@overmap-ai/core 1.2.5-install-common.0 → 1.2.5-install-common.2

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.
@@ -1,14 +1,14 @@
1
- (function(s,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("@overmap-ai/common"),require("@redux-offline/redux-offline/lib/types"),require("@reduxjs/toolkit"),require("superagent"),require("uuid"),require("react"),require("@redux-offline/redux-offline"),require("@redux-offline/redux-offline/lib/defaults"),require("localforage"),require("idb"),require("jwt-decode"),require("dependency-graph")):typeof define=="function"&&define.amd?define(["exports","@overmap-ai/common","@redux-offline/redux-offline/lib/types","@reduxjs/toolkit","superagent","uuid","react","@redux-offline/redux-offline","@redux-offline/redux-offline/lib/defaults","localforage","idb","jwt-decode","dependency-graph"],l):(s=typeof globalThis<"u"?globalThis:s||self,l(s["overmap-core"]={},s.common,null,s.toolkit,s.request,s.uuid,s.react,s.reduxOffline,s.offlineConfig,s.localforage,s.idb,s.jwtDecode,s.dependencyGraph))})(this,(function(s,l,iR,u,pt,at,cF,rF,un,dF,uF,lF,oF){"use strict";const ln=["created_at","updated_at","index","revision"];var o=(t=>(t.GET="GET",t.POST="POST",t.PATCH="PATCH",t.PUT="PUT",t.DELETE="DELETE",t))(o||{});function P(t){return{addOne:(f,A)=>{const T=t(A.payload);T in f.instances||(f.instances[T]=A.payload)},addMany:(f,A)=>{for(const T of A.payload){const S=t(T);S in f.instances||(f.instances[S]=T)}},updateOne:(f,A)=>{const T=t(A.payload);T in f.instances&&(f.instances[T]=A.payload)},setMany:(f,A)=>{for(const T of A.payload){const S=t(T);f.instances[S]=T}},setOne:(f,A)=>{const T=t(A.payload);f.instances[T]=A.payload},updateMany:(f,A)=>{for(const T of A.payload){const S=t(T);S in f.instances&&(f.instances[S]=T)}},deleteOne:(f,A)=>{delete f.instances[A.payload]},deleteMany:(f,A)=>{for(const T of A.payload)delete f.instances[T]},initialize:(f,A)=>{f.instances={};const T=new Set;for(const S of A.payload){const O=t(S);T.add(O),f.instances[O]=S}T.size!==A.payload.length&&console.warn("duplicate ids detected when initializing model instances.")}}}function hF(t){return{initializeSelection:(p,h)=>{p[t]=Array.from(new Set(h.payload))},selectOne:(p,h)=>{console.debug(p,p[t]),!new Set(p[t]).has(h.payload)&&p[t].push(h.payload)},selectMany:(p,h)=>{const f=new Set(p[t]);for(const A of h.payload)f.has(A)||f.add(A);p[t]=Array.from(f)},unselectOne:(p,h)=>{const f=new Set(p[t]);f.has(h.payload)&&(f.delete(h.payload),p[t]=Array.from(f))},unselectMany:(p,h)=>{const f=new Set(p[t]);for(const A of h.payload)f.has(A)&&f.delete(A);p[t]=Array.from(f)},toggleOne:(p,h)=>{const f=new Set(p[t]);f.has(h.payload)?f.delete(h.payload):f.add(h.payload),p[t]=Array.from(f)},toggleMany:(p,h)=>{const f=new Set(p[t]);for(const A of h.payload)f.has(A)?f.delete(A):f.add(A);p[t]=Array.from(f)}}}const I=u.createAction("RESET"),E=u.createAction("RESET_PROJECT_STATE"),b=u.createAction("RESET_ORGANIZATION_STATE");function pF(t,e){return cF.useMemo(t,e)}class yF{constructor(e){this.getData=e}operations=[];getData;performOperations(e){let i=e;for(const a of this.operations)i=a(i);return i}filter(e,i){return this.operations.push(a=>a.filter(n=>n[e]===i)),this}exclude(e,i){return this.operations.push(a=>a.filter(n=>n[e]!==i)),this}orderBy(e){return this.operations.push(i=>i.toSorted((a,n)=>a[e]<=n[e]?1:-1)),this}reverse(){return this.operations.push(e=>e.toReversed()),this}all(){return this.operations.push(e=>e),this}get(e,i){return u.createSelector([this.getData],a=>this.performOperations(a).find(n=>n[e]===i))}count(){return u.createSelector([this.getData],e=>this.performOperations(e).length)}first(){return u.createSelector([this.getData],e=>this.performOperations(e)[0])}last(){return u.createSelector([this.getData],e=>{const i=this.performOperations(e);return i[i.length-1]})}exists(){return u.createSelector([this.getData],e=>this.performOperations(e).length>0)}toSelector(){return u.createSelector([this.getData],e=>l.fallbackToEmptyArray(this.performOperations(e)))}}const y=(t=>(...e)=>i=>t(i,...e)),$=P(t=>t.uuid),on={instances:{}},ns=u.createSlice({name:"agents",initialState:on,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,on)),reducers:{initializeConversations:$.initialize,addConversation:$.addOne,addConversations:$.addMany,setConversation:$.setOne,setConversations:$.setMany,updateConversation:$.updateOne,updateConversations:$.updateMany,deleteConversation:$.deleteOne,deleteConversations:$.deleteMany}}),{initializeConversations:hn,addConversation:pn,addConversations:mF,setConversation:yn,setConversations:fF,updateConversation:mn,updateConversations:SF,deleteConversation:AF,deleteConversations:TF}=ns.actions,cs=t=>t.agentsReducer.instances,IF=u.createSelector([cs],t=>Object.values(t)),OF=y(u.createSelector([cs,(t,e)=>e],(t,e)=>t[e])),fn=ns.reducer,U=P(t=>t.uuid),Sn={instances:{}},rs=u.createSlice({name:"assetAttachments",initialState:Sn,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,Sn)),reducers:{initializeAssetAttachments:U.initialize,addAssetAttachment:U.addOne,addAssetAttachments:U.addMany,setAssetAttachment:U.setOne,setAssetAttachments:U.setMany,updateAssetAttachment:U.updateOne,updateAssetAttachments:U.updateMany,deleteAssetAttachment:U.deleteOne,deleteAssetAttachments:U.deleteMany}}),{initializeAssetAttachments:An,addAssetAttachment:Tn,addAssetAttachments:ds,setAssetAttachment:In,setAssetAttachments:On,updateAssetAttachment:Pn,updateAssetAttachments:bn,deleteAssetAttachment:Fn,deleteAssetAttachments:us}=rs.actions,_n=t=>t.assetAttachmentReducer.instances,ls=u.createSelector([_n],t=>Object.values(t)),gn=t=>e=>e.assetAttachmentReducer.instances[t],Mn=y(u.createSelector([ls,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),Rn=y(u.createSelector([ls,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(({asset:i})=>e===i)))),wn=rs.reducer,k=P(t=>t.uuid),En={instances:{}},os=u.createSlice({name:"assetComments",initialState:En,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,En)),reducers:{initializeAssetComments:k.initialize,addAssetComment:k.addOne,addAssetComments:k.addMany,setAssetComment:k.setOne,setAssetComments:k.setMany,updateAssetComment:k.updateOne,updateAssetComments:k.updateMany,deleteAssetComment:k.deleteOne,deleteAssetComments:k.deleteMany}}),{initializeAssetComments:vn,addAssetComment:Vn,addAssetComments:Bt,setAssetComment:Bn,setAssetComments:zn,updateAssetComment:jn,updateAssetComments:Dn,deleteAssetComment:qn,deleteAssetComments:zt}=os.actions,Cn=t=>t.assetCommentReducer.instances,jt=u.createSelector([Cn],t=>l.fallbackToEmptyArray(Object.values(t).toSorted(l.submittedAtModelSortFn))),$n=t=>e=>e.assetCommentReducer.instances[t],Un=y(u.createSelector([jt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),kn=y(u.createSelector([jt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.asset===e)))),Ln=y(u.createSelector([jt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(a=>i.has(a.asset)))})),Hn=os.reducer,L=P(t=>t.uuid),Gn={instances:{}},hs=u.createSlice({name:"assets",initialState:Gn,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,Gn)),reducers:{initializeAssets:L.initialize,addAsset:L.addOne,addAssets:L.addMany,setAsset:L.setOne,setAssets:L.setMany,updateAsset:L.updateOne,updateAssets:L.updateMany,deleteAsset:L.deleteOne,deleteAssets:L.deleteMany}}),{initializeAssets:Nn,addAsset:Kn,addAssets:ps,updateAsset:Wn,updateAssets:Yn,deleteAsset:Xn,deleteAssets:ys,setAsset:Zn,setAssets:Jn}=hs.actions,Qn=t=>t.assetReducer.instances,Dt=u.createSelector([Qn],t=>l.fallbackToEmptyArray(Object.values(t))),PF=y(u.createSelector([Dt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(({project:i})=>i===e)))),xn=y(u.createSelector([Dt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.asset_type===e)))),ec=t=>e=>e.assetReducer.instances[t],tc=y(u.createSelector([Dt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),sc=hs.reducer,H=P(t=>t.uuid),ic={instances:{}},ms=u.createSlice({name:"assetTypeAttachments",initialState:ic,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,ic)),reducers:{initializeAssetTypeAttachments:H.initialize,addAssetTypeAttachment:H.addOne,addAssetTypeAttachments:H.addMany,setAssetTypeAttachment:H.setOne,setAssetTypeAttachments:H.setMany,updateAssetTypeAttachment:H.updateOne,updateAssetTypeAttachments:H.updateMany,deleteAssetTypeAttachment:H.deleteOne,deleteAssetTypeAttachments:H.deleteMany}}),{initializeAssetTypeAttachments:ac,addAssetTypeAttachment:nc,addAssetTypeAttachments:fs,setAssetTypeAttachment:cc,setAssetTypeAttachments:rc,updateAssetTypeAttachment:dc,updateAssetTypeAttachments:uc,deleteAssetTypeAttachment:lc,deleteAssetTypeAttachments:Ss}=ms.actions,oc=t=>t.assetTypeAttachmentReducer.instances,As=u.createSelector([oc],t=>Object.values(t)),hc=t=>e=>e.assetTypeAttachmentReducer.instances[t],pc=y(u.createSelector([As,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),yc=y(u.createSelector([As,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(({asset_type:i})=>e===i)))),mc=ms.reducer,G=P(t=>t.uuid),fc={instances:{}},Ts=u.createSlice({name:"assetTypeFieldsAttachments",initialState:fc,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,fc)),reducers:{initializeAssetTypeFieldsAttachments:G.initialize,addAssetTypeFieldsAttachment:G.addOne,addAssetTypeFieldsAttachments:G.addMany,setAssetTypeFieldsAttachment:G.setOne,setAssetTypeFieldsAttachments:G.setMany,updateAssetTypeFieldsAttachment:G.updateOne,updateAssetTypeFieldsAttachments:G.updateMany,deleteAssetTypeFieldsAttachment:G.deleteOne,deleteAssetTypeFieldsAttachments:G.deleteMany}}),{initializeAssetTypeFieldsAttachments:Sc,addAssetTypeFieldsAttachment:Ac,addAssetTypeFieldsAttachments:Tc,setAssetTypeFieldsAttachment:Ic,setAssetTypeFieldsAttachments:Oc,updateAssetTypeFieldsAttachment:Pc,updateAssetTypeFieldsAttachments:bc,deleteAssetTypeFieldsAttachment:Fc,deleteAssetTypeFieldsAttachments:_c}=Ts.actions,gc=t=>t.assetTypeFieldsAttachmentReducer.instances,Is=u.createSelector([gc],t=>Object.values(t)),bF=y(u.createSelector([Is,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.fields_revision===e)))),Mc=t=>e=>e.assetTypeFieldsAttachmentReducer.instances[t],Rc=y(u.createSelector([Is,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),wc=Ts.reducer,N=P(t=>t.uuid),Ec={instances:{}},Os=u.createSlice({name:"assetTypeFields",initialState:Ec,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,Ec)),reducers:{initializeAssetTypeFields:N.initialize,addAssetTypeFields:N.addOne,addAssetTypeFieldsMany:N.addMany,setAssetTypeFields:N.setOne,setAssetTypeFieldsMany:N.setMany,updateAssetTypeFields:N.updateOne,updateAssetTypeFieldsMany:N.updateMany,deleteAssetTypeFields:N.deleteOne,deleteAssetTypeFieldsMany:N.deleteMany}}),{initializeAssetTypeFields:vc,addAssetTypeFields:Vc,addAssetTypeFieldsMany:Bc,setAssetTypeFields:zc,setAssetTypeFieldsMany:jc,updateAssetTypeFields:Dc,updateAssetTypeFieldsMany:qc,deleteAssetTypeFields:Cc,deleteAssetTypeFieldsMany:$c}=Os.actions,Uc=t=>t.assetTypeFieldsReducer.instances,bt=u.createSelector([Uc],t=>Object.values(t)),FF=y(u.createSelector([bt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.asset_type===e)))),_F=y(u.createSelector([bt,(t,e)=>e],(t,e)=>t.filter(i=>i.asset_type===e).toSorted(l.submittedAtModelSortFn).pop())),kc=t=>e=>e.assetTypeFieldsReducer.instances[t],Lc=y(u.createSelector([bt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),Hc=Os.reducer,K=P(t=>t.uuid),Gc={instances:{}},Ps=u.createSlice({name:"assetTypeFieldValuesAttachments",initialState:Gc,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,Gc)),reducers:{initializeAssetTypeFieldValuesAttachments:K.initialize,addAssetTypeFieldValuesAttachment:K.addOne,addAssetTypeFieldValuesAttachments:K.addMany,setAssetTypeFieldValuesAttachment:K.setOne,setAssetTypeFieldValuesAttachments:K.setMany,updateAssetTypeFieldValuesAttachment:K.updateOne,updateAssetTypeFieldValuesAttachments:K.updateMany,deleteAssetTypeFieldValuesAttachment:K.deleteOne,deleteAssetTypeFieldValuesAttachments:K.deleteMany}}),{initializeAssetTypeFieldValuesAttachments:Nc,addAssetTypeFieldValuesAttachment:Kc,addAssetTypeFieldValuesAttachments:bs,setAssetTypeFieldValuesAttachment:Wc,setAssetTypeFieldValuesAttachments:Yc,updateAssetTypeFieldValuesAttachment:Xc,updateAssetTypeFieldValuesAttachments:Zc,deleteAssetTypeFieldValuesAttachment:Jc,deleteAssetTypeFieldValuesAttachments:Fs}=Ps.actions,Qc=t=>t.assetTypeFieldValuesAttachmentReducer.instances,_s=u.createSelector([Qc],t=>Object.values(t)),xc=t=>e=>e.assetTypeFieldValuesAttachmentReducer.instances[t],er=y(u.createSelector([_s,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),tr=y(u.createSelector([_s,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.field_values===e)))),sr=Ps.reducer,W=P(t=>t.uuid),ir={instances:{}},gs=u.createSlice({name:"assetTypeFieldValues",initialState:ir,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,ir)),reducers:{initializeAssetTypeFieldValues:W.initialize,addAssetTypeFieldValues:W.addOne,addAssetTypeFieldValuesMany:W.addMany,setAssetTypeFieldValues:W.setOne,setAssetTypeFieldValuesMany:W.setMany,updateAssetTypeFieldValues:W.updateOne,updateAssetTypeFieldValuesMany:W.updateMany,deleteAssetTypeFieldValues:W.deleteOne,deleteAssetTypeFieldValuesMany:W.deleteMany}}),{initializeAssetTypeFieldValues:ar,addAssetTypeFieldValues:nr,addAssetTypeFieldValuesMany:cr,setAssetTypeFieldValues:rr,setAssetTypeFieldValuesMany:dr,updateAssetTypeFieldValues:ur,updateAssetTypeFieldValuesMany:lr,deleteAssetTypeFieldValues:or,deleteAssetTypeFieldValuesMany:hr}=gs.actions,pr=t=>t.assetTypeFieldValuesReducer.instances,qt=u.createSelector([pr],t=>Object.values(t)),gF=y(u.createSelector([qt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.asset===e)))),MF=y(u.createSelector([bt,qt,(t,e)=>e],(t,e,i)=>{const a=new Set(t.filter(n=>n.asset_type===i).map(n=>n.uuid));return l.fallbackToEmptyArray(e.filter(n=>a.has(n.fields_revision)))})),yr=t=>e=>e.assetTypeFieldValuesReducer.instances[t],mr=y(u.createSelector([qt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),fr=gs.reducer,Y=P(t=>t.uuid),Sr={instances:{}},Ms=u.createSlice({name:"assetTypeIdentifiers",initialState:Sr,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,Sr)),reducers:{initializeAssetTypeIdentifiers:Y.initialize,addAssetTypeIdentifier:Y.addOne,addAssetTypeIdentifiers:Y.addMany,setAssetTypeIdentifier:Y.setOne,setAssetTypeIdentifiers:Y.setMany,updateAssetTypeIdentifier:Y.updateOne,updateAssetTypeIdentifiers:Y.updateMany,deleteAssetTypeIdentifier:Y.deleteOne,deleteAssetTypeIdentifiers:Y.deleteMany}}),{initializeAssetTypeIdentifiers:Ar,addAssetTypeIdentifier:Tr,addAssetTypeIdentifiers:Ir,setAssetTypeIdentifier:Or,setAssetTypeIdentifiers:Pr,updateAssetTypeIdentifier:br,updateAssetTypeIdentifiers:Fr,deleteAssetTypeIdentifier:_r,deleteAssetTypeIdentifiers:gr}=Ms.actions,Mr=t=>t.assetTypeIdentifierReducer.instances,Rs=u.createSelector([Mr],t=>Object.values(t)),Rr=t=>e=>e.assetTypeIdentifierReducer.instances[t],wr=y(u.createSelector([Rs,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),RF=y(u.createSelector([Rs,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.asset_type===e)))),Er=Ms.reducer,X=P(t=>t.uuid),vr={instances:{}},ws=u.createSlice({name:"assetTypeIdentifierValues",initialState:vr,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,vr)),reducers:{initializeAssetTypeIdentifierValues:X.initialize,addAssetTypeIdentifierValue:X.addOne,addAssetTypeIdentifierValues:X.addMany,setAssetTypeIdentifierValue:X.setOne,setAssetTypeIdentifierValues:X.setMany,updateAssetTypeIdentifierValue:X.updateOne,updateAssetTypeIdentifierValues:X.updateMany,deleteAssetTypeIdentifierValue:X.deleteOne,deleteAssetTypeIdentifierValues:X.deleteMany}}),{initializeAssetTypeIdentifierValues:Vr,addAssetTypeIdentifierValue:Br,addAssetTypeIdentifierValues:zr,setAssetTypeIdentifierValue:jr,setAssetTypeIdentifierValues:Dr,updateAssetTypeIdentifierValue:qr,updateAssetTypeIdentifierValues:Cr,deleteAssetTypeIdentifierValue:$r,deleteAssetTypeIdentifierValues:Ur}=ws.actions,kr=t=>t.assetTypeIdentifierValueReducer.instances,Ct=u.createSelector([kr],t=>Object.values(t)),Lr=t=>e=>e.assetTypeIdentifierValueReducer.instances[t],Hr=y(u.createSelector([Ct,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),wF=y(u.createSelector([Ct,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.asset===e)))),EF=y(u.createSelector([Ct,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.asset_type_identifier===e)))),Gr=ws.reducer,Z=P(t=>t.uuid),Nr={instances:{}},Es=u.createSlice({name:"assetTypes",initialState:Nr,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,Nr)),reducers:{initializeAssetTypes:Z.initialize,setAssetType:Z.setOne,setAssetTypes:Z.setMany,addAssetType:Z.addOne,addAssetTypes:Z.addMany,updateAssetType:Z.updateOne,updateAssetTypes:Z.updateMany,deleteAssetType:Z.deleteOne,deleteAssetTypes:Z.deleteMany}}),{initializeAssetTypes:Kr,setAssetType:Wr,setAssetTypes:Yr,addAssetType:Xr,addAssetTypes:Zr,updateAssetType:Jr,updateAssetTypes:Qr,deleteAssetType:xr,deleteAssetTypes:ed}=Es.actions,td=t=>t.assetTypeReducer.instances,vs=u.createSelector([td],t=>Object.values(t)),sd=t=>e=>e.assetTypeReducer.instances[t],id=y(u.createSelector([vs,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),vF=y(u.createSelector([vs,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.organization===e)))),ad=Es.reducer,J=P(t=>t.uuid),nd={instances:{}},Vs=u.createSlice({name:"assetTypeStatuses",initialState:nd,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,nd)),reducers:{initializeAssetTypeStatuses:J.initialize,addAssetTypeStatus:J.addOne,addAssetTypeStatuses:J.addMany,setAssetTypeStatus:J.setOne,setAssetTypeStatuses:J.setMany,updateAssetTypeStatus:J.updateOne,updateAssetTypeStatuses:J.updateMany,deleteAssetTypeStatus:J.deleteOne,deleteAssetTypeStatuses:J.deleteMany}}),{initializeAssetTypeStatuses:cd,addAssetTypeStatus:rd,addAssetTypeStatuses:dd,setAssetTypeStatus:ud,setAssetTypeStatuses:ld,updateAssetTypeStatus:od,updateAssetTypeStatuses:hd,deleteAssetTypeStatus:pd,deleteAssetTypeStatuses:yd}=Vs.actions,md=t=>t.assetTypeStatusReducer.instances,Bs=u.createSelector([md],t=>l.fallbackToEmptyArray(Object.values(t).toSorted(l.assetTypeStatusSortFn))),fd=t=>e=>e.assetTypeStatusReducer.instances[t],Sd=y(u.createSelector([Bs,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),VF=y(u.createSelector([Bs,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.asset_type===e)))),Ad=Vs.reducer,Td={accessToken:"",refreshToken:"",isLoggedIn:!1},$t=u.createSlice({name:"auth",initialState:Td,extraReducers:t=>t.addCase(I,e=>Object.assign(e,Td)),reducers:{setTokens:(t,e)=>{t.accessToken=e.payload.accessToken,t.refreshToken=e.payload.refreshToken},clearTokens:t=>{t.accessToken="",t.refreshToken=""},setLoggedIn:(t,e)=>{e.payload||$t.caseReducers.clearTokens(t),t.isLoggedIn=e.payload}}}),{setTokens:BF,clearTokens:zF,setLoggedIn:Id}=$t.actions,jF=t=>t.authReducer.accessToken,DF=t=>t.authReducer.isLoggedIn,Od=$t.reducer,Q=P(t=>t.uuid),Pd={instances:{}},zs=u.createSlice({name:"documentAttachments",initialState:Pd,extraReducers:t=>t.addCase(I,e=>Object.assign(e,Pd)),reducers:{initializeDocumentAttachments:Q.initialize,addDocumentAttachment:Q.addOne,addDocumentAttachments:Q.addMany,setDocumentAttachment:Q.setOne,setDocumentAttachments:Q.setMany,updateDocumentAttachment:Q.updateOne,updateDocumentAttachments:Q.updateMany,deleteDocumentAttachment:Q.deleteOne,deleteDocumentAttachments:Q.deleteMany}}),{initializeDocumentAttachments:bd,addDocumentAttachment:Fd,addDocumentAttachments:_d,setDocumentAttachment:gd,setDocumentAttachments:Md,updateDocumentAttachment:Rd,updateDocumentAttachments:wd,deleteDocumentAttachment:Ed,deleteDocumentAttachments:vd}=zs.actions,Vd=t=>t.documentAttachmentReducer.instances,js=u.createSelector([Vd],t=>Object.values(t)),Bd=t=>e=>e.documentAttachmentReducer.instances[t],zd=y(u.createSelector([js,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),qF=y(u.createSelector([js,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(({document:i})=>e===i)))),jd=zs.reducer,x=P(({uuid:t})=>t),Dd={instances:{}},Ds=u.createSlice({name:"documents",initialState:Dd,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>{Object.assign(e,Dd)}),reducers:{initializeDocuments:x.initialize,addDocument:x.addOne,addDocuments:x.addMany,setDocument:x.setOne,setDocuments:x.setMany,updateDocument:x.updateOne,updateDocuments:x.updateMany,deleteDocument:x.deleteOne,deleteDocuments:x.deleteMany}}),{initializeDocuments:qd,addDocument:Cd,addDocuments:$d,setDocument:Ud,setDocuments:kd,updateDocument:Ld,updateDocuments:Hd,deleteDocument:Gd,deleteDocuments:Nd}=Ds.actions,Kd=Ds.reducer,qs=t=>t.documentsReducer.instances,Ut=u.createSelector([qs],t=>Object.values(t)),Wd=t=>e=>e.documentsReducer.instances[t],Yd=y(u.createSelector([Ut,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),CF=y(u.createSelector([Ut,(t,e)=>e],(t,e)=>t.filter(i=>i.project===e))),$F=y(u.createSelector([Ut,(t,e)=>e],(t,e)=>t.filter(i=>i.organization===e))),Xd=y(u.createSelector([qs,(t,e)=>e],(t,e)=>{if(!t[e])return l.fallbackToEmptyArray([]);const n=l.getDocumentSubTree(e,Object.values(t)).all().map(({model:c})=>c);return l.fallbackToEmptyArray(n)})),ee=P(t=>t.uuid),Zd={instances:{}},Cs=u.createSlice({name:"emailDomains",initialState:Zd,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,Zd)),reducers:{initializeEmailDomains:ee.initialize,addEmailDomain:ee.addOne,addEmailDomains:ee.addMany,setEmailDomain:ee.setOne,setEmailDomains:ee.setMany,updateEmailDomain:ee.updateOne,updateEmailDomains:ee.updateMany,deleteEmailDomain:ee.deleteOne,deleteEmailDomains:ee.deleteMany}}),{initializeEmailDomains:Jd,addEmailDomain:Qd,addEmailDomains:xd,setEmailDomain:eu,setEmailDomains:tu,updateEmailDomain:su,updateEmailDomains:iu,deleteEmailDomain:au,deleteEmailDomains:nu}=Cs.actions,cu=t=>t.emailDomainsReducer.instances,$s=u.createSelector([cu],t=>Object.values(t)),ru=t=>e=>e.emailDomainsReducer.instances[t],du=y(u.createSelector([$s,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),UF=y(u.createSelector([$s,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.organization===e)))),uu=Cs.reducer,te=P(t=>t.uuid),lu={instances:{}},Us=u.createSlice({name:"formIdentifiers",initialState:lu,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,lu)),reducers:{initializeFormIdentifiers:te.initialize,addFormIdentifier:te.addOne,addFormIdentifiers:te.addMany,setFormIdentifier:te.setOne,setFormIdentifiers:te.setMany,updateFormIdentifier:te.updateOne,updateFormIdentifiers:te.updateMany,deleteFormIdentifier:te.deleteOne,deleteFormIdentifiers:te.deleteMany}}),{initializeFormIdentifiers:ou,addFormIdentifier:hu,addFormIdentifiers:pu,setFormIdentifier:yu,setFormIdentifiers:mu,updateFormIdentifier:fu,updateFormIdentifiers:Su,deleteFormIdentifier:Au,deleteFormIdentifiers:Tu}=Us.actions,Iu=t=>t.formIdentifierReducer.instances,ks=u.createSelector([Iu],t=>Object.values(t)),Ou=t=>e=>e.formIdentifierReducer.instances[t],Pu=y(u.createSelector([ks,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),kF=y(u.createSelector([ks,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.form===e)))),bu=Us.reducer,se=P(t=>t.uuid),Fu={instances:{}},Ls=u.createSlice({name:"formIdentifierValues",initialState:Fu,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,Fu)),reducers:{initializeFormIdentifierValues:se.initialize,addFormIdentifierValue:se.addOne,addFormIdentifierValues:se.addMany,setFormIdentifierValue:se.setOne,setFormIdentifierValues:se.setMany,updateFormIdentifierValue:se.updateOne,updateFormIdentifierValues:se.updateMany,deleteFormIdentifierValue:se.deleteOne,deleteFormIdentifierValues:se.deleteMany}}),{initializeFormIdentifierValues:_u,addFormIdentifierValue:gu,addFormIdentifierValues:Mu,setFormIdentifierValue:Ru,setFormIdentifierValues:wu,updateFormIdentifierValue:Eu,updateFormIdentifierValues:vu,deleteFormIdentifierValue:Vu,deleteFormIdentifierValues:Bu}=Ls.actions,zu=t=>t.formIdentifierValueReducer.instances,kt=u.createSelector([zu],t=>Object.values(t)),ju=t=>e=>e.formIdentifierValueReducer.instances[t],Du=y(u.createSelector([kt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),LF=y(u.createSelector([kt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.form_submission===e)))),HF=y(u.createSelector([kt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.form_identifier===e)))),qu=Ls.reducer,ie=P(t=>t.uuid),Cu={instances:{}},Hs=u.createSlice({name:"formRevisionAttachments",initialState:Cu,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,Cu)),reducers:{initializeFormRevisionAttachments:ie.initialize,addFormRevisionAttachment:ie.addOne,addFormRevisionAttachments:ie.addMany,setFormRevisionAttachment:ie.setOne,setFormRevisionAttachments:ie.setMany,updateFormRevisionAttachment:ie.updateOne,updateFormRevisionAttachments:ie.updateMany,deleteFormRevisionAttachment:ie.deleteOne,deleteFormRevisionAttachments:ie.deleteMany}}),{initializeFormRevisionAttachments:$u,addFormRevisionAttachment:Uu,addFormRevisionAttachments:ku,setFormRevisionAttachment:Lu,setFormRevisionAttachments:Hu,updateFormRevisionAttachment:Gu,updateFormRevisionAttachments:Nu,deleteFormRevisionAttachment:Ku,deleteFormRevisionAttachments:Wu}=Hs.actions,Lt=t=>t.formRevisionAttachmentReducer.instances,Yu=u.createSelector([Lt],t=>Object.values(t)),Xu=y(u.createSelector([Lt,(t,e)=>e],(t,e)=>t[e])),Zu=y(u.createSelector([Yu,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),GF=y(u.createSelector([Lt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(Object.values(t).filter(i=>i.form_revision===e)))),Ju=Hs.reducer,ae=P(t=>t.uuid),Qu={instances:{}},Gs=u.createSlice({name:"formRevisions",initialState:Qu,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,Qu)),reducers:{initializeFormRevisions:ae.initialize,addFormRevision:ae.addOne,addFormRevisions:ae.addMany,setFormRevision:ae.setOne,setFormRevisions:ae.setMany,updateFormRevision:ae.updateOne,updateFormRevisions:ae.updateMany,deleteFormRevision:ae.deleteOne,deleteFormRevisions:ae.deleteMany}}),{initializeFormRevisions:xu,addFormRevision:el,addFormRevisions:Ns,setFormRevision:tl,setFormRevisions:sl,updateFormRevision:il,updateFormRevisions:al,deleteFormRevision:nl,deleteFormRevisions:Ks}=Gs.actions,cl=t=>t.formRevisionReducer.instances,Ht=u.createSelector([cl],t=>Object.values(t)),rl=t=>e=>e.formRevisionReducer.instances[t],dl=y(u.createSelector([Ht,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),NF=y(u.createSelector([Ht,(t,e)=>e],(t,e)=>t.filter(i=>i.form===e).toSorted(l.submittedAtModelSortFn).pop())),ul=y(u.createSelector([Ht,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.form===e)))),ll=Gs.reducer,ne=P(t=>t.uuid),ol={instances:{}},Ws=u.createSlice({name:"formSubscribers",initialState:ol,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,ol)),reducers:{initializeFormSubscribers:ne.initialize,addFormSubscriber:ne.addOne,addFormSubscribers:ne.addMany,setFormSubscriber:ne.setOne,setFormSubscribers:ne.setMany,updateFormSubscriber:ne.updateOne,updateFormSubscribers:ne.updateMany,deleteFormSubscriber:ne.deleteOne,deleteFormSubscribers:ne.deleteMany}}),{initializeFormSubscribers:hl,addFormSubscriber:pl,addFormSubscribers:Ys,setFormSubscriber:yl,setFormSubscribers:ml,updateFormSubscriber:fl,updateFormSubscribers:Sl,deleteFormSubscriber:Al,deleteFormSubscribers:Xs}=Ws.actions,Tl=t=>t.formSubscriberReducer.instances,Gt=u.createSelector([Tl],t=>Object.values(t)),Il=t=>e=>e.formSubscriberReducer.instances[t],Ol=y(u.createSelector([Gt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),Pl=y(u.createSelector([Gt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.form===e)))),KF=y(u.createSelector([Gt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.user===e)))),bl=Ws.reducer,ce=P(t=>t.uuid),Fl={instances:{}},Zs=u.createSlice({name:"forms",initialState:Fl,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,Fl)),reducers:{initializeForms:ce.initialize,addForm:ce.addOne,addForms:ce.addMany,setForm:ce.setOne,setForms:ce.setMany,updateForm:ce.updateOne,updateForms:ce.updateMany,deleteForm:ce.deleteOne,deleteForms:ce.deleteMany}}),{initializeForms:_l,addForm:gl,addForms:Ml,setForm:Rl,setForms:wl,updateForm:El,updateForms:vl,deleteForm:Vl,deleteForms:Bl}=Zs.actions,zl=Zs.reducer,jl=t=>t.formReducer.instances,Js=u.createSelector([jl],t=>Object.values(t)),Dl=t=>e=>e.formReducer.instances[t],ql=y(u.createSelector([Js,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),WF=y(u.createSelector([Js,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.organization===e)))),re=P(({uuid:t})=>t),Cl={instances:{}},Qs=u.createSlice({name:"formSubmissionFieldValuesAttachments",initialState:Cl,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,Cl)),reducers:{initializeFormSubmissionFieldValuesAttachments:re.initialize,addFormSubmissionFieldValuesAttachment:re.addOne,addFormSubmissionFieldValuesAttachments:re.addMany,setFormSubmissionFieldValuesAttachment:re.setOne,setFormSubmissionFieldValuesAttachments:re.setMany,updateFormSubmissionFieldValuesAttachment:re.updateOne,updateFormSubmissionFieldValuesAttachments:re.updateMany,deleteFormSubmissionFieldValuesAttachment:re.deleteOne,deleteFormSubmissionFieldValuesAttachments:re.deleteMany}}),{initializeFormSubmissionFieldValuesAttachments:$l,addFormSubmissionFieldValuesAttachment:Ul,addFormSubmissionFieldValuesAttachments:xs,setFormSubmissionFieldValuesAttachment:kl,setFormSubmissionFieldValuesAttachments:Ll,updateFormSubmissionFieldValuesAttachment:Hl,updateFormSubmissionFieldValuesAttachments:Gl,deleteFormSubmissionFieldValuesAttachment:Nl,deleteFormSubmissionFieldValuesAttachments:ei}=Qs.actions,ti=t=>t.formSubmissionFieldValuesAttachmentReducer.instances,si=u.createSelector([ti],t=>Object.values(t)),Kl=y(u.createSelector([ti,(t,e)=>e],(t,e)=>t[e])),ii=y(u.createSelector([si,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(a=>i.has(a.uuid)))})),Wl=y(u.createSelector([si,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.field_values===e)))),Yl=Qs.reducer,de=P(({uuid:t})=>t),Xl={instances:{}},ai=u.createSlice({name:"formSubmissionFieldValues",initialState:Xl,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,Xl)),reducers:{initializeFormSubmissionFieldValues:de.initialize,addFormSubmissionFieldValues:de.addOne,addFormSubmissionFieldValuesMany:de.addMany,setFormSubmissionFieldValues:de.setOne,setFormSubmissionFieldValuesMany:de.setMany,updateFormSubmissionFieldValues:de.updateOne,updateFormSubmissionFieldValuesMany:de.updateMany,deleteFormSubmissionFieldValues:de.deleteOne,deleteFormSubmissionFieldValuesMany:de.deleteMany}}),{initializeFormSubmissionFieldValues:Zl,addFormSubmissionFieldValues:Jl,addFormSubmissionFieldValuesMany:ni,setFormSubmissionFieldValues:Ql,setFormSubmissionFieldValuesMany:xl,updateFormSubmissionFieldValues:eo,updateFormSubmissionFieldValuesMany:to,deleteFormSubmissionFieldValues:so,deleteFormSubmissionFieldValuesMany:ci}=ai.actions,io=t=>t.formSubmissionFieldValuesReducer.instances,ri=u.createSelector([io],t=>Object.values(t)),ao=t=>e=>e.formSubmissionFieldValuesReducer.instances[t],no=y(u.createSelector([ri,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),co=y(u.createSelector([ri,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.form_submission===e)))),ro=ai.reducer,ue=P(t=>t.uuid),uo={instances:{}},di=u.createSlice({name:"formSubmissions",initialState:uo,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,uo)),reducers:{initializeFormSubmissions:ue.initialize,setFormSubmission:ue.setOne,setFormSubmissions:ue.setMany,addFormSubmission:ue.addOne,addFormSubmissions:ue.addMany,updateFormSubmission:ue.updateOne,updateFormSubmissions:ue.updateMany,deleteFormSubmission:ue.deleteOne,deleteFormSubmissions:ue.deleteMany}}),{initializeFormSubmissions:lo,setFormSubmission:oo,setFormSubmissions:ho,addFormSubmission:po,addFormSubmissions:nt,updateFormSubmission:yo,updateFormSubmissions:mo,deleteFormSubmission:fo,deleteFormSubmissions:ct}=di.actions,So=t=>t.formSubmissionReducer.instances,D=u.createSelector([So],t=>Object.values(t)),Ao=t=>e=>e.formSubmissionReducer.instances[t],To=y(u.createSelector([D,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),Io=y(u.createSelector([D,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.form===e)))),YF=y(u.createSelector([D,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(({organization:i})=>i===e)))),XF=y(u.createSelector([D,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(({project:i})=>i===e)))),ZF=y(u.createSelector([D,(t,e)=>e,(t,e,i)=>i],(t,e,i)=>l.fallbackToEmptyArray(t.filter(({project:a,form:n})=>a===e&&n===i)))),JF=y(u.createSelector([D,(t,e)=>e,(t,e,i)=>i],(t,e,i)=>l.fallbackToEmptyArray(t.filter(({organization:a,form:n})=>a===e&&n===i)))),Oo=y(u.createSelector([D,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(({issue:i})=>i===e)))),Po=y(u.createSelector([D,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({issue:a})=>a&&i.has(a)))})),bo=y(u.createSelector([D,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(({asset:i})=>i===e)))),Fo=y(u.createSelector([D,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({asset:a})=>a&&i.has(a)))})),_o=di.reducer,le=P(t=>t.uuid),go={instances:{}},ui=u.createSlice({name:"geoImages",initialState:go,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,go)),reducers:{initializeGeoImages:le.initialize,setGeoImage:le.setOne,setGeoImages:le.setMany,addGeoImage:le.addOne,addGeoImages:le.addMany,updateGeoImage:le.updateOne,updateGeoImages:le.updateMany,deleteGeoImage:le.deleteOne,deleteGeoImages:le.deleteMany}}),{initializeGeoImages:Mo,setGeoImage:Ro,setGeoImages:wo,addGeoImage:Eo,addGeoImages:vo,updateGeoImage:Vo,updateGeoImages:Bo,deleteGeoImage:zo,deleteGeoImages:jo}=ui.actions,Do=t=>t.geoImageReducer.instances,li=u.createSelector([Do],t=>Object.values(t)),qo=t=>e=>e.geoImageReducer.instances[t],Co=y(u.createSelector([li,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),QF=y(u.createSelector([li,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.project===e)))),$o=ui.reducer,oe=P(t=>t.uuid),Uo={instances:{}},oi=u.createSlice({name:"issueAssociations",initialState:Uo,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,Uo)),reducers:{initializeIssueAssociations:oe.initialize,addIssueAssociation:oe.addOne,addIssueAssociations:oe.addMany,setIssueAssociation:oe.setOne,setIssueAssociations:oe.setMany,updateIssueAssociation:oe.updateOne,updateIssueAssociations:oe.updateMany,deleteIssueAssociation:oe.deleteOne,deleteIssueAssociations:oe.deleteMany}}),{initializeIssueAssociations:ko,setIssueAssociations:Lo,setIssueAssociation:Ho,updateIssueAssociation:Go,updateIssueAssociations:No,addIssueAssociation:Ko,addIssueAssociations:yt,deleteIssueAssociation:Wo,deleteIssueAssociations:mt}=oi.actions,Yo=t=>t.issueAssociationReducer.instances,ft=u.createSelector([Yo],t=>Object.values(t)),Xo=t=>e=>e.issueAssociationReducer.instances[t],Zo=y(u.createSelector([ft,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),Jo=y(u.createSelector([ft,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({issue:a})=>i.has(a)))})),Qo=y(u.createSelector([ft,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(({issue:i})=>i===e)))),xo=y(u.createSelector([ft,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(({asset:i})=>i===e)))),eh=y(u.createSelector([ft,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({asset:a})=>i.has(a)))})),th=oi.reducer,he=P(t=>t.uuid),sh={instances:{}},hi=u.createSlice({name:"issueAttachments",initialState:sh,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,sh)),reducers:{initializeIssueAttachments:he.initialize,addIssueAttachment:he.addOne,addIssueAttachments:he.addMany,setIssueAttachment:he.setOne,setIssueAttachments:he.setMany,updateIssueAttachment:he.updateOne,updateIssueAttachments:he.updateMany,deleteIssueAttachment:he.deleteOne,deleteIssueAttachments:he.deleteMany}}),{initializeIssueAttachments:ih,addIssueAttachment:ah,addIssueAttachments:pi,setIssueAttachment:nh,setIssueAttachments:ch,updateIssueAttachment:rh,updateIssueAttachments:dh,deleteIssueAttachment:uh,deleteIssueAttachments:yi}=hi.actions,lh=t=>t.issueAttachmentReducer.instances,mi=u.createSelector([lh],t=>Object.values(t)),oh=y(u.createSelector([mi,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(({issue:i})=>e===i)))),hh=t=>e=>e.issueAttachmentReducer.instances[t],ph=y(u.createSelector([mi,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),yh=hi.reducer,pe=P(t=>t.uuid),mh={instances:{}},fi=u.createSlice({name:"issueCommentAttachments",initialState:mh,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,mh)),reducers:{initializeIssueCommentAttachments:pe.initialize,addIssueCommentAttachment:pe.addOne,addIssueCommentAttachments:pe.addMany,setIssueCommentAttachment:pe.setOne,setIssueCommentAttachments:pe.setMany,updateIssueCommentAttachment:pe.updateOne,updateIssueCommentAttachments:pe.updateMany,deleteIssueCommentAttachment:pe.deleteOne,deleteIssueCommentAttachments:pe.deleteMany}}),{initializeIssueCommentAttachments:fh,addIssueCommentAttachment:Sh,addIssueCommentAttachments:Ah,setIssueCommentAttachment:Th,setIssueCommentAttachments:Ih,updateIssueCommentAttachment:Oh,updateIssueCommentAttachments:Ph,deleteIssueCommentAttachment:bh,deleteIssueCommentAttachments:Fh}=fi.actions,_h=t=>t.issueCommentAttachmentReducer.instances,Si=u.createSelector([_h],t=>Object.values(t)),gh=t=>e=>e.issueCommentAttachmentReducer.instances[t],Mh=y(u.createSelector([Si,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),xF=y(u.createSelector([Si,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(({issue_comment:i})=>e===i)))),Rh=fi.reducer,ye=P(t=>t.uuid),wh={instances:{}},Ai=u.createSlice({name:"issueComments",initialState:wh,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,wh)),reducers:{initializeIssueComments:ye.initialize,addIssueComment:ye.addOne,addIssueComments:ye.addMany,setIssueComment:ye.setOne,setIssueComments:ye.setMany,updateIssueComment:ye.updateOne,updateIssueComments:ye.updateMany,deleteIssueComment:ye.deleteOne,deleteIssueComments:ye.deleteMany}}),{initializeIssueComments:Eh,addIssueComment:vh,addIssueComments:Vh,setIssueComment:Bh,setIssueComments:zh,updateIssueComment:jh,updateIssueComments:Dh,deleteIssueComment:qh,deleteIssueComments:Ch}=Ai.actions,Ti=t=>t.issueCommentReducer.instances,$h=t=>e=>e.issueCommentReducer.instances[t],Uh=y(u.createSelector([Ti,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(Object.values(t).filter(({uuid:a})=>i.has(a)))})),e_=y(u.createSelector([Ti,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(Object.values(t).filter(i=>i.issue===e)))),kh=Ai.reducer,me=P(t=>t.uuid),Lh={instances:{}},Ii=u.createSlice({name:"issues",initialState:Lh,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,Lh)),reducers:{initializeIssues:me.initialize,addIssue:me.addOne,addIssues:me.addMany,setIssue:me.setOne,setIssues:me.setMany,updateIssue:me.updateOne,updateIssues:me.updateMany,deleteIssue:me.deleteOne,deleteIssues:me.deleteMany}}),{initializeIssues:Hh,addIssue:Gh,addIssues:Oi,setIssue:Nh,setIssues:Kh,updateIssue:Wh,updateIssues:Yh,deleteIssue:Xh,deleteIssues:Pi}=Ii.actions,Zh=t=>t.issueReducer.instances,Nt=u.createSelector([Zh],t=>Object.values(t)),Jh=t=>e=>e.issueReducer.instances[t],Qh=y(u.createSelector([Nt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),t_=y(u.createSelector([Nt,(t,e)=>e],(t,e)=>t.filter(i=>i.project===e))),xh=y(u.createSelector([Nt,(t,e)=>e],(t,e)=>t.filter(i=>i.issue_type===e))),ep=Ii.reducer,fe=P(t=>t.uuid),tp={instances:{}},bi=u.createSlice({name:"issueTypeAttachments",initialState:tp,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,tp)),reducers:{initializeIssueTypeAttachments:fe.initialize,addIssueTypeAttachment:fe.addOne,addIssueTypeAttachments:fe.addMany,setIssueTypeAttachment:fe.setOne,setIssueTypeAttachments:fe.setMany,updateIssueTypeAttachment:fe.updateOne,updateIssueTypeAttachments:fe.updateMany,deleteIssueTypeAttachment:fe.deleteOne,deleteIssueTypeAttachments:fe.deleteMany}}),{initializeIssueTypeAttachments:sp,addIssueTypeAttachment:ip,addIssueTypeAttachments:ap,setIssueTypeAttachment:np,setIssueTypeAttachments:cp,updateIssueTypeAttachment:rp,updateIssueTypeAttachments:dp,deleteIssueTypeAttachment:up,deleteIssueTypeAttachments:lp}=bi.actions,op=t=>t.issueTypeAttachmentReducer.instances,Fi=u.createSelector([op],t=>Object.values(t)),hp=t=>e=>e.issueTypeAttachmentReducer.instances[t],pp=y(u.createSelector([Fi,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),s_=y(u.createSelector([Fi,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(({issue_type:i})=>e===i)))),yp=bi.reducer,Se=P(t=>t.uuid),mp={instances:{}},_i=u.createSlice({name:"issueTypeFieldsAttachments",initialState:mp,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,mp)),reducers:{initializeIssueTypeFieldsAttachments:Se.initialize,addIssueTypeFieldsAttachment:Se.addOne,addIssueTypeFieldsAttachments:Se.addMany,setIssueTypeFieldsAttachment:Se.setOne,setIssueTypeFieldsAttachments:Se.setMany,updateIssueTypeFieldsAttachment:Se.updateOne,updateIssueTypeFieldsAttachments:Se.updateMany,deleteIssueTypeFieldsAttachment:Se.deleteOne,deleteIssueTypeFieldsAttachments:Se.deleteMany}}),{initializeIssueTypeFieldsAttachments:fp,addIssueTypeFieldsAttachment:Sp,addIssueTypeFieldsAttachments:Ap,setIssueTypeFieldsAttachment:Tp,setIssueTypeFieldsAttachments:Ip,updateIssueTypeFieldsAttachment:Op,updateIssueTypeFieldsAttachments:Pp,deleteIssueTypeFieldsAttachment:bp,deleteIssueTypeFieldsAttachments:Fp}=_i.actions,_p=t=>t.issueTypeFieldsAttachmentReducer.instances,gi=u.createSelector([_p],t=>Object.values(t)),i_=y(u.createSelector([gi,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.fields_revision===e)))),gp=t=>e=>e.issueTypeFieldsAttachmentReducer.instances[t],Mp=y(u.createSelector([gi,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),Rp=_i.reducer,Ae=P(t=>t.uuid),wp={instances:{}},Mi=u.createSlice({name:"issueTypeFieldValues",initialState:wp,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,wp)),reducers:{initializeIssueTypeFieldValues:Ae.initialize,addIssueTypeFieldValues:Ae.addOne,addIssueTypeFieldValuesMany:Ae.addMany,setIssueTypeFieldValues:Ae.setOne,setIssueTypeFieldValuesMany:Ae.setMany,updateIssueTypeFieldValues:Ae.updateOne,updateIssueTypeFieldValuesMany:Ae.updateMany,deleteIssueTypeFieldValues:Ae.deleteOne,deleteIssueTypeFieldValuesMany:Ae.deleteMany}}),{initializeIssueTypeFieldValues:Ep,addIssueTypeFieldValues:vp,addIssueTypeFieldValuesMany:Vp,setIssueTypeFieldValues:Bp,setIssueTypeFieldValuesMany:zp,updateIssueTypeFieldValues:jp,updateIssueTypeFieldValuesMany:Dp,deleteIssueTypeFieldValues:qp,deleteIssueTypeFieldValuesMany:Cp}=Mi.actions,$p=t=>t.issueTypeFieldValuesReducer.instances,Kt=u.createSelector([$p],t=>Object.values(t)),a_=y(u.createSelector([Kt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.issue===e)))),Up=t=>e=>e.issueTypeFieldValuesReducer.instances[t],kp=y(u.createSelector([Kt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),Lp=Mi.reducer,Te=P(t=>t.uuid),Hp={instances:{}},Ri=u.createSlice({name:"issueTypeFields",initialState:Hp,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,Hp)),reducers:{initializeIssueTypeFields:Te.initialize,addIssueTypeFields:Te.addOne,addIssueTypeFieldsMany:Te.addMany,setIssueTypeFields:Te.setOne,setIssueTypeFieldsMany:Te.setMany,updateIssueTypeFields:Te.updateOne,updateIssueTypeFieldsMany:Te.updateMany,deleteIssueTypeFields:Te.deleteOne,deleteIssueTypeFieldsMany:Te.deleteMany}}),{initializeIssueTypeFields:Gp,addIssueTypeFields:Np,addIssueTypeFieldsMany:Kp,setIssueTypeFields:Wp,setIssueTypeFieldsMany:Yp,updateIssueTypeFields:Xp,updateIssueTypeFieldsMany:Zp,deleteIssueTypeFields:Jp,deleteIssueTypeFieldsMany:Qp}=Ri.actions,xp=t=>t.issueTypeFieldsReducer.instances,Ft=u.createSelector([xp],t=>Object.values(t)),n_=y(u.createSelector([Ft,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.issue_type===e)))),c_=y(u.createSelector([Ft,(t,e)=>e],(t,e)=>t.filter(i=>i.issue_type===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),r_=y(u.createSelector([Ft,Kt,(t,e)=>e],(t,e,i)=>{const a=new Set(t.filter(n=>n.issue_type===i).map(n=>n.uuid));return l.fallbackToEmptyArray(e.filter(n=>a.has(n.fields_revision)))})),ey=t=>e=>e.issueTypeFieldsReducer.instances[t],ty=y(u.createSelector([Ft,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),sy=Ri.reducer,Ie=P(t=>t.uuid),iy={instances:{}},wi=u.createSlice({name:"issueTypeFieldValuesAttachments",initialState:iy,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,iy)),reducers:{initializeIssueTypeFieldValuesAttachments:Ie.initialize,addIssueTypeFieldValuesAttachment:Ie.addOne,addIssueTypeFieldValuesAttachments:Ie.addMany,setIssueTypeFieldValuesAttachment:Ie.setOne,setIssueTypeFieldValuesAttachments:Ie.setMany,updateIssueTypeFieldValuesAttachment:Ie.updateOne,updateIssueTypeFieldValuesAttachments:Ie.updateMany,deleteIssueTypeFieldValuesAttachment:Ie.deleteOne,deleteIssueTypeFieldValuesAttachments:Ie.deleteMany}}),{initializeIssueTypeFieldValuesAttachments:ay,addIssueTypeFieldValuesAttachment:ny,addIssueTypeFieldValuesAttachments:Ei,setIssueTypeFieldValuesAttachment:cy,setIssueTypeFieldValuesAttachments:ry,updateIssueTypeFieldValuesAttachment:dy,updateIssueTypeFieldValuesAttachments:uy,deleteIssueTypeFieldValuesAttachment:ly,deleteIssueTypeFieldValuesAttachments:vi}=wi.actions,oy=t=>t.issueTypeFieldValuesAttachmentReducer.instances,Vi=u.createSelector([oy],t=>Object.values(t)),hy=t=>e=>e.issueTypeFieldValuesAttachmentReducer.instances[t],py=y(u.createSelector([Vi,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),yy=y(u.createSelector([Vi,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.field_values===e)))),my=wi.reducer,Oe=P(t=>t.uuid),fy={instances:{}},Bi=u.createSlice({name:"issueTypeIdentifiers",initialState:fy,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,fy)),reducers:{initializeIssueTypeIdentifiers:Oe.initialize,addIssueTypeIdentifier:Oe.addOne,addIssueTypeIdentifiers:Oe.addMany,setIssueTypeIdentifier:Oe.setOne,setIssueTypeIdentifiers:Oe.setMany,updateIssueTypeIdentifier:Oe.updateOne,updateIssueTypeIdentifiers:Oe.updateMany,deleteIssueTypeIdentifier:Oe.deleteOne,deleteIssueTypeIdentifiers:Oe.deleteMany}}),{initializeIssueTypeIdentifiers:Sy,addIssueTypeIdentifier:Ay,addIssueTypeIdentifiers:Ty,setIssueTypeIdentifier:Iy,setIssueTypeIdentifiers:Oy,updateIssueTypeIdentifier:Py,updateIssueTypeIdentifiers:by,deleteIssueTypeIdentifier:Fy,deleteIssueTypeIdentifiers:_y}=Bi.actions,gy=t=>t.issueTypeIdentifierReducer.instances,zi=u.createSelector([gy],t=>Object.values(t)),My=t=>e=>e.issueTypeIdentifierReducer.instances[t],Ry=y(u.createSelector([zi,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),d_=y(u.createSelector([zi,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.issue_type===e)))),wy=Bi.reducer,Pe=P(t=>t.uuid),Ey={instances:{}},ji=u.createSlice({name:"issueTypeIdentifierValues",initialState:Ey,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,Ey)),reducers:{initializeIssueTypeIdentifierValues:Pe.initialize,addIssueTypeIdentifierValue:Pe.addOne,addIssueTypeIdentifierValues:Pe.addMany,setIssueTypeIdentifierValue:Pe.setOne,setIssueTypeIdentifierValues:Pe.setMany,updateIssueTypeIdentifierValue:Pe.updateOne,updateIssueTypeIdentifierValues:Pe.updateMany,deleteIssueTypeIdentifierValue:Pe.deleteOne,deleteIssueTypeIdentifierValues:Pe.deleteMany}}),{initializeIssueTypeIdentifierValues:vy,addIssueTypeIdentifierValue:Vy,addIssueTypeIdentifierValues:By,setIssueTypeIdentifierValue:zy,setIssueTypeIdentifierValues:jy,updateIssueTypeIdentifierValue:Dy,updateIssueTypeIdentifierValues:qy,deleteIssueTypeIdentifierValue:Cy,deleteIssueTypeIdentifierValues:$y}=ji.actions,Uy=t=>t.issueTypeIdentifierValueReducer.instances,Wt=u.createSelector([Uy],t=>Object.values(t)),ky=t=>e=>e.issueTypeIdentifierValueReducer.instances[t],Ly=y(u.createSelector([Wt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),u_=y(u.createSelector([Wt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.issue===e)))),l_=y(u.createSelector([Wt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.issue_type_identifier===e)))),Hy=ji.reducer,be=P(t=>t.uuid),Gy={instances:{}},Di=u.createSlice({name:"issueTypePriorities",initialState:Gy,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,Gy)),reducers:{initializeIssueTypePriorities:be.initialize,addIssueTypePriority:be.addOne,addIssueTypePriorities:be.addMany,setIssueTypePriority:be.setOne,setIssueTypePriorities:be.setMany,updateIssueTypePriority:be.updateOne,updateIssueTypePriorities:be.updateMany,deleteIssueTypePriority:be.deleteOne,deleteIssueTypePriorities:be.deleteMany}}),{initializeIssueTypePriorities:Ny,addIssueTypePriority:Ky,addIssueTypePriorities:Wy,setIssueTypePriority:Yy,setIssueTypePriorities:Xy,updateIssueTypePriority:Zy,updateIssueTypePriorities:Jy,deleteIssueTypePriority:Qy,deleteIssueTypePriorities:xy}=Di.actions,em=t=>t.issueTypePriorityReducer.instances,qi=u.createSelector([em],t=>l.fallbackToEmptyArray(Object.values(t).toSorted(l.issueTypePrioritySortFn))),Ci=t=>e=>e.issueTypePriorityReducer.instances[t],tm=y(u.createSelector([qi,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),o_=y(u.createSelector([qi,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.issue_type===e)))),sm=Di.reducer,Fe=P(t=>t.uuid),im={instances:{}},$i=u.createSlice({name:"issueTypes",initialState:im,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,im)),reducers:{initializeIssueTypes:Fe.initialize,addIssueType:Fe.addOne,addIssueTypes:Fe.addMany,setIssueType:Fe.setOne,setIssueTypes:Fe.setMany,updateIssueType:Fe.updateOne,updateIssueTypes:Fe.updateMany,deleteIssueType:Fe.deleteOne,deleteIssueTypes:Fe.deleteMany}}),{initializeIssueTypes:am,addIssueType:nm,addIssueTypes:cm,setIssueType:rm,setIssueTypes:dm,updateIssueType:um,updateIssueTypes:lm,deleteIssueType:om,deleteIssueTypes:hm}=$i.actions,pm=t=>t.issueTypeReducer.instances,Ui=u.createSelector(pm,t=>Object.values(t)),ym=t=>e=>e.issueTypeReducer.instances[t],mm=y(u.createSelector([Ui,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),h_=y(u.createSelector([Ui,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.organization===e)))),fm=$i.reducer,_e=P(t=>t.uuid),Sm={instances:{}},ki=u.createSlice({name:"issueTypeStatuses",initialState:Sm,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,Sm)),reducers:{initializeIssueTypeStatuses:_e.initialize,addIssueTypeStatus:_e.addOne,addIssueTypeStatuses:_e.addMany,setIssueTypeStatus:_e.setOne,setIssueTypeStatuses:_e.setMany,updateIssueTypeStatus:_e.updateOne,updateIssueTypeStatuses:_e.updateMany,deleteIssueTypeStatus:_e.deleteOne,deleteIssueTypeStatuses:_e.deleteMany}}),{initializeIssueTypeStatuses:Am,addIssueTypeStatus:Tm,addIssueTypeStatuses:Im,setIssueTypeStatus:Om,setIssueTypeStatuses:Pm,updateIssueTypeStatus:bm,updateIssueTypeStatuses:Fm,deleteIssueTypeStatus:_m,deleteIssueTypeStatuses:gm}=ki.actions,Mm=t=>t.issueTypeStatusReducer.instances,Li=u.createSelector([Mm],t=>l.fallbackToEmptyArray(Object.values(t).toSorted(l.issueTypeStatusSortFn))),Hi=t=>e=>e.issueTypeStatusReducer.instances[t],Rm=y(u.createSelector([Li,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),p_=y(u.createSelector([Li,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.issue_type===e)))),wm=ki.reducer,ge=P(t=>t.uuid),Em={instances:{}},Gi=u.createSlice({name:"issueUpdates",initialState:Em,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,Em)),reducers:{initializeIssueUpdates:ge.initialize,addIssueUpdate:ge.addOne,addIssueUpdates:ge.addMany,setIssueUpdate:ge.setOne,setIssueUpdates:ge.setMany,updateIssueUpdate:ge.updateOne,updateIssueUpdates:ge.updateMany,deleteIssueUpdate:ge.deleteOne,deleteIssueUpdates:ge.deleteMany}}),{initializeIssueUpdates:vm,addIssueUpdate:Ni,addIssueUpdates:Ki,setIssueUpdate:Vm,setIssueUpdates:Bm,updateIssueUpdate:zm,updateIssueUpdates:jm,deleteIssueUpdate:Wi,deleteIssueUpdates:Yi}=Gi.actions,Xi=t=>t.issueUpdateReducer.instances,Zi=u.createSelector([Xi],t=>Object.values(t)),Dm=y(u.createSelector([Xi,(t,e)=>e],(t,e)=>t[e])),qm=y(u.createSelector([Zi,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),Cm=y(u.createSelector([Zi,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.issue===e)))),$m=Gi.reducer,Me=P(t=>t.id),Um={instances:{},currentUser:null},Ji=u.createSlice({name:"users",initialState:Um,extraReducers:t=>t.addCase(I,e=>Object.assign(e,Um)).addCase(b,e=>Object.assign(e,{...e,instances:[]})),reducers:{initializeUsers:Me.initialize,setUsers:Me.setMany,setUser:Me.setOne,addUsers:Me.addMany,addUser:Me.addOne,updateUsers:Me.updateMany,updateUser:Me.updateOne,deleteUser:Me.deleteOne,deleteUsers:Me.deleteMany,setCurrentUser:(t,e)=>{t.currentUser=e.payload},setCurrentUserProfile:(t,e)=>{if(!t.currentUser)return;t.currentUser.profile=e.payload;const i=t.instances[t.currentUser.id];if(!i)throw new Error("Unable to find current user in users slice");i.profile=e.payload}}}),{initializeUsers:km,setUsers:Lm,setUser:Hm,addUsers:Gm,addUser:Qi,updateUsers:Nm,updateUser:Km,deleteUser:xi,deleteUsers:Wm,setCurrentUser:y_,setCurrentUserProfile:m_}=Ji.actions,Ym=Ji.reducer,Xm=t=>t.userReducer.currentUser,ea=t=>t.userReducer.instances,Yt=u.createSelector([ea],t=>Object.values(t)),Xt=t=>e=>e.userReducer.instances[t],Zm=y(u.createSelector([Yt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({id:a})=>i.has(a)))})),Re=P(t=>t.uuid),Jm={instances:{}},ta=u.createSlice({name:"organizationAccess",initialState:Jm,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,Jm)),reducers:{initializeOrganizationAccesses:Re.initialize,addOrganizationAccess:Re.addOne,addOrganizationAccesses:Re.addMany,setOrganizationAccess:Re.setOne,setOrganizationAccesses:Re.setMany,updateOrganizationAccess:Re.updateOne,updateOrganizationAccesses:Re.updateMany,deleteOrganizationAccess:Re.deleteOne,deleteOrganizationAccesses:Re.deleteMany}}),{initializeOrganizationAccesses:Qm,addOrganizationAccess:xm,addOrganizationAccesses:ef,setOrganizationAccess:tf,setOrganizationAccesses:sf,updateOrganizationAccess:af,updateOrganizationAccesses:nf,deleteOrganizationAccess:cf,deleteOrganizationAccesses:rf}=ta.actions,df=ta.reducer,Zt=t=>t.organizationAccessReducer.instances,uf=t=>e=>e.organizationAccessReducer.instances[t],lf=y(u.createSelector([Zt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(Object.values(t).filter(({uuid:a})=>i.has(a)))})),f_=u.createSelector([Xm,Zt],(t,e)=>Object.values(e).find(a=>a.user===t?.id)??null),of=u.createSelector([Zt],t=>{const e={};for(const i of Object.values(t))e[i.user]=i;return l.fallbackToEmptyObject(e)}),S_=y(u.createSelector([ea,of,(t,e)=>e],(t,e,i)=>l.fallbackToEmptyArray(Object.values(t).filter(a=>{const n=e[a.id];return!!n&&n.organization===i})))),we=P(t=>t.uuid),hf={instances:{}},sa=u.createSlice({name:"organizations",initialState:hf,extraReducers:t=>t.addMatcher(u.isAnyOf(I),e=>Object.assign(e,hf)),reducers:{initializeOrganizations:we.initialize,setOrganizations:we.setMany,setOrganization:we.setOne,addOrganizations:we.addMany,addOrganization:we.addOne,updateOrganizations:we.updateMany,updateOrganization:we.updateOne,deleteOrganization:we.deleteOne,deleteOrganizations:we.deleteMany}}),{initializeOrganizations:pf,setOrganizations:yf,setOrganization:mf,addOrganizations:ff,addOrganization:Sf,updateOrganizations:Af,updateOrganization:Tf,deleteOrganization:If,deleteOrganizations:Of}=sa.actions,Pf=t=>t.organizationReducer.instances,bf=u.createSelector([Pf],t=>Object.values(t)),Ff=t=>e=>e.organizationReducer.instances[t],_f=y(u.createSelector([bf,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),gf=sa.reducer,Mf=(t,e,i)=>{const a=t.uuid?t:{...t,uuid:at.v4()};return{payload:a,type:"",meta:{offline:{effect:{timestamp:new Date().toISOString(),request:a,BASE_URL:e,serviceName:i}}}}},Rf={deletedRequests:[],latestRetryTime:0},ia=u.createSlice({name:"outbox",initialState:Rf,extraReducers:t=>t.addCase(I,e=>Object.assign(e,Rf)),reducers:{enqueueRequest:{reducer:(t,e)=>t,prepare:t=>{console.debug("Preparing to enqueue request",t.url);const{BASE_URL:e,serviceName:i,...a}=t;return Mf(a,e,i)}},markForDeletion(t,e){t.deletedRequests.push(e.payload)},markAsDeleted(t,e){const i=t.deletedRequests.indexOf(e.payload);i!==-1&&t.deletedRequests.splice(i,1)},_setLatestRetryTime:(t,e)=>{t.latestRetryTime=e.payload}}}),A_=t=>t.outboxReducer.deletedRequests,T_=t=>t.outboxReducer.latestRetryTime,{enqueueRequest:wf,markForDeletion:I_,markAsDeleted:Ef,_setLatestRetryTime:vf}=ia.actions,Vf=ia.reducer,Ee=P(t=>t.uuid),Bf={instances:{}},aa=u.createSlice({name:"projectAccess",initialState:Bf,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,Bf)),reducers:{initializeProjectAccesses:Ee.initialize,addProjectAccess:Ee.addOne,addProjectAccesses:Ee.addMany,setProjectAccess:Ee.setOne,setProjectAccesses:Ee.setMany,updateProjectAccess:Ee.updateOne,updateProjectAccesses:Ee.updateMany,deleteProjectAccess:Ee.deleteOne,deleteProjectAccesses:Ee.deleteMany}}),{initializeProjectAccesses:zf,addProjectAccess:jf,addProjectAccesses:Df,setProjectAccess:qf,setProjectAccesses:Cf,updateProjectAccess:$f,updateProjectAccesses:Uf,deleteProjectAccess:kf,deleteProjectAccesses:Lf}=aa.actions,Hf=aa.reducer,na=t=>t.projectAccessReducer.instances,_t=u.createSelector(na,t=>Object.values(t)),Gf=t=>e=>e.projectAccessReducer.instances[t],Nf=y(u.createSelector([_t,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),O_=y(u.createSelector([na,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(Object.values(t).filter(i=>i.project===e)))),P_=y(u.createSelector([_t,(t,e)=>e],(t,e)=>{const i={};for(const a of t.filter(n=>n.project===e))i[a.user]=a;return i})),b_=y(u.createSelector([Yt,_t,(t,e)=>e],(t,e,i)=>{const a=new Set(e.filter(n=>n.project===i).map(n=>n.user));return l.fallbackToEmptyArray(t.filter(n=>a.has(n.id)))})),ve=P(t=>t.uuid),Kf={instances:{}},ca=u.createSlice({name:"projectAttachments",initialState:Kf,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,Kf)),reducers:{initializeProjectAttachments:ve.initialize,addProjectAttachment:ve.addOne,addProjectAttachments:ve.addMany,setProjectAttachment:ve.setOne,setProjectAttachments:ve.setMany,updateProjectAttachment:ve.updateOne,updateProjectAttachments:ve.updateMany,deleteProjectAttachment:ve.deleteOne,deleteProjectAttachments:ve.deleteMany}}),{initializeProjectAttachments:Wf,addProjectAttachment:Yf,addProjectAttachments:Xf,setProjectAttachment:Zf,setProjectAttachments:Jf,updateProjectAttachment:Qf,updateProjectAttachments:xf,deleteProjectAttachment:eS,deleteProjectAttachments:tS}=ca.actions,sS=t=>t.projectAttachmentReducer.instances,ra=u.createSelector([sS],t=>Object.values(t)),iS=t=>e=>e.projectAttachmentReducer.instances[t],aS=y(u.createSelector([ra,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),F_=y(u.createSelector([ra,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(({project:i})=>e===i)))),nS=ca.reducer,Ve=P(t=>t.uuid),cS={instances:{}},da=u.createSlice({name:"projectComments",initialState:cS,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,cS)),reducers:{initializeProjectComments:Ve.initialize,addProjectComment:Ve.addOne,addProjectComments:Ve.addMany,setProjectComment:Ve.setOne,setProjectComments:Ve.setMany,updateProjectComment:Ve.updateOne,updateProjectComments:Ve.updateMany,deleteProjectComment:Ve.deleteOne,deleteProjectComments:Ve.deleteMany}}),{initializeProjectComments:rS,addProjectComment:dS,addProjectComments:uS,setProjectComment:lS,setProjectComments:oS,updateProjectComment:hS,updateProjectComments:pS,deleteProjectComment:yS,deleteProjectComments:mS}=da.actions,fS=t=>t.projectCommentReducer.instances,Jt=u.createSelector([fS],t=>l.fallbackToEmptyArray(Object.values(t).toSorted(l.submittedAtModelSortFn))),SS=t=>e=>e.projectCommentReducer.instances[t],AS=y(u.createSelector([Jt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),__=y(u.createSelector([Jt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.project===e)))),g_=y(u.createSelector([Jt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(a=>i.has(a.project)))})),TS=da.reducer,Be=P(t=>t.uuid),IS={instances:{}},ua=u.createSlice({name:"projectFiles",initialState:IS,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,IS)),reducers:{initializeProjectFiles:Be.initialize,setProjectFile:Be.setOne,setProjectFiles:Be.setMany,addProjectFile:Be.addOne,addProjectFiles:Be.addMany,updateProjectFile:Be.updateOne,updateProjectFiles:Be.updateMany,deleteProjectFile:Be.deleteOne,deleteProjectFiles:Be.deleteMany}}),{initializeProjectFiles:OS,setProjectFile:PS,setProjectFiles:bS,addProjectFile:FS,addProjectFiles:_S,updateProjectFile:gS,updateProjectFiles:MS,deleteProjectFile:RS,deleteProjectFiles:wS}=ua.actions,ES=t=>t.projectFileReducer.instances,vS=u.createSelector([ES],t=>l.fallbackToEmptyArray(Object.values(t).toSorted((e,i)=>e.z_index-i.z_index))),VS=t=>e=>e.projectFileReducer.instances[t],BS=y(u.createSelector([vS,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),zS=ua.reducer,ze=P(t=>t.uuid),jS={instances:{}},la=u.createSlice({name:"projects",initialState:jS,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,jS)),reducers:{initializeProjects:ze.initialize,setProjects:ze.setMany,setProject:ze.setOne,addProjects:ze.addMany,addProject:ze.addOne,updateProjects:ze.updateMany,updateProject:ze.updateOne,deleteProject:ze.deleteOne,deleteProjects:ze.deleteMany}}),{initializeProjects:DS,setProjects:qS,setProject:CS,addProjects:$S,addProject:US,updateProjects:kS,updateProject:LS,deleteProject:HS,deleteProjects:GS}=la.actions,NS=la.reducer,KS=t=>t.projectReducer.instances,Qt=u.createSelector([KS],t=>Object.values(t)),WS=t=>e=>e.projectReducer.instances[t],YS=y(u.createSelector([Qt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),M_=y(u.createSelector([Qt,_t,(t,e)=>e],(t,e,i)=>{const a=new Set(e.filter(n=>n.user===i).map(n=>n.project));return l.fallbackToEmptyArray(t.filter(n=>a.has(n.uuid)))})),R_=y(u.createSelector([Qt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.organization===e)))),je=P(({uuid:t})=>t),XS={instances:{}},oa=u.createSlice({name:"procedureInitiatives",initialState:XS,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,XS)),reducers:{initializeProcedureInitiatives:je.initialize,addProcedureInitiative:je.addOne,addProcedureInitiatives:je.addMany,setProcedureInitiative:je.setOne,setProcedureInitiatives:je.setMany,updateProcedureInitiative:je.updateOne,updateProcedureInitiatives:je.updateMany,deleteProcedureInitiative:je.deleteOne,deleteProcedureInitiatives:je.deleteMany}}),{initializeProcedureInitiatives:ZS,addProcedureInitiative:JS,addProcedureInitiatives:QS,setProcedureInitiative:xS,setProcedureInitiatives:eA,updateProcedureInitiative:tA,updateProcedureInitiatives:sA,deleteProcedureInitiative:iA,deleteProcedureInitiatives:aA}=oa.actions,nA=oa.reducer,cA=t=>t.procedureInitiativeReducer.instances,xt=u.createSelector([cA],t=>Object.values(t)),rA=t=>e=>e.procedureInitiativeReducer.instances[t],dA=y(u.createSelector([xt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),w_=y(u.createSelector([xt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.project===e)))),E_=y(u.createSelector([xt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure_type===e)))),De=P(({uuid:t})=>t),uA={instances:{}},ha=u.createSlice({name:"procedures",initialState:uA,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,uA)),reducers:{initializeProcedures:De.initialize,addProcedure:De.addOne,addProcedures:De.addMany,setProcedure:De.setOne,setProcedures:De.setMany,updateProcedure:De.updateOne,updateProcedures:De.updateMany,deleteProcedure:De.deleteOne,deleteProcedures:De.deleteMany}}),{initializeProcedures:lA,addProcedure:oA,addProcedures:St,setProcedure:hA,setProcedures:pA,updateProcedure:yA,updateProcedures:mA,deleteProcedure:fA,deleteProcedures:At}=ha.actions,SA=ha.reducer,AA=t=>t.procedureReducer.instances,rt=u.createSelector([AA],t=>Object.values(t)),TA=t=>e=>e.procedureReducer.instances[t],IA=y(u.createSelector([rt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),v_=y(u.createSelector([rt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.project===e)))),OA=y(u.createSelector([rt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure_type===e)))),PA=y(u.createSelector([rt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.asset===e)))),bA=y(u.createSelector([rt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({asset:a})=>i.has(a)))})),FA=y(u.createSelector([rt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure_initiative===e)))),qe=P(t=>t.uuid),_A={instances:{}},pa=u.createSlice({name:"procedureStepAssignees",initialState:_A,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,_A)),reducers:{initializeProcedureStepAssignees:qe.initialize,addProcedureStepAssignee:qe.addOne,addProcedureStepAssignees:qe.addMany,setProcedureStepAssignee:qe.setOne,setProcedureStepAssignees:qe.setMany,updateProcedureStepAssignee:qe.updateOne,updateProcedureStepAssignees:qe.updateMany,deleteProcedureStepAssignee:qe.deleteOne,deleteProcedureStepAssignees:qe.deleteMany}}),{initializeProcedureStepAssignees:gA,addProcedureStepAssignee:MA,addProcedureStepAssignees:RA,setProcedureStepAssignee:wA,setProcedureStepAssignees:EA,updateProcedureStepAssignee:vA,updateProcedureStepAssignees:VA,deleteProcedureStepAssignee:BA,deleteProcedureStepAssignees:zA}=pa.actions,jA=t=>t.procedureStepAssigneeReducer.instances,gt=u.createSelector([jA],t=>Object.values(t)),DA=t=>e=>e.procedureStepAssigneeReducer.instances[t],qA=y(u.createSelector([gt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),V_=y(u.createSelector([gt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure===e)))),B_=y(u.createSelector([gt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure_step===e)))),z_=y(u.createSelector([gt,(t,e)=>e,(t,e,i)=>i],(t,e,i)=>l.fallbackToEmptyArray(t.filter(({procedure:a,procedure_step:n})=>a===e&&n===i)))),CA=pa.reducer,Ce=P(t=>t.uuid),$A={instances:{}},ya=u.createSlice({name:"procedureStepComments",initialState:$A,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,$A)),reducers:{initializeProcedureStepComments:Ce.initialize,addProcedureStepComment:Ce.addOne,addProcedureStepComments:Ce.addMany,setProcedureStepComment:Ce.setOne,setProcedureStepComments:Ce.setMany,updateProcedureStepComment:Ce.updateOne,updateProcedureStepComments:Ce.updateMany,deleteProcedureStepComment:Ce.deleteOne,deleteProcedureStepComments:Ce.deleteMany}}),{initializeProcedureStepComments:UA,addProcedureStepComment:kA,addProcedureStepComments:LA,setProcedureStepComment:HA,setProcedureStepComments:GA,updateProcedureStepComment:NA,updateProcedureStepComments:KA,deleteProcedureStepComment:WA,deleteProcedureStepComments:YA}=ya.actions,XA=t=>t.procedureStepCommentReducer.instances,Mt=u.createSelector([XA],t=>Object.values(t)),ZA=t=>e=>e.procedureStepCommentReducer.instances[t],JA=y(u.createSelector([Mt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),j_=y(u.createSelector([Mt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure===e)))),D_=y(u.createSelector([Mt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure_step===e)))),q_=y(u.createSelector([Mt,(t,e)=>e,(t,e,i)=>i],(t,e,i)=>l.fallbackToEmptyArray(t.filter(({procedure:a,procedure_step:n})=>a===e&&n===i)))),QA=ya.reducer,$e=P(t=>t.uuid),xA={instances:{}},ma=u.createSlice({name:"procedureStepDefaultAssignees",initialState:xA,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,xA)),reducers:{initializeProcedureStepDefaultAssignees:$e.initialize,addProcedureStepDefaultAssignee:$e.addOne,addProcedureStepDefaultAssignees:$e.addMany,setProcedureStepDefaultAssignee:$e.setOne,setProcedureStepDefaultAssignees:$e.setMany,updateProcedureStepDefaultAssignee:$e.updateOne,updateProcedureStepDefaultAssignees:$e.updateMany,deleteProcedureStepDefaultAssignee:$e.deleteOne,deleteProcedureStepDefaultAssignees:$e.deleteMany}}),{initializeProcedureStepDefaultAssignees:eT,addProcedureStepDefaultAssignee:tT,addProcedureStepDefaultAssignees:sT,setProcedureStepDefaultAssignee:iT,setProcedureStepDefaultAssignees:aT,updateProcedureStepDefaultAssignee:nT,updateProcedureStepDefaultAssignees:cT,deleteProcedureStepDefaultAssignee:rT,deleteProcedureStepDefaultAssignees:dT}=ma.actions,uT=t=>t.procedureStepDefaultAssigneeReducer.instances,fa=u.createSelector([uT],t=>Object.values(t)),lT=t=>e=>e.procedureStepDefaultAssigneeReducer.instances[t],oT=y(u.createSelector([fa,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),C_=y(u.createSelector([fa,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure_step===e)))),hT=ma.reducer,Ue=P(t=>t.uuid),pT={instances:{}},Sa=u.createSlice({name:"procedureStepDefaultReviewers",initialState:pT,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,pT)),reducers:{initializeProcedureStepDefaultReviewers:Ue.initialize,addProcedureStepDefaultReviewer:Ue.addOne,addProcedureStepDefaultReviewers:Ue.addMany,setProcedureStepDefaultReviewer:Ue.setOne,setProcedureStepDefaultReviewers:Ue.setMany,updateProcedureStepDefaultReviewer:Ue.updateOne,updateProcedureStepDefaultReviewers:Ue.updateMany,deleteProcedureStepDefaultReviewer:Ue.deleteOne,deleteProcedureStepDefaultReviewers:Ue.deleteMany}}),{initializeProcedureStepDefaultReviewers:yT,addProcedureStepDefaultReviewer:mT,addProcedureStepDefaultReviewers:fT,setProcedureStepDefaultReviewer:ST,setProcedureStepDefaultReviewers:AT,updateProcedureStepDefaultReviewer:TT,updateProcedureStepDefaultReviewers:IT,deleteProcedureStepDefaultReviewer:OT,deleteProcedureStepDefaultReviewers:PT}=Sa.actions,bT=t=>t.procedureStepDefaultReviewerReducer.instances,Aa=u.createSelector([bT],t=>Object.values(t)),FT=t=>e=>e.procedureStepDefaultReviewerReducer.instances[t],_T=y(u.createSelector([Aa,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),$_=y(u.createSelector([Aa,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure_step===e)))),gT=Sa.reducer,ke=P(t=>t.uuid),MT={instances:{}},Ta=u.createSlice({name:"procedureStepEvents",initialState:MT,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,MT)),reducers:{initializeProcedureStepEvents:ke.initialize,addProcedureStepEvent:ke.addOne,addProcedureStepEvents:ke.addMany,setProcedureStepEvent:ke.setOne,setProcedureStepEvents:ke.setMany,updateProcedureStepEvent:ke.updateOne,updateProcedureStepEvents:ke.updateMany,deleteProcedureStepEvent:ke.deleteOne,deleteProcedureStepEvents:ke.deleteMany}}),{initializeProcedureStepEvents:RT,addProcedureStepEvent:wT,addProcedureStepEvents:ET,setProcedureStepEvent:vT,setProcedureStepEvents:VT,updateProcedureStepEvent:BT,updateProcedureStepEvents:zT,deleteProcedureStepEvent:jT,deleteProcedureStepEvents:DT}=Ta.actions,qT=t=>t.procedureStepEventReducer.instances,Rt=u.createSelector([qT],t=>Object.values(t)),CT=t=>e=>e.procedureStepEventReducer.instances[t],$T=y(u.createSelector([Rt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),U_=y(u.createSelector([Rt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure===e)))),k_=y(u.createSelector([Rt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure_step===e)))),L_=y(u.createSelector([Rt,(t,e)=>e,(t,e,i)=>i],(t,e,i)=>l.fallbackToEmptyArray(t.filter(({procedure:a,procedure_step:n})=>a===e&&n===i)))),UT=Ta.reducer,Le=P(t=>t.uuid),kT={instances:{}},Ia=u.createSlice({name:"procedureStepFieldsAttachments",initialState:kT,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,kT)),reducers:{initializeProcedureStepFieldsAttachments:Le.initialize,addProcedureStepFieldsAttachment:Le.addOne,addProcedureStepFieldsAttachments:Le.addMany,setProcedureStepFieldsAttachment:Le.setOne,setProcedureStepFieldsAttachments:Le.setMany,updateProcedureStepFieldsAttachment:Le.updateOne,updateProcedureStepFieldsAttachments:Le.updateMany,deleteProcedureStepFieldsAttachment:Le.deleteOne,deleteProcedureStepFieldsAttachments:Le.deleteMany}}),{initializeProcedureStepFieldsAttachments:LT,addProcedureStepFieldsAttachment:HT,addProcedureStepFieldsAttachments:Oa,setProcedureStepFieldsAttachment:GT,setProcedureStepFieldsAttachments:NT,updateProcedureStepFieldsAttachment:KT,updateProcedureStepFieldsAttachments:WT,deleteProcedureStepFieldsAttachment:YT,deleteProcedureStepFieldsAttachments:Pa}=Ia.actions,XT=t=>t.procedureStepFieldsAttachmentReducer.instances,ba=u.createSelector([XT],t=>Object.values(t)),ZT=y(u.createSelector([ba,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.fields_revision===e)))),JT=t=>e=>e.procedureStepFieldsAttachmentReducer.instances[t],QT=y(u.createSelector([ba,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),xT=Ia.reducer,He=P(t=>t.uuid),eI={instances:{}},Fa=u.createSlice({name:"procedureStepFields",initialState:eI,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,eI)),reducers:{initializeProcedureStepFields:He.initialize,addProcedureStepFields:He.addOne,addProcedureStepFieldsMany:He.addMany,setProcedureStepFields:He.setOne,setProcedureStepFieldsMany:He.setMany,updateProcedureStepFields:He.updateOne,updateProcedureStepFieldsMany:He.updateMany,deleteProcedureStepFields:He.deleteOne,deleteProcedureStepFieldsMany:He.deleteMany}}),{initializeProcedureStepFields:tI,addProcedureStepFields:sI,addProcedureStepFieldsMany:iI,setProcedureStepFields:aI,setProcedureStepFieldsMany:nI,updateProcedureStepFields:cI,updateProcedureStepFieldsMany:rI,deleteProcedureStepFields:dI,deleteProcedureStepFieldsMany:uI}=Fa.actions,_a=t=>t.procedureStepFieldsReducer.instances,es=u.createSelector([_a],t=>Object.values(t)),H_=y(u.createSelector([es,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure_step===e)))),G_=y(u.createSelector([es,(t,e)=>e],(t,e)=>t.filter(i=>i.procedure_step===e).toSorted(l.submittedAtModelSortFn).pop())),N_=u.createSelector([_a],t=>{const e={};for(const i of Object.values(t)){const a=e[i.procedure_step];(!a||a.submitted_at<i.submitted_at)&&(e[i.procedure_step]=i)}return e}),lI=t=>e=>e.procedureStepFieldsReducer.instances[t],oI=y(u.createSelector([es,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),hI=Fa.reducer,Ge=P(t=>t.uuid),pI={instances:{}},ga=u.createSlice({name:"procedureStepFieldValuesAttachments",initialState:pI,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,pI)),reducers:{initializeProcedureStepFieldValuesAttachments:Ge.initialize,addProcedureStepFieldValuesAttachment:Ge.addOne,addProcedureStepFieldValuesAttachments:Ge.addMany,setProcedureStepFieldValuesAttachment:Ge.setOne,setProcedureStepFieldValuesAttachments:Ge.setMany,updateProcedureStepFieldValuesAttachment:Ge.updateOne,updateProcedureStepFieldValuesAttachments:Ge.updateMany,deleteProcedureStepFieldValuesAttachment:Ge.deleteOne,deleteProcedureStepFieldValuesAttachments:Ge.deleteMany}}),{initializeProcedureStepFieldValuesAttachments:yI,addProcedureStepFieldValuesAttachment:mI,addProcedureStepFieldValuesAttachments:Ma,setProcedureStepFieldValuesAttachment:fI,setProcedureStepFieldValuesAttachments:SI,updateProcedureStepFieldValuesAttachment:AI,updateProcedureStepFieldValuesAttachments:TI,deleteProcedureStepFieldValuesAttachment:II,deleteProcedureStepFieldValuesAttachments:Ra}=ga.actions,OI=t=>t.procedureStepFieldValuesAttachmentReducer.instances,wa=u.createSelector([OI],t=>Object.values(t)),PI=t=>e=>e.procedureStepFieldValuesAttachmentReducer.instances[t],bI=y(u.createSelector([wa,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),FI=y(u.createSelector([wa,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.field_values===e)))),_I=ga.reducer,Ne=P(t=>t.uuid),gI={instances:{}},Ea=u.createSlice({name:"procedureStepFieldValues",initialState:gI,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,gI)),reducers:{initializeProcedureStepFieldValues:Ne.initialize,addProcedureStepFieldValues:Ne.addOne,addProcedureStepFieldValuesMany:Ne.addMany,setProcedureStepFieldValues:Ne.setOne,setProcedureStepFieldValuesMany:Ne.setMany,updateProcedureStepFieldValues:Ne.updateOne,updateProcedureStepFieldValuesMany:Ne.updateMany,deleteProcedureStepFieldValues:Ne.deleteOne,deleteProcedureStepFieldValuesMany:Ne.deleteMany}}),{initializeProcedureStepFieldValues:MI,addProcedureStepFieldValues:RI,addProcedureStepFieldValuesMany:wI,setProcedureStepFieldValues:EI,setProcedureStepFieldValuesMany:vI,updateProcedureStepFieldValues:VI,updateProcedureStepFieldValuesMany:BI,deleteProcedureStepFieldValues:zI,deleteProcedureStepFieldValuesMany:jI}=Ea.actions,DI=Ea.reducer,qI=t=>t.procedureStepFieldValuesReducer.instances,dt=u.createSelector([qI],t=>Object.values(t)),K_=y(u.createSelector([dt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure===e)))),W_=y(u.createSelector([dt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure_step===e)))),CI=t=>e=>e.procedureStepFieldValuesReducer.instances[t],$I=y(u.createSelector([dt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),Y_=y(u.createSelector([dt,(t,e)=>e,(t,e,i)=>i],(t,e,i)=>l.fallbackToEmptyArray(t.filter(({procedure:a,procedure_step:n})=>a===e&&n===i)))),Ke=P(t=>t.uuid),UI={instances:{}},va=u.createSlice({name:"procedureStepFieldValuesReviews",initialState:UI,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,UI)),reducers:{initializeProcedureStepFieldValuesReviews:Ke.initialize,addProcedureStepFieldValuesReview:Ke.addOne,addProcedureStepFieldValuesReviews:Ke.addMany,setProcedureStepFieldValuesReview:Ke.setOne,setProcedureStepFieldValuesReviews:Ke.setMany,updateProcedureStepFieldValuesReview:Ke.updateOne,updateProcedureStepFieldValuesReviews:Ke.updateMany,deleteProcedureStepFieldValuesReview:Ke.deleteOne,deleteProcedureStepFieldValuesReviews:Ke.deleteMany}}),{initializeProcedureStepFieldValuesReviews:kI,addProcedureStepFieldValuesReview:LI,addProcedureStepFieldValuesReviews:Va,setProcedureStepFieldValuesReview:HI,setProcedureStepFieldValuesReviews:GI,updateProcedureStepFieldValuesReview:NI,updateProcedureStepFieldValuesReviews:KI,deleteProcedureStepFieldValuesReview:WI,deleteProcedureStepFieldValuesReviews:Ba}=va.actions,YI=t=>t.procedureStepFieldValuesReviewReducer.instances,ut=u.createSelector([YI],t=>Object.values(t)),XI=t=>e=>e.procedureStepFieldValuesReviewReducer.instances[t],ZI=y(u.createSelector([ut,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),JI=y(u.createSelector([ut,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.field_values===e)))),X_=y(u.createSelector([ut,(t,e)=>e],(t,e)=>{let i;for(const a of t){const{field_values:n}=a;n===e&&(!i||i.submitted_at<=a.submitted_at)&&(i=a)}return i})),Z_=y(u.createSelector([dt,ut,(t,e)=>e],(t,e,i)=>{const a=new Set(l.toUuidArray(t.filter(({procedure:n})=>i===n)));return l.fallbackToEmptyArray(e.filter(({field_values:n})=>a.has(n)))})),J_=y(u.createSelector([dt,ut,(t,e)=>e,(t,e,i)=>i],(t,e,i,a)=>{const n=new Set(l.toUuidArray(t.filter(({procedure_step:c,procedure:d})=>i===d&&c===a)));return l.fallbackToEmptyArray(e.filter(({field_values:c})=>n.has(c)))})),Q_=u.createSelector([ut],t=>{const e={};for(const i of t){const{field_values:a}=i,n=e[a];(!n||n.submitted_at<=i.submitted_at)&&(e[a]=i)}return e}),QI=va.reducer,We=P(t=>t.uuid),xI={instances:{}},za=u.createSlice({name:"procedureStepReviewers",initialState:xI,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,xI)),reducers:{initializeProcedureStepReviewers:We.initialize,addProcedureStepReviewer:We.addOne,addProcedureStepReviewers:We.addMany,setProcedureStepReviewer:We.setOne,setProcedureStepReviewers:We.setMany,updateProcedureStepReviewer:We.updateOne,updateProcedureStepReviewers:We.updateMany,deleteProcedureStepReviewer:We.deleteOne,deleteProcedureStepReviewers:We.deleteMany}}),{initializeProcedureStepReviewers:eO,addProcedureStepReviewer:tO,addProcedureStepReviewers:sO,setProcedureStepReviewer:iO,setProcedureStepReviewers:aO,updateProcedureStepReviewer:nO,updateProcedureStepReviewers:cO,deleteProcedureStepReviewer:rO,deleteProcedureStepReviewers:dO}=za.actions,uO=t=>t.procedureStepReviewerReducer.instances,wt=u.createSelector([uO],t=>Object.values(t)),lO=t=>e=>e.procedureStepReviewerReducer.instances[t],oO=y(u.createSelector([wt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),x_=y(u.createSelector([wt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure===e)))),eg=y(u.createSelector([wt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure_step===e)))),tg=y(u.createSelector([wt,(t,e)=>e,(t,e,i)=>i],(t,e,i)=>l.fallbackToEmptyArray(t.filter(({procedure:a,procedure_step:n})=>a===e&&n===i)))),hO=za.reducer,Ye=P(t=>t.uuid),pO={instances:{}},ja=u.createSlice({name:"procedureSteps",initialState:pO,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,pO)),reducers:{initializeProcedureSteps:Ye.initialize,setProcedureStep:Ye.setOne,setProcedureSteps:Ye.setMany,addProcedureStep:Ye.addOne,addProcedureSteps:Ye.addMany,updateProcedureStep:Ye.updateOne,updateProcedureSteps:Ye.updateMany,deleteProcedureStep:Ye.deleteOne,deleteProcedureSteps:Ye.deleteMany}}),{initializeProcedureSteps:yO,setProcedureStep:mO,setProcedureSteps:fO,addProcedureStep:SO,addProcedureSteps:AO,updateProcedureStep:TO,updateProcedureSteps:IO,deleteProcedureStep:OO,deleteProcedureSteps:PO}=ja.actions,bO=ja.reducer,Da=t=>t.procedureStepReducer.instances,FO=t=>e=>e.procedureStepReducer.instances[t],qa=u.createSelector([Da],t=>Object.values(t).toSorted((e,i)=>e.order-i.order)),sg=y(u.createSelector([Da,(t,e)=>e],(t,e)=>{const i={};for(const[a,n]of Object.entries(t))n.procedure_type===e&&(i[a]=n);return l.fallbackToEmptyObject(i)})),ig=y(u.createSelector([qa,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure_type===e)))),_O=y(u.createSelector([qa,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),Xe=P(({uuid:t})=>t),gO={instances:{}},Ca=u.createSlice({name:"procedureTypeAttachments",initialState:gO,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,gO)),reducers:{initializeProcedureTypeAttachments:Xe.initialize,addProcedureTypeAttachment:Xe.addOne,addProcedureTypeAttachments:Xe.addMany,setProcedureTypeAttachment:Xe.setOne,setProcedureTypeAttachments:Xe.setMany,updateProcedureTypeAttachment:Xe.updateOne,updateProcedureTypeAttachments:Xe.updateMany,deleteProcedureTypeAttachment:Xe.deleteOne,deleteProcedureTypeAttachments:Xe.deleteMany}}),{initializeProcedureTypeAttachments:MO,addProcedureTypeAttachment:RO,addProcedureTypeAttachments:wO,setProcedureTypeAttachment:EO,setProcedureTypeAttachments:vO,updateProcedureTypeAttachment:VO,updateProcedureTypeAttachments:BO,deleteProcedureTypeAttachment:zO,deleteProcedureTypeAttachments:jO}=Ca.actions,DO=Ca.reducer,qO=t=>t.procedureTypeAttachmentReducer.instances,$a=u.createSelector([qO],t=>Object.values(t)),CO=t=>e=>e.procedureTypeAttachmentReducer.instances[t],$O=y(u.createSelector([$a,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),ag=y(u.createSelector([$a,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(({procedure_type:i})=>e===i)))),Ze=P(({uuid:t})=>t),UO={instances:{}},Ua=u.createSlice({name:"procedureTypeFieldsAttachments",initialState:UO,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,UO)),reducers:{initializeProcedureTypeFieldsAttachments:Ze.initialize,addProcedureTypeFieldsAttachment:Ze.addOne,addProcedureTypeFieldsAttachments:Ze.addMany,setProcedureTypeFieldsAttachment:Ze.setOne,setProcedureTypeFieldsAttachments:Ze.setMany,updateProcedureTypeFieldsAttachment:Ze.updateOne,updateProcedureTypeFieldsAttachments:Ze.updateMany,deleteProcedureTypeFieldsAttachment:Ze.deleteOne,deleteProcedureTypeFieldsAttachments:Ze.deleteMany}}),{initializeProcedureTypeFieldsAttachments:kO,addProcedureTypeFieldsAttachment:LO,addProcedureTypeFieldsAttachments:HO,setProcedureTypeFieldsAttachment:GO,setProcedureTypeFieldsAttachments:NO,updateProcedureTypeFieldsAttachment:KO,updateProcedureTypeFieldsAttachments:WO,deleteProcedureTypeFieldsAttachment:YO,deleteProcedureTypeFieldsAttachments:XO}=Ua.actions,ZO=Ua.reducer,JO=t=>t.procedureTypeFieldsAttachmentReducer.instances,ka=u.createSelector([JO],t=>Object.values(t)),ng=y(u.createSelector([ka,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.fields_revision===e)))),QO=t=>e=>e.procedureTypeFieldsAttachmentReducer.instances[t],xO=y(u.createSelector([ka,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),Je=P(({uuid:t})=>t),eP={instances:{}},La=u.createSlice({name:"procedureTypeFields",initialState:eP,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,eP)),reducers:{initializeProcedureTypeFields:Je.initialize,addProcedureTypeFields:Je.addOne,addProcedureTypeFieldsMany:Je.addMany,setProcedureTypeFields:Je.setOne,setProcedureTypeFieldsMany:Je.setMany,updateProcedureTypeFields:Je.updateOne,updateProcedureTypeFieldsMany:Je.updateMany,deleteProcedureTypeFields:Je.deleteOne,deleteProcedureTypeFieldsMany:Je.deleteMany}}),{initializeProcedureTypeFields:tP,addProcedureTypeFields:sP,addProcedureTypeFieldsMany:iP,setProcedureTypeFields:aP,setProcedureTypeFieldsMany:nP,updateProcedureTypeFields:cP,updateProcedureTypeFieldsMany:rP,deleteProcedureTypeFields:dP,deleteProcedureTypeFieldsMany:uP}=La.actions,lP=La.reducer,oP=t=>t.procedureTypeFieldsReducer.instances,ts=u.createSelector([oP],t=>Object.values(t)),cg=y(u.createSelector([ts,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure_type===e)))),rg=y(u.createSelector([ts,(t,e)=>e],(t,e)=>t.filter(i=>i.procedure_type===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),hP=t=>e=>e.procedureTypeFieldsReducer.instances[t],pP=y(u.createSelector([ts,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),Qe=P(({uuid:t})=>t),yP={instances:{}},Ha=u.createSlice({name:"procedureFieldValuesAttachments",initialState:yP,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,yP)),reducers:{initializeProcedureFieldValuesAttachments:Qe.initialize,addProcedureFieldValuesAttachment:Qe.addOne,addProcedureFieldValuesAttachments:Qe.addMany,setProcedureFieldValuesAttachment:Qe.setOne,setProcedureFieldValuesAttachments:Qe.setMany,updateProcedureFieldValuesAttachment:Qe.updateOne,updateProcedureFieldValuesAttachments:Qe.updateMany,deleteProcedureFieldValuesAttachment:Qe.deleteOne,deleteProcedureFieldValuesAttachments:Qe.deleteMany}}),{initializeProcedureFieldValuesAttachments:mP,addProcedureFieldValuesAttachment:fP,addProcedureFieldValuesAttachments:Ga,setProcedureFieldValuesAttachment:SP,setProcedureFieldValuesAttachments:AP,updateProcedureFieldValuesAttachment:TP,updateProcedureFieldValuesAttachments:IP,deleteProcedureFieldValuesAttachment:OP,deleteProcedureFieldValuesAttachments:Na}=Ha.actions,PP=Ha.reducer,bP=t=>t.procedureFieldValuesAttachmentReducer.instances,Ka=u.createSelector([bP],t=>Object.values(t)),FP=t=>e=>e.procedureFieldValuesAttachmentReducer.instances[t],_P=y(u.createSelector([Ka,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),gP=y(u.createSelector([Ka,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.field_values===e)))),xe=P(({uuid:t})=>t),MP={instances:{}},Wa=u.createSlice({name:"procedureFieldValues",initialState:MP,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,MP)),reducers:{initializeProcedureFieldValues:xe.initialize,addProcedureFieldValues:xe.addOne,addProcedureFieldValuesMany:xe.addMany,setProcedureFieldValues:xe.setOne,setProcedureFieldValuesMany:xe.setMany,updateProcedureFieldValues:xe.updateOne,updateProcedureFieldValuesMany:xe.updateMany,deleteProcedureFieldValues:xe.deleteOne,deleteProcedureFieldValuesMany:xe.deleteMany}}),{initializeProcedureFieldValues:RP,addProcedureFieldValues:wP,addProcedureFieldValuesMany:EP,setProcedureFieldValues:vP,setProcedureFieldValuesMany:VP,updateProcedureFieldValues:BP,updateProcedureFieldValuesMany:zP,deleteProcedureFieldValues:jP,deleteProcedureFieldValuesMany:DP}=Wa.actions,qP=Wa.reducer,CP=t=>t.procedureFieldValuesReducer.instances,Ya=u.createSelector([CP],t=>Object.values(t)),dg=y(u.createSelector([Ya,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure===e)))),$P=t=>e=>e.procedureFieldValuesReducer.instances[t],UP=y(u.createSelector([Ya,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),et=P(t=>t.uuid),kP={instances:{}},Xa=u.createSlice({name:"procedureTypes",initialState:kP,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,kP)),reducers:{initializeProcedureTypes:et.initialize,addProcedureType:et.addOne,addProcedureTypes:et.addMany,setProcedureType:et.setOne,setProcedureTypes:et.setMany,updateProcedureType:et.updateOne,updateProcedureTypes:et.updateMany,deleteProcedureType:et.deleteOne,deleteProcedureTypes:et.deleteMany}}),{initializeProcedureTypes:LP,addProcedureType:HP,addProcedureTypes:GP,setProcedureType:NP,setProcedureTypes:KP,updateProcedureType:WP,updateProcedureTypes:YP,deleteProcedureType:XP,deleteProcedureTypes:ZP}=Xa.actions,JP=Xa.reducer,QP=t=>t.procedureTypeReducer.instances,Za=u.createSelector([QP],t=>Object.values(t)),xP=t=>e=>e.procedureTypeReducer.instances[t],eb=y(u.createSelector([Za,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),ug=y(u.createSelector([Za,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.organization===e)))),lg={isRehydrated:!1},Ja=u.createSlice({name:"rehydrated",initialState:lg,reducers:{setRehydrated:(t,e)=>{t.isRehydrated=e.payload}}}),{setRehydrated:og}=Ja.actions,hg=t=>t.rehydratedReducer.isRehydrated,tb=Ja.reducer,tt=P(t=>t.uuid),sb={instances:{}},Qa=u.createSlice({name:"teamMemberships",initialState:sb,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,sb)),reducers:{initializeTeamMemberships:tt.initialize,addTeamMembership:tt.addOne,addTeamMemberships:tt.addMany,setTeamMembership:tt.setOne,setTeamMemberships:tt.setMany,updateTeamMembership:tt.updateOne,updateTeamMemberships:tt.updateMany,deleteTeamMembership:tt.deleteOne,deleteTeamMemberships:tt.deleteMany}}),{initializeTeamMemberships:ib,addTeamMembership:ab,addTeamMemberships:nb,setTeamMembership:cb,setTeamMemberships:rb,updateTeamMembership:db,updateTeamMemberships:ub,deleteTeamMembership:lb,deleteTeamMemberships:ob}=Qa.actions,hb=Qa.reducer,pb=t=>t.teamMembershipReducer.instances,ss=u.createSelector([pb],t=>Object.values(t)),yb=t=>e=>e.teamMembershipReducer.instances[t],mb=y(u.createSelector([ss,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),pg=y(u.createSelector([ss,(t,e)=>e],(t,e)=>{const i={};for(const a of t.filter(n=>n.team===e))i[a.user]=a;return i})),yg=y(u.createSelector([Yt,ss,(t,e)=>e],(t,e,i)=>{const a=new Set(e.filter(n=>n.team===i).map(n=>n.user));return l.fallbackToEmptyArray(t.filter(n=>a.has(n.id)))})),st=P(t=>t.uuid),fb={instances:{}},xa=u.createSlice({name:"teams",initialState:fb,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,fb)),reducers:{initializeTeams:st.initialize,addTeam:st.addOne,addTeams:st.addMany,setTeam:st.setOne,setTeams:st.setMany,updateTeam:st.updateOne,updateTeams:st.updateMany,deleteTeam:st.deleteOne,deleteTeams:st.deleteMany}}),{initializeTeams:Sb,addTeam:Ab,addTeams:Tb,setTeam:Ib,setTeams:Ob,updateTeam:Pb,updateTeams:bb,deleteTeam:Fb,deleteTeams:_b}=xa.actions,gb=t=>t.teamReducer.instances,en=u.createSelector([gb],t=>Object.values(t)),Mb=t=>e=>e.teamReducer.instances[t],Rb=y(u.createSelector([en,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),mg=y(u.createSelector([en,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.organization===e)))),wb=xa.reducer,tn={outboxReducer:Vf,authReducer:Od},fg=u.combineReducers(tn),Eb={...tn,assetReducer:sc,assetAttachmentReducer:wn,assetCommentReducer:Hn,assetTypeReducer:ad,assetTypeAttachmentReducer:mc,issueReducer:ep,issueAttachmentReducer:yh,issueTypeReducer:fm,issueTypeAttachmentReducer:yp,organizationReducer:gf,projectReducer:NS,projectAttachmentReducer:nS,projectCommentReducer:TS,projectAccessReducer:Hf,organizationAccessReducer:df,projectFileReducer:zS,procedureTypeReducer:JP,procedureInitiativeReducer:nA,procedureReducer:SA,procedureTypeFieldsReducer:lP,procedureFieldValuesReducer:qP,procedureTypeAttachmentReducer:DO,procedureTypeFieldsAttachmentReducer:ZO,procedureFieldValuesAttachmentReducer:PP,procedureStepFieldsAttachmentReducer:xT,procedureStepFieldsReducer:hI,procedureStepFieldValuesAttachmentReducer:_I,procedureStepFieldValuesReducer:DI,procedureStepFieldValuesReviewReducer:QI,procedureStepAssigneeReducer:CA,procedureStepCommentReducer:QA,procedureStepDefaultAssigneeReducer:hT,procedureStepDefaultReviewerReducer:gT,procedureStepEventReducer:UT,procedureStepReviewerReducer:hO,procedureStepReducer:bO,rehydratedReducer:tb,formReducer:zl,formRevisionReducer:ll,formRevisionAttachmentReducer:Ju,formSubscriberReducer:bl,formSubmissionFieldValuesAttachmentReducer:Yl,formSubmissionFieldValuesReducer:ro,formSubmissionReducer:_o,formIdentifierReducer:bu,formIdentifierValueReducer:qu,userReducer:Ym,emailDomainsReducer:uu,documentsReducer:Kd,documentAttachmentReducer:jd,teamReducer:wb,agentsReducer:fn,issueCommentReducer:kh,issueCommentAttachmentReducer:Rh,issueUpdateReducer:$m,geoImageReducer:$o,issueAssociationReducer:th,issueTypeFieldsReducer:sy,issueTypeFieldValuesReducer:Lp,issueTypeFieldsAttachmentReducer:Rp,issueTypeFieldValuesAttachmentReducer:my,issueTypeIdentifierReducer:wy,issueTypeIdentifierValueReducer:Hy,issueTypePriorityReducer:sm,issueTypeStatusReducer:wm,assetTypeFieldsReducer:Hc,assetTypeFieldValuesReducer:fr,assetTypeFieldsAttachmentReducer:wc,assetTypeFieldValuesAttachmentReducer:sr,assetTypeIdentifierReducer:Er,assetTypeIdentifierValueReducer:Gr,assetTypeStatusReducer:Ad,teamMembershipReducer:hb},Sg=u.combineReducers(Eb),vb=1e4,sn=[400,409,403,404,405,500],q=1e4,Vb={};class Bb{client;pageSize=vb;constructor(e){Vb[this.constructor.name]=this,this.client=e}async performRequest(e,i){return this.client.performRequest(this.host,e,this,i)}async enqueueRequest(e){return this.client.enqueueRequest(e,this.host,this.constructor.name)}async performPagination(e,i){return this.client.performPagination(this.host,e,this.pageSize,this,i)}dispatch(e){this.client.store.dispatch(e)}select(e){return e(this.client.store.getState())}}const Ag=t=>{if(t)throw t;const e=Ot();e?e.dispatch({type:"rehydrated/setRehydrated",payload:!0}):console.error("Client store not set")},zb=(t,e,i)=>{const a=ht();return a?(a.addRequest(e),a.getQueue()):(console.warn("Outbox coordinator not set; cannot enqueue request yet."),[])},jb=(t,e,i)=>{const a=ht();if(!a)return console.warn("Outbox coordinator not set; cannot dequeue request yet."),[];const c=e.meta.offlineAction.payload.uuid;return a.remove(c),a.getQueue()};async function Tg(t,e){if(!e.payload)throw new Error("Received empty payload");return aF(e)}const Ig={...un,effect:Tg,discard:qb,returnPromises:!0,persistCallback:Ag,retry:bg,persistOptions:{storage:dF},queue:{...un.queue,enqueue:zb,dequeue:jb,peek:(...t)=>Pg(...t)}},Og=rF.offline(Ig);async function Db(t,e,i){if(e.store.getState().outboxReducer.deletedRequests.includes(t.payload.uuid))throw new Error("Request was marked for deletion");const n=Vb[t.meta.offline.effect.serviceName];if(!n)throw new Error(`Service ${t.meta.offline.effect.serviceName} not found`);return cn(t.meta.offline.effect.BASE_URL,t.meta.offline.effect.request,e,n,i)}function qb(t,e,i=0){if(console.debug("Considering discarding request due to error:",t,`(${typeof t})`,`
1
+ (function(s,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("@overmap-ai/common"),require("@redux-offline/redux-offline/lib/types"),require("@reduxjs/toolkit"),require("superagent"),require("uuid"),require("react"),require("@redux-offline/redux-offline"),require("@redux-offline/redux-offline/lib/defaults"),require("localforage"),require("idb"),require("jwt-decode"),require("dependency-graph")):typeof define=="function"&&define.amd?define(["exports","@overmap-ai/common","@redux-offline/redux-offline/lib/types","@reduxjs/toolkit","superagent","uuid","react","@redux-offline/redux-offline","@redux-offline/redux-offline/lib/defaults","localforage","idb","jwt-decode","dependency-graph"],l):(s=typeof globalThis<"u"?globalThis:s||self,l(s["overmap-core"]={},s.common,null,s.toolkit,s.request,s.uuid,s.react,s.reduxOffline,s.offlineConfig,s.localforage,s.idb,s.jwtDecode,s.dependencyGraph))})(this,(function(s,l,sR,u,pt,at,nF,cF,dn,rF,dF,uF,lF){"use strict";const un=["created_at","updated_at","index","revision"];var o=(t=>(t.GET="GET",t.POST="POST",t.PATCH="PATCH",t.PUT="PUT",t.DELETE="DELETE",t))(o||{});function P(t){return{addOne:(f,A)=>{const T=t(A.payload);T in f.instances||(f.instances[T]=A.payload)},addMany:(f,A)=>{for(const T of A.payload){const S=t(T);S in f.instances||(f.instances[S]=T)}},updateOne:(f,A)=>{const T=t(A.payload);T in f.instances&&(f.instances[T]=A.payload)},setMany:(f,A)=>{for(const T of A.payload){const S=t(T);f.instances[S]=T}},setOne:(f,A)=>{const T=t(A.payload);f.instances[T]=A.payload},updateMany:(f,A)=>{for(const T of A.payload){const S=t(T);S in f.instances&&(f.instances[S]=T)}},deleteOne:(f,A)=>{delete f.instances[A.payload]},deleteMany:(f,A)=>{for(const T of A.payload)delete f.instances[T]},initialize:(f,A)=>{f.instances={};const T=new Set;for(const S of A.payload){const O=t(S);T.add(O),f.instances[O]=S}T.size!==A.payload.length&&console.warn("duplicate ids detected when initializing model instances.")}}}function oF(t){return{initializeSelection:(p,h)=>{p[t]=Array.from(new Set(h.payload))},selectOne:(p,h)=>{console.debug(p,p[t]),!new Set(p[t]).has(h.payload)&&p[t].push(h.payload)},selectMany:(p,h)=>{const f=new Set(p[t]);for(const A of h.payload)f.has(A)||f.add(A);p[t]=Array.from(f)},unselectOne:(p,h)=>{const f=new Set(p[t]);f.has(h.payload)&&(f.delete(h.payload),p[t]=Array.from(f))},unselectMany:(p,h)=>{const f=new Set(p[t]);for(const A of h.payload)f.has(A)&&f.delete(A);p[t]=Array.from(f)},toggleOne:(p,h)=>{const f=new Set(p[t]);f.has(h.payload)?f.delete(h.payload):f.add(h.payload),p[t]=Array.from(f)},toggleMany:(p,h)=>{const f=new Set(p[t]);for(const A of h.payload)f.has(A)?f.delete(A):f.add(A);p[t]=Array.from(f)}}}const I=u.createAction("RESET"),E=u.createAction("RESET_PROJECT_STATE"),b=u.createAction("RESET_ORGANIZATION_STATE");function hF(t,e){return nF.useMemo(t,e)}class pF{constructor(e){this.getData=e}operations=[];getData;performOperations(e){let i=e;for(const a of this.operations)i=a(i);return i}filter(e,i){return this.operations.push(a=>a.filter(n=>n[e]===i)),this}exclude(e,i){return this.operations.push(a=>a.filter(n=>n[e]!==i)),this}orderBy(e){return this.operations.push(i=>i.toSorted((a,n)=>a[e]<=n[e]?1:-1)),this}reverse(){return this.operations.push(e=>e.toReversed()),this}all(){return this.operations.push(e=>e),this}get(e,i){return u.createSelector([this.getData],a=>this.performOperations(a).find(n=>n[e]===i))}count(){return u.createSelector([this.getData],e=>this.performOperations(e).length)}first(){return u.createSelector([this.getData],e=>this.performOperations(e)[0])}last(){return u.createSelector([this.getData],e=>{const i=this.performOperations(e);return i[i.length-1]})}exists(){return u.createSelector([this.getData],e=>this.performOperations(e).length>0)}toSelector(){return u.createSelector([this.getData],e=>l.fallbackToEmptyArray(this.performOperations(e)))}}const y=(t=>(...e)=>i=>t(i,...e)),$=P(t=>t.uuid),ln={instances:{}},as=u.createSlice({name:"agents",initialState:ln,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,ln)),reducers:{initializeConversations:$.initialize,addConversation:$.addOne,addConversations:$.addMany,setConversation:$.setOne,setConversations:$.setMany,updateConversation:$.updateOne,updateConversations:$.updateMany,deleteConversation:$.deleteOne,deleteConversations:$.deleteMany}}),{initializeConversations:on,addConversation:hn,addConversations:yF,setConversation:pn,setConversations:mF,updateConversation:yn,updateConversations:fF,deleteConversation:SF,deleteConversations:AF}=as.actions,ns=t=>t.agentsReducer.instances,TF=u.createSelector([ns],t=>Object.values(t)),IF=y(u.createSelector([ns,(t,e)=>e],(t,e)=>t[e])),mn=as.reducer,U=P(t=>t.uuid),fn={instances:{}},cs=u.createSlice({name:"assetAttachments",initialState:fn,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,fn)),reducers:{initializeAssetAttachments:U.initialize,addAssetAttachment:U.addOne,addAssetAttachments:U.addMany,setAssetAttachment:U.setOne,setAssetAttachments:U.setMany,updateAssetAttachment:U.updateOne,updateAssetAttachments:U.updateMany,deleteAssetAttachment:U.deleteOne,deleteAssetAttachments:U.deleteMany}}),{initializeAssetAttachments:Sn,addAssetAttachment:An,addAssetAttachments:rs,setAssetAttachment:Tn,setAssetAttachments:In,updateAssetAttachment:On,updateAssetAttachments:Pn,deleteAssetAttachment:bn,deleteAssetAttachments:ds}=cs.actions,Fn=t=>t.assetAttachmentReducer.instances,us=u.createSelector([Fn],t=>Object.values(t)),_n=t=>e=>e.assetAttachmentReducer.instances[t],gn=y(u.createSelector([us,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),Mn=y(u.createSelector([us,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(({asset:i})=>e===i)))),Rn=cs.reducer,k=P(t=>t.uuid),wn={instances:{}},ls=u.createSlice({name:"assetComments",initialState:wn,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,wn)),reducers:{initializeAssetComments:k.initialize,addAssetComment:k.addOne,addAssetComments:k.addMany,setAssetComment:k.setOne,setAssetComments:k.setMany,updateAssetComment:k.updateOne,updateAssetComments:k.updateMany,deleteAssetComment:k.deleteOne,deleteAssetComments:k.deleteMany}}),{initializeAssetComments:En,addAssetComment:vn,addAssetComments:Vt,setAssetComment:Vn,setAssetComments:Bn,updateAssetComment:zn,updateAssetComments:jn,deleteAssetComment:Dn,deleteAssetComments:Bt}=ls.actions,qn=t=>t.assetCommentReducer.instances,zt=u.createSelector([qn],t=>l.fallbackToEmptyArray(Object.values(t).toSorted(l.submittedAtModelSortFn))),Cn=t=>e=>e.assetCommentReducer.instances[t],$n=y(u.createSelector([zt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),Un=y(u.createSelector([zt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.asset===e)))),kn=y(u.createSelector([zt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(a=>i.has(a.asset)))})),Ln=ls.reducer,L=P(t=>t.uuid),Hn={instances:{}},os=u.createSlice({name:"assets",initialState:Hn,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,Hn)),reducers:{initializeAssets:L.initialize,addAsset:L.addOne,addAssets:L.addMany,setAsset:L.setOne,setAssets:L.setMany,updateAsset:L.updateOne,updateAssets:L.updateMany,deleteAsset:L.deleteOne,deleteAssets:L.deleteMany}}),{initializeAssets:Gn,addAsset:Nn,addAssets:hs,updateAsset:Kn,updateAssets:Wn,deleteAsset:Xn,deleteAssets:ps,setAsset:Yn,setAssets:Zn}=os.actions,Jn=t=>t.assetReducer.instances,jt=u.createSelector([Jn],t=>l.fallbackToEmptyArray(Object.values(t))),OF=y(u.createSelector([jt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(({project:i})=>i===e)))),Qn=y(u.createSelector([jt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.asset_type===e)))),xn=t=>e=>e.assetReducer.instances[t],ec=y(u.createSelector([jt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),tc=os.reducer,H=P(t=>t.uuid),sc={instances:{}},ys=u.createSlice({name:"assetTypeAttachments",initialState:sc,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,sc)),reducers:{initializeAssetTypeAttachments:H.initialize,addAssetTypeAttachment:H.addOne,addAssetTypeAttachments:H.addMany,setAssetTypeAttachment:H.setOne,setAssetTypeAttachments:H.setMany,updateAssetTypeAttachment:H.updateOne,updateAssetTypeAttachments:H.updateMany,deleteAssetTypeAttachment:H.deleteOne,deleteAssetTypeAttachments:H.deleteMany}}),{initializeAssetTypeAttachments:ic,addAssetTypeAttachment:ac,addAssetTypeAttachments:ms,setAssetTypeAttachment:nc,setAssetTypeAttachments:cc,updateAssetTypeAttachment:rc,updateAssetTypeAttachments:dc,deleteAssetTypeAttachment:uc,deleteAssetTypeAttachments:fs}=ys.actions,lc=t=>t.assetTypeAttachmentReducer.instances,Ss=u.createSelector([lc],t=>Object.values(t)),oc=t=>e=>e.assetTypeAttachmentReducer.instances[t],hc=y(u.createSelector([Ss,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),pc=y(u.createSelector([Ss,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(({asset_type:i})=>e===i)))),yc=ys.reducer,G=P(t=>t.uuid),mc={instances:{}},As=u.createSlice({name:"assetTypeFieldsAttachments",initialState:mc,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,mc)),reducers:{initializeAssetTypeFieldsAttachments:G.initialize,addAssetTypeFieldsAttachment:G.addOne,addAssetTypeFieldsAttachments:G.addMany,setAssetTypeFieldsAttachment:G.setOne,setAssetTypeFieldsAttachments:G.setMany,updateAssetTypeFieldsAttachment:G.updateOne,updateAssetTypeFieldsAttachments:G.updateMany,deleteAssetTypeFieldsAttachment:G.deleteOne,deleteAssetTypeFieldsAttachments:G.deleteMany}}),{initializeAssetTypeFieldsAttachments:fc,addAssetTypeFieldsAttachment:Sc,addAssetTypeFieldsAttachments:Ac,setAssetTypeFieldsAttachment:Tc,setAssetTypeFieldsAttachments:Ic,updateAssetTypeFieldsAttachment:Oc,updateAssetTypeFieldsAttachments:Pc,deleteAssetTypeFieldsAttachment:bc,deleteAssetTypeFieldsAttachments:Fc}=As.actions,_c=t=>t.assetTypeFieldsAttachmentReducer.instances,Ts=u.createSelector([_c],t=>Object.values(t)),PF=y(u.createSelector([Ts,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.fields_revision===e)))),gc=t=>e=>e.assetTypeFieldsAttachmentReducer.instances[t],Mc=y(u.createSelector([Ts,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),Rc=As.reducer,N=P(t=>t.uuid),wc={instances:{}},Is=u.createSlice({name:"assetTypeFields",initialState:wc,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,wc)),reducers:{initializeAssetTypeFields:N.initialize,addAssetTypeFields:N.addOne,addAssetTypeFieldsMany:N.addMany,setAssetTypeFields:N.setOne,setAssetTypeFieldsMany:N.setMany,updateAssetTypeFields:N.updateOne,updateAssetTypeFieldsMany:N.updateMany,deleteAssetTypeFields:N.deleteOne,deleteAssetTypeFieldsMany:N.deleteMany}}),{initializeAssetTypeFields:Ec,addAssetTypeFields:vc,addAssetTypeFieldsMany:Vc,setAssetTypeFields:Bc,setAssetTypeFieldsMany:zc,updateAssetTypeFields:jc,updateAssetTypeFieldsMany:Dc,deleteAssetTypeFields:qc,deleteAssetTypeFieldsMany:Cc}=Is.actions,$c=t=>t.assetTypeFieldsReducer.instances,Pt=u.createSelector([$c],t=>Object.values(t)),bF=y(u.createSelector([Pt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.asset_type===e)))),FF=y(u.createSelector([Pt,(t,e)=>e],(t,e)=>t.filter(i=>i.asset_type===e).toSorted(l.submittedAtModelSortFn).pop())),Uc=t=>e=>e.assetTypeFieldsReducer.instances[t],kc=y(u.createSelector([Pt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),Lc=Is.reducer,K=P(t=>t.uuid),Hc={instances:{}},Os=u.createSlice({name:"assetTypeFieldValuesAttachments",initialState:Hc,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,Hc)),reducers:{initializeAssetTypeFieldValuesAttachments:K.initialize,addAssetTypeFieldValuesAttachment:K.addOne,addAssetTypeFieldValuesAttachments:K.addMany,setAssetTypeFieldValuesAttachment:K.setOne,setAssetTypeFieldValuesAttachments:K.setMany,updateAssetTypeFieldValuesAttachment:K.updateOne,updateAssetTypeFieldValuesAttachments:K.updateMany,deleteAssetTypeFieldValuesAttachment:K.deleteOne,deleteAssetTypeFieldValuesAttachments:K.deleteMany}}),{initializeAssetTypeFieldValuesAttachments:Gc,addAssetTypeFieldValuesAttachment:Nc,addAssetTypeFieldValuesAttachments:Ps,setAssetTypeFieldValuesAttachment:Kc,setAssetTypeFieldValuesAttachments:Wc,updateAssetTypeFieldValuesAttachment:Xc,updateAssetTypeFieldValuesAttachments:Yc,deleteAssetTypeFieldValuesAttachment:Zc,deleteAssetTypeFieldValuesAttachments:bs}=Os.actions,Jc=t=>t.assetTypeFieldValuesAttachmentReducer.instances,Fs=u.createSelector([Jc],t=>Object.values(t)),Qc=t=>e=>e.assetTypeFieldValuesAttachmentReducer.instances[t],xc=y(u.createSelector([Fs,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),er=y(u.createSelector([Fs,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.field_values===e)))),tr=Os.reducer,W=P(t=>t.uuid),sr={instances:{}},_s=u.createSlice({name:"assetTypeFieldValues",initialState:sr,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,sr)),reducers:{initializeAssetTypeFieldValues:W.initialize,addAssetTypeFieldValues:W.addOne,addAssetTypeFieldValuesMany:W.addMany,setAssetTypeFieldValues:W.setOne,setAssetTypeFieldValuesMany:W.setMany,updateAssetTypeFieldValues:W.updateOne,updateAssetTypeFieldValuesMany:W.updateMany,deleteAssetTypeFieldValues:W.deleteOne,deleteAssetTypeFieldValuesMany:W.deleteMany}}),{initializeAssetTypeFieldValues:ir,addAssetTypeFieldValues:ar,addAssetTypeFieldValuesMany:nr,setAssetTypeFieldValues:cr,setAssetTypeFieldValuesMany:rr,updateAssetTypeFieldValues:dr,updateAssetTypeFieldValuesMany:ur,deleteAssetTypeFieldValues:lr,deleteAssetTypeFieldValuesMany:or}=_s.actions,hr=t=>t.assetTypeFieldValuesReducer.instances,Dt=u.createSelector([hr],t=>Object.values(t)),_F=y(u.createSelector([Dt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.asset===e)))),gF=y(u.createSelector([Pt,Dt,(t,e)=>e],(t,e,i)=>{const a=new Set(t.filter(n=>n.asset_type===i).map(n=>n.uuid));return l.fallbackToEmptyArray(e.filter(n=>a.has(n.fields_revision)))})),pr=t=>e=>e.assetTypeFieldValuesReducer.instances[t],yr=y(u.createSelector([Dt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),mr=_s.reducer,X=P(t=>t.uuid),fr={instances:{}},gs=u.createSlice({name:"assetTypeIdentifiers",initialState:fr,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,fr)),reducers:{initializeAssetTypeIdentifiers:X.initialize,addAssetTypeIdentifier:X.addOne,addAssetTypeIdentifiers:X.addMany,setAssetTypeIdentifier:X.setOne,setAssetTypeIdentifiers:X.setMany,updateAssetTypeIdentifier:X.updateOne,updateAssetTypeIdentifiers:X.updateMany,deleteAssetTypeIdentifier:X.deleteOne,deleteAssetTypeIdentifiers:X.deleteMany}}),{initializeAssetTypeIdentifiers:Sr,addAssetTypeIdentifier:Ar,addAssetTypeIdentifiers:Tr,setAssetTypeIdentifier:Ir,setAssetTypeIdentifiers:Or,updateAssetTypeIdentifier:Pr,updateAssetTypeIdentifiers:br,deleteAssetTypeIdentifier:Fr,deleteAssetTypeIdentifiers:_r}=gs.actions,gr=t=>t.assetTypeIdentifierReducer.instances,Ms=u.createSelector([gr],t=>Object.values(t)),Mr=t=>e=>e.assetTypeIdentifierReducer.instances[t],Rr=y(u.createSelector([Ms,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),MF=y(u.createSelector([Ms,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.asset_type===e)))),wr=gs.reducer,Y=P(t=>t.uuid),Er={instances:{}},Rs=u.createSlice({name:"assetTypeIdentifierValues",initialState:Er,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,Er)),reducers:{initializeAssetTypeIdentifierValues:Y.initialize,addAssetTypeIdentifierValue:Y.addOne,addAssetTypeIdentifierValues:Y.addMany,setAssetTypeIdentifierValue:Y.setOne,setAssetTypeIdentifierValues:Y.setMany,updateAssetTypeIdentifierValue:Y.updateOne,updateAssetTypeIdentifierValues:Y.updateMany,deleteAssetTypeIdentifierValue:Y.deleteOne,deleteAssetTypeIdentifierValues:Y.deleteMany}}),{initializeAssetTypeIdentifierValues:vr,addAssetTypeIdentifierValue:Vr,addAssetTypeIdentifierValues:Br,setAssetTypeIdentifierValue:zr,setAssetTypeIdentifierValues:jr,updateAssetTypeIdentifierValue:Dr,updateAssetTypeIdentifierValues:qr,deleteAssetTypeIdentifierValue:Cr,deleteAssetTypeIdentifierValues:$r}=Rs.actions,Ur=t=>t.assetTypeIdentifierValueReducer.instances,qt=u.createSelector([Ur],t=>Object.values(t)),kr=t=>e=>e.assetTypeIdentifierValueReducer.instances[t],Lr=y(u.createSelector([qt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),RF=y(u.createSelector([qt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.asset===e)))),wF=y(u.createSelector([qt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.asset_type_identifier===e)))),Hr=Rs.reducer,Z=P(t=>t.uuid),Gr={instances:{}},ws=u.createSlice({name:"assetTypes",initialState:Gr,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,Gr)),reducers:{initializeAssetTypes:Z.initialize,setAssetType:Z.setOne,setAssetTypes:Z.setMany,addAssetType:Z.addOne,addAssetTypes:Z.addMany,updateAssetType:Z.updateOne,updateAssetTypes:Z.updateMany,deleteAssetType:Z.deleteOne,deleteAssetTypes:Z.deleteMany}}),{initializeAssetTypes:Nr,setAssetType:Kr,setAssetTypes:Wr,addAssetType:Xr,addAssetTypes:Yr,updateAssetType:Zr,updateAssetTypes:Jr,deleteAssetType:Qr,deleteAssetTypes:xr}=ws.actions,ed=t=>t.assetTypeReducer.instances,Es=u.createSelector([ed],t=>Object.values(t)),td=t=>e=>e.assetTypeReducer.instances[t],sd=y(u.createSelector([Es,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),EF=y(u.createSelector([Es,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.organization===e)))),id=ws.reducer,J=P(t=>t.uuid),ad={instances:{}},vs=u.createSlice({name:"assetTypeStatuses",initialState:ad,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,ad)),reducers:{initializeAssetTypeStatuses:J.initialize,addAssetTypeStatus:J.addOne,addAssetTypeStatuses:J.addMany,setAssetTypeStatus:J.setOne,setAssetTypeStatuses:J.setMany,updateAssetTypeStatus:J.updateOne,updateAssetTypeStatuses:J.updateMany,deleteAssetTypeStatus:J.deleteOne,deleteAssetTypeStatuses:J.deleteMany}}),{initializeAssetTypeStatuses:nd,addAssetTypeStatus:cd,addAssetTypeStatuses:rd,setAssetTypeStatus:dd,setAssetTypeStatuses:ud,updateAssetTypeStatus:ld,updateAssetTypeStatuses:od,deleteAssetTypeStatus:hd,deleteAssetTypeStatuses:pd}=vs.actions,yd=t=>t.assetTypeStatusReducer.instances,Vs=u.createSelector([yd],t=>l.fallbackToEmptyArray(Object.values(t).toSorted(l.assetTypeStatusSortFn))),md=t=>e=>e.assetTypeStatusReducer.instances[t],fd=y(u.createSelector([Vs,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),vF=y(u.createSelector([Vs,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.asset_type===e)))),Sd=vs.reducer,Ad={accessToken:"",refreshToken:"",isLoggedIn:!1},Ct=u.createSlice({name:"auth",initialState:Ad,extraReducers:t=>t.addCase(I,e=>Object.assign(e,Ad)),reducers:{setTokens:(t,e)=>{t.accessToken=e.payload.accessToken,t.refreshToken=e.payload.refreshToken},clearTokens:t=>{t.accessToken="",t.refreshToken=""},setLoggedIn:(t,e)=>{e.payload||Ct.caseReducers.clearTokens(t),t.isLoggedIn=e.payload}}}),{setTokens:VF,clearTokens:BF,setLoggedIn:Td}=Ct.actions,zF=t=>t.authReducer.accessToken,jF=t=>t.authReducer.isLoggedIn,Id=Ct.reducer,Q=P(t=>t.uuid),Od={instances:{}},Bs=u.createSlice({name:"documentAttachments",initialState:Od,extraReducers:t=>t.addCase(I,e=>Object.assign(e,Od)),reducers:{initializeDocumentAttachments:Q.initialize,addDocumentAttachment:Q.addOne,addDocumentAttachments:Q.addMany,setDocumentAttachment:Q.setOne,setDocumentAttachments:Q.setMany,updateDocumentAttachment:Q.updateOne,updateDocumentAttachments:Q.updateMany,deleteDocumentAttachment:Q.deleteOne,deleteDocumentAttachments:Q.deleteMany}}),{initializeDocumentAttachments:Pd,addDocumentAttachment:bd,addDocumentAttachments:Fd,setDocumentAttachment:_d,setDocumentAttachments:gd,updateDocumentAttachment:Md,updateDocumentAttachments:Rd,deleteDocumentAttachment:wd,deleteDocumentAttachments:Ed}=Bs.actions,vd=t=>t.documentAttachmentReducer.instances,zs=u.createSelector([vd],t=>Object.values(t)),Vd=t=>e=>e.documentAttachmentReducer.instances[t],Bd=y(u.createSelector([zs,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),DF=y(u.createSelector([zs,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(({document:i})=>e===i)))),zd=Bs.reducer,x=P(({uuid:t})=>t),jd={instances:{}},js=u.createSlice({name:"documents",initialState:jd,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>{Object.assign(e,jd)}),reducers:{initializeDocuments:x.initialize,addDocument:x.addOne,addDocuments:x.addMany,setDocument:x.setOne,setDocuments:x.setMany,updateDocument:x.updateOne,updateDocuments:x.updateMany,deleteDocument:x.deleteOne,deleteDocuments:x.deleteMany}}),{initializeDocuments:Dd,addDocument:qd,addDocuments:Cd,setDocument:$d,setDocuments:Ud,updateDocument:kd,updateDocuments:Ld,deleteDocument:Hd,deleteDocuments:Gd}=js.actions,Nd=js.reducer,Ds=t=>t.documentsReducer.instances,$t=u.createSelector([Ds],t=>Object.values(t)),Kd=t=>e=>e.documentsReducer.instances[t],Wd=y(u.createSelector([$t,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),qF=y(u.createSelector([$t,(t,e)=>e],(t,e)=>t.filter(i=>i.project===e))),CF=y(u.createSelector([$t,(t,e)=>e],(t,e)=>t.filter(i=>i.organization===e))),Xd=y(u.createSelector([Ds,(t,e)=>e],(t,e)=>{if(!t[e])return l.fallbackToEmptyArray([]);const n=l.getDocumentSubTree(e,Object.values(t)).all().map(({model:c})=>c);return l.fallbackToEmptyArray(n)})),ee=P(t=>t.uuid),Yd={instances:{}},qs=u.createSlice({name:"emailDomains",initialState:Yd,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,Yd)),reducers:{initializeEmailDomains:ee.initialize,addEmailDomain:ee.addOne,addEmailDomains:ee.addMany,setEmailDomain:ee.setOne,setEmailDomains:ee.setMany,updateEmailDomain:ee.updateOne,updateEmailDomains:ee.updateMany,deleteEmailDomain:ee.deleteOne,deleteEmailDomains:ee.deleteMany}}),{initializeEmailDomains:Zd,addEmailDomain:Jd,addEmailDomains:Qd,setEmailDomain:xd,setEmailDomains:eu,updateEmailDomain:tu,updateEmailDomains:su,deleteEmailDomain:iu,deleteEmailDomains:au}=qs.actions,nu=t=>t.emailDomainsReducer.instances,Cs=u.createSelector([nu],t=>Object.values(t)),cu=t=>e=>e.emailDomainsReducer.instances[t],ru=y(u.createSelector([Cs,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),$F=y(u.createSelector([Cs,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.organization===e)))),du=qs.reducer,te=P(t=>t.uuid),uu={instances:{}},$s=u.createSlice({name:"formIdentifiers",initialState:uu,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,uu)),reducers:{initializeFormIdentifiers:te.initialize,addFormIdentifier:te.addOne,addFormIdentifiers:te.addMany,setFormIdentifier:te.setOne,setFormIdentifiers:te.setMany,updateFormIdentifier:te.updateOne,updateFormIdentifiers:te.updateMany,deleteFormIdentifier:te.deleteOne,deleteFormIdentifiers:te.deleteMany}}),{initializeFormIdentifiers:lu,addFormIdentifier:ou,addFormIdentifiers:hu,setFormIdentifier:pu,setFormIdentifiers:yu,updateFormIdentifier:mu,updateFormIdentifiers:fu,deleteFormIdentifier:Su,deleteFormIdentifiers:Au}=$s.actions,Tu=t=>t.formIdentifierReducer.instances,Us=u.createSelector([Tu],t=>Object.values(t)),Iu=t=>e=>e.formIdentifierReducer.instances[t],Ou=y(u.createSelector([Us,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),UF=y(u.createSelector([Us,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.form===e)))),Pu=$s.reducer,se=P(t=>t.uuid),bu={instances:{}},ks=u.createSlice({name:"formIdentifierValues",initialState:bu,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,bu)),reducers:{initializeFormIdentifierValues:se.initialize,addFormIdentifierValue:se.addOne,addFormIdentifierValues:se.addMany,setFormIdentifierValue:se.setOne,setFormIdentifierValues:se.setMany,updateFormIdentifierValue:se.updateOne,updateFormIdentifierValues:se.updateMany,deleteFormIdentifierValue:se.deleteOne,deleteFormIdentifierValues:se.deleteMany}}),{initializeFormIdentifierValues:Fu,addFormIdentifierValue:_u,addFormIdentifierValues:gu,setFormIdentifierValue:Mu,setFormIdentifierValues:Ru,updateFormIdentifierValue:wu,updateFormIdentifierValues:Eu,deleteFormIdentifierValue:vu,deleteFormIdentifierValues:Vu}=ks.actions,Bu=t=>t.formIdentifierValueReducer.instances,Ut=u.createSelector([Bu],t=>Object.values(t)),zu=t=>e=>e.formIdentifierValueReducer.instances[t],ju=y(u.createSelector([Ut,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),kF=y(u.createSelector([Ut,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.form_submission===e)))),LF=y(u.createSelector([Ut,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.form_identifier===e)))),Du=ks.reducer,ie=P(t=>t.uuid),qu={instances:{}},Ls=u.createSlice({name:"formRevisionAttachments",initialState:qu,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,qu)),reducers:{initializeFormRevisionAttachments:ie.initialize,addFormRevisionAttachment:ie.addOne,addFormRevisionAttachments:ie.addMany,setFormRevisionAttachment:ie.setOne,setFormRevisionAttachments:ie.setMany,updateFormRevisionAttachment:ie.updateOne,updateFormRevisionAttachments:ie.updateMany,deleteFormRevisionAttachment:ie.deleteOne,deleteFormRevisionAttachments:ie.deleteMany}}),{initializeFormRevisionAttachments:Cu,addFormRevisionAttachment:$u,addFormRevisionAttachments:Uu,setFormRevisionAttachment:ku,setFormRevisionAttachments:Lu,updateFormRevisionAttachment:Hu,updateFormRevisionAttachments:Gu,deleteFormRevisionAttachment:Nu,deleteFormRevisionAttachments:Ku}=Ls.actions,kt=t=>t.formRevisionAttachmentReducer.instances,Wu=u.createSelector([kt],t=>Object.values(t)),Xu=y(u.createSelector([kt,(t,e)=>e],(t,e)=>t[e])),Yu=y(u.createSelector([Wu,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),HF=y(u.createSelector([kt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(Object.values(t).filter(i=>i.form_revision===e)))),Zu=Ls.reducer,ae=P(t=>t.uuid),Ju={instances:{}},Hs=u.createSlice({name:"formRevisions",initialState:Ju,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,Ju)),reducers:{initializeFormRevisions:ae.initialize,addFormRevision:ae.addOne,addFormRevisions:ae.addMany,setFormRevision:ae.setOne,setFormRevisions:ae.setMany,updateFormRevision:ae.updateOne,updateFormRevisions:ae.updateMany,deleteFormRevision:ae.deleteOne,deleteFormRevisions:ae.deleteMany}}),{initializeFormRevisions:Qu,addFormRevision:xu,addFormRevisions:Gs,setFormRevision:el,setFormRevisions:tl,updateFormRevision:sl,updateFormRevisions:il,deleteFormRevision:al,deleteFormRevisions:Ns}=Hs.actions,nl=t=>t.formRevisionReducer.instances,Lt=u.createSelector([nl],t=>Object.values(t)),cl=t=>e=>e.formRevisionReducer.instances[t],rl=y(u.createSelector([Lt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),GF=y(u.createSelector([Lt,(t,e)=>e],(t,e)=>t.filter(i=>i.form===e).toSorted(l.submittedAtModelSortFn).pop())),dl=y(u.createSelector([Lt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.form===e)))),ul=Hs.reducer,ne=P(t=>t.uuid),ll={instances:{}},Ks=u.createSlice({name:"formSubscribers",initialState:ll,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,ll)),reducers:{initializeFormSubscribers:ne.initialize,addFormSubscriber:ne.addOne,addFormSubscribers:ne.addMany,setFormSubscriber:ne.setOne,setFormSubscribers:ne.setMany,updateFormSubscriber:ne.updateOne,updateFormSubscribers:ne.updateMany,deleteFormSubscriber:ne.deleteOne,deleteFormSubscribers:ne.deleteMany}}),{initializeFormSubscribers:ol,addFormSubscriber:hl,addFormSubscribers:Ws,setFormSubscriber:pl,setFormSubscribers:yl,updateFormSubscriber:ml,updateFormSubscribers:fl,deleteFormSubscriber:Sl,deleteFormSubscribers:Xs}=Ks.actions,Al=t=>t.formSubscriberReducer.instances,Ht=u.createSelector([Al],t=>Object.values(t)),Tl=t=>e=>e.formSubscriberReducer.instances[t],Il=y(u.createSelector([Ht,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),Ol=y(u.createSelector([Ht,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.form===e)))),NF=y(u.createSelector([Ht,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.user===e)))),Pl=Ks.reducer,ce=P(t=>t.uuid),bl={instances:{}},Ys=u.createSlice({name:"forms",initialState:bl,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,bl)),reducers:{initializeForms:ce.initialize,addForm:ce.addOne,addForms:ce.addMany,setForm:ce.setOne,setForms:ce.setMany,updateForm:ce.updateOne,updateForms:ce.updateMany,deleteForm:ce.deleteOne,deleteForms:ce.deleteMany}}),{initializeForms:Fl,addForm:_l,addForms:gl,setForm:Ml,setForms:Rl,updateForm:wl,updateForms:El,deleteForm:vl,deleteForms:Vl}=Ys.actions,Bl=Ys.reducer,zl=t=>t.formReducer.instances,Zs=u.createSelector([zl],t=>Object.values(t)),jl=t=>e=>e.formReducer.instances[t],Dl=y(u.createSelector([Zs,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),KF=y(u.createSelector([Zs,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.organization===e)))),re=P(({uuid:t})=>t),ql={instances:{}},Js=u.createSlice({name:"formSubmissionFieldValuesAttachments",initialState:ql,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,ql)),reducers:{initializeFormSubmissionFieldValuesAttachments:re.initialize,addFormSubmissionFieldValuesAttachment:re.addOne,addFormSubmissionFieldValuesAttachments:re.addMany,setFormSubmissionFieldValuesAttachment:re.setOne,setFormSubmissionFieldValuesAttachments:re.setMany,updateFormSubmissionFieldValuesAttachment:re.updateOne,updateFormSubmissionFieldValuesAttachments:re.updateMany,deleteFormSubmissionFieldValuesAttachment:re.deleteOne,deleteFormSubmissionFieldValuesAttachments:re.deleteMany}}),{initializeFormSubmissionFieldValuesAttachments:Cl,addFormSubmissionFieldValuesAttachment:$l,addFormSubmissionFieldValuesAttachments:Qs,setFormSubmissionFieldValuesAttachment:Ul,setFormSubmissionFieldValuesAttachments:kl,updateFormSubmissionFieldValuesAttachment:Ll,updateFormSubmissionFieldValuesAttachments:Hl,deleteFormSubmissionFieldValuesAttachment:Gl,deleteFormSubmissionFieldValuesAttachments:xs}=Js.actions,ei=t=>t.formSubmissionFieldValuesAttachmentReducer.instances,ti=u.createSelector([ei],t=>Object.values(t)),Nl=y(u.createSelector([ei,(t,e)=>e],(t,e)=>t[e])),si=y(u.createSelector([ti,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(a=>i.has(a.uuid)))})),Kl=y(u.createSelector([ti,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.field_values===e)))),Wl=Js.reducer,de=P(({uuid:t})=>t),Xl={instances:{}},ii=u.createSlice({name:"formSubmissionFieldValues",initialState:Xl,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,Xl)),reducers:{initializeFormSubmissionFieldValues:de.initialize,addFormSubmissionFieldValues:de.addOne,addFormSubmissionFieldValuesMany:de.addMany,setFormSubmissionFieldValues:de.setOne,setFormSubmissionFieldValuesMany:de.setMany,updateFormSubmissionFieldValues:de.updateOne,updateFormSubmissionFieldValuesMany:de.updateMany,deleteFormSubmissionFieldValues:de.deleteOne,deleteFormSubmissionFieldValuesMany:de.deleteMany}}),{initializeFormSubmissionFieldValues:Yl,addFormSubmissionFieldValues:Zl,addFormSubmissionFieldValuesMany:ai,setFormSubmissionFieldValues:Jl,setFormSubmissionFieldValuesMany:Ql,updateFormSubmissionFieldValues:xl,updateFormSubmissionFieldValuesMany:eo,deleteFormSubmissionFieldValues:to,deleteFormSubmissionFieldValuesMany:ni}=ii.actions,so=t=>t.formSubmissionFieldValuesReducer.instances,ci=u.createSelector([so],t=>Object.values(t)),io=t=>e=>e.formSubmissionFieldValuesReducer.instances[t],ao=y(u.createSelector([ci,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),no=y(u.createSelector([ci,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.form_submission===e)))),co=ii.reducer,ue=P(t=>t.uuid),ro={instances:{}},ri=u.createSlice({name:"formSubmissions",initialState:ro,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,ro)),reducers:{initializeFormSubmissions:ue.initialize,setFormSubmission:ue.setOne,setFormSubmissions:ue.setMany,addFormSubmission:ue.addOne,addFormSubmissions:ue.addMany,updateFormSubmission:ue.updateOne,updateFormSubmissions:ue.updateMany,deleteFormSubmission:ue.deleteOne,deleteFormSubmissions:ue.deleteMany}}),{initializeFormSubmissions:uo,setFormSubmission:lo,setFormSubmissions:oo,addFormSubmission:ho,addFormSubmissions:nt,updateFormSubmission:po,updateFormSubmissions:yo,deleteFormSubmission:mo,deleteFormSubmissions:ct}=ri.actions,fo=t=>t.formSubmissionReducer.instances,D=u.createSelector([fo],t=>Object.values(t)),So=t=>e=>e.formSubmissionReducer.instances[t],Ao=y(u.createSelector([D,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),To=y(u.createSelector([D,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.form===e)))),WF=y(u.createSelector([D,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(({organization:i})=>i===e)))),XF=y(u.createSelector([D,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(({project:i})=>i===e)))),YF=y(u.createSelector([D,(t,e)=>e,(t,e,i)=>i],(t,e,i)=>l.fallbackToEmptyArray(t.filter(({project:a,form:n})=>a===e&&n===i)))),ZF=y(u.createSelector([D,(t,e)=>e,(t,e,i)=>i],(t,e,i)=>l.fallbackToEmptyArray(t.filter(({organization:a,form:n})=>a===e&&n===i)))),Io=y(u.createSelector([D,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(({issue:i})=>i===e)))),Oo=y(u.createSelector([D,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({issue:a})=>a&&i.has(a)))})),Po=y(u.createSelector([D,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(({asset:i})=>i===e)))),bo=y(u.createSelector([D,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({asset:a})=>a&&i.has(a)))})),Fo=ri.reducer,le=P(t=>t.uuid),_o={instances:{}},di=u.createSlice({name:"geoImages",initialState:_o,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,_o)),reducers:{initializeGeoImages:le.initialize,setGeoImage:le.setOne,setGeoImages:le.setMany,addGeoImage:le.addOne,addGeoImages:le.addMany,updateGeoImage:le.updateOne,updateGeoImages:le.updateMany,deleteGeoImage:le.deleteOne,deleteGeoImages:le.deleteMany}}),{initializeGeoImages:go,setGeoImage:Mo,setGeoImages:Ro,addGeoImage:wo,addGeoImages:Eo,updateGeoImage:vo,updateGeoImages:Vo,deleteGeoImage:Bo,deleteGeoImages:zo}=di.actions,jo=t=>t.geoImageReducer.instances,ui=u.createSelector([jo],t=>Object.values(t)),Do=t=>e=>e.geoImageReducer.instances[t],qo=y(u.createSelector([ui,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),JF=y(u.createSelector([ui,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.project===e)))),Co=di.reducer,oe=P(t=>t.uuid),$o={instances:{}},li=u.createSlice({name:"issueAssociations",initialState:$o,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,$o)),reducers:{initializeIssueAssociations:oe.initialize,addIssueAssociation:oe.addOne,addIssueAssociations:oe.addMany,setIssueAssociation:oe.setOne,setIssueAssociations:oe.setMany,updateIssueAssociation:oe.updateOne,updateIssueAssociations:oe.updateMany,deleteIssueAssociation:oe.deleteOne,deleteIssueAssociations:oe.deleteMany}}),{initializeIssueAssociations:Uo,setIssueAssociations:ko,setIssueAssociation:Lo,updateIssueAssociation:Ho,updateIssueAssociations:Go,addIssueAssociation:No,addIssueAssociations:yt,deleteIssueAssociation:Ko,deleteIssueAssociations:mt}=li.actions,Wo=t=>t.issueAssociationReducer.instances,ft=u.createSelector([Wo],t=>Object.values(t)),Xo=t=>e=>e.issueAssociationReducer.instances[t],Yo=y(u.createSelector([ft,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),Zo=y(u.createSelector([ft,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({issue:a})=>i.has(a)))})),Jo=y(u.createSelector([ft,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(({issue:i})=>i===e)))),Qo=y(u.createSelector([ft,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(({asset:i})=>i===e)))),xo=y(u.createSelector([ft,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({asset:a})=>i.has(a)))})),eh=li.reducer,he=P(t=>t.uuid),th={instances:{}},oi=u.createSlice({name:"issueAttachments",initialState:th,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,th)),reducers:{initializeIssueAttachments:he.initialize,addIssueAttachment:he.addOne,addIssueAttachments:he.addMany,setIssueAttachment:he.setOne,setIssueAttachments:he.setMany,updateIssueAttachment:he.updateOne,updateIssueAttachments:he.updateMany,deleteIssueAttachment:he.deleteOne,deleteIssueAttachments:he.deleteMany}}),{initializeIssueAttachments:sh,addIssueAttachment:ih,addIssueAttachments:hi,setIssueAttachment:ah,setIssueAttachments:nh,updateIssueAttachment:ch,updateIssueAttachments:rh,deleteIssueAttachment:dh,deleteIssueAttachments:pi}=oi.actions,uh=t=>t.issueAttachmentReducer.instances,yi=u.createSelector([uh],t=>Object.values(t)),lh=y(u.createSelector([yi,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(({issue:i})=>e===i)))),oh=t=>e=>e.issueAttachmentReducer.instances[t],hh=y(u.createSelector([yi,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),ph=oi.reducer,pe=P(t=>t.uuid),yh={instances:{}},mi=u.createSlice({name:"issueCommentAttachments",initialState:yh,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,yh)),reducers:{initializeIssueCommentAttachments:pe.initialize,addIssueCommentAttachment:pe.addOne,addIssueCommentAttachments:pe.addMany,setIssueCommentAttachment:pe.setOne,setIssueCommentAttachments:pe.setMany,updateIssueCommentAttachment:pe.updateOne,updateIssueCommentAttachments:pe.updateMany,deleteIssueCommentAttachment:pe.deleteOne,deleteIssueCommentAttachments:pe.deleteMany}}),{initializeIssueCommentAttachments:mh,addIssueCommentAttachment:fh,addIssueCommentAttachments:Sh,setIssueCommentAttachment:Ah,setIssueCommentAttachments:Th,updateIssueCommentAttachment:Ih,updateIssueCommentAttachments:Oh,deleteIssueCommentAttachment:Ph,deleteIssueCommentAttachments:bh}=mi.actions,Fh=t=>t.issueCommentAttachmentReducer.instances,fi=u.createSelector([Fh],t=>Object.values(t)),_h=t=>e=>e.issueCommentAttachmentReducer.instances[t],gh=y(u.createSelector([fi,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),QF=y(u.createSelector([fi,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(({issue_comment:i})=>e===i)))),Mh=mi.reducer,ye=P(t=>t.uuid),Rh={instances:{}},Si=u.createSlice({name:"issueComments",initialState:Rh,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,Rh)),reducers:{initializeIssueComments:ye.initialize,addIssueComment:ye.addOne,addIssueComments:ye.addMany,setIssueComment:ye.setOne,setIssueComments:ye.setMany,updateIssueComment:ye.updateOne,updateIssueComments:ye.updateMany,deleteIssueComment:ye.deleteOne,deleteIssueComments:ye.deleteMany}}),{initializeIssueComments:wh,addIssueComment:Eh,addIssueComments:vh,setIssueComment:Vh,setIssueComments:Bh,updateIssueComment:zh,updateIssueComments:jh,deleteIssueComment:Dh,deleteIssueComments:qh}=Si.actions,Ai=t=>t.issueCommentReducer.instances,Ch=t=>e=>e.issueCommentReducer.instances[t],$h=y(u.createSelector([Ai,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(Object.values(t).filter(({uuid:a})=>i.has(a)))})),xF=y(u.createSelector([Ai,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(Object.values(t).filter(i=>i.issue===e)))),Uh=Si.reducer,me=P(t=>t.uuid),kh={instances:{}},Ti=u.createSlice({name:"issues",initialState:kh,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,kh)),reducers:{initializeIssues:me.initialize,addIssue:me.addOne,addIssues:me.addMany,setIssue:me.setOne,setIssues:me.setMany,updateIssue:me.updateOne,updateIssues:me.updateMany,deleteIssue:me.deleteOne,deleteIssues:me.deleteMany}}),{initializeIssues:Lh,addIssue:Hh,addIssues:Ii,setIssue:Gh,setIssues:Nh,updateIssue:Kh,updateIssues:Wh,deleteIssue:Xh,deleteIssues:Oi}=Ti.actions,Yh=t=>t.issueReducer.instances,Gt=u.createSelector([Yh],t=>Object.values(t)),Zh=t=>e=>e.issueReducer.instances[t],Jh=y(u.createSelector([Gt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),e_=y(u.createSelector([Gt,(t,e)=>e],(t,e)=>t.filter(i=>i.project===e))),Qh=y(u.createSelector([Gt,(t,e)=>e],(t,e)=>t.filter(i=>i.issue_type===e))),xh=Ti.reducer,fe=P(t=>t.uuid),ep={instances:{}},Pi=u.createSlice({name:"issueTypeAttachments",initialState:ep,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,ep)),reducers:{initializeIssueTypeAttachments:fe.initialize,addIssueTypeAttachment:fe.addOne,addIssueTypeAttachments:fe.addMany,setIssueTypeAttachment:fe.setOne,setIssueTypeAttachments:fe.setMany,updateIssueTypeAttachment:fe.updateOne,updateIssueTypeAttachments:fe.updateMany,deleteIssueTypeAttachment:fe.deleteOne,deleteIssueTypeAttachments:fe.deleteMany}}),{initializeIssueTypeAttachments:tp,addIssueTypeAttachment:sp,addIssueTypeAttachments:ip,setIssueTypeAttachment:ap,setIssueTypeAttachments:np,updateIssueTypeAttachment:cp,updateIssueTypeAttachments:rp,deleteIssueTypeAttachment:dp,deleteIssueTypeAttachments:up}=Pi.actions,lp=t=>t.issueTypeAttachmentReducer.instances,bi=u.createSelector([lp],t=>Object.values(t)),op=t=>e=>e.issueTypeAttachmentReducer.instances[t],hp=y(u.createSelector([bi,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),t_=y(u.createSelector([bi,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(({issue_type:i})=>e===i)))),pp=Pi.reducer,Se=P(t=>t.uuid),yp={instances:{}},Fi=u.createSlice({name:"issueTypeFieldsAttachments",initialState:yp,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,yp)),reducers:{initializeIssueTypeFieldsAttachments:Se.initialize,addIssueTypeFieldsAttachment:Se.addOne,addIssueTypeFieldsAttachments:Se.addMany,setIssueTypeFieldsAttachment:Se.setOne,setIssueTypeFieldsAttachments:Se.setMany,updateIssueTypeFieldsAttachment:Se.updateOne,updateIssueTypeFieldsAttachments:Se.updateMany,deleteIssueTypeFieldsAttachment:Se.deleteOne,deleteIssueTypeFieldsAttachments:Se.deleteMany}}),{initializeIssueTypeFieldsAttachments:mp,addIssueTypeFieldsAttachment:fp,addIssueTypeFieldsAttachments:Sp,setIssueTypeFieldsAttachment:Ap,setIssueTypeFieldsAttachments:Tp,updateIssueTypeFieldsAttachment:Ip,updateIssueTypeFieldsAttachments:Op,deleteIssueTypeFieldsAttachment:Pp,deleteIssueTypeFieldsAttachments:bp}=Fi.actions,Fp=t=>t.issueTypeFieldsAttachmentReducer.instances,_i=u.createSelector([Fp],t=>Object.values(t)),s_=y(u.createSelector([_i,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.fields_revision===e)))),_p=t=>e=>e.issueTypeFieldsAttachmentReducer.instances[t],gp=y(u.createSelector([_i,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),Mp=Fi.reducer,Ae=P(t=>t.uuid),Rp={instances:{}},gi=u.createSlice({name:"issueTypeFieldValues",initialState:Rp,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,Rp)),reducers:{initializeIssueTypeFieldValues:Ae.initialize,addIssueTypeFieldValues:Ae.addOne,addIssueTypeFieldValuesMany:Ae.addMany,setIssueTypeFieldValues:Ae.setOne,setIssueTypeFieldValuesMany:Ae.setMany,updateIssueTypeFieldValues:Ae.updateOne,updateIssueTypeFieldValuesMany:Ae.updateMany,deleteIssueTypeFieldValues:Ae.deleteOne,deleteIssueTypeFieldValuesMany:Ae.deleteMany}}),{initializeIssueTypeFieldValues:wp,addIssueTypeFieldValues:Ep,addIssueTypeFieldValuesMany:vp,setIssueTypeFieldValues:Vp,setIssueTypeFieldValuesMany:Bp,updateIssueTypeFieldValues:zp,updateIssueTypeFieldValuesMany:jp,deleteIssueTypeFieldValues:Dp,deleteIssueTypeFieldValuesMany:qp}=gi.actions,Cp=t=>t.issueTypeFieldValuesReducer.instances,Nt=u.createSelector([Cp],t=>Object.values(t)),i_=y(u.createSelector([Nt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.issue===e)))),$p=t=>e=>e.issueTypeFieldValuesReducer.instances[t],Up=y(u.createSelector([Nt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),kp=gi.reducer,Te=P(t=>t.uuid),Lp={instances:{}},Mi=u.createSlice({name:"issueTypeFields",initialState:Lp,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,Lp)),reducers:{initializeIssueTypeFields:Te.initialize,addIssueTypeFields:Te.addOne,addIssueTypeFieldsMany:Te.addMany,setIssueTypeFields:Te.setOne,setIssueTypeFieldsMany:Te.setMany,updateIssueTypeFields:Te.updateOne,updateIssueTypeFieldsMany:Te.updateMany,deleteIssueTypeFields:Te.deleteOne,deleteIssueTypeFieldsMany:Te.deleteMany}}),{initializeIssueTypeFields:Hp,addIssueTypeFields:Gp,addIssueTypeFieldsMany:Np,setIssueTypeFields:Kp,setIssueTypeFieldsMany:Wp,updateIssueTypeFields:Xp,updateIssueTypeFieldsMany:Yp,deleteIssueTypeFields:Zp,deleteIssueTypeFieldsMany:Jp}=Mi.actions,Qp=t=>t.issueTypeFieldsReducer.instances,bt=u.createSelector([Qp],t=>Object.values(t)),a_=y(u.createSelector([bt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.issue_type===e)))),n_=y(u.createSelector([bt,(t,e)=>e],(t,e)=>t.filter(i=>i.issue_type===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),c_=y(u.createSelector([bt,Nt,(t,e)=>e],(t,e,i)=>{const a=new Set(t.filter(n=>n.issue_type===i).map(n=>n.uuid));return l.fallbackToEmptyArray(e.filter(n=>a.has(n.fields_revision)))})),xp=t=>e=>e.issueTypeFieldsReducer.instances[t],ey=y(u.createSelector([bt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),ty=Mi.reducer,Ie=P(t=>t.uuid),sy={instances:{}},Ri=u.createSlice({name:"issueTypeFieldValuesAttachments",initialState:sy,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,sy)),reducers:{initializeIssueTypeFieldValuesAttachments:Ie.initialize,addIssueTypeFieldValuesAttachment:Ie.addOne,addIssueTypeFieldValuesAttachments:Ie.addMany,setIssueTypeFieldValuesAttachment:Ie.setOne,setIssueTypeFieldValuesAttachments:Ie.setMany,updateIssueTypeFieldValuesAttachment:Ie.updateOne,updateIssueTypeFieldValuesAttachments:Ie.updateMany,deleteIssueTypeFieldValuesAttachment:Ie.deleteOne,deleteIssueTypeFieldValuesAttachments:Ie.deleteMany}}),{initializeIssueTypeFieldValuesAttachments:iy,addIssueTypeFieldValuesAttachment:ay,addIssueTypeFieldValuesAttachments:wi,setIssueTypeFieldValuesAttachment:ny,setIssueTypeFieldValuesAttachments:cy,updateIssueTypeFieldValuesAttachment:ry,updateIssueTypeFieldValuesAttachments:dy,deleteIssueTypeFieldValuesAttachment:uy,deleteIssueTypeFieldValuesAttachments:Ei}=Ri.actions,ly=t=>t.issueTypeFieldValuesAttachmentReducer.instances,vi=u.createSelector([ly],t=>Object.values(t)),oy=t=>e=>e.issueTypeFieldValuesAttachmentReducer.instances[t],hy=y(u.createSelector([vi,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),py=y(u.createSelector([vi,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.field_values===e)))),yy=Ri.reducer,Oe=P(t=>t.uuid),my={instances:{}},Vi=u.createSlice({name:"issueTypeIdentifiers",initialState:my,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,my)),reducers:{initializeIssueTypeIdentifiers:Oe.initialize,addIssueTypeIdentifier:Oe.addOne,addIssueTypeIdentifiers:Oe.addMany,setIssueTypeIdentifier:Oe.setOne,setIssueTypeIdentifiers:Oe.setMany,updateIssueTypeIdentifier:Oe.updateOne,updateIssueTypeIdentifiers:Oe.updateMany,deleteIssueTypeIdentifier:Oe.deleteOne,deleteIssueTypeIdentifiers:Oe.deleteMany}}),{initializeIssueTypeIdentifiers:fy,addIssueTypeIdentifier:Sy,addIssueTypeIdentifiers:Ay,setIssueTypeIdentifier:Ty,setIssueTypeIdentifiers:Iy,updateIssueTypeIdentifier:Oy,updateIssueTypeIdentifiers:Py,deleteIssueTypeIdentifier:by,deleteIssueTypeIdentifiers:Fy}=Vi.actions,_y=t=>t.issueTypeIdentifierReducer.instances,Bi=u.createSelector([_y],t=>Object.values(t)),gy=t=>e=>e.issueTypeIdentifierReducer.instances[t],My=y(u.createSelector([Bi,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),r_=y(u.createSelector([Bi,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.issue_type===e)))),Ry=Vi.reducer,Pe=P(t=>t.uuid),wy={instances:{}},zi=u.createSlice({name:"issueTypeIdentifierValues",initialState:wy,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,wy)),reducers:{initializeIssueTypeIdentifierValues:Pe.initialize,addIssueTypeIdentifierValue:Pe.addOne,addIssueTypeIdentifierValues:Pe.addMany,setIssueTypeIdentifierValue:Pe.setOne,setIssueTypeIdentifierValues:Pe.setMany,updateIssueTypeIdentifierValue:Pe.updateOne,updateIssueTypeIdentifierValues:Pe.updateMany,deleteIssueTypeIdentifierValue:Pe.deleteOne,deleteIssueTypeIdentifierValues:Pe.deleteMany}}),{initializeIssueTypeIdentifierValues:Ey,addIssueTypeIdentifierValue:vy,addIssueTypeIdentifierValues:Vy,setIssueTypeIdentifierValue:By,setIssueTypeIdentifierValues:zy,updateIssueTypeIdentifierValue:jy,updateIssueTypeIdentifierValues:Dy,deleteIssueTypeIdentifierValue:qy,deleteIssueTypeIdentifierValues:Cy}=zi.actions,$y=t=>t.issueTypeIdentifierValueReducer.instances,Kt=u.createSelector([$y],t=>Object.values(t)),Uy=t=>e=>e.issueTypeIdentifierValueReducer.instances[t],ky=y(u.createSelector([Kt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),d_=y(u.createSelector([Kt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.issue===e)))),u_=y(u.createSelector([Kt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.issue_type_identifier===e)))),Ly=zi.reducer,be=P(t=>t.uuid),Hy={instances:{}},ji=u.createSlice({name:"issueTypePriorities",initialState:Hy,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,Hy)),reducers:{initializeIssueTypePriorities:be.initialize,addIssueTypePriority:be.addOne,addIssueTypePriorities:be.addMany,setIssueTypePriority:be.setOne,setIssueTypePriorities:be.setMany,updateIssueTypePriority:be.updateOne,updateIssueTypePriorities:be.updateMany,deleteIssueTypePriority:be.deleteOne,deleteIssueTypePriorities:be.deleteMany}}),{initializeIssueTypePriorities:Gy,addIssueTypePriority:Ny,addIssueTypePriorities:Ky,setIssueTypePriority:Wy,setIssueTypePriorities:Xy,updateIssueTypePriority:Yy,updateIssueTypePriorities:Zy,deleteIssueTypePriority:Jy,deleteIssueTypePriorities:Qy}=ji.actions,xy=t=>t.issueTypePriorityReducer.instances,Di=u.createSelector([xy],t=>l.fallbackToEmptyArray(Object.values(t).toSorted(l.issueTypePrioritySortFn))),qi=t=>e=>e.issueTypePriorityReducer.instances[t],em=y(u.createSelector([Di,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),l_=y(u.createSelector([Di,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.issue_type===e)))),tm=ji.reducer,Fe=P(t=>t.uuid),sm={instances:{}},Ci=u.createSlice({name:"issueTypes",initialState:sm,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,sm)),reducers:{initializeIssueTypes:Fe.initialize,addIssueType:Fe.addOne,addIssueTypes:Fe.addMany,setIssueType:Fe.setOne,setIssueTypes:Fe.setMany,updateIssueType:Fe.updateOne,updateIssueTypes:Fe.updateMany,deleteIssueType:Fe.deleteOne,deleteIssueTypes:Fe.deleteMany}}),{initializeIssueTypes:im,addIssueType:am,addIssueTypes:nm,setIssueType:cm,setIssueTypes:rm,updateIssueType:dm,updateIssueTypes:um,deleteIssueType:lm,deleteIssueTypes:om}=Ci.actions,hm=t=>t.issueTypeReducer.instances,$i=u.createSelector(hm,t=>Object.values(t)),pm=t=>e=>e.issueTypeReducer.instances[t],ym=y(u.createSelector([$i,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),o_=y(u.createSelector([$i,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.organization===e)))),mm=Ci.reducer,_e=P(t=>t.uuid),fm={instances:{}},Ui=u.createSlice({name:"issueTypeStatuses",initialState:fm,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,fm)),reducers:{initializeIssueTypeStatuses:_e.initialize,addIssueTypeStatus:_e.addOne,addIssueTypeStatuses:_e.addMany,setIssueTypeStatus:_e.setOne,setIssueTypeStatuses:_e.setMany,updateIssueTypeStatus:_e.updateOne,updateIssueTypeStatuses:_e.updateMany,deleteIssueTypeStatus:_e.deleteOne,deleteIssueTypeStatuses:_e.deleteMany}}),{initializeIssueTypeStatuses:Sm,addIssueTypeStatus:Am,addIssueTypeStatuses:Tm,setIssueTypeStatus:Im,setIssueTypeStatuses:Om,updateIssueTypeStatus:Pm,updateIssueTypeStatuses:bm,deleteIssueTypeStatus:Fm,deleteIssueTypeStatuses:_m}=Ui.actions,gm=t=>t.issueTypeStatusReducer.instances,ki=u.createSelector([gm],t=>l.fallbackToEmptyArray(Object.values(t).toSorted(l.issueTypeStatusSortFn))),Li=t=>e=>e.issueTypeStatusReducer.instances[t],Mm=y(u.createSelector([ki,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),h_=y(u.createSelector([ki,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.issue_type===e)))),Rm=Ui.reducer,ge=P(t=>t.uuid),wm={instances:{}},Hi=u.createSlice({name:"issueUpdates",initialState:wm,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,wm)),reducers:{initializeIssueUpdates:ge.initialize,addIssueUpdate:ge.addOne,addIssueUpdates:ge.addMany,setIssueUpdate:ge.setOne,setIssueUpdates:ge.setMany,updateIssueUpdate:ge.updateOne,updateIssueUpdates:ge.updateMany,deleteIssueUpdate:ge.deleteOne,deleteIssueUpdates:ge.deleteMany}}),{initializeIssueUpdates:Em,addIssueUpdate:Gi,addIssueUpdates:Ni,setIssueUpdate:vm,setIssueUpdates:Vm,updateIssueUpdate:Bm,updateIssueUpdates:zm,deleteIssueUpdate:Ki,deleteIssueUpdates:Wi}=Hi.actions,Xi=t=>t.issueUpdateReducer.instances,Yi=u.createSelector([Xi],t=>Object.values(t)),jm=y(u.createSelector([Xi,(t,e)=>e],(t,e)=>t[e])),Dm=y(u.createSelector([Yi,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),qm=y(u.createSelector([Yi,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.issue===e)))),Cm=Hi.reducer,Me=P(t=>t.id),$m={instances:{},currentUser:null},Zi=u.createSlice({name:"users",initialState:$m,extraReducers:t=>t.addCase(I,e=>Object.assign(e,$m)).addCase(b,e=>Object.assign(e,{...e,instances:[]})),reducers:{initializeUsers:Me.initialize,setUsers:Me.setMany,setUser:Me.setOne,addUsers:Me.addMany,addUser:Me.addOne,updateUsers:Me.updateMany,updateUser:Me.updateOne,deleteUser:Me.deleteOne,deleteUsers:Me.deleteMany,setCurrentUser:(t,e)=>{t.currentUser=e.payload},setCurrentUserProfile:(t,e)=>{if(!t.currentUser)return;t.currentUser.profile=e.payload;const i=t.instances[t.currentUser.id];if(!i)throw new Error("Unable to find current user in users slice");i.profile=e.payload}}}),{initializeUsers:Um,setUsers:km,setUser:Lm,addUsers:Hm,addUser:Ji,updateUsers:Gm,updateUser:Nm,deleteUser:Qi,deleteUsers:Km,setCurrentUser:p_,setCurrentUserProfile:y_}=Zi.actions,Wm=Zi.reducer,Xm=t=>t.userReducer.currentUser,xi=t=>t.userReducer.instances,Wt=u.createSelector([xi],t=>Object.values(t)),Xt=t=>e=>e.userReducer.instances[t],Ym=y(u.createSelector([Wt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({id:a})=>i.has(a)))})),Re=P(t=>t.uuid),Zm={instances:{}},ea=u.createSlice({name:"organizationAccess",initialState:Zm,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,Zm)),reducers:{initializeOrganizationAccesses:Re.initialize,addOrganizationAccess:Re.addOne,addOrganizationAccesses:Re.addMany,setOrganizationAccess:Re.setOne,setOrganizationAccesses:Re.setMany,updateOrganizationAccess:Re.updateOne,updateOrganizationAccesses:Re.updateMany,deleteOrganizationAccess:Re.deleteOne,deleteOrganizationAccesses:Re.deleteMany}}),{initializeOrganizationAccesses:Jm,addOrganizationAccess:Qm,addOrganizationAccesses:xm,setOrganizationAccess:ef,setOrganizationAccesses:tf,updateOrganizationAccess:sf,updateOrganizationAccesses:af,deleteOrganizationAccess:nf,deleteOrganizationAccesses:cf}=ea.actions,rf=ea.reducer,Yt=t=>t.organizationAccessReducer.instances,df=t=>e=>e.organizationAccessReducer.instances[t],uf=y(u.createSelector([Yt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(Object.values(t).filter(({uuid:a})=>i.has(a)))})),m_=u.createSelector([Xm,Yt],(t,e)=>Object.values(e).find(a=>a.user===t?.id)??null),lf=u.createSelector([Yt],t=>{const e={};for(const i of Object.values(t))e[i.user]=i;return l.fallbackToEmptyObject(e)}),f_=y(u.createSelector([xi,lf,(t,e)=>e],(t,e,i)=>l.fallbackToEmptyArray(Object.values(t).filter(a=>{const n=e[a.id];return!!n&&n.organization===i})))),we=P(t=>t.uuid),of={instances:{}},ta=u.createSlice({name:"organizations",initialState:of,extraReducers:t=>t.addMatcher(u.isAnyOf(I),e=>Object.assign(e,of)),reducers:{initializeOrganizations:we.initialize,setOrganizations:we.setMany,setOrganization:we.setOne,addOrganizations:we.addMany,addOrganization:we.addOne,updateOrganizations:we.updateMany,updateOrganization:we.updateOne,deleteOrganization:we.deleteOne,deleteOrganizations:we.deleteMany}}),{initializeOrganizations:hf,setOrganizations:pf,setOrganization:yf,addOrganizations:mf,addOrganization:ff,updateOrganizations:Sf,updateOrganization:Af,deleteOrganization:Tf,deleteOrganizations:If}=ta.actions,Of=t=>t.organizationReducer.instances,Pf=u.createSelector([Of],t=>Object.values(t)),bf=t=>e=>e.organizationReducer.instances[t],Ff=y(u.createSelector([Pf,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),_f=ta.reducer,gf=(t,e,i)=>{const a=t.uuid?t:{...t,uuid:at.v4()};return{payload:a,type:"",meta:{offline:{effect:{timestamp:new Date().toISOString(),request:a,BASE_URL:e,serviceName:i}}}}},Mf={deletedRequests:[],latestRetryTime:0},sa=u.createSlice({name:"outbox",initialState:Mf,extraReducers:t=>t.addCase(I,e=>Object.assign(e,Mf)),reducers:{enqueueRequest:{reducer:(t,e)=>t,prepare:t=>{console.debug("Preparing to enqueue request",t.url);const{BASE_URL:e,serviceName:i,...a}=t;return gf(a,e,i)}},markForDeletion(t,e){t.deletedRequests.push(e.payload)},markAsDeleted(t,e){const i=t.deletedRequests.indexOf(e.payload);i!==-1&&t.deletedRequests.splice(i,1)},_setLatestRetryTime:(t,e)=>{t.latestRetryTime=e.payload}}}),S_=t=>t.outboxReducer.deletedRequests,A_=t=>t.outboxReducer.latestRetryTime,{enqueueRequest:Rf,markForDeletion:T_,markAsDeleted:wf,_setLatestRetryTime:Ef}=sa.actions,vf=sa.reducer,Ee=P(t=>t.uuid),Vf={instances:{}},ia=u.createSlice({name:"projectAccess",initialState:Vf,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,Vf)),reducers:{initializeProjectAccesses:Ee.initialize,addProjectAccess:Ee.addOne,addProjectAccesses:Ee.addMany,setProjectAccess:Ee.setOne,setProjectAccesses:Ee.setMany,updateProjectAccess:Ee.updateOne,updateProjectAccesses:Ee.updateMany,deleteProjectAccess:Ee.deleteOne,deleteProjectAccesses:Ee.deleteMany}}),{initializeProjectAccesses:Bf,addProjectAccess:zf,addProjectAccesses:jf,setProjectAccess:Df,setProjectAccesses:qf,updateProjectAccess:Cf,updateProjectAccesses:$f,deleteProjectAccess:Uf,deleteProjectAccesses:kf}=ia.actions,Lf=ia.reducer,aa=t=>t.projectAccessReducer.instances,Ft=u.createSelector(aa,t=>Object.values(t)),Hf=t=>e=>e.projectAccessReducer.instances[t],Gf=y(u.createSelector([Ft,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),I_=y(u.createSelector([aa,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(Object.values(t).filter(i=>i.project===e)))),O_=y(u.createSelector([Ft,(t,e)=>e],(t,e)=>{const i={};for(const a of t.filter(n=>n.project===e))i[a.user]=a;return i})),P_=y(u.createSelector([Wt,Ft,(t,e)=>e],(t,e,i)=>{const a=new Set(e.filter(n=>n.project===i).map(n=>n.user));return l.fallbackToEmptyArray(t.filter(n=>a.has(n.id)))})),ve=P(t=>t.uuid),Nf={instances:{}},na=u.createSlice({name:"projectAttachments",initialState:Nf,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,Nf)),reducers:{initializeProjectAttachments:ve.initialize,addProjectAttachment:ve.addOne,addProjectAttachments:ve.addMany,setProjectAttachment:ve.setOne,setProjectAttachments:ve.setMany,updateProjectAttachment:ve.updateOne,updateProjectAttachments:ve.updateMany,deleteProjectAttachment:ve.deleteOne,deleteProjectAttachments:ve.deleteMany}}),{initializeProjectAttachments:Kf,addProjectAttachment:Wf,addProjectAttachments:Xf,setProjectAttachment:Yf,setProjectAttachments:Zf,updateProjectAttachment:Jf,updateProjectAttachments:Qf,deleteProjectAttachment:xf,deleteProjectAttachments:eS}=na.actions,tS=t=>t.projectAttachmentReducer.instances,ca=u.createSelector([tS],t=>Object.values(t)),sS=t=>e=>e.projectAttachmentReducer.instances[t],iS=y(u.createSelector([ca,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),b_=y(u.createSelector([ca,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(({project:i})=>e===i)))),aS=na.reducer,Ve=P(t=>t.uuid),nS={instances:{}},ra=u.createSlice({name:"projectComments",initialState:nS,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,nS)),reducers:{initializeProjectComments:Ve.initialize,addProjectComment:Ve.addOne,addProjectComments:Ve.addMany,setProjectComment:Ve.setOne,setProjectComments:Ve.setMany,updateProjectComment:Ve.updateOne,updateProjectComments:Ve.updateMany,deleteProjectComment:Ve.deleteOne,deleteProjectComments:Ve.deleteMany}}),{initializeProjectComments:cS,addProjectComment:rS,addProjectComments:dS,setProjectComment:uS,setProjectComments:lS,updateProjectComment:oS,updateProjectComments:hS,deleteProjectComment:pS,deleteProjectComments:yS}=ra.actions,mS=t=>t.projectCommentReducer.instances,Zt=u.createSelector([mS],t=>l.fallbackToEmptyArray(Object.values(t).toSorted(l.submittedAtModelSortFn))),fS=t=>e=>e.projectCommentReducer.instances[t],SS=y(u.createSelector([Zt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),F_=y(u.createSelector([Zt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.project===e)))),__=y(u.createSelector([Zt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(a=>i.has(a.project)))})),AS=ra.reducer,Be=P(t=>t.uuid),TS={instances:{}},da=u.createSlice({name:"projectFiles",initialState:TS,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,TS)),reducers:{initializeProjectFiles:Be.initialize,setProjectFile:Be.setOne,setProjectFiles:Be.setMany,addProjectFile:Be.addOne,addProjectFiles:Be.addMany,updateProjectFile:Be.updateOne,updateProjectFiles:Be.updateMany,deleteProjectFile:Be.deleteOne,deleteProjectFiles:Be.deleteMany}}),{initializeProjectFiles:IS,setProjectFile:OS,setProjectFiles:PS,addProjectFile:bS,addProjectFiles:FS,updateProjectFile:_S,updateProjectFiles:gS,deleteProjectFile:MS,deleteProjectFiles:RS}=da.actions,wS=t=>t.projectFileReducer.instances,ES=u.createSelector([wS],t=>l.fallbackToEmptyArray(Object.values(t).toSorted((e,i)=>e.z_index-i.z_index))),vS=t=>e=>e.projectFileReducer.instances[t],VS=y(u.createSelector([ES,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),BS=da.reducer,ze=P(t=>t.uuid),zS={instances:{}},ua=u.createSlice({name:"projects",initialState:zS,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,zS)),reducers:{initializeProjects:ze.initialize,setProjects:ze.setMany,setProject:ze.setOne,addProjects:ze.addMany,addProject:ze.addOne,updateProjects:ze.updateMany,updateProject:ze.updateOne,deleteProject:ze.deleteOne,deleteProjects:ze.deleteMany}}),{initializeProjects:jS,setProjects:DS,setProject:qS,addProjects:CS,addProject:$S,updateProjects:US,updateProject:kS,deleteProject:LS,deleteProjects:HS}=ua.actions,GS=ua.reducer,NS=t=>t.projectReducer.instances,Jt=u.createSelector([NS],t=>Object.values(t)),KS=t=>e=>e.projectReducer.instances[t],WS=y(u.createSelector([Jt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),g_=y(u.createSelector([Jt,Ft,(t,e)=>e],(t,e,i)=>{const a=new Set(e.filter(n=>n.user===i).map(n=>n.project));return l.fallbackToEmptyArray(t.filter(n=>a.has(n.uuid)))})),M_=y(u.createSelector([Jt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.organization===e)))),je=P(({uuid:t})=>t),XS={instances:{}},la=u.createSlice({name:"procedureInitiatives",initialState:XS,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,XS)),reducers:{initializeProcedureInitiatives:je.initialize,addProcedureInitiative:je.addOne,addProcedureInitiatives:je.addMany,setProcedureInitiative:je.setOne,setProcedureInitiatives:je.setMany,updateProcedureInitiative:je.updateOne,updateProcedureInitiatives:je.updateMany,deleteProcedureInitiative:je.deleteOne,deleteProcedureInitiatives:je.deleteMany}}),{initializeProcedureInitiatives:YS,addProcedureInitiative:ZS,addProcedureInitiatives:JS,setProcedureInitiative:QS,setProcedureInitiatives:xS,updateProcedureInitiative:eA,updateProcedureInitiatives:tA,deleteProcedureInitiative:sA,deleteProcedureInitiatives:iA}=la.actions,aA=la.reducer,nA=t=>t.procedureInitiativeReducer.instances,Qt=u.createSelector([nA],t=>Object.values(t)),cA=t=>e=>e.procedureInitiativeReducer.instances[t],rA=y(u.createSelector([Qt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),R_=y(u.createSelector([Qt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.project===e)))),w_=y(u.createSelector([Qt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure_type===e)))),De=P(({uuid:t})=>t),dA={instances:{}},oa=u.createSlice({name:"procedures",initialState:dA,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,dA)),reducers:{initializeProcedures:De.initialize,addProcedure:De.addOne,addProcedures:De.addMany,setProcedure:De.setOne,setProcedures:De.setMany,updateProcedure:De.updateOne,updateProcedures:De.updateMany,deleteProcedure:De.deleteOne,deleteProcedures:De.deleteMany}}),{initializeProcedures:uA,addProcedure:lA,addProcedures:St,setProcedure:oA,setProcedures:hA,updateProcedure:pA,updateProcedures:yA,deleteProcedure:mA,deleteProcedures:At}=oa.actions,fA=oa.reducer,SA=t=>t.procedureReducer.instances,rt=u.createSelector([SA],t=>Object.values(t)),AA=t=>e=>e.procedureReducer.instances[t],TA=y(u.createSelector([rt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),E_=y(u.createSelector([rt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.project===e)))),IA=y(u.createSelector([rt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure_type===e)))),OA=y(u.createSelector([rt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.asset===e)))),PA=y(u.createSelector([rt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({asset:a})=>i.has(a)))})),bA=y(u.createSelector([rt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure_initiative===e)))),qe=P(t=>t.uuid),FA={instances:{}},ha=u.createSlice({name:"procedureStepAssignees",initialState:FA,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,FA)),reducers:{initializeProcedureStepAssignees:qe.initialize,addProcedureStepAssignee:qe.addOne,addProcedureStepAssignees:qe.addMany,setProcedureStepAssignee:qe.setOne,setProcedureStepAssignees:qe.setMany,updateProcedureStepAssignee:qe.updateOne,updateProcedureStepAssignees:qe.updateMany,deleteProcedureStepAssignee:qe.deleteOne,deleteProcedureStepAssignees:qe.deleteMany}}),{initializeProcedureStepAssignees:_A,addProcedureStepAssignee:gA,addProcedureStepAssignees:MA,setProcedureStepAssignee:RA,setProcedureStepAssignees:wA,updateProcedureStepAssignee:EA,updateProcedureStepAssignees:vA,deleteProcedureStepAssignee:VA,deleteProcedureStepAssignees:BA}=ha.actions,zA=t=>t.procedureStepAssigneeReducer.instances,_t=u.createSelector([zA],t=>Object.values(t)),jA=t=>e=>e.procedureStepAssigneeReducer.instances[t],DA=y(u.createSelector([_t,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),v_=y(u.createSelector([_t,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure===e)))),V_=y(u.createSelector([_t,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure_step===e)))),B_=y(u.createSelector([_t,(t,e)=>e,(t,e,i)=>i],(t,e,i)=>l.fallbackToEmptyArray(t.filter(({procedure:a,procedure_step:n})=>a===e&&n===i)))),qA=ha.reducer,Ce=P(t=>t.uuid),CA={instances:{}},pa=u.createSlice({name:"procedureStepComments",initialState:CA,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,CA)),reducers:{initializeProcedureStepComments:Ce.initialize,addProcedureStepComment:Ce.addOne,addProcedureStepComments:Ce.addMany,setProcedureStepComment:Ce.setOne,setProcedureStepComments:Ce.setMany,updateProcedureStepComment:Ce.updateOne,updateProcedureStepComments:Ce.updateMany,deleteProcedureStepComment:Ce.deleteOne,deleteProcedureStepComments:Ce.deleteMany}}),{initializeProcedureStepComments:$A,addProcedureStepComment:UA,addProcedureStepComments:kA,setProcedureStepComment:LA,setProcedureStepComments:HA,updateProcedureStepComment:GA,updateProcedureStepComments:NA,deleteProcedureStepComment:KA,deleteProcedureStepComments:WA}=pa.actions,XA=t=>t.procedureStepCommentReducer.instances,gt=u.createSelector([XA],t=>Object.values(t)),YA=t=>e=>e.procedureStepCommentReducer.instances[t],ZA=y(u.createSelector([gt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),z_=y(u.createSelector([gt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure===e)))),j_=y(u.createSelector([gt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure_step===e)))),D_=y(u.createSelector([gt,(t,e)=>e,(t,e,i)=>i],(t,e,i)=>l.fallbackToEmptyArray(t.filter(({procedure:a,procedure_step:n})=>a===e&&n===i)))),JA=pa.reducer,$e=P(t=>t.uuid),QA={instances:{}},ya=u.createSlice({name:"procedureStepDefaultAssignees",initialState:QA,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,QA)),reducers:{initializeProcedureStepDefaultAssignees:$e.initialize,addProcedureStepDefaultAssignee:$e.addOne,addProcedureStepDefaultAssignees:$e.addMany,setProcedureStepDefaultAssignee:$e.setOne,setProcedureStepDefaultAssignees:$e.setMany,updateProcedureStepDefaultAssignee:$e.updateOne,updateProcedureStepDefaultAssignees:$e.updateMany,deleteProcedureStepDefaultAssignee:$e.deleteOne,deleteProcedureStepDefaultAssignees:$e.deleteMany}}),{initializeProcedureStepDefaultAssignees:xA,addProcedureStepDefaultAssignee:eT,addProcedureStepDefaultAssignees:tT,setProcedureStepDefaultAssignee:sT,setProcedureStepDefaultAssignees:iT,updateProcedureStepDefaultAssignee:aT,updateProcedureStepDefaultAssignees:nT,deleteProcedureStepDefaultAssignee:cT,deleteProcedureStepDefaultAssignees:rT}=ya.actions,dT=t=>t.procedureStepDefaultAssigneeReducer.instances,ma=u.createSelector([dT],t=>Object.values(t)),uT=t=>e=>e.procedureStepDefaultAssigneeReducer.instances[t],lT=y(u.createSelector([ma,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),q_=y(u.createSelector([ma,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure_step===e)))),oT=ya.reducer,Ue=P(t=>t.uuid),hT={instances:{}},fa=u.createSlice({name:"procedureStepDefaultReviewers",initialState:hT,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,hT)),reducers:{initializeProcedureStepDefaultReviewers:Ue.initialize,addProcedureStepDefaultReviewer:Ue.addOne,addProcedureStepDefaultReviewers:Ue.addMany,setProcedureStepDefaultReviewer:Ue.setOne,setProcedureStepDefaultReviewers:Ue.setMany,updateProcedureStepDefaultReviewer:Ue.updateOne,updateProcedureStepDefaultReviewers:Ue.updateMany,deleteProcedureStepDefaultReviewer:Ue.deleteOne,deleteProcedureStepDefaultReviewers:Ue.deleteMany}}),{initializeProcedureStepDefaultReviewers:pT,addProcedureStepDefaultReviewer:yT,addProcedureStepDefaultReviewers:mT,setProcedureStepDefaultReviewer:fT,setProcedureStepDefaultReviewers:ST,updateProcedureStepDefaultReviewer:AT,updateProcedureStepDefaultReviewers:TT,deleteProcedureStepDefaultReviewer:IT,deleteProcedureStepDefaultReviewers:OT}=fa.actions,PT=t=>t.procedureStepDefaultReviewerReducer.instances,Sa=u.createSelector([PT],t=>Object.values(t)),bT=t=>e=>e.procedureStepDefaultReviewerReducer.instances[t],FT=y(u.createSelector([Sa,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),C_=y(u.createSelector([Sa,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure_step===e)))),_T=fa.reducer,ke=P(t=>t.uuid),gT={instances:{}},Aa=u.createSlice({name:"procedureStepEvents",initialState:gT,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,gT)),reducers:{initializeProcedureStepEvents:ke.initialize,addProcedureStepEvent:ke.addOne,addProcedureStepEvents:ke.addMany,setProcedureStepEvent:ke.setOne,setProcedureStepEvents:ke.setMany,updateProcedureStepEvent:ke.updateOne,updateProcedureStepEvents:ke.updateMany,deleteProcedureStepEvent:ke.deleteOne,deleteProcedureStepEvents:ke.deleteMany}}),{initializeProcedureStepEvents:MT,addProcedureStepEvent:RT,addProcedureStepEvents:wT,setProcedureStepEvent:ET,setProcedureStepEvents:vT,updateProcedureStepEvent:VT,updateProcedureStepEvents:BT,deleteProcedureStepEvent:zT,deleteProcedureStepEvents:jT}=Aa.actions,DT=t=>t.procedureStepEventReducer.instances,Mt=u.createSelector([DT],t=>Object.values(t)),qT=t=>e=>e.procedureStepEventReducer.instances[t],CT=y(u.createSelector([Mt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),$_=y(u.createSelector([Mt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure===e)))),U_=y(u.createSelector([Mt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure_step===e)))),k_=y(u.createSelector([Mt,(t,e)=>e,(t,e,i)=>i],(t,e,i)=>l.fallbackToEmptyArray(t.filter(({procedure:a,procedure_step:n})=>a===e&&n===i)))),$T=Aa.reducer,Le=P(t=>t.uuid),UT={instances:{}},Ta=u.createSlice({name:"procedureStepFieldsAttachments",initialState:UT,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,UT)),reducers:{initializeProcedureStepFieldsAttachments:Le.initialize,addProcedureStepFieldsAttachment:Le.addOne,addProcedureStepFieldsAttachments:Le.addMany,setProcedureStepFieldsAttachment:Le.setOne,setProcedureStepFieldsAttachments:Le.setMany,updateProcedureStepFieldsAttachment:Le.updateOne,updateProcedureStepFieldsAttachments:Le.updateMany,deleteProcedureStepFieldsAttachment:Le.deleteOne,deleteProcedureStepFieldsAttachments:Le.deleteMany}}),{initializeProcedureStepFieldsAttachments:kT,addProcedureStepFieldsAttachment:LT,addProcedureStepFieldsAttachments:Ia,setProcedureStepFieldsAttachment:HT,setProcedureStepFieldsAttachments:GT,updateProcedureStepFieldsAttachment:NT,updateProcedureStepFieldsAttachments:KT,deleteProcedureStepFieldsAttachment:WT,deleteProcedureStepFieldsAttachments:Oa}=Ta.actions,XT=t=>t.procedureStepFieldsAttachmentReducer.instances,Pa=u.createSelector([XT],t=>Object.values(t)),YT=y(u.createSelector([Pa,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.fields_revision===e)))),ZT=t=>e=>e.procedureStepFieldsAttachmentReducer.instances[t],JT=y(u.createSelector([Pa,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),QT=Ta.reducer,He=P(t=>t.uuid),xT={instances:{}},ba=u.createSlice({name:"procedureStepFields",initialState:xT,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,xT)),reducers:{initializeProcedureStepFields:He.initialize,addProcedureStepFields:He.addOne,addProcedureStepFieldsMany:He.addMany,setProcedureStepFields:He.setOne,setProcedureStepFieldsMany:He.setMany,updateProcedureStepFields:He.updateOne,updateProcedureStepFieldsMany:He.updateMany,deleteProcedureStepFields:He.deleteOne,deleteProcedureStepFieldsMany:He.deleteMany}}),{initializeProcedureStepFields:eI,addProcedureStepFields:tI,addProcedureStepFieldsMany:sI,setProcedureStepFields:iI,setProcedureStepFieldsMany:aI,updateProcedureStepFields:nI,updateProcedureStepFieldsMany:cI,deleteProcedureStepFields:rI,deleteProcedureStepFieldsMany:dI}=ba.actions,Fa=t=>t.procedureStepFieldsReducer.instances,xt=u.createSelector([Fa],t=>Object.values(t)),L_=y(u.createSelector([xt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure_step===e)))),H_=y(u.createSelector([xt,(t,e)=>e],(t,e)=>t.filter(i=>i.procedure_step===e).toSorted(l.submittedAtModelSortFn).pop())),G_=u.createSelector([Fa],t=>{const e={};for(const i of Object.values(t)){const a=e[i.procedure_step];(!a||a.submitted_at<i.submitted_at)&&(e[i.procedure_step]=i)}return e}),uI=t=>e=>e.procedureStepFieldsReducer.instances[t],lI=y(u.createSelector([xt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),oI=ba.reducer,Ge=P(t=>t.uuid),hI={instances:{}},_a=u.createSlice({name:"procedureStepFieldValuesAttachments",initialState:hI,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,hI)),reducers:{initializeProcedureStepFieldValuesAttachments:Ge.initialize,addProcedureStepFieldValuesAttachment:Ge.addOne,addProcedureStepFieldValuesAttachments:Ge.addMany,setProcedureStepFieldValuesAttachment:Ge.setOne,setProcedureStepFieldValuesAttachments:Ge.setMany,updateProcedureStepFieldValuesAttachment:Ge.updateOne,updateProcedureStepFieldValuesAttachments:Ge.updateMany,deleteProcedureStepFieldValuesAttachment:Ge.deleteOne,deleteProcedureStepFieldValuesAttachments:Ge.deleteMany}}),{initializeProcedureStepFieldValuesAttachments:pI,addProcedureStepFieldValuesAttachment:yI,addProcedureStepFieldValuesAttachments:ga,setProcedureStepFieldValuesAttachment:mI,setProcedureStepFieldValuesAttachments:fI,updateProcedureStepFieldValuesAttachment:SI,updateProcedureStepFieldValuesAttachments:AI,deleteProcedureStepFieldValuesAttachment:TI,deleteProcedureStepFieldValuesAttachments:Ma}=_a.actions,II=t=>t.procedureStepFieldValuesAttachmentReducer.instances,Ra=u.createSelector([II],t=>Object.values(t)),OI=t=>e=>e.procedureStepFieldValuesAttachmentReducer.instances[t],PI=y(u.createSelector([Ra,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),bI=y(u.createSelector([Ra,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.field_values===e)))),FI=_a.reducer,Ne=P(t=>t.uuid),_I={instances:{}},wa=u.createSlice({name:"procedureStepFieldValues",initialState:_I,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,_I)),reducers:{initializeProcedureStepFieldValues:Ne.initialize,addProcedureStepFieldValues:Ne.addOne,addProcedureStepFieldValuesMany:Ne.addMany,setProcedureStepFieldValues:Ne.setOne,setProcedureStepFieldValuesMany:Ne.setMany,updateProcedureStepFieldValues:Ne.updateOne,updateProcedureStepFieldValuesMany:Ne.updateMany,deleteProcedureStepFieldValues:Ne.deleteOne,deleteProcedureStepFieldValuesMany:Ne.deleteMany}}),{initializeProcedureStepFieldValues:gI,addProcedureStepFieldValues:MI,addProcedureStepFieldValuesMany:RI,setProcedureStepFieldValues:wI,setProcedureStepFieldValuesMany:EI,updateProcedureStepFieldValues:vI,updateProcedureStepFieldValuesMany:VI,deleteProcedureStepFieldValues:BI,deleteProcedureStepFieldValuesMany:zI}=wa.actions,jI=wa.reducer,DI=t=>t.procedureStepFieldValuesReducer.instances,dt=u.createSelector([DI],t=>Object.values(t)),N_=y(u.createSelector([dt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure===e)))),K_=y(u.createSelector([dt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure_step===e)))),qI=t=>e=>e.procedureStepFieldValuesReducer.instances[t],CI=y(u.createSelector([dt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),W_=y(u.createSelector([dt,(t,e)=>e,(t,e,i)=>i],(t,e,i)=>l.fallbackToEmptyArray(t.filter(({procedure:a,procedure_step:n})=>a===e&&n===i)))),Ke=P(t=>t.uuid),$I={instances:{}},Ea=u.createSlice({name:"procedureStepFieldValuesReviews",initialState:$I,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,$I)),reducers:{initializeProcedureStepFieldValuesReviews:Ke.initialize,addProcedureStepFieldValuesReview:Ke.addOne,addProcedureStepFieldValuesReviews:Ke.addMany,setProcedureStepFieldValuesReview:Ke.setOne,setProcedureStepFieldValuesReviews:Ke.setMany,updateProcedureStepFieldValuesReview:Ke.updateOne,updateProcedureStepFieldValuesReviews:Ke.updateMany,deleteProcedureStepFieldValuesReview:Ke.deleteOne,deleteProcedureStepFieldValuesReviews:Ke.deleteMany}}),{initializeProcedureStepFieldValuesReviews:UI,addProcedureStepFieldValuesReview:kI,addProcedureStepFieldValuesReviews:va,setProcedureStepFieldValuesReview:LI,setProcedureStepFieldValuesReviews:HI,updateProcedureStepFieldValuesReview:GI,updateProcedureStepFieldValuesReviews:NI,deleteProcedureStepFieldValuesReview:KI,deleteProcedureStepFieldValuesReviews:Va}=Ea.actions,WI=t=>t.procedureStepFieldValuesReviewReducer.instances,ut=u.createSelector([WI],t=>Object.values(t)),XI=t=>e=>e.procedureStepFieldValuesReviewReducer.instances[t],YI=y(u.createSelector([ut,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),ZI=y(u.createSelector([ut,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.field_values===e)))),X_=y(u.createSelector([ut,(t,e)=>e],(t,e)=>{let i;for(const a of t){const{field_values:n}=a;n===e&&(!i||i.submitted_at<=a.submitted_at)&&(i=a)}return i})),Y_=y(u.createSelector([dt,ut,(t,e)=>e],(t,e,i)=>{const a=new Set(l.toUuidArray(t.filter(({procedure:n})=>i===n)));return l.fallbackToEmptyArray(e.filter(({field_values:n})=>a.has(n)))})),Z_=y(u.createSelector([dt,ut,(t,e)=>e,(t,e,i)=>i],(t,e,i,a)=>{const n=new Set(l.toUuidArray(t.filter(({procedure_step:c,procedure:d})=>i===d&&c===a)));return l.fallbackToEmptyArray(e.filter(({field_values:c})=>n.has(c)))})),J_=u.createSelector([ut],t=>{const e={};for(const i of t){const{field_values:a}=i,n=e[a];(!n||n.submitted_at<=i.submitted_at)&&(e[a]=i)}return e}),JI=Ea.reducer,We=P(t=>t.uuid),QI={instances:{}},Ba=u.createSlice({name:"procedureStepReviewers",initialState:QI,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,QI)),reducers:{initializeProcedureStepReviewers:We.initialize,addProcedureStepReviewer:We.addOne,addProcedureStepReviewers:We.addMany,setProcedureStepReviewer:We.setOne,setProcedureStepReviewers:We.setMany,updateProcedureStepReviewer:We.updateOne,updateProcedureStepReviewers:We.updateMany,deleteProcedureStepReviewer:We.deleteOne,deleteProcedureStepReviewers:We.deleteMany}}),{initializeProcedureStepReviewers:xI,addProcedureStepReviewer:eO,addProcedureStepReviewers:tO,setProcedureStepReviewer:sO,setProcedureStepReviewers:iO,updateProcedureStepReviewer:aO,updateProcedureStepReviewers:nO,deleteProcedureStepReviewer:cO,deleteProcedureStepReviewers:rO}=Ba.actions,dO=t=>t.procedureStepReviewerReducer.instances,Rt=u.createSelector([dO],t=>Object.values(t)),uO=t=>e=>e.procedureStepReviewerReducer.instances[t],lO=y(u.createSelector([Rt,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),Q_=y(u.createSelector([Rt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure===e)))),x_=y(u.createSelector([Rt,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure_step===e)))),eg=y(u.createSelector([Rt,(t,e)=>e,(t,e,i)=>i],(t,e,i)=>l.fallbackToEmptyArray(t.filter(({procedure:a,procedure_step:n})=>a===e&&n===i)))),oO=Ba.reducer,Xe=P(t=>t.uuid),hO={instances:{}},za=u.createSlice({name:"procedureSteps",initialState:hO,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,hO)),reducers:{initializeProcedureSteps:Xe.initialize,setProcedureStep:Xe.setOne,setProcedureSteps:Xe.setMany,addProcedureStep:Xe.addOne,addProcedureSteps:Xe.addMany,updateProcedureStep:Xe.updateOne,updateProcedureSteps:Xe.updateMany,deleteProcedureStep:Xe.deleteOne,deleteProcedureSteps:Xe.deleteMany}}),{initializeProcedureSteps:pO,setProcedureStep:yO,setProcedureSteps:mO,addProcedureStep:fO,addProcedureSteps:SO,updateProcedureStep:AO,updateProcedureSteps:TO,deleteProcedureStep:IO,deleteProcedureSteps:OO}=za.actions,PO=za.reducer,ja=t=>t.procedureStepReducer.instances,bO=t=>e=>e.procedureStepReducer.instances[t],Da=u.createSelector([ja],t=>Object.values(t).toSorted((e,i)=>e.order-i.order)),tg=y(u.createSelector([ja,(t,e)=>e],(t,e)=>{const i={};for(const[a,n]of Object.entries(t))n.procedure_type===e&&(i[a]=n);return l.fallbackToEmptyObject(i)})),sg=y(u.createSelector([Da,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure_type===e)))),FO=y(u.createSelector([Da,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),Ye=P(({uuid:t})=>t),_O={instances:{}},qa=u.createSlice({name:"procedureTypeAttachments",initialState:_O,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,_O)),reducers:{initializeProcedureTypeAttachments:Ye.initialize,addProcedureTypeAttachment:Ye.addOne,addProcedureTypeAttachments:Ye.addMany,setProcedureTypeAttachment:Ye.setOne,setProcedureTypeAttachments:Ye.setMany,updateProcedureTypeAttachment:Ye.updateOne,updateProcedureTypeAttachments:Ye.updateMany,deleteProcedureTypeAttachment:Ye.deleteOne,deleteProcedureTypeAttachments:Ye.deleteMany}}),{initializeProcedureTypeAttachments:gO,addProcedureTypeAttachment:MO,addProcedureTypeAttachments:RO,setProcedureTypeAttachment:wO,setProcedureTypeAttachments:EO,updateProcedureTypeAttachment:vO,updateProcedureTypeAttachments:VO,deleteProcedureTypeAttachment:BO,deleteProcedureTypeAttachments:zO}=qa.actions,jO=qa.reducer,DO=t=>t.procedureTypeAttachmentReducer.instances,Ca=u.createSelector([DO],t=>Object.values(t)),qO=t=>e=>e.procedureTypeAttachmentReducer.instances[t],CO=y(u.createSelector([Ca,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),ig=y(u.createSelector([Ca,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(({procedure_type:i})=>e===i)))),Ze=P(({uuid:t})=>t),$O={instances:{}},$a=u.createSlice({name:"procedureTypeFieldsAttachments",initialState:$O,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,$O)),reducers:{initializeProcedureTypeFieldsAttachments:Ze.initialize,addProcedureTypeFieldsAttachment:Ze.addOne,addProcedureTypeFieldsAttachments:Ze.addMany,setProcedureTypeFieldsAttachment:Ze.setOne,setProcedureTypeFieldsAttachments:Ze.setMany,updateProcedureTypeFieldsAttachment:Ze.updateOne,updateProcedureTypeFieldsAttachments:Ze.updateMany,deleteProcedureTypeFieldsAttachment:Ze.deleteOne,deleteProcedureTypeFieldsAttachments:Ze.deleteMany}}),{initializeProcedureTypeFieldsAttachments:UO,addProcedureTypeFieldsAttachment:kO,addProcedureTypeFieldsAttachments:LO,setProcedureTypeFieldsAttachment:HO,setProcedureTypeFieldsAttachments:GO,updateProcedureTypeFieldsAttachment:NO,updateProcedureTypeFieldsAttachments:KO,deleteProcedureTypeFieldsAttachment:WO,deleteProcedureTypeFieldsAttachments:XO}=$a.actions,YO=$a.reducer,ZO=t=>t.procedureTypeFieldsAttachmentReducer.instances,Ua=u.createSelector([ZO],t=>Object.values(t)),ag=y(u.createSelector([Ua,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.fields_revision===e)))),JO=t=>e=>e.procedureTypeFieldsAttachmentReducer.instances[t],QO=y(u.createSelector([Ua,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),Je=P(({uuid:t})=>t),xO={instances:{}},ka=u.createSlice({name:"procedureTypeFields",initialState:xO,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,xO)),reducers:{initializeProcedureTypeFields:Je.initialize,addProcedureTypeFields:Je.addOne,addProcedureTypeFieldsMany:Je.addMany,setProcedureTypeFields:Je.setOne,setProcedureTypeFieldsMany:Je.setMany,updateProcedureTypeFields:Je.updateOne,updateProcedureTypeFieldsMany:Je.updateMany,deleteProcedureTypeFields:Je.deleteOne,deleteProcedureTypeFieldsMany:Je.deleteMany}}),{initializeProcedureTypeFields:eP,addProcedureTypeFields:tP,addProcedureTypeFieldsMany:sP,setProcedureTypeFields:iP,setProcedureTypeFieldsMany:aP,updateProcedureTypeFields:nP,updateProcedureTypeFieldsMany:cP,deleteProcedureTypeFields:rP,deleteProcedureTypeFieldsMany:dP}=ka.actions,uP=ka.reducer,lP=t=>t.procedureTypeFieldsReducer.instances,es=u.createSelector([lP],t=>Object.values(t)),ng=y(u.createSelector([es,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure_type===e)))),cg=y(u.createSelector([es,(t,e)=>e],(t,e)=>t.filter(i=>i.procedure_type===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),oP=t=>e=>e.procedureTypeFieldsReducer.instances[t],hP=y(u.createSelector([es,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),Qe=P(({uuid:t})=>t),pP={instances:{}},La=u.createSlice({name:"procedureFieldValuesAttachments",initialState:pP,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,pP)),reducers:{initializeProcedureFieldValuesAttachments:Qe.initialize,addProcedureFieldValuesAttachment:Qe.addOne,addProcedureFieldValuesAttachments:Qe.addMany,setProcedureFieldValuesAttachment:Qe.setOne,setProcedureFieldValuesAttachments:Qe.setMany,updateProcedureFieldValuesAttachment:Qe.updateOne,updateProcedureFieldValuesAttachments:Qe.updateMany,deleteProcedureFieldValuesAttachment:Qe.deleteOne,deleteProcedureFieldValuesAttachments:Qe.deleteMany}}),{initializeProcedureFieldValuesAttachments:yP,addProcedureFieldValuesAttachment:mP,addProcedureFieldValuesAttachments:Ha,setProcedureFieldValuesAttachment:fP,setProcedureFieldValuesAttachments:SP,updateProcedureFieldValuesAttachment:AP,updateProcedureFieldValuesAttachments:TP,deleteProcedureFieldValuesAttachment:IP,deleteProcedureFieldValuesAttachments:Ga}=La.actions,OP=La.reducer,PP=t=>t.procedureFieldValuesAttachmentReducer.instances,Na=u.createSelector([PP],t=>Object.values(t)),bP=t=>e=>e.procedureFieldValuesAttachmentReducer.instances[t],FP=y(u.createSelector([Na,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),_P=y(u.createSelector([Na,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.field_values===e)))),xe=P(({uuid:t})=>t),gP={instances:{}},Ka=u.createSlice({name:"procedureFieldValues",initialState:gP,extraReducers:t=>t.addMatcher(u.isAnyOf(I,E,b),e=>Object.assign(e,gP)),reducers:{initializeProcedureFieldValues:xe.initialize,addProcedureFieldValues:xe.addOne,addProcedureFieldValuesMany:xe.addMany,setProcedureFieldValues:xe.setOne,setProcedureFieldValuesMany:xe.setMany,updateProcedureFieldValues:xe.updateOne,updateProcedureFieldValuesMany:xe.updateMany,deleteProcedureFieldValues:xe.deleteOne,deleteProcedureFieldValuesMany:xe.deleteMany}}),{initializeProcedureFieldValues:MP,addProcedureFieldValues:RP,addProcedureFieldValuesMany:wP,setProcedureFieldValues:EP,setProcedureFieldValuesMany:vP,updateProcedureFieldValues:VP,updateProcedureFieldValuesMany:BP,deleteProcedureFieldValues:zP,deleteProcedureFieldValuesMany:jP}=Ka.actions,DP=Ka.reducer,qP=t=>t.procedureFieldValuesReducer.instances,Wa=u.createSelector([qP],t=>Object.values(t)),rg=y(u.createSelector([Wa,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.procedure===e)))),CP=t=>e=>e.procedureFieldValuesReducer.instances[t],$P=y(u.createSelector([Wa,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),et=P(t=>t.uuid),UP={instances:{}},Xa=u.createSlice({name:"procedureTypes",initialState:UP,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,UP)),reducers:{initializeProcedureTypes:et.initialize,addProcedureType:et.addOne,addProcedureTypes:et.addMany,setProcedureType:et.setOne,setProcedureTypes:et.setMany,updateProcedureType:et.updateOne,updateProcedureTypes:et.updateMany,deleteProcedureType:et.deleteOne,deleteProcedureTypes:et.deleteMany}}),{initializeProcedureTypes:kP,addProcedureType:LP,addProcedureTypes:HP,setProcedureType:GP,setProcedureTypes:NP,updateProcedureType:KP,updateProcedureTypes:WP,deleteProcedureType:XP,deleteProcedureTypes:YP}=Xa.actions,ZP=Xa.reducer,JP=t=>t.procedureTypeReducer.instances,Ya=u.createSelector([JP],t=>Object.values(t)),QP=t=>e=>e.procedureTypeReducer.instances[t],xP=y(u.createSelector([Ya,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),dg=y(u.createSelector([Ya,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.organization===e)))),ug={isRehydrated:!1},Za=u.createSlice({name:"rehydrated",initialState:ug,reducers:{setRehydrated:(t,e)=>{t.isRehydrated=e.payload}}}),{setRehydrated:lg}=Za.actions,og=t=>t.rehydratedReducer.isRehydrated,eb=Za.reducer,tt=P(t=>t.uuid),tb={instances:{}},Ja=u.createSlice({name:"teamMemberships",initialState:tb,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,tb)),reducers:{initializeTeamMemberships:tt.initialize,addTeamMembership:tt.addOne,addTeamMemberships:tt.addMany,setTeamMembership:tt.setOne,setTeamMemberships:tt.setMany,updateTeamMembership:tt.updateOne,updateTeamMemberships:tt.updateMany,deleteTeamMembership:tt.deleteOne,deleteTeamMemberships:tt.deleteMany}}),{initializeTeamMemberships:sb,addTeamMembership:ib,addTeamMemberships:ab,setTeamMembership:nb,setTeamMemberships:cb,updateTeamMembership:rb,updateTeamMemberships:db,deleteTeamMembership:ub,deleteTeamMemberships:lb}=Ja.actions,ob=Ja.reducer,hb=t=>t.teamMembershipReducer.instances,ts=u.createSelector([hb],t=>Object.values(t)),pb=t=>e=>e.teamMembershipReducer.instances[t],yb=y(u.createSelector([ts,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),hg=y(u.createSelector([ts,(t,e)=>e],(t,e)=>{const i={};for(const a of t.filter(n=>n.team===e))i[a.user]=a;return i})),pg=y(u.createSelector([Wt,ts,(t,e)=>e],(t,e,i)=>{const a=new Set(e.filter(n=>n.team===i).map(n=>n.user));return l.fallbackToEmptyArray(t.filter(n=>a.has(n.id)))})),st=P(t=>t.uuid),mb={instances:{}},Qa=u.createSlice({name:"teams",initialState:mb,extraReducers:t=>t.addMatcher(u.isAnyOf(I,b),e=>Object.assign(e,mb)),reducers:{initializeTeams:st.initialize,addTeam:st.addOne,addTeams:st.addMany,setTeam:st.setOne,setTeams:st.setMany,updateTeam:st.updateOne,updateTeams:st.updateMany,deleteTeam:st.deleteOne,deleteTeams:st.deleteMany}}),{initializeTeams:fb,addTeam:Sb,addTeams:Ab,setTeam:Tb,setTeams:Ib,updateTeam:Ob,updateTeams:Pb,deleteTeam:bb,deleteTeams:Fb}=Qa.actions,_b=t=>t.teamReducer.instances,xa=u.createSelector([_b],t=>Object.values(t)),gb=t=>e=>e.teamReducer.instances[t],Mb=y(u.createSelector([xa,(t,e)=>e],(t,e)=>{const i=new Set(e);return l.fallbackToEmptyArray(t.filter(({uuid:a})=>i.has(a)))})),yg=y(u.createSelector([xa,(t,e)=>e],(t,e)=>l.fallbackToEmptyArray(t.filter(i=>i.organization===e)))),Rb=Qa.reducer,en={outboxReducer:vf,authReducer:Id},mg=u.combineReducers(en),wb={...en,assetReducer:tc,assetAttachmentReducer:Rn,assetCommentReducer:Ln,assetTypeReducer:id,assetTypeAttachmentReducer:yc,issueReducer:xh,issueAttachmentReducer:ph,issueTypeReducer:mm,issueTypeAttachmentReducer:pp,organizationReducer:_f,projectReducer:GS,projectAttachmentReducer:aS,projectCommentReducer:AS,projectAccessReducer:Lf,organizationAccessReducer:rf,projectFileReducer:BS,procedureTypeReducer:ZP,procedureInitiativeReducer:aA,procedureReducer:fA,procedureTypeFieldsReducer:uP,procedureFieldValuesReducer:DP,procedureTypeAttachmentReducer:jO,procedureTypeFieldsAttachmentReducer:YO,procedureFieldValuesAttachmentReducer:OP,procedureStepFieldsAttachmentReducer:QT,procedureStepFieldsReducer:oI,procedureStepFieldValuesAttachmentReducer:FI,procedureStepFieldValuesReducer:jI,procedureStepFieldValuesReviewReducer:JI,procedureStepAssigneeReducer:qA,procedureStepCommentReducer:JA,procedureStepDefaultAssigneeReducer:oT,procedureStepDefaultReviewerReducer:_T,procedureStepEventReducer:$T,procedureStepReviewerReducer:oO,procedureStepReducer:PO,rehydratedReducer:eb,formReducer:Bl,formRevisionReducer:ul,formRevisionAttachmentReducer:Zu,formSubscriberReducer:Pl,formSubmissionFieldValuesAttachmentReducer:Wl,formSubmissionFieldValuesReducer:co,formSubmissionReducer:Fo,formIdentifierReducer:Pu,formIdentifierValueReducer:Du,userReducer:Wm,emailDomainsReducer:du,documentsReducer:Nd,documentAttachmentReducer:zd,teamReducer:Rb,agentsReducer:mn,issueCommentReducer:Uh,issueCommentAttachmentReducer:Mh,issueUpdateReducer:Cm,geoImageReducer:Co,issueAssociationReducer:eh,issueTypeFieldsReducer:ty,issueTypeFieldValuesReducer:kp,issueTypeFieldsAttachmentReducer:Mp,issueTypeFieldValuesAttachmentReducer:yy,issueTypeIdentifierReducer:Ry,issueTypeIdentifierValueReducer:Ly,issueTypePriorityReducer:tm,issueTypeStatusReducer:Rm,assetTypeFieldsReducer:Lc,assetTypeFieldValuesReducer:mr,assetTypeFieldsAttachmentReducer:Rc,assetTypeFieldValuesAttachmentReducer:tr,assetTypeIdentifierReducer:wr,assetTypeIdentifierValueReducer:Hr,assetTypeStatusReducer:Sd,teamMembershipReducer:ob},fg=u.combineReducers(wb),Eb=1e4,tn=[400,409,403,404,405,500],q=1e4,vb={};class Vb{client;pageSize=Eb;constructor(e){vb[this.constructor.name]=this,this.client=e}async performRequest(e,i){return this.client.performRequest(this.host,e,this,i)}async enqueueRequest(e){return this.client.enqueueRequest(e,this.host,this.constructor.name)}async performPagination(e,i){return this.client.performPagination(this.host,e,this.pageSize,this,i)}dispatch(e){this.client.store.dispatch(e)}select(e){return e(this.client.store.getState())}}const Sg=t=>{if(t)throw t;const e=It();e?e.dispatch({type:"rehydrated/setRehydrated",payload:!0}):console.error("Client store not set")},Bb=(t,e,i)=>{const a=ht();return a?(a.addRequest(e),a.getQueue()):(console.warn("Outbox coordinator not set; cannot enqueue request yet."),[])},zb=(t,e,i)=>{const a=ht();if(!a)return console.warn("Outbox coordinator not set; cannot dequeue request yet."),[];const c=e.meta.offlineAction.payload.uuid;return a.remove(c),a.getQueue()};async function Ag(t,e){if(!e.payload)throw new Error("Received empty payload");return iF(e)}const Tg={...dn,effect:Ag,discard:Db,returnPromises:!0,persistCallback:Sg,retry:Pg,persistOptions:{storage:rF},queue:{...dn.queue,enqueue:Bb,dequeue:zb,peek:(...t)=>Og(...t)}},Ig=cF.offline(Tg);async function jb(t,e,i){if(e.store.getState().outboxReducer.deletedRequests.includes(t.payload.uuid))throw new Error("Request was marked for deletion");const n=vb[t.meta.offline.effect.serviceName];if(!n)throw new Error(`Service ${t.meta.offline.effect.serviceName} not found`);return nn(t.meta.offline.effect.BASE_URL,t.meta.offline.effect.request,e,n,i)}function Db(t,e,i=0){if(console.debug("Considering discarding request due to error:",t,`(${typeof t})`,`
2
2
  Url:`,e.payload.url,`
3
- Retries:`,i),!(t instanceof Error))throw console.error("ENCOUNTERED NON-ERROR ERROR:",t,"(throwing immediately, which may lead to unexpected behavior)"),t;const a=Ot(),c=a.getState().outboxReducer.deletedRequests,d=e.payload.uuid;function r(){a.dispatch(Ef(d));const h=ht();if(!h)throw new Error("Outbox coordinator not set");h.remove(e.payload.uuid);const f=e.meta.offline.rollback;throw f&&(console.warn("Rolling back request due to SDK error:",e),a.dispatch(f)),t}if(t instanceof z&&t.options.discard&&(console.debug("Discarding request due to explicit discard:",e.payload.url),r()),c.includes(d)&&(console.debug("Discarding request due to deletion:",e.payload.url),r()),t instanceof z){const h=t.status||t.response?.status;if(h||console.warn("Error has no status code:",t),t.options.discard!==!1&&h!==void 0&&sn.includes(h)){console.warn("Discarding request due to error:",t,`
4
- Action:`,e);const f=ht();if(!f)throw new Error("Outbox coordinator not set");f.remove(e.payload.uuid),t.options.discard=!0,r()}}console.debug("Registering a retry for request:",e.payload.uuid);const p=ht();if(!p)throw new Error("Outbox coordinator not set");return p.registerRetry(e.payload.uuid),!1}function Pg(t,e,i){return ht()?.peek()}function bg(t,e){return Ot().dispatch(vf(new Date().getTime())),6e4}const Tt="An unknown error occurred",Fg=500,Cb=["non_field_errors","detail"];function _g(t,e){let i;if(t?.body)if(typeof t.body=="object"){const a=t.body;if(typeof a.error=="string")i=a.error;else if(typeof a.message=="string")i=a.message;else try{i=Object.entries(a).map(([n,c])=>typeof c=="string"?Cb.includes(n)?c:`${n}: ${c}`:Array.isArray(c)?Cb.includes(n)?c.join(`
3
+ Retries:`,i),!(t instanceof Error))throw console.error("ENCOUNTERED NON-ERROR ERROR:",t,"(throwing immediately, which may lead to unexpected behavior)"),t;const a=It(),c=a.getState().outboxReducer.deletedRequests,d=e.payload.uuid;function r(){a.dispatch(wf(d));const h=ht();if(!h)throw new Error("Outbox coordinator not set");h.remove(e.payload.uuid);const f=e.meta.offline.rollback;throw f&&(console.warn("Rolling back request due to SDK error:",e),a.dispatch(f)),t}if(t instanceof z&&t.options.discard&&(console.debug("Discarding request due to explicit discard:",e.payload.url),r()),c.includes(d)&&(console.debug("Discarding request due to deletion:",e.payload.url),r()),t instanceof z){const h=t.status||t.response?.status;if(h||console.warn("Error has no status code:",t),t.options.discard!==!1&&h!==void 0&&tn.includes(h)){console.warn("Discarding request due to error:",t,`
4
+ Action:`,e);const f=ht();if(!f)throw new Error("Outbox coordinator not set");f.remove(e.payload.uuid),t.options.discard=!0,r()}}console.debug("Registering a retry for request:",e.payload.uuid);const p=ht();if(!p)throw new Error("Outbox coordinator not set");return p.registerRetry(e.payload.uuid),!1}function Og(t,e,i){return ht()?.peek()}function Pg(t,e){return It().dispatch(Ef(new Date().getTime())),6e4}const bg=500,qb=["non_field_errors","detail"];function Fg(t,e){let i;if(t?.body)if(typeof t.body=="object"){const a=t.body;if(typeof a.error=="string")i=a.error;else if(typeof a.message=="string")i=a.message;else try{i=Object.entries(a).map(([n,c])=>typeof c=="string"?qb.includes(n)?c:`${n}: ${c}`:Array.isArray(c)?qb.includes(n)?c.join(`
5
5
  `):c.map(d=>`${n}: ${d}`).join(`
6
6
  `):`${n}: ${JSON.stringify(c)}`).join(`
7
- `)}catch(n){console.error("Failed to extract error message from response body",n)}}else typeof t.body=="string"&&(i=t.body);else t?.text?i=t.text:e instanceof Error&&(i=e.message);return!i||i.length>Fg?Tt:i}class z extends Error{status;response;message;options;constructor(e){super(Tt);const{response:i,innerError:a}=e;this.message=e.message??_g(i,a)??Tt,this.status=i?.status??0,this.response=i,this.options=e}}function $b(t){function e(i){return typeof i=="object"&&i!==null&&["ok","redirect","clientError","serverError","error"].every(n=>n in i)}if(e(t))return t;if(typeof t=="object"&&t!==null){const i=t;if(e(i.response))return i.response;if(i.response&&e(i.response.response))return i.response.response}}function gg(t){return new Uint8Array(t).reduce((i,a)=>i+a.toString(16).padStart(2,"0"),"")}function is(t){return new Promise((e,i)=>{const a=new FileReader;a.onload=()=>{const n=a.result;if(!n){i(new Error("FileReader did not return a valid ArrayBuffer."));return}crypto.subtle.digest("SHA-1",n).then(c=>{const d=gg(c);e(d)})},a.readAsArrayBuffer(t)})}const Ub=async t=>{const e=await t.arrayBuffer();return new Blob([e],{type:t.type})},Mg=(t,e)=>`${t}${e?`.${e}`:""}`;function Rg(t,e){return new File([t],e,{type:t.type})}function kb(t){const e=t.name;return e.includes(".")?e.split(".").pop():""}const Lb=async t=>(await fetch(t)).blob(),Hb=async(t,e)=>{const i=await Lb(t);return new File([i],e,{type:i.type})};function Gb(t){return typeof t=="string"&&t.startsWith("blob:")}function Nb(t){return typeof t=="string"&&URL.canParse(t)&&t.startsWith("https://")&&t.includes(".cloudfront.net/")}function Kb(t){return typeof t=="string"&&URL.canParse(t)&&t.startsWith("https://")&&t.includes(".s3.amazonaws.com/")}function Wb(t){if(Nb(t)){const i=new URLSearchParams(t).get("Expires");if(!i)return null;const a=parseInt(i,10);return new Date(a*1e3)}if(Kb(t)){const e=new URLSearchParams(t),i=e.get("X-Amz-Date"),a=e.get("X-Amz-Expires");if(!i||!a)return null;const n=new Date(i.replace(/^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})Z$/,"$1-$2-$3T$4:$5:$6Z")),c=parseInt(a);return new Date(n.getTime()+c*1e3)}return null}function Yb(t,e=30){const i=Wb(t);if(!i)return!1;const a=Date.now(),n=i.getTime(),c=e*1e3;return a+c>=n}function wg(t){return t.type.startsWith("image/")}class Xb extends Bb{constructor(e){super(e)}applyAuth(e){const i=this.getAuthHeader();return i?e.set("Authorization",i):e}isAuthFailure(e){return e.status===401}}class lt extends Bb{auth;constructor(e,i){super(e),this.auth=i}}class Eg extends lt{async startConversation(e,i){return this.enqueueRequest({description:"Start agent conversation",method:o.POST,url:"/agents/prompt/",payload:{prompt:e,active_project:i},blockers:["prompt"],blocks:["prompt"]}).then(a=>(this.dispatch(pn(a)),a))}async continueConversation(e,i,a){return this.enqueueRequest({description:"Prompt agent",method:o.POST,url:"/agents/prompt/",payload:{prompt:e,active_project:a},blockers:["prompt"],blocks:["prompt"],queryParams:{conversation_id:i}}).then(n=>{this.dispatch(mn(n))})}async fetchDetails(e){return this.enqueueRequest({description:"Get agent conversation",method:o.GET,url:`/agents/conversations/${e}/`,blockers:["conversation"],blocks:["conversation"]}).then(i=>{this.dispatch(yn(i))})}async rate(e,i){return this.enqueueRequest({description:"Rate agent response",method:o.PUT,url:`/agents/responses/${e}/rate/`,payload:{rating:i},blockers:["rate"],blocks:["rate"]})}async list(e,i){return this.performRequest({method:o.GET,url:"/agents/conversations/",...e},i)}async refreshStore(e,i){const a=await this.list({queryParams:{project:e}},i);return this.dispatch(hn(a)),a}}function m(t,e,i){const a=`${e}${i?"s":""}`;switch(t){case o.GET:return`Get ${a}`;case o.POST:return`Create ${a}`;case o.PATCH:return`Update ${a}`;case o.PUT:return`Update ${a}`;case o.DELETE:return`Delete ${a}`}}function g(t){const e={...t};for(const i of[...ln,"created_by"])i in e&&delete e[i];return e}class M extends lt{async get(e,i){return this.performRequest({url:`${this.url}/${e}/`,method:o.GET},i)}async list(e,i){return this.performRequest({url:`${this.url}/`,method:o.GET,...e},i)}async listPaginated(e,i){return this.performPagination({url:`${this.url}/`,method:o.GET,...e},i)}}class v extends M{async getPresignedUrl(e,i){const{selectById:a}=this.selectors,n=this.select(a(e));if(!n)throw new Error(`Could not find ${this.name}: ${e} in store.`);if(n.object_url)return n.object_url;const c=await this.client.files.getPresignedUrlFromCache(n.file_sha1);if(c)return c;const d=await this.performRequest({url:`${this.url}/${e}/presigned-url/`,method:o.GET},i);return await this.client.files.cachePresignedUrl(n.file_sha1,d),d}async add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions;let c,d=null,r=null;if("file"in e){const{file:S,...O}=e;d=await this.client.files.getFilePayload(S),r=URL.createObjectURL(S),c={...O,file_sha1:d.sha1,file_type:d.file_type,file_name:S.name,file_extension:d.extension,object_url:r}}else c=e;const p=this.buildModel(c),h=this.buildPayload(p);this.dispatch(i(p));const f=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:{...h,...d?{file:d}:{}},blockers:this.getBlockers(p),blocks:this.getBlocks(p)});f.then(({instance:S})=>{this.dispatch(a(S))}).catch(()=>{this.dispatch(n(this.getId(p)))}).finally(()=>{r&&URL.revokeObjectURL(r)});const A=f.then(({instance:S})=>S),T=f.then(async({instance:S,presigned_url:O})=>{try{return O&&await this.client.files.processPresignedUrl(S.file_sha1,O),S.file_sha1}catch(_){throw console.error("Upload to s3 using presigned url failed.",_),_}});return[p,A,T]}async bulkAdd(e,i){const{addMany:a,updateMany:n,deleteMany:c}=this.actions,d=new Date().toISOString(),r=[],p=new Set,h=l.chunkArray(e,Math.min(i??e.length,q)),f=[];for(const O of h){const _=[],F={},w=[],V=[];for(const it of O){let vt;if("file"in it){const{file:Vt,...sR}=it,Pt=await this.client.files.getFilePayload(Vt);Pt.sha1 in F||(F[Pt.sha1]=Pt);const nF=URL.createObjectURL(Vt);p.add(nF),vt={...sR,file_sha1:Pt.sha1,file_type:Pt.file_type,file_name:Vt.name,file_extension:Pt.extension,object_url:nF}}else vt=it;const j=this.buildModel(vt);r.push(j);const as=this.buildBulkPayload(j);_.push(as);const B=this.getBlockers(j);w.push(...B);const C=this.getBlocks(j);V.push(...C)}const R={payloads:_,submittedAt:d,files:Object.values(F),blockers:w,blocks:V};f.push(R)}this.dispatch(a(r));const A=f.map(O=>{const{submittedAt:_,files:F,payloads:w,blocks:V,blockers:R}=O;return this.enqueueRequest({description:m(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{submitted_at:_,files:F,payloads:w},blockers:R,blocks:V})});Promise.all(A).then(O=>{const _=O.flatMap(F=>F.instances);this.dispatch(n(_))}).catch(O=>{throw this.dispatch(c(r.map(_=>this.getId(_)))),console.error(O),O}).finally(()=>{for(const O of p)URL.revokeObjectURL(O)});const T=Promise.all(A).then(O=>O.flatMap(({instances:_})=>_)),S=Promise.all(A).then(async O=>{const _=[];for(const{presigned_urls:F}of O){const w=this.client.files.processPresignedUrls(F);for(const[V,R]of Object.entries(w))try{await R,_.push(V)}catch(it){throw console.error("Upload to s3 using presigned url failed.",it),it}}return _});return[r,T,S]}async delete(e){const{addOne:i,deleteOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Attempting to delete ${this.name} with pk ${e} that does not exist in the store`);this.dispatch(a(this.getId(c)));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(i(c)),d}}}class vg extends v{name="Asset attachment";url="/asset-attachments";actions={addOne:Tn,addMany:ds,setOne:In,setMany:On,updateOne:Pn,updateMany:bn,deleteOne:Fn,deleteMany:us,initialize:An};selectors={selectById:gn,selectByIds:Mn};getId(e){return e.uuid}getBlockers(e){const{asset:i}=e;return[i]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset:e.asset}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset:e.asset}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{asset__project:e}},i)).flat();return this.dispatch(a(c)),c}}class Vg extends M{name="Asset Comment";url="/asset-comments";actions={addOne:Vn,addMany:Bt,setOne:Bn,setMany:zn,updateOne:jn,updateMany:Dn,deleteOne:qn,deleteMany:zt,initialize:vn};selectors={selectById:$n,selectByIds:Un};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(c),blockers:[c.asset],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Asset comment with uuid ${e.uuid} not found in store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Asset comment with uuid ${e} not found in store`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{asset__project:e}},i)).flat();return this.dispatch(a(c)),c}}class Bg extends M{url="/assets";name="Asset";actions={addOne:Kn,addMany:ps,setOne:Zn,setMany:Jn,updateOne:Wn,updateMany:Yn,deleteOne:Xn,deleteMany:ys,initialize:Nn};selectors={selectById:ec,selectByIds:tc};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[r.asset_type],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`No asset with uuid ${e.uuid} found in the store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{addOne:i,deleteOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`No asset with uuid ${e} found in the store`);const d=this.select(Rn(e)),r=this.select(kn(e)),p=this.select(xo(e)),h=this.select(PA(e)),f=this.select(bo(e));this.dispatch(a(e)),this.dispatch(us(l.toUuidArray(d))),this.dispatch(zt(l.toUuidArray(r))),this.dispatch(mt(l.toUuidArray(p))),this.dispatch(At(l.toUuidArray(h))),this.dispatch(ct(l.toUuidArray(f)));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(A){throw this.dispatch(i(c)),this.dispatch(ds(d)),this.dispatch(Bt(r)),this.dispatch(yt(p)),this.dispatch(St(h)),this.dispatch(nt(f)),A}}bulkAdd(e,i){const{addMany:a}=this.actions,n=new Date().toISOString(),c=l.chunkArray(e,Math.min(i??e.length,q)).map(p=>{const h=p.map(f=>l.uuidObj(f));return{batchId:at.v4(),payload:{submitted_at:n,assets:h}}}),d=[];let r=null;for(const p of c){const{batchId:h,payload:f}=p,A=f.assets.map(({uuid:F})=>F),T=f.assets.map(({asset_type:F})=>F),S=f.assets.map(({project:F})=>F),O=f.assets.map(({status:F})=>F),_=this.enqueueRequest({description:m(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:f,blockers:(r?[r]:[]).concat(T).concat(S).concat(O),blocks:[h].concat(A)});r=p.batchId,d.push(_)}return Promise.all(d).then(p=>{const h=p.flat();this.dispatch(a(h))}),d}bulkUpdate(e,i){const{updateMany:a}=this.actions,{selectByIds:n}=this.selectors,c=l.toUuidArray(e);if(new Set(c).size!==e.length)throw new Error("payloads contains duplicate uuids.");const d=this.select(n(c));if(c.length!=d.length)throw new Error(`Attempting to bulk update ${c.length-d.length} assets that dont exist in the store`);const r=d.toSorted((S,O)=>l.uuidSortFn(S.uuid,O.uuid)),p=e.toSorted((S,O)=>l.uuidSortFn(S.uuid,O.uuid)),h=[];for(let S=0;S<c.length;S++)h.push({...r[S],...p[S]});this.dispatch(a(h));const f=l.chunkArray(e,Math.min(i??e.length,q)),A=[];let T=null;for(const S of f){const O=at.v4(),_=l.toUuidArray(S),F=S.map(({status:V})=>V).filter(Boolean),w=this.enqueueRequest({description:m(o.PATCH,this.name,!0),method:o.PATCH,url:`${this.url}/bulk/`,payload:{payloads:S},blockers:(T?[T]:[]).concat(_).concat(F),blocks:[O].concat(_)});A.push(w),T=O}return Promise.all(A).then(S=>{this.dispatch(a(S.flat()))}).catch(()=>{this.dispatch(a(d))}),[h,A]}async bulkDelete(e){const{addMany:i,deleteMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e)),d=this.select(Ln(e)),r=this.select(eh(e)),p=this.select(bA(e)),h=this.select(Fo(e));this.dispatch(a(e)),this.dispatch(zt(l.toUuidArray(d))),this.dispatch(mt(l.toUuidArray(r))),this.dispatch(At(l.toUuidArray(p))),this.dispatch(ct(l.toUuidArray(h)));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(f){throw this.dispatch(i(c)),this.dispatch(Bt(d)),this.dispatch(yt(r)),this.dispatch(St(p)),this.dispatch(nt(h)),f}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}class zg extends v{name="Asset Type Attachment";url="/asset-type-attachments";actions={addOne:nc,addMany:fs,setOne:cc,setMany:rc,updateOne:dc,updateMany:uc,deleteOne:lc,deleteMany:Ss,initialize:ac};selectors={selectById:hc,selectByIds:pc};getId(e){return e.uuid}getBlockers(e){return[e.asset_type]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset_type:e.asset_type}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset_type:e.asset_type}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{asset_type__organization:e}},i);return this.dispatch(a(n)),n}}class jg extends v{name="Asset Type Fields Attachment";url="/asset-type-fields-attachments";actions={addOne:Ac,addMany:Tc,setOne:Ic,setMany:Oc,updateOne:Pc,updateMany:bc,deleteOne:Fc,deleteMany:_c,initialize:Sc};selectors={selectById:Mc,selectByIds:Rc};getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){const{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{fields_revision__asset_type__organization:e}},i);return this.dispatch(a(n)),n}}class Dg extends M{name="Asset Type Fields";url="/asset-type-fields";actions={addOne:Vc,addMany:Bc,setOne:zc,setMany:jc,updateOne:Dc,updateMany:qc,deleteOne:Cc,deleteMany:$c,initialize:vc};selectors={selectById:kc,selectByIds:Lc};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[r.asset_type],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{asset_type__organization:e}},i);return this.dispatch(a(n)),n}}class qg extends v{name="Asset Type Field Values Attachment";url="/asset-type-field-values-attachments";actions={addOne:Kc,addMany:bs,setOne:Wc,setMany:Yc,updateOne:Xc,updateMany:Zc,deleteOne:Jc,deleteMany:Fs,initialize:Nc};selectors={selectById:xc,selectByIds:er};getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}async bulkDelete(e){const{deleteMany:i,addMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{field_values__asset__project:e,latest:!0}},i)).flat();return this.dispatch(a(c)),c}}class Cg extends M{name="Asset Type Field Values";url="/asset-type-field-values";actions={addOne:nr,addMany:cr,setOne:rr,setMany:dr,updateOne:ur,updateMany:lr,deleteOne:or,deleteMany:hr,initialize:ar};selectors={selectById:yr,selectByIds:mr};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d}),p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[e.asset,e.fields_revision],blocks:[r.uuid]});return this.dispatch(i(r)),p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}bulkAdd(e,i){const{payloads:a,values:n}=e,{addMany:c,updateMany:d,deleteMany:r}=this.actions,p=new Date().toISOString(),h=[],f=l.chunkArray(a,Math.min(i??a.length,q)),A=[];for(const S of f){const O=[];for(const _ of S){const F=l.uuidObj({..._,values:_.values,created_by:this.select(w=>w.userReducer.currentUser?.id??null),submitted_at:p});h.push(F),O.push({uuid:F.uuid,asset:_.asset,fields_revision:_.fields_revision,published_at:_.published_at,values:F.values})}A.push({submitted_at:p,values:n,field_values:O})}this.dispatch(c(h));const T=[];for(const S of A){const{field_values:O}=S,_=O.map(({asset:R})=>R),F=O.map(({fields_revision:R})=>R),w=O.map(({uuid:R})=>R),V=this.enqueueRequest({description:m(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:S,blockers:_.concat(F),blocks:w});T.push(V)}return Promise.all(T).then(S=>{this.dispatch(d(S.flat()))}).catch(()=>{this.dispatch(r(l.toUuidArray(h)))}),[h,T]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected AssetTypeFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[c.uuid,c.fields_revision,c.asset],blocks:[c.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const d=this.select(tr(e));this.dispatch(i(e)),this.dispatch(Fs(l.toUuidArray(d)));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(c)),this.dispatch(bs(d)),r}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{asset__project:e,latest:!0}},i)).flat();return this.dispatch(a(c)),c}}class $g extends M{name="Asset Type Identifier";url="/asset-type-identifiers";actions={addOne:Tr,addMany:Ir,setOne:Or,setMany:Pr,updateOne:br,updateMany:Fr,deleteOne:_r,deleteMany:gr,initialize:Ar};selectors={selectById:Rr,selectByIds:wr};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[r.asset_type],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected asset type identifier with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected asset type identifier with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{asset_type__organization:e}},i);return this.dispatch(a(n)),n}}class Ug extends M{name="Asset Type Identifier Value";url="/asset-type-identifier-values";actions={addOne:Br,addMany:zr,setOne:jr,setMany:Dr,updateOne:qr,updateMany:Cr,deleteOne:$r,deleteMany:Ur,initialize:Vr};selectors={selectById:Lr,selectByIds:Hr};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[e.asset,e.asset_type_identifier],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}bulkAdd(e,i){const{addMany:a,updateMany:n,deleteMany:c}=this.actions,d=new Date().toISOString(),r=this.select(S=>S.userReducer.currentUser?.id??null),p=l.chunkArray(e,Math.min(i??e.length,q)),h=[],f=[];for(const S of p){const O=[],_=[],F=[];for(const V of S){const R=l.uuidObj({...V,submitted_at:d,created_by:r});f.push(R);const it={uuid:R.uuid,asset:R.asset,asset_type_identifier:R.asset_type_identifier,value:R.value};O.push(it),_.push(R.asset),_.push(R.asset_type_identifier),F.push(R.uuid)}const w={payloads:O,submitted_at:d,blockers:_,blocks:F};h.push(w)}this.dispatch(a(f));const A=h.map(S=>{const{payloads:O,submitted_at:_,blockers:F,blocks:w}=S;return this.enqueueRequest({description:m(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{submitted_at:_,payloads:O},blockers:F,blocks:w})});Promise.all(A).then(S=>{this.dispatch(n(S.flat()))}).catch(S=>{throw this.dispatch(c(l.toUuidArray(f))),S});const T=Promise.all(A).then(S=>S.flat());return[f,T]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected asset type identifier value with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{asset__project:e,latest:!0}},i)).flat();return this.dispatch(a(c)),c}}class kg extends M{name="Asset Type";url="/asset-types";actions={addOne:Xr,addMany:Zr,setOne:Wr,setMany:Yr,updateOne:Jr,updateMany:Qr,deleteOne:xr,deleteMany:ed,initialize:Kr};selectors={selectById:sd,selectByIds:id};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected asset type with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected asset type with uuid ${e} to exist`);const d=this.select(xn(e)),r=this.select(yc(e));this.dispatch(i(e)),this.dispatch(ys(l.toUuidArray(d))),this.dispatch(Ss(l.toUuidArray(r)));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(a(c)),this.dispatch(ps(d)),this.dispatch(fs(r)),p}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{organization:e}},i);return this.dispatch(a(n)),n}}class Lg extends M{name="Asset Type Status";url="/asset-type-statuses";actions={addOne:rd,addMany:dd,setOne:ud,setMany:ld,updateOne:od,updateMany:hd,deleteOne:pd,deleteMany:yd,initialize:cd};selectors={selectById:fd,selectByIds:Sd};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[e.asset_type],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected an existing asset type status with uuid ${e.uuid}`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`No asset type status with uuid ${e} found in the store`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{asset_type__organization:e}},i);return this.dispatch(a(n)),n}}class Hg extends v{name="Document Attachment";url="/document-attachments";actions={addOne:Fd,addMany:_d,setOne:gd,setMany:Md,updateOne:Rd,updateMany:wd,deleteOne:Ed,deleteMany:vd,initialize:bd};selectors={selectById:Bd,selectByIds:zd};getId(e){return e.uuid}getBlockers(e){return[e.document]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,document:e.document}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,document:e.document}}async bulkAdd(e,i){const[a,n,c]=await super.bulkAdd(e,i),d={};for(const{file_sha1:r,uuid:p}of a)r in d||(d[r]=[]),d[r].push(p);return c.then(r=>{const p=r.flatMap(h=>d[h]??[]);for(const h of p)this.makeReadable(h)}),[a,n,c]}makeReadable(e){this.enqueueRequest({description:"Add attachment to AI assistant",method:o.PATCH,url:`${this.url}/${e}/`,payload:{readable_to_assistant:!0},blockers:["index-document-attachment",e],blocks:["index-document-attachment"]})}async refreshStore(e,i){const{initialize:a}=this.actions,n=this.list({queryParams:{document__project__organization:e}},i),c=this.list({queryParams:{document__organization:e}},i),r=(await Promise.all([n,c])).flat();return this.dispatch(a(r)),r}}class Gg extends M{name="Document";url="/documents";actions={addOne:Cd,addMany:$d,setOne:Ud,setMany:kd,updateOne:Ld,updateMany:Hd,deleteOne:Gd,deleteMany:Nd,initialize:qd};selectors={selectById:Wd,selectByIds:Yd};add(e){const{addOne:i,deleteOne:a,updateOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:r.parent_document?[r.parent_document]:[],blocks:[r.uuid]});return p.then(h=>{this.dispatch(n(h))}).catch(()=>{this.dispatch(a(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`attempting to update a document with uuid ${e.uuid} that does not exist in store.documents`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a,addMany:n,deleteMany:c}=this.actions,{selectById:d}=this.selectors,r=this.select(d(e));if(!r)throw new Error(`attempting to delete a document with uuid ${e} that does not exist in store.documents`);const p=this.select(Xd(e));this.dispatch(i(e)),this.dispatch(c(l.toUuidArray(p)));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(a(r)),this.dispatch(n(p)),h}}async refreshStore(e,i){const{initialize:a}=this.actions,n=this.list({queryParams:{project__organization:e}},i),c=this.list({queryParams:{organization:e}},i),r=(await Promise.all([n,c])).flat();return this.dispatch(a(r)),r}}class ot extends lt{async get(e,i){return this.performRequest({url:`${this.url}/${e}/`,method:o.GET},i)}async list(e,i){return this.performRequest({url:`${this.url}/`,method:o.GET,...e},i)}async listPaginated(e,i){return this.performPagination({url:`${this.url}/`,method:o.GET,...e},i)}}class Ng extends ot{name="Email Domains";url="/organization-email-domains";actions={addOne:Qd,addMany:xd,setOne:eu,setMany:tu,updateOne:su,updateMany:iu,deleteOne:au,deleteMany:nu,initialize:Jd};selectors={selectById:ru,selectByIds:du};async add(e,i){return this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:{email:i,organization:e},blockers:[e,"create-org"],blocks:[]})}async delete(e){const{deleteOne:i,addOne:a}=this.actions;this.dispatch(i(e.uuid));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e.uuid}/`,blockers:[e.domain],blocks:[]})}catch(n){throw this.dispatch(a(e)),n}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{organization:e}},i);return this.dispatch(a(n)),n}}class Kg extends lt{async getVerificationCode(e){return this.enqueueRequest({description:"Get verification code",method:o.GET,url:`/verification/email-verification/${e}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}validateVerificationCode(e,i){return this.enqueueRequest({description:"Validate verification code",method:o.POST,url:`/verification/email-verification/${e}/`,isAuthNeeded:!1,payload:i,blockers:[],blocks:[]})}}const Et={},an=new Set,nn=new Set;class Wg extends lt{host=void 0;dbPromise=uF.openDB("fileCache",2,{upgrade(e,i){i<1&&e.createObjectStore("files"),i<2&&e.createObjectStore("presignedUrls")}});async getDB(){return await this.dbPromise}async cacheFile(e){if(!e.name)throw new Error(`Cant add a file without a name to cache: ${e.name}`);if(!e.type)throw new Error(`Cant add a file without a type to cache: ${e.name}`);if(!e.size)throw new Error(`Cant add an empty file to cache: ${e.name}`);const i=await is(e);if(an.has(i))return;const a=await this.getDB();!!await a.get("files",i)?console.warn(`Attempting to add a file already cached, ${e.name}`):await a.put("files",e,i),an.add(i)}async uncacheFile(e){await(await this.getDB()).delete("files",e),an.delete(e)}async getFileFromCache(e){return(await this.getDB()).get("files",e)}async fetchFileFromUrl(e,i,a=i,n){const c=e.split("?")[0]??e,d=await this.getFileFromCache(i);if(d)return d;let r;c in Et?r=Et[c]:Gb(e)?(r=Hb(e,a),Et[c]=r):(r=this.performRequest({method:o.GET,url:e,isExternalUrl:!0,isResponseBlob:!0,isAuthNeeded:!1},n).then(f=>new File([f],a,{type:f.type})),Et[c]=r);let p;try{p=await r}catch(f){throw f instanceof z&&delete Et[c],f}const h=await is(p);if(h!==i){const f=`The hash of the file returned from the server (${h}) does not match the
7
+ `)}catch(n){console.error("Failed to extract error message from response body",n)}}else typeof t.body=="string"&&(i=t.body);else t?.text?i=t.text:e instanceof Error&&(i=e.message);return!i||i.length>bg?l.ERROR_MSG_UNEXPECTED:i}class z extends Error{status;response;message;options;constructor(e){super(l.ERROR_MSG_UNEXPECTED);const{response:i,innerError:a}=e;this.message=e.message??Fg(i,a)??l.ERROR_MSG_UNEXPECTED,this.status=i?.status??0,this.response=i,this.options=e}}function Cb(t){function e(i){return typeof i=="object"&&i!==null&&["ok","redirect","clientError","serverError","error"].every(n=>n in i)}if(e(t))return t;if(typeof t=="object"&&t!==null){const i=t;if(e(i.response))return i.response;if(i.response&&e(i.response.response))return i.response.response}}function _g(t){return new Uint8Array(t).reduce((i,a)=>i+a.toString(16).padStart(2,"0"),"")}function ss(t){return new Promise((e,i)=>{const a=new FileReader;a.onload=()=>{const n=a.result;if(!n){i(new Error("FileReader did not return a valid ArrayBuffer."));return}crypto.subtle.digest("SHA-1",n).then(c=>{const d=_g(c);e(d)})},a.readAsArrayBuffer(t)})}const $b=async t=>{const e=await t.arrayBuffer();return new Blob([e],{type:t.type})},gg=(t,e)=>`${t}${e?`.${e}`:""}`;function Mg(t,e){return new File([t],e,{type:t.type})}function Ub(t){const e=t.name;return e.includes(".")?e.split(".").pop():""}const kb=async t=>(await fetch(t)).blob(),Lb=async(t,e)=>{const i=await kb(t);return new File([i],e,{type:i.type})};function Hb(t){return typeof t=="string"&&t.startsWith("blob:")}function Gb(t){return typeof t=="string"&&URL.canParse(t)&&t.startsWith("https://")&&t.includes(".cloudfront.net/")}function Nb(t){return typeof t=="string"&&URL.canParse(t)&&t.startsWith("https://")&&t.includes(".s3.amazonaws.com/")}function Kb(t){if(Gb(t)){const i=new URLSearchParams(t).get("Expires");if(!i)return null;const a=parseInt(i,10);return new Date(a*1e3)}if(Nb(t)){const e=new URLSearchParams(t),i=e.get("X-Amz-Date"),a=e.get("X-Amz-Expires");if(!i||!a)return null;const n=new Date(i.replace(/^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})Z$/,"$1-$2-$3T$4:$5:$6Z")),c=parseInt(a);return new Date(n.getTime()+c*1e3)}return null}function Wb(t,e=30){const i=Kb(t);if(!i)return!1;const a=Date.now(),n=i.getTime(),c=e*1e3;return a+c>=n}function Rg(t){return t.type.startsWith("image/")}class Xb extends Vb{constructor(e){super(e)}applyAuth(e){const i=this.getAuthHeader();return i?e.set("Authorization",i):e}isAuthFailure(e){return e.status===401}}class lt extends Vb{auth;constructor(e,i){super(e),this.auth=i}}class wg extends lt{async startConversation(e,i){return this.enqueueRequest({description:"Start agent conversation",method:o.POST,url:"/agents/prompt/",payload:{prompt:e,active_project:i},blockers:["prompt"],blocks:["prompt"]}).then(a=>(this.dispatch(hn(a)),a))}async continueConversation(e,i,a){return this.enqueueRequest({description:"Prompt agent",method:o.POST,url:"/agents/prompt/",payload:{prompt:e,active_project:a},blockers:["prompt"],blocks:["prompt"],queryParams:{conversation_id:i}}).then(n=>{this.dispatch(yn(n))})}async fetchDetails(e){return this.enqueueRequest({description:"Get agent conversation",method:o.GET,url:`/agents/conversations/${e}/`,blockers:["conversation"],blocks:["conversation"]}).then(i=>{this.dispatch(pn(i))})}async rate(e,i){return this.enqueueRequest({description:"Rate agent response",method:o.PUT,url:`/agents/responses/${e}/rate/`,payload:{rating:i},blockers:["rate"],blocks:["rate"]})}async list(e,i){return this.performRequest({method:o.GET,url:"/agents/conversations/",...e},i)}async refreshStore(e,i){const a=await this.list({queryParams:{project:e}},i);return this.dispatch(on(a)),a}}function m(t,e,i){const a=`${e}${i?"s":""}`;switch(t){case o.GET:return`Get ${a}`;case o.POST:return`Create ${a}`;case o.PATCH:return`Update ${a}`;case o.PUT:return`Update ${a}`;case o.DELETE:return`Delete ${a}`}}function g(t){const e={...t};for(const i of[...un,"created_by"])i in e&&delete e[i];return e}class M extends lt{async get(e,i){return this.performRequest({url:`${this.url}/${e}/`,method:o.GET},i)}async list(e,i){return this.performRequest({url:`${this.url}/`,method:o.GET,...e},i)}async listPaginated(e,i){return this.performPagination({url:`${this.url}/`,method:o.GET,...e},i)}}class v extends M{async getPresignedUrl(e,i){const{selectById:a}=this.selectors,n=this.select(a(e));if(!n)throw new Error(`Could not find ${this.name}: ${e} in store.`);if(n.object_url)return n.object_url;const c=await this.client.files.getPresignedUrlFromCache(n.file_sha1);if(c)return c;const d=await this.performRequest({url:`${this.url}/${e}/presigned-url/`,method:o.GET},i);return await this.client.files.cachePresignedUrl(n.file_sha1,d),d}async add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions;let c,d=null,r=null;if("file"in e){const{file:S,...O}=e;d=await this.client.files.getFilePayload(S),r=URL.createObjectURL(S),c={...O,file_sha1:d.sha1,file_type:d.file_type,file_name:S.name,file_extension:d.extension,object_url:r}}else c=e;const p=this.buildModel(c),h=this.buildPayload(p);this.dispatch(i(p));const f=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:{...h,...d?{file:d}:{}},blockers:this.getBlockers(p),blocks:this.getBlocks(p)});f.then(({instance:S})=>{this.dispatch(a(S))}).catch(()=>{this.dispatch(n(this.getId(p)))}).finally(()=>{r&&URL.revokeObjectURL(r)});const A=f.then(({instance:S})=>S),T=f.then(async({instance:S,presigned_url:O})=>{try{return O&&await this.client.files.processPresignedUrl(S.file_sha1,O),S.file_sha1}catch(_){throw console.error("Upload to s3 using presigned url failed.",_),_}});return[p,A,T]}async bulkAdd(e,i){const{addMany:a,updateMany:n,deleteMany:c}=this.actions,d=new Date().toISOString(),r=[],p=new Set,h=l.chunkArray(e,Math.min(i??e.length,q)),f=[];for(const O of h){const _=[],F={},w=[],V=[];for(const it of O){let Et;if("file"in it){const{file:vt,...tR}=it,Ot=await this.client.files.getFilePayload(vt);Ot.sha1 in F||(F[Ot.sha1]=Ot);const aF=URL.createObjectURL(vt);p.add(aF),Et={...tR,file_sha1:Ot.sha1,file_type:Ot.file_type,file_name:vt.name,file_extension:Ot.extension,object_url:aF}}else Et=it;const j=this.buildModel(Et);r.push(j);const is=this.buildBulkPayload(j);_.push(is);const B=this.getBlockers(j);w.push(...B);const C=this.getBlocks(j);V.push(...C)}const R={payloads:_,submittedAt:d,files:Object.values(F),blockers:w,blocks:V};f.push(R)}this.dispatch(a(r));const A=f.map(O=>{const{submittedAt:_,files:F,payloads:w,blocks:V,blockers:R}=O;return this.enqueueRequest({description:m(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{submitted_at:_,files:F,payloads:w},blockers:R,blocks:V})});Promise.all(A).then(O=>{const _=O.flatMap(F=>F.instances);this.dispatch(n(_))}).catch(O=>{throw this.dispatch(c(r.map(_=>this.getId(_)))),console.error(O),O}).finally(()=>{for(const O of p)URL.revokeObjectURL(O)});const T=Promise.all(A).then(O=>O.flatMap(({instances:_})=>_)),S=Promise.all(A).then(async O=>{const _=[];for(const{presigned_urls:F}of O){const w=this.client.files.processPresignedUrls(F);for(const[V,R]of Object.entries(w))try{await R,_.push(V)}catch(it){throw console.error("Upload to s3 using presigned url failed.",it),it}}return _});return[r,T,S]}async delete(e){const{addOne:i,deleteOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Attempting to delete ${this.name} with pk ${e} that does not exist in the store`);this.dispatch(a(this.getId(c)));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(i(c)),d}}}class Eg extends v{name="Asset attachment";url="/asset-attachments";actions={addOne:An,addMany:rs,setOne:Tn,setMany:In,updateOne:On,updateMany:Pn,deleteOne:bn,deleteMany:ds,initialize:Sn};selectors={selectById:_n,selectByIds:gn};getId(e){return e.uuid}getBlockers(e){const{asset:i}=e;return[i]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset:e.asset}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset:e.asset}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{asset__project:e}},i)).flat();return this.dispatch(a(c)),c}}class vg extends M{name="Asset Comment";url="/asset-comments";actions={addOne:vn,addMany:Vt,setOne:Vn,setMany:Bn,updateOne:zn,updateMany:jn,deleteOne:Dn,deleteMany:Bt,initialize:En};selectors={selectById:Cn,selectByIds:$n};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(c),blockers:[c.asset],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Asset comment with uuid ${e.uuid} not found in store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Asset comment with uuid ${e} not found in store`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{asset__project:e}},i)).flat();return this.dispatch(a(c)),c}}class Vg extends M{url="/assets";name="Asset";actions={addOne:Nn,addMany:hs,setOne:Yn,setMany:Zn,updateOne:Kn,updateMany:Wn,deleteOne:Xn,deleteMany:ps,initialize:Gn};selectors={selectById:xn,selectByIds:ec};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[r.asset_type],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`No asset with uuid ${e.uuid} found in the store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{addOne:i,deleteOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`No asset with uuid ${e} found in the store`);const d=this.select(Mn(e)),r=this.select(Un(e)),p=this.select(Qo(e)),h=this.select(OA(e)),f=this.select(Po(e));this.dispatch(a(e)),this.dispatch(ds(l.toUuidArray(d))),this.dispatch(Bt(l.toUuidArray(r))),this.dispatch(mt(l.toUuidArray(p))),this.dispatch(At(l.toUuidArray(h))),this.dispatch(ct(l.toUuidArray(f)));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(A){throw this.dispatch(i(c)),this.dispatch(rs(d)),this.dispatch(Vt(r)),this.dispatch(yt(p)),this.dispatch(St(h)),this.dispatch(nt(f)),A}}bulkAdd(e,i){const{addMany:a}=this.actions,n=new Date().toISOString(),c=l.chunkArray(e,Math.min(i??e.length,q)).map(p=>{const h=p.map(f=>l.uuidObj(f));return{batchId:at.v4(),payload:{submitted_at:n,assets:h}}}),d=[];let r=null;for(const p of c){const{batchId:h,payload:f}=p,A=f.assets.map(({uuid:F})=>F),T=f.assets.map(({asset_type:F})=>F),S=f.assets.map(({project:F})=>F),O=f.assets.map(({status:F})=>F),_=this.enqueueRequest({description:m(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:f,blockers:(r?[r]:[]).concat(T).concat(S).concat(O),blocks:[h].concat(A)});r=p.batchId,d.push(_)}return Promise.all(d).then(p=>{const h=p.flat();this.dispatch(a(h))}),d}bulkUpdate(e,i){const{updateMany:a}=this.actions,{selectByIds:n}=this.selectors,c=l.toUuidArray(e);if(new Set(c).size!==e.length)throw new Error("payloads contains duplicate uuids.");const d=this.select(n(c));if(c.length!=d.length)throw new Error(`Attempting to bulk update ${c.length-d.length} assets that dont exist in the store`);const r=d.toSorted((S,O)=>l.uuidSortFn(S.uuid,O.uuid)),p=e.toSorted((S,O)=>l.uuidSortFn(S.uuid,O.uuid)),h=[];for(let S=0;S<c.length;S++)h.push({...r[S],...p[S]});this.dispatch(a(h));const f=l.chunkArray(e,Math.min(i??e.length,q)),A=[];let T=null;for(const S of f){const O=at.v4(),_=l.toUuidArray(S),F=S.map(({status:V})=>V).filter(Boolean),w=this.enqueueRequest({description:m(o.PATCH,this.name,!0),method:o.PATCH,url:`${this.url}/bulk/`,payload:{payloads:S},blockers:(T?[T]:[]).concat(_).concat(F),blocks:[O].concat(_)});A.push(w),T=O}return Promise.all(A).then(S=>{this.dispatch(a(S.flat()))}).catch(()=>{this.dispatch(a(d))}),[h,A]}async bulkDelete(e){const{addMany:i,deleteMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e)),d=this.select(kn(e)),r=this.select(xo(e)),p=this.select(PA(e)),h=this.select(bo(e));this.dispatch(a(e)),this.dispatch(Bt(l.toUuidArray(d))),this.dispatch(mt(l.toUuidArray(r))),this.dispatch(At(l.toUuidArray(p))),this.dispatch(ct(l.toUuidArray(h)));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(f){throw this.dispatch(i(c)),this.dispatch(Vt(d)),this.dispatch(yt(r)),this.dispatch(St(p)),this.dispatch(nt(h)),f}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}class Bg extends v{name="Asset Type Attachment";url="/asset-type-attachments";actions={addOne:ac,addMany:ms,setOne:nc,setMany:cc,updateOne:rc,updateMany:dc,deleteOne:uc,deleteMany:fs,initialize:ic};selectors={selectById:oc,selectByIds:hc};getId(e){return e.uuid}getBlockers(e){return[e.asset_type]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset_type:e.asset_type}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,asset_type:e.asset_type}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{asset_type__organization:e}},i);return this.dispatch(a(n)),n}}class zg extends v{name="Asset Type Fields Attachment";url="/asset-type-fields-attachments";actions={addOne:Sc,addMany:Ac,setOne:Tc,setMany:Ic,updateOne:Oc,updateMany:Pc,deleteOne:bc,deleteMany:Fc,initialize:fc};selectors={selectById:gc,selectByIds:Mc};getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){const{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{fields_revision__asset_type__organization:e}},i);return this.dispatch(a(n)),n}}class jg extends M{name="Asset Type Fields";url="/asset-type-fields";actions={addOne:vc,addMany:Vc,setOne:Bc,setMany:zc,updateOne:jc,updateMany:Dc,deleteOne:qc,deleteMany:Cc,initialize:Ec};selectors={selectById:Uc,selectByIds:kc};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[r.asset_type],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{asset_type__organization:e}},i);return this.dispatch(a(n)),n}}class Dg extends v{name="Asset Type Field Values Attachment";url="/asset-type-field-values-attachments";actions={addOne:Nc,addMany:Ps,setOne:Kc,setMany:Wc,updateOne:Xc,updateMany:Yc,deleteOne:Zc,deleteMany:bs,initialize:Gc};selectors={selectById:Qc,selectByIds:xc};getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}async bulkDelete(e){const{deleteMany:i,addMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{field_values__asset__project:e,latest:!0}},i)).flat();return this.dispatch(a(c)),c}}class qg extends M{name="Asset Type Field Values";url="/asset-type-field-values";actions={addOne:ar,addMany:nr,setOne:cr,setMany:rr,updateOne:dr,updateMany:ur,deleteOne:lr,deleteMany:or,initialize:ir};selectors={selectById:pr,selectByIds:yr};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d}),p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[e.asset,e.fields_revision],blocks:[r.uuid]});return this.dispatch(i(r)),p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}bulkAdd(e,i){const{payloads:a,values:n}=e,{addMany:c,updateMany:d,deleteMany:r}=this.actions,p=new Date().toISOString(),h=[],f=l.chunkArray(a,Math.min(i??a.length,q)),A=[];for(const S of f){const O=[];for(const _ of S){const F=l.uuidObj({..._,values:_.values,created_by:this.select(w=>w.userReducer.currentUser?.id??null),submitted_at:p});h.push(F),O.push({uuid:F.uuid,asset:_.asset,fields_revision:_.fields_revision,published_at:_.published_at,values:F.values})}A.push({submitted_at:p,values:n,field_values:O})}this.dispatch(c(h));const T=[];for(const S of A){const{field_values:O}=S,_=O.map(({asset:R})=>R),F=O.map(({fields_revision:R})=>R),w=O.map(({uuid:R})=>R),V=this.enqueueRequest({description:m(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:S,blockers:_.concat(F),blocks:w});T.push(V)}return Promise.all(T).then(S=>{this.dispatch(d(S.flat()))}).catch(()=>{this.dispatch(r(l.toUuidArray(h)))}),[h,T]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected AssetTypeFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[c.uuid,c.fields_revision,c.asset],blocks:[c.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const d=this.select(er(e));this.dispatch(i(e)),this.dispatch(bs(l.toUuidArray(d)));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(c)),this.dispatch(Ps(d)),r}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{asset__project:e,latest:!0}},i)).flat();return this.dispatch(a(c)),c}}class Cg extends M{name="Asset Type Identifier";url="/asset-type-identifiers";actions={addOne:Ar,addMany:Tr,setOne:Ir,setMany:Or,updateOne:Pr,updateMany:br,deleteOne:Fr,deleteMany:_r,initialize:Sr};selectors={selectById:Mr,selectByIds:Rr};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[r.asset_type],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected asset type identifier with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected asset type identifier with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{asset_type__organization:e}},i);return this.dispatch(a(n)),n}}class $g extends M{name="Asset Type Identifier Value";url="/asset-type-identifier-values";actions={addOne:Vr,addMany:Br,setOne:zr,setMany:jr,updateOne:Dr,updateMany:qr,deleteOne:Cr,deleteMany:$r,initialize:vr};selectors={selectById:kr,selectByIds:Lr};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[e.asset,e.asset_type_identifier],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}bulkAdd(e,i){const{addMany:a,updateMany:n,deleteMany:c}=this.actions,d=new Date().toISOString(),r=this.select(S=>S.userReducer.currentUser?.id??null),p=l.chunkArray(e,Math.min(i??e.length,q)),h=[],f=[];for(const S of p){const O=[],_=[],F=[];for(const V of S){const R=l.uuidObj({...V,submitted_at:d,created_by:r});f.push(R);const it={uuid:R.uuid,asset:R.asset,asset_type_identifier:R.asset_type_identifier,value:R.value};O.push(it),_.push(R.asset),_.push(R.asset_type_identifier),F.push(R.uuid)}const w={payloads:O,submitted_at:d,blockers:_,blocks:F};h.push(w)}this.dispatch(a(f));const A=h.map(S=>{const{payloads:O,submitted_at:_,blockers:F,blocks:w}=S;return this.enqueueRequest({description:m(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{submitted_at:_,payloads:O},blockers:F,blocks:w})});Promise.all(A).then(S=>{this.dispatch(n(S.flat()))}).catch(S=>{throw this.dispatch(c(l.toUuidArray(f))),S});const T=Promise.all(A).then(S=>S.flat());return[f,T]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected asset type identifier value with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{asset__project:e,latest:!0}},i)).flat();return this.dispatch(a(c)),c}}class Ug extends M{name="Asset Type";url="/asset-types";actions={addOne:Xr,addMany:Yr,setOne:Kr,setMany:Wr,updateOne:Zr,updateMany:Jr,deleteOne:Qr,deleteMany:xr,initialize:Nr};selectors={selectById:td,selectByIds:sd};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected asset type with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected asset type with uuid ${e} to exist`);const d=this.select(Qn(e)),r=this.select(pc(e));this.dispatch(i(e)),this.dispatch(ps(l.toUuidArray(d))),this.dispatch(fs(l.toUuidArray(r)));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(a(c)),this.dispatch(hs(d)),this.dispatch(ms(r)),p}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{organization:e}},i);return this.dispatch(a(n)),n}}class kg extends M{name="Asset Type Status";url="/asset-type-statuses";actions={addOne:cd,addMany:rd,setOne:dd,setMany:ud,updateOne:ld,updateMany:od,deleteOne:hd,deleteMany:pd,initialize:nd};selectors={selectById:md,selectByIds:fd};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[e.asset_type],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected an existing asset type status with uuid ${e.uuid}`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`No asset type status with uuid ${e} found in the store`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{asset_type__organization:e}},i);return this.dispatch(a(n)),n}}class Lg extends v{name="Document Attachment";url="/document-attachments";actions={addOne:bd,addMany:Fd,setOne:_d,setMany:gd,updateOne:Md,updateMany:Rd,deleteOne:wd,deleteMany:Ed,initialize:Pd};selectors={selectById:Vd,selectByIds:Bd};getId(e){return e.uuid}getBlockers(e){return[e.document]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,document:e.document}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,document:e.document}}async bulkAdd(e,i){const[a,n,c]=await super.bulkAdd(e,i),d={};for(const{file_sha1:r,uuid:p}of a)r in d||(d[r]=[]),d[r].push(p);return c.then(r=>{const p=r.flatMap(h=>d[h]??[]);for(const h of p)this.makeReadable(h)}),[a,n,c]}makeReadable(e){this.enqueueRequest({description:"Add attachment to AI assistant",method:o.PATCH,url:`${this.url}/${e}/`,payload:{readable_to_assistant:!0},blockers:["index-document-attachment",e],blocks:["index-document-attachment"]})}async refreshStore(e,i){const{initialize:a}=this.actions,n=this.list({queryParams:{document__project__organization:e}},i),c=this.list({queryParams:{document__organization:e}},i),r=(await Promise.all([n,c])).flat();return this.dispatch(a(r)),r}}class Hg extends M{name="Document";url="/documents";actions={addOne:qd,addMany:Cd,setOne:$d,setMany:Ud,updateOne:kd,updateMany:Ld,deleteOne:Hd,deleteMany:Gd,initialize:Dd};selectors={selectById:Kd,selectByIds:Wd};add(e){const{addOne:i,deleteOne:a,updateOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:r.parent_document?[r.parent_document]:[],blocks:[r.uuid]});return p.then(h=>{this.dispatch(n(h))}).catch(()=>{this.dispatch(a(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`attempting to update a document with uuid ${e.uuid} that does not exist in store.documents`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a,addMany:n,deleteMany:c}=this.actions,{selectById:d}=this.selectors,r=this.select(d(e));if(!r)throw new Error(`attempting to delete a document with uuid ${e} that does not exist in store.documents`);const p=this.select(Xd(e));this.dispatch(i(e)),this.dispatch(c(l.toUuidArray(p)));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(a(r)),this.dispatch(n(p)),h}}async refreshStore(e,i){const{initialize:a}=this.actions,n=this.list({queryParams:{project__organization:e}},i),c=this.list({queryParams:{organization:e}},i),r=(await Promise.all([n,c])).flat();return this.dispatch(a(r)),r}}class ot extends lt{async get(e,i){return this.performRequest({url:`${this.url}/${e}/`,method:o.GET},i)}async list(e,i){return this.performRequest({url:`${this.url}/`,method:o.GET,...e},i)}async listPaginated(e,i){return this.performPagination({url:`${this.url}/`,method:o.GET,...e},i)}}class Gg extends ot{name="Email Domains";url="/organization-email-domains";actions={addOne:Jd,addMany:Qd,setOne:xd,setMany:eu,updateOne:tu,updateMany:su,deleteOne:iu,deleteMany:au,initialize:Zd};selectors={selectById:cu,selectByIds:ru};async add(e,i){return this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:{email:i,organization:e},blockers:[e,"create-org"],blocks:[]})}async delete(e){const{deleteOne:i,addOne:a}=this.actions;this.dispatch(i(e.uuid));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e.uuid}/`,blockers:[e.domain],blocks:[]})}catch(n){throw this.dispatch(a(e)),n}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{organization:e}},i);return this.dispatch(a(n)),n}}class Ng extends lt{async getVerificationCode(e){return this.enqueueRequest({description:"Get verification code",method:o.GET,url:`/verification/email-verification/${e}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}validateVerificationCode(e,i){return this.enqueueRequest({description:"Validate verification code",method:o.POST,url:`/verification/email-verification/${e}/`,isAuthNeeded:!1,payload:i,blockers:[],blocks:[]})}}const wt={},sn=new Set,an=new Set;class Kg extends lt{host=void 0;dbPromise=dF.openDB("fileCache",2,{upgrade(e,i){i<1&&e.createObjectStore("files"),i<2&&e.createObjectStore("presignedUrls")}});async getDB(){return await this.dbPromise}async cacheFile(e){if(!e.name)throw new Error(`Cant add a file without a name to cache: ${e.name}`);if(!e.type)throw new Error(`Cant add a file without a type to cache: ${e.name}`);if(!e.size)throw new Error(`Cant add an empty file to cache: ${e.name}`);const i=await ss(e);if(sn.has(i))return;const a=await this.getDB();!!await a.get("files",i)?console.warn(`Attempting to add a file already cached, ${e.name}`):await a.put("files",e,i),sn.add(i)}async uncacheFile(e){await(await this.getDB()).delete("files",e),sn.delete(e)}async getFileFromCache(e){return(await this.getDB()).get("files",e)}async fetchFileFromUrl(e,i,a=i,n){const c=e.split("?")[0]??e,d=await this.getFileFromCache(i);if(d)return d;let r;c in wt?r=wt[c]:Hb(e)?(r=Lb(e,a),wt[c]=r):(r=this.performRequest({method:o.GET,url:e,isExternalUrl:!0,isResponseBlob:!0,isAuthNeeded:!1},n).then(f=>new File([f],a,{type:f.type})),wt[c]=r);let p;try{p=await r}catch(f){throw f instanceof z&&delete wt[c],f}const h=await ss(p);if(h!==i){const f=`The hash of the file returned from the server (${h}) does not match the
8
8
  expected hash (${i}). This can happen if you're using a local development server and the
9
9
  isExternalUrl flag in the request details is set to true, because instead of requesting the local
10
10
  REST API, you will be requesting localhost:80 (where this app runs), resulting in a transformed blob
11
11
  (with an uuid attached) being returned. Alternatively, you may be running with
12
12
  import.meta.env.PROD, which will result in some file requests being treated as
13
- external URLs and therefore not prepended with VITE_API_URL.`;throw new Error(f)}return await this.cacheFile(p),p}processPresignedUrl(e,i){if("warning"in i){if(i.warning==="already_uploaded")return Promise.resolve(void 0);throw console.error(i.warning),new Error(i.warning)}return this.enqueueRequest({url:i.url,description:"Upload file to S3",method:o.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:e,blockers:[`s3-${i.fields.key}`,"s3-presigned-upload"],blocks:[e,"s3-presigned-upload"],s3url:i})}processPresignedUrls(e){const i={};for(const[a,n]of Object.entries(e))i[a]=this.processPresignedUrl(a,n);return i}async getFilePayload(e){const a={sha1:await is(e),file_type:e.type,extension:kb(e),size:e.size};return await this.client.files.cacheFile(e),a}async cachePresignedUrl(e,i){if(nn.has(e))return;const a=await this.getDB();!!await a.get("presignedUrls",e)?console.warn(`Attempting to add a presigned url already cached, ${i}`):await a.put("presignedUrls",i,e),nn.add(e)}async uncachePresignedUrl(e){await(await this.getDB()).delete("presignedUrls",e),nn.delete(e)}async getPresignedUrlFromCache(e){const i=await(await this.getDB()).get("presignedUrls",e);if(!i)return;if(Yb(i)){await this.uncachePresignedUrl(e);return}return i}}class Yg extends M{name="Form Identifier";url="/form-identifiers";actions={addOne:hu,addMany:pu,setOne:yu,setMany:mu,updateOne:fu,updateMany:Su,deleteOne:Au,deleteMany:Tu,initialize:ou};selectors={selectById:Ou,selectByIds:Pu};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[r.form],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected form identifier with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected form identifier with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{form__organization:e}},i);return this.dispatch(a(n)),n}}class Xg extends M{name="Form Identifier Value";url="/form-identifier-values";actions={addOne:gu,addMany:Mu,setOne:Ru,setMany:wu,updateOne:Eu,updateMany:vu,deleteOne:Vu,deleteMany:Bu,initialize:_u};selectors={selectById:ju,selectByIds:Du};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[e.form_submission,e.form_identifier],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected form identifier value with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await Promise.all([this.listPaginated({queryParams:{latest:!0,form_submission__organization:e}},i),this.listPaginated({queryParams:{latest:!0,form_submission__project__organization:e}},i)])).flatMap(d=>d.flat());return this.dispatch(a(c)),c}}class Zg extends v{name="Form Revision Attachment";url="/form-revision-attachments";actions={addOne:Uu,addMany:ku,setOne:Lu,setMany:Hu,updateOne:Gu,updateMany:Nu,deleteOne:Ku,deleteMany:Wu,initialize:$u};selectors={selectById:Xu,selectByIds:Zu};getId(e){return e.uuid}getBlockers(e){return[e.form_revision]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){const{uuid:i,field_identifier:a,form_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,form_revision:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,form_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,form_revision:n,file_sha1:c,file_name:d,file_extension:r}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{form_revision__form__organization:e}},i);return this.dispatch(a(n)),n}}class Jg extends M{name="Form Revision";url="/form-revisions";actions={addOne:el,addMany:Ns,setOne:tl,setMany:sl,updateOne:il,updateMany:al,deleteOne:nl,deleteMany:Ks,initialize:xu};selectors={selectById:rl,selectByIds:dl};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[e.form],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{form__organization:e}},i);return this.dispatch(a(n)),n}}class Qg extends M{name="Form";url="/forms";actions={addOne:gl,addMany:Ml,setOne:Rl,setMany:wl,updateOne:El,updateMany:vl,deleteOne:Vl,deleteMany:Bl,initialize:_l};selectors={selectById:Dl,selectByIds:ql};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=new Date().toISOString(),d=this.select(h=>h.userReducer.currentUser?.id??null),r=l.uuidObj({...e,submitted_at:c,created_by:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected form with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error("Expected form to exist");const d=this.select(Io(e)),r=this.select(ul(e)),p=this.select(Pl(e));this.dispatch(i(e)),this.dispatch(ct(l.toUuidArray(d))),this.dispatch(Ks(l.toUuidArray(r))),this.dispatch(Xs(l.toUuidArray(p)));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(a(c)),this.dispatch(Ns(r)),this.dispatch(nt(d)),this.dispatch(Ys(p)),h}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{organization:e}},i);return this.dispatch(a(n)),n}}class xg extends M{name="Form Subscriber";url="/form-subscribers";actions={addOne:pl,addMany:Ys,setOne:yl,setMany:ml,updateOne:fl,updateMany:Sl,deleteOne:Al,deleteMany:Xs,initialize:hl};selectors={selectById:Il,selectByIds:Ol};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=new Date().toISOString(),d=this.select(h=>h.userReducer.currentUser?.id??null),r=l.uuidObj({...e,created_by:d,submitted_at:c});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[r.form],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected form subscriber with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{form__organization:e}},i);return this.dispatch(a(n)),n}}class eM extends v{name="Form Submission Field Values Attachment";url="/form-submission-field-values-attachments";actions={addOne:Ul,addMany:xs,setOne:kl,setMany:Ll,updateOne:Hl,updateMany:Gl,deleteOne:Nl,deleteMany:ei,initialize:$l};selectors={selectById:Kl,selectByIds:ii};getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}async bulkDelete(e){const{deleteMany:i,addMany:a}=this.actions,n=this.select(ii(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(a(n)),c}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await Promise.all([this.listPaginated({queryParams:{latest:!0,field_values__form_submission__organization:e}},i),this.listPaginated({queryParams:{latest:!0,field_values__form_submission__project__organization:e}},i)])).flatMap(d=>d.flat());return this.dispatch(a(c)),c}}class tM extends M{name="Form Submission Field Values";url="/form-submission-field-values";actions={addOne:Jl,addMany:ni,setOne:Ql,setMany:xl,updateOne:eo,updateMany:to,deleteOne:so,deleteMany:ci,initialize:Zl};selectors={selectById:ao,selectByIds:no};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[r.form_submission],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await Promise.all([this.listPaginated({queryParams:{latest:!0,form_submission__organization:e}},i),this.listPaginated({queryParams:{latest:!0,form_submission__project__organization:e}},i)])).flatMap(d=>d.flat());return this.dispatch(a(c)),c}}class sM extends M{name="Form Submission";url="/form-submissions";actions={addOne:po,addMany:nt,setOne:oo,setMany:ho,updateOne:yo,updateMany:mo,deleteOne:fo,deleteMany:ct,initialize:lo};selectors={selectById:Ao,selectByIds:To};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d}),p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[e.form_revision],blocks:[r.uuid]});return this.dispatch(i(r)),p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected submission with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${c.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const d=this.select(co(e)),r=d.flatMap(({uuid:p})=>this.select(Wl(p)));this.dispatch(i(e)),this.dispatch(ci(l.toUuidArray(d))),this.dispatch(ei(l.toUuidArray(r)));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(a(c)),this.dispatch(ni(d)),this.dispatch(xs(r)),p}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await Promise.all([this.listPaginated({queryParams:{organization:e}},i),this.listPaginated({queryParams:{project__organization:e}},i)])).flatMap(d=>d.flat());return this.dispatch(a(c)),c}}class iM extends v{name="Geo Image";url="/geo-images";actions={addOne:Eo,addMany:vo,setOne:Ro,setMany:wo,updateOne:Vo,updateMany:Bo,deleteOne:zo,deleteMany:jo,initialize:Mo};selectors={selectById:qo,selectByIds:Co};getId(e){return e.uuid}getBlockers(e){return[e.project]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_sha1:e.file_sha1,file_name:e.file_name,file_extension:e.file_extension,title:e.title,description:e.description,geo_marker:e.geo_marker,direction:e.direction,original_date:e.original_date,project:e.project}}buildBulkPayload(e){return{uuid:e.uuid,file_sha1:e.file_sha1,file_name:e.file_name,file_extension:e.file_extension,title:e.title,description:e.description,geo_marker:e.geo_marker,direction:e.direction,original_date:e.original_date,project:e.project}}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Geo image with uuid ${e.uuid} does not exist in the store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{project:e}},i);return this.dispatch(a(n)),n}}class aM extends M{name="Issue Association";url="/issue-associations";actions={addOne:Ko,addMany:yt,setOne:Ho,setMany:Lo,updateOne:Go,updateMany:No,deleteOne:Wo,deleteMany:mt,initialize:ko};selectors={selectById:Xo,selectByIds:Zo};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=new Date().toISOString(),d=this.select(h=>h.userReducer.currentUser?.id??null),r=l.uuidObj({...e,submitted_at:c,created_by:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[e.issue,e.asset],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}bulkAdd(e){const{addMany:i,deleteMany:a,updateMany:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=e.map(h=>l.uuidObj({...h,submitted_at:d,created_by:c}));this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{payloads:r.map(h=>g(h)),submitted_at:d},blockers:r.flatMap(h=>[h.issue,h.asset]),blocks:l.toUuidArray(r)});return p.then(h=>{this.dispatch(n(h))}).catch(()=>{this.dispatch(a(l.toUuidArray(r)))}),[r,p]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{issue__project:e}},i)).flat();return this.dispatch(a(c)),c}}class nM extends v{name="Issue Attachment";url="/issue-attachments";actions={addOne:ah,addMany:pi,setOne:nh,setMany:ch,updateOne:rh,updateMany:dh,deleteOne:uh,deleteMany:yi,initialize:ih};selectors={selectById:hh,selectByIds:ph};getId(e){return e.uuid}getBlockers(e){return[e.issue]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue:e.issue}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue:e.issue}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{issue__project:e}},i)).flat();return this.dispatch(a(c)),c}}class cM extends v{name="Issue Comment Attachment";url="/issue-comment-attachments";actions={addOne:Sh,addMany:Ah,setOne:Th,setMany:Ih,updateOne:Oh,updateMany:Ph,deleteOne:bh,deleteMany:Fh,initialize:fh};selectors={selectById:gh,selectByIds:Mh};getId(e){return e.uuid}getBlockers(e){return[e.issue_comment]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue_comment:e.issue_comment}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue_comment:e.issue_comment}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{issue_comment__issue__project:e}},i)).flat();return this.dispatch(a(c)),c}}class rM extends M{name="Issue Comment";url="/issue-comments";actions={addOne:vh,addMany:Vh,setOne:Bh,setMany:zh,updateOne:jh,updateMany:Dh,deleteOne:qh,deleteMany:Ch,initialize:Eh};selectors={selectById:$h,selectByIds:Uh};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser.id),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(c),blockers:[e.issue],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{issue__project:e}},i)).flat();return this.dispatch(a(c)),c}}class dM extends M{name="Issue";url="/issues";actions={addOne:Gh,addMany:Oi,setOne:Nh,setMany:Kh,updateOne:Wh,updateMany:Yh,deleteOne:Xh,deleteMany:Pi,initialize:Hh};selectors={selectById:Jh,selectByIds:Qh};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=new Date().toISOString(),d=this.select(h=>h.userReducer.currentUser?.id??null),r=l.uuidObj({...e,submitted_at:c,created_by:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[r.project,r.issue_type,r.status,r.priority],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(h=>{throw this.dispatch(n(r.uuid)),h}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const c={...n,...e};this.dispatch(i(c));const d={};for(const h of[l.IssueUpdateChange.TITLE,l.IssueUpdateChange.DESCRIPTION,l.IssueUpdateChange.STATUS,l.IssueUpdateChange.PRIORITY,l.IssueUpdateChange.ASSIGNED_TO,l.IssueUpdateChange.DUE_DATE])if(h in e&&e[h]!==n[h])switch(h){case l.IssueUpdateChange.PRIORITY:{const f=e[h],A=this.select(Ci(f));if(!A)throw new Error(`Trying to update issue type priority with ${f} which does not exist in store`);d[h]={name:A.name,color:A.color,uuid:A.uuid};break}case l.IssueUpdateChange.DUE_DATE:d[h]=e.due_date;break;case l.IssueUpdateChange.DESCRIPTION:d[h]=e.description??"";break;case l.IssueUpdateChange.TITLE:d[h]=e.title??"";break;case l.IssueUpdateChange.STATUS:{const f=e[h],A=this.select(Hi(f));if(!A)throw new Error(`Trying to update issue type status with ${f} which does not exist in store`);d[h]={name:A.name,color:A.color,uuid:A.uuid};break}case l.IssueUpdateChange.ASSIGNED_TO:{const f=e[h];if(f===null)d[h]=null;else{const A=this.select(Xt(f));if(!A)throw new Error(`Trying to update assigned to with ${f} which does not exist in store.`);d[h]={full_name:A.username,id:A.id}}break}}const r=l.uuidObj({created_by:this.select(h=>h.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString(),issue:n.uuid,changes:d});this.dispatch(Ni(r));const p=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return p.then(h=>{this.dispatch(i(h))}).catch(()=>{this.dispatch(i(n)),this.dispatch(Wi(r.uuid))}),[c,p]}bulkUpdate(e,i){const{updateMany:a}=this.actions,{selectByIds:n}=this.selectors,c=l.toUuidArray(e);if(new Set(c).size!==e.length)throw new Error("payloads contains duplicate uuids.");const d=this.select(n(c));if(c.length!=d.length)throw new Error(`Attempting to bulk update ${c.length-d.length} issues that dont exist in the store`);const r=d.toSorted((S,O)=>l.uuidSortFn(S.uuid,O.uuid)),p=e.toSorted((S,O)=>l.uuidSortFn(S.uuid,O.uuid)),h=[];for(let S=0;S<c.length;S++)h.push({...r[S],...p[S]});this.dispatch(a(h));const f=l.chunkArray(e,Math.min(i??e.length,q)),A=[];let T=null;for(const S of f){const O=at.v4(),_=l.toUuidArray(S),F=S.map(({status:R})=>R).filter(Boolean),w=S.map(({priority:R})=>R).filter(Boolean),V=this.enqueueRequest({description:m(o.PATCH,this.name,!0),method:o.PATCH,url:`${this.url}/bulk/`,payload:{payloads:S},blockers:(T?[T]:[]).concat(_).concat(F).concat(w),blocks:[O].concat(_)});A.push(V),T=O}return Promise.all(A).then(S=>{this.dispatch(a(S.flat()))}).catch(()=>{this.dispatch(a(d))}),[h,A]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`No issue with uuid ${e} found in the store`);const d=this.select(Qo(e)),r=this.select(oh(e)),p=this.select(Cm(e)),h=this.select(Oo(e));this.dispatch(i(e)),this.dispatch(yi(l.toUuidArray(r))),this.dispatch(Yi(l.toUuidArray(p))),this.dispatch(mt(l.toUuidArray(d))),this.dispatch(ct(l.toUuidArray(h)));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(f){throw this.dispatch(a(c)),this.dispatch(pi(r)),this.dispatch(Ki(p)),this.dispatch(yt(d)),this.dispatch(nt(h)),f}}async bulkDelete(e){const{addMany:i,deleteMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e)),d=this.select(Jo(e)),r=this.select(Po(e));this.dispatch(a(e)),this.dispatch(mt(l.toUuidArray(d))),this.dispatch(ct(l.toUuidArray(r)));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(p){throw this.dispatch(i(c)),this.dispatch(yt(d)),this.dispatch(nt(r)),p}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}class uM extends v{name="Issue Type Attachment";url="/issue-type-attachments";actions={addOne:ip,addMany:ap,setOne:np,setMany:cp,updateOne:rp,updateMany:dp,deleteOne:up,deleteMany:lp,initialize:sp};selectors={selectById:hp,selectByIds:pp};getId(e){return e.uuid}getBlockers(e){return[e.issue_type]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue_type:e.issue_type}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue_type:e.issue_type}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{issue_type__organization:e}},i);return this.dispatch(a(n)),n}}class lM extends v{name="Issue Type Fields Attachment";url="/issue-type-fields-attachments";actions={addOne:Sp,addMany:Ap,setOne:Tp,setMany:Ip,updateOne:Op,updateMany:Pp,deleteOne:bp,deleteMany:Fp,initialize:fp};selectors={selectById:gp,selectByIds:Mp};getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){const{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{fields_revision__issue_type__organization:e}},i);return this.dispatch(a(n)),n}}class oM extends M{name="Issue Type Fields";url="/issue-type-fields";actions={addOne:Np,addMany:Kp,setOne:Wp,setMany:Yp,updateOne:Xp,updateMany:Zp,deleteOne:Jp,deleteMany:Qp,initialize:Gp};selectors={selectById:ey,selectByIds:ty};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[r.issue_type],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(h=>{throw this.dispatch(n(r.uuid)),h}),[r,p]}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{issue_type__organization:e}},i);return this.dispatch(a(n)),n}}class hM extends v{name="Issue Type Field Values Attachment";url="/issue-type-field-values-attachments";actions={addOne:ny,addMany:Ei,setOne:cy,setMany:ry,updateOne:dy,updateMany:uy,deleteOne:ly,deleteMany:vi,initialize:ay};selectors={selectById:hy,selectByIds:py};getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}async bulkDelete(e){const{deleteMany:i,addMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{field_values__issue__project:e,latest:!0}},i)).flat();return this.dispatch(a(c)),c}}class pM extends M{name="Issue Type Field Values";url="/issue-type-field-values";actions={addOne:vp,addMany:Vp,setOne:Bp,setMany:zp,updateOne:jp,updateMany:Dp,deleteOne:qp,deleteMany:Cp,initialize:Ep};selectors={selectById:Up,selectByIds:kp};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d}),p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[e.issue,e.fields_revision],blocks:[r.uuid]});return this.dispatch(i(r)),p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected IssueTypeFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[c.uuid,c.fields_revision,c.issue],blocks:[c.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const d=this.select(yy(e));this.dispatch(i(e)),this.dispatch(vi(l.toUuidArray(d)));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(c)),this.dispatch(Ei(d)),r}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{issue__project:e,latest:!0}},i)).flat();return this.dispatch(a(c)),c}}class yM extends M{name="Issue Type Identifier";url="/issue-type-identifiers";actions={addOne:Ay,addMany:Ty,setOne:Iy,setMany:Oy,updateOne:Py,updateMany:by,deleteOne:Fy,deleteMany:_y,initialize:Sy};selectors={selectById:My,selectByIds:Ry};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[r.issue_type],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected issue type identifier with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected issue type identifier with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{issue_type__organization:e}},i);return this.dispatch(a(n)),n}}class mM extends M{name="Issue Type Identifier Value";url="/issue-type-identifier-values";actions={addOne:Vy,addMany:By,setOne:zy,setMany:jy,updateOne:Dy,updateMany:qy,deleteOne:Cy,deleteMany:$y,initialize:vy};selectors={selectById:ky,selectByIds:Ly};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[e.issue,e.issue_type_identifier],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected issue type identifier value with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{issue__project:e,latest:!0}},i)).flat();return this.dispatch(a(c)),c}}class fM extends M{name="Issue Type Priority";url="/issue-type-priorities";actions={addOne:Ky,addMany:Wy,setOne:Yy,setMany:Xy,updateOne:Zy,updateMany:Jy,deleteOne:Qy,deleteMany:xy,initialize:Ny};selectors={selectById:Ci,selectByIds:tm};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[e.issue_type],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected an existing issue type priority with uuid ${e.uuid}`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`No issue type priority with uuid ${e} found in the store`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{issue_type__organization:e}},i);return this.dispatch(a(n)),n}}class SM extends M{name="Issue Type";url="/issue-types";actions={addOne:nm,addMany:cm,setOne:rm,setMany:dm,updateOne:um,updateMany:lm,deleteOne:om,deleteMany:hm,initialize:am};selectors={selectById:ym,selectByIds:mm};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,submitted_at:d,created_by:c});this.dispatch(i(r));const p=this.enqueueRequest({method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`IssueType with uuid ${e.uuid} does not exist in the store.`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{addOne:i,deleteOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const d=this.select(xh(e));this.dispatch(a(e)),this.dispatch(Pi(l.toUuidArray(d)));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(i(c)),this.dispatch(Oi(d)),r}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{organization:e}},i);return this.dispatch(a(n)),n}}class AM extends M{name="Issue Type Status";url="/issue-type-statuses";actions={addOne:Tm,addMany:Im,setOne:Om,setMany:Pm,updateOne:bm,updateMany:Fm,deleteOne:_m,deleteMany:gm,initialize:Am};selectors={selectById:Hi,selectByIds:Rm};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[e.issue_type],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected an existing issue type status with uuid ${e.uuid}`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`No issue type status with uuid ${e} found in the store`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{issue_type__organization:e}},i);return this.dispatch(a(n)),n}}class TM extends M{name="Issue Update";url="/issue-updates";actions={addOne:Ni,addMany:Ki,setOne:Vm,setMany:Bm,updateOne:zm,updateMany:jm,deleteOne:Wi,deleteMany:Yi,initialize:vm};selectors={selectById:Dm,selectByIds:qm};async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{issue__project:e}},i)).flat();return this.dispatch(a(c)),c}}const IM=1800;function OM(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 PM extends Xb{_getRenewedTokens=async e=>{const i=this.performRequest({method:o.POST,url:this.refreshTokensUrl,payload:{refresh:e},isAuthNeeded:!1,checkAuth:!1});let a;try{a=await i}catch(n){console.error("Could not renew tokens; clearing auth",n),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(Id(!1)),this.clearTokens(),this.dispatch(I()),this.dispatch(I())}async renewTokens(){const e=this.getRefreshToken();if(!e)throw new Error("No refresh token found");console.debug(this.constructor.name,"renewing tokens");try{const i=await this._getRenewedTokens(e);if(!i)return;console.debug("Got renewed tokens"),this.setTokens(i)}catch(i){throw console.error("Could not renew tokens; clearing auth",i),this.clearAuth(),i}}tokenIsExpiringSoon(){const e=this.getAccessToken();if(!e)return!1;const i=Date.now()/1e3;let a;try{a=lF(e).exp??i}catch{a=i}return a-i<IM}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 z&&this.clearAuth(),e instanceof Error?Promise.reject(e):Promise.reject(new Error((e??Tt).toString()))}}}async handleUnauthorized(e,i){if(e.url.endsWith("/token/refresh/"))throw this.select(a=>a.authReducer.isLoggedIn)&&console.warn("No signed-in user to sign out."),this.clearAuth(),new z({message:"You have been signed out due to inactivity.",response:i,discard:!0});if(this.select(a=>a.authReducer.isLoggedIn))await this.renewTokens();else throw console.debug("Forbidden; user is not logged in."),new z({message:"Incorrect username or password.",response:i,discard:!0})}async initAuth(e){const i=at.v4();return console.debug(this.constructor.name,"Initiating auth"),this.performRequest({uuid:i,method:o.POST,url:this.initTokensUrl,payload:e,isAuthNeeded:!1,checkAuth:!1}).then(a=>{this.setTokens(OM(a))})}}class bM extends ot{name="Organization Access";url="/organization-accesses";actions={addOne:xm,addMany:ef,setOne:tf,setMany:sf,updateOne:af,updateMany:nf,deleteOne:cf,deleteMany:rf,initialize:Qm};selectors={selectById:uf,selectByIds:lf};update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid)),c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(r=>{throw this.dispatch(i(n)),r}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e)),d=this.select(Xt(c.user));this.dispatch(i(c.uuid)),this.dispatch(xi(c.user));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${c.uuid}/`,blockers:[c.uuid],blocks:[]})}catch(r){throw this.dispatch(a(c)),this.dispatch(Qi(d)),r}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{organization:e}},i);return this.dispatch(a(n)),n}}class FM extends ot{name="Organization";url="/organizations";actions={addOne:Sf,addMany:ff,setOne:mf,setMany:yf,updateOne:Tf,updateMany:Af,deleteOne:If,deleteMany:Of,initialize:pf};selectors={selectById:Ff,selectByIds:_f};async add(e){const{addOne:i}=this.actions,a=await this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:e,blockers:[],blocks:[]});return this.dispatch(i(a)),a}async update(e){const{updateOne:i}=this.actions,a=await this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return this.dispatch(i(a)),a}async invite(e,i){return this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/${e}/invite/${i}/`,blockers:[],blocks:[]})}async refreshStore(e){const{initialize:i}=this.actions,a=await this.list({},e);return this.dispatch(i(a)),a}}class _M extends M{name="Project Access";url="/project-accesses";actions={addOne:jf,addMany:Df,setOne:qf,setMany:Cf,updateOne:$f,updateMany:Uf,deleteOne:kf,deleteMany:Lf,initialize:zf};selectors={selectById:Gf,selectByIds:Nf};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null)});this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(c),blockers:[c.organization_access,c.project],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(r=>{throw this.dispatch(n(c.uuid)),r}),[c,d]}bulkAdd(e){const{addMany:i,deleteMany:a,updateMany:n}=this.actions,c=this.select(p=>p.userReducer.currentUser?.id??null),d=e.map(p=>l.uuidObj({...p,created_by:c}));this.dispatch(i(d));const r=this.enqueueRequest({description:m(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{project_accesses:d.map(p=>g(p))},blockers:d.flatMap(p=>[p.project,p.organization_access]),blocks:d.map(p=>p.uuid)});return r.then(p=>{this.dispatch(n(p))}).catch(p=>{throw this.dispatch(a(d.map(h=>h.uuid))),p}),[d,r]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid)),c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[]});return d.then(r=>{this.dispatch(i(r))}).catch(r=>{throw this.dispatch(i(n)),r}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{project__organization:e}},i);return this.dispatch(a(n)),n}}class gM extends v{name="Project Attachment";url="/project-attachments";actions={addOne:Yf,addMany:Xf,setOne:Zf,setMany:Jf,updateOne:Qf,updateMany:xf,deleteOne:eS,deleteMany:tS,initialize:Wf};selectors={selectById:iS,selectByIds:aS};getId(e){return e.uuid}getBlockers(e){return[e.project]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,project:e.project}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,project:e.project}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{project__organization:e}},i);return this.dispatch(a(n)),n}}class MM extends M{name="Project Comment";url="/project-comments";actions={addOne:dS,addMany:uS,setOne:lS,setMany:oS,updateOne:hS,updateMany:pS,deleteOne:yS,deleteMany:mS,initialize:rS};selectors={selectById:SS,selectByIds:AS};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(c),blockers:[c.project],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Project comment with uuid ${e.uuid} not found in store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Project comment with uuid ${e} not found in store`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}class RM extends v{name="Project File";url="/project-files";actions={addOne:FS,addMany:_S,setOne:PS,setMany:bS,updateOne:gS,updateMany:MS,deleteOne:RS,deleteMany:wS,initialize:OS};selectors={selectById:VS,selectByIds:BS};getId(e){return e.uuid}getBlockers(e){return[e.project]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_sha1:e.file_sha1,file_name:e.file_name,file_extension:e.file_extension,project:e.project,z_index:e.z_index,bounds:e.bounds}}buildBulkPayload(e){return{uuid:e.uuid,file_sha1:e.file_sha1,file_name:e.file_name,file_extension:e.file_extension,project:e.project,z_index:e.z_index,bounds:e.bounds}}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`${this.name} with uuid ${e.uuid} does not exist in the store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}class wM extends ot{name="Project";url="/projects";actions={addOne:US,addMany:$S,setOne:CS,setMany:qS,updateOne:LS,updateMany:kS,deleteOne:HS,deleteMany:GS,initialize:DS};selectors={selectById:WS,selectByIds:YS};async add(e){const{addOne:i}=this.actions,a=await this.performRequest({method:o.POST,url:`${this.url}/`,payload:g(e)});return this.dispatch(i(a)),a}async update(e){const{updateOne:i}=this.actions,a=await this.performRequest({method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:g(e)});return this.dispatch(i(a)),a}async delete(e){const{deleteOne:i}=this.actions,a=await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return this.dispatch(i(e)),a}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{organization:e}},i);return this.dispatch(a(n)),n}}class EM extends M{name="Procedure";url="/procedures";actions={addOne:oA,addMany:St,setOne:hA,setMany:pA,updateOne:yA,updateMany:mA,deleteOne:fA,deleteMany:At,initialize:lA};selectors={selectById:TA,selectByIds:IA};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(c),blockers:[c.procedure_type,c.project,c.asset,...c.procedure_initiative?[c.procedure_initiative]:[]],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}bulkAdd(e,i){const{store:a}=this.client,{addMany:n,updateMany:c,deleteMany:d}=this.actions,r=new Date().toISOString(),p=a.getState().userReducer.currentUser?.id??null,h=[],f=l.chunkArray(e,Math.min(i??e.length,q)),A=[];for(const S of f){const O=[],_=[],F=[];for(const V of S){const R=l.uuidObj({...V,submitted_at:r,created_by:p});h.push(R),O.push(g(R)),_.push(R.procedure_type,R.project,R.asset,...R.procedure_initiative?[R.procedure_initiative]:[]),F.push(R.uuid)}const w={payload:{submitted_at:r,payloads:O},blockers:_,blocks:F};A.push(w)}this.dispatch(n(h));const T=A.map(S=>{const{payload:O,blocks:_,blockers:F}=S;return this.enqueueRequest({description:m(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:O,blockers:F,blocks:_})});return Promise.all(T).then(S=>{this.dispatch(c(S.flat()))}).catch(()=>{this.dispatch(d(l.toUuidArray(h)))}),[h,Promise.all(T).then(S=>S.flat())]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected procedure with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected procedure with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async bulkDelete(e){const{addMany:i,deleteMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e));this.dispatch(a(l.toUuidArray(c)));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(i(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}class vM extends M{name="Procedure Step Assignee";url="/procedure-step-assignees";actions={addOne:MA,addMany:RA,setOne:wA,setMany:EA,updateOne:vA,updateMany:VA,deleteOne:BA,deleteMany:zA,initialize:gA};selectors={selectById:DA,selectByIds:qA};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(c),blockers:[c.procedure,c.procedure_step],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}bulkAdd(e){const{addMany:i,updateMany:a,deleteMany:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=e.map(h=>l.uuidObj({...h,created_by:c,submitted_at:d}));this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{procedure_step_assignees:r.map(h=>g(h)),submitted_at:d},blockers:r.flatMap(h=>[h.procedure,h.procedure_step]),blocks:l.toUuidArray(r)});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(l.toUuidArray(r)))}),[r,p]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected procedure step assignee with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async bulkDelete(e){const{deleteMany:i,addMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{procedure__project:e}},i)).flat();return this.dispatch(a(c)),c}}class VM extends M{name="Procedure Step Comment";url="/procedure-step-comments";actions={addOne:kA,addMany:LA,setOne:HA,setMany:GA,updateOne:NA,updateMany:KA,deleteOne:WA,deleteMany:YA,initialize:UA};selectors={selectById:ZA,selectByIds:JA};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(c),blockers:[c.procedure,c.procedure_step],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Procedure step comment with uuid ${e.uuid} not found in store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Procedure step comment with uuid ${e} not found in store`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{procedure__project:e}},i)).flat();return this.dispatch(a(c)),c}}class BM extends M{name="Procedure Step Default Assignee";url="/procedure-step-default-assignees";actions={addOne:tT,addMany:sT,setOne:iT,setMany:aT,updateOne:nT,updateMany:cT,deleteOne:rT,deleteMany:dT,initialize:eT};selectors={selectById:lT,selectByIds:oT};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(c),blockers:[c.procedure_step],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected procedure step default assignee with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{procedure_step__procedure_type__organization:e}},i);return this.dispatch(a(n)),n}}class zM extends M{name="Procedure Step Default Reviewer";url="/procedure-step-default-reviewers";actions={addOne:mT,addMany:fT,setOne:ST,setMany:AT,updateOne:TT,updateMany:IT,deleteOne:OT,deleteMany:PT,initialize:yT};selectors={selectById:FT,selectByIds:_T};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(c),blockers:[c.procedure_step],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected procedure step default reviewer with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{procedure_step__procedure_type__organization:e}},i);return this.dispatch(a(n)),n}}class jM extends ot{name="Procedure Step Event";url="/procedure-step-events";actions={addOne:wT,addMany:ET,setOne:vT,setMany:VT,updateOne:BT,updateMany:zT,deleteOne:jT,deleteMany:DT,initialize:RT};selectors={selectById:CT,selectByIds:$T};async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{procedure__project:e}},i)).flat();return this.dispatch(a(c)),c}}class DM extends v{name="Procedure Step Fields Attachment";url="/procedure-step-fields-attachments";actions={addOne:HT,addMany:Oa,setOne:GT,setMany:NT,updateOne:KT,updateMany:WT,deleteOne:YT,deleteMany:Pa,initialize:LT};selectors={selectById:JT,selectByIds:QT};getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){return l.uuidObj({...e,created_by:this.select(i=>i.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()})}buildPayload(e){const{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{fields_revision__procedure_step__procedure_type__organization:e}},i);return this.dispatch(a(n)),n}}class qM extends M{name="Procedure Step Fields";url="/procedure-step-fields";actions={addOne:sI,addMany:iI,setOne:aI,setMany:nI,updateOne:cI,updateMany:rI,deleteOne:dI,deleteMany:uI,initialize:tI};selectors={selectById:lI,selectByIds:oI};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(c),blockers:[c.procedure_step],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected procedure step fields with uuid ${e} to exist`);const d=this.select(ZT(e));this.dispatch(i(e)),this.dispatch(Pa(l.toUuidArray(d)));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(c)),this.dispatch(Oa(d)),r}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{procedure_step__procedure_type__organization:e}},i);return this.dispatch(a(n)),n}}class CM extends v{name="Procedure Step Field Values Attachment";url="/procedure-step-field-values-attachments";actions={addOne:mI,addMany:Ma,setOne:fI,setMany:SI,updateOne:AI,updateMany:TI,deleteOne:II,deleteMany:Ra,initialize:yI};selectors={selectById:PI,selectByIds:bI};getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}async bulkDelete(e){const{deleteMany:i,addMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{field_values__procedure__project:e,latest:!0}},i)).flat();return this.dispatch(a(c)),c}}class $M extends M{name="Procedure Step Field Values Review";url="/procedure-step-field-values-reviews";actions={addOne:LI,addMany:Va,setOne:HI,setMany:GI,updateOne:NI,updateMany:KI,deleteOne:WI,deleteMany:Ba,initialize:kI};selectors={selectById:XI,selectByIds:ZI};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(c),blockers:[c.field_values],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Procedure step field values review with uuid ${e.uuid} not found in store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Procedure step field values review with uuid ${e} not found in store`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{field_values__procedure__project:e}},i)).flat();return this.dispatch(a(c)),c}}class UM extends M{name="Procedure Step Field Values";url="/procedure-step-field-values";actions={addOne:RI,addMany:wI,setOne:EI,setMany:vI,updateOne:VI,updateMany:BI,deleteOne:zI,deleteMany:jI,initialize:MI};selectors={selectById:CI,selectByIds:$I};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d}),p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[e.procedure,e.procedure_step,e.fields_revision],blocks:[r.uuid]});return this.dispatch(i(r)),p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}bulkAdd(e,i){const{addMany:a,updateMany:n,deleteMany:c}=this.actions,d=new Date().toISOString(),r=this.select(T=>T.userReducer.currentUser?.id??null),p=[],h=l.chunkArray(e,Math.min(i??e.length,q)),f=[];for(const T of h){const S=[],O=[],_=[];for(const F of T){const w=l.uuidObj({...F,values:F.values,created_by:r,submitted_at:d});p.push(w),S.push(g(w)),O.push(w.procedure_step,w.procedure,w.fields_revision),_.push(w.uuid)}f.push({payload:{payloads:S,submitted_at:d},blockers:O,blocks:_})}this.dispatch(a(p));const A=f.map(T=>{const{payload:S,blocks:O,blockers:_}=T;return this.enqueueRequest({description:m(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:S,blockers:_,blocks:O})});return Promise.all(A).then(T=>{this.dispatch(n(T.flat()))}).catch(()=>{this.dispatch(c(l.toUuidArray(p)))}),[p,Promise.all(A).then(T=>T.flat())]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected ProcedureStepFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[c.uuid,c.procedure,c.procedure_step,c.fields_revision],blocks:[c.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected ProcedureStepFieldValues with uuid ${e} to exist`);const d=this.select(FI(e)),r=this.select(JI(e));this.dispatch(i(e)),this.dispatch(Ra(l.toUuidArray(d))),this.dispatch(Ba(l.toUuidArray(r)));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(a(c)),this.dispatch(Ma(d)),this.dispatch(Va(r)),p}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{procedure__project:e}},i)).flat();return this.dispatch(a(c)),c}}class kM extends M{name="Procedure Step Reviewer";url="/procedure-step-reviewers";actions={addOne:tO,addMany:sO,setOne:iO,setMany:aO,updateOne:nO,updateMany:cO,deleteOne:rO,deleteMany:dO,initialize:eO};selectors={selectById:lO,selectByIds:oO};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(c),blockers:[c.procedure,c.procedure_step],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}bulkAdd(e){const{addMany:i,updateMany:a,deleteMany:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=e.map(h=>l.uuidObj({...h,created_by:c,submitted_at:d}));this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{procedure_step_reviewers:r.map(h=>g(h)),submitted_at:d},blockers:r.flatMap(h=>[h.procedure,h.procedure_step]),blocks:r.map(h=>h.uuid)});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(l.toUuidArray(r)))}),[r,p]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected procedure step reviewer with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async bulkDelete(e){const{deleteMany:i,addMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{procedure__project:e}},i)).flat();return this.dispatch(a(c)),c}}class LM extends M{name="Procedure Initiative";url="/procedure-initiatives";actions={addOne:JS,addMany:QS,setOne:xS,setMany:eA,updateOne:tA,updateMany:sA,deleteOne:iA,deleteMany:aA,initialize:ZS};selectors={selectById:rA,selectByIds:dA};add(e){const{store:i}=this.client,{addOne:a,updateOne:n,deleteOne:c}=this.actions,d=l.uuidObj({...e,created_by:i.getState().userReducer.currentUser?.id??null,submitted_at:new Date().toISOString()});this.dispatch(a(d));const r=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(d),blockers:[d.procedure_type,d.project],blocks:[d.uuid]});return r.then(p=>{this.dispatch(n(p))}).catch(()=>{this.dispatch(c(d.uuid))}),[d,r]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected ${this.name} with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected ${this.name} with uuid ${e} to exist`);const d=this.select(FA(e));this.dispatch(i(e)),this.dispatch(At(l.toUuidArray(d)));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(c)),this.dispatch(St(d)),r}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}class HM extends M{name="Procedure Step";url="/procedure-steps";actions={addOne:SO,addMany:AO,setOne:mO,setMany:fO,updateOne:TO,updateMany:IO,deleteOne:OO,deleteMany:PO,initialize:yO};selectors={selectById:FO,selectByIds:_O};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(c),blockers:[c.procedure_type],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`No procedure step with uuid ${e.uuid} found in the store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${n.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{addOne:i,deleteOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`No procedure step with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(i(c)),d}}bulkUpdate(e,i){const{updateMany:a}=this.actions,{selectByIds:n}=this.selectors,c=l.toUuidArray(e);if(new Set(c).size!==e.length)throw new Error("payloads contains duplicate uuids.");const d=this.select(n(c));if(c.length!=d.length)throw new Error(`Attempting to bulk update ${c.length-d.length} ${this.name} that dont exist in the store`);const r=d.toSorted((S,O)=>l.uuidSortFn(S.uuid,O.uuid)),p=e.toSorted((S,O)=>l.uuidSortFn(S.uuid,O.uuid)),h=[];for(let S=0;S<c.length;S++)h.push({...r[S],...p[S]});this.dispatch(a(h));const f=l.chunkArray(e,Math.min(i??e.length,q)),A=[];let T=null;for(const S of f){const O=at.v4(),_=l.toUuidArray(S),F=this.enqueueRequest({description:m(o.PATCH,this.name,!0),method:o.PATCH,url:`${this.url}/bulk/`,payload:{payloads:S},blockers:(T?[T]:[]).concat(_),blocks:[O].concat(_)});A.push(F),T=O}return Promise.all(A).then(S=>{this.dispatch(a(S.flat()))}).catch(()=>{this.dispatch(a(d))}),[h,A]}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{procedure_type__organization:e}},i);return this.dispatch(a(n)),n}}class GM extends v{name="Procedure Type Attachment";url="/procedure-type-attachments";actions={addOne:RO,addMany:wO,setOne:EO,setMany:vO,updateOne:VO,updateMany:BO,deleteOne:zO,deleteMany:jO,initialize:MO};selectors={selectById:CO,selectByIds:$O};getId(e){return e.uuid}getBlockers(e){return[e.procedure_type]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,procedure_type:e.procedure_type}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,procedure_type:e.procedure_type}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{procedure_type__organization:e}},i);return this.dispatch(a(n)),n}}class NM extends v{name="Procedure Type Fields Attachment";url="/procedure-type-fields-attachments";actions={addOne:LO,addMany:HO,setOne:GO,setMany:NO,updateOne:KO,updateMany:WO,deleteOne:YO,deleteMany:XO,initialize:kO};selectors={selectById:QO,selectByIds:xO};getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){const{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{fields_revision__procedure_type__organization:e}},i);return this.dispatch(a(n)),n}}class KM extends M{name="Procedure Type Fields";url="/procedure-type-fields";actions={addOne:sP,addMany:iP,setOne:aP,setMany:nP,updateOne:cP,updateMany:rP,deleteOne:dP,deleteMany:uP,initialize:tP};selectors={selectById:hP,selectByIds:pP};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[r.procedure_type],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(h=>{throw this.dispatch(n(r.uuid)),h}),[r,p]}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{procedure_type__organization:e}},i);return this.dispatch(a(n)),n}}class WM extends v{name="Procedure Field Values Attachment";url="/procedure-field-values-attachments";actions={addOne:fP,addMany:Ga,setOne:SP,setMany:AP,updateOne:TP,updateMany:IP,deleteOne:OP,deleteMany:Na,initialize:mP};selectors={selectById:FP,selectByIds:_P};getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}async bulkDelete(e){const{deleteMany:i,addMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{field_values__procedure__project:e,latest:!0}},i)).flat();return this.dispatch(a(c)),c}}class YM extends M{name="Procedure Field Values";url="/procedure-field-values";actions={addOne:wP,addMany:EP,setOne:vP,setMany:VP,updateOne:BP,updateMany:zP,deleteOne:jP,deleteMany:DP,initialize:RP};selectors={selectById:$P,selectByIds:UP};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d}),p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[e.fields_revision,e.procedure],blocks:[r.uuid]});return this.dispatch(i(r)),p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}bulkAdd(e,i){const{addMany:a,updateMany:n,deleteMany:c}=this.actions,d=new Date().toISOString(),r=this.select(T=>T.userReducer.currentUser?.id??null),p=[],h=l.chunkArray(e,Math.min(i??e.length,q)),f=[];for(const T of h){const S=[],O=[],_=[];for(const F of T){const w=l.uuidObj({...F,values:F.values,created_by:r,submitted_at:d});p.push(w),S.push(g(w)),O.push(w.procedure,w.fields_revision),_.push(w.uuid)}f.push({payload:{payloads:S,submitted_at:d},blockers:O,blocks:_})}this.dispatch(a(p));const A=f.map(T=>{const{payload:S,blocks:O,blockers:_}=T;return this.enqueueRequest({description:m(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:S,blockers:_,blocks:O})});return Promise.all(A).then(T=>{this.dispatch(n(T.flat()))}).catch(()=>{this.dispatch(c(l.toUuidArray(p)))}),[p,Promise.all(A).then(T=>T.flat())]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected ProcedureFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[c.fields_revision,c.procedure],blocks:[c.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const d=this.select(gP(e));this.dispatch(i(e)),this.dispatch(Na(l.toUuidArray(d)));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(c)),this.dispatch(Ga(d)),r}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{procedure__project:e,latest:!0}},i)).flat();return this.dispatch(a(c)),c}}class XM extends M{name="Procedure Type";url="/procedure-types";actions={addOne:HP,addMany:GP,setOne:NP,setMany:KP,updateOne:WP,updateMany:YP,deleteOne:XP,deleteMany:ZP,initialize:LP};selectors={selectById:xP,selectByIds:eb};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(c),blockers:[],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected procedure type with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected procedure type with uuid ${e} to exist`);const d=this.select(OA(e));this.dispatch(i(e)),this.dispatch(At(l.toUuidArray(d)));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(c)),this.dispatch(St(d)),r}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{organization:e}},i);return this.dispatch(a(n)),n}}class ZM extends M{name="Team Membership";url="/team-memberships";actions={addOne:ab,addMany:nb,setOne:cb,setMany:rb,updateOne:db,updateMany:ub,deleteOne:lb,deleteMany:ob,initialize:ib};selectors={selectById:yb,selectByIds:mb};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null)});this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(c),blockers:[e.team],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}bulkAdd(e){const{addMany:i,updateMany:a,deleteMany:n}=this.actions,c=this.select(p=>p.userReducer.currentUser?.id??null),d=e.map(p=>l.uuidObj({...p,created_by:c}));this.dispatch(i(d));const r=this.enqueueRequest({description:m(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{team_memberships:d.map(p=>g(p))},blockers:d.map(p=>p.team),blocks:d.map(p=>p.uuid)});return r.then(p=>{this.dispatch(a(p))}).catch(()=>{this.dispatch(n(d.map(p=>p.uuid)))}),[d,r]}async delete(e){const{addOne:i,deleteOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected team membership with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(d){throw this.dispatch(i(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{team__organization:e}},i);return this.dispatch(a(n)),n}}class JM extends M{name="Team";url="/teams";actions={addOne:Ab,addMany:Tb,setOne:Ib,setMany:Ob,updateOne:Pb,updateMany:bb,deleteOne:Fb,deleteMany:_b,initialize:Sb};selectors={selectById:Mb,selectByIds:Rb};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,submitted_at:new Date().toISOString(),created_by:this.select(r=>r.userReducer.currentUser?.id??null)});this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(c),blockers:[],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected team with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:g(e),blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{addOne:i,deleteOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(d){throw this.dispatch(i(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{organization:e}},i);return this.dispatch(a(n)),n}}class QM extends ot{name="User";url="/user";actions={addOne:Qi,addMany:Gm,setOne:Hm,setMany:Lm,updateOne:Km,updateMany:Nm,deleteOne:xi,deleteMany:Wm,initialize:km};selectors={selectById:Xt,selectByIds:Zm};async list(e,i){const{organizationUuid:a,...n}=e,c=a?`/organizations/${a}${this.url}s/`:`/${this.url}`;return this.performRequest({method:o.GET,url:c,...n},i)}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({organizationUuid:e},i);return this.dispatch(a(n)),n}}async function cn(t,e,i,a,n){const c=a instanceof lt;c&&e.checkAuth!==!1&&await a.auth.prepareAuth();const d={queryParams:"",isAuthNeeded:!0},{s3url:r,payload:p,headers:h,method:f,queryParams:A,attachmentHash:T,isExternalUrl:S,isAuthNeeded:O,isResponseBlob:_}={...d,...e};let F=e.url;const w=T?await i.files.getFileFromCache(T):void 0,V=w?await Ub(w):void 0;if(T){if(!V)throw new Error(`Cannot upload file ${T} because it's not cached.`);if(V.size===0)throw new Error(`Cannot upload file ${T} because its has a size of 0.`)}!S&&!F.startsWith("http")&&(!F.startsWith("/")&&!F.startsWith("blob:")&&(F="/"+F),F=t+F);const R=B=>{if(T){if(!r)throw new Error(`No S3 URL for file ${T}`);if("warning"in r)throw new Error(`S3 URL warning for file ${T}`);if(!V)throw new Error(`No file for file ${T}`);const C=r.fields["x-amz-checksum-sha1"];if(!C)throw new Error(`No checksum for file ${T}`);return B.set("x-amz-checksum-sha1",C).field({...p,...r.fields}).attach("file",V)}return B.send(p)},vt={[o.GET]:()=>_?pt.get(F.toString()).responseType("blob"):pt.get(F.toString()),[o.POST]:()=>{const B=pt.post(F.toString());return R(B)},[o.PATCH]:()=>{const B=pt.patch(F.toString());return R(B)},[o.PUT]:()=>{const B=pt.put(F.toString());return R(B)},[o.DELETE]:()=>{const B=pt.delete(F.toString());return R(B)}}[f];let j=vt();const as=()=>{console.debug("aborting request:",e.url),j.abort()};n?.addEventListener("abort",as),O&&c&&(j=a.auth.applyAuth(j)),h&&(j=j.set(h));try{return await j.query(A)}catch(B){const C=$b(B),Vt=C?.status;throw c&&C&&a.auth.isAuthFailure(C)?(await a.auth.handleUnauthorized(j,C),new z({response:C,innerError:B,discard:!1})):new z({response:C,innerError:B,discard:sn.includes(Vt)})}finally{n?.removeEventListener("abort",as)}}class xM{store;constructor(e){this.store=e}_performRequest(e,i,a,n){const c=new l.DeferredPromise,d={...i,uuid:i.uuid??at.v4()};return cn(e,d,this,a,n).then(r=>{c.resolve(r.body)}).catch(r=>{r instanceof Error?c.reject(r):c.reject(new Error((r??Tt).toString()))}),c}async performRequest(e,i,a,n){return this._performRequest(e,i,a,n).then(c=>{if(c instanceof z)throw c;return c})}async enqueueRequest(e,i,a){return this._enqueueRequest(e,i,a).then(n=>{if(n instanceof z)throw n;return n})}_enqueueRequest(e,i,a){const n=new l.DeferredPromise,c={...e,BASE_URL:i,serviceName:a},d=this.store.dispatch(wf(c)),r=h=>{if(h)n.resolve(h.body);else{const f=new z({message:"Could not get a response from the server.",response:h,discard:!0});n.reject(f)}},p=h=>{h instanceof z?h.options.discard=!0:(console.error("Received an unexpected error while processing a request:",h,`
14
- Converting error to APIError and discarding.`),h=new z({message:"An error occurred while processing the request.",innerError:h,discard:!0})),n.reject(h)};return d.then(r,p),n}async performPagination(e,i,a,n,c){const d={...i,queryParams:{...i.queryParams,paginate:!0,limit:a}},{method:r}=d,p=[];let h=await this.performRequest(e,d,n,c);for(p.push(h.results);h.next;)h=await this.performRequest(e,{url:h.next,method:r},n,c),p.push(h.results);return p}}class It{graph;requestAttemptCounter;constructor(){this.graph=new oF.DepGraph,this.requestAttemptCounter={}}static _fromOutbox(e){const i=new It;for(let a=0;a<e.length;a++){const n=e[a];if(!n){console.error("Outbox item was undefined");continue}i.sneakRequest(n);for(let c=0;c<a;c++){const d=e[c];if(!d){console.error("Previous outbox item was undefined");continue}d.payload.uuid!==n.payload.uuid&&d.payload.blocks.some(r=>n.payload.blockers.includes(r))&&It._addDependency(n.payload.uuid,d.payload.uuid,i.graph)}}return i}_addDependency(e,i){It._addDependency(e,i,this.graph)}static _addDependency(e,i,a){if(e===i)throw new Error(`Tried to add dependency from node to itself: ${e}`);if(!a.hasNode(e))throw new Error(`Tried to add dependency from non-existent node: ${e} (to node: ${i})`);if(!a.hasNode(i))throw new Error(`Tried to add dependency to non-existent node: ${i} (from node: ${e})`);a.addDependency(e,i)}addRequest(e){if(this.graph.addNode(e.payload.uuid,e),!(e.payload.blockers.length===0||this.graph.size()===1))for(const i of this.graph.overallOrder()){if(i===e.payload.uuid)continue;const a=this.graph.getNodeData(i),n=new Set(a.payload.blocks);e.payload.blockers.some(c=>n.has(c))&&this._addDependency(e.payload.uuid,i)}}insertRequest(e){this.graph.addNode(e.payload.uuid,e);for(const i of this.graph.overallOrder()){if(i===e.payload.uuid)continue;const a=this.graph.getNodeData(i),n=new Set(e.payload.blocks);a.payload.blockers.some(c=>n.has(c))&&this._addDependency(i,e.payload.uuid)}}sneakRequest(e){this.graph.addNode(e.payload.uuid,e)}_getNextNode(){const e=this.graph.overallOrder(!0);let i=1/0,a;for(const n of e){const c=this.requestAttemptCounter[n]||0;c<i&&(i=c,a=n)}return a}peek(){const e=this._getNextNode();if(e)return this.graph.getNodeData(e)}remove(e){this.graph.removeNode(e),delete this.requestAttemptCounter[e]}pop(){const e=this.peek();return e&&this.graph.removeNode(e.payload.uuid),e}getQueue(){const e=this.graph.overallOrder().map(a=>this.graph.getNodeData(a)),i=this._getNextNode();if(i){const a=this.graph.getNodeData(i),n=e.findIndex(c=>c.payload.uuid===a.payload.uuid);n!==-1&&(e.splice(n,1),e.unshift(a))}return e}getReady(){let e=this.graph.overallOrder(!0).map(i=>this.graph.getNodeData(i));return e=e.sort((i,a)=>i.meta.offline.effect.timestamp.localeCompare(a.meta.offline.effect.timestamp)),e=e.sort((i,a)=>{const n=this.requestAttemptCounter[i.payload.uuid]||0,c=this.requestAttemptCounter[a.payload.uuid]||0;return n-c}),e}registerRetry(e){this.requestAttemptCounter[e]=(this.requestAttemptCounter[e]||0)+1}}let Zb;function Jb(t){Zb=t}function Ot(){return Zb}let Qb;function xb(t){Qb=t}function eF(){return Qb}let rn=null;function ht(){const t=Ot();if(!t)return console.warn("Client store not set; cannot get outbox coordinator yet."),null;if(rn)return rn;const e=t.getState().offline.outbox,i=It._fromOutbox(e);return rn=i,i}const eR=(t,e)=>{const i=new e(t);return xb(i),Jb(t),i};class tR{_all;_previous;constructor(e){this._all=[e],this._previous=e,this.then=this.then.bind(this),this.compile=this.compile.bind(this)}then(e){return this._previous&&(this._previous.next=e),this._all.push(e),this._previous=e,{then:this.then,compile:this.compile}}compile(){return this._all}}class dn{next;constructor(){this.next=null}then(e){return new tR(this).then(e)}async run(e){if(this.next)return this.next.run(e);{if(console.debug("Middleware finished. Performing request:",e.payload.url),!Ot())throw new Error("Client store not set");const a=eF();if(!a)throw new Error("Client SDK not set");return Db(e,a)}}}class tF extends dn{async run(e){return super.run(e)}}class sF extends dn{async run(e){return super.run(e)}}const iF=new tF().then(new sF).compile();function aF(t){return iF[0]?.run(t)}s.ALL_MIDDLEWARE=iF,s.APIError=z,s.AgentService=Eg,s.AssetAttachmentService=vg,s.AssetCommentService=Vg,s.AssetService=Bg,s.AssetTypeAttachmentService=zg,s.AssetTypeFieldValuesAttachmentService=qg,s.AssetTypeFieldValuesService=Cg,s.AssetTypeFieldsAttachmentService=jg,s.AssetTypeFieldsService=Dg,s.AssetTypeIdentifierService=$g,s.AssetTypeIdentifierValueService=Ug,s.AssetTypeService=kg,s.AssetTypeStatusService=Lg,s.BaseApiService=lt,s.BaseAuthService=Xb,s.BaseModelApiService=ot,s.BaseOfflineFileModelApiService=v,s.BaseOfflineModelApiService=M,s.BaseSDK=xM,s.COMMON_AUTO_FIELDS=ln,s.DEFAULT_PAGE_SIZE=vb,s.DISCARD_HTTP_STATUSES=sn,s.DocumentAttachmentService=Hg,s.DocumentService=Gg,s.EmailDomainsService=Ng,s.EmailVerificationService=Kg,s.FileService=Wg,s.FormIdentifierService=Yg,s.FormIdentifierValueService=Xg,s.FormRevisionAttachmentService=Zg,s.FormRevisionService=Jg,s.FormService=Qg,s.FormSubmissionFieldValuesAttachmentService=eM,s.FormSubmissionFieldValuesService=tM,s.FormSubmissionService=sM,s.FormSubscriberService=xg,s.GeoImageService=iM,s.HttpMethod=o,s.IssueAssociationService=aM,s.IssueAttachmentService=nM,s.IssueCommentAttachmentService=cM,s.IssueCommentService=rM,s.IssueService=dM,s.IssueTypeAttachmentService=uM,s.IssueTypeFieldValuesAttachmentService=hM,s.IssueTypeFieldValuesService=pM,s.IssueTypeFieldsAttachmentService=lM,s.IssueTypeFieldsService=oM,s.IssueTypeIdentifierService=yM,s.IssueTypeIdentifierValueService=mM,s.IssueTypePriorityService=fM,s.IssueTypeService=SM,s.IssueTypeStatusService=AM,s.IssueUpdateService=TM,s.JWTService=PM,s.MAX_SERVICE_BATCH_SIZE=q,s.OUTBOX_RETRY_DELAY=6e4,s.OfflineAnalyticsMiddleware=tF,s.OfflineMiddleware=dn,s.OrganizationAccessService=bM,s.OrganizationService=FM,s.OutboxCoordinator=It,s.ProcdureInitiativeService=LM,s.ProcedureFieldValuesAttachmentService=WM,s.ProcedureFieldValuesService=YM,s.ProcedureService=EM,s.ProcedureStepAssigneeService=vM,s.ProcedureStepCommentService=VM,s.ProcedureStepDefaultAssigneeService=BM,s.ProcedureStepDefaultReviewerService=zM,s.ProcedureStepEventService=jM,s.ProcedureStepFieldValuesAttachmentService=CM,s.ProcedureStepFieldValuesReviewService=$M,s.ProcedureStepFieldValuesService=UM,s.ProcedureStepFieldsAttachmentService=DM,s.ProcedureStepFieldsService=qM,s.ProcedureStepReviewerService=kM,s.ProcedureStepService=HM,s.ProcedureTypeAttachmentService=GM,s.ProcedureTypeFieldsAttachmentService=NM,s.ProcedureTypeFieldsService=KM,s.ProcedureTypeService=XM,s.ProjectAccessService=_M,s.ProjectAttachmentService=gM,s.ProjectCommentService=MM,s.ProjectFileService=RM,s.ProjectService=wM,s.RESET_ORGANIZATION_STATE=b,s.RESET_PROJECT_STATE=E,s.RESET_STATE=I,s.RateLimitingMiddleware=sF,s.SelectorBuilder=yF,s.TeamMembershipService=ZM,s.TeamService=JM,s.UNKNOWN_ERROR_MESSAGE=Tt,s.UserService=QM,s._setLatestRetryTime=vf,s.addAsset=Kn,s.addAssetAttachment=Tn,s.addAssetAttachments=ds,s.addAssetComment=Vn,s.addAssetComments=Bt,s.addAssetType=Xr,s.addAssetTypeAttachment=nc,s.addAssetTypeAttachments=fs,s.addAssetTypeFieldValues=nr,s.addAssetTypeFieldValuesAttachment=Kc,s.addAssetTypeFieldValuesAttachments=bs,s.addAssetTypeFieldValuesMany=cr,s.addAssetTypeFields=Vc,s.addAssetTypeFieldsAttachment=Ac,s.addAssetTypeFieldsAttachments=Tc,s.addAssetTypeFieldsMany=Bc,s.addAssetTypeIdentifier=Tr,s.addAssetTypeIdentifierValue=Br,s.addAssetTypeIdentifierValues=zr,s.addAssetTypeIdentifiers=Ir,s.addAssetTypeStatus=rd,s.addAssetTypeStatuses=dd,s.addAssetTypes=Zr,s.addAssets=ps,s.addConversation=pn,s.addConversations=mF,s.addDocument=Cd,s.addDocumentAttachment=Fd,s.addDocumentAttachments=_d,s.addDocuments=$d,s.addEmailDomain=Qd,s.addEmailDomains=xd,s.addForm=gl,s.addFormIdentifier=hu,s.addFormIdentifierValue=gu,s.addFormIdentifierValues=Mu,s.addFormIdentifiers=pu,s.addFormRevision=el,s.addFormRevisionAttachment=Uu,s.addFormRevisionAttachments=ku,s.addFormRevisions=Ns,s.addFormSubmission=po,s.addFormSubmissionFieldValues=Jl,s.addFormSubmissionFieldValuesAttachment=Ul,s.addFormSubmissionFieldValuesAttachments=xs,s.addFormSubmissionFieldValuesMany=ni,s.addFormSubmissions=nt,s.addFormSubscriber=pl,s.addFormSubscribers=Ys,s.addForms=Ml,s.addGeoImage=Eo,s.addGeoImages=vo,s.addIssue=Gh,s.addIssueAssociation=Ko,s.addIssueAssociations=yt,s.addIssueAttachment=ah,s.addIssueAttachments=pi,s.addIssueComment=vh,s.addIssueCommentAttachment=Sh,s.addIssueCommentAttachments=Ah,s.addIssueComments=Vh,s.addIssueType=nm,s.addIssueTypeAttachment=ip,s.addIssueTypeAttachments=ap,s.addIssueTypeFieldValues=vp,s.addIssueTypeFieldValuesAttachment=ny,s.addIssueTypeFieldValuesAttachments=Ei,s.addIssueTypeFieldValuesMany=Vp,s.addIssueTypeFields=Np,s.addIssueTypeFieldsAttachment=Sp,s.addIssueTypeFieldsAttachments=Ap,s.addIssueTypeFieldsMany=Kp,s.addIssueTypeIdentifier=Ay,s.addIssueTypeIdentifierValue=Vy,s.addIssueTypeIdentifierValues=By,s.addIssueTypeIdentifiers=Ty,s.addIssueTypePriorities=Wy,s.addIssueTypePriority=Ky,s.addIssueTypeStatus=Tm,s.addIssueTypeStatuses=Im,s.addIssueTypes=cm,s.addIssueUpdate=Ni,s.addIssueUpdates=Ki,s.addIssues=Oi,s.addOrganization=Sf,s.addOrganizationAccess=xm,s.addOrganizationAccesses=ef,s.addOrganizations=ff,s.addProcedure=oA,s.addProcedureFieldValues=wP,s.addProcedureFieldValuesAttachment=fP,s.addProcedureFieldValuesAttachments=Ga,s.addProcedureFieldValuesMany=EP,s.addProcedureInitiative=JS,s.addProcedureInitiatives=QS,s.addProcedureStep=SO,s.addProcedureStepAssignee=MA,s.addProcedureStepAssignees=RA,s.addProcedureStepComment=kA,s.addProcedureStepComments=LA,s.addProcedureStepDefaultAssignee=tT,s.addProcedureStepDefaultAssignees=sT,s.addProcedureStepDefaultReviewer=mT,s.addProcedureStepDefaultReviewers=fT,s.addProcedureStepEvent=wT,s.addProcedureStepEvents=ET,s.addProcedureStepFieldValues=RI,s.addProcedureStepFieldValuesAttachment=mI,s.addProcedureStepFieldValuesAttachments=Ma,s.addProcedureStepFieldValuesMany=wI,s.addProcedureStepFieldValuesReview=LI,s.addProcedureStepFieldValuesReviews=Va,s.addProcedureStepFields=sI,s.addProcedureStepFieldsAttachment=HT,s.addProcedureStepFieldsAttachments=Oa,s.addProcedureStepFieldsMany=iI,s.addProcedureStepReviewer=tO,s.addProcedureStepReviewers=sO,s.addProcedureSteps=AO,s.addProcedureType=HP,s.addProcedureTypeAttachment=RO,s.addProcedureTypeAttachments=wO,s.addProcedureTypeFields=sP,s.addProcedureTypeFieldsAttachment=LO,s.addProcedureTypeFieldsAttachments=HO,s.addProcedureTypeFieldsMany=iP,s.addProcedureTypes=GP,s.addProcedures=St,s.addProject=US,s.addProjectAccess=jf,s.addProjectAccesses=Df,s.addProjectAttachment=Yf,s.addProjectAttachments=Xf,s.addProjectComment=dS,s.addProjectComments=uS,s.addProjectFile=FS,s.addProjectFiles=_S,s.addProjects=$S,s.addTeam=Ab,s.addTeamMembership=ab,s.addTeamMemberships=nb,s.addTeams=Tb,s.addUser=Qi,s.addUsers=Gm,s.agentsReducer=fn,s.agentsSlice=ns,s.assetAttachmentReducer=wn,s.assetAttachmentSlice=rs,s.assetCommentReducer=Hn,s.assetCommentSlice=os,s.assetReducer=sc,s.assetSlice=hs,s.assetTypeAttachmentReducer=mc,s.assetTypeAttachmentSlice=ms,s.assetTypeFieldValuesAttachmentReducer=sr,s.assetTypeFieldValuesAttachmentSlice=Ps,s.assetTypeFieldValuesReducer=fr,s.assetTypeFieldValuesSlice=gs,s.assetTypeFieldsAttachmentReducer=wc,s.assetTypeFieldsAttachmentSlice=Ts,s.assetTypeFieldsReducer=Hc,s.assetTypeFieldsSlice=Os,s.assetTypeIdentifierReducer=Er,s.assetTypeIdentifierSlice=Ms,s.assetTypeIdentifierValueReducer=Gr,s.assetTypeIdentifierValueSlice=ws,s.assetTypeReducer=ad,s.assetTypeSlice=Es,s.assetTypeStatusReducer=Ad,s.assetTypeStatusSlice=Vs,s.authReducer=Od,s.authSlice=$t,s.baseReducer=fg,s.baseReducers=tn,s.clearTokens=zF,s.createModelAdapter=P,s.createOfflineAction=Mf,s.createPayload=g,s.createSelectionAdapter=hF,s.deleteAsset=Xn,s.deleteAssetAttachment=Fn,s.deleteAssetAttachments=us,s.deleteAssetComment=qn,s.deleteAssetComments=zt,s.deleteAssetType=xr,s.deleteAssetTypeAttachment=lc,s.deleteAssetTypeAttachments=Ss,s.deleteAssetTypeFieldValues=or,s.deleteAssetTypeFieldValuesAttachment=Jc,s.deleteAssetTypeFieldValuesAttachments=Fs,s.deleteAssetTypeFieldValuesMany=hr,s.deleteAssetTypeFields=Cc,s.deleteAssetTypeFieldsAttachment=Fc,s.deleteAssetTypeFieldsAttachments=_c,s.deleteAssetTypeFieldsMany=$c,s.deleteAssetTypeIdentifier=_r,s.deleteAssetTypeIdentifierValue=$r,s.deleteAssetTypeIdentifierValues=Ur,s.deleteAssetTypeIdentifiers=gr,s.deleteAssetTypeStatus=pd,s.deleteAssetTypeStatuses=yd,s.deleteAssetTypes=ed,s.deleteAssets=ys,s.deleteConversation=AF,s.deleteConversations=TF,s.deleteDocument=Gd,s.deleteDocumentAttachment=Ed,s.deleteDocumentAttachments=vd,s.deleteDocuments=Nd,s.deleteEmailDomain=au,s.deleteEmailDomains=nu,s.deleteForm=Vl,s.deleteFormIdentifier=Au,s.deleteFormIdentifierValue=Vu,s.deleteFormIdentifierValues=Bu,s.deleteFormIdentifiers=Tu,s.deleteFormRevision=nl,s.deleteFormRevisionAttachment=Ku,s.deleteFormRevisionAttachments=Wu,s.deleteFormRevisions=Ks,s.deleteFormSubmission=fo,s.deleteFormSubmissionFieldValues=so,s.deleteFormSubmissionFieldValuesAttachment=Nl,s.deleteFormSubmissionFieldValuesAttachments=ei,s.deleteFormSubmissionFieldValuesMany=ci,s.deleteFormSubmissions=ct,s.deleteFormSubscriber=Al,s.deleteFormSubscribers=Xs,s.deleteForms=Bl,s.deleteGeoImage=zo,s.deleteGeoImages=jo,s.deleteIssue=Xh,s.deleteIssueAssociation=Wo,s.deleteIssueAssociations=mt,s.deleteIssueAttachment=uh,s.deleteIssueAttachments=yi,s.deleteIssueComment=qh,s.deleteIssueCommentAttachment=bh,s.deleteIssueCommentAttachments=Fh,s.deleteIssueComments=Ch,s.deleteIssueType=om,s.deleteIssueTypeAttachment=up,s.deleteIssueTypeAttachments=lp,s.deleteIssueTypeFieldValues=qp,s.deleteIssueTypeFieldValuesAttachment=ly,s.deleteIssueTypeFieldValuesAttachments=vi,s.deleteIssueTypeFieldValuesMany=Cp,s.deleteIssueTypeFields=Jp,s.deleteIssueTypeFieldsAttachment=bp,s.deleteIssueTypeFieldsAttachments=Fp,s.deleteIssueTypeFieldsMany=Qp,s.deleteIssueTypeIdentifier=Fy,s.deleteIssueTypeIdentifierValue=Cy,s.deleteIssueTypeIdentifierValues=$y,s.deleteIssueTypeIdentifiers=_y,s.deleteIssueTypePriorities=xy,s.deleteIssueTypePriority=Qy,s.deleteIssueTypeStatus=_m,s.deleteIssueTypeStatuses=gm,s.deleteIssueTypes=hm,s.deleteIssueUpdate=Wi,s.deleteIssueUpdates=Yi,s.deleteIssues=Pi,s.deleteOrganization=If,s.deleteOrganizationAccess=cf,s.deleteOrganizationAccesses=rf,s.deleteOrganizations=Of,s.deleteProcedure=fA,s.deleteProcedureFieldValues=jP,s.deleteProcedureFieldValuesAttachment=OP,s.deleteProcedureFieldValuesAttachments=Na,s.deleteProcedureFieldValuesMany=DP,s.deleteProcedureInitiative=iA,s.deleteProcedureInitiatives=aA,s.deleteProcedureStep=OO,s.deleteProcedureStepAssignee=BA,s.deleteProcedureStepAssignees=zA,s.deleteProcedureStepComment=WA,s.deleteProcedureStepComments=YA,s.deleteProcedureStepDefaultAssignee=rT,s.deleteProcedureStepDefaultAssignees=dT,s.deleteProcedureStepDefaultReviewer=OT,s.deleteProcedureStepDefaultReviewers=PT,s.deleteProcedureStepEvent=jT,s.deleteProcedureStepEvents=DT,s.deleteProcedureStepFieldValues=zI,s.deleteProcedureStepFieldValuesAttachment=II,s.deleteProcedureStepFieldValuesAttachments=Ra,s.deleteProcedureStepFieldValuesMany=jI,s.deleteProcedureStepFieldValuesReview=WI,s.deleteProcedureStepFieldValuesReviews=Ba,s.deleteProcedureStepFields=dI,s.deleteProcedureStepFieldsAttachment=YT,s.deleteProcedureStepFieldsAttachments=Pa,s.deleteProcedureStepFieldsMany=uI,s.deleteProcedureStepReviewer=rO,s.deleteProcedureStepReviewers=dO,s.deleteProcedureSteps=PO,s.deleteProcedureType=XP,s.deleteProcedureTypeAttachment=zO,s.deleteProcedureTypeAttachments=jO,s.deleteProcedureTypeFields=dP,s.deleteProcedureTypeFieldsAttachment=YO,s.deleteProcedureTypeFieldsAttachments=XO,s.deleteProcedureTypeFieldsMany=uP,s.deleteProcedureTypes=ZP,s.deleteProcedures=At,s.deleteProject=HS,s.deleteProjectAccess=kf,s.deleteProjectAccesses=Lf,s.deleteProjectAttachment=eS,s.deleteProjectAttachments=tS,s.deleteProjectComment=yS,s.deleteProjectComments=mS,s.deleteProjectFile=RS,s.deleteProjectFiles=wS,s.deleteProjects=GS,s.deleteTeam=Fb,s.deleteTeamMembership=lb,s.deleteTeamMemberships=ob,s.deleteTeams=_b,s.deleteUser=xi,s.deleteUsers=Wm,s.dequeue=jb,s.discard=qb,s.documentAttachmentReducer=jd,s.documentAttachmentSlice=zs,s.documentSlice=Ds,s.documentsReducer=Kd,s.emailDomainsReducer=uu,s.emailDomainsSlice=Cs,s.enqueue=zb,s.enqueueRequest=wf,s.extractResponseFromError=$b,s.fetchBlobFromObjectUrl=Lb,s.fetchFileFromObjectUrl=Hb,s.fileToBlob=Ub,s.formIdentifierReducer=bu,s.formIdentifierSlice=Us,s.formIdentifierValueReducer=qu,s.formIdentifierValueSlice=Ls,s.formReducer=zl,s.formRevisionAttachmentReducer=Ju,s.formRevisionAttachmentSlice=Hs,s.formRevisionReducer=ll,s.formRevisionsSlice=Gs,s.formSlice=Zs,s.formSubmissionFieldValuesAttachmentReducer=Yl,s.formSubmissionFieldValuesAttachmentSlice=Qs,s.formSubmissionFieldValuesReducer=ro,s.formSubmissionFieldValuesSlice=ai,s.formSubmissionReducer=_o,s.formSubmissionSlice=di,s.formSubscriberReducer=bl,s.formSubscriberSlice=Ws,s.geoImageReducer=$o,s.geoImageSlice=ui,s.getClientSDK=eF,s.getClientStore=Ot,s.getFileExtension=kb,s.getOutboxCoordinator=ht,s.getPresignedUrlExpiryDate=Wb,s.getRenamedFile=Rg,s.getRequestDescription=m,s.getS3FileKey=Mg,s.hashFile=is,s.initSDK=eR,s.initializeAssetAttachments=An,s.initializeAssetComments=vn,s.initializeAssetTypeAttachments=ac,s.initializeAssetTypeFieldValues=ar,s.initializeAssetTypeFieldValuesAttachments=Nc,s.initializeAssetTypeFields=vc,s.initializeAssetTypeFieldsAttachments=Sc,s.initializeAssetTypeIdentifierValues=Vr,s.initializeAssetTypeIdentifiers=Ar,s.initializeAssetTypeStatuses=cd,s.initializeAssetTypes=Kr,s.initializeAssets=Nn,s.initializeConversations=hn,s.initializeDocumentAttachments=bd,s.initializeDocuments=qd,s.initializeEmailDomains=Jd,s.initializeFormIdentifierValues=_u,s.initializeFormIdentifiers=ou,s.initializeFormRevisionAttachments=$u,s.initializeFormRevisions=xu,s.initializeFormSubmissionFieldValues=Zl,s.initializeFormSubmissionFieldValuesAttachments=$l,s.initializeFormSubmissions=lo,s.initializeFormSubscribers=hl,s.initializeForms=_l,s.initializeGeoImages=Mo,s.initializeIssueAssociations=ko,s.initializeIssueAttachments=ih,s.initializeIssueCommentAttachments=fh,s.initializeIssueComments=Eh,s.initializeIssueTypeAttachments=sp,s.initializeIssueTypeFieldValues=Ep,s.initializeIssueTypeFieldValuesAttachments=ay,s.initializeIssueTypeFields=Gp,s.initializeIssueTypeFieldsAttachments=fp,s.initializeIssueTypeIdentifierValues=vy,s.initializeIssueTypeIdentifiers=Sy,s.initializeIssueTypePriorities=Ny,s.initializeIssueTypeStatuses=Am,s.initializeIssueTypes=am,s.initializeIssueUpdates=vm,s.initializeIssues=Hh,s.initializeOrganizationAccesses=Qm,s.initializeOrganizations=pf,s.initializeProcedureFieldValues=RP,s.initializeProcedureFieldValuesAttachments=mP,s.initializeProcedureInitiatives=ZS,s.initializeProcedureStepAssignees=gA,s.initializeProcedureStepComments=UA,s.initializeProcedureStepDefaultAssignees=eT,s.initializeProcedureStepDefaultReviewers=yT,s.initializeProcedureStepEvents=RT,s.initializeProcedureStepFieldValues=MI,s.initializeProcedureStepFieldValuesAttachments=yI,s.initializeProcedureStepFieldValuesReviews=kI,s.initializeProcedureStepFields=tI,s.initializeProcedureStepFieldsAttachments=LT,s.initializeProcedureStepReviewers=eO,s.initializeProcedureSteps=yO,s.initializeProcedureTypeAttachments=MO,s.initializeProcedureTypeFields=tP,s.initializeProcedureTypeFieldsAttachments=kO,s.initializeProcedureTypes=LP,s.initializeProcedures=lA,s.initializeProjectAccesses=zf,s.initializeProjectAttachments=Wf,s.initializeProjectComments=rS,s.initializeProjectFiles=OS,s.initializeProjects=DS,s.initializeTeamMemberships=ib,s.initializeTeams=Sb,s.initializeUsers=km,s.isCloudfrontUrl=Nb,s.isImageFile=wg,s.isObjectUrl=Gb,s.isPresignedUrlExpired=Yb,s.isS3Url=Kb,s.issueAssociationReducer=th,s.issueAssociationSlice=oi,s.issueAttachmentReducer=yh,s.issueAttachmentSlice=hi,s.issueCommentAttachmentReducer=Rh,s.issueCommentAttachmentSlice=fi,s.issueCommentReducer=kh,s.issueCommentSlice=Ai,s.issueReducer=ep,s.issueSlice=Ii,s.issueTypeAttachmentReducer=yp,s.issueTypeAttachmentSlice=bi,s.issueTypeFieldValuesAttachmentReducer=my,s.issueTypeFieldValuesAttachmentSlice=wi,s.issueTypeFieldValuesReducer=Lp,s.issueTypeFieldValuesSlice=Mi,s.issueTypeFieldsAttachmentReducer=Rp,s.issueTypeFieldsAttachmentSlice=_i,s.issueTypeFieldsReducer=sy,s.issueTypeFieldsSlice=Ri,s.issueTypeIdentifierReducer=wy,s.issueTypeIdentifierSlice=Bi,s.issueTypeIdentifierValueReducer=Hy,s.issueTypeIdentifierValueSlice=ji,s.issueTypePriorityReducer=sm,s.issueTypePrioritySlice=Di,s.issueTypeReducer=fm,s.issueTypeSlice=$i,s.issueTypeStatusReducer=wm,s.issueTypeStatusSlice=ki,s.issueUpdateReducer=$m,s.issueUpdateSlice=Gi,s.markAsDeleted=Ef,s.markForDeletion=I_,s.organizationAccessReducer=df,s.organizationAccessSlice=ta,s.organizationReducer=gf,s.organizationSlice=sa,s.outboxReducer=Vf,s.outboxSlice=ia,s.overmapEnhancer=Og,s.overmapReducer=Sg,s.overmapReducers=Eb,s.performRequest=cn,s.performRequestFromAction=Db,s.procedureFieldValuesAttachmentReducer=PP,s.procedureFieldValuesAttachmentSlice=Ha,s.procedureFieldValuesReducer=qP,s.procedureFieldValuesSlice=Wa,s.procedureInitiativeReducer=nA,s.procedureInitiativeSlice=oa,s.procedureReducer=SA,s.procedureSlice=ha,s.procedureStepAssigneeReducer=CA,s.procedureStepAssigneeSlice=pa,s.procedureStepCommentReducer=QA,s.procedureStepCommentSlice=ya,s.procedureStepDefaultAssigneeReducer=hT,s.procedureStepDefaultAssigneeSlice=ma,s.procedureStepDefaultReviewerReducer=gT,s.procedureStepDefaultReviewerSlice=Sa,s.procedureStepEventReducer=UT,s.procedureStepEventSlice=Ta,s.procedureStepFieldValuesAttachmentReducer=_I,s.procedureStepFieldValuesAttachmentSlice=ga,s.procedureStepFieldValuesReducer=DI,s.procedureStepFieldValuesReviewReducer=QI,s.procedureStepFieldValuesReviewSlice=va,s.procedureStepFieldValuesSlice=Ea,s.procedureStepFieldsAttachmentReducer=xT,s.procedureStepFieldsAttachmentSlice=Ia,s.procedureStepFieldsReducer=hI,s.procedureStepFieldsSlice=Fa,s.procedureStepReducer=bO,s.procedureStepReviewerReducer=hO,s.procedureStepReviewerSlice=za,s.procedureStepSlice=ja,s.procedureTypeAttachmentReducer=DO,s.procedureTypeAttachmentSlice=Ca,s.procedureTypeFieldsAttachmentReducer=ZO,s.procedureTypeFieldsAttachmentSlice=Ua,s.procedureTypeFieldsReducer=lP,s.procedureTypeFieldsSlice=La,s.procedureTypeReducer=JP,s.procedureTypeSlice=Xa,s.projectAccessReducer=Hf,s.projectAccessSlice=aa,s.projectAttachmentReducer=nS,s.projectAttachmentSlice=ca,s.projectCommentReducer=TS,s.projectCommentSlice=da,s.projectFileReducer=zS,s.projectFileSlice=ua,s.projectReducer=NS,s.projectSlice=la,s.rehydratedReducer=tb,s.rehydratedSlice=Ja,s.restructureSelectorWithArgs=y,s.runMiddleware=aF,s.selectAccessToken=jF,s.selectAccessesByUserOfProject=P_,s.selectAccessibleProjects=M_,s.selectActiveOrganizationAccess=f_,s.selectAllDocumentAttachments=js,s.selectAssetAttachmentById=gn,s.selectAssetAttachmentMapping=_n,s.selectAssetAttachments=ls,s.selectAssetAttachmentsByIds=Mn,s.selectAssetById=ec,s.selectAssetCommentById=$n,s.selectAssetCommentMapping=Cn,s.selectAssetComments=jt,s.selectAssetCommentsByIds=Un,s.selectAssetTypeAttachmentById=hc,s.selectAssetTypeAttachmentMapping=oc,s.selectAssetTypeAttachments=As,s.selectAssetTypeAttachmentsByIds=pc,s.selectAssetTypeById=sd,s.selectAssetTypeFieldValues=qt,s.selectAssetTypeFieldValuesAttachmentById=xc,s.selectAssetTypeFieldValuesAttachments=_s,s.selectAssetTypeFieldValuesAttachmentsByIds=er,s.selectAssetTypeFieldValuesAttachmentsMapping=Qc,s.selectAssetTypeFieldValuesById=yr,s.selectAssetTypeFieldValuesByIds=mr,s.selectAssetTypeFieldValuesMapping=pr,s.selectAssetTypeFieldValuesOfAsset=gF,s.selectAssetTypeFields=bt,s.selectAssetTypeFieldsAttachmentById=Mc,s.selectAssetTypeFieldsAttachments=Is,s.selectAssetTypeFieldsAttachmentsByIds=Rc,s.selectAssetTypeFieldsAttachmentsMapping=gc,s.selectAssetTypeFieldsById=kc,s.selectAssetTypeFieldsByIds=Lc,s.selectAssetTypeFieldsMapping=Uc,s.selectAssetTypeFieldsOfAssetType=FF,s.selectAssetTypeIdentifierById=Rr,s.selectAssetTypeIdentifierMapping=Mr,s.selectAssetTypeIdentifierValueById=Lr,s.selectAssetTypeIdentifierValueMapping=kr,s.selectAssetTypeIdentifierValues=Ct,s.selectAssetTypeIdentifierValuesByIds=Hr,s.selectAssetTypeIdentifierValuesOfAsset=wF,s.selectAssetTypeIdentifierValuesOfIdentifier=EF,s.selectAssetTypeIdentifiers=Rs,s.selectAssetTypeIdentifiersByIds=wr,s.selectAssetTypeIdentifiersOfAssetType=RF,s.selectAssetTypeStatusById=fd,s.selectAssetTypeStatusMapping=md,s.selectAssetTypeStatuses=Bs,s.selectAssetTypeStatusesByIds=Sd,s.selectAssetTypeStatusesOfAssetType=VF,s.selectAssetTypeValuesOfAssetType=MF,s.selectAssetTypes=vs,s.selectAssetTypesByIds=id,s.selectAssetTypesMapping=td,s.selectAssetTypesOfOrganization=vF,s.selectAssets=Dt,s.selectAssetsByIds=tc,s.selectAssetsMapping=Qn,s.selectAssetsOfAssetType=xn,s.selectAssetsOfProject=PF,s.selectAttachmentsOfAsset=Rn,s.selectAttachmentsOfAssetType=yc,s.selectAttachmentsOfAssetTypeFieldValues=tr,s.selectAttachmentsOfAssetTypeFields=bF,s.selectAttachmentsOfDocument=qF,s.selectAttachmentsOfFormRevision=GF,s.selectAttachmentsOfFormSubmissionFieldValues=Wl,s.selectAttachmentsOfIssue=oh,s.selectAttachmentsOfIssueComment=xF,s.selectAttachmentsOfIssueType=s_,s.selectAttachmentsOfIssueTypeFieldValues=yy,s.selectAttachmentsOfIssueTypeFields=i_,s.selectAttachmentsOfProcedureFieldValues=gP,s.selectAttachmentsOfProcedureStepFieldValues=FI,s.selectAttachmentsOfProcedureStepFields=ZT,s.selectAttachmentsOfProcedureType=ag,s.selectAttachmentsOfProcedureTypeFields=ng,s.selectAttachmentsOfProject=F_,s.selectCommentsOfAsset=kn,s.selectCommentsOfAssets=Ln,s.selectCommentsOfIssue=e_,s.selectCommentsOfProject=__,s.selectCommentsOfProjects=g_,s.selectConversation=OF,s.selectConversationMapping=cs,s.selectConversations=IF,s.selectCurrentUser=Xm,s.selectDeletedRequests=A_,s.selectDescendantsOfDocument=Xd,s.selectDocumentAttachmentById=Bd,s.selectDocumentAttachmentMapping=Vd,s.selectDocumentAttachmentsByIds=zd,s.selectDocumentById=Wd,s.selectDocuments=Ut,s.selectDocumentsByIds=Yd,s.selectDocumentsMapping=qs,s.selectEmailDomainById=ru,s.selectEmailDomains=$s,s.selectEmailDomainsAsMapping=cu,s.selectEmailDomainsByIds=du,s.selectEmailDomainsOfOrganization=UF,s.selectFieldValuesOfProcedure=dg,s.selectFormById=Dl,s.selectFormIdentifierById=Ou,s.selectFormIdentifierMapping=Iu,s.selectFormIdentifierValueById=ju,s.selectFormIdentifierValueMapping=zu,s.selectFormIdentifierValues=kt,s.selectFormIdentifierValuesByIds=Du,s.selectFormIdentifierValuesOfFormSubmission=LF,s.selectFormIdentifierValuesOfIdentifier=HF,s.selectFormIdentifiers=ks,s.selectFormIdentifiersByIds=Pu,s.selectFormIdentifiersOfForm=kF,s.selectFormMapping=jl,s.selectFormRevisionAttachmentById=Xu,s.selectFormRevisionAttachments=Yu,s.selectFormRevisionAttachmentsByIds=Zu,s.selectFormRevisionAttachmentsMapping=Lt,s.selectFormRevisionById=rl,s.selectFormRevisionMapping=cl,s.selectFormRevisions=Ht,s.selectFormRevisionsByIds=dl,s.selectFormRevisionsOfForm=ul,s.selectFormSubmissionById=Ao,s.selectFormSubmissionFieldValues=ri,s.selectFormSubmissionFieldValuesAttachmentById=Kl,s.selectFormSubmissionFieldValuesAttachments=si,s.selectFormSubmissionFieldValuesAttachmentsByIds=ii,s.selectFormSubmissionFieldValuesAttachmentsMapping=ti,s.selectFormSubmissionFieldValuesById=ao,s.selectFormSubmissionFieldValuesByIds=no,s.selectFormSubmissionFieldValuesMapping=io,s.selectFormSubmissionFieldValuesOfFormSubmission=co,s.selectFormSubmissions=D,s.selectFormSubmissionsByIds=To,s.selectFormSubmissionsMapping=So,s.selectFormSubmissionsOfAsset=bo,s.selectFormSubmissionsOfAssets=Fo,s.selectFormSubmissionsOfForm=Io,s.selectFormSubmissionsOfIssue=Oo,s.selectFormSubmissionsOfIssues=Po,s.selectFormSubmissionsOfOrganization=YF,s.selectFormSubmissionsOfOrganizationAndForm=JF,s.selectFormSubmissionsOfProject=XF,s.selectFormSubmissionsOfProjectAndForm=ZF,s.selectFormSubscriberById=Il,s.selectFormSubscriberMapping=Tl,s.selectFormSubscribers=Gt,s.selectFormSubscribersByIds=Ol,s.selectFormSubscribersOfForm=Pl,s.selectFormSubscribersOfUser=KF,s.selectForms=Js,s.selectFormsByIds=ql,s.selectFormsOfOrganization=WF,s.selectGeoImageById=qo,s.selectGeoImageMapping=Do,s.selectGeoImages=li,s.selectGeoImagesByIds=Co,s.selectGeoImagesOfProject=QF,s.selectIsLoggedIn=DF,s.selectIssueAssociationById=Xo,s.selectIssueAssociationMapping=Yo,s.selectIssueAssociations=ft,s.selectIssueAssociationsByIds=Zo,s.selectIssueAssociationsOfAsset=xo,s.selectIssueAssociationsOfAssets=eh,s.selectIssueAssociationsOfIssue=Qo,s.selectIssueAssociationsOfIssues=Jo,s.selectIssueAttachmentById=hh,s.selectIssueAttachmentMapping=lh,s.selectIssueAttachments=mi,s.selectIssueAttachmentsByIds=ph,s.selectIssueById=Jh,s.selectIssueCommentAttachmentById=gh,s.selectIssueCommentAttachmentMapping=_h,s.selectIssueCommentAttachments=Si,s.selectIssueCommentAttachmentsByIds=Mh,s.selectIssueCommentById=$h,s.selectIssueCommentMapping=Ti,s.selectIssueCommentsByIds=Uh,s.selectIssueMapping=Zh,s.selectIssueTypeAttachmentById=hp,s.selectIssueTypeAttachmentMapping=op,s.selectIssueTypeAttachments=Fi,s.selectIssueTypeAttachmentsByIds=pp,s.selectIssueTypeById=ym,s.selectIssueTypeFieldValues=Kt,s.selectIssueTypeFieldValuesAttachmentById=hy,s.selectIssueTypeFieldValuesAttachments=Vi,s.selectIssueTypeFieldValuesAttachmentsByIds=py,s.selectIssueTypeFieldValuesAttachmentsMapping=oy,s.selectIssueTypeFieldValuesById=Up,s.selectIssueTypeFieldValuesByIds=kp,s.selectIssueTypeFieldValuesMapping=$p,s.selectIssueTypeFieldValuesOfIssue=a_,s.selectIssueTypeFields=Ft,s.selectIssueTypeFieldsAttachmentById=gp,s.selectIssueTypeFieldsAttachments=gi,s.selectIssueTypeFieldsAttachmentsByIds=Mp,s.selectIssueTypeFieldsAttachmentsMapping=_p,s.selectIssueTypeFieldsById=ey,s.selectIssueTypeFieldsByIds=ty,s.selectIssueTypeFieldsMapping=xp,s.selectIssueTypeFieldsOfIssueType=n_,s.selectIssueTypeIdentifierById=My,s.selectIssueTypeIdentifierMapping=gy,s.selectIssueTypeIdentifierValueById=ky,s.selectIssueTypeIdentifierValueMapping=Uy,s.selectIssueTypeIdentifierValues=Wt,s.selectIssueTypeIdentifierValuesByIds=Ly,s.selectIssueTypeIdentifierValuesOfIdentifier=l_,s.selectIssueTypeIdentifierValuesOfIssue=u_,s.selectIssueTypeIdentifiers=zi,s.selectIssueTypeIdentifiersByIds=Ry,s.selectIssueTypeIdentifiersOfIssueType=d_,s.selectIssueTypeMapping=pm,s.selectIssueTypePriorities=qi,s.selectIssueTypePrioritiesByIds=tm,s.selectIssueTypePrioritiesOfIssueType=o_,s.selectIssueTypePriorityById=Ci,s.selectIssueTypePriorityMapping=em,s.selectIssueTypeStatusById=Hi,s.selectIssueTypeStatusMapping=Mm,s.selectIssueTypeStatuses=Li,s.selectIssueTypeStatusesByIds=Rm,s.selectIssueTypeStatusesOfIssueType=p_,s.selectIssueTypeValuesOfIssueType=r_,s.selectIssueTypes=Ui,s.selectIssueTypesByIds=mm,s.selectIssueTypesOfOrganization=h_,s.selectIssueUpdateById=Dm,s.selectIssueUpdateMapping=Xi,s.selectIssueUpdates=Zi,s.selectIssueUpdatesByIds=qm,s.selectIssueUpdatesOfIssue=Cm,s.selectIssues=Nt,s.selectIssuesByIds=Qh,s.selectIssuesOfIssueType=xh,s.selectIssuesOfProject=t_,s.selectLatestAssetTypeFieldsOfAssetType=_F,s.selectLatestFieldsByProcedureStep=N_,s.selectLatestFormRevisionOfForm=NF,s.selectLatestIssueTypeFieldsOfIssueType=c_,s.selectLatestProcedureStepFieldValuesReviewByProcedureStepFieldValues=Q_,s.selectLatestProcedureStepFieldsOfProcedureStep=G_,s.selectLatestProcedureTypeFieldsOfProcedureType=rg,s.selectLatestRetryTime=T_,s.selectLatestReviewOfProcedureStepFieldValues=X_,s.selectMembershipsByUserOfTeam=pg,s.selectOrganizationAccessById=uf,s.selectOrganizationAccessMapping=Zt,s.selectOrganizationAccessUserMapping=of,s.selectOrganizationAccessesByIds=lf,s.selectOrganizationById=Ff,s.selectOrganizationDocuments=$F,s.selectOrganizations=bf,s.selectOrganizationsByIds=_f,s.selectOrganizationsMapping=Pf,s.selectProcedureById=TA,s.selectProcedureFieldValues=Ya,s.selectProcedureFieldValuesAttachmentById=FP,s.selectProcedureFieldValuesAttachments=Ka,s.selectProcedureFieldValuesAttachmentsByIds=_P,s.selectProcedureFieldValuesAttachmentsMapping=bP,s.selectProcedureFieldValuesById=$P,s.selectProcedureFieldValuesByIds=UP,s.selectProcedureFieldValuesMapping=CP,s.selectProcedureInitiativeById=rA,s.selectProcedureInitiatives=xt,s.selectProcedureInitiativesByIds=dA,s.selectProcedureInitiativesMapping=cA,s.selectProcedureInitiativesOfProcedureType=E_,s.selectProcedureInitiativesOfProject=w_,s.selectProcedureStepAssigneeById=DA,s.selectProcedureStepAssignees=gt,s.selectProcedureStepAssigneesByIds=qA,s.selectProcedureStepAssigneesMapping=jA,s.selectProcedureStepAssigneesOfProcedure=V_,s.selectProcedureStepAssigneesOfProcedureAndProcedureStep=z_,s.selectProcedureStepAssigneesOfProcedureStep=B_,s.selectProcedureStepById=FO,s.selectProcedureStepCommentById=ZA,s.selectProcedureStepComments=Mt,s.selectProcedureStepCommentsByIds=JA,s.selectProcedureStepCommentsMapping=XA,s.selectProcedureStepCommentsOfProcedure=j_,s.selectProcedureStepCommentsOfProcedureAndProcedureStep=q_,s.selectProcedureStepCommentsOfProcedureStep=D_,s.selectProcedureStepDefaultAssigneeById=lT,s.selectProcedureStepDefaultAssignees=fa,s.selectProcedureStepDefaultAssigneesByIds=oT,s.selectProcedureStepDefaultAssigneesMapping=uT,s.selectProcedureStepDefaultAssigneesOfProcedureStep=C_,s.selectProcedureStepDefaultReviewerById=FT,s.selectProcedureStepDefaultReviewers=Aa,s.selectProcedureStepDefaultReviewersByIds=_T,s.selectProcedureStepDefaultReviewersMapping=bT,s.selectProcedureStepDefaultReviewersOfProcedureStep=$_,s.selectProcedureStepEventById=CT,s.selectProcedureStepEvents=Rt,s.selectProcedureStepEventsByIds=$T,s.selectProcedureStepEventsMapping=qT,s.selectProcedureStepEventsOfProcedure=U_,s.selectProcedureStepEventsOfProcedureAndProcedureStep=L_,s.selectProcedureStepEventsOfProcedureStep=k_,s.selectProcedureStepFieldValues=dt,s.selectProcedureStepFieldValuesAttachmentById=PI,s.selectProcedureStepFieldValuesAttachments=wa,s.selectProcedureStepFieldValuesAttachmentsByIds=bI,s.selectProcedureStepFieldValuesAttachmentsMapping=OI,s.selectProcedureStepFieldValuesById=CI,s.selectProcedureStepFieldValuesByIds=$I,s.selectProcedureStepFieldValuesMapping=qI,s.selectProcedureStepFieldValuesOfProcedure=K_,s.selectProcedureStepFieldValuesOfProcedureAndProcedureStep=Y_,s.selectProcedureStepFieldValuesOfProcedureStep=W_,s.selectProcedureStepFieldValuesReviewById=XI,s.selectProcedureStepFieldValuesReviews=ut,s.selectProcedureStepFieldValuesReviewsByIds=ZI,s.selectProcedureStepFieldValuesReviewsMapping=YI,s.selectProcedureStepFieldValuesReviewsOfProcedure=Z_,s.selectProcedureStepFieldValuesReviewsOfProcedureAndProcedureStep=J_,s.selectProcedureStepFields=es,s.selectProcedureStepFieldsAttachmentById=JT,s.selectProcedureStepFieldsAttachments=ba,s.selectProcedureStepFieldsAttachmentsByIds=QT,s.selectProcedureStepFieldsAttachmentsMapping=XT,s.selectProcedureStepFieldsById=lI,s.selectProcedureStepFieldsByIds=oI,s.selectProcedureStepFieldsMapping=_a,s.selectProcedureStepFieldsOfProcedureStep=H_,s.selectProcedureStepReviewerById=lO,s.selectProcedureStepReviewers=wt,s.selectProcedureStepReviewersByIds=oO,s.selectProcedureStepReviewersMapping=uO,s.selectProcedureStepReviewersOfProcedure=x_,s.selectProcedureStepReviewersOfProcedureAndProcedureStep=tg,s.selectProcedureStepReviewersOfProcedureStep=eg,s.selectProcedureSteps=qa,s.selectProcedureStepsByIds=_O,s.selectProcedureStepsMapping=Da,s.selectProcedureStepsMappingOfProcedureType=sg,s.selectProcedureStepsOfProcedureType=ig,s.selectProcedureTypeAttachmentById=CO,s.selectProcedureTypeAttachmentMapping=qO,s.selectProcedureTypeAttachments=$a,s.selectProcedureTypeAttachmentsByIds=$O,s.selectProcedureTypeById=xP,s.selectProcedureTypeFields=ts,s.selectProcedureTypeFieldsAttachmentById=QO,s.selectProcedureTypeFieldsAttachments=ka,s.selectProcedureTypeFieldsAttachmentsByIds=xO,s.selectProcedureTypeFieldsAttachmentsMapping=JO,s.selectProcedureTypeFieldsById=hP,s.selectProcedureTypeFieldsByIds=pP,s.selectProcedureTypeFieldsMapping=oP,s.selectProcedureTypeFieldsOfProcedureType=cg,s.selectProcedureTypes=Za,s.selectProcedureTypesByIds=eb,s.selectProcedureTypesMapping=QP,s.selectProcedureTypesOfOrganization=ug,s.selectProcedures=rt,s.selectProceduresByIds=IA,s.selectProceduresMapping=AA,s.selectProceduresOfAsset=PA,s.selectProceduresOfAssets=bA,s.selectProceduresOfProcedureInitiative=FA,s.selectProceduresOfProcedureType=OA,s.selectProceduresOfProject=v_,s.selectProjectAccessById=Gf,s.selectProjectAccessMapping=na,s.selectProjectAccesses=_t,s.selectProjectAccessesByIds=Nf,s.selectProjectAccessesOfProject=O_,s.selectProjectAttachmentById=iS,s.selectProjectAttachmentMapping=sS,s.selectProjectAttachments=ra,s.selectProjectAttachmentsByIds=aS,s.selectProjectById=WS,s.selectProjectCommentById=SS,s.selectProjectCommentMapping=fS,s.selectProjectComments=Jt,s.selectProjectCommentsByIds=AS,s.selectProjectDocuments=CF,s.selectProjectFileById=VS,s.selectProjectFileMapping=ES,s.selectProjectFiles=vS,s.selectProjectFilesByIds=BS,s.selectProjectMapping=KS,s.selectProjects=Qt,s.selectProjectsByIds=YS,s.selectProjectsOfOrganization=R_,s.selectRehydrated=hg,s.selectReviewsOfProcedureStepFieldValues=JI,s.selectTeamById=Mb,s.selectTeamMembershipById=yb,s.selectTeamMemberships=ss,s.selectTeamMembershipsByIds=mb,s.selectTeamMembershipsMapping=pb,s.selectTeams=en,s.selectTeamsByIds=Rb,s.selectTeamsMapping=gb,s.selectTeamsOfOrganization=mg,s.selectUserById=Xt,s.selectUsers=Yt,s.selectUsersByIds=Zm,s.selectUsersMapping=ea,s.selectUsersOfOrganization=S_,s.selectUsersOfProject=b_,s.selectUsersOfTeam=yg,s.setAsset=Zn,s.setAssetAttachment=In,s.setAssetAttachments=On,s.setAssetComment=Bn,s.setAssetComments=zn,s.setAssetType=Wr,s.setAssetTypeAttachment=cc,s.setAssetTypeAttachments=rc,s.setAssetTypeFieldValues=rr,s.setAssetTypeFieldValuesAttachment=Wc,s.setAssetTypeFieldValuesAttachments=Yc,s.setAssetTypeFieldValuesMany=dr,s.setAssetTypeFields=zc,s.setAssetTypeFieldsAttachment=Ic,s.setAssetTypeFieldsAttachments=Oc,s.setAssetTypeFieldsMany=jc,s.setAssetTypeIdentifier=Or,s.setAssetTypeIdentifierValue=jr,s.setAssetTypeIdentifierValues=Dr,s.setAssetTypeIdentifiers=Pr,s.setAssetTypeStatus=ud,s.setAssetTypeStatuses=ld,s.setAssetTypes=Yr,s.setAssets=Jn,s.setClientSDK=xb,s.setClientStore=Jb,s.setConversation=yn,s.setConversations=fF,s.setCurrentUser=y_,s.setCurrentUserProfile=m_,s.setDocument=Ud,s.setDocumentAttachment=gd,s.setDocumentAttachments=Md,s.setDocuments=kd,s.setEmailDomain=eu,s.setEmailDomains=tu,s.setForm=Rl,s.setFormIdentifier=yu,s.setFormIdentifierValue=Ru,s.setFormIdentifierValues=wu,s.setFormIdentifiers=mu,s.setFormRevision=tl,s.setFormRevisionAttachment=Lu,s.setFormRevisionAttachments=Hu,s.setFormRevisions=sl,s.setFormSubmission=oo,s.setFormSubmissionFieldValues=Ql,s.setFormSubmissionFieldValuesAttachment=kl,s.setFormSubmissionFieldValuesAttachments=Ll,s.setFormSubmissionFieldValuesMany=xl,s.setFormSubmissions=ho,s.setFormSubscriber=yl,s.setFormSubscribers=ml,s.setForms=wl,s.setGeoImage=Ro,s.setGeoImages=wo,s.setIssue=Nh,s.setIssueAssociation=Ho,s.setIssueAssociations=Lo,s.setIssueAttachment=nh,s.setIssueAttachments=ch,s.setIssueComment=Bh,s.setIssueCommentAttachment=Th,s.setIssueCommentAttachments=Ih,s.setIssueComments=zh,s.setIssueType=rm,s.setIssueTypeAttachment=np,s.setIssueTypeAttachments=cp,s.setIssueTypeFieldValues=Bp,s.setIssueTypeFieldValuesAttachment=cy,s.setIssueTypeFieldValuesAttachments=ry,s.setIssueTypeFieldValuesMany=zp,s.setIssueTypeFields=Wp,s.setIssueTypeFieldsAttachment=Tp,s.setIssueTypeFieldsAttachments=Ip,s.setIssueTypeFieldsMany=Yp,s.setIssueTypeIdentifier=Iy,s.setIssueTypeIdentifierValue=zy,s.setIssueTypeIdentifierValues=jy,s.setIssueTypeIdentifiers=Oy,s.setIssueTypePriorities=Xy,s.setIssueTypePriority=Yy,s.setIssueTypeStatus=Om,s.setIssueTypeStatuses=Pm,s.setIssueTypes=dm,s.setIssueUpdate=Vm,s.setIssueUpdates=Bm,s.setIssues=Kh,s.setLoggedIn=Id,s.setOrganization=mf,s.setOrganizationAccess=tf,s.setOrganizationAccesses=sf,s.setOrganizations=yf,s.setProcedure=hA,s.setProcedureFieldValues=vP,s.setProcedureFieldValuesAttachment=SP,s.setProcedureFieldValuesAttachments=AP,s.setProcedureFieldValuesMany=VP,s.setProcedureInitiative=xS,s.setProcedureInitiatives=eA,s.setProcedureStep=mO,s.setProcedureStepAssignee=wA,s.setProcedureStepAssignees=EA,s.setProcedureStepComment=HA,s.setProcedureStepComments=GA,s.setProcedureStepDefaultAssignee=iT,s.setProcedureStepDefaultAssignees=aT,s.setProcedureStepDefaultReviewer=ST,s.setProcedureStepDefaultReviewers=AT,s.setProcedureStepEvent=vT,s.setProcedureStepEvents=VT,s.setProcedureStepFieldValues=EI,s.setProcedureStepFieldValuesAttachment=fI,s.setProcedureStepFieldValuesAttachments=SI,s.setProcedureStepFieldValuesMany=vI,s.setProcedureStepFieldValuesReview=HI,s.setProcedureStepFieldValuesReviews=GI,s.setProcedureStepFields=aI,s.setProcedureStepFieldsAttachment=GT,s.setProcedureStepFieldsAttachments=NT,s.setProcedureStepFieldsMany=nI,s.setProcedureStepReviewer=iO,s.setProcedureStepReviewers=aO,s.setProcedureSteps=fO,s.setProcedureType=NP,s.setProcedureTypeAttachment=EO,s.setProcedureTypeAttachments=vO,s.setProcedureTypeFields=aP,s.setProcedureTypeFieldsAttachment=GO,s.setProcedureTypeFieldsAttachments=NO,s.setProcedureTypeFieldsMany=nP,s.setProcedureTypes=KP,s.setProcedures=pA,s.setProject=CS,s.setProjectAccess=qf,s.setProjectAccesses=Cf,s.setProjectAttachment=Zf,s.setProjectAttachments=Jf,s.setProjectComment=lS,s.setProjectComments=oS,s.setProjectFile=PS,s.setProjectFiles=bS,s.setProjects=qS,s.setRehydrated=og,s.setTeam=Ib,s.setTeamMembership=cb,s.setTeamMemberships=rb,s.setTeams=Ob,s.setTokens=BF,s.setUser=Hm,s.setUsers=Lm,s.teamMembershipReducer=hb,s.teamMembershipSlice=Qa,s.teamReducer=wb,s.teamSlice=xa,s.updateAsset=Wn,s.updateAssetAttachment=Pn,s.updateAssetAttachments=bn,s.updateAssetComment=jn,s.updateAssetComments=Dn,s.updateAssetType=Jr,s.updateAssetTypeAttachment=dc,s.updateAssetTypeAttachments=uc,s.updateAssetTypeFieldValues=ur,s.updateAssetTypeFieldValuesAttachment=Xc,s.updateAssetTypeFieldValuesAttachments=Zc,s.updateAssetTypeFieldValuesMany=lr,s.updateAssetTypeFields=Dc,s.updateAssetTypeFieldsAttachment=Pc,s.updateAssetTypeFieldsAttachments=bc,s.updateAssetTypeFieldsMany=qc,s.updateAssetTypeIdentifier=br,s.updateAssetTypeIdentifierValue=qr,s.updateAssetTypeIdentifierValues=Cr,s.updateAssetTypeIdentifiers=Fr,s.updateAssetTypeStatus=od,s.updateAssetTypeStatuses=hd,s.updateAssetTypes=Qr,s.updateAssets=Yn,s.updateConversation=mn,s.updateConversations=SF,s.updateDocument=Ld,s.updateDocumentAttachment=Rd,s.updateDocumentAttachments=wd,s.updateDocuments=Hd,s.updateEmailDomain=su,s.updateEmailDomains=iu,s.updateForm=El,s.updateFormIdentifier=fu,s.updateFormIdentifierValue=Eu,s.updateFormIdentifierValues=vu,s.updateFormIdentifiers=Su,s.updateFormRevision=il,s.updateFormRevisionAttachment=Gu,s.updateFormRevisionAttachments=Nu,s.updateFormRevisions=al,s.updateFormSubmission=yo,s.updateFormSubmissionFieldValues=eo,s.updateFormSubmissionFieldValuesAttachment=Hl,s.updateFormSubmissionFieldValuesAttachments=Gl,s.updateFormSubmissionFieldValuesMany=to,s.updateFormSubmissions=mo,s.updateFormSubscriber=fl,s.updateFormSubscribers=Sl,s.updateForms=vl,s.updateGeoImage=Vo,s.updateGeoImages=Bo,s.updateIssue=Wh,s.updateIssueAssociation=Go,s.updateIssueAssociations=No,s.updateIssueAttachment=rh,s.updateIssueAttachments=dh,s.updateIssueComment=jh,s.updateIssueCommentAttachment=Oh,s.updateIssueCommentAttachments=Ph,s.updateIssueComments=Dh,s.updateIssueType=um,s.updateIssueTypeAttachment=rp,s.updateIssueTypeAttachments=dp,s.updateIssueTypeFieldValues=jp,s.updateIssueTypeFieldValuesAttachment=dy,s.updateIssueTypeFieldValuesAttachments=uy,s.updateIssueTypeFieldValuesMany=Dp,s.updateIssueTypeFields=Xp,s.updateIssueTypeFieldsAttachment=Op,s.updateIssueTypeFieldsAttachments=Pp,s.updateIssueTypeFieldsMany=Zp,s.updateIssueTypeIdentifier=Py,s.updateIssueTypeIdentifierValue=Dy,s.updateIssueTypeIdentifierValues=qy,s.updateIssueTypeIdentifiers=by,s.updateIssueTypePriorities=Jy,s.updateIssueTypePriority=Zy,s.updateIssueTypeStatus=bm,s.updateIssueTypeStatuses=Fm,s.updateIssueTypes=lm,s.updateIssueUpdate=zm,s.updateIssueUpdates=jm,s.updateIssues=Yh,s.updateOrganization=Tf,s.updateOrganizationAccess=af,s.updateOrganizationAccesses=nf,s.updateOrganizations=Af,s.updateProcedure=yA,s.updateProcedureFieldValues=BP,s.updateProcedureFieldValuesAttachment=TP,s.updateProcedureFieldValuesAttachments=IP,s.updateProcedureFieldValuesMany=zP,s.updateProcedureInitiative=tA,s.updateProcedureInitiatives=sA,s.updateProcedureStep=TO,s.updateProcedureStepAssignee=vA,s.updateProcedureStepAssignees=VA,s.updateProcedureStepComment=NA,s.updateProcedureStepComments=KA,s.updateProcedureStepDefaultAssignee=nT,s.updateProcedureStepDefaultAssignees=cT,s.updateProcedureStepDefaultReviewer=TT,s.updateProcedureStepDefaultReviewers=IT,s.updateProcedureStepEvent=BT,s.updateProcedureStepEvents=zT,s.updateProcedureStepFieldValues=VI,s.updateProcedureStepFieldValuesAttachment=AI,s.updateProcedureStepFieldValuesAttachments=TI,s.updateProcedureStepFieldValuesMany=BI,s.updateProcedureStepFieldValuesReview=NI,s.updateProcedureStepFieldValuesReviews=KI,s.updateProcedureStepFields=cI,s.updateProcedureStepFieldsAttachment=KT,s.updateProcedureStepFieldsAttachments=WT,s.updateProcedureStepFieldsMany=rI,s.updateProcedureStepReviewer=nO,s.updateProcedureStepReviewers=cO,s.updateProcedureSteps=IO,s.updateProcedureType=WP,s.updateProcedureTypeAttachment=VO,s.updateProcedureTypeAttachments=BO,s.updateProcedureTypeFields=cP,s.updateProcedureTypeFieldsAttachment=KO,s.updateProcedureTypeFieldsAttachments=WO,s.updateProcedureTypeFieldsMany=rP,s.updateProcedureTypes=YP,s.updateProcedures=mA,s.updateProject=LS,s.updateProjectAccess=$f,s.updateProjectAccesses=Uf,s.updateProjectAttachment=Qf,s.updateProjectAttachments=xf,s.updateProjectComment=hS,s.updateProjectComments=pS,s.updateProjectFile=gS,s.updateProjectFiles=MS,s.updateProjects=kS,s.updateTeam=Pb,s.updateTeamMembership=db,s.updateTeamMemberships=ub,s.updateTeams=bb,s.updateUser=Km,s.updateUsers=Nm,s.useSelectorBuilder=pF,s.userReducer=Ym,s.userSlice=Ji,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})}));
13
+ external URLs and therefore not prepended with VITE_API_URL.`;throw new Error(f)}return await this.cacheFile(p),p}processPresignedUrl(e,i){if("warning"in i){if(i.warning==="already_uploaded")return Promise.resolve(void 0);throw console.error(i.warning),new Error(i.warning)}return this.enqueueRequest({url:i.url,description:"Upload file to S3",method:o.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:e,blockers:[`s3-${i.fields.key}`,"s3-presigned-upload"],blocks:[e,"s3-presigned-upload"],s3url:i})}processPresignedUrls(e){const i={};for(const[a,n]of Object.entries(e))i[a]=this.processPresignedUrl(a,n);return i}async getFilePayload(e){const a={sha1:await ss(e),file_type:e.type,extension:Ub(e),size:e.size};return await this.client.files.cacheFile(e),a}async cachePresignedUrl(e,i){if(an.has(e))return;const a=await this.getDB();!!await a.get("presignedUrls",e)?console.warn(`Attempting to add a presigned url already cached, ${i}`):await a.put("presignedUrls",i,e),an.add(e)}async uncachePresignedUrl(e){await(await this.getDB()).delete("presignedUrls",e),an.delete(e)}async getPresignedUrlFromCache(e){const i=await(await this.getDB()).get("presignedUrls",e);if(!i)return;if(Wb(i)){await this.uncachePresignedUrl(e);return}return i}}class Wg extends M{name="Form Identifier";url="/form-identifiers";actions={addOne:ou,addMany:hu,setOne:pu,setMany:yu,updateOne:mu,updateMany:fu,deleteOne:Su,deleteMany:Au,initialize:lu};selectors={selectById:Iu,selectByIds:Ou};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[r.form],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected form identifier with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected form identifier with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{form__organization:e}},i);return this.dispatch(a(n)),n}}class Xg extends M{name="Form Identifier Value";url="/form-identifier-values";actions={addOne:_u,addMany:gu,setOne:Mu,setMany:Ru,updateOne:wu,updateMany:Eu,deleteOne:vu,deleteMany:Vu,initialize:Fu};selectors={selectById:zu,selectByIds:ju};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[e.form_submission,e.form_identifier],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected form identifier value with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await Promise.all([this.listPaginated({queryParams:{latest:!0,form_submission__organization:e}},i),this.listPaginated({queryParams:{latest:!0,form_submission__project__organization:e}},i)])).flatMap(d=>d.flat());return this.dispatch(a(c)),c}}class Yg extends v{name="Form Revision Attachment";url="/form-revision-attachments";actions={addOne:$u,addMany:Uu,setOne:ku,setMany:Lu,updateOne:Hu,updateMany:Gu,deleteOne:Nu,deleteMany:Ku,initialize:Cu};selectors={selectById:Xu,selectByIds:Yu};getId(e){return e.uuid}getBlockers(e){return[e.form_revision]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){const{uuid:i,field_identifier:a,form_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,form_revision:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,form_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,form_revision:n,file_sha1:c,file_name:d,file_extension:r}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{form_revision__form__organization:e}},i);return this.dispatch(a(n)),n}}class Zg extends M{name="Form Revision";url="/form-revisions";actions={addOne:xu,addMany:Gs,setOne:el,setMany:tl,updateOne:sl,updateMany:il,deleteOne:al,deleteMany:Ns,initialize:Qu};selectors={selectById:cl,selectByIds:rl};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[e.form],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{form__organization:e}},i);return this.dispatch(a(n)),n}}class Jg extends M{name="Form";url="/forms";actions={addOne:_l,addMany:gl,setOne:Ml,setMany:Rl,updateOne:wl,updateMany:El,deleteOne:vl,deleteMany:Vl,initialize:Fl};selectors={selectById:jl,selectByIds:Dl};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=new Date().toISOString(),d=this.select(h=>h.userReducer.currentUser?.id??null),r=l.uuidObj({...e,submitted_at:c,created_by:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected form with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error("Expected form to exist");const d=this.select(To(e)),r=this.select(dl(e)),p=this.select(Ol(e));this.dispatch(i(e)),this.dispatch(ct(l.toUuidArray(d))),this.dispatch(Ns(l.toUuidArray(r))),this.dispatch(Xs(l.toUuidArray(p)));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(a(c)),this.dispatch(Gs(r)),this.dispatch(nt(d)),this.dispatch(Ws(p)),h}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{organization:e}},i);return this.dispatch(a(n)),n}}class Qg extends M{name="Form Subscriber";url="/form-subscribers";actions={addOne:hl,addMany:Ws,setOne:pl,setMany:yl,updateOne:ml,updateMany:fl,deleteOne:Sl,deleteMany:Xs,initialize:ol};selectors={selectById:Tl,selectByIds:Il};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=new Date().toISOString(),d=this.select(h=>h.userReducer.currentUser?.id??null),r=l.uuidObj({...e,created_by:d,submitted_at:c});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[r.form],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected form subscriber with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{form__organization:e}},i);return this.dispatch(a(n)),n}}class xg extends v{name="Form Submission Field Values Attachment";url="/form-submission-field-values-attachments";actions={addOne:$l,addMany:Qs,setOne:Ul,setMany:kl,updateOne:Ll,updateMany:Hl,deleteOne:Gl,deleteMany:xs,initialize:Cl};selectors={selectById:Nl,selectByIds:si};getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}async bulkDelete(e){const{deleteMany:i,addMany:a}=this.actions,n=this.select(si(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(a(n)),c}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await Promise.all([this.listPaginated({queryParams:{latest:!0,field_values__form_submission__organization:e}},i),this.listPaginated({queryParams:{latest:!0,field_values__form_submission__project__organization:e}},i)])).flatMap(d=>d.flat());return this.dispatch(a(c)),c}}class eM extends M{name="Form Submission Field Values";url="/form-submission-field-values";actions={addOne:Zl,addMany:ai,setOne:Jl,setMany:Ql,updateOne:xl,updateMany:eo,deleteOne:to,deleteMany:ni,initialize:Yl};selectors={selectById:io,selectByIds:ao};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[r.form_submission],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await Promise.all([this.listPaginated({queryParams:{latest:!0,form_submission__organization:e}},i),this.listPaginated({queryParams:{latest:!0,form_submission__project__organization:e}},i)])).flatMap(d=>d.flat());return this.dispatch(a(c)),c}}class tM extends M{name="Form Submission";url="/form-submissions";actions={addOne:ho,addMany:nt,setOne:lo,setMany:oo,updateOne:po,updateMany:yo,deleteOne:mo,deleteMany:ct,initialize:uo};selectors={selectById:So,selectByIds:Ao};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d}),p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[e.form_revision],blocks:[r.uuid]});return this.dispatch(i(r)),p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected submission with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${c.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const d=this.select(no(e)),r=d.flatMap(({uuid:p})=>this.select(Kl(p)));this.dispatch(i(e)),this.dispatch(ni(l.toUuidArray(d))),this.dispatch(xs(l.toUuidArray(r)));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(a(c)),this.dispatch(ai(d)),this.dispatch(Qs(r)),p}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await Promise.all([this.listPaginated({queryParams:{organization:e}},i),this.listPaginated({queryParams:{project__organization:e}},i)])).flatMap(d=>d.flat());return this.dispatch(a(c)),c}}class sM extends v{name="Geo Image";url="/geo-images";actions={addOne:wo,addMany:Eo,setOne:Mo,setMany:Ro,updateOne:vo,updateMany:Vo,deleteOne:Bo,deleteMany:zo,initialize:go};selectors={selectById:Do,selectByIds:qo};getId(e){return e.uuid}getBlockers(e){return[e.project]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_sha1:e.file_sha1,file_name:e.file_name,file_extension:e.file_extension,title:e.title,description:e.description,geo_marker:e.geo_marker,direction:e.direction,original_date:e.original_date,project:e.project}}buildBulkPayload(e){return{uuid:e.uuid,file_sha1:e.file_sha1,file_name:e.file_name,file_extension:e.file_extension,title:e.title,description:e.description,geo_marker:e.geo_marker,direction:e.direction,original_date:e.original_date,project:e.project}}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Geo image with uuid ${e.uuid} does not exist in the store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{project:e}},i);return this.dispatch(a(n)),n}}class iM extends M{name="Issue Association";url="/issue-associations";actions={addOne:No,addMany:yt,setOne:Lo,setMany:ko,updateOne:Ho,updateMany:Go,deleteOne:Ko,deleteMany:mt,initialize:Uo};selectors={selectById:Xo,selectByIds:Yo};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=new Date().toISOString(),d=this.select(h=>h.userReducer.currentUser?.id??null),r=l.uuidObj({...e,submitted_at:c,created_by:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[e.issue,e.asset],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}bulkAdd(e){const{addMany:i,deleteMany:a,updateMany:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=e.map(h=>l.uuidObj({...h,submitted_at:d,created_by:c}));this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{payloads:r.map(h=>g(h)),submitted_at:d},blockers:r.flatMap(h=>[h.issue,h.asset]),blocks:l.toUuidArray(r)});return p.then(h=>{this.dispatch(n(h))}).catch(()=>{this.dispatch(a(l.toUuidArray(r)))}),[r,p]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{issue__project:e}},i)).flat();return this.dispatch(a(c)),c}}class aM extends v{name="Issue Attachment";url="/issue-attachments";actions={addOne:ih,addMany:hi,setOne:ah,setMany:nh,updateOne:ch,updateMany:rh,deleteOne:dh,deleteMany:pi,initialize:sh};selectors={selectById:oh,selectByIds:hh};getId(e){return e.uuid}getBlockers(e){return[e.issue]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue:e.issue}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue:e.issue}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{issue__project:e}},i)).flat();return this.dispatch(a(c)),c}}class nM extends v{name="Issue Comment Attachment";url="/issue-comment-attachments";actions={addOne:fh,addMany:Sh,setOne:Ah,setMany:Th,updateOne:Ih,updateMany:Oh,deleteOne:Ph,deleteMany:bh,initialize:mh};selectors={selectById:_h,selectByIds:gh};getId(e){return e.uuid}getBlockers(e){return[e.issue_comment]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue_comment:e.issue_comment}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue_comment:e.issue_comment}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{issue_comment__issue__project:e}},i)).flat();return this.dispatch(a(c)),c}}class cM extends M{name="Issue Comment";url="/issue-comments";actions={addOne:Eh,addMany:vh,setOne:Vh,setMany:Bh,updateOne:zh,updateMany:jh,deleteOne:Dh,deleteMany:qh,initialize:wh};selectors={selectById:Ch,selectByIds:$h};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser.id),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(c),blockers:[e.issue],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{issue__project:e}},i)).flat();return this.dispatch(a(c)),c}}class rM extends M{name="Issue";url="/issues";actions={addOne:Hh,addMany:Ii,setOne:Gh,setMany:Nh,updateOne:Kh,updateMany:Wh,deleteOne:Xh,deleteMany:Oi,initialize:Lh};selectors={selectById:Zh,selectByIds:Jh};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=new Date().toISOString(),d=this.select(h=>h.userReducer.currentUser?.id??null),r=l.uuidObj({...e,submitted_at:c,created_by:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[r.project,r.issue_type,r.status,r.priority],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(h=>{throw this.dispatch(n(r.uuid)),h}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const c={...n,...e};this.dispatch(i(c));const d={};for(const h of[l.IssueUpdateChange.TITLE,l.IssueUpdateChange.DESCRIPTION,l.IssueUpdateChange.STATUS,l.IssueUpdateChange.PRIORITY,l.IssueUpdateChange.ASSIGNED_TO,l.IssueUpdateChange.DUE_DATE])if(h in e&&e[h]!==n[h])switch(h){case l.IssueUpdateChange.PRIORITY:{const f=e[h],A=this.select(qi(f));if(!A)throw new Error(`Trying to update issue type priority with ${f} which does not exist in store`);d[h]={name:A.name,color:A.color,uuid:A.uuid};break}case l.IssueUpdateChange.DUE_DATE:d[h]=e.due_date;break;case l.IssueUpdateChange.DESCRIPTION:d[h]=e.description??"";break;case l.IssueUpdateChange.TITLE:d[h]=e.title??"";break;case l.IssueUpdateChange.STATUS:{const f=e[h],A=this.select(Li(f));if(!A)throw new Error(`Trying to update issue type status with ${f} which does not exist in store`);d[h]={name:A.name,color:A.color,uuid:A.uuid};break}case l.IssueUpdateChange.ASSIGNED_TO:{const f=e[h];if(f===null)d[h]=null;else{const A=this.select(Xt(f));if(!A)throw new Error(`Trying to update assigned to with ${f} which does not exist in store.`);d[h]={full_name:A.username,id:A.id}}break}}const r=l.uuidObj({created_by:this.select(h=>h.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString(),issue:n.uuid,changes:d});this.dispatch(Gi(r));const p=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return p.then(h=>{this.dispatch(i(h))}).catch(()=>{this.dispatch(i(n)),this.dispatch(Ki(r.uuid))}),[c,p]}bulkUpdate(e,i){const{updateMany:a}=this.actions,{selectByIds:n}=this.selectors,c=l.toUuidArray(e);if(new Set(c).size!==e.length)throw new Error("payloads contains duplicate uuids.");const d=this.select(n(c));if(c.length!=d.length)throw new Error(`Attempting to bulk update ${c.length-d.length} issues that dont exist in the store`);const r=d.toSorted((S,O)=>l.uuidSortFn(S.uuid,O.uuid)),p=e.toSorted((S,O)=>l.uuidSortFn(S.uuid,O.uuid)),h=[];for(let S=0;S<c.length;S++)h.push({...r[S],...p[S]});this.dispatch(a(h));const f=l.chunkArray(e,Math.min(i??e.length,q)),A=[];let T=null;for(const S of f){const O=at.v4(),_=l.toUuidArray(S),F=S.map(({status:R})=>R).filter(Boolean),w=S.map(({priority:R})=>R).filter(Boolean),V=this.enqueueRequest({description:m(o.PATCH,this.name,!0),method:o.PATCH,url:`${this.url}/bulk/`,payload:{payloads:S},blockers:(T?[T]:[]).concat(_).concat(F).concat(w),blocks:[O].concat(_)});A.push(V),T=O}return Promise.all(A).then(S=>{this.dispatch(a(S.flat()))}).catch(()=>{this.dispatch(a(d))}),[h,A]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`No issue with uuid ${e} found in the store`);const d=this.select(Jo(e)),r=this.select(lh(e)),p=this.select(qm(e)),h=this.select(Io(e));this.dispatch(i(e)),this.dispatch(pi(l.toUuidArray(r))),this.dispatch(Wi(l.toUuidArray(p))),this.dispatch(mt(l.toUuidArray(d))),this.dispatch(ct(l.toUuidArray(h)));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(f){throw this.dispatch(a(c)),this.dispatch(hi(r)),this.dispatch(Ni(p)),this.dispatch(yt(d)),this.dispatch(nt(h)),f}}async bulkDelete(e){const{addMany:i,deleteMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e)),d=this.select(Zo(e)),r=this.select(Oo(e));this.dispatch(a(e)),this.dispatch(mt(l.toUuidArray(d))),this.dispatch(ct(l.toUuidArray(r)));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(p){throw this.dispatch(i(c)),this.dispatch(yt(d)),this.dispatch(nt(r)),p}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}class dM extends v{name="Issue Type Attachment";url="/issue-type-attachments";actions={addOne:sp,addMany:ip,setOne:ap,setMany:np,updateOne:cp,updateMany:rp,deleteOne:dp,deleteMany:up,initialize:tp};selectors={selectById:op,selectByIds:hp};getId(e){return e.uuid}getBlockers(e){return[e.issue_type]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue_type:e.issue_type}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,issue_type:e.issue_type}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{issue_type__organization:e}},i);return this.dispatch(a(n)),n}}class uM extends v{name="Issue Type Fields Attachment";url="/issue-type-fields-attachments";actions={addOne:fp,addMany:Sp,setOne:Ap,setMany:Tp,updateOne:Ip,updateMany:Op,deleteOne:Pp,deleteMany:bp,initialize:mp};selectors={selectById:_p,selectByIds:gp};getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){const{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{fields_revision__issue_type__organization:e}},i);return this.dispatch(a(n)),n}}class lM extends M{name="Issue Type Fields";url="/issue-type-fields";actions={addOne:Gp,addMany:Np,setOne:Kp,setMany:Wp,updateOne:Xp,updateMany:Yp,deleteOne:Zp,deleteMany:Jp,initialize:Hp};selectors={selectById:xp,selectByIds:ey};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[r.issue_type],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(h=>{throw this.dispatch(n(r.uuid)),h}),[r,p]}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{issue_type__organization:e}},i);return this.dispatch(a(n)),n}}class oM extends v{name="Issue Type Field Values Attachment";url="/issue-type-field-values-attachments";actions={addOne:ay,addMany:wi,setOne:ny,setMany:cy,updateOne:ry,updateMany:dy,deleteOne:uy,deleteMany:Ei,initialize:iy};selectors={selectById:oy,selectByIds:hy};getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}async bulkDelete(e){const{deleteMany:i,addMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{field_values__issue__project:e,latest:!0}},i)).flat();return this.dispatch(a(c)),c}}class hM extends M{name="Issue Type Field Values";url="/issue-type-field-values";actions={addOne:Ep,addMany:vp,setOne:Vp,setMany:Bp,updateOne:zp,updateMany:jp,deleteOne:Dp,deleteMany:qp,initialize:wp};selectors={selectById:$p,selectByIds:Up};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d}),p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[e.issue,e.fields_revision],blocks:[r.uuid]});return this.dispatch(i(r)),p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected IssueTypeFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[c.uuid,c.fields_revision,c.issue],blocks:[c.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const d=this.select(py(e));this.dispatch(i(e)),this.dispatch(Ei(l.toUuidArray(d)));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(c)),this.dispatch(wi(d)),r}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{issue__project:e,latest:!0}},i)).flat();return this.dispatch(a(c)),c}}class pM extends M{name="Issue Type Identifier";url="/issue-type-identifiers";actions={addOne:Sy,addMany:Ay,setOne:Ty,setMany:Iy,updateOne:Oy,updateMany:Py,deleteOne:by,deleteMany:Fy,initialize:fy};selectors={selectById:gy,selectByIds:My};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[r.issue_type],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected issue type identifier with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected issue type identifier with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{issue_type__organization:e}},i);return this.dispatch(a(n)),n}}class yM extends M{name="Issue Type Identifier Value";url="/issue-type-identifier-values";actions={addOne:vy,addMany:Vy,setOne:By,setMany:zy,updateOne:jy,updateMany:Dy,deleteOne:qy,deleteMany:Cy,initialize:Ey};selectors={selectById:Uy,selectByIds:ky};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[e.issue,e.issue_type_identifier],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected issue type identifier value with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{issue__project:e,latest:!0}},i)).flat();return this.dispatch(a(c)),c}}class mM extends M{name="Issue Type Priority";url="/issue-type-priorities";actions={addOne:Ny,addMany:Ky,setOne:Wy,setMany:Xy,updateOne:Yy,updateMany:Zy,deleteOne:Jy,deleteMany:Qy,initialize:Gy};selectors={selectById:qi,selectByIds:em};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[e.issue_type],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected an existing issue type priority with uuid ${e.uuid}`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`No issue type priority with uuid ${e} found in the store`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{issue_type__organization:e}},i);return this.dispatch(a(n)),n}}class fM extends M{name="Issue Type";url="/issue-types";actions={addOne:am,addMany:nm,setOne:cm,setMany:rm,updateOne:dm,updateMany:um,deleteOne:lm,deleteMany:om,initialize:im};selectors={selectById:pm,selectByIds:ym};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,submitted_at:d,created_by:c});this.dispatch(i(r));const p=this.enqueueRequest({method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`IssueType with uuid ${e.uuid} does not exist in the store.`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{addOne:i,deleteOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const d=this.select(Qh(e));this.dispatch(a(e)),this.dispatch(Oi(l.toUuidArray(d)));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(i(c)),this.dispatch(Ii(d)),r}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{organization:e}},i);return this.dispatch(a(n)),n}}class SM extends M{name="Issue Type Status";url="/issue-type-statuses";actions={addOne:Am,addMany:Tm,setOne:Im,setMany:Om,updateOne:Pm,updateMany:bm,deleteOne:Fm,deleteMany:_m,initialize:Sm};selectors={selectById:Li,selectByIds:Mm};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[e.issue_type],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected an existing issue type status with uuid ${e.uuid}`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`No issue type status with uuid ${e} found in the store`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{issue_type__organization:e}},i);return this.dispatch(a(n)),n}}class AM extends M{name="Issue Update";url="/issue-updates";actions={addOne:Gi,addMany:Ni,setOne:vm,setMany:Vm,updateOne:Bm,updateMany:zm,deleteOne:Ki,deleteMany:Wi,initialize:Em};selectors={selectById:jm,selectByIds:Dm};async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{issue__project:e}},i)).flat();return this.dispatch(a(c)),c}}const TM=1800;function IM(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 OM extends Xb{_getRenewedTokens=async e=>{const i=this.performRequest({method:o.POST,url:this.refreshTokensUrl,payload:{refresh:e},isAuthNeeded:!1,checkAuth:!1});let a;try{a=await i}catch(n){console.error("Could not renew tokens; clearing auth",n),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(Td(!1)),this.clearTokens(),this.dispatch(I()),this.dispatch(I())}async renewTokens(){const e=this.getRefreshToken();if(!e)throw new Error("No refresh token found");console.debug(this.constructor.name,"renewing tokens");try{const i=await this._getRenewedTokens(e);if(!i)return;console.debug("Got renewed tokens"),this.setTokens(i)}catch(i){throw console.error("Could not renew tokens; clearing auth",i),this.clearAuth(),i}}tokenIsExpiringSoon(){const e=this.getAccessToken();if(!e)return!1;const i=Date.now()/1e3;let a;try{a=uF(e).exp??i}catch{a=i}return a-i<TM}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 z&&this.clearAuth(),e instanceof Error?Promise.reject(e):Promise.reject(new Error((e??l.ERROR_MSG_UNEXPECTED).toString()))}}}async handleUnauthorized(e,i){if(e.url.endsWith("/token/refresh/"))throw this.select(a=>a.authReducer.isLoggedIn)&&console.warn("No signed-in user to sign out."),this.clearAuth(),new z({message:"You have been signed out due to inactivity.",response:i,discard:!0});if(this.select(a=>a.authReducer.isLoggedIn))await this.renewTokens();else throw console.debug("Forbidden; user is not logged in."),new z({message:"Incorrect username or password.",response:i,discard:!0})}async initAuth(e){const i=at.v4();return console.debug(this.constructor.name,"Initiating auth"),this.performRequest({uuid:i,method:o.POST,url:this.initTokensUrl,payload:e,isAuthNeeded:!1,checkAuth:!1}).then(a=>{this.setTokens(IM(a))})}}class PM extends ot{name="Organization Access";url="/organization-accesses";actions={addOne:Qm,addMany:xm,setOne:ef,setMany:tf,updateOne:sf,updateMany:af,deleteOne:nf,deleteMany:cf,initialize:Jm};selectors={selectById:df,selectByIds:uf};update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid)),c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(r=>{throw this.dispatch(i(n)),r}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e)),d=this.select(Xt(c.user));this.dispatch(i(c.uuid)),this.dispatch(Qi(c.user));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${c.uuid}/`,blockers:[c.uuid],blocks:[]})}catch(r){throw this.dispatch(a(c)),this.dispatch(Ji(d)),r}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{organization:e}},i);return this.dispatch(a(n)),n}}class bM extends ot{name="Organization";url="/organizations";actions={addOne:ff,addMany:mf,setOne:yf,setMany:pf,updateOne:Af,updateMany:Sf,deleteOne:Tf,deleteMany:If,initialize:hf};selectors={selectById:bf,selectByIds:Ff};async add(e){const{addOne:i}=this.actions,a=await this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:e,blockers:[],blocks:[]});return this.dispatch(i(a)),a}async update(e){const{updateOne:i}=this.actions,a=await this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return this.dispatch(i(a)),a}async invite(e,i){return this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/${e}/invite/${i}/`,blockers:[],blocks:[]})}async refreshStore(e){const{initialize:i}=this.actions,a=await this.list({},e);return this.dispatch(i(a)),a}}class FM extends M{name="Project Access";url="/project-accesses";actions={addOne:zf,addMany:jf,setOne:Df,setMany:qf,updateOne:Cf,updateMany:$f,deleteOne:Uf,deleteMany:kf,initialize:Bf};selectors={selectById:Hf,selectByIds:Gf};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null)});this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(c),blockers:[c.organization_access,c.project],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(r=>{throw this.dispatch(n(c.uuid)),r}),[c,d]}bulkAdd(e){const{addMany:i,deleteMany:a,updateMany:n}=this.actions,c=this.select(p=>p.userReducer.currentUser?.id??null),d=e.map(p=>l.uuidObj({...p,created_by:c}));this.dispatch(i(d));const r=this.enqueueRequest({description:m(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{project_accesses:d.map(p=>g(p))},blockers:d.flatMap(p=>[p.project,p.organization_access]),blocks:d.map(p=>p.uuid)});return r.then(p=>{this.dispatch(n(p))}).catch(p=>{throw this.dispatch(a(d.map(h=>h.uuid))),p}),[d,r]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid)),c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[]});return d.then(r=>{this.dispatch(i(r))}).catch(r=>{throw this.dispatch(i(n)),r}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{project__organization:e}},i);return this.dispatch(a(n)),n}}class _M extends v{name="Project Attachment";url="/project-attachments";actions={addOne:Wf,addMany:Xf,setOne:Yf,setMany:Zf,updateOne:Jf,updateMany:Qf,deleteOne:xf,deleteMany:eS,initialize:Kf};selectors={selectById:sS,selectByIds:iS};getId(e){return e.uuid}getBlockers(e){return[e.project]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,project:e.project}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,project:e.project}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{project__organization:e}},i);return this.dispatch(a(n)),n}}class gM extends M{name="Project Comment";url="/project-comments";actions={addOne:rS,addMany:dS,setOne:uS,setMany:lS,updateOne:oS,updateMany:hS,deleteOne:pS,deleteMany:yS,initialize:cS};selectors={selectById:fS,selectByIds:SS};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(c),blockers:[c.project],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Project comment with uuid ${e.uuid} not found in store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Project comment with uuid ${e} not found in store`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}class MM extends v{name="Project File";url="/project-files";actions={addOne:bS,addMany:FS,setOne:OS,setMany:PS,updateOne:_S,updateMany:gS,deleteOne:MS,deleteMany:RS,initialize:IS};selectors={selectById:vS,selectByIds:VS};getId(e){return e.uuid}getBlockers(e){return[e.project]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_sha1:e.file_sha1,file_name:e.file_name,file_extension:e.file_extension,project:e.project,z_index:e.z_index,bounds:e.bounds}}buildBulkPayload(e){return{uuid:e.uuid,file_sha1:e.file_sha1,file_name:e.file_name,file_extension:e.file_extension,project:e.project,z_index:e.z_index,bounds:e.bounds}}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`${this.name} with uuid ${e.uuid} does not exist in the store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}class RM extends ot{name="Project";url="/projects";actions={addOne:$S,addMany:CS,setOne:qS,setMany:DS,updateOne:kS,updateMany:US,deleteOne:LS,deleteMany:HS,initialize:jS};selectors={selectById:KS,selectByIds:WS};async add(e){const{addOne:i}=this.actions,a=await this.performRequest({method:o.POST,url:`${this.url}/`,payload:g(e)});return this.dispatch(i(a)),a}async update(e){const{updateOne:i}=this.actions,a=await this.performRequest({method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:g(e)});return this.dispatch(i(a)),a}async delete(e){const{deleteOne:i}=this.actions,a=await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return this.dispatch(i(e)),a}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{organization:e}},i);return this.dispatch(a(n)),n}}class wM extends M{name="Procedure";url="/procedures";actions={addOne:lA,addMany:St,setOne:oA,setMany:hA,updateOne:pA,updateMany:yA,deleteOne:mA,deleteMany:At,initialize:uA};selectors={selectById:AA,selectByIds:TA};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(c),blockers:[c.procedure_type,c.project,c.asset,...c.procedure_initiative?[c.procedure_initiative]:[]],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}bulkAdd(e,i){const{store:a}=this.client,{addMany:n,updateMany:c,deleteMany:d}=this.actions,r=new Date().toISOString(),p=a.getState().userReducer.currentUser?.id??null,h=[],f=l.chunkArray(e,Math.min(i??e.length,q)),A=[];for(const S of f){const O=[],_=[],F=[];for(const V of S){const R=l.uuidObj({...V,submitted_at:r,created_by:p});h.push(R),O.push(g(R)),_.push(R.procedure_type,R.project,R.asset,...R.procedure_initiative?[R.procedure_initiative]:[]),F.push(R.uuid)}const w={payload:{submitted_at:r,payloads:O},blockers:_,blocks:F};A.push(w)}this.dispatch(n(h));const T=A.map(S=>{const{payload:O,blocks:_,blockers:F}=S;return this.enqueueRequest({description:m(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:O,blockers:F,blocks:_})});return Promise.all(T).then(S=>{this.dispatch(c(S.flat()))}).catch(()=>{this.dispatch(d(l.toUuidArray(h)))}),[h,Promise.all(T).then(S=>S.flat())]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected procedure with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected procedure with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async bulkDelete(e){const{addMany:i,deleteMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e));this.dispatch(a(l.toUuidArray(c)));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(i(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}class EM extends M{name="Procedure Step Assignee";url="/procedure-step-assignees";actions={addOne:gA,addMany:MA,setOne:RA,setMany:wA,updateOne:EA,updateMany:vA,deleteOne:VA,deleteMany:BA,initialize:_A};selectors={selectById:jA,selectByIds:DA};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(c),blockers:[c.procedure,c.procedure_step],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}bulkAdd(e){const{addMany:i,updateMany:a,deleteMany:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=e.map(h=>l.uuidObj({...h,created_by:c,submitted_at:d}));this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{procedure_step_assignees:r.map(h=>g(h)),submitted_at:d},blockers:r.flatMap(h=>[h.procedure,h.procedure_step]),blocks:l.toUuidArray(r)});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(l.toUuidArray(r)))}),[r,p]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected procedure step assignee with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async bulkDelete(e){const{deleteMany:i,addMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{procedure__project:e}},i)).flat();return this.dispatch(a(c)),c}}class vM extends M{name="Procedure Step Comment";url="/procedure-step-comments";actions={addOne:UA,addMany:kA,setOne:LA,setMany:HA,updateOne:GA,updateMany:NA,deleteOne:KA,deleteMany:WA,initialize:$A};selectors={selectById:YA,selectByIds:ZA};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(c),blockers:[c.procedure,c.procedure_step],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Procedure step comment with uuid ${e.uuid} not found in store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Procedure step comment with uuid ${e} not found in store`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{procedure__project:e}},i)).flat();return this.dispatch(a(c)),c}}class VM extends M{name="Procedure Step Default Assignee";url="/procedure-step-default-assignees";actions={addOne:eT,addMany:tT,setOne:sT,setMany:iT,updateOne:aT,updateMany:nT,deleteOne:cT,deleteMany:rT,initialize:xA};selectors={selectById:uT,selectByIds:lT};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(c),blockers:[c.procedure_step],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected procedure step default assignee with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{procedure_step__procedure_type__organization:e}},i);return this.dispatch(a(n)),n}}class BM extends M{name="Procedure Step Default Reviewer";url="/procedure-step-default-reviewers";actions={addOne:yT,addMany:mT,setOne:fT,setMany:ST,updateOne:AT,updateMany:TT,deleteOne:IT,deleteMany:OT,initialize:pT};selectors={selectById:bT,selectByIds:FT};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(c),blockers:[c.procedure_step],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected procedure step default reviewer with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{procedure_step__procedure_type__organization:e}},i);return this.dispatch(a(n)),n}}class zM extends ot{name="Procedure Step Event";url="/procedure-step-events";actions={addOne:RT,addMany:wT,setOne:ET,setMany:vT,updateOne:VT,updateMany:BT,deleteOne:zT,deleteMany:jT,initialize:MT};selectors={selectById:qT,selectByIds:CT};async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{procedure__project:e}},i)).flat();return this.dispatch(a(c)),c}}class jM extends v{name="Procedure Step Fields Attachment";url="/procedure-step-fields-attachments";actions={addOne:LT,addMany:Ia,setOne:HT,setMany:GT,updateOne:NT,updateMany:KT,deleteOne:WT,deleteMany:Oa,initialize:kT};selectors={selectById:ZT,selectByIds:JT};getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){return l.uuidObj({...e,created_by:this.select(i=>i.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()})}buildPayload(e){const{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{fields_revision__procedure_step__procedure_type__organization:e}},i);return this.dispatch(a(n)),n}}class DM extends M{name="Procedure Step Fields";url="/procedure-step-fields";actions={addOne:tI,addMany:sI,setOne:iI,setMany:aI,updateOne:nI,updateMany:cI,deleteOne:rI,deleteMany:dI,initialize:eI};selectors={selectById:uI,selectByIds:lI};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(c),blockers:[c.procedure_step],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected procedure step fields with uuid ${e} to exist`);const d=this.select(YT(e));this.dispatch(i(e)),this.dispatch(Oa(l.toUuidArray(d)));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(c)),this.dispatch(Ia(d)),r}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{procedure_step__procedure_type__organization:e}},i);return this.dispatch(a(n)),n}}class qM extends v{name="Procedure Step Field Values Attachment";url="/procedure-step-field-values-attachments";actions={addOne:yI,addMany:ga,setOne:mI,setMany:fI,updateOne:SI,updateMany:AI,deleteOne:TI,deleteMany:Ma,initialize:pI};selectors={selectById:OI,selectByIds:PI};getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}async bulkDelete(e){const{deleteMany:i,addMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{field_values__procedure__project:e,latest:!0}},i)).flat();return this.dispatch(a(c)),c}}class CM extends M{name="Procedure Step Field Values Review";url="/procedure-step-field-values-reviews";actions={addOne:kI,addMany:va,setOne:LI,setMany:HI,updateOne:GI,updateMany:NI,deleteOne:KI,deleteMany:Va,initialize:UI};selectors={selectById:XI,selectByIds:YI};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(c),blockers:[c.field_values],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Procedure step field values review with uuid ${e.uuid} not found in store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Procedure step field values review with uuid ${e} not found in store`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{field_values__procedure__project:e}},i)).flat();return this.dispatch(a(c)),c}}class $M extends M{name="Procedure Step Field Values";url="/procedure-step-field-values";actions={addOne:MI,addMany:RI,setOne:wI,setMany:EI,updateOne:vI,updateMany:VI,deleteOne:BI,deleteMany:zI,initialize:gI};selectors={selectById:qI,selectByIds:CI};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d}),p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[e.procedure,e.procedure_step,e.fields_revision],blocks:[r.uuid]});return this.dispatch(i(r)),p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}bulkAdd(e,i){const{addMany:a,updateMany:n,deleteMany:c}=this.actions,d=new Date().toISOString(),r=this.select(T=>T.userReducer.currentUser?.id??null),p=[],h=l.chunkArray(e,Math.min(i??e.length,q)),f=[];for(const T of h){const S=[],O=[],_=[];for(const F of T){const w=l.uuidObj({...F,values:F.values,created_by:r,submitted_at:d});p.push(w),S.push(g(w)),O.push(w.procedure_step,w.procedure,w.fields_revision),_.push(w.uuid)}f.push({payload:{payloads:S,submitted_at:d},blockers:O,blocks:_})}this.dispatch(a(p));const A=f.map(T=>{const{payload:S,blocks:O,blockers:_}=T;return this.enqueueRequest({description:m(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:S,blockers:_,blocks:O})});return Promise.all(A).then(T=>{this.dispatch(n(T.flat()))}).catch(()=>{this.dispatch(c(l.toUuidArray(p)))}),[p,Promise.all(A).then(T=>T.flat())]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected ProcedureStepFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[c.uuid,c.procedure,c.procedure_step,c.fields_revision],blocks:[c.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected ProcedureStepFieldValues with uuid ${e} to exist`);const d=this.select(bI(e)),r=this.select(ZI(e));this.dispatch(i(e)),this.dispatch(Ma(l.toUuidArray(d))),this.dispatch(Va(l.toUuidArray(r)));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(a(c)),this.dispatch(ga(d)),this.dispatch(va(r)),p}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{procedure__project:e}},i)).flat();return this.dispatch(a(c)),c}}class UM extends M{name="Procedure Step Reviewer";url="/procedure-step-reviewers";actions={addOne:eO,addMany:tO,setOne:sO,setMany:iO,updateOne:aO,updateMany:nO,deleteOne:cO,deleteMany:rO,initialize:xI};selectors={selectById:uO,selectByIds:lO};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(c),blockers:[c.procedure,c.procedure_step],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}bulkAdd(e){const{addMany:i,updateMany:a,deleteMany:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=e.map(h=>l.uuidObj({...h,created_by:c,submitted_at:d}));this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{procedure_step_reviewers:r.map(h=>g(h)),submitted_at:d},blockers:r.flatMap(h=>[h.procedure,h.procedure_step]),blocks:r.map(h=>h.uuid)});return p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(l.toUuidArray(r)))}),[r,p]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected procedure step reviewer with uuid ${e} to exist`);this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async bulkDelete(e){const{deleteMany:i,addMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{procedure__project:e}},i)).flat();return this.dispatch(a(c)),c}}class kM extends M{name="Procedure Initiative";url="/procedure-initiatives";actions={addOne:ZS,addMany:JS,setOne:QS,setMany:xS,updateOne:eA,updateMany:tA,deleteOne:sA,deleteMany:iA,initialize:YS};selectors={selectById:cA,selectByIds:rA};add(e){const{store:i}=this.client,{addOne:a,updateOne:n,deleteOne:c}=this.actions,d=l.uuidObj({...e,created_by:i.getState().userReducer.currentUser?.id??null,submitted_at:new Date().toISOString()});this.dispatch(a(d));const r=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(d),blockers:[d.procedure_type,d.project],blocks:[d.uuid]});return r.then(p=>{this.dispatch(n(p))}).catch(()=>{this.dispatch(c(d.uuid))}),[d,r]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected ${this.name} with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected ${this.name} with uuid ${e} to exist`);const d=this.select(bA(e));this.dispatch(i(e)),this.dispatch(At(l.toUuidArray(d)));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(c)),this.dispatch(St(d)),r}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{project:e}},i)).flat();return this.dispatch(a(c)),c}}class LM extends M{name="Procedure Step";url="/procedure-steps";actions={addOne:fO,addMany:SO,setOne:yO,setMany:mO,updateOne:AO,updateMany:TO,deleteOne:IO,deleteMany:OO,initialize:pO};selectors={selectById:bO,selectByIds:FO};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(c),blockers:[c.procedure_type],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`No procedure step with uuid ${e.uuid} found in the store`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${n.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{addOne:i,deleteOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`No procedure step with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(i(c)),d}}bulkUpdate(e,i){const{updateMany:a}=this.actions,{selectByIds:n}=this.selectors,c=l.toUuidArray(e);if(new Set(c).size!==e.length)throw new Error("payloads contains duplicate uuids.");const d=this.select(n(c));if(c.length!=d.length)throw new Error(`Attempting to bulk update ${c.length-d.length} ${this.name} that dont exist in the store`);const r=d.toSorted((S,O)=>l.uuidSortFn(S.uuid,O.uuid)),p=e.toSorted((S,O)=>l.uuidSortFn(S.uuid,O.uuid)),h=[];for(let S=0;S<c.length;S++)h.push({...r[S],...p[S]});this.dispatch(a(h));const f=l.chunkArray(e,Math.min(i??e.length,q)),A=[];let T=null;for(const S of f){const O=at.v4(),_=l.toUuidArray(S),F=this.enqueueRequest({description:m(o.PATCH,this.name,!0),method:o.PATCH,url:`${this.url}/bulk/`,payload:{payloads:S},blockers:(T?[T]:[]).concat(_),blocks:[O].concat(_)});A.push(F),T=O}return Promise.all(A).then(S=>{this.dispatch(a(S.flat()))}).catch(()=>{this.dispatch(a(d))}),[h,A]}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{procedure_type__organization:e}},i);return this.dispatch(a(n)),n}}class HM extends v{name="Procedure Type Attachment";url="/procedure-type-attachments";actions={addOne:MO,addMany:RO,setOne:wO,setMany:EO,updateOne:vO,updateMany:VO,deleteOne:BO,deleteMany:zO,initialize:gO};selectors={selectById:qO,selectByIds:CO};getId(e){return e.uuid}getBlockers(e){return[e.procedure_type]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){return{uuid:e.uuid,submitted_at:e.submitted_at,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,procedure_type:e.procedure_type}}buildBulkPayload(e){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:e.file_extension,procedure_type:e.procedure_type}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{procedure_type__organization:e}},i);return this.dispatch(a(n)),n}}class GM extends v{name="Procedure Type Fields Attachment";url="/procedure-type-fields-attachments";actions={addOne:kO,addMany:LO,setOne:HO,setMany:GO,updateOne:NO,updateMany:KO,deleteOne:WO,deleteMany:XO,initialize:UO};selectors={selectById:JO,selectByIds:QO};getId(e){return e.uuid}getBlockers(e){return[e.fields_revision]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){const{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,fields_revision:n,file_sha1:c,file_name:d,file_extension:r}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{fields_revision__procedure_type__organization:e}},i);return this.dispatch(a(n)),n}}class NM extends M{name="Procedure Type Fields";url="/procedure-type-fields";actions={addOne:tP,addMany:sP,setOne:iP,setMany:aP,updateOne:nP,updateMany:cP,deleteOne:rP,deleteMany:dP,initialize:eP};selectors={selectById:oP,selectByIds:hP};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d});this.dispatch(i(r));const p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[r.procedure_type],blocks:[r.uuid]});return p.then(h=>{this.dispatch(a(h))}).catch(h=>{throw this.dispatch(n(r.uuid)),h}),[r,p]}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{procedure_type__organization:e}},i);return this.dispatch(a(n)),n}}class KM extends v{name="Procedure Field Values Attachment";url="/procedure-field-values-attachments";actions={addOne:mP,addMany:Ha,setOne:fP,setMany:SP,updateOne:AP,updateMany:TP,deleteOne:IP,deleteMany:Ga,initialize:yP};selectors={selectById:bP,selectByIds:FP};getId(e){return e.uuid}getBlockers(e){return[e.field_values]}getBlocks(e){return[e.uuid]}buildModel(e){const i=this.select(n=>n.userReducer.currentUser?.id??null),a=new Date().toISOString();return l.uuidObj({...e,created_by:i,submitted_at:a})}buildPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,submitted_at:e.submitted_at,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}buildBulkPayload(e){const{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}=e;return{uuid:i,field_identifier:a,field_values:n,file_sha1:c,file_name:d,file_extension:r}}async bulkDelete(e){const{deleteMany:i,addMany:a}=this.actions,{selectByIds:n}=this.selectors,c=this.select(n(e));this.dispatch(i(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!0),method:o.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{field_values__procedure__project:e,latest:!0}},i)).flat();return this.dispatch(a(c)),c}}class WM extends M{name="Procedure Field Values";url="/procedure-field-values";actions={addOne:RP,addMany:wP,setOne:EP,setMany:vP,updateOne:VP,updateMany:BP,deleteOne:zP,deleteMany:jP,initialize:MP};selectors={selectById:CP,selectByIds:$P};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=this.select(h=>h.userReducer.currentUser?.id??null),d=new Date().toISOString(),r=l.uuidObj({...e,created_by:c,submitted_at:d}),p=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(r),blockers:[e.fields_revision,e.procedure],blocks:[r.uuid]});return this.dispatch(i(r)),p.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(n(r.uuid))}),[r,p]}bulkAdd(e,i){const{addMany:a,updateMany:n,deleteMany:c}=this.actions,d=new Date().toISOString(),r=this.select(T=>T.userReducer.currentUser?.id??null),p=[],h=l.chunkArray(e,Math.min(i??e.length,q)),f=[];for(const T of h){const S=[],O=[],_=[];for(const F of T){const w=l.uuidObj({...F,values:F.values,created_by:r,submitted_at:d});p.push(w),S.push(g(w)),O.push(w.procedure,w.fields_revision),_.push(w.uuid)}f.push({payload:{payloads:S,submitted_at:d},blockers:O,blocks:_})}this.dispatch(a(p));const A=f.map(T=>{const{payload:S,blocks:O,blockers:_}=T;return this.enqueueRequest({description:m(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:S,blockers:_,blocks:O})});return Promise.all(A).then(T=>{this.dispatch(n(T.flat()))}).catch(()=>{this.dispatch(c(l.toUuidArray(p)))}),[p,Promise.all(A).then(T=>T.flat())]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected ProcedureFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[c.fields_revision,c.procedure],blocks:[c.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const d=this.select(_P(e));this.dispatch(i(e)),this.dispatch(Ga(l.toUuidArray(d)));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(c)),this.dispatch(Ha(d)),r}}async refreshStore(e,i){const{initialize:a}=this.actions,c=(await this.listPaginated({queryParams:{procedure__project:e,latest:!0}},i)).flat();return this.dispatch(a(c)),c}}class XM extends M{name="Procedure Type";url="/procedure-types";actions={addOne:LP,addMany:HP,setOne:GP,setMany:NP,updateOne:KP,updateMany:WP,deleteOne:XP,deleteMany:YP,initialize:kP};selectors={selectById:QP,selectByIds:xP};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null),submitted_at:new Date().toISOString()});this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(c),blockers:[],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected procedure type with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{deleteOne:i,addOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected procedure type with uuid ${e} to exist`);const d=this.select(IA(e));this.dispatch(i(e)),this.dispatch(At(l.toUuidArray(d)));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(a(c)),this.dispatch(St(d)),r}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{organization:e}},i);return this.dispatch(a(n)),n}}class YM extends M{name="Team Membership";url="/team-memberships";actions={addOne:ib,addMany:ab,setOne:nb,setMany:cb,updateOne:rb,updateMany:db,deleteOne:ub,deleteMany:lb,initialize:sb};selectors={selectById:pb,selectByIds:yb};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,created_by:this.select(r=>r.userReducer.currentUser?.id??null)});this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(c),blockers:[e.team],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}bulkAdd(e){const{addMany:i,updateMany:a,deleteMany:n}=this.actions,c=this.select(p=>p.userReducer.currentUser?.id??null),d=e.map(p=>l.uuidObj({...p,created_by:c}));this.dispatch(i(d));const r=this.enqueueRequest({description:m(o.POST,this.name,!0),method:o.POST,url:`${this.url}/bulk/`,payload:{team_memberships:d.map(p=>g(p))},blockers:d.map(p=>p.team),blocks:d.map(p=>p.uuid)});return r.then(p=>{this.dispatch(a(p))}).catch(()=>{this.dispatch(n(d.map(p=>p.uuid)))}),[d,r]}async delete(e){const{addOne:i,deleteOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected team membership with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(d){throw this.dispatch(i(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{team__organization:e}},i);return this.dispatch(a(n)),n}}class ZM extends M{name="Team";url="/teams";actions={addOne:Sb,addMany:Ab,setOne:Tb,setMany:Ib,updateOne:Ob,updateMany:Pb,deleteOne:bb,deleteMany:Fb,initialize:fb};selectors={selectById:gb,selectByIds:Mb};add(e){const{addOne:i,updateOne:a,deleteOne:n}=this.actions,c=l.uuidObj({...e,submitted_at:new Date().toISOString(),created_by:this.select(r=>r.userReducer.currentUser?.id??null)});this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.POST,this.name,!1),method:o.POST,url:`${this.url}/`,payload:g(c),blockers:[],blocks:[c.uuid]});return d.then(r=>{this.dispatch(a(r))}).catch(()=>{this.dispatch(n(c.uuid))}),[c,d]}update(e){const{updateOne:i}=this.actions,{selectById:a}=this.selectors,n=this.select(a(e.uuid));if(!n)throw new Error(`Expected team with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(i(c));const d=this.enqueueRequest({description:m(o.PATCH,this.name,!1),method:o.PATCH,url:`${this.url}/${e.uuid}/`,payload:g(e),blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(i(r))}).catch(()=>{this.dispatch(i(n))}),[c,d]}async delete(e){const{addOne:i,deleteOne:a}=this.actions,{selectById:n}=this.selectors,c=this.select(n(e));if(!c)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:m(o.DELETE,this.name,!1),method:o.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(d){throw this.dispatch(i(c)),d}}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({queryParams:{organization:e}},i);return this.dispatch(a(n)),n}}class JM extends ot{name="User";url="/user";actions={addOne:Ji,addMany:Hm,setOne:Lm,setMany:km,updateOne:Nm,updateMany:Gm,deleteOne:Qi,deleteMany:Km,initialize:Um};selectors={selectById:Xt,selectByIds:Ym};async list(e,i){const{organizationUuid:a,...n}=e,c=a?`/organizations/${a}${this.url}s/`:`/${this.url}`;return this.performRequest({method:o.GET,url:c,...n},i)}async refreshStore(e,i){const{initialize:a}=this.actions,n=await this.list({organizationUuid:e},i);return this.dispatch(a(n)),n}}async function nn(t,e,i,a,n){const c=a instanceof lt;c&&e.checkAuth!==!1&&await a.auth.prepareAuth();const d={queryParams:"",isAuthNeeded:!0},{s3url:r,payload:p,headers:h,method:f,queryParams:A,attachmentHash:T,isExternalUrl:S,isAuthNeeded:O,isResponseBlob:_}={...d,...e};let F=e.url;const w=T?await i.files.getFileFromCache(T):void 0,V=w?await $b(w):void 0;if(T){if(!V)throw new Error(`Cannot upload file ${T} because it's not cached.`);if(V.size===0)throw new Error(`Cannot upload file ${T} because its has a size of 0.`)}!S&&!F.startsWith("http")&&(!F.startsWith("/")&&!F.startsWith("blob:")&&(F="/"+F),F=t+F);const R=B=>{if(T){if(!r)throw new Error(`No S3 URL for file ${T}`);if("warning"in r)throw new Error(`S3 URL warning for file ${T}`);if(!V)throw new Error(`No file for file ${T}`);const C=r.fields["x-amz-checksum-sha1"];if(!C)throw new Error(`No checksum for file ${T}`);return B.set("x-amz-checksum-sha1",C).field({...p,...r.fields}).attach("file",V)}return B.send(p)},Et={[o.GET]:()=>_?pt.get(F.toString()).responseType("blob"):pt.get(F.toString()),[o.POST]:()=>{const B=pt.post(F.toString());return R(B)},[o.PATCH]:()=>{const B=pt.patch(F.toString());return R(B)},[o.PUT]:()=>{const B=pt.put(F.toString());return R(B)},[o.DELETE]:()=>{const B=pt.delete(F.toString());return R(B)}}[f];let j=Et();const is=()=>{console.debug("aborting request:",e.url),j.abort()};n?.addEventListener("abort",is),O&&c&&(j=a.auth.applyAuth(j)),h&&(j=j.set(h));try{return await j.query(A)}catch(B){const C=Cb(B),vt=C?.status;throw c&&C&&a.auth.isAuthFailure(C)?(await a.auth.handleUnauthorized(j,C),new z({response:C,innerError:B,discard:!1})):new z({response:C,innerError:B,discard:tn.includes(vt)})}finally{n?.removeEventListener("abort",is)}}class QM{store;constructor(e){this.store=e}_performRequest(e,i,a,n){const c=new l.DeferredPromise,d={...i,uuid:i.uuid??at.v4()};return nn(e,d,this,a,n).then(r=>{c.resolve(r.body)}).catch(r=>{r instanceof Error?c.reject(r):c.reject(new Error((r??l.ERROR_MSG_UNEXPECTED).toString()))}),c}async performRequest(e,i,a,n){return this._performRequest(e,i,a,n).then(c=>{if(c instanceof z)throw c;return c})}async enqueueRequest(e,i,a){return this._enqueueRequest(e,i,a).then(n=>{if(n instanceof z)throw n;return n})}_enqueueRequest(e,i,a){const n=new l.DeferredPromise,c={...e,BASE_URL:i,serviceName:a},d=this.store.dispatch(Rf(c)),r=h=>{if(h)n.resolve(h.body);else{const f=new z({message:"Could not get a response from the server.",response:h,discard:!0});n.reject(f)}},p=h=>{h instanceof z?h.options.discard=!0:(console.error("Received an unexpected error while processing a request:",h,`
14
+ Converting error to APIError and discarding.`),h=new z({message:"An error occurred while processing the request.",innerError:h,discard:!0})),n.reject(h)};return d.then(r,p),n}async performPagination(e,i,a,n,c){const d={...i,queryParams:{...i.queryParams,paginate:!0,limit:a}},{method:r}=d,p=[];let h=await this.performRequest(e,d,n,c);for(p.push(h.results);h.next;)h=await this.performRequest(e,{url:h.next,method:r},n,c),p.push(h.results);return p}}class Tt{graph;requestAttemptCounter;constructor(){this.graph=new lF.DepGraph,this.requestAttemptCounter={}}static _fromOutbox(e){const i=new Tt;for(let a=0;a<e.length;a++){const n=e[a];if(!n){console.error("Outbox item was undefined");continue}i.sneakRequest(n);for(let c=0;c<a;c++){const d=e[c];if(!d){console.error("Previous outbox item was undefined");continue}d.payload.uuid!==n.payload.uuid&&d.payload.blocks.some(r=>n.payload.blockers.includes(r))&&Tt._addDependency(n.payload.uuid,d.payload.uuid,i.graph)}}return i}_addDependency(e,i){Tt._addDependency(e,i,this.graph)}static _addDependency(e,i,a){if(e===i)throw new Error(`Tried to add dependency from node to itself: ${e}`);if(!a.hasNode(e))throw new Error(`Tried to add dependency from non-existent node: ${e} (to node: ${i})`);if(!a.hasNode(i))throw new Error(`Tried to add dependency to non-existent node: ${i} (from node: ${e})`);a.addDependency(e,i)}addRequest(e){if(this.graph.addNode(e.payload.uuid,e),!(e.payload.blockers.length===0||this.graph.size()===1))for(const i of this.graph.overallOrder()){if(i===e.payload.uuid)continue;const a=this.graph.getNodeData(i),n=new Set(a.payload.blocks);e.payload.blockers.some(c=>n.has(c))&&this._addDependency(e.payload.uuid,i)}}insertRequest(e){this.graph.addNode(e.payload.uuid,e);for(const i of this.graph.overallOrder()){if(i===e.payload.uuid)continue;const a=this.graph.getNodeData(i),n=new Set(e.payload.blocks);a.payload.blockers.some(c=>n.has(c))&&this._addDependency(i,e.payload.uuid)}}sneakRequest(e){this.graph.addNode(e.payload.uuid,e)}_getNextNode(){const e=this.graph.overallOrder(!0);let i=1/0,a;for(const n of e){const c=this.requestAttemptCounter[n]||0;c<i&&(i=c,a=n)}return a}peek(){const e=this._getNextNode();if(e)return this.graph.getNodeData(e)}remove(e){this.graph.removeNode(e),delete this.requestAttemptCounter[e]}pop(){const e=this.peek();return e&&this.graph.removeNode(e.payload.uuid),e}getQueue(){const e=this.graph.overallOrder().map(a=>this.graph.getNodeData(a)),i=this._getNextNode();if(i){const a=this.graph.getNodeData(i),n=e.findIndex(c=>c.payload.uuid===a.payload.uuid);n!==-1&&(e.splice(n,1),e.unshift(a))}return e}getReady(){let e=this.graph.overallOrder(!0).map(i=>this.graph.getNodeData(i));return e=e.sort((i,a)=>i.meta.offline.effect.timestamp.localeCompare(a.meta.offline.effect.timestamp)),e=e.sort((i,a)=>{const n=this.requestAttemptCounter[i.payload.uuid]||0,c=this.requestAttemptCounter[a.payload.uuid]||0;return n-c}),e}registerRetry(e){this.requestAttemptCounter[e]=(this.requestAttemptCounter[e]||0)+1}}let Yb;function Zb(t){Yb=t}function It(){return Yb}let Jb;function Qb(t){Jb=t}function xb(){return Jb}let cn=null;function ht(){const t=It();if(!t)return console.warn("Client store not set; cannot get outbox coordinator yet."),null;if(cn)return cn;const e=t.getState().offline.outbox,i=Tt._fromOutbox(e);return cn=i,i}const xM=(t,e)=>{const i=new e(t);return Qb(i),Zb(t),i};class eR{_all;_previous;constructor(e){this._all=[e],this._previous=e,this.then=this.then.bind(this),this.compile=this.compile.bind(this)}then(e){return this._previous&&(this._previous.next=e),this._all.push(e),this._previous=e,{then:this.then,compile:this.compile}}compile(){return this._all}}class rn{next;constructor(){this.next=null}then(e){return new eR(this).then(e)}async run(e){if(this.next)return this.next.run(e);{if(console.debug("Middleware finished. Performing request:",e.payload.url),!It())throw new Error("Client store not set");const a=xb();if(!a)throw new Error("Client SDK not set");return jb(e,a)}}}class eF extends rn{async run(e){return super.run(e)}}class tF extends rn{async run(e){return super.run(e)}}const sF=new eF().then(new tF).compile();function iF(t){return sF[0]?.run(t)}s.ALL_MIDDLEWARE=sF,s.APIError=z,s.AgentService=wg,s.AssetAttachmentService=Eg,s.AssetCommentService=vg,s.AssetService=Vg,s.AssetTypeAttachmentService=Bg,s.AssetTypeFieldValuesAttachmentService=Dg,s.AssetTypeFieldValuesService=qg,s.AssetTypeFieldsAttachmentService=zg,s.AssetTypeFieldsService=jg,s.AssetTypeIdentifierService=Cg,s.AssetTypeIdentifierValueService=$g,s.AssetTypeService=Ug,s.AssetTypeStatusService=kg,s.BaseApiService=lt,s.BaseAuthService=Xb,s.BaseModelApiService=ot,s.BaseOfflineFileModelApiService=v,s.BaseOfflineModelApiService=M,s.BaseSDK=QM,s.COMMON_AUTO_FIELDS=un,s.DEFAULT_PAGE_SIZE=Eb,s.DISCARD_HTTP_STATUSES=tn,s.DocumentAttachmentService=Lg,s.DocumentService=Hg,s.EmailDomainsService=Gg,s.EmailVerificationService=Ng,s.FileService=Kg,s.FormIdentifierService=Wg,s.FormIdentifierValueService=Xg,s.FormRevisionAttachmentService=Yg,s.FormRevisionService=Zg,s.FormService=Jg,s.FormSubmissionFieldValuesAttachmentService=xg,s.FormSubmissionFieldValuesService=eM,s.FormSubmissionService=tM,s.FormSubscriberService=Qg,s.GeoImageService=sM,s.HttpMethod=o,s.IssueAssociationService=iM,s.IssueAttachmentService=aM,s.IssueCommentAttachmentService=nM,s.IssueCommentService=cM,s.IssueService=rM,s.IssueTypeAttachmentService=dM,s.IssueTypeFieldValuesAttachmentService=oM,s.IssueTypeFieldValuesService=hM,s.IssueTypeFieldsAttachmentService=uM,s.IssueTypeFieldsService=lM,s.IssueTypeIdentifierService=pM,s.IssueTypeIdentifierValueService=yM,s.IssueTypePriorityService=mM,s.IssueTypeService=fM,s.IssueTypeStatusService=SM,s.IssueUpdateService=AM,s.JWTService=OM,s.MAX_SERVICE_BATCH_SIZE=q,s.OUTBOX_RETRY_DELAY=6e4,s.OfflineAnalyticsMiddleware=eF,s.OfflineMiddleware=rn,s.OrganizationAccessService=PM,s.OrganizationService=bM,s.OutboxCoordinator=Tt,s.ProcdureInitiativeService=kM,s.ProcedureFieldValuesAttachmentService=KM,s.ProcedureFieldValuesService=WM,s.ProcedureService=wM,s.ProcedureStepAssigneeService=EM,s.ProcedureStepCommentService=vM,s.ProcedureStepDefaultAssigneeService=VM,s.ProcedureStepDefaultReviewerService=BM,s.ProcedureStepEventService=zM,s.ProcedureStepFieldValuesAttachmentService=qM,s.ProcedureStepFieldValuesReviewService=CM,s.ProcedureStepFieldValuesService=$M,s.ProcedureStepFieldsAttachmentService=jM,s.ProcedureStepFieldsService=DM,s.ProcedureStepReviewerService=UM,s.ProcedureStepService=LM,s.ProcedureTypeAttachmentService=HM,s.ProcedureTypeFieldsAttachmentService=GM,s.ProcedureTypeFieldsService=NM,s.ProcedureTypeService=XM,s.ProjectAccessService=FM,s.ProjectAttachmentService=_M,s.ProjectCommentService=gM,s.ProjectFileService=MM,s.ProjectService=RM,s.RESET_ORGANIZATION_STATE=b,s.RESET_PROJECT_STATE=E,s.RESET_STATE=I,s.RateLimitingMiddleware=tF,s.SelectorBuilder=pF,s.TeamMembershipService=YM,s.TeamService=ZM,s.UserService=JM,s._setLatestRetryTime=Ef,s.addAsset=Nn,s.addAssetAttachment=An,s.addAssetAttachments=rs,s.addAssetComment=vn,s.addAssetComments=Vt,s.addAssetType=Xr,s.addAssetTypeAttachment=ac,s.addAssetTypeAttachments=ms,s.addAssetTypeFieldValues=ar,s.addAssetTypeFieldValuesAttachment=Nc,s.addAssetTypeFieldValuesAttachments=Ps,s.addAssetTypeFieldValuesMany=nr,s.addAssetTypeFields=vc,s.addAssetTypeFieldsAttachment=Sc,s.addAssetTypeFieldsAttachments=Ac,s.addAssetTypeFieldsMany=Vc,s.addAssetTypeIdentifier=Ar,s.addAssetTypeIdentifierValue=Vr,s.addAssetTypeIdentifierValues=Br,s.addAssetTypeIdentifiers=Tr,s.addAssetTypeStatus=cd,s.addAssetTypeStatuses=rd,s.addAssetTypes=Yr,s.addAssets=hs,s.addConversation=hn,s.addConversations=yF,s.addDocument=qd,s.addDocumentAttachment=bd,s.addDocumentAttachments=Fd,s.addDocuments=Cd,s.addEmailDomain=Jd,s.addEmailDomains=Qd,s.addForm=_l,s.addFormIdentifier=ou,s.addFormIdentifierValue=_u,s.addFormIdentifierValues=gu,s.addFormIdentifiers=hu,s.addFormRevision=xu,s.addFormRevisionAttachment=$u,s.addFormRevisionAttachments=Uu,s.addFormRevisions=Gs,s.addFormSubmission=ho,s.addFormSubmissionFieldValues=Zl,s.addFormSubmissionFieldValuesAttachment=$l,s.addFormSubmissionFieldValuesAttachments=Qs,s.addFormSubmissionFieldValuesMany=ai,s.addFormSubmissions=nt,s.addFormSubscriber=hl,s.addFormSubscribers=Ws,s.addForms=gl,s.addGeoImage=wo,s.addGeoImages=Eo,s.addIssue=Hh,s.addIssueAssociation=No,s.addIssueAssociations=yt,s.addIssueAttachment=ih,s.addIssueAttachments=hi,s.addIssueComment=Eh,s.addIssueCommentAttachment=fh,s.addIssueCommentAttachments=Sh,s.addIssueComments=vh,s.addIssueType=am,s.addIssueTypeAttachment=sp,s.addIssueTypeAttachments=ip,s.addIssueTypeFieldValues=Ep,s.addIssueTypeFieldValuesAttachment=ay,s.addIssueTypeFieldValuesAttachments=wi,s.addIssueTypeFieldValuesMany=vp,s.addIssueTypeFields=Gp,s.addIssueTypeFieldsAttachment=fp,s.addIssueTypeFieldsAttachments=Sp,s.addIssueTypeFieldsMany=Np,s.addIssueTypeIdentifier=Sy,s.addIssueTypeIdentifierValue=vy,s.addIssueTypeIdentifierValues=Vy,s.addIssueTypeIdentifiers=Ay,s.addIssueTypePriorities=Ky,s.addIssueTypePriority=Ny,s.addIssueTypeStatus=Am,s.addIssueTypeStatuses=Tm,s.addIssueTypes=nm,s.addIssueUpdate=Gi,s.addIssueUpdates=Ni,s.addIssues=Ii,s.addOrganization=ff,s.addOrganizationAccess=Qm,s.addOrganizationAccesses=xm,s.addOrganizations=mf,s.addProcedure=lA,s.addProcedureFieldValues=RP,s.addProcedureFieldValuesAttachment=mP,s.addProcedureFieldValuesAttachments=Ha,s.addProcedureFieldValuesMany=wP,s.addProcedureInitiative=ZS,s.addProcedureInitiatives=JS,s.addProcedureStep=fO,s.addProcedureStepAssignee=gA,s.addProcedureStepAssignees=MA,s.addProcedureStepComment=UA,s.addProcedureStepComments=kA,s.addProcedureStepDefaultAssignee=eT,s.addProcedureStepDefaultAssignees=tT,s.addProcedureStepDefaultReviewer=yT,s.addProcedureStepDefaultReviewers=mT,s.addProcedureStepEvent=RT,s.addProcedureStepEvents=wT,s.addProcedureStepFieldValues=MI,s.addProcedureStepFieldValuesAttachment=yI,s.addProcedureStepFieldValuesAttachments=ga,s.addProcedureStepFieldValuesMany=RI,s.addProcedureStepFieldValuesReview=kI,s.addProcedureStepFieldValuesReviews=va,s.addProcedureStepFields=tI,s.addProcedureStepFieldsAttachment=LT,s.addProcedureStepFieldsAttachments=Ia,s.addProcedureStepFieldsMany=sI,s.addProcedureStepReviewer=eO,s.addProcedureStepReviewers=tO,s.addProcedureSteps=SO,s.addProcedureType=LP,s.addProcedureTypeAttachment=MO,s.addProcedureTypeAttachments=RO,s.addProcedureTypeFields=tP,s.addProcedureTypeFieldsAttachment=kO,s.addProcedureTypeFieldsAttachments=LO,s.addProcedureTypeFieldsMany=sP,s.addProcedureTypes=HP,s.addProcedures=St,s.addProject=$S,s.addProjectAccess=zf,s.addProjectAccesses=jf,s.addProjectAttachment=Wf,s.addProjectAttachments=Xf,s.addProjectComment=rS,s.addProjectComments=dS,s.addProjectFile=bS,s.addProjectFiles=FS,s.addProjects=CS,s.addTeam=Sb,s.addTeamMembership=ib,s.addTeamMemberships=ab,s.addTeams=Ab,s.addUser=Ji,s.addUsers=Hm,s.agentsReducer=mn,s.agentsSlice=as,s.assetAttachmentReducer=Rn,s.assetAttachmentSlice=cs,s.assetCommentReducer=Ln,s.assetCommentSlice=ls,s.assetReducer=tc,s.assetSlice=os,s.assetTypeAttachmentReducer=yc,s.assetTypeAttachmentSlice=ys,s.assetTypeFieldValuesAttachmentReducer=tr,s.assetTypeFieldValuesAttachmentSlice=Os,s.assetTypeFieldValuesReducer=mr,s.assetTypeFieldValuesSlice=_s,s.assetTypeFieldsAttachmentReducer=Rc,s.assetTypeFieldsAttachmentSlice=As,s.assetTypeFieldsReducer=Lc,s.assetTypeFieldsSlice=Is,s.assetTypeIdentifierReducer=wr,s.assetTypeIdentifierSlice=gs,s.assetTypeIdentifierValueReducer=Hr,s.assetTypeIdentifierValueSlice=Rs,s.assetTypeReducer=id,s.assetTypeSlice=ws,s.assetTypeStatusReducer=Sd,s.assetTypeStatusSlice=vs,s.authReducer=Id,s.authSlice=Ct,s.baseReducer=mg,s.baseReducers=en,s.clearTokens=BF,s.createModelAdapter=P,s.createOfflineAction=gf,s.createPayload=g,s.createSelectionAdapter=oF,s.deleteAsset=Xn,s.deleteAssetAttachment=bn,s.deleteAssetAttachments=ds,s.deleteAssetComment=Dn,s.deleteAssetComments=Bt,s.deleteAssetType=Qr,s.deleteAssetTypeAttachment=uc,s.deleteAssetTypeAttachments=fs,s.deleteAssetTypeFieldValues=lr,s.deleteAssetTypeFieldValuesAttachment=Zc,s.deleteAssetTypeFieldValuesAttachments=bs,s.deleteAssetTypeFieldValuesMany=or,s.deleteAssetTypeFields=qc,s.deleteAssetTypeFieldsAttachment=bc,s.deleteAssetTypeFieldsAttachments=Fc,s.deleteAssetTypeFieldsMany=Cc,s.deleteAssetTypeIdentifier=Fr,s.deleteAssetTypeIdentifierValue=Cr,s.deleteAssetTypeIdentifierValues=$r,s.deleteAssetTypeIdentifiers=_r,s.deleteAssetTypeStatus=hd,s.deleteAssetTypeStatuses=pd,s.deleteAssetTypes=xr,s.deleteAssets=ps,s.deleteConversation=SF,s.deleteConversations=AF,s.deleteDocument=Hd,s.deleteDocumentAttachment=wd,s.deleteDocumentAttachments=Ed,s.deleteDocuments=Gd,s.deleteEmailDomain=iu,s.deleteEmailDomains=au,s.deleteForm=vl,s.deleteFormIdentifier=Su,s.deleteFormIdentifierValue=vu,s.deleteFormIdentifierValues=Vu,s.deleteFormIdentifiers=Au,s.deleteFormRevision=al,s.deleteFormRevisionAttachment=Nu,s.deleteFormRevisionAttachments=Ku,s.deleteFormRevisions=Ns,s.deleteFormSubmission=mo,s.deleteFormSubmissionFieldValues=to,s.deleteFormSubmissionFieldValuesAttachment=Gl,s.deleteFormSubmissionFieldValuesAttachments=xs,s.deleteFormSubmissionFieldValuesMany=ni,s.deleteFormSubmissions=ct,s.deleteFormSubscriber=Sl,s.deleteFormSubscribers=Xs,s.deleteForms=Vl,s.deleteGeoImage=Bo,s.deleteGeoImages=zo,s.deleteIssue=Xh,s.deleteIssueAssociation=Ko,s.deleteIssueAssociations=mt,s.deleteIssueAttachment=dh,s.deleteIssueAttachments=pi,s.deleteIssueComment=Dh,s.deleteIssueCommentAttachment=Ph,s.deleteIssueCommentAttachments=bh,s.deleteIssueComments=qh,s.deleteIssueType=lm,s.deleteIssueTypeAttachment=dp,s.deleteIssueTypeAttachments=up,s.deleteIssueTypeFieldValues=Dp,s.deleteIssueTypeFieldValuesAttachment=uy,s.deleteIssueTypeFieldValuesAttachments=Ei,s.deleteIssueTypeFieldValuesMany=qp,s.deleteIssueTypeFields=Zp,s.deleteIssueTypeFieldsAttachment=Pp,s.deleteIssueTypeFieldsAttachments=bp,s.deleteIssueTypeFieldsMany=Jp,s.deleteIssueTypeIdentifier=by,s.deleteIssueTypeIdentifierValue=qy,s.deleteIssueTypeIdentifierValues=Cy,s.deleteIssueTypeIdentifiers=Fy,s.deleteIssueTypePriorities=Qy,s.deleteIssueTypePriority=Jy,s.deleteIssueTypeStatus=Fm,s.deleteIssueTypeStatuses=_m,s.deleteIssueTypes=om,s.deleteIssueUpdate=Ki,s.deleteIssueUpdates=Wi,s.deleteIssues=Oi,s.deleteOrganization=Tf,s.deleteOrganizationAccess=nf,s.deleteOrganizationAccesses=cf,s.deleteOrganizations=If,s.deleteProcedure=mA,s.deleteProcedureFieldValues=zP,s.deleteProcedureFieldValuesAttachment=IP,s.deleteProcedureFieldValuesAttachments=Ga,s.deleteProcedureFieldValuesMany=jP,s.deleteProcedureInitiative=sA,s.deleteProcedureInitiatives=iA,s.deleteProcedureStep=IO,s.deleteProcedureStepAssignee=VA,s.deleteProcedureStepAssignees=BA,s.deleteProcedureStepComment=KA,s.deleteProcedureStepComments=WA,s.deleteProcedureStepDefaultAssignee=cT,s.deleteProcedureStepDefaultAssignees=rT,s.deleteProcedureStepDefaultReviewer=IT,s.deleteProcedureStepDefaultReviewers=OT,s.deleteProcedureStepEvent=zT,s.deleteProcedureStepEvents=jT,s.deleteProcedureStepFieldValues=BI,s.deleteProcedureStepFieldValuesAttachment=TI,s.deleteProcedureStepFieldValuesAttachments=Ma,s.deleteProcedureStepFieldValuesMany=zI,s.deleteProcedureStepFieldValuesReview=KI,s.deleteProcedureStepFieldValuesReviews=Va,s.deleteProcedureStepFields=rI,s.deleteProcedureStepFieldsAttachment=WT,s.deleteProcedureStepFieldsAttachments=Oa,s.deleteProcedureStepFieldsMany=dI,s.deleteProcedureStepReviewer=cO,s.deleteProcedureStepReviewers=rO,s.deleteProcedureSteps=OO,s.deleteProcedureType=XP,s.deleteProcedureTypeAttachment=BO,s.deleteProcedureTypeAttachments=zO,s.deleteProcedureTypeFields=rP,s.deleteProcedureTypeFieldsAttachment=WO,s.deleteProcedureTypeFieldsAttachments=XO,s.deleteProcedureTypeFieldsMany=dP,s.deleteProcedureTypes=YP,s.deleteProcedures=At,s.deleteProject=LS,s.deleteProjectAccess=Uf,s.deleteProjectAccesses=kf,s.deleteProjectAttachment=xf,s.deleteProjectAttachments=eS,s.deleteProjectComment=pS,s.deleteProjectComments=yS,s.deleteProjectFile=MS,s.deleteProjectFiles=RS,s.deleteProjects=HS,s.deleteTeam=bb,s.deleteTeamMembership=ub,s.deleteTeamMemberships=lb,s.deleteTeams=Fb,s.deleteUser=Qi,s.deleteUsers=Km,s.dequeue=zb,s.discard=Db,s.documentAttachmentReducer=zd,s.documentAttachmentSlice=Bs,s.documentSlice=js,s.documentsReducer=Nd,s.emailDomainsReducer=du,s.emailDomainsSlice=qs,s.enqueue=Bb,s.enqueueRequest=Rf,s.extractResponseFromError=Cb,s.fetchBlobFromObjectUrl=kb,s.fetchFileFromObjectUrl=Lb,s.fileToBlob=$b,s.formIdentifierReducer=Pu,s.formIdentifierSlice=$s,s.formIdentifierValueReducer=Du,s.formIdentifierValueSlice=ks,s.formReducer=Bl,s.formRevisionAttachmentReducer=Zu,s.formRevisionAttachmentSlice=Ls,s.formRevisionReducer=ul,s.formRevisionsSlice=Hs,s.formSlice=Ys,s.formSubmissionFieldValuesAttachmentReducer=Wl,s.formSubmissionFieldValuesAttachmentSlice=Js,s.formSubmissionFieldValuesReducer=co,s.formSubmissionFieldValuesSlice=ii,s.formSubmissionReducer=Fo,s.formSubmissionSlice=ri,s.formSubscriberReducer=Pl,s.formSubscriberSlice=Ks,s.geoImageReducer=Co,s.geoImageSlice=di,s.getClientSDK=xb,s.getClientStore=It,s.getFileExtension=Ub,s.getOutboxCoordinator=ht,s.getPresignedUrlExpiryDate=Kb,s.getRenamedFile=Mg,s.getRequestDescription=m,s.getS3FileKey=gg,s.hashFile=ss,s.initSDK=xM,s.initializeAssetAttachments=Sn,s.initializeAssetComments=En,s.initializeAssetTypeAttachments=ic,s.initializeAssetTypeFieldValues=ir,s.initializeAssetTypeFieldValuesAttachments=Gc,s.initializeAssetTypeFields=Ec,s.initializeAssetTypeFieldsAttachments=fc,s.initializeAssetTypeIdentifierValues=vr,s.initializeAssetTypeIdentifiers=Sr,s.initializeAssetTypeStatuses=nd,s.initializeAssetTypes=Nr,s.initializeAssets=Gn,s.initializeConversations=on,s.initializeDocumentAttachments=Pd,s.initializeDocuments=Dd,s.initializeEmailDomains=Zd,s.initializeFormIdentifierValues=Fu,s.initializeFormIdentifiers=lu,s.initializeFormRevisionAttachments=Cu,s.initializeFormRevisions=Qu,s.initializeFormSubmissionFieldValues=Yl,s.initializeFormSubmissionFieldValuesAttachments=Cl,s.initializeFormSubmissions=uo,s.initializeFormSubscribers=ol,s.initializeForms=Fl,s.initializeGeoImages=go,s.initializeIssueAssociations=Uo,s.initializeIssueAttachments=sh,s.initializeIssueCommentAttachments=mh,s.initializeIssueComments=wh,s.initializeIssueTypeAttachments=tp,s.initializeIssueTypeFieldValues=wp,s.initializeIssueTypeFieldValuesAttachments=iy,s.initializeIssueTypeFields=Hp,s.initializeIssueTypeFieldsAttachments=mp,s.initializeIssueTypeIdentifierValues=Ey,s.initializeIssueTypeIdentifiers=fy,s.initializeIssueTypePriorities=Gy,s.initializeIssueTypeStatuses=Sm,s.initializeIssueTypes=im,s.initializeIssueUpdates=Em,s.initializeIssues=Lh,s.initializeOrganizationAccesses=Jm,s.initializeOrganizations=hf,s.initializeProcedureFieldValues=MP,s.initializeProcedureFieldValuesAttachments=yP,s.initializeProcedureInitiatives=YS,s.initializeProcedureStepAssignees=_A,s.initializeProcedureStepComments=$A,s.initializeProcedureStepDefaultAssignees=xA,s.initializeProcedureStepDefaultReviewers=pT,s.initializeProcedureStepEvents=MT,s.initializeProcedureStepFieldValues=gI,s.initializeProcedureStepFieldValuesAttachments=pI,s.initializeProcedureStepFieldValuesReviews=UI,s.initializeProcedureStepFields=eI,s.initializeProcedureStepFieldsAttachments=kT,s.initializeProcedureStepReviewers=xI,s.initializeProcedureSteps=pO,s.initializeProcedureTypeAttachments=gO,s.initializeProcedureTypeFields=eP,s.initializeProcedureTypeFieldsAttachments=UO,s.initializeProcedureTypes=kP,s.initializeProcedures=uA,s.initializeProjectAccesses=Bf,s.initializeProjectAttachments=Kf,s.initializeProjectComments=cS,s.initializeProjectFiles=IS,s.initializeProjects=jS,s.initializeTeamMemberships=sb,s.initializeTeams=fb,s.initializeUsers=Um,s.isCloudfrontUrl=Gb,s.isImageFile=Rg,s.isObjectUrl=Hb,s.isPresignedUrlExpired=Wb,s.isS3Url=Nb,s.issueAssociationReducer=eh,s.issueAssociationSlice=li,s.issueAttachmentReducer=ph,s.issueAttachmentSlice=oi,s.issueCommentAttachmentReducer=Mh,s.issueCommentAttachmentSlice=mi,s.issueCommentReducer=Uh,s.issueCommentSlice=Si,s.issueReducer=xh,s.issueSlice=Ti,s.issueTypeAttachmentReducer=pp,s.issueTypeAttachmentSlice=Pi,s.issueTypeFieldValuesAttachmentReducer=yy,s.issueTypeFieldValuesAttachmentSlice=Ri,s.issueTypeFieldValuesReducer=kp,s.issueTypeFieldValuesSlice=gi,s.issueTypeFieldsAttachmentReducer=Mp,s.issueTypeFieldsAttachmentSlice=Fi,s.issueTypeFieldsReducer=ty,s.issueTypeFieldsSlice=Mi,s.issueTypeIdentifierReducer=Ry,s.issueTypeIdentifierSlice=Vi,s.issueTypeIdentifierValueReducer=Ly,s.issueTypeIdentifierValueSlice=zi,s.issueTypePriorityReducer=tm,s.issueTypePrioritySlice=ji,s.issueTypeReducer=mm,s.issueTypeSlice=Ci,s.issueTypeStatusReducer=Rm,s.issueTypeStatusSlice=Ui,s.issueUpdateReducer=Cm,s.issueUpdateSlice=Hi,s.markAsDeleted=wf,s.markForDeletion=T_,s.organizationAccessReducer=rf,s.organizationAccessSlice=ea,s.organizationReducer=_f,s.organizationSlice=ta,s.outboxReducer=vf,s.outboxSlice=sa,s.overmapEnhancer=Ig,s.overmapReducer=fg,s.overmapReducers=wb,s.performRequest=nn,s.performRequestFromAction=jb,s.procedureFieldValuesAttachmentReducer=OP,s.procedureFieldValuesAttachmentSlice=La,s.procedureFieldValuesReducer=DP,s.procedureFieldValuesSlice=Ka,s.procedureInitiativeReducer=aA,s.procedureInitiativeSlice=la,s.procedureReducer=fA,s.procedureSlice=oa,s.procedureStepAssigneeReducer=qA,s.procedureStepAssigneeSlice=ha,s.procedureStepCommentReducer=JA,s.procedureStepCommentSlice=pa,s.procedureStepDefaultAssigneeReducer=oT,s.procedureStepDefaultAssigneeSlice=ya,s.procedureStepDefaultReviewerReducer=_T,s.procedureStepDefaultReviewerSlice=fa,s.procedureStepEventReducer=$T,s.procedureStepEventSlice=Aa,s.procedureStepFieldValuesAttachmentReducer=FI,s.procedureStepFieldValuesAttachmentSlice=_a,s.procedureStepFieldValuesReducer=jI,s.procedureStepFieldValuesReviewReducer=JI,s.procedureStepFieldValuesReviewSlice=Ea,s.procedureStepFieldValuesSlice=wa,s.procedureStepFieldsAttachmentReducer=QT,s.procedureStepFieldsAttachmentSlice=Ta,s.procedureStepFieldsReducer=oI,s.procedureStepFieldsSlice=ba,s.procedureStepReducer=PO,s.procedureStepReviewerReducer=oO,s.procedureStepReviewerSlice=Ba,s.procedureStepSlice=za,s.procedureTypeAttachmentReducer=jO,s.procedureTypeAttachmentSlice=qa,s.procedureTypeFieldsAttachmentReducer=YO,s.procedureTypeFieldsAttachmentSlice=$a,s.procedureTypeFieldsReducer=uP,s.procedureTypeFieldsSlice=ka,s.procedureTypeReducer=ZP,s.procedureTypeSlice=Xa,s.projectAccessReducer=Lf,s.projectAccessSlice=ia,s.projectAttachmentReducer=aS,s.projectAttachmentSlice=na,s.projectCommentReducer=AS,s.projectCommentSlice=ra,s.projectFileReducer=BS,s.projectFileSlice=da,s.projectReducer=GS,s.projectSlice=ua,s.rehydratedReducer=eb,s.rehydratedSlice=Za,s.restructureSelectorWithArgs=y,s.runMiddleware=iF,s.selectAccessToken=zF,s.selectAccessesByUserOfProject=O_,s.selectAccessibleProjects=g_,s.selectActiveOrganizationAccess=m_,s.selectAllDocumentAttachments=zs,s.selectAssetAttachmentById=_n,s.selectAssetAttachmentMapping=Fn,s.selectAssetAttachments=us,s.selectAssetAttachmentsByIds=gn,s.selectAssetById=xn,s.selectAssetCommentById=Cn,s.selectAssetCommentMapping=qn,s.selectAssetComments=zt,s.selectAssetCommentsByIds=$n,s.selectAssetTypeAttachmentById=oc,s.selectAssetTypeAttachmentMapping=lc,s.selectAssetTypeAttachments=Ss,s.selectAssetTypeAttachmentsByIds=hc,s.selectAssetTypeById=td,s.selectAssetTypeFieldValues=Dt,s.selectAssetTypeFieldValuesAttachmentById=Qc,s.selectAssetTypeFieldValuesAttachments=Fs,s.selectAssetTypeFieldValuesAttachmentsByIds=xc,s.selectAssetTypeFieldValuesAttachmentsMapping=Jc,s.selectAssetTypeFieldValuesById=pr,s.selectAssetTypeFieldValuesByIds=yr,s.selectAssetTypeFieldValuesMapping=hr,s.selectAssetTypeFieldValuesOfAsset=_F,s.selectAssetTypeFields=Pt,s.selectAssetTypeFieldsAttachmentById=gc,s.selectAssetTypeFieldsAttachments=Ts,s.selectAssetTypeFieldsAttachmentsByIds=Mc,s.selectAssetTypeFieldsAttachmentsMapping=_c,s.selectAssetTypeFieldsById=Uc,s.selectAssetTypeFieldsByIds=kc,s.selectAssetTypeFieldsMapping=$c,s.selectAssetTypeFieldsOfAssetType=bF,s.selectAssetTypeIdentifierById=Mr,s.selectAssetTypeIdentifierMapping=gr,s.selectAssetTypeIdentifierValueById=kr,s.selectAssetTypeIdentifierValueMapping=Ur,s.selectAssetTypeIdentifierValues=qt,s.selectAssetTypeIdentifierValuesByIds=Lr,s.selectAssetTypeIdentifierValuesOfAsset=RF,s.selectAssetTypeIdentifierValuesOfIdentifier=wF,s.selectAssetTypeIdentifiers=Ms,s.selectAssetTypeIdentifiersByIds=Rr,s.selectAssetTypeIdentifiersOfAssetType=MF,s.selectAssetTypeStatusById=md,s.selectAssetTypeStatusMapping=yd,s.selectAssetTypeStatuses=Vs,s.selectAssetTypeStatusesByIds=fd,s.selectAssetTypeStatusesOfAssetType=vF,s.selectAssetTypeValuesOfAssetType=gF,s.selectAssetTypes=Es,s.selectAssetTypesByIds=sd,s.selectAssetTypesMapping=ed,s.selectAssetTypesOfOrganization=EF,s.selectAssets=jt,s.selectAssetsByIds=ec,s.selectAssetsMapping=Jn,s.selectAssetsOfAssetType=Qn,s.selectAssetsOfProject=OF,s.selectAttachmentsOfAsset=Mn,s.selectAttachmentsOfAssetType=pc,s.selectAttachmentsOfAssetTypeFieldValues=er,s.selectAttachmentsOfAssetTypeFields=PF,s.selectAttachmentsOfDocument=DF,s.selectAttachmentsOfFormRevision=HF,s.selectAttachmentsOfFormSubmissionFieldValues=Kl,s.selectAttachmentsOfIssue=lh,s.selectAttachmentsOfIssueComment=QF,s.selectAttachmentsOfIssueType=t_,s.selectAttachmentsOfIssueTypeFieldValues=py,s.selectAttachmentsOfIssueTypeFields=s_,s.selectAttachmentsOfProcedureFieldValues=_P,s.selectAttachmentsOfProcedureStepFieldValues=bI,s.selectAttachmentsOfProcedureStepFields=YT,s.selectAttachmentsOfProcedureType=ig,s.selectAttachmentsOfProcedureTypeFields=ag,s.selectAttachmentsOfProject=b_,s.selectCommentsOfAsset=Un,s.selectCommentsOfAssets=kn,s.selectCommentsOfIssue=xF,s.selectCommentsOfProject=F_,s.selectCommentsOfProjects=__,s.selectConversation=IF,s.selectConversationMapping=ns,s.selectConversations=TF,s.selectCurrentUser=Xm,s.selectDeletedRequests=S_,s.selectDescendantsOfDocument=Xd,s.selectDocumentAttachmentById=Vd,s.selectDocumentAttachmentMapping=vd,s.selectDocumentAttachmentsByIds=Bd,s.selectDocumentById=Kd,s.selectDocuments=$t,s.selectDocumentsByIds=Wd,s.selectDocumentsMapping=Ds,s.selectEmailDomainById=cu,s.selectEmailDomains=Cs,s.selectEmailDomainsAsMapping=nu,s.selectEmailDomainsByIds=ru,s.selectEmailDomainsOfOrganization=$F,s.selectFieldValuesOfProcedure=rg,s.selectFormById=jl,s.selectFormIdentifierById=Iu,s.selectFormIdentifierMapping=Tu,s.selectFormIdentifierValueById=zu,s.selectFormIdentifierValueMapping=Bu,s.selectFormIdentifierValues=Ut,s.selectFormIdentifierValuesByIds=ju,s.selectFormIdentifierValuesOfFormSubmission=kF,s.selectFormIdentifierValuesOfIdentifier=LF,s.selectFormIdentifiers=Us,s.selectFormIdentifiersByIds=Ou,s.selectFormIdentifiersOfForm=UF,s.selectFormMapping=zl,s.selectFormRevisionAttachmentById=Xu,s.selectFormRevisionAttachments=Wu,s.selectFormRevisionAttachmentsByIds=Yu,s.selectFormRevisionAttachmentsMapping=kt,s.selectFormRevisionById=cl,s.selectFormRevisionMapping=nl,s.selectFormRevisions=Lt,s.selectFormRevisionsByIds=rl,s.selectFormRevisionsOfForm=dl,s.selectFormSubmissionById=So,s.selectFormSubmissionFieldValues=ci,s.selectFormSubmissionFieldValuesAttachmentById=Nl,s.selectFormSubmissionFieldValuesAttachments=ti,s.selectFormSubmissionFieldValuesAttachmentsByIds=si,s.selectFormSubmissionFieldValuesAttachmentsMapping=ei,s.selectFormSubmissionFieldValuesById=io,s.selectFormSubmissionFieldValuesByIds=ao,s.selectFormSubmissionFieldValuesMapping=so,s.selectFormSubmissionFieldValuesOfFormSubmission=no,s.selectFormSubmissions=D,s.selectFormSubmissionsByIds=Ao,s.selectFormSubmissionsMapping=fo,s.selectFormSubmissionsOfAsset=Po,s.selectFormSubmissionsOfAssets=bo,s.selectFormSubmissionsOfForm=To,s.selectFormSubmissionsOfIssue=Io,s.selectFormSubmissionsOfIssues=Oo,s.selectFormSubmissionsOfOrganization=WF,s.selectFormSubmissionsOfOrganizationAndForm=ZF,s.selectFormSubmissionsOfProject=XF,s.selectFormSubmissionsOfProjectAndForm=YF,s.selectFormSubscriberById=Tl,s.selectFormSubscriberMapping=Al,s.selectFormSubscribers=Ht,s.selectFormSubscribersByIds=Il,s.selectFormSubscribersOfForm=Ol,s.selectFormSubscribersOfUser=NF,s.selectForms=Zs,s.selectFormsByIds=Dl,s.selectFormsOfOrganization=KF,s.selectGeoImageById=Do,s.selectGeoImageMapping=jo,s.selectGeoImages=ui,s.selectGeoImagesByIds=qo,s.selectGeoImagesOfProject=JF,s.selectIsLoggedIn=jF,s.selectIssueAssociationById=Xo,s.selectIssueAssociationMapping=Wo,s.selectIssueAssociations=ft,s.selectIssueAssociationsByIds=Yo,s.selectIssueAssociationsOfAsset=Qo,s.selectIssueAssociationsOfAssets=xo,s.selectIssueAssociationsOfIssue=Jo,s.selectIssueAssociationsOfIssues=Zo,s.selectIssueAttachmentById=oh,s.selectIssueAttachmentMapping=uh,s.selectIssueAttachments=yi,s.selectIssueAttachmentsByIds=hh,s.selectIssueById=Zh,s.selectIssueCommentAttachmentById=_h,s.selectIssueCommentAttachmentMapping=Fh,s.selectIssueCommentAttachments=fi,s.selectIssueCommentAttachmentsByIds=gh,s.selectIssueCommentById=Ch,s.selectIssueCommentMapping=Ai,s.selectIssueCommentsByIds=$h,s.selectIssueMapping=Yh,s.selectIssueTypeAttachmentById=op,s.selectIssueTypeAttachmentMapping=lp,s.selectIssueTypeAttachments=bi,s.selectIssueTypeAttachmentsByIds=hp,s.selectIssueTypeById=pm,s.selectIssueTypeFieldValues=Nt,s.selectIssueTypeFieldValuesAttachmentById=oy,s.selectIssueTypeFieldValuesAttachments=vi,s.selectIssueTypeFieldValuesAttachmentsByIds=hy,s.selectIssueTypeFieldValuesAttachmentsMapping=ly,s.selectIssueTypeFieldValuesById=$p,s.selectIssueTypeFieldValuesByIds=Up,s.selectIssueTypeFieldValuesMapping=Cp,s.selectIssueTypeFieldValuesOfIssue=i_,s.selectIssueTypeFields=bt,s.selectIssueTypeFieldsAttachmentById=_p,s.selectIssueTypeFieldsAttachments=_i,s.selectIssueTypeFieldsAttachmentsByIds=gp,s.selectIssueTypeFieldsAttachmentsMapping=Fp,s.selectIssueTypeFieldsById=xp,s.selectIssueTypeFieldsByIds=ey,s.selectIssueTypeFieldsMapping=Qp,s.selectIssueTypeFieldsOfIssueType=a_,s.selectIssueTypeIdentifierById=gy,s.selectIssueTypeIdentifierMapping=_y,s.selectIssueTypeIdentifierValueById=Uy,s.selectIssueTypeIdentifierValueMapping=$y,s.selectIssueTypeIdentifierValues=Kt,s.selectIssueTypeIdentifierValuesByIds=ky,s.selectIssueTypeIdentifierValuesOfIdentifier=u_,s.selectIssueTypeIdentifierValuesOfIssue=d_,s.selectIssueTypeIdentifiers=Bi,s.selectIssueTypeIdentifiersByIds=My,s.selectIssueTypeIdentifiersOfIssueType=r_,s.selectIssueTypeMapping=hm,s.selectIssueTypePriorities=Di,s.selectIssueTypePrioritiesByIds=em,s.selectIssueTypePrioritiesOfIssueType=l_,s.selectIssueTypePriorityById=qi,s.selectIssueTypePriorityMapping=xy,s.selectIssueTypeStatusById=Li,s.selectIssueTypeStatusMapping=gm,s.selectIssueTypeStatuses=ki,s.selectIssueTypeStatusesByIds=Mm,s.selectIssueTypeStatusesOfIssueType=h_,s.selectIssueTypeValuesOfIssueType=c_,s.selectIssueTypes=$i,s.selectIssueTypesByIds=ym,s.selectIssueTypesOfOrganization=o_,s.selectIssueUpdateById=jm,s.selectIssueUpdateMapping=Xi,s.selectIssueUpdates=Yi,s.selectIssueUpdatesByIds=Dm,s.selectIssueUpdatesOfIssue=qm,s.selectIssues=Gt,s.selectIssuesByIds=Jh,s.selectIssuesOfIssueType=Qh,s.selectIssuesOfProject=e_,s.selectLatestAssetTypeFieldsOfAssetType=FF,s.selectLatestFieldsByProcedureStep=G_,s.selectLatestFormRevisionOfForm=GF,s.selectLatestIssueTypeFieldsOfIssueType=n_,s.selectLatestProcedureStepFieldValuesReviewByProcedureStepFieldValues=J_,s.selectLatestProcedureStepFieldsOfProcedureStep=H_,s.selectLatestProcedureTypeFieldsOfProcedureType=cg,s.selectLatestRetryTime=A_,s.selectLatestReviewOfProcedureStepFieldValues=X_,s.selectMembershipsByUserOfTeam=hg,s.selectOrganizationAccessById=df,s.selectOrganizationAccessMapping=Yt,s.selectOrganizationAccessUserMapping=lf,s.selectOrganizationAccessesByIds=uf,s.selectOrganizationById=bf,s.selectOrganizationDocuments=CF,s.selectOrganizations=Pf,s.selectOrganizationsByIds=Ff,s.selectOrganizationsMapping=Of,s.selectProcedureById=AA,s.selectProcedureFieldValues=Wa,s.selectProcedureFieldValuesAttachmentById=bP,s.selectProcedureFieldValuesAttachments=Na,s.selectProcedureFieldValuesAttachmentsByIds=FP,s.selectProcedureFieldValuesAttachmentsMapping=PP,s.selectProcedureFieldValuesById=CP,s.selectProcedureFieldValuesByIds=$P,s.selectProcedureFieldValuesMapping=qP,s.selectProcedureInitiativeById=cA,s.selectProcedureInitiatives=Qt,s.selectProcedureInitiativesByIds=rA,s.selectProcedureInitiativesMapping=nA,s.selectProcedureInitiativesOfProcedureType=w_,s.selectProcedureInitiativesOfProject=R_,s.selectProcedureStepAssigneeById=jA,s.selectProcedureStepAssignees=_t,s.selectProcedureStepAssigneesByIds=DA,s.selectProcedureStepAssigneesMapping=zA,s.selectProcedureStepAssigneesOfProcedure=v_,s.selectProcedureStepAssigneesOfProcedureAndProcedureStep=B_,s.selectProcedureStepAssigneesOfProcedureStep=V_,s.selectProcedureStepById=bO,s.selectProcedureStepCommentById=YA,s.selectProcedureStepComments=gt,s.selectProcedureStepCommentsByIds=ZA,s.selectProcedureStepCommentsMapping=XA,s.selectProcedureStepCommentsOfProcedure=z_,s.selectProcedureStepCommentsOfProcedureAndProcedureStep=D_,s.selectProcedureStepCommentsOfProcedureStep=j_,s.selectProcedureStepDefaultAssigneeById=uT,s.selectProcedureStepDefaultAssignees=ma,s.selectProcedureStepDefaultAssigneesByIds=lT,s.selectProcedureStepDefaultAssigneesMapping=dT,s.selectProcedureStepDefaultAssigneesOfProcedureStep=q_,s.selectProcedureStepDefaultReviewerById=bT,s.selectProcedureStepDefaultReviewers=Sa,s.selectProcedureStepDefaultReviewersByIds=FT,s.selectProcedureStepDefaultReviewersMapping=PT,s.selectProcedureStepDefaultReviewersOfProcedureStep=C_,s.selectProcedureStepEventById=qT,s.selectProcedureStepEvents=Mt,s.selectProcedureStepEventsByIds=CT,s.selectProcedureStepEventsMapping=DT,s.selectProcedureStepEventsOfProcedure=$_,s.selectProcedureStepEventsOfProcedureAndProcedureStep=k_,s.selectProcedureStepEventsOfProcedureStep=U_,s.selectProcedureStepFieldValues=dt,s.selectProcedureStepFieldValuesAttachmentById=OI,s.selectProcedureStepFieldValuesAttachments=Ra,s.selectProcedureStepFieldValuesAttachmentsByIds=PI,s.selectProcedureStepFieldValuesAttachmentsMapping=II,s.selectProcedureStepFieldValuesById=qI,s.selectProcedureStepFieldValuesByIds=CI,s.selectProcedureStepFieldValuesMapping=DI,s.selectProcedureStepFieldValuesOfProcedure=N_,s.selectProcedureStepFieldValuesOfProcedureAndProcedureStep=W_,s.selectProcedureStepFieldValuesOfProcedureStep=K_,s.selectProcedureStepFieldValuesReviewById=XI,s.selectProcedureStepFieldValuesReviews=ut,s.selectProcedureStepFieldValuesReviewsByIds=YI,s.selectProcedureStepFieldValuesReviewsMapping=WI,s.selectProcedureStepFieldValuesReviewsOfProcedure=Y_,s.selectProcedureStepFieldValuesReviewsOfProcedureAndProcedureStep=Z_,s.selectProcedureStepFields=xt,s.selectProcedureStepFieldsAttachmentById=ZT,s.selectProcedureStepFieldsAttachments=Pa,s.selectProcedureStepFieldsAttachmentsByIds=JT,s.selectProcedureStepFieldsAttachmentsMapping=XT,s.selectProcedureStepFieldsById=uI,s.selectProcedureStepFieldsByIds=lI,s.selectProcedureStepFieldsMapping=Fa,s.selectProcedureStepFieldsOfProcedureStep=L_,s.selectProcedureStepReviewerById=uO,s.selectProcedureStepReviewers=Rt,s.selectProcedureStepReviewersByIds=lO,s.selectProcedureStepReviewersMapping=dO,s.selectProcedureStepReviewersOfProcedure=Q_,s.selectProcedureStepReviewersOfProcedureAndProcedureStep=eg,s.selectProcedureStepReviewersOfProcedureStep=x_,s.selectProcedureSteps=Da,s.selectProcedureStepsByIds=FO,s.selectProcedureStepsMapping=ja,s.selectProcedureStepsMappingOfProcedureType=tg,s.selectProcedureStepsOfProcedureType=sg,s.selectProcedureTypeAttachmentById=qO,s.selectProcedureTypeAttachmentMapping=DO,s.selectProcedureTypeAttachments=Ca,s.selectProcedureTypeAttachmentsByIds=CO,s.selectProcedureTypeById=QP,s.selectProcedureTypeFields=es,s.selectProcedureTypeFieldsAttachmentById=JO,s.selectProcedureTypeFieldsAttachments=Ua,s.selectProcedureTypeFieldsAttachmentsByIds=QO,s.selectProcedureTypeFieldsAttachmentsMapping=ZO,s.selectProcedureTypeFieldsById=oP,s.selectProcedureTypeFieldsByIds=hP,s.selectProcedureTypeFieldsMapping=lP,s.selectProcedureTypeFieldsOfProcedureType=ng,s.selectProcedureTypes=Ya,s.selectProcedureTypesByIds=xP,s.selectProcedureTypesMapping=JP,s.selectProcedureTypesOfOrganization=dg,s.selectProcedures=rt,s.selectProceduresByIds=TA,s.selectProceduresMapping=SA,s.selectProceduresOfAsset=OA,s.selectProceduresOfAssets=PA,s.selectProceduresOfProcedureInitiative=bA,s.selectProceduresOfProcedureType=IA,s.selectProceduresOfProject=E_,s.selectProjectAccessById=Hf,s.selectProjectAccessMapping=aa,s.selectProjectAccesses=Ft,s.selectProjectAccessesByIds=Gf,s.selectProjectAccessesOfProject=I_,s.selectProjectAttachmentById=sS,s.selectProjectAttachmentMapping=tS,s.selectProjectAttachments=ca,s.selectProjectAttachmentsByIds=iS,s.selectProjectById=KS,s.selectProjectCommentById=fS,s.selectProjectCommentMapping=mS,s.selectProjectComments=Zt,s.selectProjectCommentsByIds=SS,s.selectProjectDocuments=qF,s.selectProjectFileById=vS,s.selectProjectFileMapping=wS,s.selectProjectFiles=ES,s.selectProjectFilesByIds=VS,s.selectProjectMapping=NS,s.selectProjects=Jt,s.selectProjectsByIds=WS,s.selectProjectsOfOrganization=M_,s.selectRehydrated=og,s.selectReviewsOfProcedureStepFieldValues=ZI,s.selectTeamById=gb,s.selectTeamMembershipById=pb,s.selectTeamMemberships=ts,s.selectTeamMembershipsByIds=yb,s.selectTeamMembershipsMapping=hb,s.selectTeams=xa,s.selectTeamsByIds=Mb,s.selectTeamsMapping=_b,s.selectTeamsOfOrganization=yg,s.selectUserById=Xt,s.selectUsers=Wt,s.selectUsersByIds=Ym,s.selectUsersMapping=xi,s.selectUsersOfOrganization=f_,s.selectUsersOfProject=P_,s.selectUsersOfTeam=pg,s.setAsset=Yn,s.setAssetAttachment=Tn,s.setAssetAttachments=In,s.setAssetComment=Vn,s.setAssetComments=Bn,s.setAssetType=Kr,s.setAssetTypeAttachment=nc,s.setAssetTypeAttachments=cc,s.setAssetTypeFieldValues=cr,s.setAssetTypeFieldValuesAttachment=Kc,s.setAssetTypeFieldValuesAttachments=Wc,s.setAssetTypeFieldValuesMany=rr,s.setAssetTypeFields=Bc,s.setAssetTypeFieldsAttachment=Tc,s.setAssetTypeFieldsAttachments=Ic,s.setAssetTypeFieldsMany=zc,s.setAssetTypeIdentifier=Ir,s.setAssetTypeIdentifierValue=zr,s.setAssetTypeIdentifierValues=jr,s.setAssetTypeIdentifiers=Or,s.setAssetTypeStatus=dd,s.setAssetTypeStatuses=ud,s.setAssetTypes=Wr,s.setAssets=Zn,s.setClientSDK=Qb,s.setClientStore=Zb,s.setConversation=pn,s.setConversations=mF,s.setCurrentUser=p_,s.setCurrentUserProfile=y_,s.setDocument=$d,s.setDocumentAttachment=_d,s.setDocumentAttachments=gd,s.setDocuments=Ud,s.setEmailDomain=xd,s.setEmailDomains=eu,s.setForm=Ml,s.setFormIdentifier=pu,s.setFormIdentifierValue=Mu,s.setFormIdentifierValues=Ru,s.setFormIdentifiers=yu,s.setFormRevision=el,s.setFormRevisionAttachment=ku,s.setFormRevisionAttachments=Lu,s.setFormRevisions=tl,s.setFormSubmission=lo,s.setFormSubmissionFieldValues=Jl,s.setFormSubmissionFieldValuesAttachment=Ul,s.setFormSubmissionFieldValuesAttachments=kl,s.setFormSubmissionFieldValuesMany=Ql,s.setFormSubmissions=oo,s.setFormSubscriber=pl,s.setFormSubscribers=yl,s.setForms=Rl,s.setGeoImage=Mo,s.setGeoImages=Ro,s.setIssue=Gh,s.setIssueAssociation=Lo,s.setIssueAssociations=ko,s.setIssueAttachment=ah,s.setIssueAttachments=nh,s.setIssueComment=Vh,s.setIssueCommentAttachment=Ah,s.setIssueCommentAttachments=Th,s.setIssueComments=Bh,s.setIssueType=cm,s.setIssueTypeAttachment=ap,s.setIssueTypeAttachments=np,s.setIssueTypeFieldValues=Vp,s.setIssueTypeFieldValuesAttachment=ny,s.setIssueTypeFieldValuesAttachments=cy,s.setIssueTypeFieldValuesMany=Bp,s.setIssueTypeFields=Kp,s.setIssueTypeFieldsAttachment=Ap,s.setIssueTypeFieldsAttachments=Tp,s.setIssueTypeFieldsMany=Wp,s.setIssueTypeIdentifier=Ty,s.setIssueTypeIdentifierValue=By,s.setIssueTypeIdentifierValues=zy,s.setIssueTypeIdentifiers=Iy,s.setIssueTypePriorities=Xy,s.setIssueTypePriority=Wy,s.setIssueTypeStatus=Im,s.setIssueTypeStatuses=Om,s.setIssueTypes=rm,s.setIssueUpdate=vm,s.setIssueUpdates=Vm,s.setIssues=Nh,s.setLoggedIn=Td,s.setOrganization=yf,s.setOrganizationAccess=ef,s.setOrganizationAccesses=tf,s.setOrganizations=pf,s.setProcedure=oA,s.setProcedureFieldValues=EP,s.setProcedureFieldValuesAttachment=fP,s.setProcedureFieldValuesAttachments=SP,s.setProcedureFieldValuesMany=vP,s.setProcedureInitiative=QS,s.setProcedureInitiatives=xS,s.setProcedureStep=yO,s.setProcedureStepAssignee=RA,s.setProcedureStepAssignees=wA,s.setProcedureStepComment=LA,s.setProcedureStepComments=HA,s.setProcedureStepDefaultAssignee=sT,s.setProcedureStepDefaultAssignees=iT,s.setProcedureStepDefaultReviewer=fT,s.setProcedureStepDefaultReviewers=ST,s.setProcedureStepEvent=ET,s.setProcedureStepEvents=vT,s.setProcedureStepFieldValues=wI,s.setProcedureStepFieldValuesAttachment=mI,s.setProcedureStepFieldValuesAttachments=fI,s.setProcedureStepFieldValuesMany=EI,s.setProcedureStepFieldValuesReview=LI,s.setProcedureStepFieldValuesReviews=HI,s.setProcedureStepFields=iI,s.setProcedureStepFieldsAttachment=HT,s.setProcedureStepFieldsAttachments=GT,s.setProcedureStepFieldsMany=aI,s.setProcedureStepReviewer=sO,s.setProcedureStepReviewers=iO,s.setProcedureSteps=mO,s.setProcedureType=GP,s.setProcedureTypeAttachment=wO,s.setProcedureTypeAttachments=EO,s.setProcedureTypeFields=iP,s.setProcedureTypeFieldsAttachment=HO,s.setProcedureTypeFieldsAttachments=GO,s.setProcedureTypeFieldsMany=aP,s.setProcedureTypes=NP,s.setProcedures=hA,s.setProject=qS,s.setProjectAccess=Df,s.setProjectAccesses=qf,s.setProjectAttachment=Yf,s.setProjectAttachments=Zf,s.setProjectComment=uS,s.setProjectComments=lS,s.setProjectFile=OS,s.setProjectFiles=PS,s.setProjects=DS,s.setRehydrated=lg,s.setTeam=Tb,s.setTeamMembership=nb,s.setTeamMemberships=cb,s.setTeams=Ib,s.setTokens=VF,s.setUser=Lm,s.setUsers=km,s.teamMembershipReducer=ob,s.teamMembershipSlice=Ja,s.teamReducer=Rb,s.teamSlice=Qa,s.updateAsset=Kn,s.updateAssetAttachment=On,s.updateAssetAttachments=Pn,s.updateAssetComment=zn,s.updateAssetComments=jn,s.updateAssetType=Zr,s.updateAssetTypeAttachment=rc,s.updateAssetTypeAttachments=dc,s.updateAssetTypeFieldValues=dr,s.updateAssetTypeFieldValuesAttachment=Xc,s.updateAssetTypeFieldValuesAttachments=Yc,s.updateAssetTypeFieldValuesMany=ur,s.updateAssetTypeFields=jc,s.updateAssetTypeFieldsAttachment=Oc,s.updateAssetTypeFieldsAttachments=Pc,s.updateAssetTypeFieldsMany=Dc,s.updateAssetTypeIdentifier=Pr,s.updateAssetTypeIdentifierValue=Dr,s.updateAssetTypeIdentifierValues=qr,s.updateAssetTypeIdentifiers=br,s.updateAssetTypeStatus=ld,s.updateAssetTypeStatuses=od,s.updateAssetTypes=Jr,s.updateAssets=Wn,s.updateConversation=yn,s.updateConversations=fF,s.updateDocument=kd,s.updateDocumentAttachment=Md,s.updateDocumentAttachments=Rd,s.updateDocuments=Ld,s.updateEmailDomain=tu,s.updateEmailDomains=su,s.updateForm=wl,s.updateFormIdentifier=mu,s.updateFormIdentifierValue=wu,s.updateFormIdentifierValues=Eu,s.updateFormIdentifiers=fu,s.updateFormRevision=sl,s.updateFormRevisionAttachment=Hu,s.updateFormRevisionAttachments=Gu,s.updateFormRevisions=il,s.updateFormSubmission=po,s.updateFormSubmissionFieldValues=xl,s.updateFormSubmissionFieldValuesAttachment=Ll,s.updateFormSubmissionFieldValuesAttachments=Hl,s.updateFormSubmissionFieldValuesMany=eo,s.updateFormSubmissions=yo,s.updateFormSubscriber=ml,s.updateFormSubscribers=fl,s.updateForms=El,s.updateGeoImage=vo,s.updateGeoImages=Vo,s.updateIssue=Kh,s.updateIssueAssociation=Ho,s.updateIssueAssociations=Go,s.updateIssueAttachment=ch,s.updateIssueAttachments=rh,s.updateIssueComment=zh,s.updateIssueCommentAttachment=Ih,s.updateIssueCommentAttachments=Oh,s.updateIssueComments=jh,s.updateIssueType=dm,s.updateIssueTypeAttachment=cp,s.updateIssueTypeAttachments=rp,s.updateIssueTypeFieldValues=zp,s.updateIssueTypeFieldValuesAttachment=ry,s.updateIssueTypeFieldValuesAttachments=dy,s.updateIssueTypeFieldValuesMany=jp,s.updateIssueTypeFields=Xp,s.updateIssueTypeFieldsAttachment=Ip,s.updateIssueTypeFieldsAttachments=Op,s.updateIssueTypeFieldsMany=Yp,s.updateIssueTypeIdentifier=Oy,s.updateIssueTypeIdentifierValue=jy,s.updateIssueTypeIdentifierValues=Dy,s.updateIssueTypeIdentifiers=Py,s.updateIssueTypePriorities=Zy,s.updateIssueTypePriority=Yy,s.updateIssueTypeStatus=Pm,s.updateIssueTypeStatuses=bm,s.updateIssueTypes=um,s.updateIssueUpdate=Bm,s.updateIssueUpdates=zm,s.updateIssues=Wh,s.updateOrganization=Af,s.updateOrganizationAccess=sf,s.updateOrganizationAccesses=af,s.updateOrganizations=Sf,s.updateProcedure=pA,s.updateProcedureFieldValues=VP,s.updateProcedureFieldValuesAttachment=AP,s.updateProcedureFieldValuesAttachments=TP,s.updateProcedureFieldValuesMany=BP,s.updateProcedureInitiative=eA,s.updateProcedureInitiatives=tA,s.updateProcedureStep=AO,s.updateProcedureStepAssignee=EA,s.updateProcedureStepAssignees=vA,s.updateProcedureStepComment=GA,s.updateProcedureStepComments=NA,s.updateProcedureStepDefaultAssignee=aT,s.updateProcedureStepDefaultAssignees=nT,s.updateProcedureStepDefaultReviewer=AT,s.updateProcedureStepDefaultReviewers=TT,s.updateProcedureStepEvent=VT,s.updateProcedureStepEvents=BT,s.updateProcedureStepFieldValues=vI,s.updateProcedureStepFieldValuesAttachment=SI,s.updateProcedureStepFieldValuesAttachments=AI,s.updateProcedureStepFieldValuesMany=VI,s.updateProcedureStepFieldValuesReview=GI,s.updateProcedureStepFieldValuesReviews=NI,s.updateProcedureStepFields=nI,s.updateProcedureStepFieldsAttachment=NT,s.updateProcedureStepFieldsAttachments=KT,s.updateProcedureStepFieldsMany=cI,s.updateProcedureStepReviewer=aO,s.updateProcedureStepReviewers=nO,s.updateProcedureSteps=TO,s.updateProcedureType=KP,s.updateProcedureTypeAttachment=vO,s.updateProcedureTypeAttachments=VO,s.updateProcedureTypeFields=nP,s.updateProcedureTypeFieldsAttachment=NO,s.updateProcedureTypeFieldsAttachments=KO,s.updateProcedureTypeFieldsMany=cP,s.updateProcedureTypes=WP,s.updateProcedures=yA,s.updateProject=kS,s.updateProjectAccess=Cf,s.updateProjectAccesses=$f,s.updateProjectAttachment=Jf,s.updateProjectAttachments=Qf,s.updateProjectComment=oS,s.updateProjectComments=hS,s.updateProjectFile=_S,s.updateProjectFiles=gS,s.updateProjects=US,s.updateTeam=Ob,s.updateTeamMembership=rb,s.updateTeamMemberships=db,s.updateTeams=Pb,s.updateUser=Nm,s.updateUsers=Gm,s.useSelectorBuilder=hF,s.userReducer=Wm,s.userSlice=Zi,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})}));