@overmap-ai/core 1.0.78-status-models.1 → 1.0.78-status-models.3

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.
Files changed (42) hide show
  1. package/dist/enums/asset.d.ts +8 -0
  2. package/dist/enums/index.d.ts +1 -0
  3. package/dist/overmap-core.js +4067 -3924
  4. package/dist/overmap-core.umd.cjs +9 -9
  5. package/dist/sdk/services/AssetTypeStatusService.d.ts +11 -0
  6. package/dist/sdk/services/index.d.ts +1 -0
  7. package/dist/store/reducers.d.ts +3 -0
  8. package/dist/store/slices/assetProcedureSlice.d.ts +1 -0
  9. package/dist/store/slices/assetProcedureStepFieldValuesAttachmentSlice.d.ts +1 -0
  10. package/dist/store/slices/assetProcedureStepFieldValuesSlice.d.ts +1 -0
  11. package/dist/store/slices/assetProcedureStepFieldsAttachmentSlice.d.ts +1 -0
  12. package/dist/store/slices/assetProcedureStepFieldsSlice.d.ts +2 -0
  13. package/dist/store/slices/assetProcedureStepSlice.d.ts +1 -0
  14. package/dist/store/slices/assetProcedureTypeFieldValuesAttachmentSlice.d.ts +1 -0
  15. package/dist/store/slices/assetProcedureTypeFieldValuesSlice.d.ts +1 -0
  16. package/dist/store/slices/assetProcedureTypeFieldsAttachmentSlice.d.ts +1 -0
  17. package/dist/store/slices/assetSlice.d.ts +1 -0
  18. package/dist/store/slices/assetStageCompletionSlice.d.ts +1 -0
  19. package/dist/store/slices/assetStageSlice.d.ts +1 -0
  20. package/dist/store/slices/assetTypeFieldValuesAttachmentSlice.d.ts +1 -0
  21. package/dist/store/slices/assetTypeFieldValuesSlice.d.ts +1 -0
  22. package/dist/store/slices/assetTypeFieldsAttachmentSlice.d.ts +1 -0
  23. package/dist/store/slices/assetTypeFieldsSlice.d.ts +1 -0
  24. package/dist/store/slices/assetTypeStatusSlice.d.ts +139 -0
  25. package/dist/store/slices/categorySlice.d.ts +1 -0
  26. package/dist/store/slices/emailDomainsSlice.d.ts +1 -0
  27. package/dist/store/slices/formRevisionSlice.d.ts +1 -0
  28. package/dist/store/slices/formSlice.d.ts +1 -0
  29. package/dist/store/slices/geoImageSlice.d.ts +1 -0
  30. package/dist/store/slices/index.d.ts +1 -0
  31. package/dist/store/slices/issueAssociationSlice.d.ts +1 -0
  32. package/dist/store/slices/issueTypeFieldValuesAttachmentSlice.d.ts +1 -0
  33. package/dist/store/slices/issueTypeFieldValuesSlice.d.ts +1 -0
  34. package/dist/store/slices/issueTypeFieldsAttachmentSlice.d.ts +1 -0
  35. package/dist/store/slices/issueTypeFieldsSlice.d.ts +1 -0
  36. package/dist/store/slices/issueTypeStatusSlice.d.ts +1 -0
  37. package/dist/store/slices/organizationSlice.d.ts +1 -0
  38. package/dist/store/slices/projectFileSlice.d.ts +1 -0
  39. package/dist/store/slices/projectSlice.d.ts +1 -0
  40. package/dist/store/slices/userSlice.d.ts +1 -0
  41. package/dist/typings/models/assets.d.ts +10 -1
  42. package/package.json +1 -1
@@ -1,15 +1,15 @@
1
- (function(s,D){typeof exports=="object"&&typeof module<"u"?D(exports,require("@redux-offline/redux-offline/lib/types"),require("@reduxjs/toolkit"),require("superagent"),require("uuid"),require("file-saver"),require("fast-tree-builder"),require("ts-tree-lib"),require("react"),require("@redux-offline/redux-offline"),require("@redux-offline/redux-offline/lib/defaults"),require("buffer"),require("localforage"),require("redux-persist-migrate"),require("@overmap-ai/forms"),require("idb"),require("jwt-decode"),require("dependency-graph"),require("@tiptap/core")):typeof define=="function"&&define.amd?define(["exports","@redux-offline/redux-offline/lib/types","@reduxjs/toolkit","superagent","uuid","file-saver","fast-tree-builder","ts-tree-lib","react","@redux-offline/redux-offline","@redux-offline/redux-offline/lib/defaults","buffer","localforage","redux-persist-migrate","@overmap-ai/forms","idb","jwt-decode","dependency-graph","@tiptap/core"],D):(s=typeof globalThis<"u"?globalThis:s||self,D(s["overmap-core"]={},null,s.toolkit,s.request,s.uuid,s.fileSaver,s.buildTree,s.tsTreeLib,s.react,s.reduxOffline,s.offlineConfig,null,s.localforage,s.createMigration,null,s.idb,s.jwtDecode,s.dependencyGraph))})(this,function(s,D,d,Xe,Qe,ty,sy,cc,iy,ay,rc,XF,ny,cy,QF,ry,dy,uy){"use strict";var ZF=Object.defineProperty;var JF=(s,D,d)=>D in s?ZF(s,D,{enumerable:!0,configurable:!0,writable:!0,value:d}):s[D]=d;var T=(s,D,d)=>JF(s,typeof D!="symbol"?D+"":D,d);var ey;const dc=Object.freeze([]),uc=Object.freeze({});var oc=(t=>(t[t.GUEST=0]="GUEST",t[t.BASIC=2]="BASIC",t[t.ADMIN=4]="ADMIN",t))(oc||{}),l=(t=>(t.GET="GET",t.POST="POST",t.PATCH="PATCH",t.PUT="PUT",t.DELETE="DELETE",t))(l||{}),lc=(t=>(t.Issue="issue",t.Asset="asset",t.AssetType="asset_type",t.Project="project",t.Document="document",t))(lc||{}),ts=(t=>(t[t.LOWEST=0]="LOWEST",t[t.LOW=2]="LOW",t[t.MEDIUM=4]="MEDIUM",t[t.HIGH=6]="HIGH",t[t.HIGHEST=8]="HIGHEST",t))(ts||{}),ss=(t=>(t[t.BACKLOG=0]="BACKLOG",t[t.SELECTED=2]="SELECTED",t[t.DONE=4]="DONE",t))(ss||{}),E=(t=>(t.STATUS="status",t.PRIORITY="priority",t.CATEGORY="category",t.DESCRIPTION="description",t.TITLE="title",t.ASSIGNED_TO="assigned_to",t.DUE_DATE="due_date",t))(E||{}),hc=(t=>(t[t.BACKLOG=0]="BACKLOG",t[t.PLANNED=1]="PLANNED",t[t.IN_PROGRESS=2]="IN_PROGRESS",t[t.COMPLETED=3]="COMPLETED",t[t.CANCELLED=4]="CANCELLED",t))(hc||{});const oy=ss.BACKLOG,ly=ts.MEDIUM,mc=6e4;function P(t){return{addOne:(p,y)=>{const A=t(y.payload);p.instances[A]=y.payload},addMany:(p,y)=>{for(const A of y.payload){const g=t(A);p.instances[g]=A}},setOne:(p,y)=>{const A=t(y.payload);p.instances[A]=y.payload},setMany:(p,y)=>{for(const A of y.payload){const g=t(A);p.instances[g]=A}},updateOne:(p,y)=>{const A=t(y.payload);p.instances[A]=y.payload},updateMany:(p,y)=>{for(const A of y.payload){const g=t(A);p.instances[g]=A}},deleteOne:(p,y)=>{delete p.instances[y.payload]},deleteMany:(p,y)=>{for(const A of y.payload)delete p.instances[A]},initialize:(p,y)=>{p.instances={};const A=new Set;for(const g of y.payload){const F=t(g);A.add(F),p.instances[F]=g}A.size!==y.payload.length&&console.warn("duplicate ids detected when initializing model instances.")},getInitialState:p=>({...p,instances:{}})}}function hy(){return{initializeSelection:(m,o)=>{m.selection=Array.from(new Set(o.payload))},selectOne:(m,o)=>{new Set(m.selection).has(o.payload)||m.selection.push(o.payload)},selectMany:(m,o)=>{const h=new Set(m.selection);for(const p of o.payload)h.has(p)||h.add(p);m.selection=Array.from(h)},unselectOne:(m,o)=>{const h=new Set(m.selection);h.has(o.payload)&&(h.delete(o.payload),m.selection=Array.from(h))},unselectMany:(m,o)=>{const h=new Set(m.selection);for(const p of o.payload)h.has(p)&&h.delete(p);m.selection=Array.from(h)},toggleOne:(m,o)=>{const h=new Set(m.selection);h.has(o.payload)?h.delete(o.payload):h.add(o.payload),m.selection=Array.from(h)},toggleMany:(m,o)=>{const h=new Set(m.selection);for(const p of o.payload)h.has(p)?h.delete(p):h.add(p);m.selection=Array.from(h)},getInitialState:m=>({...m,selection:[]})}}const at="versioning",I=d.createAction("RESET"),M=d.createAction("RESET_PROJECT_STATE"),O=d.createAction("RESET_ORGANIZATION_STATE");ey=Symbol.toStringTag;class pc{constructor(){T(this,ey,"Promise");T(this,"_promise");T(this,"_resolve");T(this,"_reject");T(this,"_state","pending");this._resolve=null,this._reject=null,this._promise=new Promise((e,i)=>{this._resolve=e,this._reject=i})}get state(){return this._state}then(e,i){return this._promise.then(e,i)}catch(e){return this._promise.catch(e)}resolve(e){if(!this._resolve)throw new Error("No resolve callback");this._resolve(e),this._state="fulfilled"}reject(e){if(!this._reject)throw e;this._reject(e),this._state="rejected"}finally(e){throw new Error("`finally` not implemented")}}let is=!1;["true","1"].includes("".toLowerCase())&&(is=!0);function my(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;const i=Object.keys(t),a=Object.keys(e),n=i.length;if(n!==a.length)return!1;for(let c=0;c<n;c++){const r=i[c];if(!Object.prototype.hasOwnProperty.call(e,r)||t[r]!==e[r])return!1}return!0}function as(t){const e={};return function(){const i=Array.prototype.slice.call(arguments);return i in e?(is&&console.debug(`Memoization debug: Using memorized return value for ${t.toString()}(`,i,")"),e[i]):(is&&console.debug(`Memoization debug: Cache miss! Memoizing ${t.toString()}(`,i,")"),e[i]=t.apply(this,i))}}function py(t,e){if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}const S=t=>t.length===0?dc:t,Rt=t=>Object.keys(t).length===0?uc:t,yc=as(t=>{if(!t)return"";const e=new Date(t),i=e.getFullYear()===ns.getFullYear(),a={day:"numeric",month:"short"};return i||(a.year="numeric"),e.toLocaleDateString([],a)}),yy=new Intl.RelativeTimeFormat([],{style:"long",numeric:"auto"}),Ay=1e3*86400,ns=new Date,fy=t=>new Date(t).toDateString()===ns.toDateString(),Sy=as((t,e,i)=>{const a=Math.round((new Date(t).getTime()-ns.getTime())/Ay);return a<e||a>i?yc(t):yy.format(a,"days")});function Ty(t){return new Uint8Array(t).reduce((i,a)=>i+a.toString(16).padStart(2,"0"),"")}const cs=async(t,e)=>{e||(e=await xe(t));let i=t.type;if(i.includes("/")&&(i=i.split("/")[1]),!i)throw new Error(`Could not extract file type from ${t.type}`);return`${e}.${i}`};function xe(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 r=Ty(c);e(r)})},a.readAsArrayBuffer(t)})}function Iy(t){if(!t.name||!t.type||!t.size){const e="File has no name, type, and/or size";throw new Error(e)}return`${t.name}&${t.type}${t.size}`}function Ac(t,e){return new File([t],e,{type:t.type})}function gy(t,e){const i=document.createElement("a");i.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(e)),i.setAttribute("download",t),i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i)}const by=async t=>{const e={};for(const i of t){const a=await xe(i);e[a]={sha1:a,extension:i.name.split(".").pop()||"",file_type:i.type,size:i.size}}return Object.values(e)},fc=async t=>(await fetch(t)).blob(),Fy=t=>new Promise((e,i)=>{const a=new FileReader;a.onloadend=()=>{var n;e(((n=a.result)==null?void 0:n.toString())||"")},a.readAsDataURL(t)});function Py(t){const e=new Blob([t]);ty.saveAs(e,t.name)}const Sc={};function Oy(t,e,i,...a){const n=Sc[t];let c=!1;n?n[e]||(n[e]=!0,c=!0):(Sc[t]={[e]:!0},c=!0),c&&console[i](...a)}const Tc=["created_at","updated_at","index","revision"];function b(t){return{...t,uuid:Qe.v4()}}function Ic(t){const e={};for(const i of t)e[i.uuid]=i;return e}function gc(t){return t.map(({uuid:e})=>e)}function _y(t,e=void 0,i=255){let a=t.replace(/[^a-z0-9_\-.]/gi,"_").replace(/_{2,}/g,"_");if(!e){const c=t.split(".");c.length>1&&(e=c[c.length-1])}e&&!e.startsWith(".")&&(e="."+e);const n=e?e.length:0;return a.length+n>i&&(a=a.slice(0,i-n)+(e||"")),a}function Ry(t){return t.toLowerCase().replace(" ","-")}function vy(t,e=!1){return t.normalize("NFKD").toLowerCase().replace(/[^\w\s-]/g,"").trim().replace(/[-\s]+/g,e?"_":"-")}function wy(t,e){if(t.length<=e)return t;const i=t.slice(0,e-1);return i.slice(0,i.lastIndexOf(" "))+"…"}const f=t=>e=>i=>t(i,e);function bc(t,e,i){return i.findIndex(a=>a.uuid===t.uuid)===e}function My(t,e,i){return i.findIndex(a=>a.file_sha1===t.file_sha1)===e}const Ey=/^.+@.+\..+$/;function v(t){const e={...t};for(const i of[...Tc,"created_by"])i in e&&delete e[i];return e}const Fc=t=>{const e=t.toSorted((i,a)=>i.order-a.order);return sy(e,{id:i=>i.uuid,parentId:i=>i.parent,includeEmptyChildrenArray:!0,valueKey:!1})},Vy=t=>{const{roots:e}=Fc(t);return e.map(i=>new cc.Tree(i))},Pc=(t,e)=>{const{nodes:i}=Fc(e),a=i.get(t);if(!a)throw new Error(`Node with uuid ${t} does not exist in asset procedure step tree.`);return new cc.Tree(a)},k=P(t=>t.uuid),Oc=k.getInitialState({}),rs=d.createSlice({name:"agents",initialState:Oc,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,O),e=>Object.assign(e,Oc)),reducers:{initializeConversations:k.initialize,addConversation:k.addOne,addConversations:k.addMany,setConversation:k.setOne,setConversations:k.setMany,updateConversation:k.updateOne,updateConversations:k.updateMany,deleteConversation:k.deleteOne,deleteConversations:k.deleteMany}}),{initializeConversations:_c,addConversation:Rc,addConversations:jy,setConversation:vc,setConversations:qy,updateConversation:wc,updateConversations:zy,deleteConversation:Dy,deleteConversations:Uy}=rs.actions,ds=t=>t.agentsReducer.instances,Cy=d.createSelector([ds],t=>Object.values(t)),ky=f(d.createSelector([ds,(t,e)=>e],(t,e)=>t[e])),Mc=rs.reducer,B=P(t=>t.uuid),Ec=B.getInitialState({}),us=d.createSlice({name:"assetAttachments",initialState:Ec,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,O),e=>Object.assign(e,Ec)),reducers:{initializeAssetAttachments:B.initialize,addAssetAttachment:B.addOne,addAssetAttachments:B.addMany,setAssetAttachment:B.setOne,setAssetAttachments:B.setMany,updateAssetAttachment:B.updateOne,updateAssetAttachments:B.updateMany,deleteAssetAttachment:B.deleteOne,deleteAssetAttachments:B.deleteMany}}),{initializeAssetAttachments:os,addAssetAttachment:By,addAssetAttachments:ls,setAssetAttachment:Vc,setAssetAttachments:$y,updateAssetAttachment:Gy,updateAssetAttachments:jc,deleteAssetAttachment:qc,deleteAssetAttachments:hs}=us.actions,zc=t=>t.assetAttachmentReducer.instances,Dc=d.createSelector([zc],t=>Object.values(t)),Uc=t=>e=>e.assetAttachmentReducer.instances[t],Cc=f(d.createSelector([Dc,(t,e)=>e],(t,e)=>S(t.filter(({asset:i})=>e===i)))),kc=us.reducer,$=P(({uuid:t})=>t),Bc=$.getInitialState({}),ms=d.createSlice({name:"assetProcedureTypeAttachments",initialState:Bc,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Bc)),reducers:{initializeAssetProcedureTypeAttachments:$.initialize,addAssetProcedureTypeAttachment:$.addOne,addAssetProcedureTypeAttachments:$.addMany,setAssetProcedureTypeAttachment:$.setOne,setAssetProcedureTypeAttachments:$.setMany,updateAssetProcedureTypeAttachment:$.updateOne,updateAssetProcedureTypeAttachments:$.updateMany,deleteAssetProcedureTypeAttachment:$.deleteOne,deleteAssetProcedureTypeAttachments:$.deleteMany}}),{initializeAssetProcedureTypeAttachments:$c,addAssetProcedureTypeAttachment:Ly,addAssetProcedureTypeAttachments:Gc,setAssetProcedureTypeAttachment:Lc,setAssetProcedureTypeAttachments:Ny,updateAssetProcedureTypeAttachment:Hy,updateAssetProcedureTypeAttachments:Nc,deleteAssetProcedureTypeAttachment:Hc,deleteAssetProcedureTypeAttachments:Wc}=ms.actions,Kc=ms.reducer,Yc=t=>t.assetProcedureTypeAttachmentReducer.instances,Zc=d.createSelector([Yc],t=>Object.values(t)),Jc=t=>e=>e.assetProcedureTypeAttachmentReducer.instances[t],Wy=f(d.createSelector([Zc,(t,e)=>e],(t,e)=>S(t.filter(({asset_procedure_type:i})=>e===i)))),G=P(({uuid:t})=>t),Xc=G.getInitialState({}),ps=d.createSlice({name:"assetProcedureTypeFieldsAttachments",initialState:Xc,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Xc)),reducers:{initializeAssetProcedureTypeFieldsAttachments:G.initialize,addAssetProcedureTypeFieldsAttachment:G.addOne,addAssetProcedureTypeFieldsAttachments:G.addMany,setAssetProcedureTypeFieldsAttachment:G.setOne,setAssetProcedureTypeFieldsAttachments:G.setMany,updateAssetProcedureTypeFieldsAttachment:G.updateOne,updateAssetProcedureTypeFieldsAttachments:G.updateMany,deleteAssetProcedureTypeFieldsAttachment:G.deleteOne,deleteAssetProcedureTypeFieldsAttachments:G.deleteMany}}),{initializeAssetProcedureTypeFieldsAttachments:Qc,addAssetProcedureTypeFieldsAttachment:Ky,addAssetProcedureTypeFieldsAttachments:xc,setAssetProcedureTypeFieldsAttachment:Yy,setAssetProcedureTypeFieldsAttachments:Zy,updateAssetProcedureTypeFieldsAttachment:Jy,updateAssetProcedureTypeFieldsAttachments:er,deleteAssetProcedureTypeFieldsAttachment:Xy,deleteAssetProcedureTypeFieldsAttachments:tr}=ps.actions,sr=ps.reducer,ir=t=>t.assetProcedureTypeFieldsAttachmentReducer.instances,ar=d.createSelector([ir],t=>Object.values(t)),Qy=f(d.createSelector([ar,(t,e)=>e],(t,e)=>S(t.filter(i=>i.fields_revision===e)))),xy=t=>e=>e.assetProcedureTypeFieldsAttachmentReducer.instances[t],L=P(({uuid:t})=>t),nr=L.getInitialState({}),ys=d.createSlice({name:"assetProcedureTypeFields",initialState:nr,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,nr)),reducers:{initializeAssetProcedureTypeFields:L.initialize,addAssetProcedureTypeFields:L.addOne,addAssetProcedureTypeFieldsMany:L.addMany,setAssetProcedureTypeFields:L.setOne,setAssetProcedureTypeFieldsMany:L.setMany,updateAssetProcedureTypeFields:L.updateOne,updateAssetProcedureTypeFieldsMany:L.updateMany,deleteAssetProcedureTypeFields:L.deleteOne,deleteAssetProcedureTypeFieldsMany:L.deleteMany}}),{initializeAssetProcedureTypeFields:cr,addAssetProcedureTypeFields:rr,addAssetProcedureTypeFieldsMany:eA,setAssetProcedureTypeFields:tA,setAssetProcedureTypeFieldsMany:sA,updateAssetProcedureTypeFields:dr,updateAssetProcedureTypeFieldsMany:iA,deleteAssetProcedureTypeFields:ur,deleteAssetProcedureTypeFieldsMany:aA}=ys.actions,or=ys.reducer,lr=t=>t.assetProcedureTypeFieldsReducer.instances,As=d.createSelector([lr],t=>Object.values(t)),nA=f(d.createSelector([As,(t,e)=>e],(t,e)=>S(t.filter(i=>i.asset_procedure_type===e)))),cA=f(d.createSelector([As,(t,e)=>e],(t,e)=>t.filter(i=>i.asset_procedure_type===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),rA=t=>e=>e.assetProcedureTypeFieldsReducer.instances[t],N=P(({uuid:t})=>t),hr=N.getInitialState({}),fs=d.createSlice({name:"assetProcedureTypeFieldValuesAttachments",initialState:hr,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,O),e=>Object.assign(e,hr)),reducers:{initializeAssetProcedureTypeFieldValuesAttachments:N.initialize,addAssetProcedureTypeFieldValuesAttachment:N.addOne,addAssetProcedureTypeFieldValuesAttachments:N.addMany,setAssetProcedureTypeFieldValuesAttachment:N.setOne,setAssetProcedureTypeFieldValuesAttachments:N.setMany,updateAssetProcedureTypeFieldValuesAttachment:N.updateOne,updateAssetProcedureTypeFieldValuesAttachments:N.updateMany,deleteAssetProcedureTypeFieldValuesAttachment:N.deleteOne,deleteAssetProcedureTypeFieldValuesAttachments:N.deleteMany}}),{initializeAssetProcedureTypeFieldValuesAttachments:mr,addAssetProcedureTypeFieldValuesAttachment:dA,addAssetProcedureTypeFieldValuesAttachments:vt,setAssetProcedureTypeFieldValuesAttachment:uA,setAssetProcedureTypeFieldValuesAttachments:oA,updateAssetProcedureTypeFieldValuesAttachment:lA,updateAssetProcedureTypeFieldValuesAttachments:pr,deleteAssetProcedureTypeFieldValuesAttachment:hA,deleteAssetProcedureTypeFieldValuesAttachments:wt}=fs.actions,yr=fs.reducer,Ss=t=>t.assetProcedureTypeFieldValuesAttachmentReducer.instances,Ar=d.createSelector([Ss],t=>Object.values(t)),mA=t=>e=>e.assetProcedureTypeFieldValuesAttachmentReducer.instances[t],fr=f(d.createSelector([Ss,(t,e)=>e],(t,e)=>{const i=new Set(e);return S(Object.values(t).filter(a=>i.has(a.uuid)))})),Sr=f(d.createSelector([Ar,(t,e)=>e],(t,e)=>S(t.filter(i=>i.field_values===e)))),H=P(({uuid:t})=>t),Tr=H.getInitialState({}),Ts=d.createSlice({name:"assetProcedureTypeFieldValues",initialState:Tr,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,O),e=>Object.assign(e,Tr)),reducers:{initializeAssetProcedureTypeFieldValues:H.initialize,addAssetProcedureTypeFieldValues:H.addOne,addAssetProcedureTypeFieldValuesMany:H.addMany,setAssetProcedureTypeFieldValues:H.setOne,setAssetProcedureTypeFieldValuesMany:H.setMany,updateAssetProcedureTypeFieldValues:H.updateOne,updateAssetProcedureTypeFieldValuesMany:H.updateMany,deleteAssetProcedureTypeFieldValues:H.deleteOne,deleteAssetProcedureTypeFieldValuesMany:H.deleteMany}}),{initializeAssetProcedureTypeFieldValues:Ir,addAssetProcedureTypeFieldValues:Is,addAssetProcedureTypeFieldValuesMany:gr,setAssetProcedureTypeFieldValues:pA,setAssetProcedureTypeFieldValuesMany:yA,updateAssetProcedureTypeFieldValues:nt,updateAssetProcedureTypeFieldValuesMany:br,deleteAssetProcedureTypeFieldValues:gs,deleteAssetProcedureTypeFieldValuesMany:Fr}=Ts.actions,Pr=Ts.reducer,Or=t=>t.assetProcedureFieldValuesReducer.instances,bs=d.createSelector([Or],t=>Object.values(t)),AA=f(d.createSelector([bs,(t,e)=>e],(t,e)=>S(t.filter(i=>i.asset===e)))),fA=f(d.createSelector([bs,(t,e)=>e],(t,e)=>S(t.filter(i=>i.asset_procedure===e)))),Fs=t=>e=>e.assetProcedureFieldValuesReducer.instances[t],W=P(({uuid:t})=>t),_r=W.getInitialState({}),Ps=d.createSlice({name:"assetProcedures",initialState:_r,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,O),e=>Object.assign(e,_r)),reducers:{initializeAssetProcedures:W.initialize,addAssetProcedure:W.addOne,addAssetProcedures:W.addMany,setAssetProcedure:W.setOne,setAssetProcedures:W.setMany,updateAssetProcedure:W.updateOne,updateAssetProcedures:W.updateMany,deleteAssetProcedure:W.deleteOne,deleteAssetProcedures:W.deleteMany}}),{initializeAssetProcedures:Rr,addAssetProcedure:Os,addAssetProcedures:vr,updateAssetProcedure:ct,updateAssetProcedures:SA,deleteAssetProcedure:_s,deleteAssetProcedures:wr,setAssetProcedure:TA,setAssetProcedures:IA}=Ps.actions,Mr=Ps.reducer,Rs=t=>t.assetProcedureReducer.instances,vs=d.createSelector([Rs],t=>Object.values(t)),Er=f(d.createSelector([vs,(t,e)=>e],(t,e)=>S(t.filter(i=>i.asset_procedure_type===e)))),gA=f(d.createSelector([vs,(t,e)=>e],(t,e)=>S(t.filter(i=>i.asset_type===e)))),ws=t=>e=>e.assetProcedureReducer.instances[t],bA=f(d.createSelector([Rs,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n&&i.push(n)}return S(i)})),K=P(t=>t.uuid),Vr=K.getInitialState({}),Ms=d.createSlice({name:"assetProcedureTypes",initialState:Vr,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Vr)),reducers:{initializeAssetProcedureTypes:K.initialize,addAssetProcedureType:K.addOne,addAssetProcedureTypes:K.addMany,setAssetProcedureType:K.setOne,setAssetProcedureTypes:K.setMany,updateAssetProcedureType:K.updateOne,updateAssetProcedureTypes:K.updateMany,deleteAssetProcedureType:K.deleteOne,deleteAssetProcedureTypes:K.deleteMany}}),{initializeAssetProcedureTypes:jr,addAssetProcedureType:Es,addAssetProcedureTypes:FA,updateAssetProcedureType:rt,updateAssetProcedureTypes:PA,deleteAssetProcedureType:Vs,deleteAssetProcedureTypes:OA,setAssetProcedureType:_A,setAssetProcedureTypes:RA}=Ms.actions,qr=Ms.reducer,js=t=>t.assetProcedureTypeReducer.instances,zr=d.createSelector([js],t=>Object.values(t)),qs=t=>e=>e.assetProcedureTypeReducer.instances[t],vA=f(d.createSelector([js,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n&&i.push(n)}return S(i)})),wA=f(d.createSelector([zr,(t,e)=>e],(t,e)=>S(t.filter(i=>i.organization===e)))),Y=P(t=>t.uuid),Dr=Y.getInitialState({}),zs=d.createSlice({name:"assetProcedureStepFieldsAttachments",initialState:Dr,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Dr)),reducers:{initializeAssetProcedureStepFieldsAttachments:Y.initialize,addAssetProcedureStepFieldsAttachment:Y.addOne,addAssetProcedureStepFieldsAttachments:Y.addMany,setAssetProcedureStepFieldsAttachment:Y.setOne,setAssetProcedureStepFieldsAttachments:Y.setMany,updateAssetProcedureStepFieldsAttachment:Y.updateOne,updateAssetProcedureStepFieldsAttachments:Y.updateMany,deleteAssetProcedureStepFieldsAttachment:Y.deleteOne,deleteAssetProcedureStepFieldsAttachments:Y.deleteMany}}),{initializeAssetProcedureStepFieldsAttachments:Ur,addAssetProcedureStepFieldsAttachment:MA,addAssetProcedureStepFieldsAttachments:Cr,setAssetProcedureStepFieldsAttachment:EA,setAssetProcedureStepFieldsAttachments:VA,updateAssetProcedureStepFieldsAttachment:jA,updateAssetProcedureStepFieldsAttachments:kr,deleteAssetProcedureStepFieldsAttachment:qA,deleteAssetProcedureStepFieldsAttachments:Br}=zs.actions,$r=t=>t.assetProcedureStepFieldsAttachmentReducer.instances,Gr=d.createSelector([$r],t=>Object.values(t)),zA=f(d.createSelector([Gr,(t,e)=>e],(t,e)=>S(t.filter(i=>i.fields_revision===e)))),DA=t=>e=>e.assetProcedureStepFieldsAttachmentReducer.instances[t],Lr=zs.reducer,Z=P(t=>t.uuid),Nr=Z.getInitialState({}),Ds=d.createSlice({name:"assetProcedureStepFields",initialState:Nr,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Nr)),reducers:{initializeAssetProcedureStepFields:Z.initialize,addAssetProcedureStepFields:Z.addOne,addAssetProcedureStepFieldsMany:Z.addMany,setAssetProcedureStepFields:Z.setOne,setAssetProcedureStepFieldsMany:Z.setMany,updateAssetProcedureStepFields:Z.updateOne,updateAssetProcedureStepFieldsMany:Z.updateMany,deleteAssetProcedureStepFields:Z.deleteOne,deleteAssetProcedureStepFieldsMany:Z.deleteMany}}),{initializeAssetProcedureStepFields:Hr,addAssetProcedureStepFields:Us,addAssetProcedureStepFieldsMany:UA,setAssetProcedureStepFields:CA,setAssetProcedureStepFieldsMany:kA,updateAssetProcedureStepFields:dt,updateAssetProcedureStepFieldsMany:BA,deleteAssetProcedureStepFields:Cs,deleteAssetProcedureStepFieldsMany:$A}=Ds.actions,ks=t=>t.assetProcedureStepFieldsReducer.instances,Bs=d.createSelector([ks],t=>Object.values(t)),GA=f(d.createSelector([Bs,(t,e)=>e],(t,e)=>S(t.filter(i=>i.asset_procedure_step===e)))),LA=f(d.createSelector([Bs,(t,e)=>e],(t,e)=>t.filter(i=>i.asset_procedure_step===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),NA=d.createSelector([ks],t=>{const e={};for(const i of Object.values(t)){const a=e[i.asset_procedure_step];(!a||a.submitted_at<i.submitted_at)&&(e[i.asset_procedure_step]=i)}return e}),HA=t=>e=>e.assetProcedureStepFieldsReducer.instances[t],Wr=Ds.reducer,J=P(t=>t.uuid),Kr=J.getInitialState({}),$s=d.createSlice({name:"assetProcedureStepFieldValuesAttachments",initialState:Kr,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,O),e=>Object.assign(e,Kr)),reducers:{initializeAssetProcedureStepFieldValuesAttachments:J.initialize,addAssetProcedureStepFieldValuesAttachment:J.addOne,addAssetProcedureStepFieldValuesAttachments:J.addMany,setAssetProcedureStepFieldValuesAttachment:J.setOne,setAssetProcedureStepFieldValuesAttachments:J.setMany,updateAssetProcedureStepFieldValuesAttachment:J.updateOne,updateAssetProcedureStepFieldValuesAttachments:J.updateMany,deleteAssetProcedureStepFieldValuesAttachment:J.deleteOne,deleteAssetProcedureStepFieldValuesAttachments:J.deleteMany}}),{initializeAssetProcedureStepFieldValuesAttachments:Yr,addAssetProcedureStepFieldValuesAttachment:WA,addAssetProcedureStepFieldValuesAttachments:Mt,setAssetProcedureStepFieldValuesAttachment:KA,setAssetProcedureStepFieldValuesAttachments:YA,updateAssetProcedureStepFieldValuesAttachment:ZA,updateAssetProcedureStepFieldValuesAttachments:Zr,deleteAssetProcedureStepFieldValuesAttachment:JA,deleteAssetProcedureStepFieldValuesAttachments:Et}=$s.actions,Gs=t=>t.assetProcedureStepFieldValuesAttachmentReducer.instances,Jr=d.createSelector([Gs],t=>Object.values(t)),XA=t=>e=>e.assetProcedureStepFieldValuesAttachmentReducer.instances[t],Xr=f(d.createSelector([Gs,(t,e)=>e],(t,e)=>{const i=new Set(e);return S(Object.values(t).filter(a=>i.has(a.uuid)))})),Qr=f(d.createSelector([Jr,(t,e)=>e],(t,e)=>S(t.filter(i=>i.field_values===e)))),xr=$s.reducer,X=P(t=>t.uuid),ed=X.getInitialState({}),Ls=d.createSlice({name:"assetProcedureStepFieldValues",initialState:ed,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,O),e=>Object.assign(e,ed)),reducers:{initializeAssetProcedureStepFieldValues:X.initialize,addAssetProcedureStepFieldValues:X.addOne,addAssetProcedureStepFieldValuesMany:X.addMany,setAssetProcedureStepFieldValues:X.setOne,setAssetProcedureStepFieldValuesMany:X.setMany,updateAssetProcedureStepFieldValues:X.updateOne,updateAssetProcedureStepFieldValuesMany:X.updateMany,deleteAssetProcedureStepFieldValues:X.deleteOne,deleteAssetProcedureStepFieldValuesMany:X.deleteMany}}),{initializeAssetProcedureStepFieldValues:td,addAssetProcedureStepFieldValues:Ns,addAssetProcedureStepFieldValuesMany:sd,setAssetProcedureStepFieldValues:QA,setAssetProcedureStepFieldValuesMany:xA,updateAssetProcedureStepFieldValues:ut,updateAssetProcedureStepFieldValuesMany:id,deleteAssetProcedureStepFieldValues:Hs,deleteAssetProcedureStepFieldValuesMany:ad}=Ls.actions,nd=t=>t.assetProcedureStepFieldValuesReducer.instances,Vt=d.createSelector([nd],t=>Object.values(t)),ef=f(d.createSelector([Vt,(t,e)=>e],(t,e)=>S(t.filter(i=>i.asset===e)))),tf=f(d.createSelector([Vt,(t,e)=>e],(t,e)=>S(t.filter(i=>i.asset_procedure===e)))),sf=f(d.createSelector([Vt,(t,e)=>e],(t,e)=>S(t.filter(i=>i.asset_procedure_step===e)))),Ws=t=>e=>e.assetProcedureStepFieldValuesReducer.instances[t],cd=Ls.reducer,Q=P(t=>t.uuid),rd=Q.getInitialState({}),Ks=d.createSlice({name:"assetProcedureSteps",initialState:rd,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,rd)),reducers:{initializeAssetProcedureSteps:Q.initialize,setAssetProcedureStep:Q.setOne,setAssetProcedureSteps:Q.setMany,addAssetProcedureStep:Q.addOne,addAssetProcedureSteps:Q.addMany,updateAssetProcedureStep:Q.updateOne,updateAssetProcedureSteps:Q.updateMany,deleteAssetProcedureStep:Q.deleteOne,deleteAssetProcedureSteps:Q.deleteMany}}),{initializeAssetProcedureSteps:dd,setAssetProcedureStep:ud,setAssetProcedureSteps:af,addAssetProcedureStep:od,addAssetProcedureSteps:ld,updateAssetProcedureStep:jt,updateAssetProcedureSteps:nf,deleteAssetProcedureStep:hd,deleteAssetProcedureSteps:md}=Ks.actions,pd=Ks.reducer,ot=t=>t.assetProcedureStepReducer.instances,Ys=t=>e=>e.assetProcedureStepReducer.instances[t],yd=d.createSelector([ot],t=>Object.values(t)),cf=f(d.createSelector([ot,(t,e)=>e],(t,e)=>{const i={};for(const[a,n]of Object.entries(t))n.asset_procedure_type===e&&(i[a]=n);return Rt(i)})),rf=f(d.createSelector([yd,(t,e)=>e],(t,e)=>S(t.filter(i=>i.asset_procedure_type===e)))),df=f(d.createSelector([ot,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectAssetProcedureStepsByIds: No step exists with the id",a)}return S(i)})),Ad=f(d.createSelector([ot,(t,e)=>e],(t,e)=>{if(!t[e])return S([]);const n=Pc(e,Object.values(t)).all().map(({model:c})=>c);return S(n)})),x=P(t=>t.uuid),fd=x.getInitialState({}),Zs=d.createSlice({name:"assets",initialState:fd,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,O),e=>Object.assign(e,fd)),reducers:{initializeAssets:x.initialize,addAsset:x.addOne,addAssets:x.addMany,setAsset:x.setOne,setAssets:x.setMany,updateAsset:x.updateOne,updateAssets:x.updateMany,deleteAsset:x.deleteOne,deleteAssets:x.deleteMany}}),{initializeAssets:Sd,addAsset:Js,addAssets:qt,updateAsset:lt,updateAssets:uf,deleteAsset:Xs,deleteAssets:Qs,setAsset:of,setAssets:lf}=Zs.actions,xs=t=>t.assetReducer.instances,Td=d.createSelector([xs],t=>S(Object.values(t))),ei=f(d.createSelector([Td,(t,e)=>e],(t,e)=>S(t.filter(i=>i.asset_type===e)))),ti=t=>e=>e.assetReducer.instances[t],Id=f(d.createSelector([xs,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n&&i.push(n)}return S(i)})),hf=t=>e=>ei(t)(e).length,gd=Zs.reducer,ee=P(t=>t.uuid),bd=ee.getInitialState({}),si=d.createSlice({name:"assetStageCompletions",initialState:bd,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,O),e=>Object.assign(e,bd)),reducers:{initializeAssetStageCompletions:ee.initialize,addAssetStageCompletion:ee.addOne,addAssetStageCompletions:ee.addMany,setAssetStageCompletion:ee.setOne,setAssetStageCompletions:ee.setMany,updateAssetStageCompletion:ee.updateOne,updateAssetStageCompletions:ee.updateMany,deleteAssetStageCompletion:ee.deleteOne,deleteAssetStageCompletions:ee.deleteMany}}),{initializeAssetStageCompletions:Fd,addAssetStageCompletion:ii,addAssetStageCompletions:ai,setAssetStageCompletion:mf,setAssetStageCompletions:pf,updateAssetStageCompletion:Pd,updateAssetStageCompletions:Od,deleteAssetStageCompletion:ni,deleteAssetStageCompletions:ci}=si.actions,_d=si.reducer,ri=t=>t.assetStageCompletionReducer.instances,yf=d.createSelector([ri],t=>Object.values(t)),Rd=t=>e=>e.assetStageCompletionReducer.instances[t],vd=f(d.createSelector([ri,(t,e)=>e],(t,e)=>{const i=new Set(e);return S(Object.values(t).filter(a=>i.has(a.uuid)))})),te=P(t=>t.uuid),wd=te.getInitialState({}),di=d.createSlice({name:"assetStages",initialState:wd,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,wd)),reducers:{initializeAssetStages:te.initialize,setAssetStage:te.setOne,setAssetStages:te.setMany,addAssetStage:te.addOne,addAssetStages:te.addMany,updateAssetStage:te.updateOne,updateAssetStages:te.updateMany,deleteAssetStage:te.deleteOne,deleteAssetStages:te.deleteMany}}),{initializeAssetStages:Md,setAssetStage:Ed,setAssetStages:Af,addAssetStage:ui,addAssetStages:ff,updateAssetStage:zt,updateAssetStages:Sf,deleteAssetStage:oi,deleteAssetStages:Tf}=di.actions,Vd=di.reducer,Dt=t=>t.assetStageReducer.instances,li=t=>e=>e.assetStageReducer.instances[t],jd=d.createSelector([Dt],t=>Object.values(t)),If=f(d.createSelector([Dt,(t,e)=>e],(t,e)=>{const i={};for(const[a,n]of Object.entries(t))n.asset_procedure_type===e&&(i[a]=n);return Rt(i)})),gf=f(d.createSelector([jd,(t,e)=>e],(t,e)=>S(t.filter(i=>i.asset_procedure_type===e)))),bf=f(d.createSelector([Dt,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectStagesFromStageIds: No stage exists with the id",a)}return S(i)})),se=P(t=>t.uuid),qd=se.getInitialState({}),hi=d.createSlice({name:"assetTypeAttachments",initialState:qd,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,qd)),reducers:{initializeAssetTypeAttachments:se.initialize,addAssetTypeAttachment:se.addOne,addAssetTypeAttachments:se.addMany,setAssetTypeAttachment:se.setOne,setAssetTypeAttachments:se.setMany,updateAssetTypeAttachment:se.updateOne,updateAssetTypeAttachments:se.updateMany,deleteAssetTypeAttachment:se.deleteOne,deleteAssetTypeAttachments:se.deleteMany}}),{initializeAssetTypeAttachments:zd,addAssetTypeAttachment:Ff,addAssetTypeAttachments:mi,setAssetTypeAttachment:Dd,setAssetTypeAttachments:Pf,updateAssetTypeAttachment:Of,updateAssetTypeAttachments:Ud,deleteAssetTypeAttachment:Cd,deleteAssetTypeAttachments:pi}=hi.actions,kd=t=>t.assetTypeAttachmentReducer.instances,Bd=d.createSelector([kd],t=>Object.values(t)),$d=t=>e=>e.assetTypeAttachmentReducer.instances[t],Gd=f(d.createSelector([Bd,(t,e)=>e],(t,e)=>S(t.filter(({asset_type:i})=>e===i)))),Ld=hi.reducer,ie=P(t=>t.uuid),Nd=ie.getInitialState({}),yi=d.createSlice({name:"assetTypeFieldsAttachments",initialState:Nd,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Nd)),reducers:{initializeAssetTypeFieldsAttachments:ie.initialize,addAssetTypeFieldsAttachment:ie.addOne,addAssetTypeFieldsAttachments:ie.addMany,setAssetTypeFieldsAttachment:ie.setOne,setAssetTypeFieldsAttachments:ie.setMany,updateAssetTypeFieldsAttachment:ie.updateOne,updateAssetTypeFieldsAttachments:ie.updateMany,deleteAssetTypeFieldsAttachment:ie.deleteOne,deleteAssetTypeFieldsAttachments:ie.deleteMany}}),{initializeAssetTypeFieldsAttachments:Hd,addAssetTypeFieldsAttachment:_f,addAssetTypeFieldsAttachments:Wd,setAssetTypeFieldsAttachment:Rf,setAssetTypeFieldsAttachments:vf,updateAssetTypeFieldsAttachment:wf,updateAssetTypeFieldsAttachments:Kd,deleteAssetTypeFieldsAttachment:Mf,deleteAssetTypeFieldsAttachments:Yd}=yi.actions,Zd=t=>t.assetTypeFieldsAttachmentReducer.instances,Jd=d.createSelector([Zd],t=>Object.values(t)),Ef=f(d.createSelector([Jd,(t,e)=>e],(t,e)=>S(t.filter(i=>i.fields_revision===e)))),Vf=t=>e=>e.assetTypeFieldsAttachmentReducer.instances[t],Xd=yi.reducer,ae=P(t=>t.uuid),Qd=ae.getInitialState({}),Ai=d.createSlice({name:"assetTypeFields",initialState:Qd,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Qd)),reducers:{initializeAssetTypeFields:ae.initialize,addAssetTypeFields:ae.addOne,addAssetTypeFieldsMany:ae.addMany,setAssetTypeFields:ae.setOne,setAssetTypeFieldsMany:ae.setMany,updateAssetTypeFields:ae.updateOne,updateAssetTypeFieldsMany:ae.updateMany,deleteAssetTypeFields:ae.deleteOne,deleteAssetTypeFieldsMany:ae.deleteMany}}),{initializeAssetTypeFields:xd,addAssetTypeFields:eu,addAssetTypeFieldsMany:jf,setAssetTypeFields:qf,setAssetTypeFieldsMany:zf,updateAssetTypeFields:tu,updateAssetTypeFieldsMany:Df,deleteAssetTypeFields:su,deleteAssetTypeFieldsMany:Uf}=Ai.actions,iu=t=>t.assetTypeFieldsReducer.instances,Ut=d.createSelector([iu],t=>Object.values(t)),Cf=f(d.createSelector([Ut,(t,e)=>e],(t,e)=>S(t.filter(i=>i.asset_type===e)))),kf=f(d.createSelector([Ut,(t,e)=>e],(t,e)=>t.filter(i=>i.asset_type===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),Bf=t=>e=>e.assetTypeFieldsReducer.instances[t],au=Ai.reducer,ne=P(t=>t.uuid),nu=ne.getInitialState({}),fi=d.createSlice({name:"assetTypeFieldValuesAttachments",initialState:nu,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,O),e=>Object.assign(e,nu)),reducers:{initializeAssetTypeFieldValuesAttachments:ne.initialize,addAssetTypeFieldValuesAttachment:ne.addOne,addAssetTypeFieldValuesAttachments:ne.addMany,setAssetTypeFieldValuesAttachment:ne.setOne,setAssetTypeFieldValuesAttachments:ne.setMany,updateAssetTypeFieldValuesAttachment:ne.updateOne,updateAssetTypeFieldValuesAttachments:ne.updateMany,deleteAssetTypeFieldValuesAttachment:ne.deleteOne,deleteAssetTypeFieldValuesAttachments:ne.deleteMany}}),{initializeAssetTypeFieldValuesAttachments:cu,addAssetTypeFieldValuesAttachment:$f,addAssetTypeFieldValuesAttachments:Ct,setAssetTypeFieldValuesAttachment:Gf,setAssetTypeFieldValuesAttachments:Lf,updateAssetTypeFieldValuesAttachment:Nf,updateAssetTypeFieldValuesAttachments:ru,deleteAssetTypeFieldValuesAttachment:Hf,deleteAssetTypeFieldValuesAttachments:kt}=fi.actions,Si=t=>t.assetTypeFieldValuesAttachmentReducer.instances,du=d.createSelector([Si],t=>Object.values(t)),Wf=t=>e=>e.assetTypeFieldValuesAttachmentReducer.instances[t],uu=f(d.createSelector([Si,(t,e)=>e],(t,e)=>{const i=new Set(e);return S(Object.values(t).filter(a=>i.has(a.uuid)))})),ou=f(d.createSelector([du,(t,e)=>e],(t,e)=>S(t.filter(i=>i.field_values===e)))),lu=fi.reducer,ce=P(t=>t.uuid),hu=ce.getInitialState({}),Ti=d.createSlice({name:"assetTypeFieldValues",initialState:hu,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,O),e=>Object.assign(e,hu)),reducers:{initializeAssetTypeFieldValues:ce.initialize,addAssetTypeFieldValues:ce.addOne,addAssetTypeFieldValuesMany:ce.addMany,setAssetTypeFieldValues:ce.setOne,setAssetTypeFieldValuesMany:ce.setMany,updateAssetTypeFieldValues:ce.updateOne,updateAssetTypeFieldValuesMany:ce.updateMany,deleteAssetTypeFieldValues:ce.deleteOne,deleteAssetTypeFieldValuesMany:ce.deleteMany}}),{initializeAssetTypeFieldValues:mu,addAssetTypeFieldValues:Ii,addAssetTypeFieldValuesMany:pu,setAssetTypeFieldValues:Kf,setAssetTypeFieldValuesMany:Yf,updateAssetTypeFieldValues:ht,updateAssetTypeFieldValuesMany:yu,deleteAssetTypeFieldValues:gi,deleteAssetTypeFieldValuesMany:Au}=Ti.actions,fu=t=>t.assetTypeFieldValuesReducer.instances,bi=d.createSelector([fu],t=>Object.values(t)),Zf=f(d.createSelector([bi,(t,e)=>e],(t,e)=>S(t.filter(i=>i.asset===e)))),Jf=f(d.createSelector([Ut,bi,(t,e)=>e],(t,e,i)=>{const a=new Set(t.filter(n=>n.asset_type===i).map(n=>n.uuid));return S(e.filter(n=>a.has(n.fields_revision)))})),Fi=t=>e=>e.assetTypeFieldValuesReducer.instances[t],Su=Ti.reducer,re=P(t=>t.uuid),Tu=re.getInitialState({}),Pi=d.createSlice({name:"assetTypeIdentifiers",initialState:Tu,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Tu)),reducers:{initializeAssetTypeIdentifiers:re.initialize,addAssetTypeIdentifier:re.addOne,addAssetTypeIdentifiers:re.addMany,setAssetTypeIdentifier:re.setOne,setAssetTypeIdentifiers:re.setMany,updateAssetTypeIdentifier:re.updateOne,updateAssetTypeIdentifiers:re.updateMany,deleteAssetTypeIdentifier:re.deleteOne,deleteAssetTypeIdentifiers:re.deleteMany}}),{initializeAssetTypeIdentifiers:Iu,addAssetTypeIdentifier:Oi,addAssetTypeIdentifiers:Xf,setAssetTypeIdentifier:Qf,setAssetTypeIdentifiers:xf,updateAssetTypeIdentifier:mt,updateAssetTypeIdentifiers:eS,deleteAssetTypeIdentifier:_i,deleteAssetTypeIdentifiers:tS}=Pi.actions,gu=t=>t.assetTypeIdentifierReducer.instances,bu=d.createSelector([gu],t=>Object.values(t)),Ri=t=>e=>e.assetTypeIdentifierReducer.instances[t],sS=f(d.createSelector([bu,(t,e)=>e],(t,e)=>S(t.filter(i=>i.asset_type===e)))),Fu=Pi.reducer,de=P(t=>t.uuid),Pu=de.getInitialState({}),vi=d.createSlice({name:"assetTypeIdentifierValues",initialState:Pu,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,O),e=>Object.assign(e,Pu)),reducers:{initializeAssetTypeIdentifierValues:de.initialize,addAssetTypeIdentifierValue:de.addOne,addAssetTypeIdentifierValues:de.addMany,setAssetTypeIdentifierValue:de.setOne,setAssetTypeIdentifierValues:de.setMany,updateAssetTypeIdentifierValue:de.updateOne,updateAssetTypeIdentifierValues:de.updateMany,deleteAssetTypeIdentifierValue:de.deleteOne,deleteAssetTypeIdentifierValues:de.deleteMany}}),{initializeAssetTypeIdentifierValues:Ou,addAssetTypeIdentifierValue:wi,addAssetTypeIdentifierValues:iS,setAssetTypeIdentifierValue:aS,setAssetTypeIdentifierValues:nS,updateAssetTypeIdentifierValue:pt,updateAssetTypeIdentifierValues:cS,deleteAssetTypeIdentifierValue:Mi,deleteAssetTypeIdentifierValues:rS}=vi.actions,_u=t=>t.assetTypeIdentifierValueReducer.instances,Ei=d.createSelector([_u],t=>Object.values(t)),Vi=t=>e=>e.assetTypeIdentifierValueReducer.instances[t],dS=f(d.createSelector([Ei,(t,e)=>e],(t,e)=>S(t.filter(i=>i.asset===e)))),uS=f(d.createSelector([Ei,(t,e)=>e],(t,e)=>S(t.filter(i=>i.asset_type_identifier===e)))),Ru=vi.reducer,ue=P(t=>t.uuid),vu=ue.getInitialState({}),ji=d.createSlice({name:"assetTypes",initialState:vu,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,vu)),reducers:{initializeAssetTypes:ue.initialize,setAssetType:ue.setOne,setAssetTypes:ue.setMany,addAssetType:ue.addOne,addAssetTypes:ue.addMany,updateAssetType:ue.updateOne,updateAssetTypes:ue.updateMany,deleteAssetType:ue.deleteOne,deleteAssetTypes:ue.deleteMany}}),{initializeAssetTypes:wu,setAssetType:oS,setAssetTypes:lS,addAssetType:qi,addAssetTypes:hS,updateAssetType:yt,updateAssetTypes:mS,deleteAssetType:zi,deleteAssetTypes:pS}=ji.actions,Di=t=>t.assetTypeReducer.instances,Mu=d.createSelector([Di],t=>Object.values(t)),Ui=t=>e=>e.assetTypeReducer.instances[t],yS=f(d.createSelector([Di,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectAssetTypesByIds: No assetType exists with the id",a)}return S(i)})),AS=f(d.createSelector([Mu,(t,e)=>e],(t,e)=>S(t.filter(i=>i.organization===e)))),Eu=ji.reducer,Vu={accessToken:"",refreshToken:"",isLoggedIn:!1},Bt=d.createSlice({name:"auth",initialState:Vu,extraReducers:t=>t.addCase(I,e=>Object.assign(e,Vu)),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||Bt.caseReducers.clearTokens(t),t.isLoggedIn=e.payload}}}),{setTokens:fS,clearTokens:SS,setLoggedIn:ju}=Bt.actions,TS=t=>t.authReducer.accessToken,IS=t=>t.authReducer.isLoggedIn,qu=Bt.reducer,oe=P(t=>t.uuid),zu=oe.getInitialState({}),Ci=d.createSlice({name:"categories",initialState:zu,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,zu)),reducers:{initializeCategories:oe.initialize,addCategory:oe.addOne,addCategories:oe.addMany,setCategory:oe.setOne,setCategories:oe.setMany,updateCategory:oe.updateOne,updateCategories:oe.updateMany,deleteCategory:oe.deleteOne,deleteCategories:oe.deleteMany}}),{initializeCategories:Du,addCategory:ki,addCategories:gS,setCategory:bS,setCategories:FS,updateCategory:Uu,updateCategories:PS,deleteCategory:Cu,deleteCategories:OS}=Ci.actions,Bi=t=>t.categoryReducer.instances,ku=d.createSelector([Bi],t=>Object.values(t)),$i=t=>e=>e.categoryReducer.instances[t],_S=f(d.createSelector([Bi,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectCategoryByIds: No category exists with the id",a)}return S(i)})),RS=f(d.createSelector([ku,(t,e)=>e],(t,e)=>S(t.filter(i=>i.project===e)))),Bu=Ci.reducer,le=P(t=>t.uuid),$u=le.getInitialState({}),Gi=d.createSlice({name:"documentAttachments",initialState:$u,extraReducers:t=>t.addCase(I,e=>Object.assign(e,$u)),reducers:{initializeDocumentAttachments:le.initialize,addDocumentAttachment:le.addOne,addDocumentAttachments:le.addMany,setDocumentAttachment:le.setOne,setDocumentAttachments:le.setMany,updateDocumentAttachment:le.updateOne,updateDocumentAttachments:le.updateMany,deleteDocumentAttachment:le.deleteOne,deleteDocumentAttachments:le.deleteMany}}),{initializeDocumentAttachments:Gu,addDocumentAttachment:vS,addDocumentAttachments:Lu,setDocumentAttachment:Nu,setDocumentAttachments:wS,updateDocumentAttachment:MS,updateDocumentAttachments:Hu,deleteDocumentAttachment:Wu,deleteDocumentAttachments:Ku}=Gi.actions,Yu=t=>t.documentAttachmentReducer.instances,Zu=d.createSelector([Yu],t=>Object.values(t)),Ju=t=>e=>e.documentAttachmentReducer.instances[t],ES=f(d.createSelector([Zu,(t,e)=>e],(t,e)=>S(t.filter(({document:i})=>e===i)))),Xu=Gi.reducer,Qu={documents:{}},Li=d.createSlice({name:"documents",initialState:Qu,extraReducers:t=>t.addCase(I,e=>{Object.assign(e,Qu)}),reducers:{setDocuments:(t,e)=>{if(e.payload.filter(bc).length!==e.payload.length)throw new Error("Tried to use setIssues reducer with duplicate ID's");t.documents=Ic(e.payload)},addDocuments:(t,e)=>{for(const i of e.payload)if(i.uuid in t.documents)throw new Error(`attempting to add a document with uuid ${i.uuid} which already exists in state.documents.`);for(const i of e.payload){if(i.parent_document&&t.documents[i.parent_document]){const a=t.documents[i.parent_document];t.documents[i.parent_document]={...a,children_documents:[...a.children_documents,i.uuid]}}t.documents[i.uuid]=i}},updateDocuments:(t,e)=>{for(const i of e.payload)if(!(i.uuid in t.documents))throw new Error(`attempting to update a document with uuid ${i.uuid} which doesn't exists in state.documents.`);for(const i of e.payload){const a=t.documents[i.uuid];if(i.organization!==void 0&&i.organization!==a.organization)throw new Error("organization cannot be updated");if(i.project!==void 0&&i.project!==a.project)throw new Error("project cannot be updated");t.documents[i.uuid]={...a,...i}}},removeDocuments:(t,e)=>{for(const i of e.payload)if(!(i in t.documents))throw new Error(`attempting to delete a document with uuid ${i} which doesn't exists in state.documents.`);for(const i of e.payload){const a=t.documents[i];if(a.parent_document&&t.documents[a.parent_document]){const n=t.documents[a.parent_document];t.documents[a.parent_document]={...n,children_documents:n.children_documents.filter(c=>c!==a.uuid)}}delete t.documents[i]}}}}),{setDocuments:xu,addDocuments:eo,updateDocuments:et,removeDocuments:Ni}=Li.actions,$t=t=>t.documentsReducer.documents,Hi=d.createSelector([$t],t=>Object.values(t)),to=t=>e=>e.documentsReducer.documents[t],VS=f(d.createSelector([$t,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectDocumentByIds: No document exists with the id",a)}return S(i)})),jS=f(d.createSelector([Hi,(t,e)=>e],(t,e)=>t.filter(i=>i.project===e))),qS=f(d.createSelector([Hi,(t,e)=>e],(t,e)=>t.filter(i=>i.organization===e))),so=Li.reducer,he=P(t=>t.uuid),io=he.getInitialState({}),Wi=d.createSlice({name:"emailDomains",initialState:io,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,io)),reducers:{initializeEmailDomains:he.initialize,addEmailDomain:he.addOne,addEmailDomains:he.addMany,setEmailDomain:he.setOne,setEmailDomains:he.setMany,updateEmailDomain:he.updateOne,updateEmailDomains:he.updateMany,deleteEmailDomain:he.deleteOne,deleteEmailDomains:he.deleteMany}}),{initializeEmailDomains:ao,addEmailDomain:no,addEmailDomains:zS,setEmailDomain:DS,setEmailDomains:US,updateEmailDomain:CS,updateEmailDomains:kS,deleteEmailDomain:co,deleteEmailDomains:BS}=Wi.actions,ro=t=>t.emailDomainsReducer.instances,uo=d.createSelector([ro],t=>Object.values(t)),$S=f(d.createSelector([uo,(t,e)=>e],(t,e)=>S(t.filter(i=>i.organization===e)))),oo=Wi.reducer,lo={s3Urls:{}},ho=1e3*60*60,GS=ho*24*7,Ki=d.createSlice({name:"file",initialState:lo,extraReducers:t=>t.addCase(I,e=>Object.assign(e,lo)),reducers:{setUploadUrl:(t,e)=>{const{url:i,fields:a,sha1:n}=e.payload,c=new Date,r=new Date(c.getTime()+GS);t.s3Urls[n]={url:i,fields:a,exp:r.getTime()}}}}),{setUploadUrl:mo}=Ki.actions,po=t=>e=>{const i=e.fileReducer.s3Urls[t];if(!i)return;const a=new Date().getTime();if(!((i.exp??a)-a<ho))return i},yo=Ki.reducer,me=P(t=>t.uuid),Ao=me.getInitialState({}),Yi=d.createSlice({name:"formIdentifiers",initialState:Ao,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Ao)),reducers:{initializeFormIdentifiers:me.initialize,addFormIdentifier:me.addOne,addFormIdentifiers:me.addMany,setFormIdentifier:me.setOne,setFormIdentifiers:me.setMany,updateFormIdentifier:me.updateOne,updateFormIdentifiers:me.updateMany,deleteFormIdentifier:me.deleteOne,deleteFormIdentifiers:me.deleteMany}}),{initializeFormIdentifiers:fo,addFormIdentifier:Zi,addFormIdentifiers:LS,setFormIdentifier:NS,setFormIdentifiers:HS,updateFormIdentifier:At,updateFormIdentifiers:WS,deleteFormIdentifier:Ji,deleteFormIdentifiers:KS}=Yi.actions,So=t=>t.formIdentifierReducer.instances,To=d.createSelector([So],t=>Object.values(t)),Xi=t=>e=>e.formIdentifierReducer.instances[t],YS=f(d.createSelector([To,(t,e)=>e],(t,e)=>S(t.filter(i=>i.form===e)))),Io=Yi.reducer,pe=P(t=>t.uuid),go=pe.getInitialState({}),Qi=d.createSlice({name:"formIdentifierValues",initialState:go,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,go)),reducers:{initializeFormIdentifierValues:pe.initialize,addFormIdentifierValue:pe.addOne,addFormIdentifierValues:pe.addMany,setFormIdentifierValue:pe.setOne,setFormIdentifierValues:pe.setMany,updateFormIdentifierValue:pe.updateOne,updateFormIdentifierValues:pe.updateMany,deleteFormIdentifierValue:pe.deleteOne,deleteFormIdentifierValues:pe.deleteMany}}),{initializeFormIdentifierValues:bo,addFormIdentifierValue:xi,addFormIdentifierValues:ZS,setFormIdentifierValue:JS,setFormIdentifierValues:XS,updateFormIdentifierValue:ft,updateFormIdentifierValues:QS,deleteFormIdentifierValue:ea,deleteFormIdentifierValues:xS}=Qi.actions,Fo=t=>t.formIdentifierValueReducer.instances,ta=d.createSelector([Fo],t=>Object.values(t)),sa=t=>e=>e.formIdentifierValueReducer.instances[t],eT=f(d.createSelector([ta,(t,e)=>e],(t,e)=>S(t.filter(i=>i.form_submission===e)))),tT=f(d.createSelector([ta,(t,e)=>e],(t,e)=>S(t.filter(i=>i.form_identifier===e)))),Po=Qi.reducer,ye=P(t=>t.uuid),Oo=ye.getInitialState({}),ia=d.createSlice({name:"formRevisionAttachments",initialState:Oo,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Oo)),reducers:{initializeFormRevisionAttachments:ye.initialize,addFormRevisionAttachment:ye.addOne,addFormRevisionAttachments:ye.addMany,setFormRevisionAttachment:ye.setOne,setFormRevisionAttachments:ye.setMany,updateFormRevisionAttachment:ye.updateOne,updateFormRevisionAttachments:ye.updateMany,deleteFormRevisionAttachment:ye.deleteOne,deleteFormRevisionAttachments:ye.deleteMany}}),{initializeFormRevisionAttachments:_o,addFormRevisionAttachment:sT,addFormRevisionAttachments:Ro,setFormRevisionAttachment:iT,setFormRevisionAttachments:aT,updateFormRevisionAttachment:nT,updateFormRevisionAttachments:vo,deleteFormRevisionAttachment:cT,deleteFormRevisionAttachments:wo}=ia.actions,Mo=t=>t.formRevisionAttachmentReducer.instances,rT=f(d.createSelector([Mo,(t,e)=>e],(t,e)=>S(Object.values(t).filter(i=>i.form_revision===e)))),Eo=ia.reducer,Ae=P(t=>t.uuid),Vo=Ae.getInitialState({}),aa=d.createSlice({name:"formRevisions",initialState:Vo,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Vo)),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:jo,addFormRevision:na,addFormRevisions:qo,setFormRevision:zo,setFormRevisions:dT,updateFormRevision:uT,updateFormRevisions:oT,deleteFormRevision:ca,deleteFormRevisions:Do}=aa.actions,ra=t=>t.formRevisionReducer.instances,da=d.createSelector([ra],t=>Object.values(t)),lT=t=>e=>e.formRevisionReducer.instances[t],hT=f(d.createSelector([da,(t,e)=>e],(t,e)=>t.filter(i=>i.form===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),Uo=f(d.createSelector([da,(t,e)=>e],(t,e)=>S(t.filter(i=>i.form===e)))),Co=aa.reducer,fe=P(t=>t.uuid),ko=fe.getInitialState({}),ua=d.createSlice({name:"forms",initialState:ko,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,ko)),reducers:{initializeForms:fe.initialize,addForm:fe.addOne,addForms:fe.addMany,setForm:fe.setOne,setForms:fe.setMany,updateForm:fe.updateOne,updateForms:fe.updateMany,deleteForm:fe.deleteOne,deleteForms:fe.deleteMany}}),{initializeForms:Bo,addForm:oa,addForms:mT,setForm:pT,setForms:yT,updateForm:AT,updateForms:fT,deleteForm:la,deleteForms:ST}=ua.actions,$o=ua.reducer,Go=t=>t.formReducer.instances,Lo=d.createSelector([Go],t=>Object.values(t)),No=t=>e=>e.formReducer.instances[t],TT=f(d.createSelector([Lo,(t,e)=>e],(t,e)=>S(t.filter(i=>i.organization===e)))),Se=P(t=>t.uuid),Ho=Se.getInitialState({}),ha=d.createSlice({name:"formSubmissionAttachments",initialState:Ho,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Ho)),reducers:{initializeFormSubmissionAttachments:Se.initialize,addFormSubmissionAttachment:Se.addOne,addFormSubmissionAttachments:Se.addMany,setFormSubmissionAttachment:Se.setOne,setFormSubmissionAttachments:Se.setMany,updateFormSubmissionAttachment:Se.updateOne,updateFormSubmissionAttachments:Se.updateMany,deleteFormSubmissionAttachment:Se.deleteOne,deleteFormSubmissionAttachments:Se.deleteMany}}),{initializeFormSubmissionAttachments:Wo,addFormSubmissionAttachment:IT,addFormSubmissionAttachments:Gt,setFormSubmissionAttachment:gT,setFormSubmissionAttachments:bT,updateFormSubmissionAttachment:FT,updateFormSubmissionAttachments:Ko,deleteFormSubmissionAttachment:PT,deleteFormSubmissionAttachments:Lt}=ha.actions,Yo=t=>t.formSubmissionAttachmentReducer.instances,ma=d.createSelector([Yo],t=>Object.values(t)),Zo=f(d.createSelector([ma,(t,e)=>e],(t,e)=>{const i=new Set(e);return S(t.filter(a=>i.has(a.uuid)))})),Jo=f(d.createSelector([ma,(t,e)=>e],(t,e)=>S(t.filter(i=>i.form_submission===e)))),Xo=ha.reducer,Te=P(t=>t.uuid),Qo=Te.getInitialState({}),pa=d.createSlice({name:"formSubmissions",initialState:Qo,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Qo)),reducers:{initializeFormSubmissions:Te.initialize,setFormSubmission:Te.setOne,setFormSubmissions:Te.setMany,addFormSubmission:Te.addOne,addFormSubmissions:Te.addMany,updateFormSubmission:Te.updateOne,updateFormSubmissions:Te.updateMany,deleteFormSubmission:Te.deleteOne,deleteFormSubmissions:Te.deleteMany}}),{initializeFormSubmissions:xo,setFormSubmission:Nt,setFormSubmissions:OT,addFormSubmission:ya,addFormSubmissions:el,updateFormSubmission:tl,updateFormSubmissions:_T,deleteFormSubmission:Aa,deleteFormSubmissions:sl}=pa.actions,fa=t=>t.formSubmissionReducer.instances,RT=d.createSelector([fa],t=>Object.values(t)),Sa=t=>e=>e.formSubmissionReducer.instances[t],il=f(d.createSelector([fa,ra,(t,e)=>e],(t,e,i)=>{const a=new Set;for(const n of Object.values(e))n.form===i&&a.add(n.uuid);return Object.values(t).filter(n=>a.has(n.form_revision))})),al=pa.reducer,Ie=P(t=>t.uuid),nl=Ie.getInitialState({}),Ta=d.createSlice({name:"geoImages",initialState:nl,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,O),e=>Object.assign(e,nl)),reducers:{initializeGeoImages:Ie.initialize,setGeoImage:Ie.setOne,setGeoImages:Ie.setMany,addGeoImage:Ie.addOne,addGeoImages:Ie.addMany,updateGeoImage:Ie.updateOne,updateGeoImages:Ie.updateMany,deleteGeoImage:Ie.deleteOne,deleteGeoImages:Ie.deleteMany}}),{initializeGeoImages:cl,setGeoImage:St,setGeoImages:rl,addGeoImage:dl,addGeoImages:ul,updateGeoImage:ol,updateGeoImages:vT,deleteGeoImage:Ia,deleteGeoImages:ll}=Ta.actions,hl=t=>t.geoImageReducer.instances,ml=d.createSelector([hl],t=>Object.values(t)),ga=t=>e=>e.geoImageReducer.instances[t],wT=f(d.createSelector([ml,(t,e)=>e],(t,e)=>S(t.filter(i=>i.project===e)))),pl=Ta.reducer,ge=P(t=>t.uuid),yl=ge.getInitialState({}),ba=d.createSlice({name:"issueAssociations",initialState:yl,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,O),e=>Object.assign(e,yl)),reducers:{initializeIssueAssociations:ge.initialize,addIssueAssociation:ge.addOne,addIssueAssociations:ge.addMany,setIssueAssociation:ge.setOne,setIssueAssociations:ge.setMany,updateIssueAssociation:ge.updateOne,updateIssueAssociations:ge.updateMany,deleteIssueAssociation:ge.deleteOne,deleteIssueAssociations:ge.deleteMany}}),{initializeIssueAssociations:Al,setIssueAssociations:MT,setIssueAssociation:ET,updateIssueAssociation:fl,updateIssueAssociations:VT,addIssueAssociation:Fa,addIssueAssociations:Pa,deleteIssueAssociation:Oa,deleteIssueAssociations:_a}=ba.actions,Tt=t=>t.issueAssociationReducer.instances,jT=d.createSelector([Tt],t=>Object.values(t)),Sl=t=>e=>e.issueAssociationReducer.instances[t],Tl=f(d.createSelector([Tt,(t,e)=>e],(t,e)=>S(Object.values(t).filter(i=>i.associated_issue===e)))),Il=f(d.createSelector([Tt,(t,e)=>e],(t,e)=>S(Object.values(t).filter(i=>i.issue===e)))),gl=f(d.createSelector([Tt,(t,e)=>e],(t,e)=>S(Object.values(t).filter(i=>i.asset===e)))),bl=ba.reducer,be=P(t=>t.uuid),Fl=be.getInitialState({}),Ra=d.createSlice({name:"issueAttachments",initialState:Fl,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,O),e=>Object.assign(e,Fl)),reducers:{initializeIssueAttachments:be.initialize,addIssueAttachment:be.addOne,addIssueAttachments:be.addMany,setIssueAttachment:be.setOne,setIssueAttachments:be.setMany,updateIssueAttachment:be.updateOne,updateIssueAttachments:be.updateMany,deleteIssueAttachment:be.deleteOne,deleteIssueAttachments:be.deleteMany}}),{initializeIssueAttachments:va,addIssueAttachment:qT,addIssueAttachments:wa,setIssueAttachment:Pl,setIssueAttachments:zT,updateIssueAttachment:DT,updateIssueAttachments:Ol,deleteIssueAttachment:_l,deleteIssueAttachments:Ma}=Ra.actions,Rl=t=>t.issueAttachmentReducer.instances,vl=d.createSelector([Rl],t=>Object.values(t)),wl=f(d.createSelector([vl,(t,e)=>e],(t,e)=>S(t.filter(({issue:i})=>e===i)))),Ml=t=>e=>e.issueAttachmentReducer.instances[t],El=Ra.reducer,Fe=P(t=>t.uuid),Vl=Fe.getInitialState({}),Ea=d.createSlice({name:"issueCommentAttachments",initialState:Vl,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,O),e=>Object.assign(e,Vl)),reducers:{initializeIssueCommentAttachments:Fe.initialize,addIssueCommentAttachment:Fe.addOne,addIssueCommentAttachments:Fe.addMany,setIssueCommentAttachment:Fe.setOne,setIssueCommentAttachments:Fe.setMany,updateIssueCommentAttachment:Fe.updateOne,updateIssueCommentAttachments:Fe.updateMany,deleteIssueCommentAttachment:Fe.deleteOne,deleteIssueCommentAttachments:Fe.deleteMany}}),{initializeIssueCommentAttachments:Va,addIssueCommentAttachment:UT,addIssueCommentAttachments:jl,setIssueCommentAttachment:ql,setIssueCommentAttachments:CT,updateIssueCommentAttachment:kT,updateIssueCommentAttachments:zl,deleteIssueCommentAttachment:Dl,deleteIssueCommentAttachments:Ul}=Ea.actions,Cl=t=>t.issueCommentAttachmentReducer.instances,kl=d.createSelector([Cl],t=>Object.values(t)),Bl=t=>e=>e.issueCommentAttachmentReducer.instances[t],BT=f(d.createSelector([kl,(t,e)=>e],(t,e)=>S(t.filter(({issue_comment:i})=>e===i)))),$l=Ea.reducer,Pe=P(t=>t.uuid),Gl=Pe.getInitialState({}),ja=d.createSlice({name:"issueComments",initialState:Gl,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,O),e=>Object.assign(e,Gl)),reducers:{initializeIssueComments:Pe.initialize,addIssueComment:Pe.addOne,addIssueComments:Pe.addMany,setIssueComment:Pe.setOne,setIssueComments:Pe.setMany,updateIssueComment:Pe.updateOne,updateIssueComments:Pe.updateMany,deleteIssueComment:Pe.deleteOne,deleteIssueComments:Pe.deleteMany}}),{initializeIssueComments:$T,addIssueComment:qa,addIssueComments:GT,setIssueComment:za,setIssueComments:Ll,updateIssueComment:LT,updateIssueComments:NT,deleteIssueComment:Da,deleteIssueComments:HT}=ja.actions,Nl=t=>t.issueCommentReducer.instances,Ua=t=>e=>e.issueCommentReducer.instances[t],WT=f(d.createSelector([Nl,(t,e)=>e],(t,e)=>S(Object.values(t).filter(i=>i.issue===e)))),Hl=ja.reducer,Oe=P(t=>t.uuid),Wl=Oe.getInitialState({}),Ca=d.createSlice({name:"issues",initialState:Wl,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,O),e=>Object.assign(e,Wl)),reducers:{initializeIssues:Oe.initialize,addIssue:Oe.addOne,addIssues:Oe.addMany,setIssue:Oe.setOne,setIssues:Oe.setMany,updateIssue:Oe.updateOne,updateIssues:Oe.updateMany,deleteIssue:Oe.deleteOne,deleteIssues:Oe.deleteMany}}),{initializeIssues:Kl,addIssue:ka,addIssues:Yl,setIssue:KT,setIssues:YT,updateIssue:Ht,updateIssues:ZT,deleteIssue:Ba,deleteIssues:Zl}=Ca.actions,$a=t=>t.issueReducer.instances,Ga=d.createSelector([$a],t=>Object.values(t)),La=t=>e=>e.issueReducer.instances[t],JT=f(d.createSelector([$a,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectIssuesByIds: No issue exists with the id",a)}return S(i)})),XT=f(d.createSelector([Ga,(t,e)=>e],(t,e)=>t.filter(i=>i.project===e))),Jl=f(d.createSelector([Ga,(t,e)=>e],(t,e)=>t.filter(i=>i.issue_type===e))),Xl=Ca.reducer,_e=P(t=>t.uuid),Ql=_e.getInitialState({}),Na=d.createSlice({name:"issueTypeAttachments",initialState:Ql,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Ql)),reducers:{initializeIssueTypeAttachments:_e.initialize,addIssueTypeAttachment:_e.addOne,addIssueTypeAttachments:_e.addMany,setIssueTypeAttachment:_e.setOne,setIssueTypeAttachments:_e.setMany,updateIssueTypeAttachment:_e.updateOne,updateIssueTypeAttachments:_e.updateMany,deleteIssueTypeAttachment:_e.deleteOne,deleteIssueTypeAttachments:_e.deleteMany}}),{initializeIssueTypeAttachments:Ha,addIssueTypeAttachment:QT,addIssueTypeAttachments:xl,setIssueTypeAttachment:eh,setIssueTypeAttachments:xT,updateIssueTypeAttachment:eI,updateIssueTypeAttachments:th,deleteIssueTypeAttachment:sh,deleteIssueTypeAttachments:ih}=Na.actions,ah=t=>t.issueTypeAttachmentReducer.instances,nh=d.createSelector([ah],t=>Object.values(t)),ch=t=>e=>e.issueTypeAttachmentReducer.instances[t],tI=f(d.createSelector([nh,(t,e)=>e],(t,e)=>S(t.filter(({issue_type:i})=>e===i)))),rh=Na.reducer,Re=P(t=>t.uuid),dh=Re.getInitialState({}),Wa=d.createSlice({name:"issueTypeFieldsAttachments",initialState:dh,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,dh)),reducers:{initializeIssueTypeFieldsAttachments:Re.initialize,addIssueTypeFieldsAttachment:Re.addOne,addIssueTypeFieldsAttachments:Re.addMany,setIssueTypeFieldsAttachment:Re.setOne,setIssueTypeFieldsAttachments:Re.setMany,updateIssueTypeFieldsAttachment:Re.updateOne,updateIssueTypeFieldsAttachments:Re.updateMany,deleteIssueTypeFieldsAttachment:Re.deleteOne,deleteIssueTypeFieldsAttachments:Re.deleteMany}}),{initializeIssueTypeFieldsAttachments:uh,addIssueTypeFieldsAttachment:sI,addIssueTypeFieldsAttachments:oh,setIssueTypeFieldsAttachment:iI,setIssueTypeFieldsAttachments:aI,updateIssueTypeFieldsAttachment:nI,updateIssueTypeFieldsAttachments:lh,deleteIssueTypeFieldsAttachment:cI,deleteIssueTypeFieldsAttachments:hh}=Wa.actions,mh=t=>t.issueTypeFieldsAttachmentReducer.instances,ph=d.createSelector([mh],t=>Object.values(t)),rI=f(d.createSelector([ph,(t,e)=>e],(t,e)=>S(t.filter(i=>i.fields_revision===e)))),dI=t=>e=>e.issueTypeFieldsAttachmentReducer.instances[t],yh=Wa.reducer,ve=P(t=>t.uuid),Ah=ve.getInitialState({}),Ka=d.createSlice({name:"issueTypeFieldValues",initialState:Ah,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,O),e=>Object.assign(e,Ah)),reducers:{initializeIssueTypeFieldValues:ve.initialize,addIssueTypeFieldValues:ve.addOne,addIssueTypeFieldValuesMany:ve.addMany,setIssueTypeFieldValues:ve.setOne,setIssueTypeFieldValuesMany:ve.setMany,updateIssueTypeFieldValues:ve.updateOne,updateIssueTypeFieldValuesMany:ve.updateMany,deleteIssueTypeFieldValues:ve.deleteOne,deleteIssueTypeFieldValuesMany:ve.deleteMany}}),{initializeIssueTypeFieldValues:fh,addIssueTypeFieldValues:Ya,addIssueTypeFieldValuesMany:uI,setIssueTypeFieldValues:oI,setIssueTypeFieldValuesMany:lI,updateIssueTypeFieldValues:It,updateIssueTypeFieldValuesMany:hI,deleteIssueTypeFieldValues:Za,deleteIssueTypeFieldValuesMany:mI}=Ka.actions,Sh=t=>t.issueTypeFieldValuesReducer.instances,Ja=d.createSelector([Sh],t=>Object.values(t)),pI=f(d.createSelector([Ja,(t,e)=>e],(t,e)=>S(t.filter(i=>i.issue===e)))),Xa=t=>e=>e.issueTypeFieldValuesReducer.instances[t],Th=Ka.reducer,we=P(t=>t.uuid),Ih=we.getInitialState({}),Qa=d.createSlice({name:"issueTypeFields",initialState:Ih,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Ih)),reducers:{initializeIssueTypeFields:we.initialize,addIssueTypeFields:we.addOne,addIssueTypeFieldsMany:we.addMany,setIssueTypeFields:we.setOne,setIssueTypeFieldsMany:we.setMany,updateIssueTypeFields:we.updateOne,updateIssueTypeFieldsMany:we.updateMany,deleteIssueTypeFields:we.deleteOne,deleteIssueTypeFieldsMany:we.deleteMany}}),{initializeIssueTypeFields:gh,addIssueTypeFields:bh,addIssueTypeFieldsMany:yI,setIssueTypeFields:AI,setIssueTypeFieldsMany:fI,updateIssueTypeFields:Fh,updateIssueTypeFieldsMany:SI,deleteIssueTypeFields:Ph,deleteIssueTypeFieldsMany:TI}=Qa.actions,Oh=t=>t.issueTypeFieldsReducer.instances,Wt=d.createSelector([Oh],t=>Object.values(t)),II=f(d.createSelector([Wt,(t,e)=>e],(t,e)=>S(t.filter(i=>i.issue_type===e)))),gI=f(d.createSelector([Wt,(t,e)=>e],(t,e)=>t.filter(i=>i.issue_type===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),bI=f(d.createSelector([Wt,Ja,(t,e)=>e],(t,e,i)=>{const a=new Set(t.filter(n=>n.issue_type===i).map(n=>n.uuid));return S(e.filter(n=>a.has(n.fields_revision)))})),FI=t=>e=>e.issueTypeFieldsReducer.instances[t],_h=Qa.reducer,Me=P(t=>t.uuid),Rh=Me.getInitialState({}),xa=d.createSlice({name:"issueTypeFieldValuesAttachments",initialState:Rh,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,O),e=>Object.assign(e,Rh)),reducers:{initializeIssueTypeFieldValuesAttachments:Me.initialize,addIssueTypeFieldValuesAttachment:Me.addOne,addIssueTypeFieldValuesAttachments:Me.addMany,setIssueTypeFieldValuesAttachment:Me.setOne,setIssueTypeFieldValuesAttachments:Me.setMany,updateIssueTypeFieldValuesAttachment:Me.updateOne,updateIssueTypeFieldValuesAttachments:Me.updateMany,deleteIssueTypeFieldValuesAttachment:Me.deleteOne,deleteIssueTypeFieldValuesAttachments:Me.deleteMany}}),{initializeIssueTypeFieldValuesAttachments:vh,addIssueTypeFieldValuesAttachment:PI,addIssueTypeFieldValuesAttachments:Kt,setIssueTypeFieldValuesAttachment:OI,setIssueTypeFieldValuesAttachments:_I,updateIssueTypeFieldValuesAttachment:RI,updateIssueTypeFieldValuesAttachments:wh,deleteIssueTypeFieldValuesAttachment:vI,deleteIssueTypeFieldValuesAttachments:Yt}=xa.actions,Mh=t=>t.issueTypeFieldValuesAttachmentReducer.instances,en=d.createSelector([Mh],t=>Object.values(t)),wI=t=>e=>e.issueTypeFieldValuesAttachmentReducer.instances[t],Eh=f(d.createSelector([en,(t,e)=>e],(t,e)=>{const i=new Set(e);return S(t.filter(a=>i.has(a.uuid)))})),Vh=f(d.createSelector([en,(t,e)=>e],(t,e)=>S(t.filter(i=>i.field_values===e)))),jh=xa.reducer,Ee=P(t=>t.uuid),qh=Ee.getInitialState({}),tn=d.createSlice({name:"issueTypeIdentifiers",initialState:qh,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,qh)),reducers:{initializeIssueTypeIdentifiers:Ee.initialize,addIssueTypeIdentifier:Ee.addOne,addIssueTypeIdentifiers:Ee.addMany,setIssueTypeIdentifier:Ee.setOne,setIssueTypeIdentifiers:Ee.setMany,updateIssueTypeIdentifier:Ee.updateOne,updateIssueTypeIdentifiers:Ee.updateMany,deleteIssueTypeIdentifier:Ee.deleteOne,deleteIssueTypeIdentifiers:Ee.deleteMany}}),{initializeIssueTypeIdentifiers:zh,addIssueTypeIdentifier:sn,addIssueTypeIdentifiers:MI,setIssueTypeIdentifier:EI,setIssueTypeIdentifiers:VI,updateIssueTypeIdentifier:gt,updateIssueTypeIdentifiers:jI,deleteIssueTypeIdentifier:an,deleteIssueTypeIdentifiers:qI}=tn.actions,Dh=t=>t.issueTypeIdentifierReducer.instances,Uh=d.createSelector([Dh],t=>Object.values(t)),nn=t=>e=>e.issueTypeIdentifierReducer.instances[t],zI=f(d.createSelector([Uh,(t,e)=>e],(t,e)=>S(t.filter(i=>i.issue_type===e)))),Ch=tn.reducer,Ve=P(t=>t.uuid),kh=Ve.getInitialState({}),cn=d.createSlice({name:"issueTypeIdentifierValues",initialState:kh,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,O),e=>Object.assign(e,kh)),reducers:{initializeIssueTypeIdentifierValues:Ve.initialize,addIssueTypeIdentifierValue:Ve.addOne,addIssueTypeIdentifierValues:Ve.addMany,setIssueTypeIdentifierValue:Ve.setOne,setIssueTypeIdentifierValues:Ve.setMany,updateIssueTypeIdentifierValue:Ve.updateOne,updateIssueTypeIdentifierValues:Ve.updateMany,deleteIssueTypeIdentifierValue:Ve.deleteOne,deleteIssueTypeIdentifierValues:Ve.deleteMany}}),{initializeIssueTypeIdentifierValues:Bh,addIssueTypeIdentifierValue:rn,addIssueTypeIdentifierValues:DI,setIssueTypeIdentifierValue:UI,setIssueTypeIdentifierValues:CI,updateIssueTypeIdentifierValue:bt,updateIssueTypeIdentifierValues:kI,deleteIssueTypeIdentifierValue:dn,deleteIssueTypeIdentifierValues:BI}=cn.actions,$h=t=>t.issueTypeIdentifierValueReducer.instances,un=d.createSelector([$h],t=>Object.values(t)),on=t=>e=>e.issueTypeIdentifierValueReducer.instances[t],$I=f(d.createSelector([un,(t,e)=>e],(t,e)=>S(t.filter(i=>i.issue===e)))),GI=f(d.createSelector([un,(t,e)=>e],(t,e)=>S(t.filter(i=>i.issue_type_identifier===e)))),Gh=cn.reducer,C=P(t=>t.uuid),Lh=C.getInitialState({}),ln=d.createSlice({name:"issueTypes",initialState:Lh,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Lh)),reducers:{initializeIssueTypes:C.initialize,addIssueType:C.addOne,addIssueTypes:C.addMany,setIssueType:C.setOne,setIssueTypes:C.setMany,updateIssueType:C.updateOne,updateIssueTypes:C.updateMany,deleteIssueType:C.deleteOne,deleteIssueTypes:C.deleteMany,removeIssueType:C.deleteOne}}),{initializeIssueTypes:Nh,addIssueType:Hh,addIssueTypes:LI,setIssueType:Ft,setIssueTypes:NI,updateIssueType:Wh,updateIssueTypes:HI,deleteIssueType:WI,deleteIssueTypes:KI,removeIssueType:hn}=ln.actions,mn=t=>t.issueTypeReducer.instances,Kh=d.createSelector(mn,t=>Object.values(t)),pn=t=>e=>e.issueTypeReducer.instances[t],YI=f(d.createSelector([mn,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectIssueTypesByIds: No issue type exists with the id",a)}return i})),ZI=f(d.createSelector([Kh,(t,e)=>e],(t,e)=>S(t.filter(i=>i.organization===e)))),Yh=ln.reducer,je=P(t=>t.uuid),Zh=je.getInitialState({}),yn=d.createSlice({name:"issueTypeStatuses",initialState:Zh,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Zh)),reducers:{initializeIssueTypeStatuses:je.initialize,addIssueTypeStatus:je.addOne,addIssueTypeStatuses:je.addMany,setIssueTypeStatus:je.setOne,setIssueTypeStatuses:je.setMany,updateIssueTypeStatus:je.updateOne,updateIssueTypeStatuses:je.updateMany,deleteIssueTypeStatus:je.deleteOne,deleteIssueTypeStatuses:je.deleteMany}}),{initializeIssueTypeStatuses:Jh,addIssueTypeStatus:An,addIssueTypeStatuses:JI,setIssueTypeStatus:Zt,setIssueTypeStatuses:XI,updateIssueTypeStatus:Xh,updateIssueTypeStatuses:QI,deleteIssueTypeStatus:fn,deleteIssueTypeStatuses:xI}=yn.actions,Sn=t=>t.issueTypeStatusReducer.instances,Qh=d.createSelector([Sn],t=>Object.values(t)),Tn=t=>e=>e.issueTypeStatusReducer.instances[t],eg=f(d.createSelector([Sn,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectIssueTypeStatusesByIds: No issue type status exists with the id",a)}return S(i)})),tg=f(d.createSelector([Qh,(t,e)=>e],(t,e)=>S(t.filter(i=>i.issue_type===e)))),xh=yn.reducer,qe=P(t=>t.uuid),em=qe.getInitialState({}),In=d.createSlice({name:"issueUpdates",initialState:em,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,O),e=>Object.assign(e,em)),reducers:{initializeIssueUpdates:qe.initialize,addIssueUpdate:qe.addOne,addIssueUpdates:qe.addMany,setIssueUpdate:qe.setOne,setIssueUpdates:qe.setMany,updateIssueUpdate:qe.updateOne,updateIssueUpdates:qe.updateMany,deleteIssueUpdate:qe.deleteOne,deleteIssueUpdates:qe.deleteMany}}),{initializeIssueUpdates:tm,addIssueUpdate:sm,addIssueUpdates:im,setIssueUpdate:sg,setIssueUpdates:ig,updateIssueUpdate:ag,updateIssueUpdates:ng,deleteIssueUpdate:am,deleteIssueUpdates:nm}=In.actions,cm=t=>t.issueUpdateReducer.instances,rm=d.createSelector([cm],t=>Object.values(t)),dm=f(d.createSelector([rm,(t,e)=>e],(t,e)=>S(t.filter(i=>i.issue===e)))),um=In.reducer,ze=P(t=>t.id),om=ze.getInitialState({currentUser:null}),gn=d.createSlice({name:"users",initialState:om,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,om)),reducers:{initializeUsers:ze.initialize,setUsers:ze.setMany,setUser:ze.setOne,addUsers:ze.addMany,addUser:ze.addOne,updateUsers:ze.updateMany,updateUser:ze.updateOne,deleteUser:ze.deleteOne,deleteUsers:ze.deleteMany,setCurrentUser:(t,e)=>{t.currentUser=e.payload},setProfilePicture:(t,e)=>{if(!t.currentUser)return;t.currentUser.profile.file=e.payload.file??null,t.currentUser.profile.file_sha1=e.payload.file_sha1??null;const i=t.instances[t.currentUser.id];if(!i)throw new Error("Unable to find current user in users slice");i.profile.file=e.payload.file??null,i.profile.file_sha1=e.payload.file_sha1??null}}}),{initializeUsers:lm,setUsers:cg,setUser:rg,addUsers:dg,addUser:hm,updateUsers:ug,updateUser:og,deleteUser:mm,deleteUsers:lg,setCurrentUser:hg,setProfilePicture:mg}=gn.actions,pm=gn.reducer,ym=t=>t.userReducer.currentUser,Jt=t=>t.userReducer.instances,bn=d.createSelector([Jt],t=>Object.values(t)),Am=t=>e=>e.userReducer.instances[t],pg=f(d.createSelector([Jt,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectUsersByIds: No user exists with the id",a)}return S(i)})),De=P(t=>t.uuid),fm=De.getInitialState({}),Fn=d.createSlice({name:"organizationAccess",initialState:fm,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,fm)),reducers:{initializeOrganizationAccesses:De.initialize,addOrganizationAccess:De.addOne,addOrganizationAccesses:De.addMany,setOrganizationAccess:De.setOne,setOrganizationAccesses:De.setMany,updateOrganizationAccess:De.updateOne,updateOrganizationAccesses:De.updateMany,deleteOrganizationAccess:De.deleteOne,deleteOrganizationAccesses:De.deleteMany}}),{initializeOrganizationAccesses:Sm,addOrganizationAccess:Tm,addOrganizationAccesses:yg,setOrganizationAccess:Ag,setOrganizationAccesses:fg,updateOrganizationAccess:Xt,updateOrganizationAccesses:Sg,deleteOrganizationAccess:Im,deleteOrganizationAccesses:Tg}=Fn.actions,gm=Fn.reducer,Pn=t=>t.organizationAccessReducer.instances,On=t=>e=>e.organizationAccessReducer.instances[t],Ig=d.createSelector([ym,Pn],(t,e)=>Object.values(e).find(a=>a.user===(t==null?void 0:t.id))??null),bm=d.createSelector([Pn],t=>{const e={};for(const i of Object.values(t))e[i.user]=i;return Rt(e)}),gg=f(d.createSelector([Jt,bm,(t,e)=>e],(t,e,i)=>S(Object.values(t).filter(a=>{const n=e[a.id];return!!n&&n.organization===i})))),Ue=P(t=>t.uuid),Fm=Ue.getInitialState({}),_n=d.createSlice({name:"organizations",initialState:Fm,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Fm)),reducers:{initializeOrganizations:Ue.initialize,setOrganizations:Ue.setMany,setOrganization:Ue.setOne,addOrganizations:Ue.addMany,addOrganization:Ue.addOne,updateOrganizations:Ue.updateMany,updateOrganization:Ue.updateOne,deleteOrganization:Ue.deleteOne,deleteOrganizations:Ue.deleteMany}}),{initializeOrganizations:Pm,setOrganizations:bg,setOrganization:Fg,addOrganizations:Pg,addOrganization:Om,updateOrganizations:Og,updateOrganization:_m,deleteOrganization:_g,deleteOrganizations:Rg}=_n.actions,Rm=t=>t.organizationReducer.instances,vg=d.createSelector([Rm],t=>Object.values(t)),wg=t=>e=>e.organizationReducer.instances[t],vm=_n.reducer,wm=(t,e,i)=>{const a=t.uuid?t:{...t,uuid:Qe.v4()};return{payload:a,type:"",meta:{offline:{effect:{timestamp:new Date().toISOString(),request:a,BASE_URL:e,serviceName:i}}}}},Mm={deletedRequests:[],latestRetryTime:0},Rn=d.createSlice({name:"outbox",initialState:Mm,extraReducers:t=>t.addCase(I,e=>Object.assign(e,Mm)),reducers:{enqueueRequest:{reducer:(t,e)=>t,prepare:t=>{console.debug("Preparing to enqueue request",t);const{BASE_URL:e,serviceName:i,...a}=t;return wm(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}}}),Mg=t=>t.outboxReducer.deletedRequests,Eg=t=>t.outboxReducer.latestRetryTime,{enqueueRequest:Em,markForDeletion:Vg,markAsDeleted:Vm,_setLatestRetryTime:jm}=Rn.actions,qm=Rn.reducer,Ce=P(t=>t.uuid),zm=Ce.getInitialState({}),vn=d.createSlice({name:"projectAccess",initialState:zm,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,zm)),reducers:{initializeProjectAccesses:Ce.initialize,addProjectAccess:Ce.addOne,addProjectAccesses:Ce.addMany,setProjectAccess:Ce.setOne,setProjectAccesses:Ce.setMany,updateProjectAccess:Ce.updateOne,updateProjectAccesses:Ce.updateMany,deleteProjectAccess:Ce.deleteOne,deleteProjectAccesses:Ce.deleteMany}}),{initializeProjectAccesses:Dm,addProjectAccess:wn,addProjectAccesses:Mn,setProjectAccess:jg,setProjectAccesses:qg,updateProjectAccess:Pt,updateProjectAccesses:Um,deleteProjectAccess:En,deleteProjectAccesses:Vn}=vn.actions,Cm=vn.reducer,jn=t=>t.projectAccessReducer.instances,Qt=d.createSelector(jn,t=>Object.values(t)),qn=t=>e=>e.projectAccessReducer.instances[t],km=f(d.createSelector([jn,(t,e)=>e],(t,e)=>S(Object.values(t).filter(i=>i.project===e)))),zg=f(d.createSelector([Qt,(t,e)=>e],(t,e)=>{const i={};for(const a of t.filter(n=>n.project===e))i[a.user]=a;return i})),Dg=f(d.createSelector([bn,Qt,(t,e)=>e],(t,e,i)=>{const a=new Set(e.filter(n=>n.project===i).map(n=>n.user));return S(t.filter(n=>a.has(n.id)))})),ke=P(t=>t.uuid),Bm=ke.getInitialState({}),zn=d.createSlice({name:"projectAttachments",initialState:Bm,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Bm)),reducers:{initializeProjectAttachments:ke.initialize,addProjectAttachment:ke.addOne,addProjectAttachments:ke.addMany,setProjectAttachment:ke.setOne,setProjectAttachments:ke.setMany,updateProjectAttachment:ke.updateOne,updateProjectAttachments:ke.updateMany,deleteProjectAttachment:ke.deleteOne,deleteProjectAttachments:ke.deleteMany}}),{initializeProjectAttachments:$m,addProjectAttachment:Ug,addProjectAttachments:Gm,setProjectAttachment:Lm,setProjectAttachments:Nm,updateProjectAttachment:Cg,updateProjectAttachments:Hm,deleteProjectAttachment:Wm,deleteProjectAttachments:Dn}=zn.actions,Km=t=>t.projectAttachmentReducer.instances,Ym=d.createSelector([Km],t=>Object.values(t)),Zm=t=>e=>e.projectAttachmentReducer.instances[t],Jm=f(d.createSelector([Ym,(t,e)=>e],(t,e)=>S(t.filter(({project:i})=>e===i)))),Xm=zn.reducer,Be=P(t=>t.uuid),Qm=Be.getInitialState({activeProjectFileId:null,isImportingProjectFile:!1}),Un=d.createSlice({name:"projectFiles",initialState:Qm,extraReducers:t=>t.addMatcher(d.isAnyOf(I,M,O),e=>Object.assign(e,Qm)),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,setIsImportingProjectFile:(t,e)=>{t.isImportingProjectFile=e.payload},saveActiveProjectFileBounds:(t,e)=>{const i=t.activeProjectFileId;if(!i)throw new Error("Tried to save bounds for active project file, but no active project file was set.");if(!t.instances[i])throw new Error(`Tried to save bounds for active project file, but project file with ID ${i}
2
- doesn't exist.`);t.instances[i].bounds=e.payload},setActiveProjectFileId:(t,e)=>{t.activeProjectFileId=e.payload},resetProjectFileObjectUrls:(t,...e)=>{for(const i in t.instances)delete t.instances[i].objectURL}}}),{initializeProjectFiles:xm,setProjectFile:kg,setProjectFiles:Bg,addProjectFile:$g,addProjectFiles:ep,updateProjectFile:Cn,updateProjectFiles:Gg,deleteProjectFile:tp,deleteProjectFiles:sp,setIsImportingProjectFile:ip,setActiveProjectFileId:ap,saveActiveProjectFileBounds:np,resetProjectFileObjectUrls:Lg}=Un.actions,cp=t=>t.projectFileReducer.instances,rp=d.createSelector([cp],t=>S(Object.values(t).sort((e,i)=>e.z_index-i.z_index))),Ng=t=>e=>e.projectFileReducer.instances[t],Hg=t=>t.projectFileReducer.activeProjectFileId,Wg=t=>t.projectFileReducer.isImportingProjectFile,dp=Un.reducer,$e=P(t=>t.uuid),up=$e.getInitialState({}),kn=d.createSlice({name:"projects",initialState:up,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,up)),reducers:{initializeProjects:$e.initialize,setProjects:$e.setMany,setProject:$e.setOne,addProjects:$e.addMany,addProject:$e.addOne,updateProjects:$e.updateMany,updateProject:$e.updateOne,deleteProject:$e.deleteOne,deleteProjects:$e.deleteMany}}),{initializeProjects:op,setProjects:Kg,setProject:Yg,addProjects:Zg,addProject:Bn,updateProjects:Jg,updateProject:lp,deleteProject:$n,deleteProjects:Xg}=kn.actions,hp=kn.reducer,mp=t=>t.projectReducer.instances,Gn=d.createSelector([mp],t=>S(Object.values(t))),pp=t=>e=>e.projectReducer.instances[t],Qg=f(d.createSelector([Gn,Qt,(t,e)=>e],(t,e,i)=>{const a=new Set(e.filter(n=>n.user===i).map(n=>n.project));return S(t.filter(n=>a.has(n.uuid)))})),xg=f(d.createSelector([Gn,(t,e)=>e],(t,e)=>S(t.filter(i=>i.organization===e)))),eb={isRehydrated:!1},Ln=d.createSlice({name:"rehydrated",initialState:eb,reducers:{setRehydrated:(t,e)=>{t.isRehydrated=e.payload}}}),{setRehydrated:tb}=Ln.actions,sb=t=>t.rehydratedReducer.isRehydrated,yp=Ln.reducer,Ge=P(t=>t.uuid),Ap=Ge.getInitialState({}),Nn=d.createSlice({name:"teamMemberships",initialState:Ap,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Ap)),reducers:{initializeTeamMemberships:Ge.initialize,addTeamMembership:Ge.addOne,addTeamMemberships:Ge.addMany,setTeamMembership:Ge.setOne,setTeamMemberships:Ge.setMany,updateTeamMembership:Ge.updateOne,updateTeamMemberships:Ge.updateMany,deleteTeamMembership:Ge.deleteOne,deleteTeamMemberships:Ge.deleteMany}}),{initializeTeamMemberships:fp,addTeamMembership:Sp,addTeamMemberships:Tp,setTeamMembership:Hn,setTeamMemberships:Ip,updateTeamMembership:ib,updateTeamMemberships:ab,deleteTeamMembership:Wn,deleteTeamMemberships:gp}=Nn.actions,bp=Nn.reducer,Fp=t=>t.teamMembershipReducer.instances,Kn=d.createSelector([Fp],t=>Object.values(t)),Pp=t=>e=>e.teamMembershipReducer.instances[t],nb=f(d.createSelector([Kn,(t,e)=>e],(t,e)=>{const i={};for(const a of t.filter(n=>n.team===e))i[a.user]=a;return i})),cb=f(d.createSelector([bn,Kn,(t,e)=>e],(t,e,i)=>{const a=new Set(e.filter(n=>n.team===i).map(n=>n.user));return S(t.filter(n=>a.has(n.id)))})),Le=P(t=>t.uuid),Op=Le.getInitialState({}),Yn=d.createSlice({name:"teams",initialState:Op,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Op)),reducers:{initializeTeams:Le.initialize,addTeam:Le.addOne,addTeams:Le.addMany,setTeam:Le.setOne,setTeams:Le.setMany,updateTeam:Le.updateOne,updateTeams:Le.updateMany,deleteTeam:Le.deleteOne,deleteTeams:Le.deleteMany}}),{initializeTeams:_p,addTeam:Rp,addTeams:rb,setTeam:Ot,setTeams:db,updateTeam:vp,updateTeams:ub,deleteTeam:Zn,deleteTeams:ob}=Yn.actions,Jn=t=>t.teamReducer.instances,wp=d.createSelector([Jn],t=>Object.values(t)),Xn=t=>e=>e.teamReducer.instances[t],lb=f(d.createSelector([Jn,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectTeamsByIds: No team exists with the id",a)}return S(i)})),hb=f(d.createSelector([wp,(t,e)=>e],(t,e)=>S(t.filter(i=>i.organization===e)))),Mp=Yn.reducer,mb={version:0},Ep=d.createSlice({name:"versioning",initialState:mb,reducers:{}}),Vp=Ep.reducer,Qn={outboxReducer:qm,fileReducer:yo,authReducer:qu},pb=d.combineReducers(Qn),jp={...Qn,[at]:Vp,categoryReducer:Bu,assetReducer:gd,assetAttachmentReducer:kc,assetStageCompletionReducer:_d,assetStageReducer:Vd,assetTypeReducer:Eu,assetTypeAttachmentReducer:Ld,issueReducer:Xl,issueAttachmentReducer:El,issueTypeReducer:Yh,issueTypeAttachmentReducer:rh,organizationReducer:vm,projectReducer:hp,projectAttachmentReducer:Xm,projectAccessReducer:Cm,organizationAccessReducer:gm,projectFileReducer:dp,rehydratedReducer:yp,formReducer:$o,formRevisionReducer:Co,formRevisionAttachmentReducer:Eo,formSubmissionAttachmentReducer:Xo,formSubmissionReducer:al,formIdentifierReducer:Io,formIdentifierValueReducer:Po,userReducer:pm,emailDomainsReducer:oo,documentsReducer:so,documentAttachmentReducer:Xu,teamReducer:Mp,agentsReducer:Mc,issueCommentReducer:Hl,issueCommentAttachmentReducer:$l,issueUpdateReducer:um,geoImageReducer:pl,issueAssociationReducer:bl,issueTypeFieldsReducer:_h,issueTypeFieldValuesReducer:Th,issueTypeFieldsAttachmentReducer:yh,issueTypeFieldValuesAttachmentReducer:jh,issueTypeIdentifierReducer:Ch,issueTypeIdentifierValueReducer:Gh,issueTypeStatusReducer:xh,assetTypeFieldsReducer:au,assetTypeFieldValuesReducer:Su,assetTypeFieldsAttachmentReducer:Xd,assetTypeFieldValuesAttachmentReducer:lu,assetTypeIdentifierReducer:Fu,assetTypeIdentifierValueReducer:Ru,assetProcedureTypeReducer:qr,assetProcedureReducer:Mr,assetProcedureTypeFieldsReducer:or,assetProcedureFieldValuesReducer:Pr,assetProcedureTypeFieldsAttachmentReducer:sr,assetProcedureTypeFieldValuesAttachmentReducer:yr,assetProcedureTypeAttachmentReducer:Kc,assetProcedureStepFieldsAttachmentReducer:Lr,assetProcedureStepFieldsReducer:Wr,assetProcedureStepFieldValuesAttachmentReducer:xr,assetProcedureStepFieldValuesReducer:cd,assetProcedureStepReducer:pd,teamMembershipReducer:bp},yb=d.combineReducers(jp);function Ab(t,e){return iy.useMemo(t,e)}class fb{constructor(e){T(this,"operations",[]);T(this,"getData");this.getData=e}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].sort((a,n)=>a[e]<=n[e]?1:-1)),this}reverse(){return this.operations.push(e=>[...e].reverse()),this}all(){return this.operations.push(e=>e),this}get(e,i){return d.createSelector([this.getData],a=>this.performOperations(a).find(n=>n[e]===i))}count(){return d.createSelector([this.getData],e=>this.performOperations(e).length)}first(){return d.createSelector([this.getData],e=>this.performOperations(e)[0])}last(){return d.createSelector([this.getData],e=>{const i=this.performOperations(e);return i[i.length-1]})}exists(){return d.createSelector([this.getData],e=>this.performOperations(e).length>0)}toSelector(){return d.createSelector([this.getData],e=>S(this.performOperations(e)))}}const qp={};class zp{constructor(e){T(this,"client");qp[this.constructor.name]=this,this.client=e}async enqueueRequest(e,i){return this.client.enqueueRequest(e,this.host,this.constructor.name,i)}async performPagination(e,i,a){const n=[];let c=await this.client.enqueueRequest(e,this.host,this.constructor.name,a);for(n.push(c.results);c.next;)c=await this.client.enqueueRequest(i(c.next),this.host,this.constructor.name,a),n.push(c.results);return n}dispatch(e){this.client.store.dispatch(e)}}const Dp=()=>kp.length-1,Up=t=>(t[at]={version:Dp()},t),Cp=()=>Up({}),Sb=t=>(t.outboxReducer&&(t.outboxReducer.deletedRequests=[]),t),Tb=t=>e=>{var i;return e===void 0&&(e={}),((i=e[at])==null?void 0:i.version)===Dp()?e:t(e)},kp=[Up,Cp,Cp,Sb],Ib=Object.fromEntries(kp.map((t,e)=>[e,Tb(t)])),gb=t=>{if(t)throw t;const e=it();e?e.dispatch({type:"rehydrated/setRehydrated",payload:!0}):console.error("Client store not set")},Bp=(t,e,i)=>{const a=Je();return a?(a.addRequest(e),a.getQueue()):(console.warn("Outbox coordinator not set; cannot enqueue request yet."),[])},$p=(t,e,i)=>{const a=Je();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 bb(t,e){if(!e.payload)throw new Error("Received empty payload");return Qp(e)}const Fb={...rc,effect:bb,discard:ec,returnPromises:!0,persistCallback:gb,retry:vb,persistOptions:{storage:ny},queue:{...rc.queue,enqueue:Bp,dequeue:$p,peek:(...t)=>Rb(...t)}},Pb=cy(Ib,at),Ob=d.compose(ay.offline(Fb),Pb);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}}async function xn(t,e,i){const a=qp[t.meta.offline.effect.serviceName];if(!a)throw new Error(`Service ${t.meta.offline.effect.serviceName} not found`);const n=a instanceof _;if(e.store.getState().outboxReducer.deletedRequests.includes(t.payload.uuid))throw new Error("Request was marked for deletion");n&&t.payload.checkAuth!==!1&&await a.auth.prepareAuth();const r={queryParams:"",isAuthNeeded:!0},u=t.meta.offline.effect,{payload:m,headers:o,method:h,queryParams:p,attachmentHash:y,isExternalUrl:A,isAuthNeeded:g,isResponseBlob:F}={...r,...u.request},R=u.request;let w=R.url;const z=y?await e.files.fetchCache(y):void 0;if(y&&!z)throw new Error(`Cannot upload file ${y} because it's not cached.`);!A&&!w.startsWith("http")&&(!w.startsWith("/")&&!w.startsWith("blob:")&&(w="/"+w),w=t.meta.offline.effect.BASE_URL+w);const Ne=q=>{if(y){const He=R.s3url;if(!He)throw new Error(`No S3 URL for file ${y}`);if("warning"in He)throw new Error(`S3 URL warning for file ${y}`);if(!z)throw new Error(`No file for file ${y}`);const _t=He.fields["x-amz-checksum-sha1"];if(!_t)throw new Error(`No checksum for file ${y}`);return q.set("x-amz-checksum-sha1",_t).field({...m,...He.fields}).attach("file",z)}return q.send(m)},YF={[l.GET]:()=>F?Xe.get(w.toString()).responseType("blob"):Xe.get(w.toString()),[l.POST]:()=>{const q=Xe.post(w.toString());return Ne(q)},[l.PATCH]:()=>{const q=Xe.patch(w.toString());return Ne(q)},[l.PUT]:()=>{const q=Xe.put(w.toString());return Ne(q)},[l.DELETE]:()=>{const q=Xe.delete(w.toString());return Ne(q)}}[h];let Ye=YF();if(i==null||i.addEventListener("abort",()=>{console.debug("aborting request:",R),Ye.abort()}),g&&n){const q=a.auth.getAuthHeader();Ye=Ye.set("Authorization",q)}o&&(Ye=Ye.set(o));try{return await Ye.query(p)}catch(q){const He=_b(q),_t=He==null?void 0:He.status;if(n&&_t===401)return await a.auth.handleUnauthorized(Ye,He),Ye.query(p);throw new U({response:He,innerError:q,discard:Gp.includes(_t)})}}const Gp=[400,409,403,404,405,500];function ec(t,e,i=0){var o;if(console.debug("Considering discarding request due to error:",t,`(${typeof t})`,`
1
+ (function(s,D){typeof exports=="object"&&typeof module<"u"?D(exports,require("@redux-offline/redux-offline/lib/types"),require("@reduxjs/toolkit"),require("superagent"),require("uuid"),require("file-saver"),require("fast-tree-builder"),require("ts-tree-lib"),require("react"),require("@redux-offline/redux-offline"),require("@redux-offline/redux-offline/lib/defaults"),require("buffer"),require("localforage"),require("redux-persist-migrate"),require("@overmap-ai/forms"),require("idb"),require("jwt-decode"),require("dependency-graph"),require("@tiptap/core")):typeof define=="function"&&define.amd?define(["exports","@redux-offline/redux-offline/lib/types","@reduxjs/toolkit","superagent","uuid","file-saver","fast-tree-builder","ts-tree-lib","react","@redux-offline/redux-offline","@redux-offline/redux-offline/lib/defaults","buffer","localforage","redux-persist-migrate","@overmap-ai/forms","idb","jwt-decode","dependency-graph","@tiptap/core"],D):(s=typeof globalThis<"u"?globalThis:s||self,D(s["overmap-core"]={},null,s.toolkit,s.request,s.uuid,s.fileSaver,s.buildTree,s.tsTreeLib,s.react,s.reduxOffline,s.offlineConfig,null,s.localforage,s.createMigration,null,s.idb,s.jwtDecode,s.dependencyGraph))})(this,function(s,D,d,Qe,xe,py,yy,mn,Ay,fy,pn,fP,Sy,Ty,SP,Iy,gy,by){"use strict";var yP=Object.defineProperty;var AP=(s,D,d)=>D in s?yP(s,D,{enumerable:!0,configurable:!0,writable:!0,value:d}):s[D]=d;var T=(s,D,d)=>AP(s,typeof D!="symbol"?D+"":D,d);var my;const yn=Object.freeze([]),An=Object.freeze({});var fn=(t=>(t[t.GUEST=0]="GUEST",t[t.BASIC=2]="BASIC",t[t.ADMIN=4]="ADMIN",t))(fn||{}),l=(t=>(t.GET="GET",t.POST="POST",t.PATCH="PATCH",t.PUT="PUT",t.DELETE="DELETE",t))(l||{}),Sn=(t=>(t[t.PLANNED=0]="PLANNED",t[t.ACTIVE=1]="ACTIVE",t[t.MAINTENANCE=2]="MAINTENANCE",t[t.INACTIVE=3]="INACTIVE",t[t.RETIRED=4]="RETIRED",t[t.DISPOSED=5]="DISPOSED",t))(Sn||{}),Tn=(t=>(t.Issue="issue",t.Asset="asset",t.AssetType="asset_type",t.Project="project",t.Document="document",t))(Tn||{}),is=(t=>(t[t.LOWEST=0]="LOWEST",t[t.LOW=2]="LOW",t[t.MEDIUM=4]="MEDIUM",t[t.HIGH=6]="HIGH",t[t.HIGHEST=8]="HIGHEST",t))(is||{}),as=(t=>(t[t.BACKLOG=0]="BACKLOG",t[t.SELECTED=2]="SELECTED",t[t.DONE=4]="DONE",t))(as||{}),M=(t=>(t.STATUS="status",t.PRIORITY="priority",t.CATEGORY="category",t.DESCRIPTION="description",t.TITLE="title",t.ASSIGNED_TO="assigned_to",t.DUE_DATE="due_date",t))(M||{}),In=(t=>(t[t.BACKLOG=0]="BACKLOG",t[t.PLANNED=1]="PLANNED",t[t.IN_PROGRESS=2]="IN_PROGRESS",t[t.COMPLETED=3]="COMPLETED",t[t.CANCELLED=4]="CANCELLED",t))(In||{});const Fy=as.BACKLOG,Py=is.MEDIUM,gn=6e4;function P(t){return{addOne:(p,y)=>{const A=t(y.payload);p.instances[A]=y.payload},addMany:(p,y)=>{for(const A of y.payload){const g=t(A);p.instances[g]=A}},setOne:(p,y)=>{const A=t(y.payload);p.instances[A]=y.payload},setMany:(p,y)=>{for(const A of y.payload){const g=t(A);p.instances[g]=A}},updateOne:(p,y)=>{const A=t(y.payload);p.instances[A]=y.payload},updateMany:(p,y)=>{for(const A of y.payload){const g=t(A);p.instances[g]=A}},deleteOne:(p,y)=>{delete p.instances[y.payload]},deleteMany:(p,y)=>{for(const A of y.payload)delete p.instances[A]},initialize:(p,y)=>{p.instances={};const A=new Set;for(const g of y.payload){const F=t(g);A.add(F),p.instances[F]=g}A.size!==y.payload.length&&console.warn("duplicate ids detected when initializing model instances.")},getInitialState:p=>({...p,instances:{}})}}function Oy(){return{initializeSelection:(m,o)=>{m.selection=Array.from(new Set(o.payload))},selectOne:(m,o)=>{new Set(m.selection).has(o.payload)||m.selection.push(o.payload)},selectMany:(m,o)=>{const h=new Set(m.selection);for(const p of o.payload)h.has(p)||h.add(p);m.selection=Array.from(h)},unselectOne:(m,o)=>{const h=new Set(m.selection);h.has(o.payload)&&(h.delete(o.payload),m.selection=Array.from(h))},unselectMany:(m,o)=>{const h=new Set(m.selection);for(const p of o.payload)h.has(p)&&h.delete(p);m.selection=Array.from(h)},toggleOne:(m,o)=>{const h=new Set(m.selection);h.has(o.payload)?h.delete(o.payload):h.add(o.payload),m.selection=Array.from(h)},toggleMany:(m,o)=>{const h=new Set(m.selection);for(const p of o.payload)h.has(p)?h.delete(p):h.add(p);m.selection=Array.from(h)},getInitialState:m=>({...m,selection:[]})}}const ct="versioning",I=d.createAction("RESET"),E=d.createAction("RESET_PROJECT_STATE"),O=d.createAction("RESET_ORGANIZATION_STATE");my=Symbol.toStringTag;class bn{constructor(){T(this,my,"Promise");T(this,"_promise");T(this,"_resolve");T(this,"_reject");T(this,"_state","pending");this._resolve=null,this._reject=null,this._promise=new Promise((e,i)=>{this._resolve=e,this._reject=i})}get state(){return this._state}then(e,i){return this._promise.then(e,i)}catch(e){return this._promise.catch(e)}resolve(e){if(!this._resolve)throw new Error("No resolve callback");this._resolve(e),this._state="fulfilled"}reject(e){if(!this._reject)throw e;this._reject(e),this._state="rejected"}finally(e){throw new Error("`finally` not implemented")}}let cs=!1;["true","1"].includes("".toLowerCase())&&(cs=!0);function _y(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;const i=Object.keys(t),a=Object.keys(e),c=i.length;if(c!==a.length)return!1;for(let n=0;n<c;n++){const r=i[n];if(!Object.prototype.hasOwnProperty.call(e,r)||t[r]!==e[r])return!1}return!0}function ns(t){const e={};return function(){const i=Array.prototype.slice.call(arguments);return i in e?(cs&&console.debug(`Memoization debug: Using memorized return value for ${t.toString()}(`,i,")"),e[i]):(cs&&console.debug(`Memoization debug: Cache miss! Memoizing ${t.toString()}(`,i,")"),e[i]=t.apply(this,i))}}function Ry(t,e){if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}const S=t=>t.length===0?yn:t,vt=t=>Object.keys(t).length===0?An:t,Fn=ns(t=>{if(!t)return"";const e=new Date(t),i=e.getFullYear()===rs.getFullYear(),a={day:"numeric",month:"short"};return i||(a.year="numeric"),e.toLocaleDateString([],a)}),vy=new Intl.RelativeTimeFormat([],{style:"long",numeric:"auto"}),wy=1e3*86400,rs=new Date,Ey=t=>new Date(t).toDateString()===rs.toDateString(),My=ns((t,e,i)=>{const a=Math.round((new Date(t).getTime()-rs.getTime())/wy);return a<e||a>i?Fn(t):vy.format(a,"days")});function Vy(t){return new Uint8Array(t).reduce((i,a)=>i+a.toString(16).padStart(2,"0"),"")}const ds=async(t,e)=>{e||(e=await et(t));let i=t.type;if(i.includes("/")&&(i=i.split("/")[1]),!i)throw new Error(`Could not extract file type from ${t.type}`);return`${e}.${i}`};function et(t){return new Promise((e,i)=>{const a=new FileReader;a.onload=()=>{const c=a.result;if(!c){i(new Error("FileReader did not return a valid ArrayBuffer."));return}crypto.subtle.digest("SHA-1",c).then(n=>{const r=Vy(n);e(r)})},a.readAsArrayBuffer(t)})}function jy(t){if(!t.name||!t.type||!t.size){const e="File has no name, type, and/or size";throw new Error(e)}return`${t.name}&${t.type}${t.size}`}function Pn(t,e){return new File([t],e,{type:t.type})}function qy(t,e){const i=document.createElement("a");i.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(e)),i.setAttribute("download",t),i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i)}const zy=async t=>{const e={};for(const i of t){const a=await et(i);e[a]={sha1:a,extension:i.name.split(".").pop()||"",file_type:i.type,size:i.size}}return Object.values(e)},On=async t=>(await fetch(t)).blob(),Dy=t=>new Promise((e,i)=>{const a=new FileReader;a.onloadend=()=>{var c;e(((c=a.result)==null?void 0:c.toString())||"")},a.readAsDataURL(t)});function Uy(t){const e=new Blob([t]);py.saveAs(e,t.name)}const _n={};function Cy(t,e,i,...a){const c=_n[t];let n=!1;c?c[e]||(c[e]=!0,n=!0):(_n[t]={[e]:!0},n=!0),n&&console[i](...a)}const Rn=["created_at","updated_at","index","revision"];function b(t){return{...t,uuid:xe.v4()}}function vn(t){const e={};for(const i of t)e[i.uuid]=i;return e}function wn(t){return t.map(({uuid:e})=>e)}function ky(t,e=void 0,i=255){let a=t.replace(/[^a-z0-9_\-.]/gi,"_").replace(/_{2,}/g,"_");if(!e){const n=t.split(".");n.length>1&&(e=n[n.length-1])}e&&!e.startsWith(".")&&(e="."+e);const c=e?e.length:0;return a.length+c>i&&(a=a.slice(0,i-c)+(e||"")),a}function By(t){return t.toLowerCase().replace(" ","-")}function $y(t,e=!1){return t.normalize("NFKD").toLowerCase().replace(/[^\w\s-]/g,"").trim().replace(/[-\s]+/g,e?"_":"-")}function Gy(t,e){if(t.length<=e)return t;const i=t.slice(0,e-1);return i.slice(0,i.lastIndexOf(" "))+"…"}const f=t=>e=>i=>t(i,e);function En(t,e,i){return i.findIndex(a=>a.uuid===t.uuid)===e}function Ly(t,e,i){return i.findIndex(a=>a.file_sha1===t.file_sha1)===e}const Ny=/^.+@.+\..+$/;function v(t){const e={...t};for(const i of[...Rn,"created_by"])i in e&&delete e[i];return e}const Mn=t=>{const e=t.toSorted((i,a)=>i.order-a.order);return yy(e,{id:i=>i.uuid,parentId:i=>i.parent,includeEmptyChildrenArray:!0,valueKey:!1})},Hy=t=>{const{roots:e}=Mn(t);return e.map(i=>new mn.Tree(i))},Vn=(t,e)=>{const{nodes:i}=Mn(e),a=i.get(t);if(!a)throw new Error(`Node with uuid ${t} does not exist in asset procedure step tree.`);return new mn.Tree(a)},k=P(t=>t.uuid),jn=k.getInitialState({}),us=d.createSlice({name:"agents",initialState:jn,extraReducers:t=>t.addMatcher(d.isAnyOf(I,E,O),e=>Object.assign(e,jn)),reducers:{initializeConversations:k.initialize,addConversation:k.addOne,addConversations:k.addMany,setConversation:k.setOne,setConversations:k.setMany,updateConversation:k.updateOne,updateConversations:k.updateMany,deleteConversation:k.deleteOne,deleteConversations:k.deleteMany}}),{initializeConversations:qn,addConversation:zn,addConversations:Wy,setConversation:Dn,setConversations:Ky,updateConversation:Un,updateConversations:Yy,deleteConversation:Zy,deleteConversations:Jy}=us.actions,os=t=>t.agentsReducer.instances,Xy=d.createSelector([os],t=>Object.values(t)),Qy=f(d.createSelector([os,(t,e)=>e],(t,e)=>t[e])),Cn=us.reducer,B=P(t=>t.uuid),kn=B.getInitialState({}),ls=d.createSlice({name:"assetAttachments",initialState:kn,extraReducers:t=>t.addMatcher(d.isAnyOf(I,E,O),e=>Object.assign(e,kn)),reducers:{initializeAssetAttachments:B.initialize,addAssetAttachment:B.addOne,addAssetAttachments:B.addMany,setAssetAttachment:B.setOne,setAssetAttachments:B.setMany,updateAssetAttachment:B.updateOne,updateAssetAttachments:B.updateMany,deleteAssetAttachment:B.deleteOne,deleteAssetAttachments:B.deleteMany}}),{initializeAssetAttachments:hs,addAssetAttachment:xy,addAssetAttachments:ms,setAssetAttachment:Bn,setAssetAttachments:eA,updateAssetAttachment:tA,updateAssetAttachments:$n,deleteAssetAttachment:Gn,deleteAssetAttachments:ps}=ls.actions,Ln=t=>t.assetAttachmentReducer.instances,Nn=d.createSelector([Ln],t=>Object.values(t)),Hn=t=>e=>e.assetAttachmentReducer.instances[t],Wn=f(d.createSelector([Nn,(t,e)=>e],(t,e)=>S(t.filter(({asset:i})=>e===i)))),Kn=ls.reducer,$=P(({uuid:t})=>t),Yn=$.getInitialState({}),ys=d.createSlice({name:"assetProcedureTypeAttachments",initialState:Yn,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Yn)),reducers:{initializeAssetProcedureTypeAttachments:$.initialize,addAssetProcedureTypeAttachment:$.addOne,addAssetProcedureTypeAttachments:$.addMany,setAssetProcedureTypeAttachment:$.setOne,setAssetProcedureTypeAttachments:$.setMany,updateAssetProcedureTypeAttachment:$.updateOne,updateAssetProcedureTypeAttachments:$.updateMany,deleteAssetProcedureTypeAttachment:$.deleteOne,deleteAssetProcedureTypeAttachments:$.deleteMany}}),{initializeAssetProcedureTypeAttachments:Zn,addAssetProcedureTypeAttachment:sA,addAssetProcedureTypeAttachments:Jn,setAssetProcedureTypeAttachment:Xn,setAssetProcedureTypeAttachments:iA,updateAssetProcedureTypeAttachment:aA,updateAssetProcedureTypeAttachments:Qn,deleteAssetProcedureTypeAttachment:xn,deleteAssetProcedureTypeAttachments:er}=ys.actions,tr=ys.reducer,sr=t=>t.assetProcedureTypeAttachmentReducer.instances,ir=d.createSelector([sr],t=>Object.values(t)),ar=t=>e=>e.assetProcedureTypeAttachmentReducer.instances[t],cA=f(d.createSelector([ir,(t,e)=>e],(t,e)=>S(t.filter(({asset_procedure_type:i})=>e===i)))),G=P(({uuid:t})=>t),cr=G.getInitialState({}),As=d.createSlice({name:"assetProcedureTypeFieldsAttachments",initialState:cr,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,cr)),reducers:{initializeAssetProcedureTypeFieldsAttachments:G.initialize,addAssetProcedureTypeFieldsAttachment:G.addOne,addAssetProcedureTypeFieldsAttachments:G.addMany,setAssetProcedureTypeFieldsAttachment:G.setOne,setAssetProcedureTypeFieldsAttachments:G.setMany,updateAssetProcedureTypeFieldsAttachment:G.updateOne,updateAssetProcedureTypeFieldsAttachments:G.updateMany,deleteAssetProcedureTypeFieldsAttachment:G.deleteOne,deleteAssetProcedureTypeFieldsAttachments:G.deleteMany}}),{initializeAssetProcedureTypeFieldsAttachments:nr,addAssetProcedureTypeFieldsAttachment:nA,addAssetProcedureTypeFieldsAttachments:rr,setAssetProcedureTypeFieldsAttachment:rA,setAssetProcedureTypeFieldsAttachments:dA,updateAssetProcedureTypeFieldsAttachment:uA,updateAssetProcedureTypeFieldsAttachments:dr,deleteAssetProcedureTypeFieldsAttachment:oA,deleteAssetProcedureTypeFieldsAttachments:ur}=As.actions,or=As.reducer,lr=t=>t.assetProcedureTypeFieldsAttachmentReducer.instances,hr=d.createSelector([lr],t=>Object.values(t)),lA=f(d.createSelector([hr,(t,e)=>e],(t,e)=>S(t.filter(i=>i.fields_revision===e)))),hA=t=>e=>e.assetProcedureTypeFieldsAttachmentReducer.instances[t],L=P(({uuid:t})=>t),mr=L.getInitialState({}),fs=d.createSlice({name:"assetProcedureTypeFields",initialState:mr,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,mr)),reducers:{initializeAssetProcedureTypeFields:L.initialize,addAssetProcedureTypeFields:L.addOne,addAssetProcedureTypeFieldsMany:L.addMany,setAssetProcedureTypeFields:L.setOne,setAssetProcedureTypeFieldsMany:L.setMany,updateAssetProcedureTypeFields:L.updateOne,updateAssetProcedureTypeFieldsMany:L.updateMany,deleteAssetProcedureTypeFields:L.deleteOne,deleteAssetProcedureTypeFieldsMany:L.deleteMany}}),{initializeAssetProcedureTypeFields:pr,addAssetProcedureTypeFields:yr,addAssetProcedureTypeFieldsMany:mA,setAssetProcedureTypeFields:pA,setAssetProcedureTypeFieldsMany:yA,updateAssetProcedureTypeFields:Ar,updateAssetProcedureTypeFieldsMany:AA,deleteAssetProcedureTypeFields:fr,deleteAssetProcedureTypeFieldsMany:fA}=fs.actions,Sr=fs.reducer,Tr=t=>t.assetProcedureTypeFieldsReducer.instances,Ss=d.createSelector([Tr],t=>Object.values(t)),SA=f(d.createSelector([Ss,(t,e)=>e],(t,e)=>S(t.filter(i=>i.asset_procedure_type===e)))),TA=f(d.createSelector([Ss,(t,e)=>e],(t,e)=>t.filter(i=>i.asset_procedure_type===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),IA=t=>e=>e.assetProcedureTypeFieldsReducer.instances[t],N=P(({uuid:t})=>t),Ir=N.getInitialState({}),Ts=d.createSlice({name:"assetProcedureTypeFieldValuesAttachments",initialState:Ir,extraReducers:t=>t.addMatcher(d.isAnyOf(I,E,O),e=>Object.assign(e,Ir)),reducers:{initializeAssetProcedureTypeFieldValuesAttachments:N.initialize,addAssetProcedureTypeFieldValuesAttachment:N.addOne,addAssetProcedureTypeFieldValuesAttachments:N.addMany,setAssetProcedureTypeFieldValuesAttachment:N.setOne,setAssetProcedureTypeFieldValuesAttachments:N.setMany,updateAssetProcedureTypeFieldValuesAttachment:N.updateOne,updateAssetProcedureTypeFieldValuesAttachments:N.updateMany,deleteAssetProcedureTypeFieldValuesAttachment:N.deleteOne,deleteAssetProcedureTypeFieldValuesAttachments:N.deleteMany}}),{initializeAssetProcedureTypeFieldValuesAttachments:gr,addAssetProcedureTypeFieldValuesAttachment:gA,addAssetProcedureTypeFieldValuesAttachments:wt,setAssetProcedureTypeFieldValuesAttachment:bA,setAssetProcedureTypeFieldValuesAttachments:FA,updateAssetProcedureTypeFieldValuesAttachment:PA,updateAssetProcedureTypeFieldValuesAttachments:br,deleteAssetProcedureTypeFieldValuesAttachment:OA,deleteAssetProcedureTypeFieldValuesAttachments:Et}=Ts.actions,Fr=Ts.reducer,Is=t=>t.assetProcedureTypeFieldValuesAttachmentReducer.instances,Pr=d.createSelector([Is],t=>Object.values(t)),_A=t=>e=>e.assetProcedureTypeFieldValuesAttachmentReducer.instances[t],Or=f(d.createSelector([Is,(t,e)=>e],(t,e)=>{const i=new Set(e);return S(Object.values(t).filter(a=>i.has(a.uuid)))})),_r=f(d.createSelector([Pr,(t,e)=>e],(t,e)=>S(t.filter(i=>i.field_values===e)))),H=P(({uuid:t})=>t),Rr=H.getInitialState({}),gs=d.createSlice({name:"assetProcedureTypeFieldValues",initialState:Rr,extraReducers:t=>t.addMatcher(d.isAnyOf(I,E,O),e=>Object.assign(e,Rr)),reducers:{initializeAssetProcedureTypeFieldValues:H.initialize,addAssetProcedureTypeFieldValues:H.addOne,addAssetProcedureTypeFieldValuesMany:H.addMany,setAssetProcedureTypeFieldValues:H.setOne,setAssetProcedureTypeFieldValuesMany:H.setMany,updateAssetProcedureTypeFieldValues:H.updateOne,updateAssetProcedureTypeFieldValuesMany:H.updateMany,deleteAssetProcedureTypeFieldValues:H.deleteOne,deleteAssetProcedureTypeFieldValuesMany:H.deleteMany}}),{initializeAssetProcedureTypeFieldValues:vr,addAssetProcedureTypeFieldValues:bs,addAssetProcedureTypeFieldValuesMany:wr,setAssetProcedureTypeFieldValues:RA,setAssetProcedureTypeFieldValuesMany:vA,updateAssetProcedureTypeFieldValues:nt,updateAssetProcedureTypeFieldValuesMany:Er,deleteAssetProcedureTypeFieldValues:Fs,deleteAssetProcedureTypeFieldValuesMany:Mr}=gs.actions,Vr=gs.reducer,jr=t=>t.assetProcedureFieldValuesReducer.instances,Ps=d.createSelector([jr],t=>Object.values(t)),wA=f(d.createSelector([Ps,(t,e)=>e],(t,e)=>S(t.filter(i=>i.asset===e)))),EA=f(d.createSelector([Ps,(t,e)=>e],(t,e)=>S(t.filter(i=>i.asset_procedure===e)))),Os=t=>e=>e.assetProcedureFieldValuesReducer.instances[t],W=P(({uuid:t})=>t),qr=W.getInitialState({}),_s=d.createSlice({name:"assetProcedures",initialState:qr,extraReducers:t=>t.addMatcher(d.isAnyOf(I,E,O),e=>Object.assign(e,qr)),reducers:{initializeAssetProcedures:W.initialize,addAssetProcedure:W.addOne,addAssetProcedures:W.addMany,setAssetProcedure:W.setOne,setAssetProcedures:W.setMany,updateAssetProcedure:W.updateOne,updateAssetProcedures:W.updateMany,deleteAssetProcedure:W.deleteOne,deleteAssetProcedures:W.deleteMany}}),{initializeAssetProcedures:zr,addAssetProcedure:Rs,addAssetProcedures:Dr,updateAssetProcedure:rt,updateAssetProcedures:MA,deleteAssetProcedure:vs,deleteAssetProcedures:Ur,setAssetProcedure:VA,setAssetProcedures:jA}=_s.actions,Cr=_s.reducer,ws=t=>t.assetProcedureReducer.instances,Es=d.createSelector([ws],t=>Object.values(t)),kr=f(d.createSelector([Es,(t,e)=>e],(t,e)=>S(t.filter(i=>i.asset_procedure_type===e)))),qA=f(d.createSelector([Es,(t,e)=>e],(t,e)=>S(t.filter(i=>i.asset_type===e)))),Ms=t=>e=>e.assetProcedureReducer.instances[t],zA=f(d.createSelector([ws,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const c=t[a];c&&i.push(c)}return S(i)})),K=P(t=>t.uuid),Br=K.getInitialState({}),Vs=d.createSlice({name:"assetProcedureTypes",initialState:Br,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Br)),reducers:{initializeAssetProcedureTypes:K.initialize,addAssetProcedureType:K.addOne,addAssetProcedureTypes:K.addMany,setAssetProcedureType:K.setOne,setAssetProcedureTypes:K.setMany,updateAssetProcedureType:K.updateOne,updateAssetProcedureTypes:K.updateMany,deleteAssetProcedureType:K.deleteOne,deleteAssetProcedureTypes:K.deleteMany}}),{initializeAssetProcedureTypes:$r,addAssetProcedureType:js,addAssetProcedureTypes:DA,updateAssetProcedureType:dt,updateAssetProcedureTypes:UA,deleteAssetProcedureType:qs,deleteAssetProcedureTypes:CA,setAssetProcedureType:kA,setAssetProcedureTypes:BA}=Vs.actions,Gr=Vs.reducer,zs=t=>t.assetProcedureTypeReducer.instances,Lr=d.createSelector([zs],t=>Object.values(t)),Ds=t=>e=>e.assetProcedureTypeReducer.instances[t],$A=f(d.createSelector([zs,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const c=t[a];c&&i.push(c)}return S(i)})),GA=f(d.createSelector([Lr,(t,e)=>e],(t,e)=>S(t.filter(i=>i.organization===e)))),Y=P(t=>t.uuid),Nr=Y.getInitialState({}),Us=d.createSlice({name:"assetProcedureStepFieldsAttachments",initialState:Nr,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Nr)),reducers:{initializeAssetProcedureStepFieldsAttachments:Y.initialize,addAssetProcedureStepFieldsAttachment:Y.addOne,addAssetProcedureStepFieldsAttachments:Y.addMany,setAssetProcedureStepFieldsAttachment:Y.setOne,setAssetProcedureStepFieldsAttachments:Y.setMany,updateAssetProcedureStepFieldsAttachment:Y.updateOne,updateAssetProcedureStepFieldsAttachments:Y.updateMany,deleteAssetProcedureStepFieldsAttachment:Y.deleteOne,deleteAssetProcedureStepFieldsAttachments:Y.deleteMany}}),{initializeAssetProcedureStepFieldsAttachments:Hr,addAssetProcedureStepFieldsAttachment:LA,addAssetProcedureStepFieldsAttachments:Wr,setAssetProcedureStepFieldsAttachment:NA,setAssetProcedureStepFieldsAttachments:HA,updateAssetProcedureStepFieldsAttachment:WA,updateAssetProcedureStepFieldsAttachments:Kr,deleteAssetProcedureStepFieldsAttachment:KA,deleteAssetProcedureStepFieldsAttachments:Yr}=Us.actions,Zr=t=>t.assetProcedureStepFieldsAttachmentReducer.instances,Jr=d.createSelector([Zr],t=>Object.values(t)),YA=f(d.createSelector([Jr,(t,e)=>e],(t,e)=>S(t.filter(i=>i.fields_revision===e)))),ZA=t=>e=>e.assetProcedureStepFieldsAttachmentReducer.instances[t],Xr=Us.reducer,Z=P(t=>t.uuid),Qr=Z.getInitialState({}),Cs=d.createSlice({name:"assetProcedureStepFields",initialState:Qr,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Qr)),reducers:{initializeAssetProcedureStepFields:Z.initialize,addAssetProcedureStepFields:Z.addOne,addAssetProcedureStepFieldsMany:Z.addMany,setAssetProcedureStepFields:Z.setOne,setAssetProcedureStepFieldsMany:Z.setMany,updateAssetProcedureStepFields:Z.updateOne,updateAssetProcedureStepFieldsMany:Z.updateMany,deleteAssetProcedureStepFields:Z.deleteOne,deleteAssetProcedureStepFieldsMany:Z.deleteMany}}),{initializeAssetProcedureStepFields:xr,addAssetProcedureStepFields:ks,addAssetProcedureStepFieldsMany:JA,setAssetProcedureStepFields:XA,setAssetProcedureStepFieldsMany:QA,updateAssetProcedureStepFields:ut,updateAssetProcedureStepFieldsMany:xA,deleteAssetProcedureStepFields:Bs,deleteAssetProcedureStepFieldsMany:ef}=Cs.actions,$s=t=>t.assetProcedureStepFieldsReducer.instances,Gs=d.createSelector([$s],t=>Object.values(t)),tf=f(d.createSelector([Gs,(t,e)=>e],(t,e)=>S(t.filter(i=>i.asset_procedure_step===e)))),sf=f(d.createSelector([Gs,(t,e)=>e],(t,e)=>t.filter(i=>i.asset_procedure_step===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),af=d.createSelector([$s],t=>{const e={};for(const i of Object.values(t)){const a=e[i.asset_procedure_step];(!a||a.submitted_at<i.submitted_at)&&(e[i.asset_procedure_step]=i)}return e}),cf=t=>e=>e.assetProcedureStepFieldsReducer.instances[t],ed=Cs.reducer,J=P(t=>t.uuid),td=J.getInitialState({}),Ls=d.createSlice({name:"assetProcedureStepFieldValuesAttachments",initialState:td,extraReducers:t=>t.addMatcher(d.isAnyOf(I,E,O),e=>Object.assign(e,td)),reducers:{initializeAssetProcedureStepFieldValuesAttachments:J.initialize,addAssetProcedureStepFieldValuesAttachment:J.addOne,addAssetProcedureStepFieldValuesAttachments:J.addMany,setAssetProcedureStepFieldValuesAttachment:J.setOne,setAssetProcedureStepFieldValuesAttachments:J.setMany,updateAssetProcedureStepFieldValuesAttachment:J.updateOne,updateAssetProcedureStepFieldValuesAttachments:J.updateMany,deleteAssetProcedureStepFieldValuesAttachment:J.deleteOne,deleteAssetProcedureStepFieldValuesAttachments:J.deleteMany}}),{initializeAssetProcedureStepFieldValuesAttachments:sd,addAssetProcedureStepFieldValuesAttachment:nf,addAssetProcedureStepFieldValuesAttachments:Mt,setAssetProcedureStepFieldValuesAttachment:rf,setAssetProcedureStepFieldValuesAttachments:df,updateAssetProcedureStepFieldValuesAttachment:uf,updateAssetProcedureStepFieldValuesAttachments:id,deleteAssetProcedureStepFieldValuesAttachment:of,deleteAssetProcedureStepFieldValuesAttachments:Vt}=Ls.actions,Ns=t=>t.assetProcedureStepFieldValuesAttachmentReducer.instances,ad=d.createSelector([Ns],t=>Object.values(t)),lf=t=>e=>e.assetProcedureStepFieldValuesAttachmentReducer.instances[t],cd=f(d.createSelector([Ns,(t,e)=>e],(t,e)=>{const i=new Set(e);return S(Object.values(t).filter(a=>i.has(a.uuid)))})),nd=f(d.createSelector([ad,(t,e)=>e],(t,e)=>S(t.filter(i=>i.field_values===e)))),rd=Ls.reducer,X=P(t=>t.uuid),dd=X.getInitialState({}),Hs=d.createSlice({name:"assetProcedureStepFieldValues",initialState:dd,extraReducers:t=>t.addMatcher(d.isAnyOf(I,E,O),e=>Object.assign(e,dd)),reducers:{initializeAssetProcedureStepFieldValues:X.initialize,addAssetProcedureStepFieldValues:X.addOne,addAssetProcedureStepFieldValuesMany:X.addMany,setAssetProcedureStepFieldValues:X.setOne,setAssetProcedureStepFieldValuesMany:X.setMany,updateAssetProcedureStepFieldValues:X.updateOne,updateAssetProcedureStepFieldValuesMany:X.updateMany,deleteAssetProcedureStepFieldValues:X.deleteOne,deleteAssetProcedureStepFieldValuesMany:X.deleteMany}}),{initializeAssetProcedureStepFieldValues:ud,addAssetProcedureStepFieldValues:Ws,addAssetProcedureStepFieldValuesMany:od,setAssetProcedureStepFieldValues:hf,setAssetProcedureStepFieldValuesMany:mf,updateAssetProcedureStepFieldValues:ot,updateAssetProcedureStepFieldValuesMany:ld,deleteAssetProcedureStepFieldValues:Ks,deleteAssetProcedureStepFieldValuesMany:hd}=Hs.actions,md=t=>t.assetProcedureStepFieldValuesReducer.instances,jt=d.createSelector([md],t=>Object.values(t)),pf=f(d.createSelector([jt,(t,e)=>e],(t,e)=>S(t.filter(i=>i.asset===e)))),yf=f(d.createSelector([jt,(t,e)=>e],(t,e)=>S(t.filter(i=>i.asset_procedure===e)))),Af=f(d.createSelector([jt,(t,e)=>e],(t,e)=>S(t.filter(i=>i.asset_procedure_step===e)))),Ys=t=>e=>e.assetProcedureStepFieldValuesReducer.instances[t],pd=Hs.reducer,Q=P(t=>t.uuid),yd=Q.getInitialState({}),Zs=d.createSlice({name:"assetProcedureSteps",initialState:yd,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,yd)),reducers:{initializeAssetProcedureSteps:Q.initialize,setAssetProcedureStep:Q.setOne,setAssetProcedureSteps:Q.setMany,addAssetProcedureStep:Q.addOne,addAssetProcedureSteps:Q.addMany,updateAssetProcedureStep:Q.updateOne,updateAssetProcedureSteps:Q.updateMany,deleteAssetProcedureStep:Q.deleteOne,deleteAssetProcedureSteps:Q.deleteMany}}),{initializeAssetProcedureSteps:Ad,setAssetProcedureStep:fd,setAssetProcedureSteps:ff,addAssetProcedureStep:Sd,addAssetProcedureSteps:Td,updateAssetProcedureStep:qt,updateAssetProcedureSteps:Sf,deleteAssetProcedureStep:Id,deleteAssetProcedureSteps:gd}=Zs.actions,bd=Zs.reducer,lt=t=>t.assetProcedureStepReducer.instances,Js=t=>e=>e.assetProcedureStepReducer.instances[t],Fd=d.createSelector([lt],t=>Object.values(t)),Tf=f(d.createSelector([lt,(t,e)=>e],(t,e)=>{const i={};for(const[a,c]of Object.entries(t))c.asset_procedure_type===e&&(i[a]=c);return vt(i)})),If=f(d.createSelector([Fd,(t,e)=>e],(t,e)=>S(t.filter(i=>i.asset_procedure_type===e)))),gf=f(d.createSelector([lt,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const c=t[a];c?i.push(c):console.warn("selectAssetProcedureStepsByIds: No step exists with the id",a)}return S(i)})),Pd=f(d.createSelector([lt,(t,e)=>e],(t,e)=>{if(!t[e])return S([]);const c=Vn(e,Object.values(t)).all().map(({model:n})=>n);return S(c)})),x=P(t=>t.uuid),Od=x.getInitialState({}),Xs=d.createSlice({name:"assets",initialState:Od,extraReducers:t=>t.addMatcher(d.isAnyOf(I,E,O),e=>Object.assign(e,Od)),reducers:{initializeAssets:x.initialize,addAsset:x.addOne,addAssets:x.addMany,setAsset:x.setOne,setAssets:x.setMany,updateAsset:x.updateOne,updateAssets:x.updateMany,deleteAsset:x.deleteOne,deleteAssets:x.deleteMany}}),{initializeAssets:_d,addAsset:Qs,addAssets:zt,updateAsset:ht,updateAssets:bf,deleteAsset:xs,deleteAssets:ei,setAsset:Ff,setAssets:Pf}=Xs.actions,ti=t=>t.assetReducer.instances,Rd=d.createSelector([ti],t=>S(Object.values(t))),si=f(d.createSelector([Rd,(t,e)=>e],(t,e)=>S(t.filter(i=>i.asset_type===e)))),ii=t=>e=>e.assetReducer.instances[t],vd=f(d.createSelector([ti,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const c=t[a];c&&i.push(c)}return S(i)})),Of=t=>e=>si(t)(e).length,wd=Xs.reducer,ee=P(t=>t.uuid),Ed=ee.getInitialState({}),ai=d.createSlice({name:"assetStageCompletions",initialState:Ed,extraReducers:t=>t.addMatcher(d.isAnyOf(I,E,O),e=>Object.assign(e,Ed)),reducers:{initializeAssetStageCompletions:ee.initialize,addAssetStageCompletion:ee.addOne,addAssetStageCompletions:ee.addMany,setAssetStageCompletion:ee.setOne,setAssetStageCompletions:ee.setMany,updateAssetStageCompletion:ee.updateOne,updateAssetStageCompletions:ee.updateMany,deleteAssetStageCompletion:ee.deleteOne,deleteAssetStageCompletions:ee.deleteMany}}),{initializeAssetStageCompletions:Md,addAssetStageCompletion:ci,addAssetStageCompletions:ni,setAssetStageCompletion:_f,setAssetStageCompletions:Rf,updateAssetStageCompletion:Vd,updateAssetStageCompletions:jd,deleteAssetStageCompletion:ri,deleteAssetStageCompletions:di}=ai.actions,qd=ai.reducer,ui=t=>t.assetStageCompletionReducer.instances,vf=d.createSelector([ui],t=>Object.values(t)),zd=t=>e=>e.assetStageCompletionReducer.instances[t],Dd=f(d.createSelector([ui,(t,e)=>e],(t,e)=>{const i=new Set(e);return S(Object.values(t).filter(a=>i.has(a.uuid)))})),te=P(t=>t.uuid),Ud=te.getInitialState({}),oi=d.createSlice({name:"assetStages",initialState:Ud,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Ud)),reducers:{initializeAssetStages:te.initialize,setAssetStage:te.setOne,setAssetStages:te.setMany,addAssetStage:te.addOne,addAssetStages:te.addMany,updateAssetStage:te.updateOne,updateAssetStages:te.updateMany,deleteAssetStage:te.deleteOne,deleteAssetStages:te.deleteMany}}),{initializeAssetStages:Cd,setAssetStage:kd,setAssetStages:wf,addAssetStage:li,addAssetStages:Ef,updateAssetStage:Dt,updateAssetStages:Mf,deleteAssetStage:hi,deleteAssetStages:Vf}=oi.actions,Bd=oi.reducer,Ut=t=>t.assetStageReducer.instances,mi=t=>e=>e.assetStageReducer.instances[t],$d=d.createSelector([Ut],t=>Object.values(t)),jf=f(d.createSelector([Ut,(t,e)=>e],(t,e)=>{const i={};for(const[a,c]of Object.entries(t))c.asset_procedure_type===e&&(i[a]=c);return vt(i)})),qf=f(d.createSelector([$d,(t,e)=>e],(t,e)=>S(t.filter(i=>i.asset_procedure_type===e)))),zf=f(d.createSelector([Ut,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const c=t[a];c?i.push(c):console.warn("selectStagesFromStageIds: No stage exists with the id",a)}return S(i)})),se=P(t=>t.uuid),Gd=se.getInitialState({}),pi=d.createSlice({name:"assetTypeAttachments",initialState:Gd,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Gd)),reducers:{initializeAssetTypeAttachments:se.initialize,addAssetTypeAttachment:se.addOne,addAssetTypeAttachments:se.addMany,setAssetTypeAttachment:se.setOne,setAssetTypeAttachments:se.setMany,updateAssetTypeAttachment:se.updateOne,updateAssetTypeAttachments:se.updateMany,deleteAssetTypeAttachment:se.deleteOne,deleteAssetTypeAttachments:se.deleteMany}}),{initializeAssetTypeAttachments:Ld,addAssetTypeAttachment:Df,addAssetTypeAttachments:yi,setAssetTypeAttachment:Nd,setAssetTypeAttachments:Uf,updateAssetTypeAttachment:Cf,updateAssetTypeAttachments:Hd,deleteAssetTypeAttachment:Wd,deleteAssetTypeAttachments:Ai}=pi.actions,Kd=t=>t.assetTypeAttachmentReducer.instances,Yd=d.createSelector([Kd],t=>Object.values(t)),Zd=t=>e=>e.assetTypeAttachmentReducer.instances[t],Jd=f(d.createSelector([Yd,(t,e)=>e],(t,e)=>S(t.filter(({asset_type:i})=>e===i)))),Xd=pi.reducer,ie=P(t=>t.uuid),Qd=ie.getInitialState({}),fi=d.createSlice({name:"assetTypeFieldsAttachments",initialState:Qd,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Qd)),reducers:{initializeAssetTypeFieldsAttachments:ie.initialize,addAssetTypeFieldsAttachment:ie.addOne,addAssetTypeFieldsAttachments:ie.addMany,setAssetTypeFieldsAttachment:ie.setOne,setAssetTypeFieldsAttachments:ie.setMany,updateAssetTypeFieldsAttachment:ie.updateOne,updateAssetTypeFieldsAttachments:ie.updateMany,deleteAssetTypeFieldsAttachment:ie.deleteOne,deleteAssetTypeFieldsAttachments:ie.deleteMany}}),{initializeAssetTypeFieldsAttachments:xd,addAssetTypeFieldsAttachment:kf,addAssetTypeFieldsAttachments:eu,setAssetTypeFieldsAttachment:Bf,setAssetTypeFieldsAttachments:$f,updateAssetTypeFieldsAttachment:Gf,updateAssetTypeFieldsAttachments:tu,deleteAssetTypeFieldsAttachment:Lf,deleteAssetTypeFieldsAttachments:su}=fi.actions,iu=t=>t.assetTypeFieldsAttachmentReducer.instances,au=d.createSelector([iu],t=>Object.values(t)),Nf=f(d.createSelector([au,(t,e)=>e],(t,e)=>S(t.filter(i=>i.fields_revision===e)))),Hf=t=>e=>e.assetTypeFieldsAttachmentReducer.instances[t],cu=fi.reducer,ae=P(t=>t.uuid),nu=ae.getInitialState({}),Si=d.createSlice({name:"assetTypeFields",initialState:nu,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,nu)),reducers:{initializeAssetTypeFields:ae.initialize,addAssetTypeFields:ae.addOne,addAssetTypeFieldsMany:ae.addMany,setAssetTypeFields:ae.setOne,setAssetTypeFieldsMany:ae.setMany,updateAssetTypeFields:ae.updateOne,updateAssetTypeFieldsMany:ae.updateMany,deleteAssetTypeFields:ae.deleteOne,deleteAssetTypeFieldsMany:ae.deleteMany}}),{initializeAssetTypeFields:ru,addAssetTypeFields:du,addAssetTypeFieldsMany:Wf,setAssetTypeFields:Kf,setAssetTypeFieldsMany:Yf,updateAssetTypeFields:uu,updateAssetTypeFieldsMany:Zf,deleteAssetTypeFields:ou,deleteAssetTypeFieldsMany:Jf}=Si.actions,lu=t=>t.assetTypeFieldsReducer.instances,Ct=d.createSelector([lu],t=>Object.values(t)),Xf=f(d.createSelector([Ct,(t,e)=>e],(t,e)=>S(t.filter(i=>i.asset_type===e)))),Qf=f(d.createSelector([Ct,(t,e)=>e],(t,e)=>t.filter(i=>i.asset_type===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),xf=t=>e=>e.assetTypeFieldsReducer.instances[t],hu=Si.reducer,ce=P(t=>t.uuid),mu=ce.getInitialState({}),Ti=d.createSlice({name:"assetTypeFieldValuesAttachments",initialState:mu,extraReducers:t=>t.addMatcher(d.isAnyOf(I,E,O),e=>Object.assign(e,mu)),reducers:{initializeAssetTypeFieldValuesAttachments:ce.initialize,addAssetTypeFieldValuesAttachment:ce.addOne,addAssetTypeFieldValuesAttachments:ce.addMany,setAssetTypeFieldValuesAttachment:ce.setOne,setAssetTypeFieldValuesAttachments:ce.setMany,updateAssetTypeFieldValuesAttachment:ce.updateOne,updateAssetTypeFieldValuesAttachments:ce.updateMany,deleteAssetTypeFieldValuesAttachment:ce.deleteOne,deleteAssetTypeFieldValuesAttachments:ce.deleteMany}}),{initializeAssetTypeFieldValuesAttachments:pu,addAssetTypeFieldValuesAttachment:eS,addAssetTypeFieldValuesAttachments:kt,setAssetTypeFieldValuesAttachment:tS,setAssetTypeFieldValuesAttachments:sS,updateAssetTypeFieldValuesAttachment:iS,updateAssetTypeFieldValuesAttachments:yu,deleteAssetTypeFieldValuesAttachment:aS,deleteAssetTypeFieldValuesAttachments:Bt}=Ti.actions,Ii=t=>t.assetTypeFieldValuesAttachmentReducer.instances,Au=d.createSelector([Ii],t=>Object.values(t)),cS=t=>e=>e.assetTypeFieldValuesAttachmentReducer.instances[t],fu=f(d.createSelector([Ii,(t,e)=>e],(t,e)=>{const i=new Set(e);return S(Object.values(t).filter(a=>i.has(a.uuid)))})),Su=f(d.createSelector([Au,(t,e)=>e],(t,e)=>S(t.filter(i=>i.field_values===e)))),Tu=Ti.reducer,ne=P(t=>t.uuid),Iu=ne.getInitialState({}),gi=d.createSlice({name:"assetTypeFieldValues",initialState:Iu,extraReducers:t=>t.addMatcher(d.isAnyOf(I,E,O),e=>Object.assign(e,Iu)),reducers:{initializeAssetTypeFieldValues:ne.initialize,addAssetTypeFieldValues:ne.addOne,addAssetTypeFieldValuesMany:ne.addMany,setAssetTypeFieldValues:ne.setOne,setAssetTypeFieldValuesMany:ne.setMany,updateAssetTypeFieldValues:ne.updateOne,updateAssetTypeFieldValuesMany:ne.updateMany,deleteAssetTypeFieldValues:ne.deleteOne,deleteAssetTypeFieldValuesMany:ne.deleteMany}}),{initializeAssetTypeFieldValues:gu,addAssetTypeFieldValues:bi,addAssetTypeFieldValuesMany:bu,setAssetTypeFieldValues:nS,setAssetTypeFieldValuesMany:rS,updateAssetTypeFieldValues:mt,updateAssetTypeFieldValuesMany:Fu,deleteAssetTypeFieldValues:Fi,deleteAssetTypeFieldValuesMany:Pu}=gi.actions,Ou=t=>t.assetTypeFieldValuesReducer.instances,Pi=d.createSelector([Ou],t=>Object.values(t)),dS=f(d.createSelector([Pi,(t,e)=>e],(t,e)=>S(t.filter(i=>i.asset===e)))),uS=f(d.createSelector([Ct,Pi,(t,e)=>e],(t,e,i)=>{const a=new Set(t.filter(c=>c.asset_type===i).map(c=>c.uuid));return S(e.filter(c=>a.has(c.fields_revision)))})),Oi=t=>e=>e.assetTypeFieldValuesReducer.instances[t],_u=gi.reducer,re=P(t=>t.uuid),Ru=re.getInitialState({}),_i=d.createSlice({name:"assetTypeIdentifiers",initialState:Ru,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Ru)),reducers:{initializeAssetTypeIdentifiers:re.initialize,addAssetTypeIdentifier:re.addOne,addAssetTypeIdentifiers:re.addMany,setAssetTypeIdentifier:re.setOne,setAssetTypeIdentifiers:re.setMany,updateAssetTypeIdentifier:re.updateOne,updateAssetTypeIdentifiers:re.updateMany,deleteAssetTypeIdentifier:re.deleteOne,deleteAssetTypeIdentifiers:re.deleteMany}}),{initializeAssetTypeIdentifiers:vu,addAssetTypeIdentifier:Ri,addAssetTypeIdentifiers:oS,setAssetTypeIdentifier:lS,setAssetTypeIdentifiers:hS,updateAssetTypeIdentifier:pt,updateAssetTypeIdentifiers:mS,deleteAssetTypeIdentifier:vi,deleteAssetTypeIdentifiers:pS}=_i.actions,wu=t=>t.assetTypeIdentifierReducer.instances,Eu=d.createSelector([wu],t=>Object.values(t)),wi=t=>e=>e.assetTypeIdentifierReducer.instances[t],yS=f(d.createSelector([Eu,(t,e)=>e],(t,e)=>S(t.filter(i=>i.asset_type===e)))),Mu=_i.reducer,de=P(t=>t.uuid),Vu=de.getInitialState({}),Ei=d.createSlice({name:"assetTypeIdentifierValues",initialState:Vu,extraReducers:t=>t.addMatcher(d.isAnyOf(I,E,O),e=>Object.assign(e,Vu)),reducers:{initializeAssetTypeIdentifierValues:de.initialize,addAssetTypeIdentifierValue:de.addOne,addAssetTypeIdentifierValues:de.addMany,setAssetTypeIdentifierValue:de.setOne,setAssetTypeIdentifierValues:de.setMany,updateAssetTypeIdentifierValue:de.updateOne,updateAssetTypeIdentifierValues:de.updateMany,deleteAssetTypeIdentifierValue:de.deleteOne,deleteAssetTypeIdentifierValues:de.deleteMany}}),{initializeAssetTypeIdentifierValues:ju,addAssetTypeIdentifierValue:Mi,addAssetTypeIdentifierValues:AS,setAssetTypeIdentifierValue:fS,setAssetTypeIdentifierValues:SS,updateAssetTypeIdentifierValue:yt,updateAssetTypeIdentifierValues:TS,deleteAssetTypeIdentifierValue:Vi,deleteAssetTypeIdentifierValues:IS}=Ei.actions,qu=t=>t.assetTypeIdentifierValueReducer.instances,ji=d.createSelector([qu],t=>Object.values(t)),qi=t=>e=>e.assetTypeIdentifierValueReducer.instances[t],gS=f(d.createSelector([ji,(t,e)=>e],(t,e)=>S(t.filter(i=>i.asset===e)))),bS=f(d.createSelector([ji,(t,e)=>e],(t,e)=>S(t.filter(i=>i.asset_type_identifier===e)))),zu=Ei.reducer,ue=P(t=>t.uuid),Du=ue.getInitialState({}),zi=d.createSlice({name:"assetTypes",initialState:Du,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Du)),reducers:{initializeAssetTypes:ue.initialize,setAssetType:ue.setOne,setAssetTypes:ue.setMany,addAssetType:ue.addOne,addAssetTypes:ue.addMany,updateAssetType:ue.updateOne,updateAssetTypes:ue.updateMany,deleteAssetType:ue.deleteOne,deleteAssetTypes:ue.deleteMany}}),{initializeAssetTypes:Uu,setAssetType:FS,setAssetTypes:PS,addAssetType:Di,addAssetTypes:OS,updateAssetType:At,updateAssetTypes:_S,deleteAssetType:Ui,deleteAssetTypes:RS}=zi.actions,Ci=t=>t.assetTypeReducer.instances,Cu=d.createSelector([Ci],t=>Object.values(t)),ki=t=>e=>e.assetTypeReducer.instances[t],vS=f(d.createSelector([Ci,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const c=t[a];c?i.push(c):console.warn("selectAssetTypesByIds: No assetType exists with the id",a)}return S(i)})),wS=f(d.createSelector([Cu,(t,e)=>e],(t,e)=>S(t.filter(i=>i.organization===e)))),ku=zi.reducer,oe=P(t=>t.uuid),Bu=oe.getInitialState({}),Bi=d.createSlice({name:"assetTypeStatuses",initialState:Bu,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Bu)),reducers:{initializeAssetTypeStatuses:oe.initialize,addAssetTypeStatus:oe.addOne,addAssetTypeStatuses:oe.addMany,setAssetTypeStatus:oe.setOne,setAssetTypeStatuses:oe.setMany,updateAssetTypeStatus:oe.updateOne,updateAssetTypeStatuses:oe.updateMany,deleteAssetTypeStatus:oe.deleteOne,deleteAssetTypeStatuses:oe.deleteMany}}),{initializeAssetTypeStatuses:$u,addAssetTypeStatus:$i,addAssetTypeStatuses:ES,setAssetTypeStatus:$t,setAssetTypeStatuses:MS,updateAssetTypeStatus:Gu,updateAssetTypeStatuses:VS,deleteAssetTypeStatus:Gi,deleteAssetTypeStatuses:jS}=Bi.actions,Li=t=>t.assetTypeStatusReducer.instances,Lu=d.createSelector([Li],t=>Object.values(t)),Ni=t=>e=>e.assetTypeStatusReducer.instances[t],qS=f(d.createSelector([Li,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const c=t[a];c?i.push(c):console.warn("selectAssetTypeStatusesByIds: No asset type status exists with the id",a)}return S(i)})),zS=f(d.createSelector([Lu,(t,e)=>e],(t,e)=>S(t.filter(i=>i.asset_type===e)))),Nu=Bi.reducer,Hu={accessToken:"",refreshToken:"",isLoggedIn:!1},Gt=d.createSlice({name:"auth",initialState:Hu,extraReducers:t=>t.addCase(I,e=>Object.assign(e,Hu)),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||Gt.caseReducers.clearTokens(t),t.isLoggedIn=e.payload}}}),{setTokens:DS,clearTokens:US,setLoggedIn:Wu}=Gt.actions,CS=t=>t.authReducer.accessToken,kS=t=>t.authReducer.isLoggedIn,Ku=Gt.reducer,le=P(t=>t.uuid),Yu=le.getInitialState({}),Hi=d.createSlice({name:"categories",initialState:Yu,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Yu)),reducers:{initializeCategories:le.initialize,addCategory:le.addOne,addCategories:le.addMany,setCategory:le.setOne,setCategories:le.setMany,updateCategory:le.updateOne,updateCategories:le.updateMany,deleteCategory:le.deleteOne,deleteCategories:le.deleteMany}}),{initializeCategories:Zu,addCategory:Wi,addCategories:BS,setCategory:$S,setCategories:GS,updateCategory:Ju,updateCategories:LS,deleteCategory:Xu,deleteCategories:NS}=Hi.actions,Ki=t=>t.categoryReducer.instances,Qu=d.createSelector([Ki],t=>Object.values(t)),Yi=t=>e=>e.categoryReducer.instances[t],HS=f(d.createSelector([Ki,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const c=t[a];c?i.push(c):console.warn("selectCategoryByIds: No category exists with the id",a)}return S(i)})),WS=f(d.createSelector([Qu,(t,e)=>e],(t,e)=>S(t.filter(i=>i.project===e)))),xu=Hi.reducer,he=P(t=>t.uuid),eo=he.getInitialState({}),Zi=d.createSlice({name:"documentAttachments",initialState:eo,extraReducers:t=>t.addCase(I,e=>Object.assign(e,eo)),reducers:{initializeDocumentAttachments:he.initialize,addDocumentAttachment:he.addOne,addDocumentAttachments:he.addMany,setDocumentAttachment:he.setOne,setDocumentAttachments:he.setMany,updateDocumentAttachment:he.updateOne,updateDocumentAttachments:he.updateMany,deleteDocumentAttachment:he.deleteOne,deleteDocumentAttachments:he.deleteMany}}),{initializeDocumentAttachments:to,addDocumentAttachment:KS,addDocumentAttachments:so,setDocumentAttachment:io,setDocumentAttachments:YS,updateDocumentAttachment:ZS,updateDocumentAttachments:ao,deleteDocumentAttachment:co,deleteDocumentAttachments:no}=Zi.actions,ro=t=>t.documentAttachmentReducer.instances,uo=d.createSelector([ro],t=>Object.values(t)),oo=t=>e=>e.documentAttachmentReducer.instances[t],JS=f(d.createSelector([uo,(t,e)=>e],(t,e)=>S(t.filter(({document:i})=>e===i)))),lo=Zi.reducer,ho={documents:{}},Ji=d.createSlice({name:"documents",initialState:ho,extraReducers:t=>t.addCase(I,e=>{Object.assign(e,ho)}),reducers:{setDocuments:(t,e)=>{if(e.payload.filter(En).length!==e.payload.length)throw new Error("Tried to use setIssues reducer with duplicate ID's");t.documents=vn(e.payload)},addDocuments:(t,e)=>{for(const i of e.payload)if(i.uuid in t.documents)throw new Error(`attempting to add a document with uuid ${i.uuid} which already exists in state.documents.`);for(const i of e.payload){if(i.parent_document&&t.documents[i.parent_document]){const a=t.documents[i.parent_document];t.documents[i.parent_document]={...a,children_documents:[...a.children_documents,i.uuid]}}t.documents[i.uuid]=i}},updateDocuments:(t,e)=>{for(const i of e.payload)if(!(i.uuid in t.documents))throw new Error(`attempting to update a document with uuid ${i.uuid} which doesn't exists in state.documents.`);for(const i of e.payload){const a=t.documents[i.uuid];if(i.organization!==void 0&&i.organization!==a.organization)throw new Error("organization cannot be updated");if(i.project!==void 0&&i.project!==a.project)throw new Error("project cannot be updated");t.documents[i.uuid]={...a,...i}}},removeDocuments:(t,e)=>{for(const i of e.payload)if(!(i in t.documents))throw new Error(`attempting to delete a document with uuid ${i} which doesn't exists in state.documents.`);for(const i of e.payload){const a=t.documents[i];if(a.parent_document&&t.documents[a.parent_document]){const c=t.documents[a.parent_document];t.documents[a.parent_document]={...c,children_documents:c.children_documents.filter(n=>n!==a.uuid)}}delete t.documents[i]}}}}),{setDocuments:mo,addDocuments:po,updateDocuments:tt,removeDocuments:Xi}=Ji.actions,Lt=t=>t.documentsReducer.documents,Qi=d.createSelector([Lt],t=>Object.values(t)),yo=t=>e=>e.documentsReducer.documents[t],XS=f(d.createSelector([Lt,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const c=t[a];c?i.push(c):console.warn("selectDocumentByIds: No document exists with the id",a)}return S(i)})),QS=f(d.createSelector([Qi,(t,e)=>e],(t,e)=>t.filter(i=>i.project===e))),xS=f(d.createSelector([Qi,(t,e)=>e],(t,e)=>t.filter(i=>i.organization===e))),Ao=Ji.reducer,me=P(t=>t.uuid),fo=me.getInitialState({}),xi=d.createSlice({name:"emailDomains",initialState:fo,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,fo)),reducers:{initializeEmailDomains:me.initialize,addEmailDomain:me.addOne,addEmailDomains:me.addMany,setEmailDomain:me.setOne,setEmailDomains:me.setMany,updateEmailDomain:me.updateOne,updateEmailDomains:me.updateMany,deleteEmailDomain:me.deleteOne,deleteEmailDomains:me.deleteMany}}),{initializeEmailDomains:So,addEmailDomain:To,addEmailDomains:eT,setEmailDomain:tT,setEmailDomains:sT,updateEmailDomain:iT,updateEmailDomains:aT,deleteEmailDomain:Io,deleteEmailDomains:cT}=xi.actions,go=t=>t.emailDomainsReducer.instances,bo=d.createSelector([go],t=>Object.values(t)),nT=f(d.createSelector([bo,(t,e)=>e],(t,e)=>S(t.filter(i=>i.organization===e)))),Fo=xi.reducer,Po={s3Urls:{}},Oo=1e3*60*60,rT=Oo*24*7,ea=d.createSlice({name:"file",initialState:Po,extraReducers:t=>t.addCase(I,e=>Object.assign(e,Po)),reducers:{setUploadUrl:(t,e)=>{const{url:i,fields:a,sha1:c}=e.payload,n=new Date,r=new Date(n.getTime()+rT);t.s3Urls[c]={url:i,fields:a,exp:r.getTime()}}}}),{setUploadUrl:_o}=ea.actions,Ro=t=>e=>{const i=e.fileReducer.s3Urls[t];if(!i)return;const a=new Date().getTime();if(!((i.exp??a)-a<Oo))return i},vo=ea.reducer,pe=P(t=>t.uuid),wo=pe.getInitialState({}),ta=d.createSlice({name:"formIdentifiers",initialState:wo,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,wo)),reducers:{initializeFormIdentifiers:pe.initialize,addFormIdentifier:pe.addOne,addFormIdentifiers:pe.addMany,setFormIdentifier:pe.setOne,setFormIdentifiers:pe.setMany,updateFormIdentifier:pe.updateOne,updateFormIdentifiers:pe.updateMany,deleteFormIdentifier:pe.deleteOne,deleteFormIdentifiers:pe.deleteMany}}),{initializeFormIdentifiers:Eo,addFormIdentifier:sa,addFormIdentifiers:dT,setFormIdentifier:uT,setFormIdentifiers:oT,updateFormIdentifier:ft,updateFormIdentifiers:lT,deleteFormIdentifier:ia,deleteFormIdentifiers:hT}=ta.actions,Mo=t=>t.formIdentifierReducer.instances,Vo=d.createSelector([Mo],t=>Object.values(t)),aa=t=>e=>e.formIdentifierReducer.instances[t],mT=f(d.createSelector([Vo,(t,e)=>e],(t,e)=>S(t.filter(i=>i.form===e)))),jo=ta.reducer,ye=P(t=>t.uuid),qo=ye.getInitialState({}),ca=d.createSlice({name:"formIdentifierValues",initialState:qo,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,qo)),reducers:{initializeFormIdentifierValues:ye.initialize,addFormIdentifierValue:ye.addOne,addFormIdentifierValues:ye.addMany,setFormIdentifierValue:ye.setOne,setFormIdentifierValues:ye.setMany,updateFormIdentifierValue:ye.updateOne,updateFormIdentifierValues:ye.updateMany,deleteFormIdentifierValue:ye.deleteOne,deleteFormIdentifierValues:ye.deleteMany}}),{initializeFormIdentifierValues:zo,addFormIdentifierValue:na,addFormIdentifierValues:pT,setFormIdentifierValue:yT,setFormIdentifierValues:AT,updateFormIdentifierValue:St,updateFormIdentifierValues:fT,deleteFormIdentifierValue:ra,deleteFormIdentifierValues:ST}=ca.actions,Do=t=>t.formIdentifierValueReducer.instances,da=d.createSelector([Do],t=>Object.values(t)),ua=t=>e=>e.formIdentifierValueReducer.instances[t],TT=f(d.createSelector([da,(t,e)=>e],(t,e)=>S(t.filter(i=>i.form_submission===e)))),IT=f(d.createSelector([da,(t,e)=>e],(t,e)=>S(t.filter(i=>i.form_identifier===e)))),Uo=ca.reducer,Ae=P(t=>t.uuid),Co=Ae.getInitialState({}),oa=d.createSlice({name:"formRevisionAttachments",initialState:Co,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Co)),reducers:{initializeFormRevisionAttachments:Ae.initialize,addFormRevisionAttachment:Ae.addOne,addFormRevisionAttachments:Ae.addMany,setFormRevisionAttachment:Ae.setOne,setFormRevisionAttachments:Ae.setMany,updateFormRevisionAttachment:Ae.updateOne,updateFormRevisionAttachments:Ae.updateMany,deleteFormRevisionAttachment:Ae.deleteOne,deleteFormRevisionAttachments:Ae.deleteMany}}),{initializeFormRevisionAttachments:ko,addFormRevisionAttachment:gT,addFormRevisionAttachments:Bo,setFormRevisionAttachment:bT,setFormRevisionAttachments:FT,updateFormRevisionAttachment:PT,updateFormRevisionAttachments:$o,deleteFormRevisionAttachment:OT,deleteFormRevisionAttachments:Go}=oa.actions,Lo=t=>t.formRevisionAttachmentReducer.instances,_T=f(d.createSelector([Lo,(t,e)=>e],(t,e)=>S(Object.values(t).filter(i=>i.form_revision===e)))),No=oa.reducer,fe=P(t=>t.uuid),Ho=fe.getInitialState({}),la=d.createSlice({name:"formRevisions",initialState:Ho,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Ho)),reducers:{initializeFormRevisions:fe.initialize,addFormRevision:fe.addOne,addFormRevisions:fe.addMany,setFormRevision:fe.setOne,setFormRevisions:fe.setMany,updateFormRevision:fe.updateOne,updateFormRevisions:fe.updateMany,deleteFormRevision:fe.deleteOne,deleteFormRevisions:fe.deleteMany}}),{initializeFormRevisions:Wo,addFormRevision:ha,addFormRevisions:Ko,setFormRevision:Yo,setFormRevisions:RT,updateFormRevision:vT,updateFormRevisions:wT,deleteFormRevision:ma,deleteFormRevisions:Zo}=la.actions,pa=t=>t.formRevisionReducer.instances,ya=d.createSelector([pa],t=>Object.values(t)),ET=t=>e=>e.formRevisionReducer.instances[t],MT=f(d.createSelector([ya,(t,e)=>e],(t,e)=>t.filter(i=>i.form===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),Jo=f(d.createSelector([ya,(t,e)=>e],(t,e)=>S(t.filter(i=>i.form===e)))),Xo=la.reducer,Se=P(t=>t.uuid),Qo=Se.getInitialState({}),Aa=d.createSlice({name:"forms",initialState:Qo,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Qo)),reducers:{initializeForms:Se.initialize,addForm:Se.addOne,addForms:Se.addMany,setForm:Se.setOne,setForms:Se.setMany,updateForm:Se.updateOne,updateForms:Se.updateMany,deleteForm:Se.deleteOne,deleteForms:Se.deleteMany}}),{initializeForms:xo,addForm:fa,addForms:VT,setForm:jT,setForms:qT,updateForm:zT,updateForms:DT,deleteForm:Sa,deleteForms:UT}=Aa.actions,el=Aa.reducer,tl=t=>t.formReducer.instances,sl=d.createSelector([tl],t=>Object.values(t)),il=t=>e=>e.formReducer.instances[t],CT=f(d.createSelector([sl,(t,e)=>e],(t,e)=>S(t.filter(i=>i.organization===e)))),Te=P(t=>t.uuid),al=Te.getInitialState({}),Ta=d.createSlice({name:"formSubmissionAttachments",initialState:al,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,al)),reducers:{initializeFormSubmissionAttachments:Te.initialize,addFormSubmissionAttachment:Te.addOne,addFormSubmissionAttachments:Te.addMany,setFormSubmissionAttachment:Te.setOne,setFormSubmissionAttachments:Te.setMany,updateFormSubmissionAttachment:Te.updateOne,updateFormSubmissionAttachments:Te.updateMany,deleteFormSubmissionAttachment:Te.deleteOne,deleteFormSubmissionAttachments:Te.deleteMany}}),{initializeFormSubmissionAttachments:cl,addFormSubmissionAttachment:kT,addFormSubmissionAttachments:Nt,setFormSubmissionAttachment:BT,setFormSubmissionAttachments:$T,updateFormSubmissionAttachment:GT,updateFormSubmissionAttachments:nl,deleteFormSubmissionAttachment:LT,deleteFormSubmissionAttachments:Ht}=Ta.actions,rl=t=>t.formSubmissionAttachmentReducer.instances,Ia=d.createSelector([rl],t=>Object.values(t)),dl=f(d.createSelector([Ia,(t,e)=>e],(t,e)=>{const i=new Set(e);return S(t.filter(a=>i.has(a.uuid)))})),ul=f(d.createSelector([Ia,(t,e)=>e],(t,e)=>S(t.filter(i=>i.form_submission===e)))),ol=Ta.reducer,Ie=P(t=>t.uuid),ll=Ie.getInitialState({}),ga=d.createSlice({name:"formSubmissions",initialState:ll,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,ll)),reducers:{initializeFormSubmissions:Ie.initialize,setFormSubmission:Ie.setOne,setFormSubmissions:Ie.setMany,addFormSubmission:Ie.addOne,addFormSubmissions:Ie.addMany,updateFormSubmission:Ie.updateOne,updateFormSubmissions:Ie.updateMany,deleteFormSubmission:Ie.deleteOne,deleteFormSubmissions:Ie.deleteMany}}),{initializeFormSubmissions:hl,setFormSubmission:Wt,setFormSubmissions:NT,addFormSubmission:ba,addFormSubmissions:ml,updateFormSubmission:pl,updateFormSubmissions:HT,deleteFormSubmission:Fa,deleteFormSubmissions:yl}=ga.actions,Pa=t=>t.formSubmissionReducer.instances,WT=d.createSelector([Pa],t=>Object.values(t)),Oa=t=>e=>e.formSubmissionReducer.instances[t],Al=f(d.createSelector([Pa,pa,(t,e)=>e],(t,e,i)=>{const a=new Set;for(const c of Object.values(e))c.form===i&&a.add(c.uuid);return Object.values(t).filter(c=>a.has(c.form_revision))})),fl=ga.reducer,ge=P(t=>t.uuid),Sl=ge.getInitialState({}),_a=d.createSlice({name:"geoImages",initialState:Sl,extraReducers:t=>t.addMatcher(d.isAnyOf(I,E,O),e=>Object.assign(e,Sl)),reducers:{initializeGeoImages:ge.initialize,setGeoImage:ge.setOne,setGeoImages:ge.setMany,addGeoImage:ge.addOne,addGeoImages:ge.addMany,updateGeoImage:ge.updateOne,updateGeoImages:ge.updateMany,deleteGeoImage:ge.deleteOne,deleteGeoImages:ge.deleteMany}}),{initializeGeoImages:Tl,setGeoImage:Tt,setGeoImages:Il,addGeoImage:gl,addGeoImages:bl,updateGeoImage:Fl,updateGeoImages:KT,deleteGeoImage:Ra,deleteGeoImages:Pl}=_a.actions,Ol=t=>t.geoImageReducer.instances,_l=d.createSelector([Ol],t=>Object.values(t)),va=t=>e=>e.geoImageReducer.instances[t],YT=f(d.createSelector([_l,(t,e)=>e],(t,e)=>S(t.filter(i=>i.project===e)))),Rl=_a.reducer,be=P(t=>t.uuid),vl=be.getInitialState({}),wa=d.createSlice({name:"issueAssociations",initialState:vl,extraReducers:t=>t.addMatcher(d.isAnyOf(I,E,O),e=>Object.assign(e,vl)),reducers:{initializeIssueAssociations:be.initialize,addIssueAssociation:be.addOne,addIssueAssociations:be.addMany,setIssueAssociation:be.setOne,setIssueAssociations:be.setMany,updateIssueAssociation:be.updateOne,updateIssueAssociations:be.updateMany,deleteIssueAssociation:be.deleteOne,deleteIssueAssociations:be.deleteMany}}),{initializeIssueAssociations:wl,setIssueAssociations:ZT,setIssueAssociation:JT,updateIssueAssociation:El,updateIssueAssociations:XT,addIssueAssociation:Ea,addIssueAssociations:Ma,deleteIssueAssociation:Va,deleteIssueAssociations:ja}=wa.actions,It=t=>t.issueAssociationReducer.instances,QT=d.createSelector([It],t=>Object.values(t)),Ml=t=>e=>e.issueAssociationReducer.instances[t],Vl=f(d.createSelector([It,(t,e)=>e],(t,e)=>S(Object.values(t).filter(i=>i.associated_issue===e)))),jl=f(d.createSelector([It,(t,e)=>e],(t,e)=>S(Object.values(t).filter(i=>i.issue===e)))),ql=f(d.createSelector([It,(t,e)=>e],(t,e)=>S(Object.values(t).filter(i=>i.asset===e)))),zl=wa.reducer,Fe=P(t=>t.uuid),Dl=Fe.getInitialState({}),qa=d.createSlice({name:"issueAttachments",initialState:Dl,extraReducers:t=>t.addMatcher(d.isAnyOf(I,E,O),e=>Object.assign(e,Dl)),reducers:{initializeIssueAttachments:Fe.initialize,addIssueAttachment:Fe.addOne,addIssueAttachments:Fe.addMany,setIssueAttachment:Fe.setOne,setIssueAttachments:Fe.setMany,updateIssueAttachment:Fe.updateOne,updateIssueAttachments:Fe.updateMany,deleteIssueAttachment:Fe.deleteOne,deleteIssueAttachments:Fe.deleteMany}}),{initializeIssueAttachments:za,addIssueAttachment:xT,addIssueAttachments:Da,setIssueAttachment:Ul,setIssueAttachments:eI,updateIssueAttachment:tI,updateIssueAttachments:Cl,deleteIssueAttachment:kl,deleteIssueAttachments:Ua}=qa.actions,Bl=t=>t.issueAttachmentReducer.instances,$l=d.createSelector([Bl],t=>Object.values(t)),Gl=f(d.createSelector([$l,(t,e)=>e],(t,e)=>S(t.filter(({issue:i})=>e===i)))),Ll=t=>e=>e.issueAttachmentReducer.instances[t],Nl=qa.reducer,Pe=P(t=>t.uuid),Hl=Pe.getInitialState({}),Ca=d.createSlice({name:"issueCommentAttachments",initialState:Hl,extraReducers:t=>t.addMatcher(d.isAnyOf(I,E,O),e=>Object.assign(e,Hl)),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:ka,addIssueCommentAttachment:sI,addIssueCommentAttachments:Wl,setIssueCommentAttachment:Kl,setIssueCommentAttachments:iI,updateIssueCommentAttachment:aI,updateIssueCommentAttachments:Yl,deleteIssueCommentAttachment:Zl,deleteIssueCommentAttachments:Jl}=Ca.actions,Xl=t=>t.issueCommentAttachmentReducer.instances,Ql=d.createSelector([Xl],t=>Object.values(t)),xl=t=>e=>e.issueCommentAttachmentReducer.instances[t],cI=f(d.createSelector([Ql,(t,e)=>e],(t,e)=>S(t.filter(({issue_comment:i})=>e===i)))),eh=Ca.reducer,Oe=P(t=>t.uuid),th=Oe.getInitialState({}),Ba=d.createSlice({name:"issueComments",initialState:th,extraReducers:t=>t.addMatcher(d.isAnyOf(I,E,O),e=>Object.assign(e,th)),reducers:{initializeIssueComments:Oe.initialize,addIssueComment:Oe.addOne,addIssueComments:Oe.addMany,setIssueComment:Oe.setOne,setIssueComments:Oe.setMany,updateIssueComment:Oe.updateOne,updateIssueComments:Oe.updateMany,deleteIssueComment:Oe.deleteOne,deleteIssueComments:Oe.deleteMany}}),{initializeIssueComments:nI,addIssueComment:$a,addIssueComments:rI,setIssueComment:Ga,setIssueComments:sh,updateIssueComment:dI,updateIssueComments:uI,deleteIssueComment:La,deleteIssueComments:oI}=Ba.actions,ih=t=>t.issueCommentReducer.instances,Na=t=>e=>e.issueCommentReducer.instances[t],lI=f(d.createSelector([ih,(t,e)=>e],(t,e)=>S(Object.values(t).filter(i=>i.issue===e)))),ah=Ba.reducer,_e=P(t=>t.uuid),ch=_e.getInitialState({}),Ha=d.createSlice({name:"issues",initialState:ch,extraReducers:t=>t.addMatcher(d.isAnyOf(I,E,O),e=>Object.assign(e,ch)),reducers:{initializeIssues:_e.initialize,addIssue:_e.addOne,addIssues:_e.addMany,setIssue:_e.setOne,setIssues:_e.setMany,updateIssue:_e.updateOne,updateIssues:_e.updateMany,deleteIssue:_e.deleteOne,deleteIssues:_e.deleteMany}}),{initializeIssues:nh,addIssue:Wa,addIssues:rh,setIssue:hI,setIssues:mI,updateIssue:Kt,updateIssues:pI,deleteIssue:Ka,deleteIssues:dh}=Ha.actions,Ya=t=>t.issueReducer.instances,Za=d.createSelector([Ya],t=>Object.values(t)),Ja=t=>e=>e.issueReducer.instances[t],yI=f(d.createSelector([Ya,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const c=t[a];c?i.push(c):console.warn("selectIssuesByIds: No issue exists with the id",a)}return S(i)})),AI=f(d.createSelector([Za,(t,e)=>e],(t,e)=>t.filter(i=>i.project===e))),uh=f(d.createSelector([Za,(t,e)=>e],(t,e)=>t.filter(i=>i.issue_type===e))),oh=Ha.reducer,Re=P(t=>t.uuid),lh=Re.getInitialState({}),Xa=d.createSlice({name:"issueTypeAttachments",initialState:lh,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,lh)),reducers:{initializeIssueTypeAttachments:Re.initialize,addIssueTypeAttachment:Re.addOne,addIssueTypeAttachments:Re.addMany,setIssueTypeAttachment:Re.setOne,setIssueTypeAttachments:Re.setMany,updateIssueTypeAttachment:Re.updateOne,updateIssueTypeAttachments:Re.updateMany,deleteIssueTypeAttachment:Re.deleteOne,deleteIssueTypeAttachments:Re.deleteMany}}),{initializeIssueTypeAttachments:Qa,addIssueTypeAttachment:fI,addIssueTypeAttachments:hh,setIssueTypeAttachment:mh,setIssueTypeAttachments:SI,updateIssueTypeAttachment:TI,updateIssueTypeAttachments:ph,deleteIssueTypeAttachment:yh,deleteIssueTypeAttachments:Ah}=Xa.actions,fh=t=>t.issueTypeAttachmentReducer.instances,Sh=d.createSelector([fh],t=>Object.values(t)),Th=t=>e=>e.issueTypeAttachmentReducer.instances[t],II=f(d.createSelector([Sh,(t,e)=>e],(t,e)=>S(t.filter(({issue_type:i})=>e===i)))),Ih=Xa.reducer,ve=P(t=>t.uuid),gh=ve.getInitialState({}),xa=d.createSlice({name:"issueTypeFieldsAttachments",initialState:gh,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,gh)),reducers:{initializeIssueTypeFieldsAttachments:ve.initialize,addIssueTypeFieldsAttachment:ve.addOne,addIssueTypeFieldsAttachments:ve.addMany,setIssueTypeFieldsAttachment:ve.setOne,setIssueTypeFieldsAttachments:ve.setMany,updateIssueTypeFieldsAttachment:ve.updateOne,updateIssueTypeFieldsAttachments:ve.updateMany,deleteIssueTypeFieldsAttachment:ve.deleteOne,deleteIssueTypeFieldsAttachments:ve.deleteMany}}),{initializeIssueTypeFieldsAttachments:bh,addIssueTypeFieldsAttachment:gI,addIssueTypeFieldsAttachments:Fh,setIssueTypeFieldsAttachment:bI,setIssueTypeFieldsAttachments:FI,updateIssueTypeFieldsAttachment:PI,updateIssueTypeFieldsAttachments:Ph,deleteIssueTypeFieldsAttachment:OI,deleteIssueTypeFieldsAttachments:Oh}=xa.actions,_h=t=>t.issueTypeFieldsAttachmentReducer.instances,Rh=d.createSelector([_h],t=>Object.values(t)),_I=f(d.createSelector([Rh,(t,e)=>e],(t,e)=>S(t.filter(i=>i.fields_revision===e)))),RI=t=>e=>e.issueTypeFieldsAttachmentReducer.instances[t],vh=xa.reducer,we=P(t=>t.uuid),wh=we.getInitialState({}),ec=d.createSlice({name:"issueTypeFieldValues",initialState:wh,extraReducers:t=>t.addMatcher(d.isAnyOf(I,E,O),e=>Object.assign(e,wh)),reducers:{initializeIssueTypeFieldValues:we.initialize,addIssueTypeFieldValues:we.addOne,addIssueTypeFieldValuesMany:we.addMany,setIssueTypeFieldValues:we.setOne,setIssueTypeFieldValuesMany:we.setMany,updateIssueTypeFieldValues:we.updateOne,updateIssueTypeFieldValuesMany:we.updateMany,deleteIssueTypeFieldValues:we.deleteOne,deleteIssueTypeFieldValuesMany:we.deleteMany}}),{initializeIssueTypeFieldValues:Eh,addIssueTypeFieldValues:tc,addIssueTypeFieldValuesMany:vI,setIssueTypeFieldValues:wI,setIssueTypeFieldValuesMany:EI,updateIssueTypeFieldValues:gt,updateIssueTypeFieldValuesMany:MI,deleteIssueTypeFieldValues:sc,deleteIssueTypeFieldValuesMany:VI}=ec.actions,Mh=t=>t.issueTypeFieldValuesReducer.instances,ic=d.createSelector([Mh],t=>Object.values(t)),jI=f(d.createSelector([ic,(t,e)=>e],(t,e)=>S(t.filter(i=>i.issue===e)))),ac=t=>e=>e.issueTypeFieldValuesReducer.instances[t],Vh=ec.reducer,Ee=P(t=>t.uuid),jh=Ee.getInitialState({}),cc=d.createSlice({name:"issueTypeFields",initialState:jh,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,jh)),reducers:{initializeIssueTypeFields:Ee.initialize,addIssueTypeFields:Ee.addOne,addIssueTypeFieldsMany:Ee.addMany,setIssueTypeFields:Ee.setOne,setIssueTypeFieldsMany:Ee.setMany,updateIssueTypeFields:Ee.updateOne,updateIssueTypeFieldsMany:Ee.updateMany,deleteIssueTypeFields:Ee.deleteOne,deleteIssueTypeFieldsMany:Ee.deleteMany}}),{initializeIssueTypeFields:qh,addIssueTypeFields:zh,addIssueTypeFieldsMany:qI,setIssueTypeFields:zI,setIssueTypeFieldsMany:DI,updateIssueTypeFields:Dh,updateIssueTypeFieldsMany:UI,deleteIssueTypeFields:Uh,deleteIssueTypeFieldsMany:CI}=cc.actions,Ch=t=>t.issueTypeFieldsReducer.instances,Yt=d.createSelector([Ch],t=>Object.values(t)),kI=f(d.createSelector([Yt,(t,e)=>e],(t,e)=>S(t.filter(i=>i.issue_type===e)))),BI=f(d.createSelector([Yt,(t,e)=>e],(t,e)=>t.filter(i=>i.issue_type===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),$I=f(d.createSelector([Yt,ic,(t,e)=>e],(t,e,i)=>{const a=new Set(t.filter(c=>c.issue_type===i).map(c=>c.uuid));return S(e.filter(c=>a.has(c.fields_revision)))})),GI=t=>e=>e.issueTypeFieldsReducer.instances[t],kh=cc.reducer,Me=P(t=>t.uuid),Bh=Me.getInitialState({}),nc=d.createSlice({name:"issueTypeFieldValuesAttachments",initialState:Bh,extraReducers:t=>t.addMatcher(d.isAnyOf(I,E,O),e=>Object.assign(e,Bh)),reducers:{initializeIssueTypeFieldValuesAttachments:Me.initialize,addIssueTypeFieldValuesAttachment:Me.addOne,addIssueTypeFieldValuesAttachments:Me.addMany,setIssueTypeFieldValuesAttachment:Me.setOne,setIssueTypeFieldValuesAttachments:Me.setMany,updateIssueTypeFieldValuesAttachment:Me.updateOne,updateIssueTypeFieldValuesAttachments:Me.updateMany,deleteIssueTypeFieldValuesAttachment:Me.deleteOne,deleteIssueTypeFieldValuesAttachments:Me.deleteMany}}),{initializeIssueTypeFieldValuesAttachments:$h,addIssueTypeFieldValuesAttachment:LI,addIssueTypeFieldValuesAttachments:Zt,setIssueTypeFieldValuesAttachment:NI,setIssueTypeFieldValuesAttachments:HI,updateIssueTypeFieldValuesAttachment:WI,updateIssueTypeFieldValuesAttachments:Gh,deleteIssueTypeFieldValuesAttachment:KI,deleteIssueTypeFieldValuesAttachments:Jt}=nc.actions,Lh=t=>t.issueTypeFieldValuesAttachmentReducer.instances,rc=d.createSelector([Lh],t=>Object.values(t)),YI=t=>e=>e.issueTypeFieldValuesAttachmentReducer.instances[t],Nh=f(d.createSelector([rc,(t,e)=>e],(t,e)=>{const i=new Set(e);return S(t.filter(a=>i.has(a.uuid)))})),Hh=f(d.createSelector([rc,(t,e)=>e],(t,e)=>S(t.filter(i=>i.field_values===e)))),Wh=nc.reducer,Ve=P(t=>t.uuid),Kh=Ve.getInitialState({}),dc=d.createSlice({name:"issueTypeIdentifiers",initialState:Kh,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Kh)),reducers:{initializeIssueTypeIdentifiers:Ve.initialize,addIssueTypeIdentifier:Ve.addOne,addIssueTypeIdentifiers:Ve.addMany,setIssueTypeIdentifier:Ve.setOne,setIssueTypeIdentifiers:Ve.setMany,updateIssueTypeIdentifier:Ve.updateOne,updateIssueTypeIdentifiers:Ve.updateMany,deleteIssueTypeIdentifier:Ve.deleteOne,deleteIssueTypeIdentifiers:Ve.deleteMany}}),{initializeIssueTypeIdentifiers:Yh,addIssueTypeIdentifier:uc,addIssueTypeIdentifiers:ZI,setIssueTypeIdentifier:JI,setIssueTypeIdentifiers:XI,updateIssueTypeIdentifier:bt,updateIssueTypeIdentifiers:QI,deleteIssueTypeIdentifier:oc,deleteIssueTypeIdentifiers:xI}=dc.actions,Zh=t=>t.issueTypeIdentifierReducer.instances,Jh=d.createSelector([Zh],t=>Object.values(t)),lc=t=>e=>e.issueTypeIdentifierReducer.instances[t],eg=f(d.createSelector([Jh,(t,e)=>e],(t,e)=>S(t.filter(i=>i.issue_type===e)))),Xh=dc.reducer,je=P(t=>t.uuid),Qh=je.getInitialState({}),hc=d.createSlice({name:"issueTypeIdentifierValues",initialState:Qh,extraReducers:t=>t.addMatcher(d.isAnyOf(I,E,O),e=>Object.assign(e,Qh)),reducers:{initializeIssueTypeIdentifierValues:je.initialize,addIssueTypeIdentifierValue:je.addOne,addIssueTypeIdentifierValues:je.addMany,setIssueTypeIdentifierValue:je.setOne,setIssueTypeIdentifierValues:je.setMany,updateIssueTypeIdentifierValue:je.updateOne,updateIssueTypeIdentifierValues:je.updateMany,deleteIssueTypeIdentifierValue:je.deleteOne,deleteIssueTypeIdentifierValues:je.deleteMany}}),{initializeIssueTypeIdentifierValues:xh,addIssueTypeIdentifierValue:mc,addIssueTypeIdentifierValues:tg,setIssueTypeIdentifierValue:sg,setIssueTypeIdentifierValues:ig,updateIssueTypeIdentifierValue:Ft,updateIssueTypeIdentifierValues:ag,deleteIssueTypeIdentifierValue:pc,deleteIssueTypeIdentifierValues:cg}=hc.actions,em=t=>t.issueTypeIdentifierValueReducer.instances,yc=d.createSelector([em],t=>Object.values(t)),Ac=t=>e=>e.issueTypeIdentifierValueReducer.instances[t],ng=f(d.createSelector([yc,(t,e)=>e],(t,e)=>S(t.filter(i=>i.issue===e)))),rg=f(d.createSelector([yc,(t,e)=>e],(t,e)=>S(t.filter(i=>i.issue_type_identifier===e)))),tm=hc.reducer,C=P(t=>t.uuid),sm=C.getInitialState({}),fc=d.createSlice({name:"issueTypes",initialState:sm,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,sm)),reducers:{initializeIssueTypes:C.initialize,addIssueType:C.addOne,addIssueTypes:C.addMany,setIssueType:C.setOne,setIssueTypes:C.setMany,updateIssueType:C.updateOne,updateIssueTypes:C.updateMany,deleteIssueType:C.deleteOne,deleteIssueTypes:C.deleteMany,removeIssueType:C.deleteOne}}),{initializeIssueTypes:im,addIssueType:am,addIssueTypes:dg,setIssueType:Pt,setIssueTypes:ug,updateIssueType:cm,updateIssueTypes:og,deleteIssueType:lg,deleteIssueTypes:hg,removeIssueType:Sc}=fc.actions,Tc=t=>t.issueTypeReducer.instances,nm=d.createSelector(Tc,t=>Object.values(t)),Ic=t=>e=>e.issueTypeReducer.instances[t],mg=f(d.createSelector([Tc,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const c=t[a];c?i.push(c):console.warn("selectIssueTypesByIds: No issue type exists with the id",a)}return i})),pg=f(d.createSelector([nm,(t,e)=>e],(t,e)=>S(t.filter(i=>i.organization===e)))),rm=fc.reducer,qe=P(t=>t.uuid),dm=qe.getInitialState({}),gc=d.createSlice({name:"issueTypeStatuses",initialState:dm,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,dm)),reducers:{initializeIssueTypeStatuses:qe.initialize,addIssueTypeStatus:qe.addOne,addIssueTypeStatuses:qe.addMany,setIssueTypeStatus:qe.setOne,setIssueTypeStatuses:qe.setMany,updateIssueTypeStatus:qe.updateOne,updateIssueTypeStatuses:qe.updateMany,deleteIssueTypeStatus:qe.deleteOne,deleteIssueTypeStatuses:qe.deleteMany}}),{initializeIssueTypeStatuses:um,addIssueTypeStatus:bc,addIssueTypeStatuses:yg,setIssueTypeStatus:Xt,setIssueTypeStatuses:Ag,updateIssueTypeStatus:om,updateIssueTypeStatuses:fg,deleteIssueTypeStatus:Fc,deleteIssueTypeStatuses:Sg}=gc.actions,Pc=t=>t.issueTypeStatusReducer.instances,lm=d.createSelector([Pc],t=>Object.values(t)),Oc=t=>e=>e.issueTypeStatusReducer.instances[t],Tg=f(d.createSelector([Pc,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const c=t[a];c?i.push(c):console.warn("selectIssueTypeStatusesByIds: No issue type status exists with the id",a)}return S(i)})),Ig=f(d.createSelector([lm,(t,e)=>e],(t,e)=>S(t.filter(i=>i.issue_type===e)))),hm=gc.reducer,ze=P(t=>t.uuid),mm=ze.getInitialState({}),_c=d.createSlice({name:"issueUpdates",initialState:mm,extraReducers:t=>t.addMatcher(d.isAnyOf(I,E,O),e=>Object.assign(e,mm)),reducers:{initializeIssueUpdates:ze.initialize,addIssueUpdate:ze.addOne,addIssueUpdates:ze.addMany,setIssueUpdate:ze.setOne,setIssueUpdates:ze.setMany,updateIssueUpdate:ze.updateOne,updateIssueUpdates:ze.updateMany,deleteIssueUpdate:ze.deleteOne,deleteIssueUpdates:ze.deleteMany}}),{initializeIssueUpdates:pm,addIssueUpdate:ym,addIssueUpdates:Am,setIssueUpdate:gg,setIssueUpdates:bg,updateIssueUpdate:Fg,updateIssueUpdates:Pg,deleteIssueUpdate:fm,deleteIssueUpdates:Sm}=_c.actions,Tm=t=>t.issueUpdateReducer.instances,Im=d.createSelector([Tm],t=>Object.values(t)),gm=f(d.createSelector([Im,(t,e)=>e],(t,e)=>S(t.filter(i=>i.issue===e)))),bm=_c.reducer,De=P(t=>t.id),Fm=De.getInitialState({currentUser:null}),Rc=d.createSlice({name:"users",initialState:Fm,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Fm)),reducers:{initializeUsers:De.initialize,setUsers:De.setMany,setUser:De.setOne,addUsers:De.addMany,addUser:De.addOne,updateUsers:De.updateMany,updateUser:De.updateOne,deleteUser:De.deleteOne,deleteUsers:De.deleteMany,setCurrentUser:(t,e)=>{t.currentUser=e.payload},setProfilePicture:(t,e)=>{if(!t.currentUser)return;t.currentUser.profile.file=e.payload.file??null,t.currentUser.profile.file_sha1=e.payload.file_sha1??null;const i=t.instances[t.currentUser.id];if(!i)throw new Error("Unable to find current user in users slice");i.profile.file=e.payload.file??null,i.profile.file_sha1=e.payload.file_sha1??null}}}),{initializeUsers:Pm,setUsers:Og,setUser:_g,addUsers:Rg,addUser:Om,updateUsers:vg,updateUser:wg,deleteUser:_m,deleteUsers:Eg,setCurrentUser:Mg,setProfilePicture:Vg}=Rc.actions,Rm=Rc.reducer,vm=t=>t.userReducer.currentUser,Qt=t=>t.userReducer.instances,vc=d.createSelector([Qt],t=>Object.values(t)),wm=t=>e=>e.userReducer.instances[t],jg=f(d.createSelector([Qt,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const c=t[a];c?i.push(c):console.warn("selectUsersByIds: No user exists with the id",a)}return S(i)})),Ue=P(t=>t.uuid),Em=Ue.getInitialState({}),wc=d.createSlice({name:"organizationAccess",initialState:Em,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Em)),reducers:{initializeOrganizationAccesses:Ue.initialize,addOrganizationAccess:Ue.addOne,addOrganizationAccesses:Ue.addMany,setOrganizationAccess:Ue.setOne,setOrganizationAccesses:Ue.setMany,updateOrganizationAccess:Ue.updateOne,updateOrganizationAccesses:Ue.updateMany,deleteOrganizationAccess:Ue.deleteOne,deleteOrganizationAccesses:Ue.deleteMany}}),{initializeOrganizationAccesses:Mm,addOrganizationAccess:Vm,addOrganizationAccesses:qg,setOrganizationAccess:zg,setOrganizationAccesses:Dg,updateOrganizationAccess:xt,updateOrganizationAccesses:Ug,deleteOrganizationAccess:jm,deleteOrganizationAccesses:Cg}=wc.actions,qm=wc.reducer,Ec=t=>t.organizationAccessReducer.instances,Mc=t=>e=>e.organizationAccessReducer.instances[t],kg=d.createSelector([vm,Ec],(t,e)=>Object.values(e).find(a=>a.user===(t==null?void 0:t.id))??null),zm=d.createSelector([Ec],t=>{const e={};for(const i of Object.values(t))e[i.user]=i;return vt(e)}),Bg=f(d.createSelector([Qt,zm,(t,e)=>e],(t,e,i)=>S(Object.values(t).filter(a=>{const c=e[a.id];return!!c&&c.organization===i})))),Ce=P(t=>t.uuid),Dm=Ce.getInitialState({}),Vc=d.createSlice({name:"organizations",initialState:Dm,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Dm)),reducers:{initializeOrganizations:Ce.initialize,setOrganizations:Ce.setMany,setOrganization:Ce.setOne,addOrganizations:Ce.addMany,addOrganization:Ce.addOne,updateOrganizations:Ce.updateMany,updateOrganization:Ce.updateOne,deleteOrganization:Ce.deleteOne,deleteOrganizations:Ce.deleteMany}}),{initializeOrganizations:Um,setOrganizations:$g,setOrganization:Gg,addOrganizations:Lg,addOrganization:Cm,updateOrganizations:Ng,updateOrganization:km,deleteOrganization:Hg,deleteOrganizations:Wg}=Vc.actions,Bm=t=>t.organizationReducer.instances,Kg=d.createSelector([Bm],t=>Object.values(t)),Yg=t=>e=>e.organizationReducer.instances[t],$m=Vc.reducer,Gm=(t,e,i)=>{const a=t.uuid?t:{...t,uuid:xe.v4()};return{payload:a,type:"",meta:{offline:{effect:{timestamp:new Date().toISOString(),request:a,BASE_URL:e,serviceName:i}}}}},Lm={deletedRequests:[],latestRetryTime:0},jc=d.createSlice({name:"outbox",initialState:Lm,extraReducers:t=>t.addCase(I,e=>Object.assign(e,Lm)),reducers:{enqueueRequest:{reducer:(t,e)=>t,prepare:t=>{console.debug("Preparing to enqueue request",t);const{BASE_URL:e,serviceName:i,...a}=t;return Gm(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}}}),Zg=t=>t.outboxReducer.deletedRequests,Jg=t=>t.outboxReducer.latestRetryTime,{enqueueRequest:Nm,markForDeletion:Xg,markAsDeleted:Hm,_setLatestRetryTime:Wm}=jc.actions,Km=jc.reducer,ke=P(t=>t.uuid),Ym=ke.getInitialState({}),qc=d.createSlice({name:"projectAccess",initialState:Ym,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Ym)),reducers:{initializeProjectAccesses:ke.initialize,addProjectAccess:ke.addOne,addProjectAccesses:ke.addMany,setProjectAccess:ke.setOne,setProjectAccesses:ke.setMany,updateProjectAccess:ke.updateOne,updateProjectAccesses:ke.updateMany,deleteProjectAccess:ke.deleteOne,deleteProjectAccesses:ke.deleteMany}}),{initializeProjectAccesses:Zm,addProjectAccess:zc,addProjectAccesses:Dc,setProjectAccess:Qg,setProjectAccesses:xg,updateProjectAccess:Ot,updateProjectAccesses:Jm,deleteProjectAccess:Uc,deleteProjectAccesses:Cc}=qc.actions,Xm=qc.reducer,kc=t=>t.projectAccessReducer.instances,es=d.createSelector(kc,t=>Object.values(t)),Bc=t=>e=>e.projectAccessReducer.instances[t],Qm=f(d.createSelector([kc,(t,e)=>e],(t,e)=>S(Object.values(t).filter(i=>i.project===e)))),eb=f(d.createSelector([es,(t,e)=>e],(t,e)=>{const i={};for(const a of t.filter(c=>c.project===e))i[a.user]=a;return i})),tb=f(d.createSelector([vc,es,(t,e)=>e],(t,e,i)=>{const a=new Set(e.filter(c=>c.project===i).map(c=>c.user));return S(t.filter(c=>a.has(c.id)))})),Be=P(t=>t.uuid),xm=Be.getInitialState({}),$c=d.createSlice({name:"projectAttachments",initialState:xm,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,xm)),reducers:{initializeProjectAttachments:Be.initialize,addProjectAttachment:Be.addOne,addProjectAttachments:Be.addMany,setProjectAttachment:Be.setOne,setProjectAttachments:Be.setMany,updateProjectAttachment:Be.updateOne,updateProjectAttachments:Be.updateMany,deleteProjectAttachment:Be.deleteOne,deleteProjectAttachments:Be.deleteMany}}),{initializeProjectAttachments:ep,addProjectAttachment:sb,addProjectAttachments:tp,setProjectAttachment:sp,setProjectAttachments:ip,updateProjectAttachment:ib,updateProjectAttachments:ap,deleteProjectAttachment:cp,deleteProjectAttachments:Gc}=$c.actions,np=t=>t.projectAttachmentReducer.instances,rp=d.createSelector([np],t=>Object.values(t)),dp=t=>e=>e.projectAttachmentReducer.instances[t],up=f(d.createSelector([rp,(t,e)=>e],(t,e)=>S(t.filter(({project:i})=>e===i)))),op=$c.reducer,$e=P(t=>t.uuid),lp=$e.getInitialState({activeProjectFileId:null,isImportingProjectFile:!1}),Lc=d.createSlice({name:"projectFiles",initialState:lp,extraReducers:t=>t.addMatcher(d.isAnyOf(I,E,O),e=>Object.assign(e,lp)),reducers:{initializeProjectFiles:$e.initialize,setProjectFile:$e.setOne,setProjectFiles:$e.setMany,addProjectFile:$e.addOne,addProjectFiles:$e.addMany,updateProjectFile:$e.updateOne,updateProjectFiles:$e.updateMany,deleteProjectFile:$e.deleteOne,deleteProjectFiles:$e.deleteMany,setIsImportingProjectFile:(t,e)=>{t.isImportingProjectFile=e.payload},saveActiveProjectFileBounds:(t,e)=>{const i=t.activeProjectFileId;if(!i)throw new Error("Tried to save bounds for active project file, but no active project file was set.");if(!t.instances[i])throw new Error(`Tried to save bounds for active project file, but project file with ID ${i}
2
+ doesn't exist.`);t.instances[i].bounds=e.payload},setActiveProjectFileId:(t,e)=>{t.activeProjectFileId=e.payload},resetProjectFileObjectUrls:(t,...e)=>{for(const i in t.instances)delete t.instances[i].objectURL}}}),{initializeProjectFiles:hp,setProjectFile:ab,setProjectFiles:cb,addProjectFile:nb,addProjectFiles:mp,updateProjectFile:Nc,updateProjectFiles:rb,deleteProjectFile:pp,deleteProjectFiles:yp,setIsImportingProjectFile:Ap,setActiveProjectFileId:fp,saveActiveProjectFileBounds:Sp,resetProjectFileObjectUrls:db}=Lc.actions,Tp=t=>t.projectFileReducer.instances,Ip=d.createSelector([Tp],t=>S(Object.values(t).sort((e,i)=>e.z_index-i.z_index))),ub=t=>e=>e.projectFileReducer.instances[t],ob=t=>t.projectFileReducer.activeProjectFileId,lb=t=>t.projectFileReducer.isImportingProjectFile,gp=Lc.reducer,Ge=P(t=>t.uuid),bp=Ge.getInitialState({}),Hc=d.createSlice({name:"projects",initialState:bp,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,bp)),reducers:{initializeProjects:Ge.initialize,setProjects:Ge.setMany,setProject:Ge.setOne,addProjects:Ge.addMany,addProject:Ge.addOne,updateProjects:Ge.updateMany,updateProject:Ge.updateOne,deleteProject:Ge.deleteOne,deleteProjects:Ge.deleteMany}}),{initializeProjects:Fp,setProjects:hb,setProject:mb,addProjects:pb,addProject:Wc,updateProjects:yb,updateProject:Pp,deleteProject:Kc,deleteProjects:Ab}=Hc.actions,Op=Hc.reducer,_p=t=>t.projectReducer.instances,Yc=d.createSelector([_p],t=>S(Object.values(t))),Rp=t=>e=>e.projectReducer.instances[t],fb=f(d.createSelector([Yc,es,(t,e)=>e],(t,e,i)=>{const a=new Set(e.filter(c=>c.user===i).map(c=>c.project));return S(t.filter(c=>a.has(c.uuid)))})),Sb=f(d.createSelector([Yc,(t,e)=>e],(t,e)=>S(t.filter(i=>i.organization===e)))),Tb={isRehydrated:!1},Zc=d.createSlice({name:"rehydrated",initialState:Tb,reducers:{setRehydrated:(t,e)=>{t.isRehydrated=e.payload}}}),{setRehydrated:Ib}=Zc.actions,gb=t=>t.rehydratedReducer.isRehydrated,vp=Zc.reducer,Le=P(t=>t.uuid),wp=Le.getInitialState({}),Jc=d.createSlice({name:"teamMemberships",initialState:wp,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,wp)),reducers:{initializeTeamMemberships:Le.initialize,addTeamMembership:Le.addOne,addTeamMemberships:Le.addMany,setTeamMembership:Le.setOne,setTeamMemberships:Le.setMany,updateTeamMembership:Le.updateOne,updateTeamMemberships:Le.updateMany,deleteTeamMembership:Le.deleteOne,deleteTeamMemberships:Le.deleteMany}}),{initializeTeamMemberships:Ep,addTeamMembership:Mp,addTeamMemberships:Vp,setTeamMembership:Xc,setTeamMemberships:jp,updateTeamMembership:bb,updateTeamMemberships:Fb,deleteTeamMembership:Qc,deleteTeamMemberships:qp}=Jc.actions,zp=Jc.reducer,Dp=t=>t.teamMembershipReducer.instances,xc=d.createSelector([Dp],t=>Object.values(t)),Up=t=>e=>e.teamMembershipReducer.instances[t],Pb=f(d.createSelector([xc,(t,e)=>e],(t,e)=>{const i={};for(const a of t.filter(c=>c.team===e))i[a.user]=a;return i})),Ob=f(d.createSelector([vc,xc,(t,e)=>e],(t,e,i)=>{const a=new Set(e.filter(c=>c.team===i).map(c=>c.user));return S(t.filter(c=>a.has(c.id)))})),Ne=P(t=>t.uuid),Cp=Ne.getInitialState({}),en=d.createSlice({name:"teams",initialState:Cp,extraReducers:t=>t.addMatcher(d.isAnyOf(I,O),e=>Object.assign(e,Cp)),reducers:{initializeTeams:Ne.initialize,addTeam:Ne.addOne,addTeams:Ne.addMany,setTeam:Ne.setOne,setTeams:Ne.setMany,updateTeam:Ne.updateOne,updateTeams:Ne.updateMany,deleteTeam:Ne.deleteOne,deleteTeams:Ne.deleteMany}}),{initializeTeams:kp,addTeam:Bp,addTeams:_b,setTeam:_t,setTeams:Rb,updateTeam:$p,updateTeams:vb,deleteTeam:tn,deleteTeams:wb}=en.actions,sn=t=>t.teamReducer.instances,Gp=d.createSelector([sn],t=>Object.values(t)),an=t=>e=>e.teamReducer.instances[t],Eb=f(d.createSelector([sn,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const c=t[a];c?i.push(c):console.warn("selectTeamsByIds: No team exists with the id",a)}return S(i)})),Mb=f(d.createSelector([Gp,(t,e)=>e],(t,e)=>S(t.filter(i=>i.organization===e)))),Lp=en.reducer,Vb={version:0},Np=d.createSlice({name:"versioning",initialState:Vb,reducers:{}}),Hp=Np.reducer,cn={outboxReducer:Km,fileReducer:vo,authReducer:Ku},jb=d.combineReducers(cn),Wp={...cn,[ct]:Hp,categoryReducer:xu,assetReducer:wd,assetAttachmentReducer:Kn,assetStageCompletionReducer:qd,assetStageReducer:Bd,assetTypeReducer:ku,assetTypeAttachmentReducer:Xd,issueReducer:oh,issueAttachmentReducer:Nl,issueTypeReducer:rm,issueTypeAttachmentReducer:Ih,organizationReducer:$m,projectReducer:Op,projectAttachmentReducer:op,projectAccessReducer:Xm,organizationAccessReducer:qm,projectFileReducer:gp,rehydratedReducer:vp,formReducer:el,formRevisionReducer:Xo,formRevisionAttachmentReducer:No,formSubmissionAttachmentReducer:ol,formSubmissionReducer:fl,formIdentifierReducer:jo,formIdentifierValueReducer:Uo,userReducer:Rm,emailDomainsReducer:Fo,documentsReducer:Ao,documentAttachmentReducer:lo,teamReducer:Lp,agentsReducer:Cn,issueCommentReducer:ah,issueCommentAttachmentReducer:eh,issueUpdateReducer:bm,geoImageReducer:Rl,issueAssociationReducer:zl,issueTypeFieldsReducer:kh,issueTypeFieldValuesReducer:Vh,issueTypeFieldsAttachmentReducer:vh,issueTypeFieldValuesAttachmentReducer:Wh,issueTypeIdentifierReducer:Xh,issueTypeIdentifierValueReducer:tm,issueTypeStatusReducer:hm,assetTypeFieldsReducer:hu,assetTypeFieldValuesReducer:_u,assetTypeFieldsAttachmentReducer:cu,assetTypeFieldValuesAttachmentReducer:Tu,assetTypeIdentifierReducer:Mu,assetTypeIdentifierValueReducer:zu,assetTypeStatusReducer:Nu,assetProcedureTypeReducer:Gr,assetProcedureReducer:Cr,assetProcedureTypeFieldsReducer:Sr,assetProcedureFieldValuesReducer:Vr,assetProcedureTypeFieldsAttachmentReducer:or,assetProcedureTypeFieldValuesAttachmentReducer:Fr,assetProcedureTypeAttachmentReducer:tr,assetProcedureStepFieldsAttachmentReducer:Xr,assetProcedureStepFieldsReducer:ed,assetProcedureStepFieldValuesAttachmentReducer:rd,assetProcedureStepFieldValuesReducer:pd,assetProcedureStepReducer:bd,teamMembershipReducer:zp},qb=d.combineReducers(Wp);function zb(t,e){return Ay.useMemo(t,e)}class Db{constructor(e){T(this,"operations",[]);T(this,"getData");this.getData=e}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(c=>c[e]===i)),this}exclude(e,i){return this.operations.push(a=>a.filter(c=>c[e]!==i)),this}orderBy(e){return this.operations.push(i=>[...i].sort((a,c)=>a[e]<=c[e]?1:-1)),this}reverse(){return this.operations.push(e=>[...e].reverse()),this}all(){return this.operations.push(e=>e),this}get(e,i){return d.createSelector([this.getData],a=>this.performOperations(a).find(c=>c[e]===i))}count(){return d.createSelector([this.getData],e=>this.performOperations(e).length)}first(){return d.createSelector([this.getData],e=>this.performOperations(e)[0])}last(){return d.createSelector([this.getData],e=>{const i=this.performOperations(e);return i[i.length-1]})}exists(){return d.createSelector([this.getData],e=>this.performOperations(e).length>0)}toSelector(){return d.createSelector([this.getData],e=>S(this.performOperations(e)))}}const Kp={};class Yp{constructor(e){T(this,"client");Kp[this.constructor.name]=this,this.client=e}async enqueueRequest(e,i){return this.client.enqueueRequest(e,this.host,this.constructor.name,i)}async performPagination(e,i,a){const c=[];let n=await this.client.enqueueRequest(e,this.host,this.constructor.name,a);for(c.push(n.results);n.next;)n=await this.client.enqueueRequest(i(n.next),this.host,this.constructor.name,a),c.push(n.results);return c}dispatch(e){this.client.store.dispatch(e)}}const Zp=()=>Qp.length-1,Jp=t=>(t[ct]={version:Zp()},t),Xp=()=>Jp({}),Ub=t=>(t.outboxReducer&&(t.outboxReducer.deletedRequests=[]),t),Cb=t=>e=>{var i;return e===void 0&&(e={}),((i=e[ct])==null?void 0:i.version)===Zp()?e:t(e)},Qp=[Jp,Xp,Xp,Ub],kb=Object.fromEntries(Qp.map((t,e)=>[e,Cb(t)])),Bb=t=>{if(t)throw t;const e=at();e?e.dispatch({type:"rehydrated/setRehydrated",payload:!0}):console.error("Client store not set")},xp=(t,e,i)=>{const a=Xe();return a?(a.addRequest(e),a.getQueue()):(console.warn("Outbox coordinator not set; cannot enqueue request yet."),[])},ey=(t,e,i)=>{const a=Xe();if(!a)return console.warn("Outbox coordinator not set; cannot dequeue request yet."),[];const n=e.meta.offlineAction.payload.uuid;return a.remove(n),a.getQueue()};async function $b(t,e){if(!e.payload)throw new Error("Received empty payload");return ly(e)}const Gb={...pn,effect:$b,discard:rn,returnPromises:!0,persistCallback:Bb,retry:Kb,persistOptions:{storage:Sy},queue:{...pn.queue,enqueue:xp,dequeue:ey,peek:(...t)=>Wb(...t)}},Lb=Ty(kb,ct),Nb=d.compose(fy.offline(Gb),Lb);function Hb(t){function e(i){return typeof i=="object"&&i!==null&&["ok","redirect","clientError","serverError","error"].every(c=>c 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}}async function nn(t,e,i){const a=Kp[t.meta.offline.effect.serviceName];if(!a)throw new Error(`Service ${t.meta.offline.effect.serviceName} not found`);const c=a instanceof _;if(e.store.getState().outboxReducer.deletedRequests.includes(t.payload.uuid))throw new Error("Request was marked for deletion");c&&t.payload.checkAuth!==!1&&await a.auth.prepareAuth();const r={queryParams:"",isAuthNeeded:!0},u=t.meta.offline.effect,{payload:m,headers:o,method:h,queryParams:p,attachmentHash:y,isExternalUrl:A,isAuthNeeded:g,isResponseBlob:F}={...r,...u.request},R=u.request;let w=R.url;const z=y?await e.files.fetchCache(y):void 0;if(y&&!z)throw new Error(`Cannot upload file ${y} because it's not cached.`);!A&&!w.startsWith("http")&&(!w.startsWith("/")&&!w.startsWith("blob:")&&(w="/"+w),w=t.meta.offline.effect.BASE_URL+w);const He=q=>{if(y){const We=R.s3url;if(!We)throw new Error(`No S3 URL for file ${y}`);if("warning"in We)throw new Error(`S3 URL warning for file ${y}`);if(!z)throw new Error(`No file for file ${y}`);const Rt=We.fields["x-amz-checksum-sha1"];if(!Rt)throw new Error(`No checksum for file ${y}`);return q.set("x-amz-checksum-sha1",Rt).field({...m,...We.fields}).attach("file",z)}return q.send(m)},pP={[l.GET]:()=>F?Qe.get(w.toString()).responseType("blob"):Qe.get(w.toString()),[l.POST]:()=>{const q=Qe.post(w.toString());return He(q)},[l.PATCH]:()=>{const q=Qe.patch(w.toString());return He(q)},[l.PUT]:()=>{const q=Qe.put(w.toString());return He(q)},[l.DELETE]:()=>{const q=Qe.delete(w.toString());return He(q)}}[h];let Ze=pP();if(i==null||i.addEventListener("abort",()=>{console.debug("aborting request:",R),Ze.abort()}),g&&c){const q=a.auth.getAuthHeader();Ze=Ze.set("Authorization",q)}o&&(Ze=Ze.set(o));try{return await Ze.query(p)}catch(q){const We=Hb(q),Rt=We==null?void 0:We.status;if(c&&Rt===401)return await a.auth.handleUnauthorized(Ze,We),Ze.query(p);throw new U({response:We,innerError:q,discard:ty.includes(Rt)})}}const ty=[400,409,403,404,405,500];function rn(t,e,i=0){var o;if(console.debug("Considering discarding request due to error:",t,`(${typeof t})`,`
3
3
  Action:`,e,`
4
- 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,r=e.payload.uuid;function u(){a.dispatch(Vm(r));const h=Je();if(!h)throw new Error("Outbox coordinator not set");h.remove(e.payload.uuid);const p=e.meta.offline.rollback;throw p&&(console.warn("Rolling back request due to SDK error:",e),a.dispatch(p)),t}if(t instanceof U&&t.options.discard)return console.debug("Discarding request due to explicit discard:",e),u();if(c.includes(r))return console.debug("Discarding request due to deletion:",e),u();if(t instanceof U){const h=t.status||((o=t.response)==null?void 0:o.status);if(h||console.warn("Error has no status code:",t),h!==void 0&&Gp.includes(h)){console.warn("Discarding request due to error:",t,`
5
- Action:`,e);const p=Je();if(!p)throw new Error("Outbox coordinator not set");p.remove(e.payload.uuid),t.options.discard=!0,u()}}console.debug("Registering a retry for request:",e.payload.uuid);const m=Je();if(!m)throw new Error("Outbox coordinator not set");return m.registerRetry(e.payload.uuid),!1}function Rb(t,e,i){var a;return(a=Je())==null?void 0:a.peek()}function vb(t,e){return it().dispatch(jm(new Date().getTime())),mc}const tt="An unknown error occurred",wb=500,Lp=["non_field_errors","detail"];function Mb(t,e){let i;if(t!=null&&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"?Lp.includes(n)?c:`${n}: ${c}`:Array.isArray(c)?Lp.includes(n)?c.join(`
6
- `):c.map(r=>`${n}: ${r}`).join(`
7
- `):`${n}: ${JSON.stringify(c)}`).join(`
8
- `)}catch(n){console.error("Failed to extract error message from response body",n)}}else typeof t.body=="string"&&(i=t.body);else t!=null&&t.text?i=t.text:e instanceof Error&&(i=e.message);return!i||i.length>wb?tt:i}class U extends Error{constructor(i){super(tt);T(this,"status");T(this,"response");T(this,"message");T(this,"options");const{response:a,innerError:n}=i;this.message=i.message??Mb(a,n)??tt,this.status=(a==null?void 0:a.status)??0,this.response=a,i.discard=i.discard??!1,this.options=i}}class Eb extends zp{constructor(e){super(e)}}class _ extends zp{constructor(i,a){super(i);T(this,"auth");this.auth=a}}class Vb extends _{async startConversation(e,i){return this.enqueueRequest({description:"Start agent conversation",method:l.POST,url:"/agents/prompt/",payload:{prompt:e,active_project:i},blockers:["prompt"],blocks:["prompt"]}).then(a=>(this.dispatch(Rc(a)),a))}async continueConversation(e,i,a){return this.enqueueRequest({description:"Prompt agent",method:l.POST,url:"/agents/prompt/",payload:{prompt:e,active_project:a},blockers:["prompt"],blocks:["prompt"],queryParams:{conversation_id:i}}).then(n=>{this.dispatch(wc(n))})}async fetchDetails(e){return this.enqueueRequest({description:"Get agent conversation",method:l.GET,url:`/agents/conversations/${e}/`,blockers:["conversation"],blocks:["conversation"]}).then(i=>{this.dispatch(vc(i))})}async rate(e,i){return this.enqueueRequest({description:"Rate agent response",method:l.PUT,url:`/agents/responses/${e}/rate/`,payload:{rating:i},blockers:["rate"],blocks:["rate"]})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get agent conversation history",method:l.GET,url:"/agents/conversations/",queryParams:{project:e},blockers:["agent-conversations"],blocks:["agent-conversations"]},i);return this.dispatch(_c(a)),a}}const V=1e3,We=200;class j extends _{getNumberOfAttachmentsWithSha1(e){const{issueAttachmentReducer:i,assetAttachmentReducer:a,assetTypeAttachmentReducer:n,documentAttachmentReducer:c,projectAttachmentReducer:r,formRevisionAttachmentReducer:u,formSubmissionAttachmentReducer:m,geoImageReducer:o,assetTypeFieldsAttachmentReducer:h,assetTypeFieldValuesAttachmentReducer:p,issueTypeFieldsAttachmentReducer:y,issueTypeFieldValuesAttachmentReducer:A}=this.client.store.getState();return[].concat(Object.values(i.instances),Object.values(a.instances),Object.values(n.instances),Object.values(c.instances),Object.values(r.instances),Object.values(u.instances),Object.values(m.instances),Object.values(o.instances),Object.values(h.instances),Object.values(p.instances),Object.values(y.instances),Object.values(A.instances)).filter(F=>F.file_sha1===e).length}processPresignedUrls(e){const i={};for(const[a,n]of Object.entries(e))i[a]=this.enqueueRequest({url:n.url,description:"Upload file to S3",method:l.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:a,blockers:[`s3-${n.fields.key}`],blocks:[a],s3url:n});return i}async getFilePayload(e){const i=await xe(e),a={sha1:i,file_type:e.type,extension:e.name.split(".").pop(),size:e.size};return await this.client.files.addCache(e,i),a}}class Ke extends j{async _bulkAdd(e){var o;const{store:i}=this.client,a=(o=i.getState().userReducer.currentUser)==null?void 0:o.id,n=new Date().toISOString(),c=[],r=[],u={};for(const h of e){const{modelUuid:p,file:y}=h,A=await this.getFilePayload(y);A.sha1 in u||(u[A.sha1]=A);const g=this.buildOfflineAttachment({file:y,file_sha1:A.sha1,submitted_at:n,created_by:a,description:"",modelUuid:p});c.push(g),r.push(this.buildAttachmentPayload({uuid:g.uuid,file_name:g.file_name,file_sha1:g.file_sha1,file_extension:A.extension,description:g.description,modelUuid:p}))}this.dispatch(this.addAttachments(c));const m=this.enqueueRequest({description:`Add ${this.name}`,method:l.POST,url:`${this.url}/bulk/`,payload:{submitted_at:n,attachments:r,files:Object.values(u)},blocks:c.map(h=>h.uuid),blockers:c.map(h=>h.file_sha1)});return m.then(({attachments:h,presigned_urls:p})=>{this.dispatch(this.updateAttachments(h)),this.processPresignedUrls(p)}).catch(()=>{this.dispatch(this.removeAttachments(c.map(h=>h.uuid)))}),[c,m.then(({attachments:h})=>h)]}async _delete(e){const{store:i}=this.client,a=this.selectAttachment(e)(i.getState());if(!a)throw new Error(`Attempting to delete attachment with uuid ${e} that does not exist in the store`);this.dispatch(this.removeAttachment(a.uuid));const n=this.enqueueRequest({description:`Delete ${this.name}`,method:l.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return n.then(()=>{this.getNumberOfAttachmentsWithSha1(a.file_sha1)===0&&this.client.files.removeCache(a.file_sha1)}).catch(()=>{this.dispatch(this.setAttachment(a))}),n}}class jb extends Ke{constructor(){super(...arguments);T(this,"name","Asset Attachment");T(this,"url","/asset-attachments");T(this,"initializeAttachments",os);T(this,"addAttachments",ls);T(this,"updateAttachments",jc);T(this,"removeAttachments",hs);T(this,"removeAttachment",qc);T(this,"setAttachment",Vc);T(this,"selectAttachment",Uc)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,asset:i.modelUuid})}buildAttachmentPayload(i){return{...i,asset:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.assetUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const c=(await this.performPagination({immediate:!0,description:"Get asset attachments",method:l.GET,url:`${this.url}/`,queryParams:{limit:We,paginate:!0,asset__project:i},blocks:[],blockers:[]},r=>({immediate:!0,description:"Get asset attachments",method:l.GET,url:r,blockers:[],blocks:[]}),a)).flat();return this.dispatch(os(c)),c}}class qb extends Ke{constructor(){super(...arguments);T(this,"name","Asset Procedure Attachment");T(this,"url","/asset-procedure-type-attachments");T(this,"addAttachments",Gc);T(this,"updateAttachments",Nc);T(this,"removeAttachments",Wc);T(this,"removeAttachment",Hc);T(this,"setAttachment",Lc);T(this,"selectAttachment",Jc)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,asset_procedure_type:i.modelUuid})}buildAttachmentPayload(i){return{...i,asset_procedure_type:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.assetProcedureTypeUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=await this.enqueueRequest({immediate:!0,description:"Get asset procedure attachments",method:l.GET,url:`${this.url}/`,queryParams:{asset_procedure_type__organization:i},blocks:[],blockers:[]},a);return this.dispatch($c(n)),n}}class zb extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const o of e){const{fieldsRevisionUuid:h,fieldIdentifier:p,file:y}=o,A=await this.getFilePayload(y);A.sha1 in n||(n[A.sha1]=A);const g=b({file:URL.createObjectURL(y),file_type:y.type,file_name:y.name,file_sha1:A.sha1,created_by:a,fields_revision:h,submitted_at:i,field_identifier:p});c.push(g);const F={uuid:g.uuid,file_name:y.name,field_identifier:p,file_extension:A.extension,file_sha1:A.sha1,fields_revision:h};r.push(F)}this.dispatch(xc(c));const u=this.enqueueRequest({description:"Add asset procedure type fields attachments",method:l.POST,url:"/asset-procedure-type-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(o=>o.fields_revision),blocks:c.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(er(o.attachments))}).catch(()=>{this.dispatch(tr(c.map(o=>o.uuid)))}),[c,u.then(({attachments:o})=>o)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset procedure type fields attachments",method:l.GET,url:"/asset-procedure-type-fields-attachments/",queryParams:{fields_revision__asset_procedure_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Qc(a)),a}}class Db extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(rr(c));const r=this.enqueueRequest({description:"Add Asset Procedure Type Fields",method:l.POST,url:"/asset-procedure-type-fields/",payload:v(c),blockers:[c.asset_procedure_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(dr(m))}).catch(m=>{throw this.dispatch(ur(c.uuid)),m}),[c,r]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get Asset Procedure Type Fields",method:l.GET,url:"/asset-procedure-type-fields/",queryParams:{asset_procedure_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(cr(a)),a}}function Ze(t,e){const i=[];let a=0;const n=t.length;for(;a<n;)i.push(t.slice(a,a+=e));return i}class Ub extends j{async bulkAdd(e,i){var o;const a=new Date().toISOString(),n=(o=this.client.store.getState().userReducer.currentUser)==null?void 0:o.id,c=Ze(e,i??e.length),r=[],u=[];for(const h of c){const p={},y=[];for(const A of h){const{fieldValuesUuid:g,fieldIdentifier:F,file:R}=A,w=await this.getFilePayload(R);w.sha1 in p||(p[w.sha1]=w);const z=b({file:URL.createObjectURL(R),file_type:R.type,file_name:R.name,file_sha1:w.sha1,created_by:n,field_values:g,submitted_at:a,field_identifier:F});r.push(z);const Ne={uuid:z.uuid,file_name:R.name,file_sha1:w.sha1,file_extension:w.extension,field_identifier:F,field_values:g};y.push(Ne)}u.push({submitted_at:a,attachments:y,files:Object.values(p)})}this.dispatch(vt(r));const m=u.map(h=>this.enqueueRequest({description:"Add asset procedure type field values attachments",method:l.POST,url:"/asset-procedure-type-field-values-attachments/bulk/",payload:h,blockers:h.attachments.map(p=>p.field_values),blocks:h.attachments.map(p=>p.uuid)}));return Promise.all(m).then(h=>{for(const y of h)this.processPresignedUrls(y.presigned_urls);const p=h.flatMap(y=>y.attachments);this.dispatch(pr(p))}).catch(h=>{throw this.dispatch(wt(r.map(p=>p.uuid))),h}),[r,m.map(h=>h.then(({attachments:p})=>p))]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=fr(e)(a);this.dispatch(wt(e));try{await this.enqueueRequest({description:"Delete asset procedure type field values attachments",method:l.DELETE,url:"/asset-procedure-type-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(vt(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset procedure type field values attachments",method:l.GET,url:"/asset-procedure-type-field-values-attachments/",queryParams:{limit:We,paginate:!0,field_values__asset_procedure__project:e,latest:!0},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset procedure type field values attachments",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(mr(n)),n}}class Cb extends _{add(e){var r;const{store:i}=this.client,a=i.getState(),n=b({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add asset procedure type field values",method:l.POST,url:"/asset-procedure-type-field-values/",payload:v(n),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[n.uuid]});return this.dispatch(Is(n)),c.then(u=>(this.dispatch(nt(u)),u)).catch(()=>{this.dispatch(gs(n.uuid))}),[n,c]}bulkAdd(e,i){var m;const a=new Date().toISOString(),n=[],c=Ze(e.payloads,i??e.payloads.length),r=[];for(const o of c){const h=[];for(const p of o){const y=b({...p,values:p.values,created_by:(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,submitted_at:a});n.push(y),h.push({uuid:y.uuid,asset:p.asset,fields_revision:p.fields_revision,asset_procedure:p.asset_procedure,published_at:p.published_at,values:y.values})}r.push({submitted_at:a,values:e.values,field_values:h})}this.dispatch(gr(n));const u=[];for(const o of r){const h=o.field_values.map(F=>F.asset),p=o.field_values.map(F=>F.fields_revision),y=o.field_values.map(F=>F.asset_procedure),A=o.field_values.map(F=>F.uuid),g=this.enqueueRequest({description:"Bulk add asset procedure type field values",method:l.POST,url:"/asset-procedure-type-field-values/bulk/",payload:o,blockers:[...h,...p,...y],blocks:A});u.push(g)}return Promise.all(u).then(o=>{this.dispatch(br(o.flat()))}).catch(()=>{this.dispatch(Fr(n.map(o=>o.uuid)))}),[n,u]}update(e){const{store:i}=this.client,a=i.getState(),n=Fs(e.uuid)(a);if(!n)throw new Error(`Expected AssetProcedureTypeFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(nt(c));const r=this.enqueueRequest({description:"Update asset procedure type field values",method:l.PATCH,url:`/asset-procedure-type-field-values/${e.uuid}/`,payload:e,blockers:[c.fields_revision,c.asset,c.asset_procedure],blocks:[c.uuid]});return r.then(u=>{this.dispatch(nt(u))}).catch(()=>{this.dispatch(nt(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Fs(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=Sr(e)(a);this.dispatch(gs(e)),this.dispatch(wt(c.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset procedure type field values",method:l.DELETE,url:`/asset-procedure-type-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(Is(n)),this.dispatch(vt(c)),r}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset procedure type field values",method:l.GET,url:"/asset-procedure-type-field-values/",queryParams:{limit:V,paginate:!0,asset_procedure__project:e,latest:!0},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset procedure type field values",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Ir(n)),n}}class kb extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(Os(c));const r=this.enqueueRequest({description:"Create asset procedure",method:l.POST,url:"/asset-procedures/",payload:v(c),blockers:[e.asset_procedure_type,e.asset_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(ct(m))}).catch(()=>{this.dispatch(_s(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=ws(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset procedure with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(ct(n));const c=this.enqueueRequest({description:"Update asset procedure",method:l.PATCH,url:`/asset-procedures/${e.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(ct(r))}).catch(()=>{this.dispatch(ct(a))}),[n,c]}async remove(e){const{store:i}=this.client,a=i.getState(),n=ws(e)(a);if(!n)throw new Error(`Expected asset procedure with uuid ${e} to exist`);return this.dispatch(_s(e)),this.enqueueRequest({description:"Delete asset procedure",method:l.DELETE,url:`/asset-procedures/${e}/`,blockers:[e],blocks:[]}).catch(c=>{throw this.dispatch(Os(n)),c})}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset procedures",method:l.GET,url:"/asset-procedures/",queryParams:{limit:V,paginate:!0,project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset procedures",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Rr(n)),n}}class Bb extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(Es(c));const r=this.enqueueRequest({description:"Create asset procedure type",method:l.POST,url:"/asset-procedure-types/",payload:v(c),blockers:[],blocks:[c.uuid]});return r.then(m=>{this.dispatch(rt(m))}).catch(()=>{this.dispatch(Vs(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=qs(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset procedure type with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(rt(n));const c=this.enqueueRequest({description:"Update asset procedure type",method:l.PATCH,url:`/asset-procedure-types/${e.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(rt(r))}).catch(()=>{this.dispatch(rt(a))}),[n,c]}async remove(e){const{store:i}=this.client,a=i.getState(),n=qs(e)(a);if(!n)throw new Error(`Expected asset procedure type with uuid ${e} to exist`);const c=Er(e)(a);return this.dispatch(Vs(e)),this.dispatch(wr(c.map(({uuid:r})=>r))),this.enqueueRequest({description:"Delete asset procedure type",method:l.DELETE,url:`/asset-procedure-types/${e}/`,blockers:[e],blocks:[]}).catch(r=>{throw this.dispatch(Es(n)),this.dispatch(vr(c)),r})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset procedure types",method:l.GET,url:"/asset-procedure-types/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(jr(a)),a}}class $b extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const o of e){const{fieldsRevisionUuid:h,fieldIdentifier:p,file:y}=o,A=await this.getFilePayload(y);A.sha1 in n||(n[A.sha1]=A);const g=b({file:URL.createObjectURL(y),file_type:y.type,file_name:y.name,file_sha1:A.sha1,created_by:a,fields_revision:h,submitted_at:i,field_identifier:p});c.push(g);const F={uuid:g.uuid,file_name:y.name,field_identifier:p,file_extension:A.extension,file_sha1:A.sha1,fields_revision:h};r.push(F)}this.dispatch(Cr(c));const u=this.enqueueRequest({description:"Add asset procedure step fields attachments",method:l.POST,url:"/asset-procedure-step-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(o=>o.fields_revision),blocks:c.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(kr(o.attachments))}).catch(()=>{this.dispatch(Br(c.map(o=>o.uuid)))}),[c,u.then(({attachments:o})=>o)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset procedure step fields attachments",method:l.GET,url:"/asset-procedure-step-fields-attachments/",queryParams:{fields_revision__asset_procedure_step__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Ur(a)),a}}class Gb extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(Us(c));const r=this.enqueueRequest({description:"Add Asset Procedure Step Fields",method:l.POST,url:"/asset-procedure-step-fields/",payload:v(c),blockers:[c.asset_procedure_step],blocks:[c.uuid]});return r.then(m=>{this.dispatch(dt(m))}).catch(m=>{throw this.dispatch(Cs(c.uuid)),m}),[c,r]}update(e){const{store:i}=this.client,a=i.getState().assetProcedureStepFieldsReducer.instances[e.uuid];if(!a)throw new Error(`AssetProcedureStepFields with uuid ${e.uuid} not found`);const n={...a,...e};this.dispatch(dt(n));const c=this.enqueueRequest({description:"Update Asset Procedure Step Fields",method:l.PATCH,url:`/asset-procedure-step-fields/${a.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(dt(r))}).catch(r=>{throw this.dispatch(dt(a)),r}),[n,c]}delete(e){const{store:i}=this.client,a=i.getState().assetProcedureStepFieldsReducer.instances[e];if(!a)throw new Error(`AssetProcedureStepFields with uuid ${e} not found`);this.dispatch(Cs(e));const n=this.enqueueRequest({description:"Delete Asset Procedure Step Fields",method:l.DELETE,url:`/asset-procedure-step-fields/${e}/`,blockers:[e],blocks:[e]});return n.catch(c=>{throw this.dispatch(Us(a)),c}),n}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get Asset Procedure Step Fields",method:l.GET,url:"/asset-procedure-step-fields/",queryParams:{asset_procedure_step__asset_procedure_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Hr(a)),a}}class Lb extends j{async bulkAdd(e,i){var o;const a=new Date().toISOString(),n=(o=this.client.store.getState().userReducer.currentUser)==null?void 0:o.id,c=Ze(e,i??e.length),r=[],u=[];for(const h of c){const p={},y=[];for(const A of h){const{fieldValuesUuid:g,fieldIdentifier:F,file:R}=A,w=await this.getFilePayload(R);w.sha1 in p||(p[w.sha1]=w);const z=b({file:URL.createObjectURL(R),file_type:R.type,file_name:R.name,file_sha1:w.sha1,created_by:n,field_values:g,submitted_at:a,field_identifier:F});r.push(z);const Ne={uuid:z.uuid,file_name:R.name,file_sha1:w.sha1,file_extension:w.extension,field_identifier:F,field_values:g};y.push(Ne)}u.push({submitted_at:a,attachments:y,files:Object.values(p)})}this.dispatch(Mt(r));const m=u.map(h=>this.enqueueRequest({description:"Add asset procedure step field values attachments",method:l.POST,url:"/asset-procedure-step-field-values-attachments/bulk/",payload:h,blockers:h.attachments.map(p=>p.field_values),blocks:h.attachments.map(p=>p.uuid)}));return Promise.all(m).then(h=>{for(const y of h)this.processPresignedUrls(y.presigned_urls);const p=h.flatMap(y=>y.attachments);this.dispatch(Zr(p))}).catch(h=>{throw this.dispatch(Et(r.map(p=>p.uuid))),h}),[r,m.map(h=>h.then(({attachments:p})=>p))]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=Xr(e)(a);this.dispatch(Et(e));try{await this.enqueueRequest({description:"Delete asset procedure step field values attachments",method:l.DELETE,url:"/asset-procedure-step-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(Mt(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset procedure step field values attachments",method:l.GET,url:"/asset-procedure-step-field-values-attachments/",queryParams:{limit:We,paginate:!0,field_values__asset_procedure__project:e,latest:!0},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset procedure step field values attachments",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Yr(n)),n}}class Nb extends _{add(e){var r;const{store:i}=this.client,a=i.getState(),n=b({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add asset procedure step field values",method:l.POST,url:"/asset-procedure-step-field-values/",payload:v(n),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[n.uuid]});return this.dispatch(Ns(n)),c.then(u=>(this.dispatch(ut(u)),u)).catch(()=>{this.dispatch(Hs(n.uuid))}),[n,c]}bulkAdd(e,i){var m;const a=new Date().toISOString(),n=[],c=Ze(e.payloads,i??e.payloads.length),r=[];for(const o of c){const h=[];for(const p of o){const y=b({...p,values:p.values,created_by:(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,submitted_at:a});n.push(y),h.push({uuid:y.uuid,asset:p.asset,fields_revision:p.fields_revision,asset_procedure:p.asset_procedure,asset_procedure_step:p.asset_procedure_step,published_at:p.published_at,values:y.values})}r.push({submitted_at:a,values:e.values,field_values:h})}this.dispatch(sd(n));const u=[];for(const o of r){const h=o.field_values.map(F=>F.asset),p=o.field_values.map(F=>F.fields_revision),y=o.field_values.map(F=>F.asset_procedure),A=o.field_values.map(F=>F.uuid),g=this.enqueueRequest({description:"Bulk add asset procedure step field values",method:l.POST,url:"/asset-procedure-step-field-values/bulk/",payload:o,blockers:[...h,...p,...y],blocks:A});u.push(g)}return Promise.all(u).then(o=>{this.dispatch(id(o.flat()))}).catch(()=>{this.dispatch(ad(n.map(o=>o.uuid)))}),[n,u]}update(e){const{store:i}=this.client,a=i.getState(),n=Ws(e.uuid)(a);if(!n)throw new Error(`Expected AssetProcedureStepFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(ut(c));const r=this.enqueueRequest({description:"Update asset procedure step field values",method:l.PATCH,url:`/asset-procedure-step-field-values/${e.uuid}/`,payload:e,blockers:[c.fields_revision,c.asset,c.asset_procedure],blocks:[c.uuid]});return r.then(u=>{this.dispatch(ut(u))}).catch(()=>{this.dispatch(ut(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Ws(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=Qr(e)(a);this.dispatch(Hs(e)),this.dispatch(Et(c.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset procedure step field values",method:l.DELETE,url:`/asset-procedure-step-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(Ns(n)),this.dispatch(Mt(c)),r}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset procedure step field values",method:l.GET,url:"/asset-procedure-step-field-values/",queryParams:{limit:V,paginate:!0,asset_procedure__project:e,latest:!0},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset procedure step field values",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(td(n)),n}}class Hb extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(od(c));const r=this.enqueueRequest({description:"Create asset procedure step",method:l.POST,url:"/asset-procedure-steps/",payload:v(c),blockers:[c.asset_procedure_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(jt(m))}).catch(()=>{this.dispatch(hd(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=Ys(e.uuid)(i.getState());if(!a)throw new Error(`No asset procedure step with uuid ${e.uuid} found in the store`);const n={...a,...e};this.dispatch(jt(n));const c=this.enqueueRequest({description:"Update asset procedure step",method:l.PATCH,url:`/asset-procedure-steps/${a.uuid}/`,payload:{name:e.name,description:e.description,priority:e.order,color:e.color},blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(jt(r))}).catch(()=>{this.dispatch(ud(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Ys(e)(a);if(!n)throw new Error(`No asset procedure step with uuid ${e} found in the store`);const c=Ad(e)(a);return this.dispatch(md([e,...gc(c)])),this.enqueueRequest({description:"Delete asset stage",method:l.DELETE,url:`/asset-procedure-steps/${e}/`,blockers:[e],blocks:[]}).catch(r=>{throw this.dispatch(ld([n,...c])),r})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset procedure steps",method:l.GET,url:"/asset-procedure-steps/",queryParams:{asset_procedure_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(dd(a)),a}}class Wb extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(Js(c));const r=this.enqueueRequest({description:"Create asset",method:l.POST,url:"/assets/",payload:v(c),blockers:[c.asset_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(lt(m))}).catch(()=>{this.dispatch(Xs(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=ti(e.uuid)(i.getState());if(!a)throw new Error(`No asset with uuid ${e.uuid} found in the store`);const n={...a,...e};this.dispatch(lt(n));const c=this.enqueueRequest({description:"Edit asset",method:l.PATCH,url:`/assets/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(lt(r))}).catch(()=>{this.dispatch(lt(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=ti(e)(a);if(!n)throw new Error(`No asset with uuid ${e} found in the store`);const c=Cc(e)(a),r=gl(e)(a);if(this.dispatch(Xs(e)),c.length>0){const u=c.map(({uuid:m})=>m);this.dispatch(hs(u))}if(r.length>0){const u=r.map(({uuid:m})=>m);this.dispatch(_a(u))}return this.enqueueRequest({description:"Delete asset",method:l.DELETE,url:`/assets/${e}/`,blockers:[e],blocks:[]}).catch(u=>{throw this.dispatch(Js(n)),this.dispatch(ls(c)),this.dispatch(Pa(r)),u})}bulkAdd(e,i,a,n){const c=new Date().toISOString(),r=Qe.v4(),u=Ze(e,n).map(h=>{const p=h.map(y=>b(y));return{batchId:Qe.v4(),payload:{transaction_id:r,submitted_at:c,asset_type:i,project:a,assets:p}}}),m=[];let o=null;for(const h of u){const{batchId:p,payload:y}=h,A=y.assets.map(w=>w.uuid),g=[i];o&&g.push(o);const F=A;F.push(p);const R=this.enqueueRequest({description:"Batch create assets",method:l.POST,url:"/assets/bulk/",payload:y,blockers:g,blocks:F});o=h.batchId,m.push(R)}return Promise.all(m).then(h=>{const p=h.flat();this.dispatch(qt(p))}),m}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=Id(e)(a);this.dispatch(Qs(e));try{await this.enqueueRequest({description:"Bulk delete assets",method:l.DELETE,url:"/assets/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(qt(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get assets",method:l.GET,url:"/assets/",queryParams:{limit:V,paginate:!0,project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get assets",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Sd(n)),n}}class Kb extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(ii(c));const r=this.enqueueRequest({description:"Add asset stage completion",method:l.POST,url:"/asset-stage-completions/",payload:v(c),blockers:[e.asset,e.asset_stage],blocks:[c.uuid]});return r.then(m=>{this.dispatch(Pd(m))}).catch(()=>{this.dispatch(ni(c.uuid))}),[c,r]}delete(e){const{store:i}=this.client,a=Rd(e)(i.getState());if(!a)throw new Error(`Expected asset stage completion with uuid ${e} to exist`);this.dispatch(ni(e));const n=this.enqueueRequest({description:"Delete asset stage completion",method:l.DELETE,url:`/asset-stage-completions/${e}/`,blockers:[e],blocks:[]});return n.catch(()=>{this.dispatch(ii(a))}),n}bulkAdd(e){var o;const{store:i}=this.client,a=new Date().toISOString(),n=(o=i.getState().userReducer.currentUser)==null?void 0:o.id,c=e.map(h=>b(h)),r=c.map(h=>({...h,created_by:n,submitted_at:a})),u=r.map(({uuid:h})=>h);this.dispatch(ai(r));const m=this.enqueueRequest({description:"Bulk create asset stage completions",method:l.POST,url:"/asset-stage-completions/bulk/",payload:{submitted_at:a,completions:c},blockers:[...e.map(h=>h.asset_procedure),...e.map(h=>h.asset_stage),...e.map(h=>h.asset)],blocks:u});return m.then(h=>{this.dispatch(Od(h))}).catch(()=>{this.dispatch(ci(u))}),[r,m]}bulkDelete(e){const{store:i}=this.client,a=vd(e)(i.getState());this.dispatch(ci(e));const n=this.enqueueRequest({description:"Deleting asset stage completions",method:l.DELETE,url:"/asset-stage-completions/bulk/",payload:{uuids:e},blockers:e,blocks:[]});return n.catch(()=>{this.dispatch(ai(a))}),n}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset stage completions",method:l.GET,url:"/asset-stage-completions/",queryParams:{limit:V,paginate:!0,asset_procedure__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset stage completions",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Fd(n)),n}}class Yb extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(ui(c));const r=this.enqueueRequest({description:"Create asset",method:l.POST,url:"/asset-stages/",payload:v(c),blockers:[c.asset_procedure_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(zt(m))}).catch(()=>{this.dispatch(oi(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=li(e.uuid)(i.getState());if(!a)throw new Error(`No asset stage with uuid ${e.uuid} found in the store`);const n={...a,...e};this.dispatch(zt(n));const c=this.enqueueRequest({description:"Update asset stage",method:l.PATCH,url:`/asset-stages/${a.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(zt(r))}).catch(()=>{this.dispatch(Ed(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=li(e)(a);if(!n)throw new Error(`No asset stage with uuid ${e} found in the store`);return this.dispatch(oi(e)),this.enqueueRequest({description:"Delete asset stage",method:l.DELETE,url:`/asset-stages/${e}/`,blockers:[e],blocks:[]}).catch(c=>{throw this.dispatch(ui(n)),c})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset stages",method:l.GET,url:"/asset-stages/",queryParams:{asset_procedure_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Md(a)),a}}class Zb extends Ke{constructor(){super(...arguments);T(this,"name","Asset Type Attachment");T(this,"url","/asset-type-attachments");T(this,"addAttachments",mi);T(this,"updateAttachments",Ud);T(this,"removeAttachments",pi);T(this,"removeAttachment",Cd);T(this,"setAttachment",Dd);T(this,"selectAttachment",$d)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,asset_type:i.modelUuid})}buildAttachmentPayload(i){return{...i,asset_type:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.assetTypeUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=await this.enqueueRequest({immediate:!0,description:"Get asset type attachments",method:l.GET,url:`${this.url}/`,queryParams:{asset_type__organization:i},blocks:[],blockers:[]},a);return this.dispatch(zd(n)),n}}class Jb extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const o of e){const{fieldsRevisionUuid:h,fieldIdentifier:p,file:y}=o,A=await this.getFilePayload(y);A.sha1 in n||(n[A.sha1]=A);const g=b({file:URL.createObjectURL(y),file_type:y.type,file_name:y.name,file_sha1:A.sha1,created_by:a,fields_revision:h,submitted_at:i,field_identifier:p});c.push(g);const F={uuid:g.uuid,file_name:y.name,field_identifier:p,file_extension:A.extension,file_sha1:A.sha1,fields_revision:h};r.push(F)}this.dispatch(Wd(c));const u=this.enqueueRequest({description:"Add asset type fields attachments",method:l.POST,url:"/asset-type-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(o=>o.fields_revision),blocks:c.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(Kd(o.attachments))}).catch(()=>{this.dispatch(Yd(c.map(o=>o.uuid)))}),[c,u.then(({attachments:o})=>o)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset type fields attachments",method:l.GET,url:"/asset-type-fields-attachments/",queryParams:{fields_revision__asset_type__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(Hd(a)),a}}class Xb extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(eu(c));const r=this.enqueueRequest({description:"Add Asset Type Fields",method:l.POST,url:"/asset-type-fields/",payload:v(c),blockers:[c.asset_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(tu(m))}).catch(m=>{throw this.dispatch(su(c.uuid)),m}),[c,r]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get Asset Type Fields",method:l.GET,url:"/asset-type-fields/",queryParams:{asset_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(xd(a)),a}}class Qb extends j{async bulkAdd(e,i){var o;const a=new Date().toISOString(),n=(o=this.client.store.getState().userReducer.currentUser)==null?void 0:o.id,c=Ze(e,i??e.length),r=[],u=[];for(const h of c){const p={},y=[];for(const A of h){const{fieldValuesUuid:g,fieldIdentifier:F,file:R}=A,w=await this.getFilePayload(R);w.sha1 in p||(p[w.sha1]=w);const z=b({file:URL.createObjectURL(R),file_type:R.type,file_name:R.name,file_sha1:w.sha1,created_by:n,field_values:g,submitted_at:a,field_identifier:F});r.push(z);const Ne={uuid:z.uuid,file_name:R.name,file_sha1:w.sha1,file_extension:w.extension,field_identifier:F,field_values:g};y.push(Ne)}u.push({submitted_at:a,attachments:y,files:Object.values(p)})}this.dispatch(Ct(r));const m=u.map(h=>this.enqueueRequest({description:"Add asset type field values attachments",method:l.POST,url:"/asset-type-field-values-attachments/bulk/",payload:h,blockers:h.attachments.map(p=>p.field_values),blocks:h.attachments.map(p=>p.uuid)}));return Promise.all(m).then(h=>{for(const y of h)this.processPresignedUrls(y.presigned_urls);const p=h.flatMap(y=>y.attachments);this.dispatch(ru(p))}).catch(h=>{throw this.dispatch(kt(r.map(p=>p.uuid))),h}),[r,m.map(h=>h.then(({attachments:p})=>p))]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=uu(e)(a);this.dispatch(kt(e));try{await this.enqueueRequest({description:"Delete asset type field values attachments",method:l.DELETE,url:"/asset-type-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(Ct(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset type field values attachments",method:l.GET,url:"/asset-type-field-values-attachments/",queryParams:{limit:We,paginate:!0,field_values__asset__project:e,latest:!0},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset type field values attachments",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(cu(n)),n}}class xb extends _{add(e){var r;const{store:i}=this.client,a=i.getState(),n=b({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add asset type field values",method:l.POST,url:"/asset-type-field-values/",payload:v(n),blockers:[e.asset,e.fields_revision],blocks:[n.uuid]});return this.dispatch(Ii(n)),c.then(u=>(this.dispatch(ht(u)),u)).catch(()=>{this.dispatch(gi(n.uuid))}),[n,c]}bulkAdd(e,i){var m;const a=new Date().toISOString(),n=[],c=Ze(e.payloads,i??e.payloads.length),r=[];for(const o of c){const h=[];for(const p of o){const y=b({...p,values:p.values,created_by:(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,submitted_at:a});n.push(y),h.push({uuid:y.uuid,asset:p.asset,fields_revision:p.fields_revision,published_at:p.published_at,values:y.values})}r.push({submitted_at:a,values:e.values,field_values:h})}this.dispatch(pu(n));const u=[];for(const o of r){const h=o.field_values.map(g=>g.asset),p=o.field_values.map(g=>g.fields_revision),y=o.field_values.map(g=>g.uuid),A=this.enqueueRequest({description:"Bulk add asset type field values",method:l.POST,url:"/asset-type-field-values/bulk/",payload:o,blockers:[...h,...p],blocks:y});u.push(A)}return Promise.all(u).then(o=>{this.dispatch(yu(o.flat()))}).catch(()=>{this.dispatch(Au(n.map(o=>o.uuid)))}),[n,u]}update(e){const{store:i}=this.client,a=i.getState(),n=Fi(e.uuid)(a);if(!n)throw new Error(`Expected AssetTypeFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(ht(c));const r=this.enqueueRequest({description:"Delete asset type field values",method:l.PATCH,url:`/asset-type-field-values/${e.uuid}/`,payload:e,blockers:[c.uuid,c.fields_revision,c.asset],blocks:[c.uuid]});return r.then(u=>{this.dispatch(ht(u))}).catch(()=>{this.dispatch(ht(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Fi(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=ou(e)(a);this.dispatch(gi(e)),this.dispatch(kt(c.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset type field values",method:l.DELETE,url:`/asset-type-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(Ii(n)),this.dispatch(Ct(c)),r}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset type field values",method:l.GET,url:"/asset-type-field-values/",queryParams:{limit:V,paginate:!0,asset__project:e,latest:!0},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset type field values",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(mu(n)),n}}class eF extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(Oi(c));const r=this.enqueueRequest({description:"Create asset type identifier",method:l.POST,url:"/asset-type-identifiers/",payload:v(c),blockers:[c.asset_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(mt(m))}).catch(()=>{this.dispatch(_i(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=Ri(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset type identifier with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(mt(n));const c=this.enqueueRequest({description:"Update asset type identifier",method:l.PATCH,url:`/asset-type-identifiers/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(mt(r))}).catch(()=>{this.dispatch(mt(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Ri(e)(a);if(!n)throw new Error(`Expected asset type identifier with uuid ${e} to exist`);this.dispatch(_i(e));try{return await this.enqueueRequest({description:"Delete asset type identifier",method:l.DELETE,url:`/asset-type-identifiers/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(Oi(n)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset type identifiers",method:l.GET,url:"/asset-type-identifiers/",queryParams:{asset_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Iu(a)),a}}class tF extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(wi(c));const r=this.enqueueRequest({description:"Create asset type identifier value",method:l.POST,url:"/asset-type-identifier-values/",payload:v(c),blockers:[e.asset,e.asset_type_identifier],blocks:[c.uuid]});return r.then(m=>{this.dispatch(pt(m))}).catch(()=>{this.dispatch(Mi(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=Vi(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset type identifier value with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(pt(n));const c=this.enqueueRequest({description:"Update asset type identifier value",method:l.PATCH,url:`/asset-type-identifier-values/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(pt(r))}).catch(()=>{this.dispatch(pt(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Vi(e)(a);if(!n)throw new Error(`Expected asset type identifier value with uuid ${e} to exist`);this.dispatch(Mi(e));try{return await this.enqueueRequest({description:"Delete asset type identifier value",method:l.DELETE,url:`/asset-type-identifier-values/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(wi(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset type identifier values",method:l.GET,url:"/asset-type-identifier-values/",queryParams:{limit:V,paginate:!0,asset__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset type identifier values",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Ou(n)),n}}class sF extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(qi(c));const r=this.enqueueRequest({description:"Create asset type",method:l.POST,url:"/asset-types/",payload:v(c),blockers:[],blocks:[c.uuid]});return r.then(m=>{this.dispatch(yt(m))}).catch(()=>{this.dispatch(zi(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=Ui(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset type with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(yt(n));const c=this.enqueueRequest({description:"Update asset type",method:l.PATCH,url:`/asset-types/${e.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(yt(r))}).catch(()=>{this.dispatch(yt(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Ui(e)(a);if(!n)throw new Error(`Expected asset type with uuid ${e} to exist`);const c=ei(e)(a),r=Gd(e)(a);return this.dispatch(zi(e)),this.dispatch(Qs(c.map(u=>u.uuid))),this.dispatch(pi(r.map(({uuid:u})=>u))),this.enqueueRequest({description:"Delete asset type",method:l.DELETE,url:`/asset-types/${e}/`,blockers:[e],blocks:[]}).catch(u=>{throw this.dispatch(qi(n)),this.dispatch(qt(c)),this.dispatch(mi(r)),u})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset types",method:l.GET,url:"/asset-types/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(wu(a)),a}}class iF extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(ki(c));const r=this.enqueueRequest({description:"Create Category",method:l.POST,url:"/categories/",payload:v(c),blockers:[e.project],blocks:[c.uuid]});return[c,r]}update(e){const i=this.client.store.getState(),a=$i(e.uuid)(i);if(!a)throw new Error(`Expected an existing category with uuid ${e.uuid}`);const n={...a,...e};this.dispatch(Uu(n));const c=this.enqueueRequest({description:"Edit Category",method:l.PATCH,url:`/categories/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return[n,c]}remove(e){const{store:i}=this.client,a=$i(e)(i.getState());if(!a)throw new Error(`No category with uuid ${e} found in the store`);this.dispatch(Cu(e));const n=this.enqueueRequest({description:"Delete Category",method:l.DELETE,url:`/categories/${a.uuid}/`,blockers:[a.uuid],blocks:[]});return n.catch(()=>{this.dispatch(ki(a))}),n}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get categories",method:l.GET,url:"/categories/",queryParams:{project__organization:e},blocks:[],blockers:[]},i);return this.dispatch(Du(a)),a}}class aF extends Ke{constructor(){super(...arguments);T(this,"name","Document Attachment");T(this,"url","/document-attachments");T(this,"addAttachments",Lu);T(this,"updateAttachments",Hu);T(this,"removeAttachments",Ku);T(this,"removeAttachment",Wu);T(this,"setAttachment",Nu);T(this,"selectAttachment",Ju)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,document:i.modelUuid})}buildAttachmentPayload(i){return{...i,document:i.modelUuid}}async bulkAdd(i){var p;const{store:a}=this.client,n=(p=a.getState().userReducer.currentUser)==null?void 0:p.id,c=new Date().toISOString(),r=[],u=[],m={},o={};for(const y of i){const{documentUuid:A,file:g}=y,F=await this.getFilePayload(g);F.sha1 in m||(m[F.sha1]=F,o[F.sha1]=[]);const R=this.buildOfflineAttachment({file:g,file_sha1:F.sha1,submitted_at:c,created_by:n,description:"",modelUuid:A});r.push(R),u.push({uuid:R.uuid,file_name:R.file_name,file_sha1:R.file_sha1,file_extension:F.extension,description:R.description,document:A}),o[F.sha1].push(R.uuid)}this.dispatch(this.addAttachments(r));const h=this.enqueueRequest({description:"Attach files to document",method:l.POST,url:"/document-attachments/bulk/",payload:{submitted_at:c,attachments:u,files:Object.values(m)},blocks:r.map(y=>y.uuid),blockers:r.map(y=>y.file_sha1)});return h.then(({attachments:y,presigned_urls:A})=>{this.dispatch(this.updateAttachments(y));const g=this.processPresignedUrls(A);for(const[F,R]of Object.entries(g))R.then(()=>{const w=o[F];for(const z of w)this.makeReadable(z)})}).catch(()=>{this.dispatch(this.removeAttachments(r.map(y=>y.uuid)))}),[r,h.then(({attachments:y})=>y)]}async delete(i){return this._delete(i)}makeReadable(i){this.enqueueRequest({description:"Add attachment to AI assistant",method:l.PATCH,url:`/document-attachments/${i}/`,payload:{readable_to_assistant:!0},blockers:["index-document-attachment",i],blocks:["index-document-attachment"]})}async refreshStore(i,a){const n=await this.enqueueRequest({immediate:!0,description:"Get document attachments",method:l.GET,url:"/document-attachments/",queryParams:{document__project__organization:i},blocks:[],blockers:[]},a),c=await this.enqueueRequest({immediate:!0,description:"Get document attachments",method:l.GET,url:"/document-attachments/",queryParams:{document__organization:i},blocks:[],blockers:[]},a),r=[...n,...c];return this.dispatch(Gu(r)),r}}class nF extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(eo([c]));const r=this.enqueueRequest({description:"Create Document",method:l.POST,url:"/documents/",payload:v(c),queryParams:{parent_document:c.parent_document??void 0},blockers:c.parent_document?[c.parent_document]:[],blocks:[c.uuid]});return r.catch(()=>{this.dispatch(Ni([c.uuid]))}),[c,r]}update(e){const{store:i}=this.client,a=i.getState().documentsReducer.documents[e.uuid];if(!a)throw new Error(`attempting to update a document with uuid ${e.uuid} that does not exist in store.documents`);const n={...a,...e};this.dispatch(et([n]));const c=this.enqueueRequest({description:"Update Document",method:l.PATCH,url:`/documents/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.catch(()=>{et([a])}),[n,c]}delete(e){const{store:i}=this.client,a=$t(i.getState()),n=to(e)(i.getState());if(!n)throw new Error(`attempting to delete a document with uuid ${e} that does not exist in store.documents`);const c=n.parent_document?a[n.parent_document]:void 0;this.dispatch(Ni([e]));const r=this.enqueueRequest({description:"Delete Document",method:l.DELETE,url:`/documents/${e}/`,blockers:[e],blocks:[]});return r.then(u=>{this.dispatch(et(u))}).catch(()=>{this.dispatch(et([n])),c&&this.dispatch(et([c]))}),r}async refreshStore(e,i){const a=this.enqueueRequest({immediate:!0,description:"Get project documents",method:l.GET,url:"/documents/",queryParams:{project__organization:e},blockers:[],blocks:[]},i),n=this.enqueueRequest({immediate:!0,description:"Get organization documents",method:l.GET,url:"/documents/",queryParams:{organization:e},blockers:[],blocks:[]},i),c=[...await a,...await n];return this.dispatch(xu(c)),c}}class cF extends _{async add(e,i){return this.enqueueRequest({description:"Add email domain to organization",method:l.POST,url:"/organization-email-domains/",payload:{email:i,organization:e},blockers:[e,"create-org"],blocks:[]})}async remove(e){return this.dispatch(co(e.uuid)),this.enqueueRequest({description:"Remove email domain from organization",method:l.DELETE,url:`/organization-email-domains/${e.uuid}/`,blockers:[e.domain],blocks:[]}).catch(i=>{throw this.dispatch(no(e)),i})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch email domains for organization",method:l.GET,url:"/organization-email-domains/",queryParams:{organization:e},blockers:[e],blocks:[]},i);return this.dispatch(ao(a)),a}}class rF extends _{async getVerificationCode(e){return this.enqueueRequest({description:"Get verification code",method:l.GET,url:`/verification/email-verification/${e}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}validateVerificationCode(e,i=void 0){return this.enqueueRequest({description:"Validate verification code",method:l.POST,url:`/verification/email-verification/${e}/`,isAuthNeeded:!1,payload:i,blockers:[],blocks:[]})}}const xt={},tc=new Set;let es=0,sc=0,ic=0;const dF=20;class uF extends _{constructor(){super(...arguments);T(this,"host");T(this,"_dbPromise",ry.openDB("fileCache",1,{upgrade(i){i.createObjectStore("files")}}))}async renewUploadUrl(i){const a=await this.fetchCache(i);if(!a)throw new Error(`File with sha1 ${i} not found in cache`);const n=await cs(a,i),c=await this.enqueueRequest({description:"Get S3 URL",method:l.GET,url:"/authentication/files/presigned-upload-url/",queryParams:{sha1:await xe(a),file_type:a.type,extension:a.name.split(".").pop(),size:a.size.toString()},blockers:[],blocks:[`s3-${n}`]});return"url"in c&&this.dispatch(mo({sha1:i,...c})),c}async addCache(i,a){if(tc.has(a))return;if(!i.type){const r=i.name.split("."),u=r[r.length-1];i=new File([i],i.name,{type:u})}if(!i.name||!i.size||!i.type)throw new Error("Cannot add files to cache that do not have a name, size and type.");const n=await this._dbPromise;!!await n.get("files",a)?(console.error("File already cached (this is unexpected at this point):",i.name,a),es++):(await n.put("files",i,a),sc++),tc.add(a),ic++,ic%dF===0&&console.debug(`File cache summary: ${es} hits and ${sc} misses, ${es/(es+sc)*100}% hit rate over ${ic} calls to addCache.`)}async removeCache(i){await(await this._dbPromise).delete("files",i),tc.delete(i)}async fetchCache(i){return(await this._dbPromise).get("files",i)}async getOrRenewUploadUrl(i){const a=this.client.store.getState();return po(i)(a)??await this.renewUploadUrl(i)}async uploadFileToS3(i){const a=await this.fetchCache(i);if(!a)throw new Error(`File with sha1 ${i} not found in cache`);const n=await cs(a,i),c={file_name:a.name,file_sha1:i,file:n},r=await this.getOrRenewUploadUrl(i);if("warning"in r){if(r.warning==="already_uploaded")return[c,Promise.resolve(void 0)];throw new Error(r.warning)}const u=r.url,m=this.enqueueRequest({url:u,description:"Upload file",method:l.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:i,blockers:[`s3-${n}`],blocks:[i],s3url:r});return[c,m]}async fetchFileFromUrl(i,a,n){const c=i.split("?")[0]??i,r=await this.fetchCache(a);if(r){if(!r.name)throw new Error("Cached file unexpectedly has no name.");return r}if(i.startsWith("blob:")){const h=await fc(i),p=new File([h],n??a,{type:h.type});return await this.addCache(p,a),p}let u=xt[c],m=!0;u?m=!1:(u=new Promise(h=>{this.enqueueRequest({description:"Download file",method:l.GET,url:i,isExternalUrl:!0,isResponseBlob:!0,isAuthNeeded:!1,blockers:[a],blocks:[a]}).then(p=>{const y=new File([p],n??a,{type:p.type});h(y)})}),xt[c]=u);let o;try{o=await u}catch(h){throw m&&h instanceof U&&delete xt[c],h}if(m){const h=await xe(o);if(h!==a){const A=`The hash of the file returned from the server (${h}) does not match the
4
+ Retries:`,i),!(t instanceof Error))throw console.error("ENCOUNTERED NON-ERROR ERROR:",t,"(throwing immediately, which may lead to unexpected behavior)"),t;const a=at(),n=a.getState().outboxReducer.deletedRequests,r=e.payload.uuid;function u(){a.dispatch(Hm(r));const h=Xe();if(!h)throw new Error("Outbox coordinator not set");h.remove(e.payload.uuid);const p=e.meta.offline.rollback;throw p&&(console.warn("Rolling back request due to SDK error:",e),a.dispatch(p)),t}if(t instanceof U&&t.options.discard)return console.debug("Discarding request due to explicit discard:",e),u();if(n.includes(r))return console.debug("Discarding request due to deletion:",e),u();if(t instanceof U){const h=t.status||((o=t.response)==null?void 0:o.status);if(h||console.warn("Error has no status code:",t),h!==void 0&&ty.includes(h)){console.warn("Discarding request due to error:",t,`
5
+ Action:`,e);const p=Xe();if(!p)throw new Error("Outbox coordinator not set");p.remove(e.payload.uuid),t.options.discard=!0,u()}}console.debug("Registering a retry for request:",e.payload.uuid);const m=Xe();if(!m)throw new Error("Outbox coordinator not set");return m.registerRetry(e.payload.uuid),!1}function Wb(t,e,i){var a;return(a=Xe())==null?void 0:a.peek()}function Kb(t,e){return at().dispatch(Wm(new Date().getTime())),gn}const st="An unknown error occurred",Yb=500,sy=["non_field_errors","detail"];function Zb(t,e){let i;if(t!=null&&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(([c,n])=>typeof n=="string"?sy.includes(c)?n:`${c}: ${n}`:Array.isArray(n)?sy.includes(c)?n.join(`
6
+ `):n.map(r=>`${c}: ${r}`).join(`
7
+ `):`${c}: ${JSON.stringify(n)}`).join(`
8
+ `)}catch(c){console.error("Failed to extract error message from response body",c)}}else typeof t.body=="string"&&(i=t.body);else t!=null&&t.text?i=t.text:e instanceof Error&&(i=e.message);return!i||i.length>Yb?st:i}class U extends Error{constructor(i){super(st);T(this,"status");T(this,"response");T(this,"message");T(this,"options");const{response:a,innerError:c}=i;this.message=i.message??Zb(a,c)??st,this.status=(a==null?void 0:a.status)??0,this.response=a,i.discard=i.discard??!1,this.options=i}}class Jb extends Yp{constructor(e){super(e)}}class _ extends Yp{constructor(i,a){super(i);T(this,"auth");this.auth=a}}class Xb extends _{async startConversation(e,i){return this.enqueueRequest({description:"Start agent conversation",method:l.POST,url:"/agents/prompt/",payload:{prompt:e,active_project:i},blockers:["prompt"],blocks:["prompt"]}).then(a=>(this.dispatch(zn(a)),a))}async continueConversation(e,i,a){return this.enqueueRequest({description:"Prompt agent",method:l.POST,url:"/agents/prompt/",payload:{prompt:e,active_project:a},blockers:["prompt"],blocks:["prompt"],queryParams:{conversation_id:i}}).then(c=>{this.dispatch(Un(c))})}async fetchDetails(e){return this.enqueueRequest({description:"Get agent conversation",method:l.GET,url:`/agents/conversations/${e}/`,blockers:["conversation"],blocks:["conversation"]}).then(i=>{this.dispatch(Dn(i))})}async rate(e,i){return this.enqueueRequest({description:"Rate agent response",method:l.PUT,url:`/agents/responses/${e}/rate/`,payload:{rating:i},blockers:["rate"],blocks:["rate"]})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get agent conversation history",method:l.GET,url:"/agents/conversations/",queryParams:{project:e},blockers:["agent-conversations"],blocks:["agent-conversations"]},i);return this.dispatch(qn(a)),a}}const V=1e3,Ke=200;class j extends _{getNumberOfAttachmentsWithSha1(e){const{issueAttachmentReducer:i,assetAttachmentReducer:a,assetTypeAttachmentReducer:c,documentAttachmentReducer:n,projectAttachmentReducer:r,formRevisionAttachmentReducer:u,formSubmissionAttachmentReducer:m,geoImageReducer:o,assetTypeFieldsAttachmentReducer:h,assetTypeFieldValuesAttachmentReducer:p,issueTypeFieldsAttachmentReducer:y,issueTypeFieldValuesAttachmentReducer:A}=this.client.store.getState();return[].concat(Object.values(i.instances),Object.values(a.instances),Object.values(c.instances),Object.values(n.instances),Object.values(r.instances),Object.values(u.instances),Object.values(m.instances),Object.values(o.instances),Object.values(h.instances),Object.values(p.instances),Object.values(y.instances),Object.values(A.instances)).filter(F=>F.file_sha1===e).length}processPresignedUrls(e){const i={};for(const[a,c]of Object.entries(e))i[a]=this.enqueueRequest({url:c.url,description:"Upload file to S3",method:l.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:a,blockers:[`s3-${c.fields.key}`],blocks:[a],s3url:c});return i}async getFilePayload(e){const i=await et(e),a={sha1:i,file_type:e.type,extension:e.name.split(".").pop(),size:e.size};return await this.client.files.addCache(e,i),a}}class Ye extends j{async _bulkAdd(e){var o;const{store:i}=this.client,a=(o=i.getState().userReducer.currentUser)==null?void 0:o.id,c=new Date().toISOString(),n=[],r=[],u={};for(const h of e){const{modelUuid:p,file:y}=h,A=await this.getFilePayload(y);A.sha1 in u||(u[A.sha1]=A);const g=this.buildOfflineAttachment({file:y,file_sha1:A.sha1,submitted_at:c,created_by:a,description:"",modelUuid:p});n.push(g),r.push(this.buildAttachmentPayload({uuid:g.uuid,file_name:g.file_name,file_sha1:g.file_sha1,file_extension:A.extension,description:g.description,modelUuid:p}))}this.dispatch(this.addAttachments(n));const m=this.enqueueRequest({description:`Add ${this.name}`,method:l.POST,url:`${this.url}/bulk/`,payload:{submitted_at:c,attachments:r,files:Object.values(u)},blocks:n.map(h=>h.uuid),blockers:n.map(h=>h.file_sha1)});return m.then(({attachments:h,presigned_urls:p})=>{this.dispatch(this.updateAttachments(h)),this.processPresignedUrls(p)}).catch(()=>{this.dispatch(this.removeAttachments(n.map(h=>h.uuid)))}),[n,m.then(({attachments:h})=>h)]}async _delete(e){const{store:i}=this.client,a=this.selectAttachment(e)(i.getState());if(!a)throw new Error(`Attempting to delete attachment with uuid ${e} that does not exist in the store`);this.dispatch(this.removeAttachment(a.uuid));const c=this.enqueueRequest({description:`Delete ${this.name}`,method:l.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return c.then(()=>{this.getNumberOfAttachmentsWithSha1(a.file_sha1)===0&&this.client.files.removeCache(a.file_sha1)}).catch(()=>{this.dispatch(this.setAttachment(a))}),c}}class Qb extends Ye{constructor(){super(...arguments);T(this,"name","Asset Attachment");T(this,"url","/asset-attachments");T(this,"initializeAttachments",hs);T(this,"addAttachments",ms);T(this,"updateAttachments",$n);T(this,"removeAttachments",ps);T(this,"removeAttachment",Gn);T(this,"setAttachment",Bn);T(this,"selectAttachment",Hn)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,asset:i.modelUuid})}buildAttachmentPayload(i){return{...i,asset:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.assetUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=(await this.performPagination({immediate:!0,description:"Get asset attachments",method:l.GET,url:`${this.url}/`,queryParams:{limit:Ke,paginate:!0,asset__project:i},blocks:[],blockers:[]},r=>({immediate:!0,description:"Get asset attachments",method:l.GET,url:r,blockers:[],blocks:[]}),a)).flat();return this.dispatch(hs(n)),n}}class xb extends Ye{constructor(){super(...arguments);T(this,"name","Asset Procedure Attachment");T(this,"url","/asset-procedure-type-attachments");T(this,"addAttachments",Jn);T(this,"updateAttachments",Qn);T(this,"removeAttachments",er);T(this,"removeAttachment",xn);T(this,"setAttachment",Xn);T(this,"selectAttachment",ar)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,asset_procedure_type:i.modelUuid})}buildAttachmentPayload(i){return{...i,asset_procedure_type:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.assetProcedureTypeUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const c=await this.enqueueRequest({immediate:!0,description:"Get asset procedure attachments",method:l.GET,url:`${this.url}/`,queryParams:{asset_procedure_type__organization:i},blocks:[],blockers:[]},a);return this.dispatch(Zn(c)),c}}class eF extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,c={},n=[],r=[];for(const o of e){const{fieldsRevisionUuid:h,fieldIdentifier:p,file:y}=o,A=await this.getFilePayload(y);A.sha1 in c||(c[A.sha1]=A);const g=b({file:URL.createObjectURL(y),file_type:y.type,file_name:y.name,file_sha1:A.sha1,created_by:a,fields_revision:h,submitted_at:i,field_identifier:p});n.push(g);const F={uuid:g.uuid,file_name:y.name,field_identifier:p,file_extension:A.extension,file_sha1:A.sha1,fields_revision:h};r.push(F)}this.dispatch(rr(n));const u=this.enqueueRequest({description:"Add asset procedure type fields attachments",method:l.POST,url:"/asset-procedure-type-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(c)},blockers:n.map(o=>o.fields_revision),blocks:n.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(dr(o.attachments))}).catch(()=>{this.dispatch(ur(n.map(o=>o.uuid)))}),[n,u.then(({attachments:o})=>o)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset procedure type fields attachments",method:l.GET,url:"/asset-procedure-type-fields-attachments/",queryParams:{fields_revision__asset_procedure_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(nr(a)),a}}class tF extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,c=new Date().toISOString(),n=b({...e,created_by:a,submitted_at:c});this.dispatch(yr(n));const r=this.enqueueRequest({description:"Add Asset Procedure Type Fields",method:l.POST,url:"/asset-procedure-type-fields/",payload:v(n),blockers:[n.asset_procedure_type],blocks:[n.uuid]});return r.then(m=>{this.dispatch(Ar(m))}).catch(m=>{throw this.dispatch(fr(n.uuid)),m}),[n,r]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get Asset Procedure Type Fields",method:l.GET,url:"/asset-procedure-type-fields/",queryParams:{asset_procedure_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(pr(a)),a}}function Je(t,e){const i=[];let a=0;const c=t.length;for(;a<c;)i.push(t.slice(a,a+=e));return i}class sF extends j{async bulkAdd(e,i){var o;const a=new Date().toISOString(),c=(o=this.client.store.getState().userReducer.currentUser)==null?void 0:o.id,n=Je(e,i??e.length),r=[],u=[];for(const h of n){const p={},y=[];for(const A of h){const{fieldValuesUuid:g,fieldIdentifier:F,file:R}=A,w=await this.getFilePayload(R);w.sha1 in p||(p[w.sha1]=w);const z=b({file:URL.createObjectURL(R),file_type:R.type,file_name:R.name,file_sha1:w.sha1,created_by:c,field_values:g,submitted_at:a,field_identifier:F});r.push(z);const He={uuid:z.uuid,file_name:R.name,file_sha1:w.sha1,file_extension:w.extension,field_identifier:F,field_values:g};y.push(He)}u.push({submitted_at:a,attachments:y,files:Object.values(p)})}this.dispatch(wt(r));const m=u.map(h=>this.enqueueRequest({description:"Add asset procedure type field values attachments",method:l.POST,url:"/asset-procedure-type-field-values-attachments/bulk/",payload:h,blockers:h.attachments.map(p=>p.field_values),blocks:h.attachments.map(p=>p.uuid)}));return Promise.all(m).then(h=>{for(const y of h)this.processPresignedUrls(y.presigned_urls);const p=h.flatMap(y=>y.attachments);this.dispatch(br(p))}).catch(h=>{throw this.dispatch(Et(r.map(p=>p.uuid))),h}),[r,m.map(h=>h.then(({attachments:p})=>p))]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),c=Or(e)(a);this.dispatch(Et(e));try{await this.enqueueRequest({description:"Delete asset procedure type field values attachments",method:l.DELETE,url:"/asset-procedure-type-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(n){throw this.dispatch(wt(c)),n}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get asset procedure type field values attachments",method:l.GET,url:"/asset-procedure-type-field-values-attachments/",queryParams:{limit:Ke,paginate:!0,field_values__asset_procedure__project:e,latest:!0},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get asset procedure type field values attachments",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(gr(c)),c}}class iF extends _{add(e){var r;const{store:i}=this.client,a=i.getState(),c=b({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),n=this.enqueueRequest({description:"Add asset procedure type field values",method:l.POST,url:"/asset-procedure-type-field-values/",payload:v(c),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[c.uuid]});return this.dispatch(bs(c)),n.then(u=>(this.dispatch(nt(u)),u)).catch(()=>{this.dispatch(Fs(c.uuid))}),[c,n]}bulkAdd(e,i){var m;const a=new Date().toISOString(),c=[],n=Je(e.payloads,i??e.payloads.length),r=[];for(const o of n){const h=[];for(const p of o){const y=b({...p,values:p.values,created_by:(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,submitted_at:a});c.push(y),h.push({uuid:y.uuid,asset:p.asset,fields_revision:p.fields_revision,asset_procedure:p.asset_procedure,published_at:p.published_at,values:y.values})}r.push({submitted_at:a,values:e.values,field_values:h})}this.dispatch(wr(c));const u=[];for(const o of r){const h=o.field_values.map(F=>F.asset),p=o.field_values.map(F=>F.fields_revision),y=o.field_values.map(F=>F.asset_procedure),A=o.field_values.map(F=>F.uuid),g=this.enqueueRequest({description:"Bulk add asset procedure type field values",method:l.POST,url:"/asset-procedure-type-field-values/bulk/",payload:o,blockers:[...h,...p,...y],blocks:A});u.push(g)}return Promise.all(u).then(o=>{this.dispatch(Er(o.flat()))}).catch(()=>{this.dispatch(Mr(c.map(o=>o.uuid)))}),[c,u]}update(e){const{store:i}=this.client,a=i.getState(),c=Os(e.uuid)(a);if(!c)throw new Error(`Expected AssetProcedureTypeFieldValues with uuid ${e.uuid} to exist`);const n={...c,...e};this.dispatch(nt(n));const r=this.enqueueRequest({description:"Update asset procedure type field values",method:l.PATCH,url:`/asset-procedure-type-field-values/${e.uuid}/`,payload:e,blockers:[n.fields_revision,n.asset,n.asset_procedure],blocks:[n.uuid]});return r.then(u=>{this.dispatch(nt(u))}).catch(()=>{this.dispatch(nt(c))}),[n,r]}async delete(e){const{store:i}=this.client,a=i.getState(),c=Os(e)(a);if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const n=_r(e)(a);this.dispatch(Fs(e)),this.dispatch(Et(n.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset procedure type field values",method:l.DELETE,url:`/asset-procedure-type-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(bs(c)),this.dispatch(wt(n)),r}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get asset procedure type field values",method:l.GET,url:"/asset-procedure-type-field-values/",queryParams:{limit:V,paginate:!0,asset_procedure__project:e,latest:!0},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get asset procedure type field values",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(vr(c)),c}}class aF extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,c=new Date().toISOString(),n=b({...e,created_by:a,submitted_at:c});this.dispatch(Rs(n));const r=this.enqueueRequest({description:"Create asset procedure",method:l.POST,url:"/asset-procedures/",payload:v(n),blockers:[e.asset_procedure_type,e.asset_type],blocks:[n.uuid]});return r.then(m=>{this.dispatch(rt(m))}).catch(()=>{this.dispatch(vs(n.uuid))}),[n,r]}update(e){const{store:i}=this.client,a=Ms(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset procedure with uuid ${e.uuid} to exist`);const c={...a,...e};this.dispatch(rt(c));const n=this.enqueueRequest({description:"Update asset procedure",method:l.PATCH,url:`/asset-procedures/${e.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return n.then(r=>{this.dispatch(rt(r))}).catch(()=>{this.dispatch(rt(a))}),[c,n]}async remove(e){const{store:i}=this.client,a=i.getState(),c=Ms(e)(a);if(!c)throw new Error(`Expected asset procedure with uuid ${e} to exist`);return this.dispatch(vs(e)),this.enqueueRequest({description:"Delete asset procedure",method:l.DELETE,url:`/asset-procedures/${e}/`,blockers:[e],blocks:[]}).catch(n=>{throw this.dispatch(Rs(c)),n})}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get asset procedures",method:l.GET,url:"/asset-procedures/",queryParams:{limit:V,paginate:!0,project:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get asset procedures",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(zr(c)),c}}class cF extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,c=new Date().toISOString(),n=b({...e,created_by:a,submitted_at:c});this.dispatch(js(n));const r=this.enqueueRequest({description:"Create asset procedure type",method:l.POST,url:"/asset-procedure-types/",payload:v(n),blockers:[],blocks:[n.uuid]});return r.then(m=>{this.dispatch(dt(m))}).catch(()=>{this.dispatch(qs(n.uuid))}),[n,r]}update(e){const{store:i}=this.client,a=Ds(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset procedure type with uuid ${e.uuid} to exist`);const c={...a,...e};this.dispatch(dt(c));const n=this.enqueueRequest({description:"Update asset procedure type",method:l.PATCH,url:`/asset-procedure-types/${e.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return n.then(r=>{this.dispatch(dt(r))}).catch(()=>{this.dispatch(dt(a))}),[c,n]}async remove(e){const{store:i}=this.client,a=i.getState(),c=Ds(e)(a);if(!c)throw new Error(`Expected asset procedure type with uuid ${e} to exist`);const n=kr(e)(a);return this.dispatch(qs(e)),this.dispatch(Ur(n.map(({uuid:r})=>r))),this.enqueueRequest({description:"Delete asset procedure type",method:l.DELETE,url:`/asset-procedure-types/${e}/`,blockers:[e],blocks:[]}).catch(r=>{throw this.dispatch(js(c)),this.dispatch(Dr(n)),r})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset procedure types",method:l.GET,url:"/asset-procedure-types/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch($r(a)),a}}class nF extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,c={},n=[],r=[];for(const o of e){const{fieldsRevisionUuid:h,fieldIdentifier:p,file:y}=o,A=await this.getFilePayload(y);A.sha1 in c||(c[A.sha1]=A);const g=b({file:URL.createObjectURL(y),file_type:y.type,file_name:y.name,file_sha1:A.sha1,created_by:a,fields_revision:h,submitted_at:i,field_identifier:p});n.push(g);const F={uuid:g.uuid,file_name:y.name,field_identifier:p,file_extension:A.extension,file_sha1:A.sha1,fields_revision:h};r.push(F)}this.dispatch(Wr(n));const u=this.enqueueRequest({description:"Add asset procedure step fields attachments",method:l.POST,url:"/asset-procedure-step-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(c)},blockers:n.map(o=>o.fields_revision),blocks:n.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(Kr(o.attachments))}).catch(()=>{this.dispatch(Yr(n.map(o=>o.uuid)))}),[n,u.then(({attachments:o})=>o)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset procedure step fields attachments",method:l.GET,url:"/asset-procedure-step-fields-attachments/",queryParams:{fields_revision__asset_procedure_step__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Hr(a)),a}}class rF extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,c=new Date().toISOString(),n=b({...e,created_by:a,submitted_at:c});this.dispatch(ks(n));const r=this.enqueueRequest({description:"Add Asset Procedure Step Fields",method:l.POST,url:"/asset-procedure-step-fields/",payload:v(n),blockers:[n.asset_procedure_step],blocks:[n.uuid]});return r.then(m=>{this.dispatch(ut(m))}).catch(m=>{throw this.dispatch(Bs(n.uuid)),m}),[n,r]}update(e){const{store:i}=this.client,a=i.getState().assetProcedureStepFieldsReducer.instances[e.uuid];if(!a)throw new Error(`AssetProcedureStepFields with uuid ${e.uuid} not found`);const c={...a,...e};this.dispatch(ut(c));const n=this.enqueueRequest({description:"Update Asset Procedure Step Fields",method:l.PATCH,url:`/asset-procedure-step-fields/${a.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return n.then(r=>{this.dispatch(ut(r))}).catch(r=>{throw this.dispatch(ut(a)),r}),[c,n]}delete(e){const{store:i}=this.client,a=i.getState().assetProcedureStepFieldsReducer.instances[e];if(!a)throw new Error(`AssetProcedureStepFields with uuid ${e} not found`);this.dispatch(Bs(e));const c=this.enqueueRequest({description:"Delete Asset Procedure Step Fields",method:l.DELETE,url:`/asset-procedure-step-fields/${e}/`,blockers:[e],blocks:[e]});return c.catch(n=>{throw this.dispatch(ks(a)),n}),c}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get Asset Procedure Step Fields",method:l.GET,url:"/asset-procedure-step-fields/",queryParams:{asset_procedure_step__asset_procedure_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(xr(a)),a}}class dF extends j{async bulkAdd(e,i){var o;const a=new Date().toISOString(),c=(o=this.client.store.getState().userReducer.currentUser)==null?void 0:o.id,n=Je(e,i??e.length),r=[],u=[];for(const h of n){const p={},y=[];for(const A of h){const{fieldValuesUuid:g,fieldIdentifier:F,file:R}=A,w=await this.getFilePayload(R);w.sha1 in p||(p[w.sha1]=w);const z=b({file:URL.createObjectURL(R),file_type:R.type,file_name:R.name,file_sha1:w.sha1,created_by:c,field_values:g,submitted_at:a,field_identifier:F});r.push(z);const He={uuid:z.uuid,file_name:R.name,file_sha1:w.sha1,file_extension:w.extension,field_identifier:F,field_values:g};y.push(He)}u.push({submitted_at:a,attachments:y,files:Object.values(p)})}this.dispatch(Mt(r));const m=u.map(h=>this.enqueueRequest({description:"Add asset procedure step field values attachments",method:l.POST,url:"/asset-procedure-step-field-values-attachments/bulk/",payload:h,blockers:h.attachments.map(p=>p.field_values),blocks:h.attachments.map(p=>p.uuid)}));return Promise.all(m).then(h=>{for(const y of h)this.processPresignedUrls(y.presigned_urls);const p=h.flatMap(y=>y.attachments);this.dispatch(id(p))}).catch(h=>{throw this.dispatch(Vt(r.map(p=>p.uuid))),h}),[r,m.map(h=>h.then(({attachments:p})=>p))]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),c=cd(e)(a);this.dispatch(Vt(e));try{await this.enqueueRequest({description:"Delete asset procedure step field values attachments",method:l.DELETE,url:"/asset-procedure-step-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(n){throw this.dispatch(Mt(c)),n}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get asset procedure step field values attachments",method:l.GET,url:"/asset-procedure-step-field-values-attachments/",queryParams:{limit:Ke,paginate:!0,field_values__asset_procedure__project:e,latest:!0},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get asset procedure step field values attachments",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(sd(c)),c}}class uF extends _{add(e){var r;const{store:i}=this.client,a=i.getState(),c=b({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),n=this.enqueueRequest({description:"Add asset procedure step field values",method:l.POST,url:"/asset-procedure-step-field-values/",payload:v(c),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[c.uuid]});return this.dispatch(Ws(c)),n.then(u=>(this.dispatch(ot(u)),u)).catch(()=>{this.dispatch(Ks(c.uuid))}),[c,n]}bulkAdd(e,i){var m;const a=new Date().toISOString(),c=[],n=Je(e.payloads,i??e.payloads.length),r=[];for(const o of n){const h=[];for(const p of o){const y=b({...p,values:p.values,created_by:(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,submitted_at:a});c.push(y),h.push({uuid:y.uuid,asset:p.asset,fields_revision:p.fields_revision,asset_procedure:p.asset_procedure,asset_procedure_step:p.asset_procedure_step,published_at:p.published_at,values:y.values})}r.push({submitted_at:a,values:e.values,field_values:h})}this.dispatch(od(c));const u=[];for(const o of r){const h=o.field_values.map(F=>F.asset),p=o.field_values.map(F=>F.fields_revision),y=o.field_values.map(F=>F.asset_procedure),A=o.field_values.map(F=>F.uuid),g=this.enqueueRequest({description:"Bulk add asset procedure step field values",method:l.POST,url:"/asset-procedure-step-field-values/bulk/",payload:o,blockers:[...h,...p,...y],blocks:A});u.push(g)}return Promise.all(u).then(o=>{this.dispatch(ld(o.flat()))}).catch(()=>{this.dispatch(hd(c.map(o=>o.uuid)))}),[c,u]}update(e){const{store:i}=this.client,a=i.getState(),c=Ys(e.uuid)(a);if(!c)throw new Error(`Expected AssetProcedureStepFieldValues with uuid ${e.uuid} to exist`);const n={...c,...e};this.dispatch(ot(n));const r=this.enqueueRequest({description:"Update asset procedure step field values",method:l.PATCH,url:`/asset-procedure-step-field-values/${e.uuid}/`,payload:e,blockers:[n.fields_revision,n.asset,n.asset_procedure],blocks:[n.uuid]});return r.then(u=>{this.dispatch(ot(u))}).catch(()=>{this.dispatch(ot(c))}),[n,r]}async delete(e){const{store:i}=this.client,a=i.getState(),c=Ys(e)(a);if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const n=nd(e)(a);this.dispatch(Ks(e)),this.dispatch(Vt(n.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset procedure step field values",method:l.DELETE,url:`/asset-procedure-step-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(Ws(c)),this.dispatch(Mt(n)),r}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get asset procedure step field values",method:l.GET,url:"/asset-procedure-step-field-values/",queryParams:{limit:V,paginate:!0,asset_procedure__project:e,latest:!0},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get asset procedure step field values",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(ud(c)),c}}class oF extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,c=new Date().toISOString(),n=b({...e,created_by:a,submitted_at:c});this.dispatch(Sd(n));const r=this.enqueueRequest({description:"Create asset procedure step",method:l.POST,url:"/asset-procedure-steps/",payload:v(n),blockers:[n.asset_procedure_type],blocks:[n.uuid]});return r.then(m=>{this.dispatch(qt(m))}).catch(()=>{this.dispatch(Id(n.uuid))}),[n,r]}update(e){const{store:i}=this.client,a=Js(e.uuid)(i.getState());if(!a)throw new Error(`No asset procedure step with uuid ${e.uuid} found in the store`);const c={...a,...e};this.dispatch(qt(c));const n=this.enqueueRequest({description:"Update asset procedure step",method:l.PATCH,url:`/asset-procedure-steps/${a.uuid}/`,payload:{name:e.name,description:e.description,priority:e.order,color:e.color},blockers:[a.uuid],blocks:[a.uuid]});return n.then(r=>{this.dispatch(qt(r))}).catch(()=>{this.dispatch(fd(a))}),[c,n]}async delete(e){const{store:i}=this.client,a=i.getState(),c=Js(e)(a);if(!c)throw new Error(`No asset procedure step with uuid ${e} found in the store`);const n=Pd(e)(a);return this.dispatch(gd([e,...wn(n)])),this.enqueueRequest({description:"Delete asset stage",method:l.DELETE,url:`/asset-procedure-steps/${e}/`,blockers:[e],blocks:[]}).catch(r=>{throw this.dispatch(Td([c,...n])),r})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset procedure steps",method:l.GET,url:"/asset-procedure-steps/",queryParams:{asset_procedure_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Ad(a)),a}}class lF extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,c=new Date().toISOString(),n=b({...e,created_by:a,submitted_at:c});this.dispatch(Qs(n));const r=this.enqueueRequest({description:"Create asset",method:l.POST,url:"/assets/",payload:v(n),blockers:[n.asset_type],blocks:[n.uuid]});return r.then(m=>{this.dispatch(ht(m))}).catch(()=>{this.dispatch(xs(n.uuid))}),[n,r]}update(e){const{store:i}=this.client,a=ii(e.uuid)(i.getState());if(!a)throw new Error(`No asset with uuid ${e.uuid} found in the store`);const c={...a,...e};this.dispatch(ht(c));const n=this.enqueueRequest({description:"Edit asset",method:l.PATCH,url:`/assets/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return n.then(r=>{this.dispatch(ht(r))}).catch(()=>{this.dispatch(ht(a))}),[c,n]}async delete(e){const{store:i}=this.client,a=i.getState(),c=ii(e)(a);if(!c)throw new Error(`No asset with uuid ${e} found in the store`);const n=Wn(e)(a),r=ql(e)(a);if(this.dispatch(xs(e)),n.length>0){const u=n.map(({uuid:m})=>m);this.dispatch(ps(u))}if(r.length>0){const u=r.map(({uuid:m})=>m);this.dispatch(ja(u))}return this.enqueueRequest({description:"Delete asset",method:l.DELETE,url:`/assets/${e}/`,blockers:[e],blocks:[]}).catch(u=>{throw this.dispatch(Qs(c)),this.dispatch(ms(n)),this.dispatch(Ma(r)),u})}bulkAdd(e,i,a,c){const n=new Date().toISOString(),r=xe.v4(),u=Je(e,c).map(h=>{const p=h.map(y=>b(y));return{batchId:xe.v4(),payload:{transaction_id:r,submitted_at:n,asset_type:i,project:a,assets:p}}}),m=[];let o=null;for(const h of u){const{batchId:p,payload:y}=h,A=y.assets.map(w=>w.uuid),g=[i];o&&g.push(o);const F=A;F.push(p);const R=this.enqueueRequest({description:"Batch create assets",method:l.POST,url:"/assets/bulk/",payload:y,blockers:g,blocks:F});o=h.batchId,m.push(R)}return Promise.all(m).then(h=>{const p=h.flat();this.dispatch(zt(p))}),m}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),c=vd(e)(a);this.dispatch(ei(e));try{await this.enqueueRequest({description:"Bulk delete assets",method:l.DELETE,url:"/assets/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(n){throw this.dispatch(zt(c)),n}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get assets",method:l.GET,url:"/assets/",queryParams:{limit:V,paginate:!0,project:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get assets",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(_d(c)),c}}class hF extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,c=new Date().toISOString(),n=b({...e,created_by:a,submitted_at:c});this.dispatch(ci(n));const r=this.enqueueRequest({description:"Add asset stage completion",method:l.POST,url:"/asset-stage-completions/",payload:v(n),blockers:[e.asset,e.asset_stage],blocks:[n.uuid]});return r.then(m=>{this.dispatch(Vd(m))}).catch(()=>{this.dispatch(ri(n.uuid))}),[n,r]}delete(e){const{store:i}=this.client,a=zd(e)(i.getState());if(!a)throw new Error(`Expected asset stage completion with uuid ${e} to exist`);this.dispatch(ri(e));const c=this.enqueueRequest({description:"Delete asset stage completion",method:l.DELETE,url:`/asset-stage-completions/${e}/`,blockers:[e],blocks:[]});return c.catch(()=>{this.dispatch(ci(a))}),c}bulkAdd(e){var o;const{store:i}=this.client,a=new Date().toISOString(),c=(o=i.getState().userReducer.currentUser)==null?void 0:o.id,n=e.map(h=>b(h)),r=n.map(h=>({...h,created_by:c,submitted_at:a})),u=r.map(({uuid:h})=>h);this.dispatch(ni(r));const m=this.enqueueRequest({description:"Bulk create asset stage completions",method:l.POST,url:"/asset-stage-completions/bulk/",payload:{submitted_at:a,completions:n},blockers:[...e.map(h=>h.asset_procedure),...e.map(h=>h.asset_stage),...e.map(h=>h.asset)],blocks:u});return m.then(h=>{this.dispatch(jd(h))}).catch(()=>{this.dispatch(di(u))}),[r,m]}bulkDelete(e){const{store:i}=this.client,a=Dd(e)(i.getState());this.dispatch(di(e));const c=this.enqueueRequest({description:"Deleting asset stage completions",method:l.DELETE,url:"/asset-stage-completions/bulk/",payload:{uuids:e},blockers:e,blocks:[]});return c.catch(()=>{this.dispatch(ni(a))}),c}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get asset stage completions",method:l.GET,url:"/asset-stage-completions/",queryParams:{limit:V,paginate:!0,asset_procedure__project:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get asset stage completions",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Md(c)),c}}class mF extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,c=new Date().toISOString(),n=b({...e,created_by:a,submitted_at:c});this.dispatch(li(n));const r=this.enqueueRequest({description:"Create asset",method:l.POST,url:"/asset-stages/",payload:v(n),blockers:[n.asset_procedure_type],blocks:[n.uuid]});return r.then(m=>{this.dispatch(Dt(m))}).catch(()=>{this.dispatch(hi(n.uuid))}),[n,r]}update(e){const{store:i}=this.client,a=mi(e.uuid)(i.getState());if(!a)throw new Error(`No asset stage with uuid ${e.uuid} found in the store`);const c={...a,...e};this.dispatch(Dt(c));const n=this.enqueueRequest({description:"Update asset stage",method:l.PATCH,url:`/asset-stages/${a.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return n.then(r=>{this.dispatch(Dt(r))}).catch(()=>{this.dispatch(kd(a))}),[c,n]}async delete(e){const{store:i}=this.client,a=i.getState(),c=mi(e)(a);if(!c)throw new Error(`No asset stage with uuid ${e} found in the store`);return this.dispatch(hi(e)),this.enqueueRequest({description:"Delete asset stage",method:l.DELETE,url:`/asset-stages/${e}/`,blockers:[e],blocks:[]}).catch(n=>{throw this.dispatch(li(c)),n})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset stages",method:l.GET,url:"/asset-stages/",queryParams:{asset_procedure_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Cd(a)),a}}class pF extends Ye{constructor(){super(...arguments);T(this,"name","Asset Type Attachment");T(this,"url","/asset-type-attachments");T(this,"addAttachments",yi);T(this,"updateAttachments",Hd);T(this,"removeAttachments",Ai);T(this,"removeAttachment",Wd);T(this,"setAttachment",Nd);T(this,"selectAttachment",Zd)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,asset_type:i.modelUuid})}buildAttachmentPayload(i){return{...i,asset_type:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.assetTypeUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const c=await this.enqueueRequest({immediate:!0,description:"Get asset type attachments",method:l.GET,url:`${this.url}/`,queryParams:{asset_type__organization:i},blocks:[],blockers:[]},a);return this.dispatch(Ld(c)),c}}class yF extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,c={},n=[],r=[];for(const o of e){const{fieldsRevisionUuid:h,fieldIdentifier:p,file:y}=o,A=await this.getFilePayload(y);A.sha1 in c||(c[A.sha1]=A);const g=b({file:URL.createObjectURL(y),file_type:y.type,file_name:y.name,file_sha1:A.sha1,created_by:a,fields_revision:h,submitted_at:i,field_identifier:p});n.push(g);const F={uuid:g.uuid,file_name:y.name,field_identifier:p,file_extension:A.extension,file_sha1:A.sha1,fields_revision:h};r.push(F)}this.dispatch(eu(n));const u=this.enqueueRequest({description:"Add asset type fields attachments",method:l.POST,url:"/asset-type-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(c)},blockers:n.map(o=>o.fields_revision),blocks:n.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(tu(o.attachments))}).catch(()=>{this.dispatch(su(n.map(o=>o.uuid)))}),[n,u.then(({attachments:o})=>o)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset type fields attachments",method:l.GET,url:"/asset-type-fields-attachments/",queryParams:{fields_revision__asset_type__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(xd(a)),a}}class AF extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,c=new Date().toISOString(),n=b({...e,created_by:a,submitted_at:c});this.dispatch(du(n));const r=this.enqueueRequest({description:"Add Asset Type Fields",method:l.POST,url:"/asset-type-fields/",payload:v(n),blockers:[n.asset_type],blocks:[n.uuid]});return r.then(m=>{this.dispatch(uu(m))}).catch(m=>{throw this.dispatch(ou(n.uuid)),m}),[n,r]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get Asset Type Fields",method:l.GET,url:"/asset-type-fields/",queryParams:{asset_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(ru(a)),a}}class fF extends j{async bulkAdd(e,i){var o;const a=new Date().toISOString(),c=(o=this.client.store.getState().userReducer.currentUser)==null?void 0:o.id,n=Je(e,i??e.length),r=[],u=[];for(const h of n){const p={},y=[];for(const A of h){const{fieldValuesUuid:g,fieldIdentifier:F,file:R}=A,w=await this.getFilePayload(R);w.sha1 in p||(p[w.sha1]=w);const z=b({file:URL.createObjectURL(R),file_type:R.type,file_name:R.name,file_sha1:w.sha1,created_by:c,field_values:g,submitted_at:a,field_identifier:F});r.push(z);const He={uuid:z.uuid,file_name:R.name,file_sha1:w.sha1,file_extension:w.extension,field_identifier:F,field_values:g};y.push(He)}u.push({submitted_at:a,attachments:y,files:Object.values(p)})}this.dispatch(kt(r));const m=u.map(h=>this.enqueueRequest({description:"Add asset type field values attachments",method:l.POST,url:"/asset-type-field-values-attachments/bulk/",payload:h,blockers:h.attachments.map(p=>p.field_values),blocks:h.attachments.map(p=>p.uuid)}));return Promise.all(m).then(h=>{for(const y of h)this.processPresignedUrls(y.presigned_urls);const p=h.flatMap(y=>y.attachments);this.dispatch(yu(p))}).catch(h=>{throw this.dispatch(Bt(r.map(p=>p.uuid))),h}),[r,m.map(h=>h.then(({attachments:p})=>p))]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),c=fu(e)(a);this.dispatch(Bt(e));try{await this.enqueueRequest({description:"Delete asset type field values attachments",method:l.DELETE,url:"/asset-type-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(n){throw this.dispatch(kt(c)),n}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get asset type field values attachments",method:l.GET,url:"/asset-type-field-values-attachments/",queryParams:{limit:Ke,paginate:!0,field_values__asset__project:e,latest:!0},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get asset type field values attachments",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(pu(c)),c}}class SF extends _{add(e){var r;const{store:i}=this.client,a=i.getState(),c=b({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),n=this.enqueueRequest({description:"Add asset type field values",method:l.POST,url:"/asset-type-field-values/",payload:v(c),blockers:[e.asset,e.fields_revision],blocks:[c.uuid]});return this.dispatch(bi(c)),n.then(u=>(this.dispatch(mt(u)),u)).catch(()=>{this.dispatch(Fi(c.uuid))}),[c,n]}bulkAdd(e,i){var m;const a=new Date().toISOString(),c=[],n=Je(e.payloads,i??e.payloads.length),r=[];for(const o of n){const h=[];for(const p of o){const y=b({...p,values:p.values,created_by:(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,submitted_at:a});c.push(y),h.push({uuid:y.uuid,asset:p.asset,fields_revision:p.fields_revision,published_at:p.published_at,values:y.values})}r.push({submitted_at:a,values:e.values,field_values:h})}this.dispatch(bu(c));const u=[];for(const o of r){const h=o.field_values.map(g=>g.asset),p=o.field_values.map(g=>g.fields_revision),y=o.field_values.map(g=>g.uuid),A=this.enqueueRequest({description:"Bulk add asset type field values",method:l.POST,url:"/asset-type-field-values/bulk/",payload:o,blockers:[...h,...p],blocks:y});u.push(A)}return Promise.all(u).then(o=>{this.dispatch(Fu(o.flat()))}).catch(()=>{this.dispatch(Pu(c.map(o=>o.uuid)))}),[c,u]}update(e){const{store:i}=this.client,a=i.getState(),c=Oi(e.uuid)(a);if(!c)throw new Error(`Expected AssetTypeFieldValues with uuid ${e.uuid} to exist`);const n={...c,...e};this.dispatch(mt(n));const r=this.enqueueRequest({description:"Delete asset type field values",method:l.PATCH,url:`/asset-type-field-values/${e.uuid}/`,payload:e,blockers:[n.uuid,n.fields_revision,n.asset],blocks:[n.uuid]});return r.then(u=>{this.dispatch(mt(u))}).catch(()=>{this.dispatch(mt(c))}),[n,r]}async delete(e){const{store:i}=this.client,a=i.getState(),c=Oi(e)(a);if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const n=Su(e)(a);this.dispatch(Fi(e)),this.dispatch(Bt(n.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset type field values",method:l.DELETE,url:`/asset-type-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(bi(c)),this.dispatch(kt(n)),r}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get asset type field values",method:l.GET,url:"/asset-type-field-values/",queryParams:{limit:V,paginate:!0,asset__project:e,latest:!0},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get asset type field values",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(gu(c)),c}}class TF extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,c=new Date().toISOString(),n=b({...e,created_by:a,submitted_at:c});this.dispatch(Ri(n));const r=this.enqueueRequest({description:"Create asset type identifier",method:l.POST,url:"/asset-type-identifiers/",payload:v(n),blockers:[n.asset_type],blocks:[n.uuid]});return r.then(m=>{this.dispatch(pt(m))}).catch(()=>{this.dispatch(vi(n.uuid))}),[n,r]}update(e){const{store:i}=this.client,a=wi(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset type identifier with uuid ${e.uuid} to exist`);const c={...a,...e};this.dispatch(pt(c));const n=this.enqueueRequest({description:"Update asset type identifier",method:l.PATCH,url:`/asset-type-identifiers/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return n.then(r=>{this.dispatch(pt(r))}).catch(()=>{this.dispatch(pt(a))}),[c,n]}async delete(e){const{store:i}=this.client,a=i.getState(),c=wi(e)(a);if(!c)throw new Error(`Expected asset type identifier with uuid ${e} to exist`);this.dispatch(vi(e));try{return await this.enqueueRequest({description:"Delete asset type identifier",method:l.DELETE,url:`/asset-type-identifiers/${e}/`,blockers:[e],blocks:[]})}catch(n){throw this.dispatch(Ri(c)),n}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset type identifiers",method:l.GET,url:"/asset-type-identifiers/",queryParams:{asset_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(vu(a)),a}}class IF extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,c=new Date().toISOString(),n=b({...e,created_by:a,submitted_at:c});this.dispatch(Mi(n));const r=this.enqueueRequest({description:"Create asset type identifier value",method:l.POST,url:"/asset-type-identifier-values/",payload:v(n),blockers:[e.asset,e.asset_type_identifier],blocks:[n.uuid]});return r.then(m=>{this.dispatch(yt(m))}).catch(()=>{this.dispatch(Vi(n.uuid))}),[n,r]}update(e){const{store:i}=this.client,a=qi(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset type identifier value with uuid ${e.uuid} to exist`);const c={...a,...e};this.dispatch(yt(c));const n=this.enqueueRequest({description:"Update asset type identifier value",method:l.PATCH,url:`/asset-type-identifier-values/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return n.then(r=>{this.dispatch(yt(r))}).catch(()=>{this.dispatch(yt(a))}),[c,n]}async delete(e){const{store:i}=this.client,a=i.getState(),c=qi(e)(a);if(!c)throw new Error(`Expected asset type identifier value with uuid ${e} to exist`);this.dispatch(Vi(e));try{return await this.enqueueRequest({description:"Delete asset type identifier value",method:l.DELETE,url:`/asset-type-identifier-values/${e}/`,blockers:[e],blocks:[]})}catch(n){throw this.dispatch(Mi(c)),n}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get asset type identifier values",method:l.GET,url:"/asset-type-identifier-values/",queryParams:{limit:V,paginate:!0,asset__project:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get asset type identifier values",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(ju(c)),c}}class gF extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,c=new Date().toISOString(),n=b({...e,created_by:a,submitted_at:c});this.dispatch(Di(n));const r=this.enqueueRequest({description:"Create asset type",method:l.POST,url:"/asset-types/",payload:v(n),blockers:[],blocks:[n.uuid]});return r.then(m=>{this.dispatch(At(m))}).catch(()=>{this.dispatch(Ui(n.uuid))}),[n,r]}update(e){const{store:i}=this.client,a=ki(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset type with uuid ${e.uuid} to exist`);const c={...a,...e};this.dispatch(At(c));const n=this.enqueueRequest({description:"Update asset type",method:l.PATCH,url:`/asset-types/${e.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return n.then(r=>{this.dispatch(At(r))}).catch(()=>{this.dispatch(At(a))}),[c,n]}async delete(e){const{store:i}=this.client,a=i.getState(),c=ki(e)(a);if(!c)throw new Error(`Expected asset type with uuid ${e} to exist`);const n=si(e)(a),r=Jd(e)(a);return this.dispatch(Ui(e)),this.dispatch(ei(n.map(u=>u.uuid))),this.dispatch(Ai(r.map(({uuid:u})=>u))),this.enqueueRequest({description:"Delete asset type",method:l.DELETE,url:`/asset-types/${e}/`,blockers:[e],blocks:[]}).catch(u=>{throw this.dispatch(Di(c)),this.dispatch(zt(n)),this.dispatch(yi(r)),u})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset types",method:l.GET,url:"/asset-types/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(Uu(a)),a}}class bF extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,c=new Date().toISOString(),n=b({...e,created_by:a,submitted_at:c});this.dispatch($i(n));const r=this.enqueueRequest({description:"Create Asset Type Status",method:l.POST,url:"/asset-type-statuses/",payload:v(n),blockers:[e.asset_type],blocks:[n.uuid]});return r.then(m=>{this.dispatch($t(m))}).catch(()=>{this.dispatch(Gi(n.uuid))}),[n,r]}update(e){const i=this.client.store.getState(),a=Ni(e.uuid)(i);if(!a)throw new Error(`Expected an existing asset type status with uuid ${e.uuid}`);const c={...a,...e};this.dispatch(Gu(c));const n=this.enqueueRequest({description:"Edit Asset Type Status",method:l.PATCH,url:`/asset-type-statuses/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return n.then(r=>{this.dispatch($t(r))}).catch(()=>{this.dispatch($t(a))}),[c,n]}delete(e){const{store:i}=this.client,a=Ni(e)(i.getState());if(!a)throw new Error(`No asset type status with uuid ${e} found in the store`);this.dispatch(Gi(e));const c=this.enqueueRequest({description:"Delete Asset Type Status",method:l.DELETE,url:`/asset-type-statuses/${e}/`,blockers:[e],blocks:[]});return c.catch(()=>{this.dispatch($i(a))}),c}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset type statuses",method:l.GET,url:"/asset-type-statuses/",queryParams:{asset_type__organization:e},blocks:[],blockers:[]},i);return this.dispatch($u(a)),a}}class FF extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,c=new Date().toISOString(),n=b({...e,created_by:a,submitted_at:c});this.dispatch(Wi(n));const r=this.enqueueRequest({description:"Create Category",method:l.POST,url:"/categories/",payload:v(n),blockers:[e.project],blocks:[n.uuid]});return[n,r]}update(e){const i=this.client.store.getState(),a=Yi(e.uuid)(i);if(!a)throw new Error(`Expected an existing category with uuid ${e.uuid}`);const c={...a,...e};this.dispatch(Ju(c));const n=this.enqueueRequest({description:"Edit Category",method:l.PATCH,url:`/categories/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return[c,n]}remove(e){const{store:i}=this.client,a=Yi(e)(i.getState());if(!a)throw new Error(`No category with uuid ${e} found in the store`);this.dispatch(Xu(e));const c=this.enqueueRequest({description:"Delete Category",method:l.DELETE,url:`/categories/${a.uuid}/`,blockers:[a.uuid],blocks:[]});return c.catch(()=>{this.dispatch(Wi(a))}),c}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get categories",method:l.GET,url:"/categories/",queryParams:{project__organization:e},blocks:[],blockers:[]},i);return this.dispatch(Zu(a)),a}}class PF extends Ye{constructor(){super(...arguments);T(this,"name","Document Attachment");T(this,"url","/document-attachments");T(this,"addAttachments",so);T(this,"updateAttachments",ao);T(this,"removeAttachments",no);T(this,"removeAttachment",co);T(this,"setAttachment",io);T(this,"selectAttachment",oo)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,document:i.modelUuid})}buildAttachmentPayload(i){return{...i,document:i.modelUuid}}async bulkAdd(i){var p;const{store:a}=this.client,c=(p=a.getState().userReducer.currentUser)==null?void 0:p.id,n=new Date().toISOString(),r=[],u=[],m={},o={};for(const y of i){const{documentUuid:A,file:g}=y,F=await this.getFilePayload(g);F.sha1 in m||(m[F.sha1]=F,o[F.sha1]=[]);const R=this.buildOfflineAttachment({file:g,file_sha1:F.sha1,submitted_at:n,created_by:c,description:"",modelUuid:A});r.push(R),u.push({uuid:R.uuid,file_name:R.file_name,file_sha1:R.file_sha1,file_extension:F.extension,description:R.description,document:A}),o[F.sha1].push(R.uuid)}this.dispatch(this.addAttachments(r));const h=this.enqueueRequest({description:"Attach files to document",method:l.POST,url:"/document-attachments/bulk/",payload:{submitted_at:n,attachments:u,files:Object.values(m)},blocks:r.map(y=>y.uuid),blockers:r.map(y=>y.file_sha1)});return h.then(({attachments:y,presigned_urls:A})=>{this.dispatch(this.updateAttachments(y));const g=this.processPresignedUrls(A);for(const[F,R]of Object.entries(g))R.then(()=>{const w=o[F];for(const z of w)this.makeReadable(z)})}).catch(()=>{this.dispatch(this.removeAttachments(r.map(y=>y.uuid)))}),[r,h.then(({attachments:y})=>y)]}async delete(i){return this._delete(i)}makeReadable(i){this.enqueueRequest({description:"Add attachment to AI assistant",method:l.PATCH,url:`/document-attachments/${i}/`,payload:{readable_to_assistant:!0},blockers:["index-document-attachment",i],blocks:["index-document-attachment"]})}async refreshStore(i,a){const c=await this.enqueueRequest({immediate:!0,description:"Get document attachments",method:l.GET,url:"/document-attachments/",queryParams:{document__project__organization:i},blocks:[],blockers:[]},a),n=await this.enqueueRequest({immediate:!0,description:"Get document attachments",method:l.GET,url:"/document-attachments/",queryParams:{document__organization:i},blocks:[],blockers:[]},a),r=[...c,...n];return this.dispatch(to(r)),r}}class OF extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,c=new Date().toISOString(),n=b({...e,created_by:a,submitted_at:c});this.dispatch(po([n]));const r=this.enqueueRequest({description:"Create Document",method:l.POST,url:"/documents/",payload:v(n),queryParams:{parent_document:n.parent_document??void 0},blockers:n.parent_document?[n.parent_document]:[],blocks:[n.uuid]});return r.catch(()=>{this.dispatch(Xi([n.uuid]))}),[n,r]}update(e){const{store:i}=this.client,a=i.getState().documentsReducer.documents[e.uuid];if(!a)throw new Error(`attempting to update a document with uuid ${e.uuid} that does not exist in store.documents`);const c={...a,...e};this.dispatch(tt([c]));const n=this.enqueueRequest({description:"Update Document",method:l.PATCH,url:`/documents/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return n.catch(()=>{tt([a])}),[c,n]}delete(e){const{store:i}=this.client,a=Lt(i.getState()),c=yo(e)(i.getState());if(!c)throw new Error(`attempting to delete a document with uuid ${e} that does not exist in store.documents`);const n=c.parent_document?a[c.parent_document]:void 0;this.dispatch(Xi([e]));const r=this.enqueueRequest({description:"Delete Document",method:l.DELETE,url:`/documents/${e}/`,blockers:[e],blocks:[]});return r.then(u=>{this.dispatch(tt(u))}).catch(()=>{this.dispatch(tt([c])),n&&this.dispatch(tt([n]))}),r}async refreshStore(e,i){const a=this.enqueueRequest({immediate:!0,description:"Get project documents",method:l.GET,url:"/documents/",queryParams:{project__organization:e},blockers:[],blocks:[]},i),c=this.enqueueRequest({immediate:!0,description:"Get organization documents",method:l.GET,url:"/documents/",queryParams:{organization:e},blockers:[],blocks:[]},i),n=[...await a,...await c];return this.dispatch(mo(n)),n}}class _F extends _{async add(e,i){return this.enqueueRequest({description:"Add email domain to organization",method:l.POST,url:"/organization-email-domains/",payload:{email:i,organization:e},blockers:[e,"create-org"],blocks:[]})}async remove(e){return this.dispatch(Io(e.uuid)),this.enqueueRequest({description:"Remove email domain from organization",method:l.DELETE,url:`/organization-email-domains/${e.uuid}/`,blockers:[e.domain],blocks:[]}).catch(i=>{throw this.dispatch(To(e)),i})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch email domains for organization",method:l.GET,url:"/organization-email-domains/",queryParams:{organization:e},blockers:[e],blocks:[]},i);return this.dispatch(So(a)),a}}class RF extends _{async getVerificationCode(e){return this.enqueueRequest({description:"Get verification code",method:l.GET,url:`/verification/email-verification/${e}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}validateVerificationCode(e,i=void 0){return this.enqueueRequest({description:"Validate verification code",method:l.POST,url:`/verification/email-verification/${e}/`,isAuthNeeded:!1,payload:i,blockers:[],blocks:[]})}}const ts={},dn=new Set;let ss=0,un=0,on=0;const vF=20;class wF extends _{constructor(){super(...arguments);T(this,"host");T(this,"_dbPromise",Iy.openDB("fileCache",1,{upgrade(i){i.createObjectStore("files")}}))}async renewUploadUrl(i){const a=await this.fetchCache(i);if(!a)throw new Error(`File with sha1 ${i} not found in cache`);const c=await ds(a,i),n=await this.enqueueRequest({description:"Get S3 URL",method:l.GET,url:"/authentication/files/presigned-upload-url/",queryParams:{sha1:await et(a),file_type:a.type,extension:a.name.split(".").pop(),size:a.size.toString()},blockers:[],blocks:[`s3-${c}`]});return"url"in n&&this.dispatch(_o({sha1:i,...n})),n}async addCache(i,a){if(dn.has(a))return;if(!i.type){const r=i.name.split("."),u=r[r.length-1];i=new File([i],i.name,{type:u})}if(!i.name||!i.size||!i.type)throw new Error("Cannot add files to cache that do not have a name, size and type.");const c=await this._dbPromise;!!await c.get("files",a)?(console.error("File already cached (this is unexpected at this point):",i.name,a),ss++):(await c.put("files",i,a),un++),dn.add(a),on++,on%vF===0&&console.debug(`File cache summary: ${ss} hits and ${un} misses, ${ss/(ss+un)*100}% hit rate over ${on} calls to addCache.`)}async removeCache(i){await(await this._dbPromise).delete("files",i),dn.delete(i)}async fetchCache(i){return(await this._dbPromise).get("files",i)}async getOrRenewUploadUrl(i){const a=this.client.store.getState();return Ro(i)(a)??await this.renewUploadUrl(i)}async uploadFileToS3(i){const a=await this.fetchCache(i);if(!a)throw new Error(`File with sha1 ${i} not found in cache`);const c=await ds(a,i),n={file_name:a.name,file_sha1:i,file:c},r=await this.getOrRenewUploadUrl(i);if("warning"in r){if(r.warning==="already_uploaded")return[n,Promise.resolve(void 0)];throw new Error(r.warning)}const u=r.url,m=this.enqueueRequest({url:u,description:"Upload file",method:l.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:i,blockers:[`s3-${c}`],blocks:[i],s3url:r});return[n,m]}async fetchFileFromUrl(i,a,c){const n=i.split("?")[0]??i,r=await this.fetchCache(a);if(r){if(!r.name)throw new Error("Cached file unexpectedly has no name.");return r}if(i.startsWith("blob:")){const h=await On(i),p=new File([h],c??a,{type:h.type});return await this.addCache(p,a),p}let u=ts[n],m=!0;u?m=!1:(u=new Promise(h=>{this.enqueueRequest({description:"Download file",method:l.GET,url:i,isExternalUrl:!0,isResponseBlob:!0,isAuthNeeded:!1,blockers:[a],blocks:[a]}).then(p=>{const y=new File([p],c??a,{type:p.type});h(y)})}),ts[n]=u);let o;try{o=await u}catch(h){throw m&&h instanceof U&&delete ts[n],h}if(m){const h=await et(o);if(h!==a){const A=`The hash of the file returned from the server (${h}) does not match the
9
9
  expected hash (${a}). This can happen if you're using a local development server and the
10
10
  isExternalUrl flag in the request details is set to true, because instead of requesting the local
11
11
  REST API, you will be requesting localhost:80 (where this app runs), resulting in a transformed blob
12
12
  (with an uuid attached) being returned. Alternatively, you may be running with
13
13
  import.meta.env.PROD, which will result in some file requests being treated as
14
- external URLs and therefore not prepended with VITE_API_URL.`;throw new Error(A)}const p=o.type.split("/")[1];if(!p)throw new Error("File has no extension");const y=n??h+"."+p;if(o=Ac(o,y),!o.name)throw new Error("Failed to set file's name");await this.addCache(o,h),xt[c]=new Promise(A=>{A(o)})}return o}}class oF extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(Zi(c));const r=this.enqueueRequest({description:"Create form identifier",method:l.POST,url:"/form-identifiers/",payload:v(c),blockers:[c.form],blocks:[c.uuid]});return r.then(m=>{this.dispatch(At(m))}).catch(()=>{this.dispatch(Ji(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=Xi(e.uuid)(i.getState());if(!a)throw new Error(`Expected form identifier with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(At(n));const c=this.enqueueRequest({description:"Update form identifier",method:l.PATCH,url:`/form-identifiers/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(At(r))}).catch(()=>{this.dispatch(At(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Xi(e)(a);if(!n)throw new Error(`Expected form identifier with uuid ${e} to exist`);this.dispatch(Ji(e));try{return await this.enqueueRequest({description:"Delete form identifier",method:l.DELETE,url:`/form-identifiers/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(Zi(n)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get form identifiers",method:l.GET,url:"/form-identifiers/",queryParams:{form__organization:e},blockers:[],blocks:[]},i);return this.dispatch(fo(a)),a}}class lF extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(xi(c));const r=this.enqueueRequest({description:"Create form identifier value",method:l.POST,url:"/form-identifier-values/",payload:v(c),blockers:[e.form_submission,e.form_identifier],blocks:[c.uuid]});return r.then(m=>{this.dispatch(ft(m))}).catch(()=>{this.dispatch(ea(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=sa(e.uuid)(i.getState());if(!a)throw new Error(`Expected form identifier value with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(ft(n));const c=this.enqueueRequest({description:"Update form identifier value",method:l.PATCH,url:`/form-identifier-values/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(ft(r))}).catch(()=>{this.dispatch(ft(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=sa(e)(a);if(!n)throw new Error(`Expected form identifier value with uuid ${e} to exist`);this.dispatch(ea(e));try{return await this.enqueueRequest({description:"Delete form identifier value",method:l.DELETE,url:`/form-identifier-values/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(xi(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get form identifier values",method:l.GET,url:"/form-identifier-values/",queryParams:{limit:V,paginate:!0,form_submission__form_revision__form__organization:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get form identifier values",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(bo(n)),n}}class hF extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const o of e){const{revisionUuid:h,fieldIdentifier:p,file:y}=o,A=await this.getFilePayload(y);A.sha1 in n||(n[A.sha1]=A);const g=b({file:URL.createObjectURL(y),file_type:y.type,file_name:y.name,file_sha1:A.sha1,created_by:a,form_revision:h,submitted_at:i,field_identifier:p});c.push(g);const F={uuid:g.uuid,file_name:y.name,field_identifier:p,file_extension:A.extension,file_sha1:A.sha1,form_revision:h};r.push(F)}this.dispatch(Ro(c));const u=this.enqueueRequest({description:"Attach files to form revision",method:l.POST,url:"/form-revision-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(o=>o.form_revision),blocks:c.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(vo(o.attachments))}).catch(()=>{this.dispatch(wo(c.map(o=>o.uuid)))}),[c,u.then(({attachments:o})=>o)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch organization form revision attachments",method:l.GET,url:"/form-revision-attachments/",queryParams:{form_revision__form__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(_o(a)),a}}class mF extends j{add(e){var u;const{store:i}=this.client,n=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,c=b({...e,created_by:n,submitted_at:new Date().toISOString()});this.dispatch(na(c));const r=this.enqueueRequest({description:"Create form revision",method:l.POST,url:"/form-revisions/",payload:v(c),blockers:[e.form],blocks:[c.uuid]});return r.then(m=>{this.dispatch(zo(m))}).catch(()=>{this.dispatch(ca(c.uuid))}),[c,r]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get organization form revisions",method:l.GET,url:"/form-revisions/",queryParams:{form__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(jo(a)),a}}class pF extends j{add(e,i){var o;const{store:a}=this.client,n=new Date().toISOString(),c=(o=a.getState().userReducer.currentUser)==null?void 0:o.id,r=b({...e,submitted_at:n,created_by:c}),u=b({...i,form:r.uuid,submitted_at:n,created_by:c});this.dispatch(oa(r)),this.dispatch(na(u));const m=this.enqueueRequest({description:"Create form",method:l.POST,url:"/forms/",payload:{...v(r),initial_revision:{uuid:u.uuid,submitted_at:u.submitted_at,title:u.title,description:u.description,fields:u.fields}},blockers:[],blocks:[r.uuid,u.uuid]});return m.catch(h=>{throw this.dispatch(la(r.uuid)),this.dispatch(ca(u.uuid)),h}),[r,u,m]}async delete(e){const{store:i}=this.client,a=i.getState(),n=No(e)(a);if(!n)throw new Error("Expected form to exist");const c=il(e)(a);c.length>0&&this.dispatch(sl(c.map(({uuid:u})=>u)));const r=Uo(e)(a);r.length>0&&this.dispatch(Do(r.map(({uuid:u})=>u))),this.dispatch(la(e));try{return await this.enqueueRequest({description:"Delete form",method:l.DELETE,url:`/forms/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(oa(n)),r.length>0&&this.dispatch(qo(r)),c.length>0&&this.dispatch(el(c)),u}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch organization forms",method:l.GET,url:"/forms/",queryParams:{organization:e},blockers:[e],blocks:[]},i);return this.dispatch(Bo(a)),a}}class yF extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const o of e){const{submissionUuid:h,fieldIdentifier:p,file:y}=o,A=await this.getFilePayload(y);A.sha1 in n||(n[A.sha1]=A);const g=b({file:URL.createObjectURL(y),file_type:y.type,file_name:y.name,file_sha1:A.sha1,created_by:a,form_submission:h,submitted_at:i,field_identifier:p});c.push(g);const F={uuid:g.uuid,file_name:y.name,file_sha1:A.sha1,file_extension:A.extension,field_identifier:p,form_submission:h};r.push(F)}this.dispatch(Gt(c));const u=this.enqueueRequest({description:"Attach files to form submission",method:l.POST,url:"/form-submission-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(o=>o.form_submission),blocks:c.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(Ko(o.attachments))}).catch(o=>{throw this.dispatch(Lt(c.map(h=>h.uuid))),o}),[c,u.then(({attachments:o})=>o)]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=Zo(e)(a);this.dispatch(Lt(e));try{await this.enqueueRequest({description:"Delete form submission attachments",method:l.DELETE,url:"/form-submission-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(Gt(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get form submission attachments",method:l.GET,url:"/form-submission-attachments/",queryParams:{limit:We,paginate:!0,form_submission__form_revision__form__organization:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get form submission attachments",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Wo(n)),n}}class AF extends j{add(e){var r;const{store:i}=this.client,a=i.getState(),n=b({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add form submission",method:l.POST,url:"/form-submissions/",payload:v(n),blockers:[e.form_revision],blocks:[n.uuid]});return this.dispatch(ya(n)),c.then(u=>(this.dispatch(Nt(u)),u)).catch(()=>{this.dispatch(Aa(n.uuid))}),[n,c]}update(e){const{store:i}=this.client,a=i.getState(),n=Sa(e.uuid)(a);if(!n)throw new Error(`Expected submission with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(tl(c));const r=this.enqueueRequest({description:"Delete user form submissions",method:l.PATCH,url:`/form-submissions/${c.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return r.then(u=>{this.dispatch(Nt(u))}).catch(()=>{this.dispatch(Nt(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Sa(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=Jo(e)(a);this.dispatch(Aa(e)),this.dispatch(Lt(c.map(r=>r.uuid)));try{return await this.enqueueRequest({description:"Delete user form submissions",method:l.DELETE,url:`/form-submissions/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(ya(n)),this.dispatch(Gt(c)),r}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Fetch form submissions",method:l.GET,url:"/form-submissions/",queryParams:{limit:V,paginate:!0,form_revision__form_organization:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Fetch form submissions",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(xo(n)),n}}class fF extends j{async add(e){var p;const{store:i}=this.client,{file:a,...n}=e,c=new Date().toISOString(),r=(p=i.getState().userReducer.currentUser)==null?void 0:p.id,u=n.project,m=await this.getFilePayload(a),o=b({...n,file_name:a.name,file_sha1:m.sha1,file:URL.createObjectURL(a),submitted_at:c,created_by:r});this.dispatch(dl(o));const h=this.enqueueRequest({description:"Add geo image",method:l.POST,url:"/geo-images/",payload:{uuid:o.uuid,submitted_at:c,title:o.title,description:o.description,geo_marker:o.geo_marker,canvas_marker:o.canvas_marker,sha1:o.file_sha1,project:o.project,file_name:o.file_name,direction:o.direction,original_date:o.original_date,file:m},blocks:[u],blockers:[u]});return h.then(y=>{this.processPresignedUrls(y.presigned_urls),this.dispatch(St(y.geo_image))}).catch(()=>{this.dispatch(Ia(o.uuid))}),[o,h.then(y=>y.geo_image)]}async bulkAdd(e,i){var p;const{store:a}=this.client,n=new Date().toISOString(),c=(p=a.getState().userReducer.currentUser)==null?void 0:p.id,r=[],u=[],m=[],o={};for(const y of e){const{file:A,...g}=y,F=await this.getFilePayload(A);F.sha1 in o||(o[F.sha1]=F);const R=b({...g,file_name:A.name,file_sha1:F.sha1,file:URL.createObjectURL(A),submitted_at:n,created_by:c,project:i});r.push(R),u.push(R.uuid),m.push({uuid:R.uuid,sha1:R.file_sha1,file_name:R.file_name,title:R.title,description:R.description,geo_marker:R.geo_marker,canvas_marker:R.canvas_marker,direction:R.direction,original_date:R.original_date})}this.dispatch(ul(r));const h=this.enqueueRequest({description:"Bulk add geo images",method:l.POST,url:"/geo-images/bulk/",payload:{submitted_at:n,project:i,geo_images:m,files:Object.values(o)},blocks:[i],blockers:u});return h.then(y=>{this.processPresignedUrls(y.presigned_urls),this.dispatch(rl(y.geo_images))}).catch(()=>{this.dispatch(ll(u))}),[r,h.then(y=>y.geo_images)]}update(e){const{store:i}=this.client,a=i.getState(),n=ga(e.uuid)(a);if(!n)throw new Error(`Map image with uuid ${e.uuid} does not exist in the store`);const c={...n,...e};this.dispatch(ol(c));const r=this.enqueueRequest({description:"Update geo image",method:l.PATCH,url:`/geo-images/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return r.then(u=>{this.dispatch(St(u))}).catch(()=>{this.dispatch(St(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=ga(e)(a);if(!n)throw new Error(`Map image with uuid ${e} does not exist in the store`);this.dispatch(Ia(e));const c=this.enqueueRequest({description:"Delete geo image",method:l.DELETE,url:`/geo-images/${e}/`,blocks:[e],blockers:[e]});return c.catch(()=>{this.dispatch(St(n))}),c}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get geo images",method:l.GET,url:"/geo-images/",queryParams:{project:e},blocks:[e],blockers:[]},i);return this.dispatch(cl(a)),a}}class SF extends _{add(e){var u;const{store:i}=this.client,a=new Date().toISOString(),n=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,c=b({...e,submitted_at:a,created_by:n});this.dispatch(Fa(c));const r=this.enqueueRequest({description:"Add issue association",method:l.POST,url:"/issue-associations/",payload:v(c),blockers:[e.associated_issue,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[c.uuid]});return r.then(m=>{this.dispatch(fl(m))}).catch(()=>{this.dispatch(Oa(c.uuid))}),[c,r]}async delete(e){const{store:i}=this.client,a=Sl(e)(i.getState());if(!a)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(Oa(e));const n=this.enqueueRequest({description:"Delete issue association",method:l.DELETE,url:`/issue-associations/${e}/`,blockers:[e],blocks:[]});return n.catch(()=>{this.dispatch(Fa(a))}),n}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Fetch issue associations",method:l.GET,url:"/issue-associations/",queryParams:{limit:V,paginate:!0,associated_issue__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Fetch issue associations",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Al(n)),n}}class TF extends Ke{constructor(){super(...arguments);T(this,"name","Issue Attachment");T(this,"url","/issue-attachments");T(this,"initializeAttachments",va);T(this,"addAttachments",wa);T(this,"updateAttachments",Ol);T(this,"removeAttachments",Ma);T(this,"removeAttachment",_l);T(this,"setAttachment",Pl);T(this,"selectAttachment",Ml)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,issue:i.modelUuid})}buildAttachmentPayload(i){return{...i,issue:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.issueUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const c=(await this.performPagination({immediate:!0,description:"Get issue attachments",method:l.GET,url:`${this.url}/`,queryParams:{limit:We,paginate:!0,issue__project:i},blocks:[],blockers:[]},r=>({immediate:!0,description:"Get issue attachments",method:l.GET,url:r,blockers:[],blocks:[]}),a)).flat();return this.dispatch(va(c)),c}}class IF extends Ke{constructor(){super(...arguments);T(this,"name","Issue Comment Attachment");T(this,"url","/issue-comment-attachments");T(this,"initializeAttachments",Va);T(this,"addAttachments",jl);T(this,"updateAttachments",zl);T(this,"removeAttachments",Ul);T(this,"removeAttachment",Dl);T(this,"setAttachment",ql);T(this,"selectAttachment",Bl)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,issue_comment:i.modelUuid})}buildAttachmentPayload(i){return{...i,issue_comment:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.issueCommentUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const c=(await this.performPagination({immediate:!0,description:"Get issue comment attachments",method:l.GET,url:`${this.url}/`,queryParams:{limit:We,paginate:!0,issue_comment__issue__project:i},blocks:[],blockers:[]},r=>({immediate:!0,description:"Get issue comment attachments",method:l.GET,url:r,blockers:[],blocks:[]}),a)).flat();return this.dispatch(Va(c)),c}}class gF extends _{add(e){var c;const{store:i}=this.client,a=b({...e,author:(c=i.getState().userReducer.currentUser)==null?void 0:c.id,submitted_at:new Date().toISOString()});this.dispatch(qa(a));const n=this.enqueueRequest({description:"Add issue comment",method:l.POST,url:"/issue-comments/",payload:v(a),blockers:[e.issue],blocks:[a.uuid]});return n.catch(()=>{this.dispatch(Da(a.uuid))}),[a,n]}update(e){const{store:i}=this.client,a=Ua(e.uuid)(i.getState());if(!a)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const n={...a,...e};this.dispatch(za(n));const c=this.enqueueRequest({description:"Edit issue comment",method:l.PATCH,url:`/issue-comments/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.catch(()=>{this.dispatch(za(a))}),[n,c]}remove(e){const{store:i}=this.client,a=Ua(e)(i.getState());if(!a)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(Da(e));const n=this.enqueueRequest({description:"Delete comment",method:l.DELETE,url:`/issue-comments/${e}/`,blockers:[e],blocks:[]});return n.catch(()=>{this.dispatch(qa(a))}),n}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get comments",method:l.GET,url:"/issue-comments/",queryParams:{issue__project:e},blockers:[],blocks:[]},i);return this.dispatch(Ll(a)),a}}class bF extends _{add(e){var m;const{store:i}=this.client,a=i.getState(),n=new Date().toISOString(),c=(m=a.userReducer.currentUser)==null?void 0:m.id,r=b({...e,submitted_at:n,created_by:c});this.dispatch(ka(r));const u=this.enqueueRequest({description:"Create issue",method:l.POST,url:"/issues/",payload:v(r),blockers:[r.project,r.issue_type,...r.category?[r.category]:[]],blocks:[r.uuid]});return u.then(o=>{this.dispatch(Ht(o))}).catch(o=>{throw this.dispatch(Ba(r.uuid)),o}),[r,u]}update(e){var m;const i=this.client.store.getState(),a=La(e.uuid)(i);if(!a)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const n={...a,...e};this.dispatch(Ht(n));const c={};for(const o of[E.TITLE,E.DESCRIPTION,E.STATUS,E.CATEGORY,E.PRIORITY,E.ASSIGNED_TO,E.DUE_DATE])if(o in e&&e[o]!==a[o])switch(o){case E.PRIORITY:case E.STATUS:{const h=e[o];c[o]=h!==void 0?Number(h):null;break}case E.DUE_DATE:case E.DESCRIPTION:case E.TITLE:c[o]=e[o]??null;break;case E.CATEGORY:{let h=null;const p=e[o];if(p&&(h=i.categoryReducer.instances[p]??null,!h))throw new Error(`Trying to update issue category to ${p} which does not exist in store`);c[o]=h?{name:h.name,color:h.color,uuid:h.uuid}:null;break}case E.ASSIGNED_TO:{let h=null;const p=e[o];if(p&&(h=i.userReducer.instances[p]??null,!h))throw new Error(`Trying to update issue assigned_to to ${p} which does not exist in store`);c[o]=h?{full_name:h.username,id:h.id}:null;break}}const r=b({created_by:(m=i.userReducer.currentUser)==null?void 0:m.id,submitted_at:new Date().toISOString(),issue:a.uuid,changes:c});this.dispatch(sm(r));const u=this.enqueueRequest({description:"Edit issue",method:l.PATCH,url:`/issues/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.catch(()=>{this.dispatch(Ht(a)),this.dispatch(am(r.uuid))}),[n,u]}async remove(e){const{store:i}=this.client,a=i.getState(),n=La(e)(a);if(!n)throw new Error(`No issue with uuid ${e} found in the store`);const c=wl(e)(a),r=dm(e)(a),u={};for(const o of Tl(e)(a))u[o.uuid]=o;for(const o of Il(e)(a))u[o.uuid]=o;const m=Object.values(u);this.dispatch(Ba(e)),c.length>0&&this.dispatch(Ma(c.map(({uuid:o})=>o))),r.length>0&&this.dispatch(nm(r.map(({uuid:o})=>o))),m.length>0&&this.dispatch(_a(m.map(({uuid:o})=>o)));try{return await this.enqueueRequest({description:"Delete issue",method:l.DELETE,url:`/issues/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(ka(n)),this.dispatch(wa(c)),this.dispatch(im(r)),this.dispatch(Pa(m)),o}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get issues",method:l.GET,url:"/issues/",queryParams:{limit:V,paginate:!0,project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get issues",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Kl(n)),n}}class FF extends Ke{constructor(){super(...arguments);T(this,"name","Issue Type Attachment");T(this,"url","/issue-type-attachments");T(this,"initializeAttachments",Ha);T(this,"addAttachments",xl);T(this,"updateAttachments",th);T(this,"removeAttachments",ih);T(this,"removeAttachment",sh);T(this,"setAttachment",eh);T(this,"selectAttachment",ch)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,issue_type:i.modelUuid})}buildAttachmentPayload(i){return{...i,issue_type:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.issueTypeUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=await this.enqueueRequest({immediate:!0,description:"Get issue type attachments",method:l.GET,url:`${this.url}/`,queryParams:{issue_type__organization:i},blocks:[],blockers:[]},a);return this.dispatch(Ha(n)),n}}class PF extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const o of e){const{fieldsRevisionUuid:h,fieldIdentifier:p,file:y}=o,A=await this.getFilePayload(y);A.sha1 in n||(n[A.sha1]=A);const g=b({file:URL.createObjectURL(y),file_type:y.type,file_name:y.name,file_sha1:A.sha1,created_by:a,fields_revision:h,submitted_at:i,field_identifier:p});c.push(g);const F={uuid:g.uuid,file_name:y.name,file_extension:A.extension,field_identifier:p,file_sha1:A.sha1,fields_revision:h};r.push(F)}this.dispatch(oh(c));const u=this.enqueueRequest({description:"Add issue type fields attachments",method:l.POST,url:"/issue-type-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(o=>o.fields_revision),blocks:c.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(lh(o.attachments))}).catch(()=>{this.dispatch(hh(c.map(o=>o.uuid)))}),[c,u.then(({attachments:o})=>o)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"get issue type fields attachments",method:l.GET,url:"/issue-type-fields-attachments/",queryParams:{fields_revision__issue_type__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(uh(a)),a}}class OF extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(bh(c));const r=this.enqueueRequest({description:"Add Issue Type Fields",method:l.POST,url:"/issue-type-fields/",payload:v(c),blockers:[c.issue_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(Fh(m))}).catch(m=>{throw this.dispatch(Ph(c.uuid)),m}),[c,r]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get Issue Type Fields",method:l.GET,url:"/issue-type-fields/",queryParams:{issue_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(gh(a)),a}}class _F extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const o of e){const{fieldValuesUuid:h,fieldIdentifier:p,file:y}=o,A=await this.getFilePayload(y);A.sha1 in n||(n[A.sha1]=A);const g=b({file:URL.createObjectURL(y),file_type:y.type,file_name:y.name,file_sha1:A.sha1,created_by:a,field_values:h,submitted_at:i,field_identifier:p});c.push(g);const F={uuid:g.uuid,file_name:y.name,file_sha1:A.sha1,file_extension:A.extension,field_identifier:p,field_values:h};r.push(F)}this.dispatch(Kt(c));const u=this.enqueueRequest({description:"Add issue type field values attachments",method:l.POST,url:"/issue-type-field-values-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(o=>o.field_values),blocks:c.map(o=>o.uuid)});return u.then(({presigned_urls:o,attachments:h})=>{this.processPresignedUrls(o),this.dispatch(wh(h))}).catch(o=>{throw this.dispatch(Yt(c.map(h=>h.uuid))),o}),[c,u.then(({attachments:o})=>o)]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=Eh(e)(a);this.dispatch(Yt(e));try{await this.enqueueRequest({description:"Delete issue type field values attachments",method:l.DELETE,url:"/issue-type-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(Kt(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get issue type field values attachments",method:l.GET,url:"/issue-type-field-values-attachments/",queryParams:{limit:We,paginate:!0,field_values__issue__project:e,latest:!0},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get issue type field values attachments",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(vh(n)),n}}class RF extends _{add(e){var r;const{store:i}=this.client,a=i.getState(),n=b({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add issue type field values",method:l.POST,url:"/issue-type-field-values/",payload:v(n),blockers:[e.issue,e.fields_revision],blocks:[n.uuid]});return this.dispatch(Ya(n)),c.then(u=>(this.dispatch(It(u)),u)).catch(()=>{this.dispatch(Za(n.uuid))}),[n,c]}update(e){const{store:i}=this.client,a=i.getState(),n=Xa(e.uuid)(a);if(!n)throw new Error(`Expected IssueTypeFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(It(c));const r=this.enqueueRequest({description:"Update issue type field values",method:l.PATCH,url:`/issue-type-field-values/${e.uuid}/`,payload:e,blockers:[c.uuid,c.fields_revision,c.issue],blocks:[c.uuid]});return r.then(u=>{this.dispatch(It(u))}).catch(()=>{this.dispatch(It(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Xa(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=Vh(e)(a);this.dispatch(Za(e)),this.dispatch(Yt(c.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete issue type field values",method:l.DELETE,url:`/issue-type-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(Ya(n)),this.dispatch(Kt(c)),r}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get issue type field values",method:l.GET,url:"/issue-type-field-values/",queryParams:{limit:V,paginate:!0,issue__project:e,latest:!0},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get issue type field values",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(fh(n)),n}}class vF extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(sn(c));const r=this.enqueueRequest({description:"Create issue type identifier",method:l.POST,url:"/issue-type-identifiers/",payload:v(c),blockers:[c.issue_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(gt(m))}).catch(()=>{this.dispatch(an(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=nn(e.uuid)(i.getState());if(!a)throw new Error(`Expected issue type identifier with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(gt(n));const c=this.enqueueRequest({description:"Update issue type identifier",method:l.PATCH,url:`/issue-type-identifiers/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(gt(r))}).catch(()=>{this.dispatch(gt(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=nn(e)(a);if(!n)throw new Error(`Expected issue type identifier with uuid ${e} to exist`);this.dispatch(an(e));try{return await this.enqueueRequest({description:"Delete issue type identifier",method:l.DELETE,url:`/issue-type-identifiers/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(sn(n)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get issue type identifiers",method:l.GET,url:"/issue-type-identifiers/",queryParams:{issue_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(zh(a)),a}}class wF extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(rn(c));const r=this.enqueueRequest({description:"Create issue type identifier value",method:l.POST,url:"/issue-type-identifier-values/",payload:v(c),blockers:[e.issue,e.issue_type_identifier],blocks:[c.uuid]});return r.then(m=>{this.dispatch(bt(m))}).catch(()=>{this.dispatch(dn(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=on(e.uuid)(i.getState());if(!a)throw new Error(`Expected issue type identifier value with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(bt(n));const c=this.enqueueRequest({description:"Update issue type identifier value",method:l.PATCH,url:`/issue-type-identifier-values/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(bt(r))}).catch(()=>{this.dispatch(bt(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=on(e)(a);if(!n)throw new Error(`Expected issue type identifier value with uuid ${e} to exist`);this.dispatch(dn(e));try{return await this.enqueueRequest({description:"Delete issue type identifier value",method:l.DELETE,url:`/issue-type-identifier-values/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(rn(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get issue type identifier values",method:l.GET,url:"/issue-type-identifier-values/",queryParams:{limit:V,paginate:!0,issue__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get issue type identifier values",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Bh(n)),n}}class MF extends _{add(e){var r;const{store:i}=this.client,a=i.getState(),n=b({...e,submitted_at:new Date().toISOString(),created_by:(r=a.userReducer.currentUser)==null?void 0:r.id});this.dispatch(Hh(n));const c=this.enqueueRequest({method:l.POST,url:"/issue-types/",payload:v(n),blockers:[],blocks:[n.uuid]});return c.then(u=>{this.dispatch(Ft(u))}).catch(()=>{this.dispatch(hn(n.uuid))}),[n,c]}update(e){const{store:i}=this.client,a=i.getState(),n=pn(e.uuid)(a);if(!n)throw new Error(`IssueType with uuid ${e.uuid} does not exist in the store.`);const c={...n,...e};this.dispatch(Wh(c));const r=this.enqueueRequest({method:l.PATCH,url:`/issue-types/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(Ft(u))}).catch(()=>{this.dispatch(Ft(n))}),[c,r]}delete(e){const{store:i}=this.client,a=i.getState(),n=pn(e)(a);if(!n)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const c=Jl(e)(a);this.dispatch(hn(e)),this.dispatch(Zl(c.map(u=>u.uuid)));const r=this.enqueueRequest({method:l.DELETE,url:`/issue-types/${e}/`,blockers:[e],blocks:[]});return r.catch(()=>{this.dispatch(Ft(n)),this.dispatch(Yl(c))}),r}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,method:l.GET,url:"/issue-types/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(Nh(a)),a}}class EF extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(An(c));const r=this.enqueueRequest({description:"Create Issue Type Status",method:l.POST,url:"/issue-type-statuses/",payload:v(c),blockers:[e.issue_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(Zt(m))}).catch(()=>{this.dispatch(fn(c.uuid))}),[c,r]}update(e){const i=this.client.store.getState(),a=Tn(e.uuid)(i);if(!a)throw new Error(`Expected an existing issue type status with uuid ${e.uuid}`);const n={...a,...e};this.dispatch(Xh(n));const c=this.enqueueRequest({description:"Edit Issue Type Status",method:l.PATCH,url:`/issue-type-statuses/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(Zt(r))}).catch(()=>{this.dispatch(Zt(a))}),[n,c]}delete(e){const{store:i}=this.client,a=Tn(e)(i.getState());if(!a)throw new Error(`No issue type status with uuid ${e} found in the store`);this.dispatch(fn(e));const n=this.enqueueRequest({description:"Delete Issue Type Status",method:l.DELETE,url:`/issue-type-statuses/${e}/`,blockers:[e],blocks:[]});return n.catch(()=>{this.dispatch(An(a))}),n}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get issue type statuses",method:l.GET,url:"/issue-type-statuses/",queryParams:{issue_type__organization:e},blocks:[],blockers:[]},i);return this.dispatch(Jh(a)),a}}class VF extends _{async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get issue updates",method:l.GET,url:"/issue-updates/",queryParams:{limit:V,paginate:!0,issue__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get issue updates",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(tm(n)),n}}const jF=1800;function qF(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 zF extends Eb{constructor(){super(...arguments);T(this,"_getRenewedTokens",async i=>{const a=this.enqueueRequest({description:"Get renewed tokens",method:l.POST,url:this.refreshTokensUrl,payload:{refresh:i},isAuthNeeded:!1,blockers:[],blocks:[],checkAuth:!1,immediate:!0});let n;try{n=await a}catch(c){console.error("Could not renew tokens; clearing auth",c),this.clearAuth();return}if(!n.access)throw new Error("Missing access token");return{accessToken:n.access,refreshToken:n.refresh??this.getRefreshToken()}})}clearAuth(){console.debug(this.constructor.name,"clearing auth;"),this.dispatch(ju(!1)),this.clearTokens(),this.dispatch(I()),this.dispatch(I())}async renewTokens(){const i=this.getRefreshToken();if(!i)throw new Error("No refresh token found");console.debug(this.constructor.name,"renewing tokens");try{const a=await this._getRenewedTokens(i);if(!a)return;console.log("Got renewed tokens"),this.setTokens(a)}catch(a){throw console.error("Could not renew tokens; clearing auth",a),this.clearAuth(),a}}tokenIsExpiringSoon(){const i=this.getAccessToken();if(!i)return!1;const a=Date.now()/1e3;let n;try{n=dy(i).exp??a}catch{n=a}return n-a<jF}getAuthHeader(){return`Bearer ${this.getAccessToken()}`}async prepareAuth(){if(this.tokenIsExpiringSoon()){console.debug(this.constructor.name,"preparing auth");try{await this.renewTokens()}catch(i){return i instanceof U&&this.clearAuth(),i instanceof Error?Promise.reject(i):Promise.reject(new Error((i??tt).toString()))}}}async handleUnauthorized(i,a){const n=this.client.store.getState();if(i.url.endsWith("/token/refresh/"))throw n.authReducer.isLoggedIn&&console.warn("No signed-in user to sign out."),this.clearAuth(),new U({message:"You have been signed out due to inactivity.",response:a,discard:!0});if(n.authReducer.isLoggedIn)await this.renewTokens();else throw console.debug("Forbidden; user is not logged in."),new U({message:"Incorrect username or password.",response:a,discard:!0})}async initAuth(i){const a=Qe.v4();return console.debug(this.constructor.name,"Initiating auth"),this.enqueueRequest({uuid:a,description:"Get token pair",method:l.POST,url:this.initTokensUrl,payload:i,isAuthNeeded:!1,checkAuth:!1,immediate:!0,blockers:[],blocks:[]}).then(n=>{this.setTokens(qF(n))})}}class DF extends _{update(e){const{store:i}=this.client,a=On(e.uuid)(i.getState()),n={...a,...e};this.dispatch(Xt(n));const c=this.enqueueRequest({description:"Edit organization access",method:l.PATCH,url:`/organization-accesses/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(Xt(r))}).catch(r=>{throw this.dispatch(Xt(a)),r}),[n,c]}async remove(e){const{store:i}=this.client,a=i.getState(),n=On(e)(a),c=Am(n.user)(a);this.dispatch(Im(n.uuid)),this.dispatch(mm(n.user));try{await this.enqueueRequest({description:"Remove organization access",method:l.DELETE,url:`/organization-accesses/${n.uuid}/`,blockers:[n.uuid],blocks:[]})}catch(r){throw this.dispatch(Tm(n)),this.dispatch(hm(c)),r}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get organization accesses",method:l.GET,url:"/organization-accesses/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(Sm(a)),a}}class UF extends _{async add(e){const i=await this.enqueueRequest({description:"Create organization",method:l.POST,url:"/organizations/",payload:e,blockers:[],blocks:[]});return this.dispatch(Om(i)),i}async update(e){const i=await this.enqueueRequest({description:"Edit organization",method:l.PATCH,url:`/organizations/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return this.dispatch(_m(i)),i}async invite(e,i){return this.enqueueRequest({description:"Invite user to organization",method:l.POST,url:`/organizations/${e}/invite/${i}/`,blockers:[],blocks:[]})}async refreshStore(e){const i=await this.enqueueRequest({immediate:!0,description:"Fetch organizations",method:l.GET,url:"/organizations/",blockers:[],blocks:[]},e);return this.dispatch(Pm(i)),i}}class CF extends _{add(e){var c;const{store:i}=this.client,a=b({...e,created_by:(c=i.getState().userReducer.currentUser)==null?void 0:c.id});this.dispatch(wn(a));const n=this.enqueueRequest({description:"Add project access",method:l.POST,url:"/project-accesses/",payload:v(a),blockers:[a.organization_access,a.project],blocks:[a.uuid]});return n.then(r=>{this.dispatch(Pt(r))}).catch(r=>{throw this.dispatch(En(a.uuid)),r}),[a,n]}bulkAdd(e){var r;const{store:i}=this.client,a=(r=i.getState().userReducer.currentUser)==null?void 0:r.id,n=e.map(u=>b({...u,created_by:a}));this.dispatch(Mn(n));const c=this.enqueueRequest({description:"Add project accesses",method:l.POST,url:"/project-accesses/bulk/",payload:{project_accesses:n.map(u=>v(u))},blockers:n.flatMap(u=>[u.project,u.organization_access]),blocks:n.map(u=>u.uuid)});return c.then(u=>{this.dispatch(Um(u))}).catch(u=>{throw this.dispatch(Vn(n.map(m=>m.uuid))),u}),[n,c]}update(e){const{store:i}=this.client,a=qn(e.uuid)(i.getState()),n={...a,...e};this.dispatch(Pt(n));const c=this.enqueueRequest({description:"Edit project access",method:l.PATCH,url:`/project-accesses/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[]});return c.then(r=>{this.dispatch(Pt(r))}).catch(r=>{throw this.dispatch(Pt(a)),r}),[n,c]}async remove(e){const{store:i}=this.client,a=qn(e)(i.getState());this.dispatch(En(e));try{await this.enqueueRequest({description:"Delete project access",method:l.DELETE,url:`/project-accesses/${e}/`,blockers:[e],blocks:[]})}catch(n){throw this.dispatch(wn(a)),n}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get project accesses",method:l.GET,url:"/project-accesses/",queryParams:{project__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Dm(a)),a}}class kF extends Ke{constructor(){super(...arguments);T(this,"name","Project Attachment");T(this,"url","/project-attachments");T(this,"addAttachments",Gm);T(this,"updateAttachments",Hm);T(this,"removeAttachments",Dn);T(this,"removeAttachment",Wm);T(this,"setAttachment",Lm);T(this,"selectAttachment",Zm)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,project:i.modelUuid})}buildAttachmentPayload(i){return{...i,project:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.projectUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=await this.enqueueRequest({immediate:!0,description:"Get project attachments",method:l.GET,url:`${this.url}/`,queryParams:{project__organization:i},blockers:[],blocks:[]},a);return this.dispatch($m(n)),n}}class BF extends _{async saveExisting(e){if(!e.uuid)throw new Error("You can only use this method to save existing project files. The one provided has no uuid.");const i={...e};delete i.file;const a=this.enqueueRequest({method:l.PATCH,url:`/project-files/${e.uuid}/`,payload:i,blockers:[e.uuid],blocks:[e.uuid]});return a.then(n=>{this.dispatch(Cn(n))}),a}saveActive(){const{store:e}=this.client,i=e.getState(),a=i.projectFileReducer.activeProjectFileId;if(!a)throw new Error("No active project file");const n=i.projectFileReducer.instances[a];if(!n)throw new Error("No active project file");if(!n.bounds&&!n.canvas_bounds)throw new Error("Project file must either have bounds or canvas_bounds set");let c;if(typeof n.file=="string"&&!n.file.startsWith("blob:")){const m={...n};delete m.file,c={method:l.PATCH,url:`/project-files/${a}/`,payload:m,blockers:[a],blocks:[a]}}else c=new Promise((m,o)=>{this.client.files.uploadFileToS3(n.file_sha1).then(([h])=>{m({method:l.POST,url:"/project-files/",payload:{...n,...h},blockers:[a],blocks:[a]})}).catch(o)});const u=Promise.resolve(c).then(m=>this.enqueueRequest(m));return u.then(m=>{this.dispatch(Cn(m))}),this.dispatch(np),this.dispatch(ap(null)),this.dispatch(ip(!1)),[n,u]}delete(e){return this.dispatch(tp(e)),this.enqueueRequest({method:l.DELETE,url:`/project-files/${e}`,blockers:[e],blocks:[]})}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get project files",method:l.GET,url:"/project-files/",queryParams:{limit:V,paginate:!0,project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get project files",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(xm(n)),n}}class $F extends _{async add(e){const i=await this.enqueueRequest({description:"Create project",method:l.POST,url:"/projects/",payload:v(e),blockers:[],blocks:[]});return this.dispatch(Bn(i)),i}async update(e){if(!e.bounds&&!e.canvas_bounds)throw new Error("Project must either have bounds or canvas_bounds set");return this.dispatch(lp(e)),await this.enqueueRequest({description:"Update project",method:l.PATCH,url:`/projects/${e.uuid}/`,payload:{name:e.name,bounds:e.bounds},blockers:[e.uuid],blocks:[e.uuid]})}async delete(e){const{store:i}=this.client,a=i.getState(),n=pp(e)(a);if(!n)throw new Error("Expected project to exist");const c=rp(a).filter(m=>m.project===e);this.dispatch(sp(c.map(({uuid:m})=>m)));const r=Jm(n.uuid)(a);this.dispatch(Dn(r.map(({uuid:m})=>m)));const u=km(e)(a);this.dispatch(Vn(u.map(({uuid:m})=>m))),this.dispatch($n(n.uuid));try{await this.enqueueRequest({description:"Delete project",method:l.DELETE,url:`/projects/${e}/`,blockers:[e],blocks:[]}),this.dispatch($n(n.uuid))}catch(m){throw this.dispatch(Bn(n)),this.dispatch(Mn(Object.values(u))),this.dispatch(ep(c)),this.dispatch(Nm(r)),m}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch projects",method:l.GET,url:"/projects/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(op(a)),a}}class GF extends _{add(e){var c;const{store:i}=this.client,a=b({...e,created_by:(c=i.getState().userReducer.currentUser)==null?void 0:c.id});this.dispatch(Sp(a));const n=this.enqueueRequest({description:"Create team membership",method:l.POST,url:"/team-memberships/",payload:v(a),blockers:[e.team],blocks:[a.uuid]});return n.then(r=>{this.dispatch(Hn(r))}).catch(()=>{this.dispatch(Wn(a.uuid))}),[a,n]}bulkAdd(e){var r;const{store:i}=this.client,a=(r=i.getState().userReducer.currentUser)==null?void 0:r.id,n=e.map(u=>b({...u,created_by:a}));this.dispatch(Tp(n));const c=this.enqueueRequest({description:"Create team memberships",method:l.POST,url:"/team-memberships/bulk/",payload:{team_memberships:n.map(u=>v(u))},blockers:n.map(u=>u.team),blocks:n.map(u=>u.uuid)});return c.then(u=>{this.dispatch(Ip(u))}).catch(()=>{this.dispatch(gp(n.map(u=>u.uuid)))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Pp(e)(a);if(!n)throw new Error(`Expected team membership with uuid ${e} to exist`);this.dispatch(Wn(e));try{return await this.enqueueRequest({description:"Delete team membership",method:l.DELETE,url:`/team-memberships/${e}/`,blockers:[e],blocks:[e]})}catch(c){throw this.dispatch(Hn(n)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch team memberships",method:l.GET,url:"/team-memberships/",queryParams:{team__organization:e},blockers:[],blocks:[]},i);return this.dispatch(fp(a)),a}}class LF extends _{add(e){var c;const{store:i}=this.client,a=b({...e,submitted_at:new Date().toISOString(),created_by:(c=i.getState().userReducer.currentUser)==null?void 0:c.id});this.dispatch(Rp(a));const n=this.enqueueRequest({description:"Create team",method:l.POST,url:"/teams/",payload:v(a),blockers:[],blocks:[a.uuid]});return n.then(r=>{this.dispatch(Ot(r))}).catch(()=>{this.dispatch(Zn(a.uuid))}),[a,n]}update(e){const{store:i}=this.client,a=Xn(e.uuid)(i.getState());if(!a)throw new Error(`Expected team with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(vp(n));const c=this.enqueueRequest({description:"Update team",method:l.PATCH,url:`/teams/${e.uuid}/`,payload:v(e),blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(Ot(r))}).catch(()=>{this.dispatch(Ot(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Xn(e)(a);if(!n)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(Zn(e));try{return await this.enqueueRequest({description:"Delete team",method:l.DELETE,url:`/teams/${e}/`,blockers:[e],blocks:[e]})}catch(c){throw this.dispatch(Ot(n)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch teams",method:l.GET,url:"/teams/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(_p(a)),a}}class NF extends _{async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch organization users",method:l.GET,url:`/organizations/${e}/users/`,blockers:[],blocks:[]},i);return this.dispatch(lm(a)),a}}class HF{constructor(e){T(this,"store");this.store=e}async enqueueRequest(e,i,a,n){return this._enqueueRequest(e,i,a,n).then(c=>{if(c instanceof U)throw c;return c})}_enqueueRequest(e,i,a,n){const c=new pc,r={...e,BASE_URL:i,serviceName:a};if(e.immediate){const u={...r,uuid:e.uuid??Qe.v4()},m={payload:u,type:"",meta:{offline:{effect:{timestamp:new Date().toISOString(),request:u,BASE_URL:i,serviceName:a}}}};xn(m,this,n).then(o=>{c.resolve(o.body)}).catch(o=>{ec(o,m),o instanceof Error?c.reject(o):c.reject(new Error((o??tt).toString()))})}else{const u=this.store.dispatch(Em(r)),m=h=>{if(h)c.resolve(h.body);else{const p=new U({message:"Could not get a response from the server.",response:h,discard:!0});c.reject(p)}},o=h=>{h instanceof U?h.options.discard=!0:(console.error("Received an unexpected error while processing a request:",h,`
15
- Converting error to APIError and discarding.`),h=new U({message:"An error occurred while processing the request.",innerError:h,discard:!0})),c.reject(h)};u.then(m,o)}return c}}class st{constructor(){T(this,"graph");T(this,"requestAttemptCounter");this.graph=new uy.DepGraph,this.requestAttemptCounter={}}static _fromOutbox(e){const i=new st;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 r=e[c];if(!r){console.error("Previous outbox item was undefined");continue}r.payload.uuid!==n.payload.uuid&&r.payload.blocks.some(u=>n.payload.blockers.includes(u))&&st._addDependency(n.payload.uuid,r.payload.uuid,i.graph)}}return i}_addDependency(e,i){st._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);e.payload.blockers.some(n=>a.payload.blocks.includes(n))&&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;this.graph.getNodeData(i).payload.blockers.some(n=>e.payload.blocks.includes(n))&&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 Np;function Hp(t){Np=t}function it(){return Np}let Wp;function Kp(t){Wp=t}function Yp(){return Wp}let ac=null;function Je(){const t=it();if(!t)return console.warn("Client store not set; cannot get outbox coordinator yet."),null;if(ac)return ac;const e=t.getState().offline.outbox,i=st._fromOutbox(e);return ac=i,i}const WF=(t,e)=>{const i=new e(t);return Kp(i),Hp(t),i};class KF{constructor(e){T(this,"_all");T(this,"_previous");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 nc{constructor(){T(this,"next");this.next=null}then(e){return new KF(this).then(e)}async run(e){if(this.next)return this.next.run(e);{if(console.debug("Middleware finished. Performing request:",e),!it())throw new Error("Client store not set");const a=Yp();if(!a)throw new Error("Client SDK not set");return xn(e,a)}}}class Zp extends nc{async run(e){return super.run(e)}}class Jp extends nc{async run(e){return super.run(e)}}const Xp=new Zp().then(new Jp).compile();function Qp(t){var e;return(e=Xp[0])==null?void 0:e.run(t)}var xp=(t=>(t[t.USER_REGISTRATION=0]="USER_REGISTRATION",t[t.APPLICATION_INVITE=2]="APPLICATION_INVITE",t[t.PROJECT_INVITE=4]="PROJECT_INVITE",t[t.ORGANIZATION_INVITE=6]="ORGANIZATION_INVITE",t[t.ADD_EMAIL_DOMAIN=8]="ADD_EMAIL_DOMAIN",t[t.RESET_PASSWORD=10]="RESET_PASSWORD",t))(xp||{});s.ALL_MIDDLEWARE=Xp,s.APIError=U,s.ATTACHMENT_PAGINATION_PAGE_SIZE=We,s.AgentService=Vb,s.AssetAttachmentService=jb,s.AssetProcedureService=kb,s.AssetProcedureStepFieldValuesAttachmentService=Lb,s.AssetProcedureStepFieldValuesService=Nb,s.AssetProcedureStepFieldsAttachmentService=$b,s.AssetProcedureStepFieldsService=Gb,s.AssetProcedureStepService=Hb,s.AssetProcedureTypeAttachmentService=qb,s.AssetProcedureTypeFieldValuesAttachmentService=Ub,s.AssetProcedureTypeFieldValuesService=Cb,s.AssetProcedureTypeFieldsAttachmentService=zb,s.AssetProcedureTypeFieldsService=Db,s.AssetProcedureTypeService=Bb,s.AssetService=Wb,s.AssetStageCompletionService=Kb,s.AssetStageService=Yb,s.AssetTypeAttachmentService=Zb,s.AssetTypeFieldValuesAttachmentService=Qb,s.AssetTypeFieldValuesService=xb,s.AssetTypeFieldsAttachmentService=Jb,s.AssetTypeFieldsService=Xb,s.AssetTypeIdentifierService=eF,s.AssetTypeIdentifierValueService=tF,s.AssetTypeService=sF,s.AttachmentModel=lc,s.BaseApiService=_,s.BaseSDK=HF,s.COMMON_AUTO_FIELDS=Tc,s.CategoryService=iF,s.DEFAULT_ISSUE_PRIORITY=ly,s.DEFAULT_ISSUE_STATUS=oy,s.DEFAULT_PAGINATION_PAGE_SIZE=V,s.DeferredPromise=pc,s.DocumentAttachmentService=aF,s.DocumentService=nF,s.EMPTY_ARRAY=dc,s.EMPTY_OBJECT=uc,s.EmailDomainsService=cF,s.EmailVerificationService=rF,s.FileService=uF,s.FormIdentifierService=oF,s.FormIdentifierValueService=lF,s.FormRevisionAttachmentService=hF,s.FormRevisionService=mF,s.FormService=pF,s.FormSubmissionAttachmentService=yF,s.FormSubmissionService=AF,s.GeoImageService=fF,s.HttpMethod=l,s.IssueAssociationService=SF,s.IssueAttachmentService=TF,s.IssueCommentAttachmentService=IF,s.IssueCommentService=gF,s.IssuePriority=ts,s.IssueService=bF,s.IssueStatus=ss,s.IssueStatusType=hc,s.IssueTypeAttachmentService=FF,s.IssueTypeFieldValuesAttachmentService=_F,s.IssueTypeFieldValuesService=RF,s.IssueTypeFieldsAttachmentService=PF,s.IssueTypeFieldsService=OF,s.IssueTypeIdentifierService=vF,s.IssueTypeIdentifierValueService=wF,s.IssueTypeService=MF,s.IssueTypeStatusService=EF,s.IssueUpdateChange=E,s.IssueUpdateService=VF,s.JWTService=zF,s.OUTBOX_RETRY_DELAY=mc,s.OfflineAnalyticsMiddleware=Zp,s.OfflineMiddleware=nc,s.OrganizationAccessLevel=oc,s.OrganizationAccessService=DF,s.OrganizationService=UF,s.OutboxCoordinator=st,s.ProjectAccessService=CF,s.ProjectAttachmentService=kF,s.ProjectFileService=BF,s.ProjectService=$F,s.RESET_ORGANIZATION_STATE=O,s.RESET_PROJECT_STATE=M,s.RESET_STATE=I,s.RateLimitingMiddleware=Jp,s.SelectorBuilder=fb,s.TeamMembershipService=GF,s.TeamService=LF,s.UNKNOWN_ERROR_MESSAGE=tt,s.UserService=NF,s.VERSION_REDUCER_KEY=at,s.VerificationCodeType=xp,s._setLatestRetryTime=jm,s.addAsset=Js,s.addAssetAttachment=By,s.addAssetAttachments=ls,s.addAssetProcedure=Os,s.addAssetProcedureStep=od,s.addAssetProcedureStepFieldValues=Ns,s.addAssetProcedureStepFieldValuesAttachment=WA,s.addAssetProcedureStepFieldValuesAttachments=Mt,s.addAssetProcedureStepFieldValuesMany=sd,s.addAssetProcedureStepFields=Us,s.addAssetProcedureStepFieldsAttachment=MA,s.addAssetProcedureStepFieldsAttachments=Cr,s.addAssetProcedureStepFieldsMany=UA,s.addAssetProcedureSteps=ld,s.addAssetProcedureType=Es,s.addAssetProcedureTypeAttachment=Ly,s.addAssetProcedureTypeAttachments=Gc,s.addAssetProcedureTypeFieldValues=Is,s.addAssetProcedureTypeFieldValuesAttachment=dA,s.addAssetProcedureTypeFieldValuesAttachments=vt,s.addAssetProcedureTypeFieldValuesMany=gr,s.addAssetProcedureTypeFields=rr,s.addAssetProcedureTypeFieldsAttachment=Ky,s.addAssetProcedureTypeFieldsAttachments=xc,s.addAssetProcedureTypeFieldsMany=eA,s.addAssetProcedureTypes=FA,s.addAssetProcedures=vr,s.addAssetStage=ui,s.addAssetStageCompletion=ii,s.addAssetStageCompletions=ai,s.addAssetStages=ff,s.addAssetType=qi,s.addAssetTypeAttachment=Ff,s.addAssetTypeAttachments=mi,s.addAssetTypeFieldValues=Ii,s.addAssetTypeFieldValuesAttachment=$f,s.addAssetTypeFieldValuesAttachments=Ct,s.addAssetTypeFieldValuesMany=pu,s.addAssetTypeFields=eu,s.addAssetTypeFieldsAttachment=_f,s.addAssetTypeFieldsAttachments=Wd,s.addAssetTypeFieldsMany=jf,s.addAssetTypeIdentifier=Oi,s.addAssetTypeIdentifierValue=wi,s.addAssetTypeIdentifierValues=iS,s.addAssetTypeIdentifiers=Xf,s.addAssetTypes=hS,s.addAssets=qt,s.addCategories=gS,s.addCategory=ki,s.addConversation=Rc,s.addConversations=jy,s.addDocumentAttachment=vS,s.addDocumentAttachments=Lu,s.addDocuments=eo,s.addEmailDomain=no,s.addEmailDomains=zS,s.addForm=oa,s.addFormIdentifier=Zi,s.addFormIdentifierValue=xi,s.addFormIdentifierValues=ZS,s.addFormIdentifiers=LS,s.addFormRevision=na,s.addFormRevisionAttachment=sT,s.addFormRevisionAttachments=Ro,s.addFormRevisions=qo,s.addFormSubmission=ya,s.addFormSubmissionAttachment=IT,s.addFormSubmissionAttachments=Gt,s.addFormSubmissions=el,s.addForms=mT,s.addGeoImage=dl,s.addGeoImages=ul,s.addIssue=ka,s.addIssueAssociation=Fa,s.addIssueAssociations=Pa,s.addIssueAttachment=qT,s.addIssueAttachments=wa,s.addIssueComment=qa,s.addIssueCommentAttachment=UT,s.addIssueCommentAttachments=jl,s.addIssueComments=GT,s.addIssueType=Hh,s.addIssueTypeAttachment=QT,s.addIssueTypeAttachments=xl,s.addIssueTypeFieldValues=Ya,s.addIssueTypeFieldValuesAttachment=PI,s.addIssueTypeFieldValuesAttachments=Kt,s.addIssueTypeFieldValuesMany=uI,s.addIssueTypeFields=bh,s.addIssueTypeFieldsAttachment=sI,s.addIssueTypeFieldsAttachments=oh,s.addIssueTypeFieldsMany=yI,s.addIssueTypeIdentifier=sn,s.addIssueTypeIdentifierValue=rn,s.addIssueTypeIdentifierValues=DI,s.addIssueTypeIdentifiers=MI,s.addIssueTypeStatus=An,s.addIssueTypeStatuses=JI,s.addIssueTypes=LI,s.addIssueUpdate=sm,s.addIssueUpdates=im,s.addIssues=Yl,s.addOrganization=Om,s.addOrganizationAccess=Tm,s.addOrganizationAccesses=yg,s.addOrganizations=Pg,s.addProject=Bn,s.addProjectAccess=wn,s.addProjectAccesses=Mn,s.addProjectAttachment=Ug,s.addProjectAttachments=Gm,s.addProjectFile=$g,s.addProjectFiles=ep,s.addProjects=Zg,s.addTeam=Rp,s.addTeamMembership=Sp,s.addTeamMemberships=Tp,s.addTeams=rb,s.addUser=hm,s.addUsers=dg,s.agentsReducer=Mc,s.agentsSlice=rs,s.areArraysEqual=py,s.assetAttachmentReducer=kc,s.assetAttachmentSlice=us,s.assetProcedureReducer=Mr,s.assetProcedureSlice=Ps,s.assetProcedureStepFieldValuesAttachmentReducer=xr,s.assetProcedureStepFieldValuesAttachmentSlice=$s,s.assetProcedureStepFieldValuesReducer=cd,s.assetProcedureStepFieldValuesSlice=Ls,s.assetProcedureStepFieldsAttachmentReducer=Lr,s.assetProcedureStepFieldsAttachmentSlice=zs,s.assetProcedureStepFieldsReducer=Wr,s.assetProcedureStepFieldsSlice=Ds,s.assetProcedureStepReducer=pd,s.assetProcedureStepSlice=Ks,s.assetProcedureTypeAttachmentReducer=Kc,s.assetProcedureTypeAttachmentSlice=ms,s.assetProcedureTypeFieldValuesAttachmentReducer=yr,s.assetProcedureTypeFieldValuesAttachmentSlice=fs,s.assetProcedureTypeFieldValuesReducer=Pr,s.assetProcedureTypeFieldValuesSlice=Ts,s.assetProcedureTypeFieldsAttachmentReducer=sr,s.assetProcedureTypeFieldsAttachmentSlice=ps,s.assetProcedureTypeFieldsReducer=or,s.assetProcedureTypeFieldsSlice=ys,s.assetProcedureTypeReducer=qr,s.assetProcedureTypeSlice=Ms,s.assetReducer=gd,s.assetSlice=Zs,s.assetStageCompletionReducer=_d,s.assetStageCompletionSlice=si,s.assetStageReducer=Vd,s.assetStageSlice=di,s.assetTypeAttachmentReducer=Ld,s.assetTypeAttachmentSlice=hi,s.assetTypeFieldValuesAttachmentReducer=lu,s.assetTypeFieldValuesAttachmentSlice=fi,s.assetTypeFieldValuesReducer=Su,s.assetTypeFieldValuesSlice=Ti,s.assetTypeFieldsAttachmentReducer=Xd,s.assetTypeFieldsAttachmentSlice=yi,s.assetTypeFieldsReducer=au,s.assetTypeFieldsSlice=Ai,s.assetTypeIdentifierReducer=Fu,s.assetTypeIdentifierSlice=Pi,s.assetTypeIdentifierValueReducer=Ru,s.assetTypeIdentifierValueSlice=vi,s.assetTypeReducer=Eu,s.assetTypeSlice=ji,s.authReducer=qu,s.authSlice=Bt,s.baseReducer=pb,s.baseReducers=Qn,s.blobToBase64=Fy,s.categoryReducer=Bu,s.categorySlice=Ci,s.clearTokens=SS,s.constructUploadedFilePayloads=by,s.createModelAdapter=P,s.createOfflineAction=wm,s.createPayload=v,s.createSelectionAdapter=hy,s.deleteAsset=Xs,s.deleteAssetAttachment=qc,s.deleteAssetAttachments=hs,s.deleteAssetProcedure=_s,s.deleteAssetProcedureStep=hd,s.deleteAssetProcedureStepFieldValues=Hs,s.deleteAssetProcedureStepFieldValuesAttachment=JA,s.deleteAssetProcedureStepFieldValuesAttachments=Et,s.deleteAssetProcedureStepFieldValuesMany=ad,s.deleteAssetProcedureStepFields=Cs,s.deleteAssetProcedureStepFieldsAttachment=qA,s.deleteAssetProcedureStepFieldsAttachments=Br,s.deleteAssetProcedureStepFieldsMany=$A,s.deleteAssetProcedureSteps=md,s.deleteAssetProcedureType=Vs,s.deleteAssetProcedureTypeAttachment=Hc,s.deleteAssetProcedureTypeAttachments=Wc,s.deleteAssetProcedureTypeFieldValues=gs,s.deleteAssetProcedureTypeFieldValuesAttachment=hA,s.deleteAssetProcedureTypeFieldValuesAttachments=wt,s.deleteAssetProcedureTypeFieldValuesMany=Fr,s.deleteAssetProcedureTypeFields=ur,s.deleteAssetProcedureTypeFieldsAttachment=Xy,s.deleteAssetProcedureTypeFieldsAttachments=tr,s.deleteAssetProcedureTypeFieldsMany=aA,s.deleteAssetProcedureTypes=OA,s.deleteAssetProcedures=wr,s.deleteAssetStage=oi,s.deleteAssetStageCompletion=ni,s.deleteAssetStageCompletions=ci,s.deleteAssetStages=Tf,s.deleteAssetType=zi,s.deleteAssetTypeAttachment=Cd,s.deleteAssetTypeAttachments=pi,s.deleteAssetTypeFieldValues=gi,s.deleteAssetTypeFieldValuesAttachment=Hf,s.deleteAssetTypeFieldValuesAttachments=kt,s.deleteAssetTypeFieldValuesMany=Au,s.deleteAssetTypeFields=su,s.deleteAssetTypeFieldsAttachment=Mf,s.deleteAssetTypeFieldsAttachments=Yd,s.deleteAssetTypeFieldsMany=Uf,s.deleteAssetTypeIdentifier=_i,s.deleteAssetTypeIdentifierValue=Mi,s.deleteAssetTypeIdentifierValues=rS,s.deleteAssetTypeIdentifiers=tS,s.deleteAssetTypes=pS,s.deleteAssets=Qs,s.deleteCategories=OS,s.deleteCategory=Cu,s.deleteConversation=Dy,s.deleteConversations=Uy,s.deleteDocumentAttachment=Wu,s.deleteDocumentAttachments=Ku,s.deleteEmailDomain=co,s.deleteEmailDomains=BS,s.deleteForm=la,s.deleteFormIdentifier=Ji,s.deleteFormIdentifierValue=ea,s.deleteFormIdentifierValues=xS,s.deleteFormIdentifiers=KS,s.deleteFormRevision=ca,s.deleteFormRevisionAttachment=cT,s.deleteFormRevisionAttachments=wo,s.deleteFormRevisions=Do,s.deleteFormSubmission=Aa,s.deleteFormSubmissionAttachment=PT,s.deleteFormSubmissionAttachments=Lt,s.deleteFormSubmissions=sl,s.deleteForms=ST,s.deleteGeoImage=Ia,s.deleteGeoImages=ll,s.deleteIssue=Ba,s.deleteIssueAssociation=Oa,s.deleteIssueAssociations=_a,s.deleteIssueAttachment=_l,s.deleteIssueAttachments=Ma,s.deleteIssueComment=Da,s.deleteIssueCommentAttachment=Dl,s.deleteIssueCommentAttachments=Ul,s.deleteIssueComments=HT,s.deleteIssueType=WI,s.deleteIssueTypeAttachment=sh,s.deleteIssueTypeAttachments=ih,s.deleteIssueTypeFieldValues=Za,s.deleteIssueTypeFieldValuesAttachment=vI,s.deleteIssueTypeFieldValuesAttachments=Yt,s.deleteIssueTypeFieldValuesMany=mI,s.deleteIssueTypeFields=Ph,s.deleteIssueTypeFieldsAttachment=cI,s.deleteIssueTypeFieldsAttachments=hh,s.deleteIssueTypeFieldsMany=TI,s.deleteIssueTypeIdentifier=an,s.deleteIssueTypeIdentifierValue=dn,s.deleteIssueTypeIdentifierValues=BI,s.deleteIssueTypeIdentifiers=qI,s.deleteIssueTypeStatus=fn,s.deleteIssueTypeStatuses=xI,s.deleteIssueTypes=KI,s.deleteIssueUpdate=am,s.deleteIssueUpdates=nm,s.deleteIssues=Zl,s.deleteOrganization=_g,s.deleteOrganizationAccess=Im,s.deleteOrganizationAccesses=Tg,s.deleteOrganizations=Rg,s.deleteProject=$n,s.deleteProjectAccess=En,s.deleteProjectAccesses=Vn,s.deleteProjectAttachment=Wm,s.deleteProjectAttachments=Dn,s.deleteProjectFile=tp,s.deleteProjectFiles=sp,s.deleteProjects=Xg,s.deleteTeam=Zn,s.deleteTeamMembership=Wn,s.deleteTeamMemberships=gp,s.deleteTeams=ob,s.deleteUser=mm,s.deleteUsers=lg,s.dequeue=$p,s.discard=ec,s.documentAttachmentReducer=Xu,s.documentAttachmentSlice=Gi,s.documentSlice=Li,s.documentsReducer=so,s.downloadFile=Py,s.downloadInMemoryFile=gy,s.emailDomainsReducer=oo,s.emailDomainsSlice=Wi,s.emailRegex=Ey,s.enqueue=Bp,s.enqueueRequest=Em,s.fallbackToEmptyArray=S,s.fallbackToEmptyObject=Rt,s.fileReducer=yo,s.fileSlice=Ki,s.fileToBlob=fc,s.formIdentifierReducer=Io,s.formIdentifierSlice=Yi,s.formIdentifierValueReducer=Po,s.formIdentifierValueSlice=Qi,s.formReducer=$o,s.formRevisionAttachmentReducer=Eo,s.formRevisionAttachmentSlice=ia,s.formRevisionReducer=Co,s.formRevisionsSlice=aa,s.formSlice=ua,s.formSubmissionAttachmentReducer=Xo,s.formSubmissionAttachmentSlice=ha,s.formSubmissionReducer=al,s.formSubmissionSlice=pa,s.geoImageReducer=pl,s.geoImageSlice=Ta,s.getAssetProcedureStepSubTree=Pc,s.getAssetProcedureStepTrees=Vy,s.getClientSDK=Yp,s.getClientStore=it,s.getFileIdentifier=Iy,s.getFileS3Key=cs,s.getLocalDateString=yc,s.getLocalRelativeDateString=Sy,s.getOutboxCoordinator=Je,s.getRenamedFile=Ac,s.hashFile=xe,s.initSDK=WF,s.initializeAssetAttachments=os,s.initializeAssetProcedureStepFieldValues=td,s.initializeAssetProcedureStepFieldValuesAttachments=Yr,s.initializeAssetProcedureStepFields=Hr,s.initializeAssetProcedureStepFieldsAttachments=Ur,s.initializeAssetProcedureSteps=dd,s.initializeAssetProcedureTypeAttachments=$c,s.initializeAssetProcedureTypeFieldValues=Ir,s.initializeAssetProcedureTypeFieldValuesAttachments=mr,s.initializeAssetProcedureTypeFields=cr,s.initializeAssetProcedureTypeFieldsAttachments=Qc,s.initializeAssetProcedureTypes=jr,s.initializeAssetProcedures=Rr,s.initializeAssetStageCompletions=Fd,s.initializeAssetStages=Md,s.initializeAssetTypeAttachments=zd,s.initializeAssetTypeFieldValues=mu,s.initializeAssetTypeFieldValuesAttachments=cu,s.initializeAssetTypeFields=xd,s.initializeAssetTypeFieldsAttachments=Hd,s.initializeAssetTypeIdentifierValues=Ou,s.initializeAssetTypeIdentifiers=Iu,s.initializeAssetTypes=wu,s.initializeAssets=Sd,s.initializeCategories=Du,s.initializeConversations=_c,s.initializeDocumentAttachments=Gu,s.initializeEmailDomains=ao,s.initializeFormIdentifierValues=bo,s.initializeFormIdentifiers=fo,s.initializeFormRevisionAttachments=_o,s.initializeFormRevisions=jo,s.initializeFormSubmissionAttachments=Wo,s.initializeFormSubmissions=xo,s.initializeForms=Bo,s.initializeGeoImages=cl,s.initializeIssueAssociations=Al,s.initializeIssueAttachments=va,s.initializeIssueCommentAttachments=Va,s.initializeIssueComments=$T,s.initializeIssueTypeAttachments=Ha,s.initializeIssueTypeFieldValues=fh,s.initializeIssueTypeFieldValuesAttachments=vh,s.initializeIssueTypeFields=gh,s.initializeIssueTypeFieldsAttachments=uh,s.initializeIssueTypeIdentifierValues=Bh,s.initializeIssueTypeIdentifiers=zh,s.initializeIssueTypeStatuses=Jh,s.initializeIssueTypes=Nh,s.initializeIssueUpdates=tm,s.initializeIssues=Kl,s.initializeOrganizationAccesses=Sm,s.initializeOrganizations=Pm,s.initializeProjectAccesses=Dm,s.initializeProjectAttachments=$m,s.initializeProjectFiles=xm,s.initializeProjects=op,s.initializeTeamMemberships=fp,s.initializeTeams=_p,s.initializeUsers=lm,s.isToday=fy,s.issueAssociationReducer=bl,s.issueAssociationSlice=ba,s.issueAttachmentReducer=El,s.issueAttachmentSlice=Ra,s.issueCommentAttachmentReducer=$l,s.issueCommentAttachmentSlice=Ea,s.issueCommentReducer=Hl,s.issueCommentSlice=ja,s.issueReducer=Xl,s.issueSlice=Ca,s.issueTypeAttachmentReducer=rh,s.issueTypeAttachmentSlice=Na,s.issueTypeFieldValuesAttachmentReducer=jh,s.issueTypeFieldValuesAttachmentSlice=xa,s.issueTypeFieldValuesReducer=Th,s.issueTypeFieldValuesSlice=Ka,s.issueTypeFieldsAttachmentReducer=yh,s.issueTypeFieldsAttachmentSlice=Wa,s.issueTypeFieldsReducer=_h,s.issueTypeFieldsSlice=Qa,s.issueTypeIdentifierReducer=Ch,s.issueTypeIdentifierSlice=tn,s.issueTypeIdentifierValueReducer=Gh,s.issueTypeIdentifierValueSlice=cn,s.issueTypeReducer=Yh,s.issueTypeSlice=ln,s.issueTypeStatusReducer=xh,s.issueTypeStatusSlice=yn,s.issueUpdateReducer=um,s.issueUpdateSlice=In,s.logOnlyOnce=Oy,s.markAsDeleted=Vm,s.markForDeletion=Vg,s.memoize=as,s.onlyUniqueHashes=My,s.onlyUniqueOfflineIds=bc,s.organizationAccessReducer=gm,s.organizationAccessSlice=Fn,s.organizationReducer=vm,s.organizationSlice=_n,s.outboxReducer=qm,s.outboxSlice=Rn,s.overmapEnhancer=Ob,s.overmapReducer=yb,s.overmapReducers=jp,s.performRequest=xn,s.projectAccessReducer=Cm,s.projectAccessSlice=vn,s.projectAttachmentReducer=Xm,s.projectAttachmentSlice=zn,s.projectFileReducer=dp,s.projectFileSlice=Un,s.projectReducer=hp,s.projectSlice=kn,s.rehydratedReducer=yp,s.rehydratedSlice=Ln,s.removeDocuments=Ni,s.removeIssueType=hn,s.resetProjectFileObjectUrls=Lg,s.restructureCreateSelectorWithArgs=f,s.runMiddleware=Qp,s.saveActiveProjectFileBounds=np,s.selectAccessToken=TS,s.selectAccessesByUserOfProject=zg,s.selectAccessibleProjects=Qg,s.selectActiveOrganizationAccess=Ig,s.selectActiveProjectFileId=Hg,s.selectAllDocumentAttachments=Zu,s.selectAllProjectAttachments=Ym,s.selectAssetAttachmentById=Uc,s.selectAssetAttachmentMapping=zc,s.selectAssetAttachments=Dc,s.selectAssetById=ti,s.selectAssetProcedureById=ws,s.selectAssetProcedureStepById=Ys,s.selectAssetProcedureStepFieldValues=Vt,s.selectAssetProcedureStepFieldValuesAttachmentById=XA,s.selectAssetProcedureStepFieldValuesAttachments=Jr,s.selectAssetProcedureStepFieldValuesAttachmentsByIds=Xr,s.selectAssetProcedureStepFieldValuesAttachmentsMapping=Gs,s.selectAssetProcedureStepFieldValuesById=Ws,s.selectAssetProcedureStepFieldValuesMapping=nd,s.selectAssetProcedureStepFieldValuesOfAsset=ef,s.selectAssetProcedureStepFieldValuesOfAssetProcedure=tf,s.selectAssetProcedureStepFieldValuesOfAssetProcedureStep=sf,s.selectAssetProcedureStepFields=Bs,s.selectAssetProcedureStepFieldsAttachmentById=DA,s.selectAssetProcedureStepFieldsAttachments=Gr,s.selectAssetProcedureStepFieldsAttachmentsMapping=$r,s.selectAssetProcedureStepFieldsById=HA,s.selectAssetProcedureStepFieldsMapping=ks,s.selectAssetProcedureStepFieldsOfAssetProcedureStep=GA,s.selectAssetProcedureStepMapping=ot,s.selectAssetProcedureSteps=yd,s.selectAssetProcedureStepsByIds=df,s.selectAssetProcedureStepsMappingOfAssetProcedureType=cf,s.selectAssetProcedureStepsOfAssetProcedureType=rf,s.selectAssetProcedureTypeAttachmentById=Jc,s.selectAssetProcedureTypeAttachmentMapping=Yc,s.selectAssetProcedureTypeAttachments=Zc,s.selectAssetProcedureTypeById=qs,s.selectAssetProcedureTypeFieldValues=bs,s.selectAssetProcedureTypeFieldValuesAttachmentById=mA,s.selectAssetProcedureTypeFieldValuesAttachments=Ar,s.selectAssetProcedureTypeFieldValuesAttachmentsByIds=fr,s.selectAssetProcedureTypeFieldValuesAttachmentsMapping=Ss,s.selectAssetProcedureTypeFieldValuesById=Fs,s.selectAssetProcedureTypeFieldValuesMapping=Or,s.selectAssetProcedureTypeFieldValuesOfAsset=AA,s.selectAssetProcedureTypeFields=As,s.selectAssetProcedureTypeFieldsAttachmentById=xy,s.selectAssetProcedureTypeFieldsAttachments=ar,s.selectAssetProcedureTypeFieldsAttachmentsMapping=ir,s.selectAssetProcedureTypeFieldsById=rA,s.selectAssetProcedureTypeFieldsMapping=lr,s.selectAssetProcedureTypeFieldsOfAssetProcedureType=nA,s.selectAssetProcedureTypes=zr,s.selectAssetProcedureTypesByIds=vA,s.selectAssetProcedureTypesMapping=js,s.selectAssetProcedureTypesOfOrganization=wA,s.selectAssetProcedures=vs,s.selectAssetProceduresByIds=bA,s.selectAssetProceduresMapping=Rs,s.selectAssetProceduresOfAssetProcedureType=Er,s.selectAssetProceduresOfAssetType=gA,s.selectAssetStageById=li,s.selectAssetStageCompletionById=Rd,s.selectAssetStageCompletionMapping=ri,s.selectAssetStageCompletions=yf,s.selectAssetStageCompletionsByIds=vd,s.selectAssetStages=jd,s.selectAssetStagesByIds=bf,s.selectAssetStagesMappingOfAssetProcedureType=If,s.selectAssetStagesOfAssetProcedureType=gf,s.selectAssetTypeAttachmentById=$d,s.selectAssetTypeAttachmentMapping=kd,s.selectAssetTypeAttachments=Bd,s.selectAssetTypeById=Ui,s.selectAssetTypeFieldValues=bi,s.selectAssetTypeFieldValuesAttachmentById=Wf,s.selectAssetTypeFieldValuesAttachments=du,s.selectAssetTypeFieldValuesAttachmentsByIds=uu,s.selectAssetTypeFieldValuesAttachmentsMapping=Si,s.selectAssetTypeFieldValuesById=Fi,s.selectAssetTypeFieldValuesMapping=fu,s.selectAssetTypeFieldValuesOfAsset=Zf,s.selectAssetTypeFields=Ut,s.selectAssetTypeFieldsAttachmentById=Vf,s.selectAssetTypeFieldsAttachments=Jd,s.selectAssetTypeFieldsAttachmentsMapping=Zd,s.selectAssetTypeFieldsById=Bf,s.selectAssetTypeFieldsMapping=iu,s.selectAssetTypeFieldsOfAssetType=Cf,s.selectAssetTypeIdentifierById=Ri,s.selectAssetTypeIdentifierMapping=gu,s.selectAssetTypeIdentifierValueById=Vi,s.selectAssetTypeIdentifierValueMapping=_u,s.selectAssetTypeIdentifierValues=Ei,s.selectAssetTypeIdentifierValuesOfAsset=dS,s.selectAssetTypeIdentifierValuesOfIdentifier=uS,s.selectAssetTypeIdentifiers=bu,s.selectAssetTypeIdentifiersOfAssetType=sS,s.selectAssetTypeValuesOfAssetType=Jf,s.selectAssetTypes=Mu,s.selectAssetTypesByIds=yS,s.selectAssetTypesMapping=Di,s.selectAssetTypesOfOrganization=AS,s.selectAssets=Td,s.selectAssetsByIds=Id,s.selectAssetsMapping=xs,s.selectAssetsOfAssetType=ei,s.selectAttachmentsOfAsset=Cc,s.selectAttachmentsOfAssetProcedureStepFieldValues=Qr,s.selectAttachmentsOfAssetProcedureStepFields=zA,s.selectAttachmentsOfAssetProcedureType=Wy,s.selectAttachmentsOfAssetProcedureTypeFieldValues=Sr,s.selectAttachmentsOfAssetProcedureTypeFields=Qy,s.selectAttachmentsOfAssetType=Gd,s.selectAttachmentsOfAssetTypeFieldValues=ou,s.selectAttachmentsOfAssetTypeFields=Ef,s.selectAttachmentsOfDocument=ES,s.selectAttachmentsOfFormRevision=rT,s.selectAttachmentsOfFormSubmission=Jo,s.selectAttachmentsOfIssue=wl,s.selectAttachmentsOfIssueComment=BT,s.selectAttachmentsOfIssueType=tI,s.selectAttachmentsOfIssueTypeFieldValues=Vh,s.selectAttachmentsOfIssueTypeFields=rI,s.selectAttachmentsOfProject=Jm,s.selectCategories=ku,s.selectCategoriesByIds=_S,s.selectCategoriesOfProject=RS,s.selectCategoryById=$i,s.selectCategoryMapping=Bi,s.selectCommentsOfIssue=WT,s.selectConversation=ky,s.selectConversationMapping=ds,s.selectConversations=Cy,s.selectCurrentUser=ym,s.selectDeletedRequests=Mg,s.selectDescendantsOfAssetProcedureStep=Ad,s.selectDocumentAttachmentById=Ju,s.selectDocumentAttachmentMapping=Yu,s.selectDocumentById=to,s.selectDocuments=Hi,s.selectDocumentsByIds=VS,s.selectDocumentsMapping=$t,s.selectEmailDomains=uo,s.selectEmailDomainsAsMapping=ro,s.selectEmailDomainsOfOrganization=$S,s.selectFieldValuesOfAssetProcedure=fA,s.selectFormById=No,s.selectFormIdentifierById=Xi,s.selectFormIdentifierMapping=So,s.selectFormIdentifierValueById=sa,s.selectFormIdentifierValueMapping=Fo,s.selectFormIdentifierValues=ta,s.selectFormIdentifierValuesOfFormSubmission=eT,s.selectFormIdentifierValuesOfIdentifier=tT,s.selectFormIdentifiers=To,s.selectFormIdentifiersOfForm=YS,s.selectFormMapping=Go,s.selectFormRevisionAttachmentsMapping=Mo,s.selectFormRevisionById=lT,s.selectFormRevisionMapping=ra,s.selectFormRevisions=da,s.selectFormRevisionsOfForm=Uo,s.selectFormSubmissionAttachemntsByIds=Zo,s.selectFormSubmissionAttachments=ma,s.selectFormSubmissionAttachmentsMapping=Yo,s.selectFormSubmissionById=Sa,s.selectFormSubmissions=RT,s.selectFormSubmissionsMapping=fa,s.selectFormSubmissionsOfForm=il,s.selectForms=Lo,s.selectFormsOfOrganization=TT,s.selectGeoImageById=ga,s.selectGeoImageMapping=hl,s.selectGeoImages=ml,s.selectGeoImagesOfProject=wT,s.selectIsImportingProjectFile=Wg,s.selectIsLoggedIn=IS,s.selectIssueAssociationById=Sl,s.selectIssueAssociationMapping=Tt,s.selectIssueAssociations=jT,s.selectIssueAssociationsOfAsset=gl,s.selectIssueAssociationsOfIssue=Il,s.selectIssueAssociationsToIssue=Tl,s.selectIssueAttachmentById=Ml,s.selectIssueAttachmentMapping=Rl,s.selectIssueAttachments=vl,s.selectIssueById=La,s.selectIssueCommentAttachmentById=Bl,s.selectIssueCommentAttachmentMapping=Cl,s.selectIssueCommentAttachments=kl,s.selectIssueCommentById=Ua,s.selectIssueCommentMapping=Nl,s.selectIssueMapping=$a,s.selectIssueTypeAttachmentById=ch,s.selectIssueTypeAttachmentMapping=ah,s.selectIssueTypeAttachments=nh,s.selectIssueTypeById=pn,s.selectIssueTypeFieldValues=Ja,s.selectIssueTypeFieldValuesAttachmentById=wI,s.selectIssueTypeFieldValuesAttachments=en,s.selectIssueTypeFieldValuesAttachmentsByIds=Eh,s.selectIssueTypeFieldValuesAttachmentsMapping=Mh,s.selectIssueTypeFieldValuesById=Xa,s.selectIssueTypeFieldValuesMapping=Sh,s.selectIssueTypeFieldValuesOfIssue=pI,s.selectIssueTypeFields=Wt,s.selectIssueTypeFieldsAttachmentById=dI,s.selectIssueTypeFieldsAttachments=ph,s.selectIssueTypeFieldsAttachmentsMapping=mh,s.selectIssueTypeFieldsById=FI,s.selectIssueTypeFieldsMapping=Oh,s.selectIssueTypeFieldsOfIssueType=II,s.selectIssueTypeIdentifierById=nn,s.selectIssueTypeIdentifierMapping=Dh,s.selectIssueTypeIdentifierValueById=on,s.selectIssueTypeIdentifierValueMapping=$h,s.selectIssueTypeIdentifierValues=un,s.selectIssueTypeIdentifierValuesOfIdentifier=GI,s.selectIssueTypeIdentifierValuesOfIssue=$I,s.selectIssueTypeIdentifiers=Uh,s.selectIssueTypeIdentifiersOfIssueType=zI,s.selectIssueTypeMapping=mn,s.selectIssueTypeStatusById=Tn,s.selectIssueTypeStatusMapping=Sn,s.selectIssueTypeStatuses=Qh,s.selectIssueTypeStatusesByIds=eg,s.selectIssueTypeStatusesOfIssueType=tg,s.selectIssueTypeValuesOfIssueType=bI,s.selectIssueTypes=Kh,s.selectIssueTypesByIds=YI,s.selectIssueTypesOfOrganization=ZI,s.selectIssueUpdateMapping=cm,s.selectIssueUpdates=rm,s.selectIssueUpdatesOfIssue=dm,s.selectIssues=Ga,s.selectIssuesByIds=JT,s.selectIssuesOfIssueType=Jl,s.selectIssuesOfProject=XT,s.selectLatestAssetProcedureStepFieldsOfAssetProcedureStep=LA,s.selectLatestAssetProcedureTypeFieldsOfAssetProcedureType=cA,s.selectLatestAssetTypeFieldsOfAssetType=kf,s.selectLatestFieldsByAssetProcedureStep=NA,s.selectLatestFormRevisionOfForm=hT,s.selectLatestIssueTypeFieldsOfIssueType=gI,s.selectLatestRetryTime=Eg,s.selectMembershipsByUserOfTeam=nb,s.selectNumberOfAssetsOfAssetType=hf,s.selectOrganizationAccessById=On,s.selectOrganizationAccessMapping=Pn,s.selectOrganizationAccessUserMapping=bm,s.selectOrganizationById=wg,s.selectOrganizationDocuments=qS,s.selectOrganizations=vg,s.selectOrganizationsMapping=Rm,s.selectProjectAccessById=qn,s.selectProjectAccessMapping=jn,s.selectProjectAccesses=Qt,s.selectProjectAccessesOfProject=km,s.selectProjectAttachmentById=Zm,s.selectProjectAttachmentMapping=Km,s.selectProjectById=pp,s.selectProjectDocuments=jS,s.selectProjectFileById=Ng,s.selectProjectFileMapping=cp,s.selectProjectFiles=rp,s.selectProjectMapping=mp,s.selectProjects=Gn,s.selectProjectsOfOrganization=xg,s.selectRehydrated=sb,s.selectStageMapping=Dt,s.selectTeamById=Xn,s.selectTeamMembershipById=Pp,s.selectTeamMemberships=Kn,s.selectTeamMembershipsMapping=Fp,s.selectTeams=wp,s.selectTeamsByIds=lb,s.selectTeamsMapping=Jn,s.selectTeamsOfOrganization=hb,s.selectUploadUrl=po,s.selectUserById=Am,s.selectUsers=bn,s.selectUsersByIds=pg,s.selectUsersMapping=Jt,s.selectUsersOfOrganization=gg,s.selectUsersOfProject=Dg,s.selectUsersOfTeam=cb,s.setActiveProjectFileId=ap,s.setAsset=of,s.setAssetAttachment=Vc,s.setAssetAttachments=$y,s.setAssetProcedure=TA,s.setAssetProcedureStep=ud,s.setAssetProcedureStepFieldValues=QA,s.setAssetProcedureStepFieldValuesAttachment=KA,s.setAssetProcedureStepFieldValuesAttachments=YA,s.setAssetProcedureStepFieldValuesMany=xA,s.setAssetProcedureStepFields=CA,s.setAssetProcedureStepFieldsAttachment=EA,s.setAssetProcedureStepFieldsAttachments=VA,s.setAssetProcedureStepFieldsMany=kA,s.setAssetProcedureSteps=af,s.setAssetProcedureType=_A,s.setAssetProcedureTypeAttachment=Lc,s.setAssetProcedureTypeAttachments=Ny,s.setAssetProcedureTypeFieldValues=pA,s.setAssetProcedureTypeFieldValuesAttachment=uA,s.setAssetProcedureTypeFieldValuesAttachments=oA,s.setAssetProcedureTypeFieldValuesMany=yA,s.setAssetProcedureTypeFields=tA,s.setAssetProcedureTypeFieldsAttachment=Yy,s.setAssetProcedureTypeFieldsAttachments=Zy,s.setAssetProcedureTypeFieldsMany=sA,s.setAssetProcedureTypes=RA,s.setAssetProcedures=IA,s.setAssetStage=Ed,s.setAssetStageCompletion=mf,s.setAssetStageCompletions=pf,s.setAssetStages=Af,s.setAssetType=oS,s.setAssetTypeAttachment=Dd,s.setAssetTypeAttachments=Pf,s.setAssetTypeFieldValues=Kf,s.setAssetTypeFieldValuesAttachment=Gf,s.setAssetTypeFieldValuesAttachments=Lf,s.setAssetTypeFieldValuesMany=Yf,s.setAssetTypeFields=qf,s.setAssetTypeFieldsAttachment=Rf,s.setAssetTypeFieldsAttachments=vf,s.setAssetTypeFieldsMany=zf,s.setAssetTypeIdentifier=Qf,s.setAssetTypeIdentifierValue=aS,s.setAssetTypeIdentifierValues=nS,s.setAssetTypeIdentifiers=xf,s.setAssetTypes=lS,s.setAssets=lf,s.setCategories=FS,s.setCategory=bS,s.setClientSDK=Kp,s.setClientStore=Hp,s.setConversation=vc,s.setConversations=qy,s.setCurrentUser=hg,s.setDocumentAttachment=Nu,s.setDocumentAttachments=wS,s.setDocuments=xu,s.setEmailDomain=DS,s.setEmailDomains=US,s.setForm=pT,s.setFormIdentifier=NS,s.setFormIdentifierValue=JS,s.setFormIdentifierValues=XS,s.setFormIdentifiers=HS,s.setFormRevision=zo,s.setFormRevisionAttachment=iT,s.setFormRevisionAttachments=aT,s.setFormRevisions=dT,s.setFormSubmission=Nt,s.setFormSubmissionAttachment=gT,s.setFormSubmissionAttachments=bT,s.setFormSubmissions=OT,s.setForms=yT,s.setGeoImage=St,s.setGeoImages=rl,s.setIsImportingProjectFile=ip,s.setIssue=KT,s.setIssueAssociation=ET,s.setIssueAssociations=MT,s.setIssueAttachment=Pl,s.setIssueAttachments=zT,s.setIssueComment=za,s.setIssueCommentAttachment=ql,s.setIssueCommentAttachments=CT,s.setIssueComments=Ll,s.setIssueType=Ft,s.setIssueTypeAttachment=eh,s.setIssueTypeAttachments=xT,s.setIssueTypeFieldValues=oI,s.setIssueTypeFieldValuesAttachment=OI,s.setIssueTypeFieldValuesAttachments=_I,s.setIssueTypeFieldValuesMany=lI,s.setIssueTypeFields=AI,s.setIssueTypeFieldsAttachment=iI,s.setIssueTypeFieldsAttachments=aI,s.setIssueTypeFieldsMany=fI,s.setIssueTypeIdentifier=EI,s.setIssueTypeIdentifierValue=UI,s.setIssueTypeIdentifierValues=CI,s.setIssueTypeIdentifiers=VI,s.setIssueTypeStatus=Zt,s.setIssueTypeStatuses=XI,s.setIssueTypes=NI,s.setIssueUpdate=sg,s.setIssueUpdates=ig,s.setIssues=YT,s.setLoggedIn=ju,s.setOrganization=Fg,s.setOrganizationAccess=Ag,s.setOrganizationAccesses=fg,s.setOrganizations=bg,s.setProfilePicture=mg,s.setProject=Yg,s.setProjectAccess=jg,s.setProjectAccesses=qg,s.setProjectAttachment=Lm,s.setProjectAttachments=Nm,s.setProjectFile=kg,s.setProjectFiles=Bg,s.setProjects=Kg,s.setRehydrated=tb,s.setTeam=Ot,s.setTeamMembership=Hn,s.setTeamMemberships=Ip,s.setTeams=db,s.setTokens=fS,s.setUploadUrl=mo,s.setUser=rg,s.setUsers=cg,s.shallowEqual=my,s.slugify=vy,s.spacesToDashesLower=Ry,s.teamMembershipReducer=bp,s.teamMembershipSlice=Nn,s.teamReducer=Mp,s.teamSlice=Yn,s.toFileNameSafeString=_y,s.toUuidArray=gc,s.toUuidIdRecord=Ic,s.truncate=wy,s.updateAsset=lt,s.updateAssetAttachment=Gy,s.updateAssetAttachments=jc,s.updateAssetProcedure=ct,s.updateAssetProcedureStep=jt,s.updateAssetProcedureStepFieldValues=ut,s.updateAssetProcedureStepFieldValuesAttachment=ZA,s.updateAssetProcedureStepFieldValuesAttachments=Zr,s.updateAssetProcedureStepFieldValuesMany=id,s.updateAssetProcedureStepFields=dt,s.updateAssetProcedureStepFieldsAttachment=jA,s.updateAssetProcedureStepFieldsAttachments=kr,s.updateAssetProcedureStepFieldsMany=BA,s.updateAssetProcedureSteps=nf,s.updateAssetProcedureType=rt,s.updateAssetProcedureTypeAttachment=Hy,s.updateAssetProcedureTypeAttachments=Nc,s.updateAssetProcedureTypeFieldValues=nt,s.updateAssetProcedureTypeFieldValuesAttachment=lA,s.updateAssetProcedureTypeFieldValuesAttachments=pr,s.updateAssetProcedureTypeFieldValuesMany=br,s.updateAssetProcedureTypeFields=dr,s.updateAssetProcedureTypeFieldsAttachment=Jy,s.updateAssetProcedureTypeFieldsAttachments=er,s.updateAssetProcedureTypeFieldsMany=iA,s.updateAssetProcedureTypes=PA,s.updateAssetProcedures=SA,s.updateAssetStage=zt,s.updateAssetStageCompletion=Pd,s.updateAssetStageCompletions=Od,s.updateAssetStages=Sf,s.updateAssetType=yt,s.updateAssetTypeAttachment=Of,s.updateAssetTypeAttachments=Ud,s.updateAssetTypeFieldValues=ht,s.updateAssetTypeFieldValuesAttachment=Nf,s.updateAssetTypeFieldValuesAttachments=ru,s.updateAssetTypeFieldValuesMany=yu,s.updateAssetTypeFields=tu,s.updateAssetTypeFieldsAttachment=wf,s.updateAssetTypeFieldsAttachments=Kd,s.updateAssetTypeFieldsMany=Df,s.updateAssetTypeIdentifier=mt,s.updateAssetTypeIdentifierValue=pt,s.updateAssetTypeIdentifierValues=cS,s.updateAssetTypeIdentifiers=eS,s.updateAssetTypes=mS,s.updateAssets=uf,s.updateCategories=PS,s.updateCategory=Uu,s.updateConversation=wc,s.updateConversations=zy,s.updateDocumentAttachment=MS,s.updateDocumentAttachments=Hu,s.updateDocuments=et,s.updateEmailDomain=CS,s.updateEmailDomains=kS,s.updateForm=AT,s.updateFormIdentifier=At,s.updateFormIdentifierValue=ft,s.updateFormIdentifierValues=QS,s.updateFormIdentifiers=WS,s.updateFormRevision=uT,s.updateFormRevisionAttachment=nT,s.updateFormRevisionAttachments=vo,s.updateFormRevisions=oT,s.updateFormSubmission=tl,s.updateFormSubmissionAttachment=FT,s.updateFormSubmissionAttachments=Ko,s.updateFormSubmissions=_T,s.updateForms=fT,s.updateGeoImage=ol,s.updateGeoImages=vT,s.updateIssue=Ht,s.updateIssueAssociation=fl,s.updateIssueAssociations=VT,s.updateIssueAttachment=DT,s.updateIssueAttachments=Ol,s.updateIssueComment=LT,s.updateIssueCommentAttachment=kT,s.updateIssueCommentAttachments=zl,s.updateIssueComments=NT,s.updateIssueType=Wh,s.updateIssueTypeAttachment=eI,s.updateIssueTypeAttachments=th,s.updateIssueTypeFieldValues=It,s.updateIssueTypeFieldValuesAttachment=RI,s.updateIssueTypeFieldValuesAttachments=wh,s.updateIssueTypeFieldValuesMany=hI,s.updateIssueTypeFields=Fh,s.updateIssueTypeFieldsAttachment=nI,s.updateIssueTypeFieldsAttachments=lh,s.updateIssueTypeFieldsMany=SI,s.updateIssueTypeIdentifier=gt,s.updateIssueTypeIdentifierValue=bt,s.updateIssueTypeIdentifierValues=kI,s.updateIssueTypeIdentifiers=jI,s.updateIssueTypeStatus=Xh,s.updateIssueTypeStatuses=QI,s.updateIssueTypes=HI,s.updateIssueUpdate=ag,s.updateIssueUpdates=ng,s.updateIssues=ZT,s.updateOrganization=_m,s.updateOrganizationAccess=Xt,s.updateOrganizationAccesses=Sg,s.updateOrganizations=Og,s.updateProject=lp,s.updateProjectAccess=Pt,s.updateProjectAccesses=Um,s.updateProjectAttachment=Cg,s.updateProjectAttachments=Hm,s.updateProjectFile=Cn,s.updateProjectFiles=Gg,s.updateProjects=Jg,s.updateTeam=vp,s.updateTeamMembership=ib,s.updateTeamMemberships=ab,s.updateTeams=ub,s.updateUser=og,s.updateUsers=ug,s.useSelectorBuilder=Ab,s.userReducer=pm,s.userSlice=gn,s.uuidObj=b,s.versioningReducer=Vp,s.versioningSlice=Ep,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
14
+ external URLs and therefore not prepended with VITE_API_URL.`;throw new Error(A)}const p=o.type.split("/")[1];if(!p)throw new Error("File has no extension");const y=c??h+"."+p;if(o=Pn(o,y),!o.name)throw new Error("Failed to set file's name");await this.addCache(o,h),ts[n]=new Promise(A=>{A(o)})}return o}}class EF extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,c=new Date().toISOString(),n=b({...e,created_by:a,submitted_at:c});this.dispatch(sa(n));const r=this.enqueueRequest({description:"Create form identifier",method:l.POST,url:"/form-identifiers/",payload:v(n),blockers:[n.form],blocks:[n.uuid]});return r.then(m=>{this.dispatch(ft(m))}).catch(()=>{this.dispatch(ia(n.uuid))}),[n,r]}update(e){const{store:i}=this.client,a=aa(e.uuid)(i.getState());if(!a)throw new Error(`Expected form identifier with uuid ${e.uuid} to exist`);const c={...a,...e};this.dispatch(ft(c));const n=this.enqueueRequest({description:"Update form identifier",method:l.PATCH,url:`/form-identifiers/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return n.then(r=>{this.dispatch(ft(r))}).catch(()=>{this.dispatch(ft(a))}),[c,n]}async delete(e){const{store:i}=this.client,a=i.getState(),c=aa(e)(a);if(!c)throw new Error(`Expected form identifier with uuid ${e} to exist`);this.dispatch(ia(e));try{return await this.enqueueRequest({description:"Delete form identifier",method:l.DELETE,url:`/form-identifiers/${e}/`,blockers:[e],blocks:[]})}catch(n){throw this.dispatch(sa(c)),n}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get form identifiers",method:l.GET,url:"/form-identifiers/",queryParams:{form__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Eo(a)),a}}class MF extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,c=new Date().toISOString(),n=b({...e,created_by:a,submitted_at:c});this.dispatch(na(n));const r=this.enqueueRequest({description:"Create form identifier value",method:l.POST,url:"/form-identifier-values/",payload:v(n),blockers:[e.form_submission,e.form_identifier],blocks:[n.uuid]});return r.then(m=>{this.dispatch(St(m))}).catch(()=>{this.dispatch(ra(n.uuid))}),[n,r]}update(e){const{store:i}=this.client,a=ua(e.uuid)(i.getState());if(!a)throw new Error(`Expected form identifier value with uuid ${e.uuid} to exist`);const c={...a,...e};this.dispatch(St(c));const n=this.enqueueRequest({description:"Update form identifier value",method:l.PATCH,url:`/form-identifier-values/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return n.then(r=>{this.dispatch(St(r))}).catch(()=>{this.dispatch(St(a))}),[c,n]}async delete(e){const{store:i}=this.client,a=i.getState(),c=ua(e)(a);if(!c)throw new Error(`Expected form identifier value with uuid ${e} to exist`);this.dispatch(ra(e));try{return await this.enqueueRequest({description:"Delete form identifier value",method:l.DELETE,url:`/form-identifier-values/${e}/`,blockers:[e],blocks:[]})}catch(n){throw this.dispatch(na(c)),n}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get form identifier values",method:l.GET,url:"/form-identifier-values/",queryParams:{limit:V,paginate:!0,form_submission__form_revision__form__organization:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get form identifier values",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(zo(c)),c}}class VF extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,c={},n=[],r=[];for(const o of e){const{revisionUuid:h,fieldIdentifier:p,file:y}=o,A=await this.getFilePayload(y);A.sha1 in c||(c[A.sha1]=A);const g=b({file:URL.createObjectURL(y),file_type:y.type,file_name:y.name,file_sha1:A.sha1,created_by:a,form_revision:h,submitted_at:i,field_identifier:p});n.push(g);const F={uuid:g.uuid,file_name:y.name,field_identifier:p,file_extension:A.extension,file_sha1:A.sha1,form_revision:h};r.push(F)}this.dispatch(Bo(n));const u=this.enqueueRequest({description:"Attach files to form revision",method:l.POST,url:"/form-revision-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(c)},blockers:n.map(o=>o.form_revision),blocks:n.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch($o(o.attachments))}).catch(()=>{this.dispatch(Go(n.map(o=>o.uuid)))}),[n,u.then(({attachments:o})=>o)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch organization form revision attachments",method:l.GET,url:"/form-revision-attachments/",queryParams:{form_revision__form__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(ko(a)),a}}class jF extends j{add(e){var u;const{store:i}=this.client,c=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=b({...e,created_by:c,submitted_at:new Date().toISOString()});this.dispatch(ha(n));const r=this.enqueueRequest({description:"Create form revision",method:l.POST,url:"/form-revisions/",payload:v(n),blockers:[e.form],blocks:[n.uuid]});return r.then(m=>{this.dispatch(Yo(m))}).catch(()=>{this.dispatch(ma(n.uuid))}),[n,r]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get organization form revisions",method:l.GET,url:"/form-revisions/",queryParams:{form__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(Wo(a)),a}}class qF extends j{add(e,i){var o;const{store:a}=this.client,c=new Date().toISOString(),n=(o=a.getState().userReducer.currentUser)==null?void 0:o.id,r=b({...e,submitted_at:c,created_by:n}),u=b({...i,form:r.uuid,submitted_at:c,created_by:n});this.dispatch(fa(r)),this.dispatch(ha(u));const m=this.enqueueRequest({description:"Create form",method:l.POST,url:"/forms/",payload:{...v(r),initial_revision:{uuid:u.uuid,submitted_at:u.submitted_at,title:u.title,description:u.description,fields:u.fields}},blockers:[],blocks:[r.uuid,u.uuid]});return m.catch(h=>{throw this.dispatch(Sa(r.uuid)),this.dispatch(ma(u.uuid)),h}),[r,u,m]}async delete(e){const{store:i}=this.client,a=i.getState(),c=il(e)(a);if(!c)throw new Error("Expected form to exist");const n=Al(e)(a);n.length>0&&this.dispatch(yl(n.map(({uuid:u})=>u)));const r=Jo(e)(a);r.length>0&&this.dispatch(Zo(r.map(({uuid:u})=>u))),this.dispatch(Sa(e));try{return await this.enqueueRequest({description:"Delete form",method:l.DELETE,url:`/forms/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(fa(c)),r.length>0&&this.dispatch(Ko(r)),n.length>0&&this.dispatch(ml(n)),u}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch organization forms",method:l.GET,url:"/forms/",queryParams:{organization:e},blockers:[e],blocks:[]},i);return this.dispatch(xo(a)),a}}class zF extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,c={},n=[],r=[];for(const o of e){const{submissionUuid:h,fieldIdentifier:p,file:y}=o,A=await this.getFilePayload(y);A.sha1 in c||(c[A.sha1]=A);const g=b({file:URL.createObjectURL(y),file_type:y.type,file_name:y.name,file_sha1:A.sha1,created_by:a,form_submission:h,submitted_at:i,field_identifier:p});n.push(g);const F={uuid:g.uuid,file_name:y.name,file_sha1:A.sha1,file_extension:A.extension,field_identifier:p,form_submission:h};r.push(F)}this.dispatch(Nt(n));const u=this.enqueueRequest({description:"Attach files to form submission",method:l.POST,url:"/form-submission-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(c)},blockers:n.map(o=>o.form_submission),blocks:n.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(nl(o.attachments))}).catch(o=>{throw this.dispatch(Ht(n.map(h=>h.uuid))),o}),[n,u.then(({attachments:o})=>o)]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),c=dl(e)(a);this.dispatch(Ht(e));try{await this.enqueueRequest({description:"Delete form submission attachments",method:l.DELETE,url:"/form-submission-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(n){throw this.dispatch(Nt(c)),n}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get form submission attachments",method:l.GET,url:"/form-submission-attachments/",queryParams:{limit:Ke,paginate:!0,form_submission__form_revision__form__organization:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get form submission attachments",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(cl(c)),c}}class DF extends j{add(e){var r;const{store:i}=this.client,a=i.getState(),c=b({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),n=this.enqueueRequest({description:"Add form submission",method:l.POST,url:"/form-submissions/",payload:v(c),blockers:[e.form_revision],blocks:[c.uuid]});return this.dispatch(ba(c)),n.then(u=>(this.dispatch(Wt(u)),u)).catch(()=>{this.dispatch(Fa(c.uuid))}),[c,n]}update(e){const{store:i}=this.client,a=i.getState(),c=Oa(e.uuid)(a);if(!c)throw new Error(`Expected submission with uuid ${e.uuid} to exist`);const n={...c,...e};this.dispatch(pl(n));const r=this.enqueueRequest({description:"Delete user form submissions",method:l.PATCH,url:`/form-submissions/${n.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return r.then(u=>{this.dispatch(Wt(u))}).catch(()=>{this.dispatch(Wt(c))}),[n,r]}async delete(e){const{store:i}=this.client,a=i.getState(),c=Oa(e)(a);if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const n=ul(e)(a);this.dispatch(Fa(e)),this.dispatch(Ht(n.map(r=>r.uuid)));try{return await this.enqueueRequest({description:"Delete user form submissions",method:l.DELETE,url:`/form-submissions/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(ba(c)),this.dispatch(Nt(n)),r}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Fetch form submissions",method:l.GET,url:"/form-submissions/",queryParams:{limit:V,paginate:!0,form_revision__form_organization:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Fetch form submissions",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(hl(c)),c}}class UF extends j{async add(e){var p;const{store:i}=this.client,{file:a,...c}=e,n=new Date().toISOString(),r=(p=i.getState().userReducer.currentUser)==null?void 0:p.id,u=c.project,m=await this.getFilePayload(a),o=b({...c,file_name:a.name,file_sha1:m.sha1,file:URL.createObjectURL(a),submitted_at:n,created_by:r});this.dispatch(gl(o));const h=this.enqueueRequest({description:"Add geo image",method:l.POST,url:"/geo-images/",payload:{uuid:o.uuid,submitted_at:n,title:o.title,description:o.description,geo_marker:o.geo_marker,canvas_marker:o.canvas_marker,sha1:o.file_sha1,project:o.project,file_name:o.file_name,direction:o.direction,original_date:o.original_date,file:m},blocks:[u],blockers:[u]});return h.then(y=>{this.processPresignedUrls(y.presigned_urls),this.dispatch(Tt(y.geo_image))}).catch(()=>{this.dispatch(Ra(o.uuid))}),[o,h.then(y=>y.geo_image)]}async bulkAdd(e,i){var p;const{store:a}=this.client,c=new Date().toISOString(),n=(p=a.getState().userReducer.currentUser)==null?void 0:p.id,r=[],u=[],m=[],o={};for(const y of e){const{file:A,...g}=y,F=await this.getFilePayload(A);F.sha1 in o||(o[F.sha1]=F);const R=b({...g,file_name:A.name,file_sha1:F.sha1,file:URL.createObjectURL(A),submitted_at:c,created_by:n,project:i});r.push(R),u.push(R.uuid),m.push({uuid:R.uuid,sha1:R.file_sha1,file_name:R.file_name,title:R.title,description:R.description,geo_marker:R.geo_marker,canvas_marker:R.canvas_marker,direction:R.direction,original_date:R.original_date})}this.dispatch(bl(r));const h=this.enqueueRequest({description:"Bulk add geo images",method:l.POST,url:"/geo-images/bulk/",payload:{submitted_at:c,project:i,geo_images:m,files:Object.values(o)},blocks:[i],blockers:u});return h.then(y=>{this.processPresignedUrls(y.presigned_urls),this.dispatch(Il(y.geo_images))}).catch(()=>{this.dispatch(Pl(u))}),[r,h.then(y=>y.geo_images)]}update(e){const{store:i}=this.client,a=i.getState(),c=va(e.uuid)(a);if(!c)throw new Error(`Map image with uuid ${e.uuid} does not exist in the store`);const n={...c,...e};this.dispatch(Fl(n));const r=this.enqueueRequest({description:"Update geo image",method:l.PATCH,url:`/geo-images/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return r.then(u=>{this.dispatch(Tt(u))}).catch(()=>{this.dispatch(Tt(c))}),[n,r]}async delete(e){const{store:i}=this.client,a=i.getState(),c=va(e)(a);if(!c)throw new Error(`Map image with uuid ${e} does not exist in the store`);this.dispatch(Ra(e));const n=this.enqueueRequest({description:"Delete geo image",method:l.DELETE,url:`/geo-images/${e}/`,blocks:[e],blockers:[e]});return n.catch(()=>{this.dispatch(Tt(c))}),n}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get geo images",method:l.GET,url:"/geo-images/",queryParams:{project:e},blocks:[e],blockers:[]},i);return this.dispatch(Tl(a)),a}}class CF extends _{add(e){var u;const{store:i}=this.client,a=new Date().toISOString(),c=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=b({...e,submitted_at:a,created_by:c});this.dispatch(Ea(n));const r=this.enqueueRequest({description:"Add issue association",method:l.POST,url:"/issue-associations/",payload:v(n),blockers:[e.associated_issue,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[n.uuid]});return r.then(m=>{this.dispatch(El(m))}).catch(()=>{this.dispatch(Va(n.uuid))}),[n,r]}async delete(e){const{store:i}=this.client,a=Ml(e)(i.getState());if(!a)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(Va(e));const c=this.enqueueRequest({description:"Delete issue association",method:l.DELETE,url:`/issue-associations/${e}/`,blockers:[e],blocks:[]});return c.catch(()=>{this.dispatch(Ea(a))}),c}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Fetch issue associations",method:l.GET,url:"/issue-associations/",queryParams:{limit:V,paginate:!0,associated_issue__project:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Fetch issue associations",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(wl(c)),c}}class kF extends Ye{constructor(){super(...arguments);T(this,"name","Issue Attachment");T(this,"url","/issue-attachments");T(this,"initializeAttachments",za);T(this,"addAttachments",Da);T(this,"updateAttachments",Cl);T(this,"removeAttachments",Ua);T(this,"removeAttachment",kl);T(this,"setAttachment",Ul);T(this,"selectAttachment",Ll)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,issue:i.modelUuid})}buildAttachmentPayload(i){return{...i,issue:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.issueUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=(await this.performPagination({immediate:!0,description:"Get issue attachments",method:l.GET,url:`${this.url}/`,queryParams:{limit:Ke,paginate:!0,issue__project:i},blocks:[],blockers:[]},r=>({immediate:!0,description:"Get issue attachments",method:l.GET,url:r,blockers:[],blocks:[]}),a)).flat();return this.dispatch(za(n)),n}}class BF extends Ye{constructor(){super(...arguments);T(this,"name","Issue Comment Attachment");T(this,"url","/issue-comment-attachments");T(this,"initializeAttachments",ka);T(this,"addAttachments",Wl);T(this,"updateAttachments",Yl);T(this,"removeAttachments",Jl);T(this,"removeAttachment",Zl);T(this,"setAttachment",Kl);T(this,"selectAttachment",xl)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,issue_comment:i.modelUuid})}buildAttachmentPayload(i){return{...i,issue_comment:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.issueCommentUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=(await this.performPagination({immediate:!0,description:"Get issue comment attachments",method:l.GET,url:`${this.url}/`,queryParams:{limit:Ke,paginate:!0,issue_comment__issue__project:i},blocks:[],blockers:[]},r=>({immediate:!0,description:"Get issue comment attachments",method:l.GET,url:r,blockers:[],blocks:[]}),a)).flat();return this.dispatch(ka(n)),n}}class $F extends _{add(e){var n;const{store:i}=this.client,a=b({...e,author:(n=i.getState().userReducer.currentUser)==null?void 0:n.id,submitted_at:new Date().toISOString()});this.dispatch($a(a));const c=this.enqueueRequest({description:"Add issue comment",method:l.POST,url:"/issue-comments/",payload:v(a),blockers:[e.issue],blocks:[a.uuid]});return c.catch(()=>{this.dispatch(La(a.uuid))}),[a,c]}update(e){const{store:i}=this.client,a=Na(e.uuid)(i.getState());if(!a)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const c={...a,...e};this.dispatch(Ga(c));const n=this.enqueueRequest({description:"Edit issue comment",method:l.PATCH,url:`/issue-comments/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return n.catch(()=>{this.dispatch(Ga(a))}),[c,n]}remove(e){const{store:i}=this.client,a=Na(e)(i.getState());if(!a)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(La(e));const c=this.enqueueRequest({description:"Delete comment",method:l.DELETE,url:`/issue-comments/${e}/`,blockers:[e],blocks:[]});return c.catch(()=>{this.dispatch($a(a))}),c}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get comments",method:l.GET,url:"/issue-comments/",queryParams:{issue__project:e},blockers:[],blocks:[]},i);return this.dispatch(sh(a)),a}}class GF extends _{add(e){var m;const{store:i}=this.client,a=i.getState(),c=new Date().toISOString(),n=(m=a.userReducer.currentUser)==null?void 0:m.id,r=b({...e,submitted_at:c,created_by:n});this.dispatch(Wa(r));const u=this.enqueueRequest({description:"Create issue",method:l.POST,url:"/issues/",payload:v(r),blockers:[r.project,r.issue_type,...r.category?[r.category]:[]],blocks:[r.uuid]});return u.then(o=>{this.dispatch(Kt(o))}).catch(o=>{throw this.dispatch(Ka(r.uuid)),o}),[r,u]}update(e){var m;const i=this.client.store.getState(),a=Ja(e.uuid)(i);if(!a)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const c={...a,...e};this.dispatch(Kt(c));const n={};for(const o of[M.TITLE,M.DESCRIPTION,M.STATUS,M.CATEGORY,M.PRIORITY,M.ASSIGNED_TO,M.DUE_DATE])if(o in e&&e[o]!==a[o])switch(o){case M.PRIORITY:case M.STATUS:{const h=e[o];n[o]=h!==void 0?Number(h):null;break}case M.DUE_DATE:case M.DESCRIPTION:case M.TITLE:n[o]=e[o]??null;break;case M.CATEGORY:{let h=null;const p=e[o];if(p&&(h=i.categoryReducer.instances[p]??null,!h))throw new Error(`Trying to update issue category to ${p} which does not exist in store`);n[o]=h?{name:h.name,color:h.color,uuid:h.uuid}:null;break}case M.ASSIGNED_TO:{let h=null;const p=e[o];if(p&&(h=i.userReducer.instances[p]??null,!h))throw new Error(`Trying to update issue assigned_to to ${p} which does not exist in store`);n[o]=h?{full_name:h.username,id:h.id}:null;break}}const r=b({created_by:(m=i.userReducer.currentUser)==null?void 0:m.id,submitted_at:new Date().toISOString(),issue:a.uuid,changes:n});this.dispatch(ym(r));const u=this.enqueueRequest({description:"Edit issue",method:l.PATCH,url:`/issues/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.catch(()=>{this.dispatch(Kt(a)),this.dispatch(fm(r.uuid))}),[c,u]}async remove(e){const{store:i}=this.client,a=i.getState(),c=Ja(e)(a);if(!c)throw new Error(`No issue with uuid ${e} found in the store`);const n=Gl(e)(a),r=gm(e)(a),u={};for(const o of Vl(e)(a))u[o.uuid]=o;for(const o of jl(e)(a))u[o.uuid]=o;const m=Object.values(u);this.dispatch(Ka(e)),n.length>0&&this.dispatch(Ua(n.map(({uuid:o})=>o))),r.length>0&&this.dispatch(Sm(r.map(({uuid:o})=>o))),m.length>0&&this.dispatch(ja(m.map(({uuid:o})=>o)));try{return await this.enqueueRequest({description:"Delete issue",method:l.DELETE,url:`/issues/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(Wa(c)),this.dispatch(Da(n)),this.dispatch(Am(r)),this.dispatch(Ma(m)),o}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get issues",method:l.GET,url:"/issues/",queryParams:{limit:V,paginate:!0,project:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get issues",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(nh(c)),c}}class LF extends Ye{constructor(){super(...arguments);T(this,"name","Issue Type Attachment");T(this,"url","/issue-type-attachments");T(this,"initializeAttachments",Qa);T(this,"addAttachments",hh);T(this,"updateAttachments",ph);T(this,"removeAttachments",Ah);T(this,"removeAttachment",yh);T(this,"setAttachment",mh);T(this,"selectAttachment",Th)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,issue_type:i.modelUuid})}buildAttachmentPayload(i){return{...i,issue_type:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.issueTypeUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const c=await this.enqueueRequest({immediate:!0,description:"Get issue type attachments",method:l.GET,url:`${this.url}/`,queryParams:{issue_type__organization:i},blocks:[],blockers:[]},a);return this.dispatch(Qa(c)),c}}class NF extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,c={},n=[],r=[];for(const o of e){const{fieldsRevisionUuid:h,fieldIdentifier:p,file:y}=o,A=await this.getFilePayload(y);A.sha1 in c||(c[A.sha1]=A);const g=b({file:URL.createObjectURL(y),file_type:y.type,file_name:y.name,file_sha1:A.sha1,created_by:a,fields_revision:h,submitted_at:i,field_identifier:p});n.push(g);const F={uuid:g.uuid,file_name:y.name,file_extension:A.extension,field_identifier:p,file_sha1:A.sha1,fields_revision:h};r.push(F)}this.dispatch(Fh(n));const u=this.enqueueRequest({description:"Add issue type fields attachments",method:l.POST,url:"/issue-type-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(c)},blockers:n.map(o=>o.fields_revision),blocks:n.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(Ph(o.attachments))}).catch(()=>{this.dispatch(Oh(n.map(o=>o.uuid)))}),[n,u.then(({attachments:o})=>o)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"get issue type fields attachments",method:l.GET,url:"/issue-type-fields-attachments/",queryParams:{fields_revision__issue_type__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(bh(a)),a}}class HF extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,c=new Date().toISOString(),n=b({...e,created_by:a,submitted_at:c});this.dispatch(zh(n));const r=this.enqueueRequest({description:"Add Issue Type Fields",method:l.POST,url:"/issue-type-fields/",payload:v(n),blockers:[n.issue_type],blocks:[n.uuid]});return r.then(m=>{this.dispatch(Dh(m))}).catch(m=>{throw this.dispatch(Uh(n.uuid)),m}),[n,r]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get Issue Type Fields",method:l.GET,url:"/issue-type-fields/",queryParams:{issue_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(qh(a)),a}}class WF extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,c={},n=[],r=[];for(const o of e){const{fieldValuesUuid:h,fieldIdentifier:p,file:y}=o,A=await this.getFilePayload(y);A.sha1 in c||(c[A.sha1]=A);const g=b({file:URL.createObjectURL(y),file_type:y.type,file_name:y.name,file_sha1:A.sha1,created_by:a,field_values:h,submitted_at:i,field_identifier:p});n.push(g);const F={uuid:g.uuid,file_name:y.name,file_sha1:A.sha1,file_extension:A.extension,field_identifier:p,field_values:h};r.push(F)}this.dispatch(Zt(n));const u=this.enqueueRequest({description:"Add issue type field values attachments",method:l.POST,url:"/issue-type-field-values-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(c)},blockers:n.map(o=>o.field_values),blocks:n.map(o=>o.uuid)});return u.then(({presigned_urls:o,attachments:h})=>{this.processPresignedUrls(o),this.dispatch(Gh(h))}).catch(o=>{throw this.dispatch(Jt(n.map(h=>h.uuid))),o}),[n,u.then(({attachments:o})=>o)]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),c=Nh(e)(a);this.dispatch(Jt(e));try{await this.enqueueRequest({description:"Delete issue type field values attachments",method:l.DELETE,url:"/issue-type-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(n){throw this.dispatch(Zt(c)),n}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get issue type field values attachments",method:l.GET,url:"/issue-type-field-values-attachments/",queryParams:{limit:Ke,paginate:!0,field_values__issue__project:e,latest:!0},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get issue type field values attachments",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch($h(c)),c}}class KF extends _{add(e){var r;const{store:i}=this.client,a=i.getState(),c=b({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),n=this.enqueueRequest({description:"Add issue type field values",method:l.POST,url:"/issue-type-field-values/",payload:v(c),blockers:[e.issue,e.fields_revision],blocks:[c.uuid]});return this.dispatch(tc(c)),n.then(u=>(this.dispatch(gt(u)),u)).catch(()=>{this.dispatch(sc(c.uuid))}),[c,n]}update(e){const{store:i}=this.client,a=i.getState(),c=ac(e.uuid)(a);if(!c)throw new Error(`Expected IssueTypeFieldValues with uuid ${e.uuid} to exist`);const n={...c,...e};this.dispatch(gt(n));const r=this.enqueueRequest({description:"Update issue type field values",method:l.PATCH,url:`/issue-type-field-values/${e.uuid}/`,payload:e,blockers:[n.uuid,n.fields_revision,n.issue],blocks:[n.uuid]});return r.then(u=>{this.dispatch(gt(u))}).catch(()=>{this.dispatch(gt(c))}),[n,r]}async delete(e){const{store:i}=this.client,a=i.getState(),c=ac(e)(a);if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const n=Hh(e)(a);this.dispatch(sc(e)),this.dispatch(Jt(n.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete issue type field values",method:l.DELETE,url:`/issue-type-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(tc(c)),this.dispatch(Zt(n)),r}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get issue type field values",method:l.GET,url:"/issue-type-field-values/",queryParams:{limit:V,paginate:!0,issue__project:e,latest:!0},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get issue type field values",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Eh(c)),c}}class YF extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,c=new Date().toISOString(),n=b({...e,created_by:a,submitted_at:c});this.dispatch(uc(n));const r=this.enqueueRequest({description:"Create issue type identifier",method:l.POST,url:"/issue-type-identifiers/",payload:v(n),blockers:[n.issue_type],blocks:[n.uuid]});return r.then(m=>{this.dispatch(bt(m))}).catch(()=>{this.dispatch(oc(n.uuid))}),[n,r]}update(e){const{store:i}=this.client,a=lc(e.uuid)(i.getState());if(!a)throw new Error(`Expected issue type identifier with uuid ${e.uuid} to exist`);const c={...a,...e};this.dispatch(bt(c));const n=this.enqueueRequest({description:"Update issue type identifier",method:l.PATCH,url:`/issue-type-identifiers/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return n.then(r=>{this.dispatch(bt(r))}).catch(()=>{this.dispatch(bt(a))}),[c,n]}async delete(e){const{store:i}=this.client,a=i.getState(),c=lc(e)(a);if(!c)throw new Error(`Expected issue type identifier with uuid ${e} to exist`);this.dispatch(oc(e));try{return await this.enqueueRequest({description:"Delete issue type identifier",method:l.DELETE,url:`/issue-type-identifiers/${e}/`,blockers:[e],blocks:[]})}catch(n){throw this.dispatch(uc(c)),n}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get issue type identifiers",method:l.GET,url:"/issue-type-identifiers/",queryParams:{issue_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Yh(a)),a}}class ZF extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,c=new Date().toISOString(),n=b({...e,created_by:a,submitted_at:c});this.dispatch(mc(n));const r=this.enqueueRequest({description:"Create issue type identifier value",method:l.POST,url:"/issue-type-identifier-values/",payload:v(n),blockers:[e.issue,e.issue_type_identifier],blocks:[n.uuid]});return r.then(m=>{this.dispatch(Ft(m))}).catch(()=>{this.dispatch(pc(n.uuid))}),[n,r]}update(e){const{store:i}=this.client,a=Ac(e.uuid)(i.getState());if(!a)throw new Error(`Expected issue type identifier value with uuid ${e.uuid} to exist`);const c={...a,...e};this.dispatch(Ft(c));const n=this.enqueueRequest({description:"Update issue type identifier value",method:l.PATCH,url:`/issue-type-identifier-values/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return n.then(r=>{this.dispatch(Ft(r))}).catch(()=>{this.dispatch(Ft(a))}),[c,n]}async delete(e){const{store:i}=this.client,a=i.getState(),c=Ac(e)(a);if(!c)throw new Error(`Expected issue type identifier value with uuid ${e} to exist`);this.dispatch(pc(e));try{return await this.enqueueRequest({description:"Delete issue type identifier value",method:l.DELETE,url:`/issue-type-identifier-values/${e}/`,blockers:[e],blocks:[]})}catch(n){throw this.dispatch(mc(c)),n}}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get issue type identifier values",method:l.GET,url:"/issue-type-identifier-values/",queryParams:{limit:V,paginate:!0,issue__project:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get issue type identifier values",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(xh(c)),c}}class JF extends _{add(e){var r;const{store:i}=this.client,a=i.getState(),c=b({...e,submitted_at:new Date().toISOString(),created_by:(r=a.userReducer.currentUser)==null?void 0:r.id});this.dispatch(am(c));const n=this.enqueueRequest({method:l.POST,url:"/issue-types/",payload:v(c),blockers:[],blocks:[c.uuid]});return n.then(u=>{this.dispatch(Pt(u))}).catch(()=>{this.dispatch(Sc(c.uuid))}),[c,n]}update(e){const{store:i}=this.client,a=i.getState(),c=Ic(e.uuid)(a);if(!c)throw new Error(`IssueType with uuid ${e.uuid} does not exist in the store.`);const n={...c,...e};this.dispatch(cm(n));const r=this.enqueueRequest({method:l.PATCH,url:`/issue-types/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(Pt(u))}).catch(()=>{this.dispatch(Pt(c))}),[n,r]}delete(e){const{store:i}=this.client,a=i.getState(),c=Ic(e)(a);if(!c)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const n=uh(e)(a);this.dispatch(Sc(e)),this.dispatch(dh(n.map(u=>u.uuid)));const r=this.enqueueRequest({method:l.DELETE,url:`/issue-types/${e}/`,blockers:[e],blocks:[]});return r.catch(()=>{this.dispatch(Pt(c)),this.dispatch(rh(n))}),r}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,method:l.GET,url:"/issue-types/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(im(a)),a}}class XF extends _{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,c=new Date().toISOString(),n=b({...e,created_by:a,submitted_at:c});this.dispatch(bc(n));const r=this.enqueueRequest({description:"Create Issue Type Status",method:l.POST,url:"/issue-type-statuses/",payload:v(n),blockers:[e.issue_type],blocks:[n.uuid]});return r.then(m=>{this.dispatch(Xt(m))}).catch(()=>{this.dispatch(Fc(n.uuid))}),[n,r]}update(e){const i=this.client.store.getState(),a=Oc(e.uuid)(i);if(!a)throw new Error(`Expected an existing issue type status with uuid ${e.uuid}`);const c={...a,...e};this.dispatch(om(c));const n=this.enqueueRequest({description:"Edit Issue Type Status",method:l.PATCH,url:`/issue-type-statuses/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return n.then(r=>{this.dispatch(Xt(r))}).catch(()=>{this.dispatch(Xt(a))}),[c,n]}delete(e){const{store:i}=this.client,a=Oc(e)(i.getState());if(!a)throw new Error(`No issue type status with uuid ${e} found in the store`);this.dispatch(Fc(e));const c=this.enqueueRequest({description:"Delete Issue Type Status",method:l.DELETE,url:`/issue-type-statuses/${e}/`,blockers:[e],blocks:[]});return c.catch(()=>{this.dispatch(bc(a))}),c}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get issue type statuses",method:l.GET,url:"/issue-type-statuses/",queryParams:{issue_type__organization:e},blocks:[],blockers:[]},i);return this.dispatch(um(a)),a}}class QF extends _{async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get issue updates",method:l.GET,url:"/issue-updates/",queryParams:{limit:V,paginate:!0,issue__project:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get issue updates",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(pm(c)),c}}const xF=1800;function eP(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 tP extends Jb{constructor(){super(...arguments);T(this,"_getRenewedTokens",async i=>{const a=this.enqueueRequest({description:"Get renewed tokens",method:l.POST,url:this.refreshTokensUrl,payload:{refresh:i},isAuthNeeded:!1,blockers:[],blocks:[],checkAuth:!1,immediate:!0});let c;try{c=await a}catch(n){console.error("Could not renew tokens; clearing auth",n),this.clearAuth();return}if(!c.access)throw new Error("Missing access token");return{accessToken:c.access,refreshToken:c.refresh??this.getRefreshToken()}})}clearAuth(){console.debug(this.constructor.name,"clearing auth;"),this.dispatch(Wu(!1)),this.clearTokens(),this.dispatch(I()),this.dispatch(I())}async renewTokens(){const i=this.getRefreshToken();if(!i)throw new Error("No refresh token found");console.debug(this.constructor.name,"renewing tokens");try{const a=await this._getRenewedTokens(i);if(!a)return;console.log("Got renewed tokens"),this.setTokens(a)}catch(a){throw console.error("Could not renew tokens; clearing auth",a),this.clearAuth(),a}}tokenIsExpiringSoon(){const i=this.getAccessToken();if(!i)return!1;const a=Date.now()/1e3;let c;try{c=gy(i).exp??a}catch{c=a}return c-a<xF}getAuthHeader(){return`Bearer ${this.getAccessToken()}`}async prepareAuth(){if(this.tokenIsExpiringSoon()){console.debug(this.constructor.name,"preparing auth");try{await this.renewTokens()}catch(i){return i instanceof U&&this.clearAuth(),i instanceof Error?Promise.reject(i):Promise.reject(new Error((i??st).toString()))}}}async handleUnauthorized(i,a){const c=this.client.store.getState();if(i.url.endsWith("/token/refresh/"))throw c.authReducer.isLoggedIn&&console.warn("No signed-in user to sign out."),this.clearAuth(),new U({message:"You have been signed out due to inactivity.",response:a,discard:!0});if(c.authReducer.isLoggedIn)await this.renewTokens();else throw console.debug("Forbidden; user is not logged in."),new U({message:"Incorrect username or password.",response:a,discard:!0})}async initAuth(i){const a=xe.v4();return console.debug(this.constructor.name,"Initiating auth"),this.enqueueRequest({uuid:a,description:"Get token pair",method:l.POST,url:this.initTokensUrl,payload:i,isAuthNeeded:!1,checkAuth:!1,immediate:!0,blockers:[],blocks:[]}).then(c=>{this.setTokens(eP(c))})}}class sP extends _{update(e){const{store:i}=this.client,a=Mc(e.uuid)(i.getState()),c={...a,...e};this.dispatch(xt(c));const n=this.enqueueRequest({description:"Edit organization access",method:l.PATCH,url:`/organization-accesses/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return n.then(r=>{this.dispatch(xt(r))}).catch(r=>{throw this.dispatch(xt(a)),r}),[c,n]}async remove(e){const{store:i}=this.client,a=i.getState(),c=Mc(e)(a),n=wm(c.user)(a);this.dispatch(jm(c.uuid)),this.dispatch(_m(c.user));try{await this.enqueueRequest({description:"Remove organization access",method:l.DELETE,url:`/organization-accesses/${c.uuid}/`,blockers:[c.uuid],blocks:[]})}catch(r){throw this.dispatch(Vm(c)),this.dispatch(Om(n)),r}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get organization accesses",method:l.GET,url:"/organization-accesses/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(Mm(a)),a}}class iP extends _{async add(e){const i=await this.enqueueRequest({description:"Create organization",method:l.POST,url:"/organizations/",payload:e,blockers:[],blocks:[]});return this.dispatch(Cm(i)),i}async update(e){const i=await this.enqueueRequest({description:"Edit organization",method:l.PATCH,url:`/organizations/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return this.dispatch(km(i)),i}async invite(e,i){return this.enqueueRequest({description:"Invite user to organization",method:l.POST,url:`/organizations/${e}/invite/${i}/`,blockers:[],blocks:[]})}async refreshStore(e){const i=await this.enqueueRequest({immediate:!0,description:"Fetch organizations",method:l.GET,url:"/organizations/",blockers:[],blocks:[]},e);return this.dispatch(Um(i)),i}}class aP extends _{add(e){var n;const{store:i}=this.client,a=b({...e,created_by:(n=i.getState().userReducer.currentUser)==null?void 0:n.id});this.dispatch(zc(a));const c=this.enqueueRequest({description:"Add project access",method:l.POST,url:"/project-accesses/",payload:v(a),blockers:[a.organization_access,a.project],blocks:[a.uuid]});return c.then(r=>{this.dispatch(Ot(r))}).catch(r=>{throw this.dispatch(Uc(a.uuid)),r}),[a,c]}bulkAdd(e){var r;const{store:i}=this.client,a=(r=i.getState().userReducer.currentUser)==null?void 0:r.id,c=e.map(u=>b({...u,created_by:a}));this.dispatch(Dc(c));const n=this.enqueueRequest({description:"Add project accesses",method:l.POST,url:"/project-accesses/bulk/",payload:{project_accesses:c.map(u=>v(u))},blockers:c.flatMap(u=>[u.project,u.organization_access]),blocks:c.map(u=>u.uuid)});return n.then(u=>{this.dispatch(Jm(u))}).catch(u=>{throw this.dispatch(Cc(c.map(m=>m.uuid))),u}),[c,n]}update(e){const{store:i}=this.client,a=Bc(e.uuid)(i.getState()),c={...a,...e};this.dispatch(Ot(c));const n=this.enqueueRequest({description:"Edit project access",method:l.PATCH,url:`/project-accesses/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[]});return n.then(r=>{this.dispatch(Ot(r))}).catch(r=>{throw this.dispatch(Ot(a)),r}),[c,n]}async remove(e){const{store:i}=this.client,a=Bc(e)(i.getState());this.dispatch(Uc(e));try{await this.enqueueRequest({description:"Delete project access",method:l.DELETE,url:`/project-accesses/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(zc(a)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get project accesses",method:l.GET,url:"/project-accesses/",queryParams:{project__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Zm(a)),a}}class cP extends Ye{constructor(){super(...arguments);T(this,"name","Project Attachment");T(this,"url","/project-attachments");T(this,"addAttachments",tp);T(this,"updateAttachments",ap);T(this,"removeAttachments",Gc);T(this,"removeAttachment",cp);T(this,"setAttachment",sp);T(this,"selectAttachment",dp)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,project:i.modelUuid})}buildAttachmentPayload(i){return{...i,project:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.projectUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const c=await this.enqueueRequest({immediate:!0,description:"Get project attachments",method:l.GET,url:`${this.url}/`,queryParams:{project__organization:i},blockers:[],blocks:[]},a);return this.dispatch(ep(c)),c}}class nP extends _{async saveExisting(e){if(!e.uuid)throw new Error("You can only use this method to save existing project files. The one provided has no uuid.");const i={...e};delete i.file;const a=this.enqueueRequest({method:l.PATCH,url:`/project-files/${e.uuid}/`,payload:i,blockers:[e.uuid],blocks:[e.uuid]});return a.then(c=>{this.dispatch(Nc(c))}),a}saveActive(){const{store:e}=this.client,i=e.getState(),a=i.projectFileReducer.activeProjectFileId;if(!a)throw new Error("No active project file");const c=i.projectFileReducer.instances[a];if(!c)throw new Error("No active project file");if(!c.bounds&&!c.canvas_bounds)throw new Error("Project file must either have bounds or canvas_bounds set");let n;if(typeof c.file=="string"&&!c.file.startsWith("blob:")){const m={...c};delete m.file,n={method:l.PATCH,url:`/project-files/${a}/`,payload:m,blockers:[a],blocks:[a]}}else n=new Promise((m,o)=>{this.client.files.uploadFileToS3(c.file_sha1).then(([h])=>{m({method:l.POST,url:"/project-files/",payload:{...c,...h},blockers:[a],blocks:[a]})}).catch(o)});const u=Promise.resolve(n).then(m=>this.enqueueRequest(m));return u.then(m=>{this.dispatch(Nc(m))}),this.dispatch(Sp),this.dispatch(fp(null)),this.dispatch(Ap(!1)),[c,u]}delete(e){return this.dispatch(pp(e)),this.enqueueRequest({method:l.DELETE,url:`/project-files/${e}`,blockers:[e],blocks:[]})}async refreshStore(e,i){const c=(await this.performPagination({immediate:!0,description:"Get project files",method:l.GET,url:"/project-files/",queryParams:{limit:V,paginate:!0,project:e},blockers:[],blocks:[]},n=>({immediate:!0,description:"Get project files",method:l.GET,url:n,blockers:[],blocks:[]}),i)).flat();return this.dispatch(hp(c)),c}}class rP extends _{async add(e){const i=await this.enqueueRequest({description:"Create project",method:l.POST,url:"/projects/",payload:v(e),blockers:[],blocks:[]});return this.dispatch(Wc(i)),i}async update(e){if(!e.bounds&&!e.canvas_bounds)throw new Error("Project must either have bounds or canvas_bounds set");return this.dispatch(Pp(e)),await this.enqueueRequest({description:"Update project",method:l.PATCH,url:`/projects/${e.uuid}/`,payload:{name:e.name,bounds:e.bounds},blockers:[e.uuid],blocks:[e.uuid]})}async delete(e){const{store:i}=this.client,a=i.getState(),c=Rp(e)(a);if(!c)throw new Error("Expected project to exist");const n=Ip(a).filter(m=>m.project===e);this.dispatch(yp(n.map(({uuid:m})=>m)));const r=up(c.uuid)(a);this.dispatch(Gc(r.map(({uuid:m})=>m)));const u=Qm(e)(a);this.dispatch(Cc(u.map(({uuid:m})=>m))),this.dispatch(Kc(c.uuid));try{await this.enqueueRequest({description:"Delete project",method:l.DELETE,url:`/projects/${e}/`,blockers:[e],blocks:[]}),this.dispatch(Kc(c.uuid))}catch(m){throw this.dispatch(Wc(c)),this.dispatch(Dc(Object.values(u))),this.dispatch(mp(n)),this.dispatch(ip(r)),m}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch projects",method:l.GET,url:"/projects/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(Fp(a)),a}}class dP extends _{add(e){var n;const{store:i}=this.client,a=b({...e,created_by:(n=i.getState().userReducer.currentUser)==null?void 0:n.id});this.dispatch(Mp(a));const c=this.enqueueRequest({description:"Create team membership",method:l.POST,url:"/team-memberships/",payload:v(a),blockers:[e.team],blocks:[a.uuid]});return c.then(r=>{this.dispatch(Xc(r))}).catch(()=>{this.dispatch(Qc(a.uuid))}),[a,c]}bulkAdd(e){var r;const{store:i}=this.client,a=(r=i.getState().userReducer.currentUser)==null?void 0:r.id,c=e.map(u=>b({...u,created_by:a}));this.dispatch(Vp(c));const n=this.enqueueRequest({description:"Create team memberships",method:l.POST,url:"/team-memberships/bulk/",payload:{team_memberships:c.map(u=>v(u))},blockers:c.map(u=>u.team),blocks:c.map(u=>u.uuid)});return n.then(u=>{this.dispatch(jp(u))}).catch(()=>{this.dispatch(qp(c.map(u=>u.uuid)))}),[c,n]}async delete(e){const{store:i}=this.client,a=i.getState(),c=Up(e)(a);if(!c)throw new Error(`Expected team membership with uuid ${e} to exist`);this.dispatch(Qc(e));try{return await this.enqueueRequest({description:"Delete team membership",method:l.DELETE,url:`/team-memberships/${e}/`,blockers:[e],blocks:[e]})}catch(n){throw this.dispatch(Xc(c)),n}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch team memberships",method:l.GET,url:"/team-memberships/",queryParams:{team__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Ep(a)),a}}class uP extends _{add(e){var n;const{store:i}=this.client,a=b({...e,submitted_at:new Date().toISOString(),created_by:(n=i.getState().userReducer.currentUser)==null?void 0:n.id});this.dispatch(Bp(a));const c=this.enqueueRequest({description:"Create team",method:l.POST,url:"/teams/",payload:v(a),blockers:[],blocks:[a.uuid]});return c.then(r=>{this.dispatch(_t(r))}).catch(()=>{this.dispatch(tn(a.uuid))}),[a,c]}update(e){const{store:i}=this.client,a=an(e.uuid)(i.getState());if(!a)throw new Error(`Expected team with uuid ${e.uuid} to exist`);const c={...a,...e};this.dispatch($p(c));const n=this.enqueueRequest({description:"Update team",method:l.PATCH,url:`/teams/${e.uuid}/`,payload:v(e),blockers:[e.uuid],blocks:[e.uuid]});return n.then(r=>{this.dispatch(_t(r))}).catch(()=>{this.dispatch(_t(a))}),[c,n]}async delete(e){const{store:i}=this.client,a=i.getState(),c=an(e)(a);if(!c)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(tn(e));try{return await this.enqueueRequest({description:"Delete team",method:l.DELETE,url:`/teams/${e}/`,blockers:[e],blocks:[e]})}catch(n){throw this.dispatch(_t(c)),n}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch teams",method:l.GET,url:"/teams/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(kp(a)),a}}class oP extends _{async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch organization users",method:l.GET,url:`/organizations/${e}/users/`,blockers:[],blocks:[]},i);return this.dispatch(Pm(a)),a}}class lP{constructor(e){T(this,"store");this.store=e}async enqueueRequest(e,i,a,c){return this._enqueueRequest(e,i,a,c).then(n=>{if(n instanceof U)throw n;return n})}_enqueueRequest(e,i,a,c){const n=new bn,r={...e,BASE_URL:i,serviceName:a};if(e.immediate){const u={...r,uuid:e.uuid??xe.v4()},m={payload:u,type:"",meta:{offline:{effect:{timestamp:new Date().toISOString(),request:u,BASE_URL:i,serviceName:a}}}};nn(m,this,c).then(o=>{n.resolve(o.body)}).catch(o=>{rn(o,m),o instanceof Error?n.reject(o):n.reject(new Error((o??st).toString()))})}else{const u=this.store.dispatch(Nm(r)),m=h=>{if(h)n.resolve(h.body);else{const p=new U({message:"Could not get a response from the server.",response:h,discard:!0});n.reject(p)}},o=h=>{h instanceof U?h.options.discard=!0:(console.error("Received an unexpected error while processing a request:",h,`
15
+ Converting error to APIError and discarding.`),h=new U({message:"An error occurred while processing the request.",innerError:h,discard:!0})),n.reject(h)};u.then(m,o)}return n}}class it{constructor(){T(this,"graph");T(this,"requestAttemptCounter");this.graph=new by.DepGraph,this.requestAttemptCounter={}}static _fromOutbox(e){const i=new it;for(let a=0;a<e.length;a++){const c=e[a];if(!c){console.error("Outbox item was undefined");continue}i.sneakRequest(c);for(let n=0;n<a;n++){const r=e[n];if(!r){console.error("Previous outbox item was undefined");continue}r.payload.uuid!==c.payload.uuid&&r.payload.blocks.some(u=>c.payload.blockers.includes(u))&&it._addDependency(c.payload.uuid,r.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);e.payload.blockers.some(c=>a.payload.blocks.includes(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;this.graph.getNodeData(i).payload.blockers.some(c=>e.payload.blocks.includes(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 c of e){const n=this.requestAttemptCounter[c]||0;n<i&&(i=n,a=c)}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),c=e.findIndex(n=>n.payload.uuid===a.payload.uuid);c!==-1&&(e.splice(c,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 c=this.requestAttemptCounter[i.payload.uuid]||0,n=this.requestAttemptCounter[a.payload.uuid]||0;return c-n}),e}registerRetry(e){this.requestAttemptCounter[e]=(this.requestAttemptCounter[e]||0)+1}}let iy;function ay(t){iy=t}function at(){return iy}let cy;function ny(t){cy=t}function ry(){return cy}let ln=null;function Xe(){const t=at();if(!t)return console.warn("Client store not set; cannot get outbox coordinator yet."),null;if(ln)return ln;const e=t.getState().offline.outbox,i=it._fromOutbox(e);return ln=i,i}const hP=(t,e)=>{const i=new e(t);return ny(i),ay(t),i};class mP{constructor(e){T(this,"_all");T(this,"_previous");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 hn{constructor(){T(this,"next");this.next=null}then(e){return new mP(this).then(e)}async run(e){if(this.next)return this.next.run(e);{if(console.debug("Middleware finished. Performing request:",e),!at())throw new Error("Client store not set");const a=ry();if(!a)throw new Error("Client SDK not set");return nn(e,a)}}}class dy extends hn{async run(e){return super.run(e)}}class uy extends hn{async run(e){return super.run(e)}}const oy=new dy().then(new uy).compile();function ly(t){var e;return(e=oy[0])==null?void 0:e.run(t)}var hy=(t=>(t[t.USER_REGISTRATION=0]="USER_REGISTRATION",t[t.APPLICATION_INVITE=2]="APPLICATION_INVITE",t[t.PROJECT_INVITE=4]="PROJECT_INVITE",t[t.ORGANIZATION_INVITE=6]="ORGANIZATION_INVITE",t[t.ADD_EMAIL_DOMAIN=8]="ADD_EMAIL_DOMAIN",t[t.RESET_PASSWORD=10]="RESET_PASSWORD",t))(hy||{});s.ALL_MIDDLEWARE=oy,s.APIError=U,s.ATTACHMENT_PAGINATION_PAGE_SIZE=Ke,s.AgentService=Xb,s.AssetAttachmentService=Qb,s.AssetProcedureService=aF,s.AssetProcedureStepFieldValuesAttachmentService=dF,s.AssetProcedureStepFieldValuesService=uF,s.AssetProcedureStepFieldsAttachmentService=nF,s.AssetProcedureStepFieldsService=rF,s.AssetProcedureStepService=oF,s.AssetProcedureTypeAttachmentService=xb,s.AssetProcedureTypeFieldValuesAttachmentService=sF,s.AssetProcedureTypeFieldValuesService=iF,s.AssetProcedureTypeFieldsAttachmentService=eF,s.AssetProcedureTypeFieldsService=tF,s.AssetProcedureTypeService=cF,s.AssetService=lF,s.AssetStageCompletionService=hF,s.AssetStageService=mF,s.AssetStatusType=Sn,s.AssetTypeAttachmentService=pF,s.AssetTypeFieldValuesAttachmentService=fF,s.AssetTypeFieldValuesService=SF,s.AssetTypeFieldsAttachmentService=yF,s.AssetTypeFieldsService=AF,s.AssetTypeIdentifierService=TF,s.AssetTypeIdentifierValueService=IF,s.AssetTypeService=gF,s.AssetTypeStatusService=bF,s.AttachmentModel=Tn,s.BaseApiService=_,s.BaseSDK=lP,s.COMMON_AUTO_FIELDS=Rn,s.CategoryService=FF,s.DEFAULT_ISSUE_PRIORITY=Py,s.DEFAULT_ISSUE_STATUS=Fy,s.DEFAULT_PAGINATION_PAGE_SIZE=V,s.DeferredPromise=bn,s.DocumentAttachmentService=PF,s.DocumentService=OF,s.EMPTY_ARRAY=yn,s.EMPTY_OBJECT=An,s.EmailDomainsService=_F,s.EmailVerificationService=RF,s.FileService=wF,s.FormIdentifierService=EF,s.FormIdentifierValueService=MF,s.FormRevisionAttachmentService=VF,s.FormRevisionService=jF,s.FormService=qF,s.FormSubmissionAttachmentService=zF,s.FormSubmissionService=DF,s.GeoImageService=UF,s.HttpMethod=l,s.IssueAssociationService=CF,s.IssueAttachmentService=kF,s.IssueCommentAttachmentService=BF,s.IssueCommentService=$F,s.IssuePriority=is,s.IssueService=GF,s.IssueStatus=as,s.IssueStatusType=In,s.IssueTypeAttachmentService=LF,s.IssueTypeFieldValuesAttachmentService=WF,s.IssueTypeFieldValuesService=KF,s.IssueTypeFieldsAttachmentService=NF,s.IssueTypeFieldsService=HF,s.IssueTypeIdentifierService=YF,s.IssueTypeIdentifierValueService=ZF,s.IssueTypeService=JF,s.IssueTypeStatusService=XF,s.IssueUpdateChange=M,s.IssueUpdateService=QF,s.JWTService=tP,s.OUTBOX_RETRY_DELAY=gn,s.OfflineAnalyticsMiddleware=dy,s.OfflineMiddleware=hn,s.OrganizationAccessLevel=fn,s.OrganizationAccessService=sP,s.OrganizationService=iP,s.OutboxCoordinator=it,s.ProjectAccessService=aP,s.ProjectAttachmentService=cP,s.ProjectFileService=nP,s.ProjectService=rP,s.RESET_ORGANIZATION_STATE=O,s.RESET_PROJECT_STATE=E,s.RESET_STATE=I,s.RateLimitingMiddleware=uy,s.SelectorBuilder=Db,s.TeamMembershipService=dP,s.TeamService=uP,s.UNKNOWN_ERROR_MESSAGE=st,s.UserService=oP,s.VERSION_REDUCER_KEY=ct,s.VerificationCodeType=hy,s._setLatestRetryTime=Wm,s.addAsset=Qs,s.addAssetAttachment=xy,s.addAssetAttachments=ms,s.addAssetProcedure=Rs,s.addAssetProcedureStep=Sd,s.addAssetProcedureStepFieldValues=Ws,s.addAssetProcedureStepFieldValuesAttachment=nf,s.addAssetProcedureStepFieldValuesAttachments=Mt,s.addAssetProcedureStepFieldValuesMany=od,s.addAssetProcedureStepFields=ks,s.addAssetProcedureStepFieldsAttachment=LA,s.addAssetProcedureStepFieldsAttachments=Wr,s.addAssetProcedureStepFieldsMany=JA,s.addAssetProcedureSteps=Td,s.addAssetProcedureType=js,s.addAssetProcedureTypeAttachment=sA,s.addAssetProcedureTypeAttachments=Jn,s.addAssetProcedureTypeFieldValues=bs,s.addAssetProcedureTypeFieldValuesAttachment=gA,s.addAssetProcedureTypeFieldValuesAttachments=wt,s.addAssetProcedureTypeFieldValuesMany=wr,s.addAssetProcedureTypeFields=yr,s.addAssetProcedureTypeFieldsAttachment=nA,s.addAssetProcedureTypeFieldsAttachments=rr,s.addAssetProcedureTypeFieldsMany=mA,s.addAssetProcedureTypes=DA,s.addAssetProcedures=Dr,s.addAssetStage=li,s.addAssetStageCompletion=ci,s.addAssetStageCompletions=ni,s.addAssetStages=Ef,s.addAssetType=Di,s.addAssetTypeAttachment=Df,s.addAssetTypeAttachments=yi,s.addAssetTypeFieldValues=bi,s.addAssetTypeFieldValuesAttachment=eS,s.addAssetTypeFieldValuesAttachments=kt,s.addAssetTypeFieldValuesMany=bu,s.addAssetTypeFields=du,s.addAssetTypeFieldsAttachment=kf,s.addAssetTypeFieldsAttachments=eu,s.addAssetTypeFieldsMany=Wf,s.addAssetTypeIdentifier=Ri,s.addAssetTypeIdentifierValue=Mi,s.addAssetTypeIdentifierValues=AS,s.addAssetTypeIdentifiers=oS,s.addAssetTypeStatus=$i,s.addAssetTypeStatuses=ES,s.addAssetTypes=OS,s.addAssets=zt,s.addCategories=BS,s.addCategory=Wi,s.addConversation=zn,s.addConversations=Wy,s.addDocumentAttachment=KS,s.addDocumentAttachments=so,s.addDocuments=po,s.addEmailDomain=To,s.addEmailDomains=eT,s.addForm=fa,s.addFormIdentifier=sa,s.addFormIdentifierValue=na,s.addFormIdentifierValues=pT,s.addFormIdentifiers=dT,s.addFormRevision=ha,s.addFormRevisionAttachment=gT,s.addFormRevisionAttachments=Bo,s.addFormRevisions=Ko,s.addFormSubmission=ba,s.addFormSubmissionAttachment=kT,s.addFormSubmissionAttachments=Nt,s.addFormSubmissions=ml,s.addForms=VT,s.addGeoImage=gl,s.addGeoImages=bl,s.addIssue=Wa,s.addIssueAssociation=Ea,s.addIssueAssociations=Ma,s.addIssueAttachment=xT,s.addIssueAttachments=Da,s.addIssueComment=$a,s.addIssueCommentAttachment=sI,s.addIssueCommentAttachments=Wl,s.addIssueComments=rI,s.addIssueType=am,s.addIssueTypeAttachment=fI,s.addIssueTypeAttachments=hh,s.addIssueTypeFieldValues=tc,s.addIssueTypeFieldValuesAttachment=LI,s.addIssueTypeFieldValuesAttachments=Zt,s.addIssueTypeFieldValuesMany=vI,s.addIssueTypeFields=zh,s.addIssueTypeFieldsAttachment=gI,s.addIssueTypeFieldsAttachments=Fh,s.addIssueTypeFieldsMany=qI,s.addIssueTypeIdentifier=uc,s.addIssueTypeIdentifierValue=mc,s.addIssueTypeIdentifierValues=tg,s.addIssueTypeIdentifiers=ZI,s.addIssueTypeStatus=bc,s.addIssueTypeStatuses=yg,s.addIssueTypes=dg,s.addIssueUpdate=ym,s.addIssueUpdates=Am,s.addIssues=rh,s.addOrganization=Cm,s.addOrganizationAccess=Vm,s.addOrganizationAccesses=qg,s.addOrganizations=Lg,s.addProject=Wc,s.addProjectAccess=zc,s.addProjectAccesses=Dc,s.addProjectAttachment=sb,s.addProjectAttachments=tp,s.addProjectFile=nb,s.addProjectFiles=mp,s.addProjects=pb,s.addTeam=Bp,s.addTeamMembership=Mp,s.addTeamMemberships=Vp,s.addTeams=_b,s.addUser=Om,s.addUsers=Rg,s.agentsReducer=Cn,s.agentsSlice=us,s.areArraysEqual=Ry,s.assetAttachmentReducer=Kn,s.assetAttachmentSlice=ls,s.assetProcedureReducer=Cr,s.assetProcedureSlice=_s,s.assetProcedureStepFieldValuesAttachmentReducer=rd,s.assetProcedureStepFieldValuesAttachmentSlice=Ls,s.assetProcedureStepFieldValuesReducer=pd,s.assetProcedureStepFieldValuesSlice=Hs,s.assetProcedureStepFieldsAttachmentReducer=Xr,s.assetProcedureStepFieldsAttachmentSlice=Us,s.assetProcedureStepFieldsReducer=ed,s.assetProcedureStepFieldsSlice=Cs,s.assetProcedureStepReducer=bd,s.assetProcedureStepSlice=Zs,s.assetProcedureTypeAttachmentReducer=tr,s.assetProcedureTypeAttachmentSlice=ys,s.assetProcedureTypeFieldValuesAttachmentReducer=Fr,s.assetProcedureTypeFieldValuesAttachmentSlice=Ts,s.assetProcedureTypeFieldValuesReducer=Vr,s.assetProcedureTypeFieldValuesSlice=gs,s.assetProcedureTypeFieldsAttachmentReducer=or,s.assetProcedureTypeFieldsAttachmentSlice=As,s.assetProcedureTypeFieldsReducer=Sr,s.assetProcedureTypeFieldsSlice=fs,s.assetProcedureTypeReducer=Gr,s.assetProcedureTypeSlice=Vs,s.assetReducer=wd,s.assetSlice=Xs,s.assetStageCompletionReducer=qd,s.assetStageCompletionSlice=ai,s.assetStageReducer=Bd,s.assetStageSlice=oi,s.assetTypeAttachmentReducer=Xd,s.assetTypeAttachmentSlice=pi,s.assetTypeFieldValuesAttachmentReducer=Tu,s.assetTypeFieldValuesAttachmentSlice=Ti,s.assetTypeFieldValuesReducer=_u,s.assetTypeFieldValuesSlice=gi,s.assetTypeFieldsAttachmentReducer=cu,s.assetTypeFieldsAttachmentSlice=fi,s.assetTypeFieldsReducer=hu,s.assetTypeFieldsSlice=Si,s.assetTypeIdentifierReducer=Mu,s.assetTypeIdentifierSlice=_i,s.assetTypeIdentifierValueReducer=zu,s.assetTypeIdentifierValueSlice=Ei,s.assetTypeReducer=ku,s.assetTypeSlice=zi,s.assetTypeStatusReducer=Nu,s.assetTypeStatusSlice=Bi,s.authReducer=Ku,s.authSlice=Gt,s.baseReducer=jb,s.baseReducers=cn,s.blobToBase64=Dy,s.categoryReducer=xu,s.categorySlice=Hi,s.clearTokens=US,s.constructUploadedFilePayloads=zy,s.createModelAdapter=P,s.createOfflineAction=Gm,s.createPayload=v,s.createSelectionAdapter=Oy,s.deleteAsset=xs,s.deleteAssetAttachment=Gn,s.deleteAssetAttachments=ps,s.deleteAssetProcedure=vs,s.deleteAssetProcedureStep=Id,s.deleteAssetProcedureStepFieldValues=Ks,s.deleteAssetProcedureStepFieldValuesAttachment=of,s.deleteAssetProcedureStepFieldValuesAttachments=Vt,s.deleteAssetProcedureStepFieldValuesMany=hd,s.deleteAssetProcedureStepFields=Bs,s.deleteAssetProcedureStepFieldsAttachment=KA,s.deleteAssetProcedureStepFieldsAttachments=Yr,s.deleteAssetProcedureStepFieldsMany=ef,s.deleteAssetProcedureSteps=gd,s.deleteAssetProcedureType=qs,s.deleteAssetProcedureTypeAttachment=xn,s.deleteAssetProcedureTypeAttachments=er,s.deleteAssetProcedureTypeFieldValues=Fs,s.deleteAssetProcedureTypeFieldValuesAttachment=OA,s.deleteAssetProcedureTypeFieldValuesAttachments=Et,s.deleteAssetProcedureTypeFieldValuesMany=Mr,s.deleteAssetProcedureTypeFields=fr,s.deleteAssetProcedureTypeFieldsAttachment=oA,s.deleteAssetProcedureTypeFieldsAttachments=ur,s.deleteAssetProcedureTypeFieldsMany=fA,s.deleteAssetProcedureTypes=CA,s.deleteAssetProcedures=Ur,s.deleteAssetStage=hi,s.deleteAssetStageCompletion=ri,s.deleteAssetStageCompletions=di,s.deleteAssetStages=Vf,s.deleteAssetType=Ui,s.deleteAssetTypeAttachment=Wd,s.deleteAssetTypeAttachments=Ai,s.deleteAssetTypeFieldValues=Fi,s.deleteAssetTypeFieldValuesAttachment=aS,s.deleteAssetTypeFieldValuesAttachments=Bt,s.deleteAssetTypeFieldValuesMany=Pu,s.deleteAssetTypeFields=ou,s.deleteAssetTypeFieldsAttachment=Lf,s.deleteAssetTypeFieldsAttachments=su,s.deleteAssetTypeFieldsMany=Jf,s.deleteAssetTypeIdentifier=vi,s.deleteAssetTypeIdentifierValue=Vi,s.deleteAssetTypeIdentifierValues=IS,s.deleteAssetTypeIdentifiers=pS,s.deleteAssetTypeStatus=Gi,s.deleteAssetTypeStatuses=jS,s.deleteAssetTypes=RS,s.deleteAssets=ei,s.deleteCategories=NS,s.deleteCategory=Xu,s.deleteConversation=Zy,s.deleteConversations=Jy,s.deleteDocumentAttachment=co,s.deleteDocumentAttachments=no,s.deleteEmailDomain=Io,s.deleteEmailDomains=cT,s.deleteForm=Sa,s.deleteFormIdentifier=ia,s.deleteFormIdentifierValue=ra,s.deleteFormIdentifierValues=ST,s.deleteFormIdentifiers=hT,s.deleteFormRevision=ma,s.deleteFormRevisionAttachment=OT,s.deleteFormRevisionAttachments=Go,s.deleteFormRevisions=Zo,s.deleteFormSubmission=Fa,s.deleteFormSubmissionAttachment=LT,s.deleteFormSubmissionAttachments=Ht,s.deleteFormSubmissions=yl,s.deleteForms=UT,s.deleteGeoImage=Ra,s.deleteGeoImages=Pl,s.deleteIssue=Ka,s.deleteIssueAssociation=Va,s.deleteIssueAssociations=ja,s.deleteIssueAttachment=kl,s.deleteIssueAttachments=Ua,s.deleteIssueComment=La,s.deleteIssueCommentAttachment=Zl,s.deleteIssueCommentAttachments=Jl,s.deleteIssueComments=oI,s.deleteIssueType=lg,s.deleteIssueTypeAttachment=yh,s.deleteIssueTypeAttachments=Ah,s.deleteIssueTypeFieldValues=sc,s.deleteIssueTypeFieldValuesAttachment=KI,s.deleteIssueTypeFieldValuesAttachments=Jt,s.deleteIssueTypeFieldValuesMany=VI,s.deleteIssueTypeFields=Uh,s.deleteIssueTypeFieldsAttachment=OI,s.deleteIssueTypeFieldsAttachments=Oh,s.deleteIssueTypeFieldsMany=CI,s.deleteIssueTypeIdentifier=oc,s.deleteIssueTypeIdentifierValue=pc,s.deleteIssueTypeIdentifierValues=cg,s.deleteIssueTypeIdentifiers=xI,s.deleteIssueTypeStatus=Fc,s.deleteIssueTypeStatuses=Sg,s.deleteIssueTypes=hg,s.deleteIssueUpdate=fm,s.deleteIssueUpdates=Sm,s.deleteIssues=dh,s.deleteOrganization=Hg,s.deleteOrganizationAccess=jm,s.deleteOrganizationAccesses=Cg,s.deleteOrganizations=Wg,s.deleteProject=Kc,s.deleteProjectAccess=Uc,s.deleteProjectAccesses=Cc,s.deleteProjectAttachment=cp,s.deleteProjectAttachments=Gc,s.deleteProjectFile=pp,s.deleteProjectFiles=yp,s.deleteProjects=Ab,s.deleteTeam=tn,s.deleteTeamMembership=Qc,s.deleteTeamMemberships=qp,s.deleteTeams=wb,s.deleteUser=_m,s.deleteUsers=Eg,s.dequeue=ey,s.discard=rn,s.documentAttachmentReducer=lo,s.documentAttachmentSlice=Zi,s.documentSlice=Ji,s.documentsReducer=Ao,s.downloadFile=Uy,s.downloadInMemoryFile=qy,s.emailDomainsReducer=Fo,s.emailDomainsSlice=xi,s.emailRegex=Ny,s.enqueue=xp,s.enqueueRequest=Nm,s.fallbackToEmptyArray=S,s.fallbackToEmptyObject=vt,s.fileReducer=vo,s.fileSlice=ea,s.fileToBlob=On,s.formIdentifierReducer=jo,s.formIdentifierSlice=ta,s.formIdentifierValueReducer=Uo,s.formIdentifierValueSlice=ca,s.formReducer=el,s.formRevisionAttachmentReducer=No,s.formRevisionAttachmentSlice=oa,s.formRevisionReducer=Xo,s.formRevisionsSlice=la,s.formSlice=Aa,s.formSubmissionAttachmentReducer=ol,s.formSubmissionAttachmentSlice=Ta,s.formSubmissionReducer=fl,s.formSubmissionSlice=ga,s.geoImageReducer=Rl,s.geoImageSlice=_a,s.getAssetProcedureStepSubTree=Vn,s.getAssetProcedureStepTrees=Hy,s.getClientSDK=ry,s.getClientStore=at,s.getFileIdentifier=jy,s.getFileS3Key=ds,s.getLocalDateString=Fn,s.getLocalRelativeDateString=My,s.getOutboxCoordinator=Xe,s.getRenamedFile=Pn,s.hashFile=et,s.initSDK=hP,s.initializeAssetAttachments=hs,s.initializeAssetProcedureStepFieldValues=ud,s.initializeAssetProcedureStepFieldValuesAttachments=sd,s.initializeAssetProcedureStepFields=xr,s.initializeAssetProcedureStepFieldsAttachments=Hr,s.initializeAssetProcedureSteps=Ad,s.initializeAssetProcedureTypeAttachments=Zn,s.initializeAssetProcedureTypeFieldValues=vr,s.initializeAssetProcedureTypeFieldValuesAttachments=gr,s.initializeAssetProcedureTypeFields=pr,s.initializeAssetProcedureTypeFieldsAttachments=nr,s.initializeAssetProcedureTypes=$r,s.initializeAssetProcedures=zr,s.initializeAssetStageCompletions=Md,s.initializeAssetStages=Cd,s.initializeAssetTypeAttachments=Ld,s.initializeAssetTypeFieldValues=gu,s.initializeAssetTypeFieldValuesAttachments=pu,s.initializeAssetTypeFields=ru,s.initializeAssetTypeFieldsAttachments=xd,s.initializeAssetTypeIdentifierValues=ju,s.initializeAssetTypeIdentifiers=vu,s.initializeAssetTypeStatuses=$u,s.initializeAssetTypes=Uu,s.initializeAssets=_d,s.initializeCategories=Zu,s.initializeConversations=qn,s.initializeDocumentAttachments=to,s.initializeEmailDomains=So,s.initializeFormIdentifierValues=zo,s.initializeFormIdentifiers=Eo,s.initializeFormRevisionAttachments=ko,s.initializeFormRevisions=Wo,s.initializeFormSubmissionAttachments=cl,s.initializeFormSubmissions=hl,s.initializeForms=xo,s.initializeGeoImages=Tl,s.initializeIssueAssociations=wl,s.initializeIssueAttachments=za,s.initializeIssueCommentAttachments=ka,s.initializeIssueComments=nI,s.initializeIssueTypeAttachments=Qa,s.initializeIssueTypeFieldValues=Eh,s.initializeIssueTypeFieldValuesAttachments=$h,s.initializeIssueTypeFields=qh,s.initializeIssueTypeFieldsAttachments=bh,s.initializeIssueTypeIdentifierValues=xh,s.initializeIssueTypeIdentifiers=Yh,s.initializeIssueTypeStatuses=um,s.initializeIssueTypes=im,s.initializeIssueUpdates=pm,s.initializeIssues=nh,s.initializeOrganizationAccesses=Mm,s.initializeOrganizations=Um,s.initializeProjectAccesses=Zm,s.initializeProjectAttachments=ep,s.initializeProjectFiles=hp,s.initializeProjects=Fp,s.initializeTeamMemberships=Ep,s.initializeTeams=kp,s.initializeUsers=Pm,s.isToday=Ey,s.issueAssociationReducer=zl,s.issueAssociationSlice=wa,s.issueAttachmentReducer=Nl,s.issueAttachmentSlice=qa,s.issueCommentAttachmentReducer=eh,s.issueCommentAttachmentSlice=Ca,s.issueCommentReducer=ah,s.issueCommentSlice=Ba,s.issueReducer=oh,s.issueSlice=Ha,s.issueTypeAttachmentReducer=Ih,s.issueTypeAttachmentSlice=Xa,s.issueTypeFieldValuesAttachmentReducer=Wh,s.issueTypeFieldValuesAttachmentSlice=nc,s.issueTypeFieldValuesReducer=Vh,s.issueTypeFieldValuesSlice=ec,s.issueTypeFieldsAttachmentReducer=vh,s.issueTypeFieldsAttachmentSlice=xa,s.issueTypeFieldsReducer=kh,s.issueTypeFieldsSlice=cc,s.issueTypeIdentifierReducer=Xh,s.issueTypeIdentifierSlice=dc,s.issueTypeIdentifierValueReducer=tm,s.issueTypeIdentifierValueSlice=hc,s.issueTypeReducer=rm,s.issueTypeSlice=fc,s.issueTypeStatusReducer=hm,s.issueTypeStatusSlice=gc,s.issueUpdateReducer=bm,s.issueUpdateSlice=_c,s.logOnlyOnce=Cy,s.markAsDeleted=Hm,s.markForDeletion=Xg,s.memoize=ns,s.onlyUniqueHashes=Ly,s.onlyUniqueOfflineIds=En,s.organizationAccessReducer=qm,s.organizationAccessSlice=wc,s.organizationReducer=$m,s.organizationSlice=Vc,s.outboxReducer=Km,s.outboxSlice=jc,s.overmapEnhancer=Nb,s.overmapReducer=qb,s.overmapReducers=Wp,s.performRequest=nn,s.projectAccessReducer=Xm,s.projectAccessSlice=qc,s.projectAttachmentReducer=op,s.projectAttachmentSlice=$c,s.projectFileReducer=gp,s.projectFileSlice=Lc,s.projectReducer=Op,s.projectSlice=Hc,s.rehydratedReducer=vp,s.rehydratedSlice=Zc,s.removeDocuments=Xi,s.removeIssueType=Sc,s.resetProjectFileObjectUrls=db,s.restructureCreateSelectorWithArgs=f,s.runMiddleware=ly,s.saveActiveProjectFileBounds=Sp,s.selectAccessToken=CS,s.selectAccessesByUserOfProject=eb,s.selectAccessibleProjects=fb,s.selectActiveOrganizationAccess=kg,s.selectActiveProjectFileId=ob,s.selectAllDocumentAttachments=uo,s.selectAllProjectAttachments=rp,s.selectAssetAttachmentById=Hn,s.selectAssetAttachmentMapping=Ln,s.selectAssetAttachments=Nn,s.selectAssetById=ii,s.selectAssetProcedureById=Ms,s.selectAssetProcedureStepById=Js,s.selectAssetProcedureStepFieldValues=jt,s.selectAssetProcedureStepFieldValuesAttachmentById=lf,s.selectAssetProcedureStepFieldValuesAttachments=ad,s.selectAssetProcedureStepFieldValuesAttachmentsByIds=cd,s.selectAssetProcedureStepFieldValuesAttachmentsMapping=Ns,s.selectAssetProcedureStepFieldValuesById=Ys,s.selectAssetProcedureStepFieldValuesMapping=md,s.selectAssetProcedureStepFieldValuesOfAsset=pf,s.selectAssetProcedureStepFieldValuesOfAssetProcedure=yf,s.selectAssetProcedureStepFieldValuesOfAssetProcedureStep=Af,s.selectAssetProcedureStepFields=Gs,s.selectAssetProcedureStepFieldsAttachmentById=ZA,s.selectAssetProcedureStepFieldsAttachments=Jr,s.selectAssetProcedureStepFieldsAttachmentsMapping=Zr,s.selectAssetProcedureStepFieldsById=cf,s.selectAssetProcedureStepFieldsMapping=$s,s.selectAssetProcedureStepFieldsOfAssetProcedureStep=tf,s.selectAssetProcedureStepMapping=lt,s.selectAssetProcedureSteps=Fd,s.selectAssetProcedureStepsByIds=gf,s.selectAssetProcedureStepsMappingOfAssetProcedureType=Tf,s.selectAssetProcedureStepsOfAssetProcedureType=If,s.selectAssetProcedureTypeAttachmentById=ar,s.selectAssetProcedureTypeAttachmentMapping=sr,s.selectAssetProcedureTypeAttachments=ir,s.selectAssetProcedureTypeById=Ds,s.selectAssetProcedureTypeFieldValues=Ps,s.selectAssetProcedureTypeFieldValuesAttachmentById=_A,s.selectAssetProcedureTypeFieldValuesAttachments=Pr,s.selectAssetProcedureTypeFieldValuesAttachmentsByIds=Or,s.selectAssetProcedureTypeFieldValuesAttachmentsMapping=Is,s.selectAssetProcedureTypeFieldValuesById=Os,s.selectAssetProcedureTypeFieldValuesMapping=jr,s.selectAssetProcedureTypeFieldValuesOfAsset=wA,s.selectAssetProcedureTypeFields=Ss,s.selectAssetProcedureTypeFieldsAttachmentById=hA,s.selectAssetProcedureTypeFieldsAttachments=hr,s.selectAssetProcedureTypeFieldsAttachmentsMapping=lr,s.selectAssetProcedureTypeFieldsById=IA,s.selectAssetProcedureTypeFieldsMapping=Tr,s.selectAssetProcedureTypeFieldsOfAssetProcedureType=SA,s.selectAssetProcedureTypes=Lr,s.selectAssetProcedureTypesByIds=$A,s.selectAssetProcedureTypesMapping=zs,s.selectAssetProcedureTypesOfOrganization=GA,s.selectAssetProcedures=Es,s.selectAssetProceduresByIds=zA,s.selectAssetProceduresMapping=ws,s.selectAssetProceduresOfAssetProcedureType=kr,s.selectAssetProceduresOfAssetType=qA,s.selectAssetStageById=mi,s.selectAssetStageCompletionById=zd,s.selectAssetStageCompletionMapping=ui,s.selectAssetStageCompletions=vf,s.selectAssetStageCompletionsByIds=Dd,s.selectAssetStages=$d,s.selectAssetStagesByIds=zf,s.selectAssetStagesMappingOfAssetProcedureType=jf,s.selectAssetStagesOfAssetProcedureType=qf,s.selectAssetTypeAttachmentById=Zd,s.selectAssetTypeAttachmentMapping=Kd,s.selectAssetTypeAttachments=Yd,s.selectAssetTypeById=ki,s.selectAssetTypeFieldValues=Pi,s.selectAssetTypeFieldValuesAttachmentById=cS,s.selectAssetTypeFieldValuesAttachments=Au,s.selectAssetTypeFieldValuesAttachmentsByIds=fu,s.selectAssetTypeFieldValuesAttachmentsMapping=Ii,s.selectAssetTypeFieldValuesById=Oi,s.selectAssetTypeFieldValuesMapping=Ou,s.selectAssetTypeFieldValuesOfAsset=dS,s.selectAssetTypeFields=Ct,s.selectAssetTypeFieldsAttachmentById=Hf,s.selectAssetTypeFieldsAttachments=au,s.selectAssetTypeFieldsAttachmentsMapping=iu,s.selectAssetTypeFieldsById=xf,s.selectAssetTypeFieldsMapping=lu,s.selectAssetTypeFieldsOfAssetType=Xf,s.selectAssetTypeIdentifierById=wi,s.selectAssetTypeIdentifierMapping=wu,s.selectAssetTypeIdentifierValueById=qi,s.selectAssetTypeIdentifierValueMapping=qu,s.selectAssetTypeIdentifierValues=ji,s.selectAssetTypeIdentifierValuesOfAsset=gS,s.selectAssetTypeIdentifierValuesOfIdentifier=bS,s.selectAssetTypeIdentifiers=Eu,s.selectAssetTypeIdentifiersOfAssetType=yS,s.selectAssetTypeStatusById=Ni,s.selectAssetTypeStatusMapping=Li,s.selectAssetTypeStatuses=Lu,s.selectAssetTypeStatusesByIds=qS,s.selectAssetTypeStatusesOfAssetType=zS,s.selectAssetTypeValuesOfAssetType=uS,s.selectAssetTypes=Cu,s.selectAssetTypesByIds=vS,s.selectAssetTypesMapping=Ci,s.selectAssetTypesOfOrganization=wS,s.selectAssets=Rd,s.selectAssetsByIds=vd,s.selectAssetsMapping=ti,s.selectAssetsOfAssetType=si,s.selectAttachmentsOfAsset=Wn,s.selectAttachmentsOfAssetProcedureStepFieldValues=nd,s.selectAttachmentsOfAssetProcedureStepFields=YA,s.selectAttachmentsOfAssetProcedureType=cA,s.selectAttachmentsOfAssetProcedureTypeFieldValues=_r,s.selectAttachmentsOfAssetProcedureTypeFields=lA,s.selectAttachmentsOfAssetType=Jd,s.selectAttachmentsOfAssetTypeFieldValues=Su,s.selectAttachmentsOfAssetTypeFields=Nf,s.selectAttachmentsOfDocument=JS,s.selectAttachmentsOfFormRevision=_T,s.selectAttachmentsOfFormSubmission=ul,s.selectAttachmentsOfIssue=Gl,s.selectAttachmentsOfIssueComment=cI,s.selectAttachmentsOfIssueType=II,s.selectAttachmentsOfIssueTypeFieldValues=Hh,s.selectAttachmentsOfIssueTypeFields=_I,s.selectAttachmentsOfProject=up,s.selectCategories=Qu,s.selectCategoriesByIds=HS,s.selectCategoriesOfProject=WS,s.selectCategoryById=Yi,s.selectCategoryMapping=Ki,s.selectCommentsOfIssue=lI,s.selectConversation=Qy,s.selectConversationMapping=os,s.selectConversations=Xy,s.selectCurrentUser=vm,s.selectDeletedRequests=Zg,s.selectDescendantsOfAssetProcedureStep=Pd,s.selectDocumentAttachmentById=oo,s.selectDocumentAttachmentMapping=ro,s.selectDocumentById=yo,s.selectDocuments=Qi,s.selectDocumentsByIds=XS,s.selectDocumentsMapping=Lt,s.selectEmailDomains=bo,s.selectEmailDomainsAsMapping=go,s.selectEmailDomainsOfOrganization=nT,s.selectFieldValuesOfAssetProcedure=EA,s.selectFormById=il,s.selectFormIdentifierById=aa,s.selectFormIdentifierMapping=Mo,s.selectFormIdentifierValueById=ua,s.selectFormIdentifierValueMapping=Do,s.selectFormIdentifierValues=da,s.selectFormIdentifierValuesOfFormSubmission=TT,s.selectFormIdentifierValuesOfIdentifier=IT,s.selectFormIdentifiers=Vo,s.selectFormIdentifiersOfForm=mT,s.selectFormMapping=tl,s.selectFormRevisionAttachmentsMapping=Lo,s.selectFormRevisionById=ET,s.selectFormRevisionMapping=pa,s.selectFormRevisions=ya,s.selectFormRevisionsOfForm=Jo,s.selectFormSubmissionAttachemntsByIds=dl,s.selectFormSubmissionAttachments=Ia,s.selectFormSubmissionAttachmentsMapping=rl,s.selectFormSubmissionById=Oa,s.selectFormSubmissions=WT,s.selectFormSubmissionsMapping=Pa,s.selectFormSubmissionsOfForm=Al,s.selectForms=sl,s.selectFormsOfOrganization=CT,s.selectGeoImageById=va,s.selectGeoImageMapping=Ol,s.selectGeoImages=_l,s.selectGeoImagesOfProject=YT,s.selectIsImportingProjectFile=lb,s.selectIsLoggedIn=kS,s.selectIssueAssociationById=Ml,s.selectIssueAssociationMapping=It,s.selectIssueAssociations=QT,s.selectIssueAssociationsOfAsset=ql,s.selectIssueAssociationsOfIssue=jl,s.selectIssueAssociationsToIssue=Vl,s.selectIssueAttachmentById=Ll,s.selectIssueAttachmentMapping=Bl,s.selectIssueAttachments=$l,s.selectIssueById=Ja,s.selectIssueCommentAttachmentById=xl,s.selectIssueCommentAttachmentMapping=Xl,s.selectIssueCommentAttachments=Ql,s.selectIssueCommentById=Na,s.selectIssueCommentMapping=ih,s.selectIssueMapping=Ya,s.selectIssueTypeAttachmentById=Th,s.selectIssueTypeAttachmentMapping=fh,s.selectIssueTypeAttachments=Sh,s.selectIssueTypeById=Ic,s.selectIssueTypeFieldValues=ic,s.selectIssueTypeFieldValuesAttachmentById=YI,s.selectIssueTypeFieldValuesAttachments=rc,s.selectIssueTypeFieldValuesAttachmentsByIds=Nh,s.selectIssueTypeFieldValuesAttachmentsMapping=Lh,s.selectIssueTypeFieldValuesById=ac,s.selectIssueTypeFieldValuesMapping=Mh,s.selectIssueTypeFieldValuesOfIssue=jI,s.selectIssueTypeFields=Yt,s.selectIssueTypeFieldsAttachmentById=RI,s.selectIssueTypeFieldsAttachments=Rh,s.selectIssueTypeFieldsAttachmentsMapping=_h,s.selectIssueTypeFieldsById=GI,s.selectIssueTypeFieldsMapping=Ch,s.selectIssueTypeFieldsOfIssueType=kI,s.selectIssueTypeIdentifierById=lc,s.selectIssueTypeIdentifierMapping=Zh,s.selectIssueTypeIdentifierValueById=Ac,s.selectIssueTypeIdentifierValueMapping=em,s.selectIssueTypeIdentifierValues=yc,s.selectIssueTypeIdentifierValuesOfIdentifier=rg,s.selectIssueTypeIdentifierValuesOfIssue=ng,s.selectIssueTypeIdentifiers=Jh,s.selectIssueTypeIdentifiersOfIssueType=eg,s.selectIssueTypeMapping=Tc,s.selectIssueTypeStatusById=Oc,s.selectIssueTypeStatusMapping=Pc,s.selectIssueTypeStatuses=lm,s.selectIssueTypeStatusesByIds=Tg,s.selectIssueTypeStatusesOfIssueType=Ig,s.selectIssueTypeValuesOfIssueType=$I,s.selectIssueTypes=nm,s.selectIssueTypesByIds=mg,s.selectIssueTypesOfOrganization=pg,s.selectIssueUpdateMapping=Tm,s.selectIssueUpdates=Im,s.selectIssueUpdatesOfIssue=gm,s.selectIssues=Za,s.selectIssuesByIds=yI,s.selectIssuesOfIssueType=uh,s.selectIssuesOfProject=AI,s.selectLatestAssetProcedureStepFieldsOfAssetProcedureStep=sf,s.selectLatestAssetProcedureTypeFieldsOfAssetProcedureType=TA,s.selectLatestAssetTypeFieldsOfAssetType=Qf,s.selectLatestFieldsByAssetProcedureStep=af,s.selectLatestFormRevisionOfForm=MT,s.selectLatestIssueTypeFieldsOfIssueType=BI,s.selectLatestRetryTime=Jg,s.selectMembershipsByUserOfTeam=Pb,s.selectNumberOfAssetsOfAssetType=Of,s.selectOrganizationAccessById=Mc,s.selectOrganizationAccessMapping=Ec,s.selectOrganizationAccessUserMapping=zm,s.selectOrganizationById=Yg,s.selectOrganizationDocuments=xS,s.selectOrganizations=Kg,s.selectOrganizationsMapping=Bm,s.selectProjectAccessById=Bc,s.selectProjectAccessMapping=kc,s.selectProjectAccesses=es,s.selectProjectAccessesOfProject=Qm,s.selectProjectAttachmentById=dp,s.selectProjectAttachmentMapping=np,s.selectProjectById=Rp,s.selectProjectDocuments=QS,s.selectProjectFileById=ub,s.selectProjectFileMapping=Tp,s.selectProjectFiles=Ip,s.selectProjectMapping=_p,s.selectProjects=Yc,s.selectProjectsOfOrganization=Sb,s.selectRehydrated=gb,s.selectStageMapping=Ut,s.selectTeamById=an,s.selectTeamMembershipById=Up,s.selectTeamMemberships=xc,s.selectTeamMembershipsMapping=Dp,s.selectTeams=Gp,s.selectTeamsByIds=Eb,s.selectTeamsMapping=sn,s.selectTeamsOfOrganization=Mb,s.selectUploadUrl=Ro,s.selectUserById=wm,s.selectUsers=vc,s.selectUsersByIds=jg,s.selectUsersMapping=Qt,s.selectUsersOfOrganization=Bg,s.selectUsersOfProject=tb,s.selectUsersOfTeam=Ob,s.setActiveProjectFileId=fp,s.setAsset=Ff,s.setAssetAttachment=Bn,s.setAssetAttachments=eA,s.setAssetProcedure=VA,s.setAssetProcedureStep=fd,s.setAssetProcedureStepFieldValues=hf,s.setAssetProcedureStepFieldValuesAttachment=rf,s.setAssetProcedureStepFieldValuesAttachments=df,s.setAssetProcedureStepFieldValuesMany=mf,s.setAssetProcedureStepFields=XA,s.setAssetProcedureStepFieldsAttachment=NA,s.setAssetProcedureStepFieldsAttachments=HA,s.setAssetProcedureStepFieldsMany=QA,s.setAssetProcedureSteps=ff,s.setAssetProcedureType=kA,s.setAssetProcedureTypeAttachment=Xn,s.setAssetProcedureTypeAttachments=iA,s.setAssetProcedureTypeFieldValues=RA,s.setAssetProcedureTypeFieldValuesAttachment=bA,s.setAssetProcedureTypeFieldValuesAttachments=FA,s.setAssetProcedureTypeFieldValuesMany=vA,s.setAssetProcedureTypeFields=pA,s.setAssetProcedureTypeFieldsAttachment=rA,s.setAssetProcedureTypeFieldsAttachments=dA,s.setAssetProcedureTypeFieldsMany=yA,s.setAssetProcedureTypes=BA,s.setAssetProcedures=jA,s.setAssetStage=kd,s.setAssetStageCompletion=_f,s.setAssetStageCompletions=Rf,s.setAssetStages=wf,s.setAssetType=FS,s.setAssetTypeAttachment=Nd,s.setAssetTypeAttachments=Uf,s.setAssetTypeFieldValues=nS,s.setAssetTypeFieldValuesAttachment=tS,s.setAssetTypeFieldValuesAttachments=sS,s.setAssetTypeFieldValuesMany=rS,s.setAssetTypeFields=Kf,s.setAssetTypeFieldsAttachment=Bf,s.setAssetTypeFieldsAttachments=$f,s.setAssetTypeFieldsMany=Yf,s.setAssetTypeIdentifier=lS,s.setAssetTypeIdentifierValue=fS,s.setAssetTypeIdentifierValues=SS,s.setAssetTypeIdentifiers=hS,s.setAssetTypeStatus=$t,s.setAssetTypeStatuses=MS,s.setAssetTypes=PS,s.setAssets=Pf,s.setCategories=GS,s.setCategory=$S,s.setClientSDK=ny,s.setClientStore=ay,s.setConversation=Dn,s.setConversations=Ky,s.setCurrentUser=Mg,s.setDocumentAttachment=io,s.setDocumentAttachments=YS,s.setDocuments=mo,s.setEmailDomain=tT,s.setEmailDomains=sT,s.setForm=jT,s.setFormIdentifier=uT,s.setFormIdentifierValue=yT,s.setFormIdentifierValues=AT,s.setFormIdentifiers=oT,s.setFormRevision=Yo,s.setFormRevisionAttachment=bT,s.setFormRevisionAttachments=FT,s.setFormRevisions=RT,s.setFormSubmission=Wt,s.setFormSubmissionAttachment=BT,s.setFormSubmissionAttachments=$T,s.setFormSubmissions=NT,s.setForms=qT,s.setGeoImage=Tt,s.setGeoImages=Il,s.setIsImportingProjectFile=Ap,s.setIssue=hI,s.setIssueAssociation=JT,s.setIssueAssociations=ZT,s.setIssueAttachment=Ul,s.setIssueAttachments=eI,s.setIssueComment=Ga,s.setIssueCommentAttachment=Kl,s.setIssueCommentAttachments=iI,s.setIssueComments=sh,s.setIssueType=Pt,s.setIssueTypeAttachment=mh,s.setIssueTypeAttachments=SI,s.setIssueTypeFieldValues=wI,s.setIssueTypeFieldValuesAttachment=NI,s.setIssueTypeFieldValuesAttachments=HI,s.setIssueTypeFieldValuesMany=EI,s.setIssueTypeFields=zI,s.setIssueTypeFieldsAttachment=bI,s.setIssueTypeFieldsAttachments=FI,s.setIssueTypeFieldsMany=DI,s.setIssueTypeIdentifier=JI,s.setIssueTypeIdentifierValue=sg,s.setIssueTypeIdentifierValues=ig,s.setIssueTypeIdentifiers=XI,s.setIssueTypeStatus=Xt,s.setIssueTypeStatuses=Ag,s.setIssueTypes=ug,s.setIssueUpdate=gg,s.setIssueUpdates=bg,s.setIssues=mI,s.setLoggedIn=Wu,s.setOrganization=Gg,s.setOrganizationAccess=zg,s.setOrganizationAccesses=Dg,s.setOrganizations=$g,s.setProfilePicture=Vg,s.setProject=mb,s.setProjectAccess=Qg,s.setProjectAccesses=xg,s.setProjectAttachment=sp,s.setProjectAttachments=ip,s.setProjectFile=ab,s.setProjectFiles=cb,s.setProjects=hb,s.setRehydrated=Ib,s.setTeam=_t,s.setTeamMembership=Xc,s.setTeamMemberships=jp,s.setTeams=Rb,s.setTokens=DS,s.setUploadUrl=_o,s.setUser=_g,s.setUsers=Og,s.shallowEqual=_y,s.slugify=$y,s.spacesToDashesLower=By,s.teamMembershipReducer=zp,s.teamMembershipSlice=Jc,s.teamReducer=Lp,s.teamSlice=en,s.toFileNameSafeString=ky,s.toUuidArray=wn,s.toUuidIdRecord=vn,s.truncate=Gy,s.updateAsset=ht,s.updateAssetAttachment=tA,s.updateAssetAttachments=$n,s.updateAssetProcedure=rt,s.updateAssetProcedureStep=qt,s.updateAssetProcedureStepFieldValues=ot,s.updateAssetProcedureStepFieldValuesAttachment=uf,s.updateAssetProcedureStepFieldValuesAttachments=id,s.updateAssetProcedureStepFieldValuesMany=ld,s.updateAssetProcedureStepFields=ut,s.updateAssetProcedureStepFieldsAttachment=WA,s.updateAssetProcedureStepFieldsAttachments=Kr,s.updateAssetProcedureStepFieldsMany=xA,s.updateAssetProcedureSteps=Sf,s.updateAssetProcedureType=dt,s.updateAssetProcedureTypeAttachment=aA,s.updateAssetProcedureTypeAttachments=Qn,s.updateAssetProcedureTypeFieldValues=nt,s.updateAssetProcedureTypeFieldValuesAttachment=PA,s.updateAssetProcedureTypeFieldValuesAttachments=br,s.updateAssetProcedureTypeFieldValuesMany=Er,s.updateAssetProcedureTypeFields=Ar,s.updateAssetProcedureTypeFieldsAttachment=uA,s.updateAssetProcedureTypeFieldsAttachments=dr,s.updateAssetProcedureTypeFieldsMany=AA,s.updateAssetProcedureTypes=UA,s.updateAssetProcedures=MA,s.updateAssetStage=Dt,s.updateAssetStageCompletion=Vd,s.updateAssetStageCompletions=jd,s.updateAssetStages=Mf,s.updateAssetType=At,s.updateAssetTypeAttachment=Cf,s.updateAssetTypeAttachments=Hd,s.updateAssetTypeFieldValues=mt,s.updateAssetTypeFieldValuesAttachment=iS,s.updateAssetTypeFieldValuesAttachments=yu,s.updateAssetTypeFieldValuesMany=Fu,s.updateAssetTypeFields=uu,s.updateAssetTypeFieldsAttachment=Gf,s.updateAssetTypeFieldsAttachments=tu,s.updateAssetTypeFieldsMany=Zf,s.updateAssetTypeIdentifier=pt,s.updateAssetTypeIdentifierValue=yt,s.updateAssetTypeIdentifierValues=TS,s.updateAssetTypeIdentifiers=mS,s.updateAssetTypeStatus=Gu,s.updateAssetTypeStatuses=VS,s.updateAssetTypes=_S,s.updateAssets=bf,s.updateCategories=LS,s.updateCategory=Ju,s.updateConversation=Un,s.updateConversations=Yy,s.updateDocumentAttachment=ZS,s.updateDocumentAttachments=ao,s.updateDocuments=tt,s.updateEmailDomain=iT,s.updateEmailDomains=aT,s.updateForm=zT,s.updateFormIdentifier=ft,s.updateFormIdentifierValue=St,s.updateFormIdentifierValues=fT,s.updateFormIdentifiers=lT,s.updateFormRevision=vT,s.updateFormRevisionAttachment=PT,s.updateFormRevisionAttachments=$o,s.updateFormRevisions=wT,s.updateFormSubmission=pl,s.updateFormSubmissionAttachment=GT,s.updateFormSubmissionAttachments=nl,s.updateFormSubmissions=HT,s.updateForms=DT,s.updateGeoImage=Fl,s.updateGeoImages=KT,s.updateIssue=Kt,s.updateIssueAssociation=El,s.updateIssueAssociations=XT,s.updateIssueAttachment=tI,s.updateIssueAttachments=Cl,s.updateIssueComment=dI,s.updateIssueCommentAttachment=aI,s.updateIssueCommentAttachments=Yl,s.updateIssueComments=uI,s.updateIssueType=cm,s.updateIssueTypeAttachment=TI,s.updateIssueTypeAttachments=ph,s.updateIssueTypeFieldValues=gt,s.updateIssueTypeFieldValuesAttachment=WI,s.updateIssueTypeFieldValuesAttachments=Gh,s.updateIssueTypeFieldValuesMany=MI,s.updateIssueTypeFields=Dh,s.updateIssueTypeFieldsAttachment=PI,s.updateIssueTypeFieldsAttachments=Ph,s.updateIssueTypeFieldsMany=UI,s.updateIssueTypeIdentifier=bt,s.updateIssueTypeIdentifierValue=Ft,s.updateIssueTypeIdentifierValues=ag,s.updateIssueTypeIdentifiers=QI,s.updateIssueTypeStatus=om,s.updateIssueTypeStatuses=fg,s.updateIssueTypes=og,s.updateIssueUpdate=Fg,s.updateIssueUpdates=Pg,s.updateIssues=pI,s.updateOrganization=km,s.updateOrganizationAccess=xt,s.updateOrganizationAccesses=Ug,s.updateOrganizations=Ng,s.updateProject=Pp,s.updateProjectAccess=Ot,s.updateProjectAccesses=Jm,s.updateProjectAttachment=ib,s.updateProjectAttachments=ap,s.updateProjectFile=Nc,s.updateProjectFiles=rb,s.updateProjects=yb,s.updateTeam=$p,s.updateTeamMembership=bb,s.updateTeamMemberships=Fb,s.updateTeams=vb,s.updateUser=wg,s.updateUsers=vg,s.useSelectorBuilder=zb,s.userReducer=Rm,s.userSlice=Rc,s.uuidObj=b,s.versioningReducer=Hp,s.versioningSlice=Np,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});