@overmap-ai/core 1.0.78-model-service.0 → 1.0.78-model-service.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,15 @@
1
- (function(i,$){typeof exports=="object"&&typeof module<"u"?$(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("localforage"),require("redux-persist-migrate"),require("buffer"),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","localforage","redux-persist-migrate","buffer","@overmap-ai/forms","idb","jwt-decode","dependency-graph","@tiptap/core"],$):(i=typeof globalThis<"u"?globalThis:i||self,$(i["overmap-core"]={},null,i.toolkit,i.request,i.uuid,i.fileSaver,i.buildTree,i.tsTreeLib,i.react,i.reduxOffline,i.offlineConfig,i.localforage,i.createMigration,null,null,i.idb,i.jwtDecode,i.dependencyGraph))})(this,function(i,$,u,Qe,xe,OO,qa,ot,FO,PO,$a,gO,bO,Tb,Ib,_O,MO,RO){"use strict";var fb=Object.defineProperty;var Sb=(i,$,u)=>$ in i?fb(i,$,{enumerable:!0,configurable:!0,writable:!0,value:u}):i[$]=u;var h=(i,$,u)=>Sb(i,typeof $!="symbol"?$+"":$,u);var TO;const Da=Object.freeze([]),Ua=Object.freeze({});var Ca=(t=>(t[t.GUEST=0]="GUEST",t[t.BASIC=2]="BASIC",t[t.ADMIN=4]="ADMIN",t))(Ca||{}),y=(t=>(t.GET="GET",t.POST="POST",t.PATCH="PATCH",t.PUT="PUT",t.DELETE="DELETE",t))(y||{}),La=(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))(La||{}),Ga=(t=>(t.Issue="issue",t.Asset="asset",t.AssetType="asset_type",t.Project="project",t.Document="document",t))(Ga||{}),$t=(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))($t||{}),B=(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))(B||{}),ka=(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))(ka||{});const wO=$t.MEDIUM,Na=6e4;function P(t){return{addOne:(l,p)=>{const A=t(p.payload);l.instances[A]=p.payload},addMany:(l,p)=>{for(const A of p.payload){const T=t(A);l.instances[T]=A}},setOne:(l,p)=>{const A=t(p.payload);l.instances[A]=p.payload},setMany:(l,p)=>{for(const A of p.payload){const T=t(A);l.instances[T]=A}},updateOne:(l,p)=>{const A=t(p.payload);l.instances[A]=p.payload},updateMany:(l,p)=>{for(const A of p.payload){const T=t(A);l.instances[T]=A}},deleteOne:(l,p)=>{delete l.instances[p.payload]},deleteMany:(l,p)=>{for(const A of p.payload)delete l.instances[A]},initialize:(l,p)=>{l.instances={};const A=new Set;for(const T of p.payload){const I=t(T);A.add(I),l.instances[I]=T}A.size!==p.payload.length&&console.warn("duplicate ids detected when initializing model instances.")}}}function vO(){return{initializeSelection:(o,m)=>{o.selection=Array.from(new Set(m.payload))},selectOne:(o,m)=>{new Set(o.selection).has(m.payload)||o.selection.push(m.payload)},selectMany:(o,m)=>{const l=new Set(o.selection);for(const p of m.payload)l.has(p)||l.add(p);o.selection=Array.from(l)},unselectOne:(o,m)=>{const l=new Set(o.selection);l.has(m.payload)&&(l.delete(m.payload),o.selection=Array.from(l))},unselectMany:(o,m)=>{const l=new Set(o.selection);for(const p of m.payload)l.has(p)&&l.delete(p);o.selection=Array.from(l)},toggleOne:(o,m)=>{const l=new Set(o.selection);l.has(m.payload)?l.delete(m.payload):l.add(m.payload),o.selection=Array.from(l)},toggleMany:(o,m)=>{const l=new Set(o.selection);for(const p of m.payload)l.has(p)?l.delete(p):l.add(p);o.selection=Array.from(l)},getInitialState:o=>({...o,selection:[]})}}const nt="versioning",O=u.createAction("RESET"),E=u.createAction("RESET_PROJECT_STATE"),b=u.createAction("RESET_ORGANIZATION_STATE");TO=Symbol.toStringTag;class Dt{constructor(){h(this,TO,"Promise");h(this,"_promise");h(this,"_resolve");h(this,"_reject");h(this,"_state","pending");this._resolve=null,this._reject=null,this._promise=new Promise((s,e)=>{this._resolve=s,this._reject=e})}get state(){return this._state}then(s,e){return this._promise.then(s,e)}catch(s){return this._promise.catch(s)}resolve(s){if(!this._resolve)throw new Error("No resolve callback");this._resolve(s),this._state="fulfilled"}reject(s){if(!this._reject)throw s;this._reject(s),this._state="rejected"}finally(s){throw new Error("`finally` not implemented")}}let Ut=!1;["true","1"].includes("".toLowerCase())&&(Ut=!0);function EO(t,s){if(t===s)return!0;if(typeof t!=typeof s)return!1;const e=Object.keys(t),a=Object.keys(s),n=e.length;if(n!==a.length)return!1;for(let c=0;c<n;c++){const d=e[c];if(!Object.prototype.hasOwnProperty.call(s,d)||t[d]!==s[d])return!1}return!0}function Ct(t){const s={};return function(){const e=Array.prototype.slice.call(arguments);return e in s?(Ut&&console.debug(`Memoization debug: Using memorized return value for ${t.toString()}(`,e,")"),s[e]):(Ut&&console.debug(`Memoization debug: Cache miss! Memoizing ${t.toString()}(`,e,")"),s[e]=t.apply(this,e))}}function VO(t,s){if(t.length!==s.length)return!1;for(let e=0;e<t.length;e++)if(t[e]!==s[e])return!1;return!0}const S=t=>t.length===0?Da:t,ht=t=>Object.keys(t).length===0?Ua:t,Ha=Ct(t=>{if(!t)return"";const s=new Date(t),e=s.getFullYear()===Lt.getFullYear(),a={day:"numeric",month:"short"};return e||(a.year="numeric"),s.toLocaleDateString([],a)}),zO=new Intl.RelativeTimeFormat([],{style:"long",numeric:"auto"}),BO=1e3*86400,Lt=new Date,jO=t=>new Date(t).toDateString()===Lt.toDateString(),qO=Ct((t,s,e)=>{const a=Math.round((new Date(t).getTime()-Lt.getTime())/BO);return a<s||a>e?Ha(t):zO.format(a,"days")});function $O(t){return new Uint8Array(t).reduce((e,a)=>e+a.toString(16).padStart(2,"0"),"")}const Gt=async(t,s)=>{s||(s=await et(t));let e=t.type;if(e.includes("/")&&(e=e.split("/")[1]),!e)throw new Error(`Could not extract file type from ${t.type}`);return`${s}.${e}`};function et(t){return new Promise((s,e)=>{const a=new FileReader;a.onload=()=>{const n=a.result;if(!n){e(new Error("FileReader did not return a valid ArrayBuffer."));return}crypto.subtle.digest("SHA-1",n).then(c=>{const d=$O(c);s(d)})},a.readAsArrayBuffer(t)})}function DO(t){if(!t.name||!t.type||!t.size){const s="File has no name, type, and/or size";throw new Error(s)}return`${t.name}&${t.type}${t.size}`}function Wa(t,s){return new File([t],s,{type:t.type})}function UO(t,s){const e=document.createElement("a");e.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(s)),e.setAttribute("download",t),e.style.display="none",document.body.appendChild(e),e.click(),document.body.removeChild(e)}const CO=async t=>{const s={};for(const e of t){const a=await et(e);s[a]={sha1:a,extension:e.name.split(".").pop()||"",file_type:e.type,size:e.size}}return Object.values(s)},Ka=async t=>(await fetch(t)).blob(),LO=t=>new Promise((s,e)=>{const a=new FileReader;a.onloadend=()=>{var n;s(((n=a.result)==null?void 0:n.toString())||"")},a.readAsDataURL(t)});function GO(t){const s=new Blob([t]);OO.saveAs(s,t.name)}const Ya={};function kO(t,s,e,...a){const n=Ya[t];let c=!1;n?n[s]||(n[s]=!0,c=!0):(Ya[t]={[s]:!0},c=!0),c&&console[e](...a)}const Za=["created_at","updated_at","index","revision"];function F(t){return{...t,uuid:xe.v4()}}function NO(t){const s={};for(const e of t)s[e.uuid]=e;return s}function Ja(t){return t.map(({uuid:s})=>s)}function HO(t,s=void 0,e=255){let a=t.replace(/[^a-z0-9_\-.]/gi,"_").replace(/_{2,}/g,"_");if(!s){const c=t.split(".");c.length>1&&(s=c[c.length-1])}s&&!s.startsWith(".")&&(s="."+s);const n=s?s.length:0;return a.length+n>e&&(a=a.slice(0,e-n)+(s||"")),a}function WO(t){return t.toLowerCase().replace(" ","-")}function KO(t,s=!1){return t.normalize("NFKD").toLowerCase().replace(/[^\w\s-]/g,"").trim().replace(/[-\s]+/g,s?"_":"-")}function YO(t,s){if(t.length<=s)return t;const e=t.slice(0,s-1);return e.slice(0,e.lastIndexOf(" "))+"…"}const f=t=>s=>e=>t(e,s);function ZO(t,s,e){return e.findIndex(a=>a.uuid===t.uuid)===s}function JO(t,s,e){return e.findIndex(a=>a.file_sha1===t.file_sha1)===s}const XO=/^.+@.+\..+$/;function R(t){const s={...t};for(const e of[...Za,"created_by"])e in s&&delete s[e];return s}const Xa=t=>{const s=t.toSorted((e,a)=>e.order-a.order);return qa(s,{id:e=>e.uuid,parentId:e=>e.parent,includeEmptyChildrenArray:!0,valueKey:!1})},QO=t=>{const{roots:s}=Xa(t);return s.map(e=>new ot.Tree(e))},Qa=(t,s)=>{const{nodes:e}=Xa(s),a=e.get(t);if(!a)throw new Error(`Node with uuid ${t} does not exist in asset procedure step tree.`);return new ot.Tree(a)},xa=(t,s)=>t.type!==s.type?t.type-s.type:t.order-s.order,en=(t,s)=>t.type!==s.type?t.type-s.type:t.order-s.order,tn=t=>qa(t,{id:s=>s.uuid,parentId:s=>s.parent_document,includeEmptyChildrenArray:!0,valueKey:!1}),xO=t=>{const{roots:s}=tn(t);return s.map(e=>new ot.Tree(e))},eF=(t,s)=>{const{nodes:e}=tn(s),a=e.get(t);if(!a)throw new Error(`Node with uuid ${t} does not exist in document tree.`);return new ot.Tree(a)},U=P(t=>t.uuid),sn={instances:{}},kt=u.createSlice({name:"agents",initialState:sn,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,sn)),reducers:{initializeConversations:U.initialize,addConversation:U.addOne,addConversations:U.addMany,setConversation:U.setOne,setConversations:U.setMany,updateConversation:U.updateOne,updateConversations:U.updateMany,deleteConversation:U.deleteOne,deleteConversations:U.deleteMany}}),{initializeConversations:an,addConversation:nn,addConversations:tF,setConversation:cn,setConversations:sF,updateConversation:dn,updateConversations:iF,deleteConversation:aF,deleteConversations:nF}=kt.actions,Nt=t=>t.agentsReducer.instances,cF=u.createSelector([Nt],t=>Object.values(t)),dF=f(u.createSelector([Nt,(t,s)=>s],(t,s)=>t[s])),rn=kt.reducer,C=P(t=>t.uuid),un={instances:{}},Ht=u.createSlice({name:"assetAttachments",initialState:un,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,un)),reducers:{initializeAssetAttachments:C.initialize,addAssetAttachment:C.addOne,addAssetAttachments:C.addMany,setAssetAttachment:C.setOne,setAssetAttachments:C.setMany,updateAssetAttachment:C.updateOne,updateAssetAttachments:C.updateMany,deleteAssetAttachment:C.deleteOne,deleteAssetAttachments:C.deleteMany}}),{initializeAssetAttachments:ln,addAssetAttachment:on,addAssetAttachments:Wt,setAssetAttachment:hn,setAssetAttachments:mn,updateAssetAttachment:yn,updateAssetAttachments:pn,deleteAssetAttachment:An,deleteAssetAttachments:Kt}=Ht.actions,fn=t=>t.assetAttachmentReducer.instances,Yt=u.createSelector([fn],t=>Object.values(t)),Sn=t=>s=>s.assetAttachmentReducer.instances[t],Tn=f(u.createSelector([Yt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),In=f(u.createSelector([Yt,(t,s)=>s],(t,s)=>S(t.filter(({asset:e})=>s===e)))),On=Ht.reducer,L=P(({uuid:t})=>t),Fn={instances:{}},Zt=u.createSlice({name:"assetProcedureTypeAttachments",initialState:Fn,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,Fn)),reducers:{initializeAssetProcedureTypeAttachments:L.initialize,addAssetProcedureTypeAttachment:L.addOne,addAssetProcedureTypeAttachments:L.addMany,setAssetProcedureTypeAttachment:L.setOne,setAssetProcedureTypeAttachments:L.setMany,updateAssetProcedureTypeAttachment:L.updateOne,updateAssetProcedureTypeAttachments:L.updateMany,deleteAssetProcedureTypeAttachment:L.deleteOne,deleteAssetProcedureTypeAttachments:L.deleteMany}}),{initializeAssetProcedureTypeAttachments:Pn,addAssetProcedureTypeAttachment:gn,addAssetProcedureTypeAttachments:bn,setAssetProcedureTypeAttachment:_n,setAssetProcedureTypeAttachments:Mn,updateAssetProcedureTypeAttachment:Rn,updateAssetProcedureTypeAttachments:wn,deleteAssetProcedureTypeAttachment:vn,deleteAssetProcedureTypeAttachments:En}=Zt.actions,Vn=Zt.reducer,zn=t=>t.assetProcedureTypeAttachmentReducer.instances,Jt=u.createSelector([zn],t=>Object.values(t)),Bn=t=>s=>s.assetProcedureTypeAttachmentReducer.instances[t],jn=f(u.createSelector([Jt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),rF=f(u.createSelector([Jt,(t,s)=>s],(t,s)=>S(t.filter(({asset_procedure_type:e})=>s===e)))),G=P(({uuid:t})=>t),qn={instances:{}},Xt=u.createSlice({name:"assetProcedureTypeFieldsAttachments",initialState:qn,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,qn)),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:$n,addAssetProcedureTypeFieldsAttachment:Dn,addAssetProcedureTypeFieldsAttachments:Un,setAssetProcedureTypeFieldsAttachment:Cn,setAssetProcedureTypeFieldsAttachments:Ln,updateAssetProcedureTypeFieldsAttachment:Gn,updateAssetProcedureTypeFieldsAttachments:kn,deleteAssetProcedureTypeFieldsAttachment:Nn,deleteAssetProcedureTypeFieldsAttachments:Hn}=Xt.actions,Wn=Xt.reducer,Kn=t=>t.assetProcedureTypeFieldsAttachmentReducer.instances,Qt=u.createSelector([Kn],t=>Object.values(t)),uF=f(u.createSelector([Qt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.fields_revision===s)))),Yn=t=>s=>s.assetProcedureTypeFieldsAttachmentReducer.instances[t],Zn=f(u.createSelector([Qt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),k=P(({uuid:t})=>t),Jn={instances:{}},xt=u.createSlice({name:"assetProcedureTypeFields",initialState:Jn,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,Jn)),reducers:{initializeAssetProcedureTypeFields:k.initialize,addAssetProcedureTypeFields:k.addOne,addAssetProcedureTypeFieldsMany:k.addMany,setAssetProcedureTypeFields:k.setOne,setAssetProcedureTypeFieldsMany:k.setMany,updateAssetProcedureTypeFields:k.updateOne,updateAssetProcedureTypeFieldsMany:k.updateMany,deleteAssetProcedureTypeFields:k.deleteOne,deleteAssetProcedureTypeFieldsMany:k.deleteMany}}),{initializeAssetProcedureTypeFields:Xn,addAssetProcedureTypeFields:Qn,addAssetProcedureTypeFieldsMany:xn,setAssetProcedureTypeFields:ec,setAssetProcedureTypeFieldsMany:tc,updateAssetProcedureTypeFields:sc,updateAssetProcedureTypeFieldsMany:ic,deleteAssetProcedureTypeFields:ac,deleteAssetProcedureTypeFieldsMany:nc}=xt.actions,cc=xt.reducer,dc=t=>t.assetProcedureTypeFieldsReducer.instances,mt=u.createSelector([dc],t=>Object.values(t)),lF=f(u.createSelector([mt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_procedure_type===s)))),oF=f(u.createSelector([mt,(t,s)=>s],(t,s)=>t.filter(e=>e.asset_procedure_type===s).sort((e,a)=>e.submitted_at>a.submitted_at?-1:1)[0])),rc=t=>s=>s.assetProcedureTypeFieldsReducer.instances[t],uc=f(u.createSelector([mt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),N=P(({uuid:t})=>t),lc={instances:{}},es=u.createSlice({name:"assetProcedureTypeFieldValuesAttachments",initialState:lc,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,lc)),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:oc,addAssetProcedureTypeFieldValuesAttachment:hc,addAssetProcedureTypeFieldValuesAttachments:ts,setAssetProcedureTypeFieldValuesAttachment:mc,setAssetProcedureTypeFieldValuesAttachments:yc,updateAssetProcedureTypeFieldValuesAttachment:pc,updateAssetProcedureTypeFieldValuesAttachments:Ac,deleteAssetProcedureTypeFieldValuesAttachment:fc,deleteAssetProcedureTypeFieldValuesAttachments:ss}=es.actions,Sc=es.reducer,Tc=t=>t.assetProcedureTypeFieldValuesAttachmentReducer.instances,is=u.createSelector([Tc],t=>Object.values(t)),Ic=t=>s=>s.assetProcedureTypeFieldValuesAttachmentReducer.instances[t],Oc=f(u.createSelector([is,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),Fc=f(u.createSelector([is,(t,s)=>s],(t,s)=>S(t.filter(e=>e.field_values===s)))),H=P(({uuid:t})=>t),Pc={instances:{}},as=u.createSlice({name:"assetProcedureTypeFieldValues",initialState:Pc,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,Pc)),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:gc,addAssetProcedureTypeFieldValues:bc,addAssetProcedureTypeFieldValuesMany:_c,setAssetProcedureTypeFieldValues:Mc,setAssetProcedureTypeFieldValuesMany:Rc,updateAssetProcedureTypeFieldValues:wc,updateAssetProcedureTypeFieldValuesMany:vc,deleteAssetProcedureTypeFieldValues:Ec,deleteAssetProcedureTypeFieldValuesMany:Vc}=as.actions,zc=as.reducer,Bc=t=>t.assetProcedureTypeFieldValuesReducer.instances,yt=u.createSelector([Bc],t=>Object.values(t)),hF=f(u.createSelector([yt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset===s)))),mF=f(u.createSelector([yt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_procedure===s)))),jc=t=>s=>s.assetProcedureTypeFieldValuesReducer.instances[t],qc=f(u.createSelector([yt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),W=P(({uuid:t})=>t),$c={instances:{}},ns=u.createSlice({name:"assetProcedures",initialState:$c,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,$c)),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:Dc,addAssetProcedure:Uc,addAssetProcedures:cs,updateAssetProcedure:Cc,updateAssetProcedures:Lc,deleteAssetProcedure:Gc,deleteAssetProcedures:ds,setAssetProcedure:kc,setAssetProcedures:Nc}=ns.actions,Hc=ns.reducer,Wc=t=>t.assetProcedureReducer.instances,pt=u.createSelector([Wc],t=>Object.values(t)),Kc=f(u.createSelector([pt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_procedure_type===s)))),yF=f(u.createSelector([pt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_type===s)))),Yc=t=>s=>s.assetProcedureReducer.instances[t],Zc=f(u.createSelector([pt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),K=P(t=>t.uuid),Jc={instances:{}},rs=u.createSlice({name:"assetProcedureTypes",initialState:Jc,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,Jc)),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:Xc,addAssetProcedureType:Qc,addAssetProcedureTypes:xc,updateAssetProcedureType:ed,updateAssetProcedureTypes:td,deleteAssetProcedureType:sd,deleteAssetProcedureTypes:id,setAssetProcedureType:ad,setAssetProcedureTypes:nd}=rs.actions,cd=rs.reducer,dd=t=>t.assetProcedureTypeReducer.instances,us=u.createSelector([dd],t=>Object.values(t)),rd=t=>s=>s.assetProcedureTypeReducer.instances[t],ud=f(u.createSelector([us,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),pF=f(u.createSelector([us,(t,s)=>s],(t,s)=>S(t.filter(e=>e.organization===s)))),Y=P(t=>t.uuid),ld={instances:{}},ls=u.createSlice({name:"assetProcedureStepFieldsAttachments",initialState:ld,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,ld)),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:od,addAssetProcedureStepFieldsAttachment:hd,addAssetProcedureStepFieldsAttachments:md,setAssetProcedureStepFieldsAttachment:yd,setAssetProcedureStepFieldsAttachments:pd,updateAssetProcedureStepFieldsAttachment:Ad,updateAssetProcedureStepFieldsAttachments:fd,deleteAssetProcedureStepFieldsAttachment:Sd,deleteAssetProcedureStepFieldsAttachments:Td}=ls.actions,Id=t=>t.assetProcedureStepFieldsAttachmentReducer.instances,os=u.createSelector([Id],t=>Object.values(t)),AF=f(u.createSelector([os,(t,s)=>s],(t,s)=>S(t.filter(e=>e.fields_revision===s)))),Od=t=>s=>s.assetProcedureStepFieldsAttachmentReducer.instances[t],Fd=f(u.createSelector([os,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),Pd=ls.reducer,Z=P(t=>t.uuid),gd={instances:{}},hs=u.createSlice({name:"assetProcedureStepFields",initialState:gd,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,gd)),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:bd,addAssetProcedureStepFields:_d,addAssetProcedureStepFieldsMany:Md,setAssetProcedureStepFields:Rd,setAssetProcedureStepFieldsMany:wd,updateAssetProcedureStepFields:vd,updateAssetProcedureStepFieldsMany:Ed,deleteAssetProcedureStepFields:Vd,deleteAssetProcedureStepFieldsMany:zd}=hs.actions,ms=t=>t.assetProcedureStepFieldsReducer.instances,At=u.createSelector([ms],t=>Object.values(t)),fF=f(u.createSelector([At,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_procedure_step===s)))),SF=f(u.createSelector([At,(t,s)=>s],(t,s)=>t.filter(e=>e.asset_procedure_step===s).sort((e,a)=>e.submitted_at>a.submitted_at?-1:1)[0])),TF=u.createSelector([ms],t=>{const s={};for(const e of Object.values(t)){const a=s[e.asset_procedure_step];(!a||a.submitted_at<e.submitted_at)&&(s[e.asset_procedure_step]=e)}return s}),Bd=t=>s=>s.assetProcedureStepFieldsReducer.instances[t],jd=f(u.createSelector([At,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),qd=hs.reducer,J=P(t=>t.uuid),$d={instances:{}},ys=u.createSlice({name:"assetProcedureStepFieldValuesAttachments",initialState:$d,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,$d)),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:Dd,addAssetProcedureStepFieldValuesAttachment:Ud,addAssetProcedureStepFieldValuesAttachments:ps,setAssetProcedureStepFieldValuesAttachment:Cd,setAssetProcedureStepFieldValuesAttachments:Ld,updateAssetProcedureStepFieldValuesAttachment:Gd,updateAssetProcedureStepFieldValuesAttachments:kd,deleteAssetProcedureStepFieldValuesAttachment:Nd,deleteAssetProcedureStepFieldValuesAttachments:As}=ys.actions,Hd=t=>t.assetProcedureStepFieldValuesAttachmentReducer.instances,fs=u.createSelector([Hd],t=>Object.values(t)),Wd=t=>s=>s.assetProcedureStepFieldValuesAttachmentReducer.instances[t],Kd=f(u.createSelector([fs,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),Yd=f(u.createSelector([fs,(t,s)=>s],(t,s)=>S(t.filter(e=>e.field_values===s)))),Zd=ys.reducer,X=P(t=>t.uuid),Jd={instances:{}},Ss=u.createSlice({name:"assetProcedureStepFieldValues",initialState:Jd,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,Jd)),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:Xd,addAssetProcedureStepFieldValues:Qd,addAssetProcedureStepFieldValuesMany:xd,setAssetProcedureStepFieldValues:er,setAssetProcedureStepFieldValuesMany:tr,updateAssetProcedureStepFieldValues:sr,updateAssetProcedureStepFieldValuesMany:ir,deleteAssetProcedureStepFieldValues:ar,deleteAssetProcedureStepFieldValuesMany:nr}=Ss.actions,cr=t=>t.assetProcedureStepFieldValuesReducer.instances,ct=u.createSelector([cr],t=>Object.values(t)),IF=f(u.createSelector([ct,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset===s)))),OF=f(u.createSelector([ct,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_procedure===s)))),FF=f(u.createSelector([ct,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_procedure_step===s)))),dr=t=>s=>s.assetProcedureStepFieldValuesReducer.instances[t],rr=f(u.createSelector([ct,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),ur=Ss.reducer,Q=P(t=>t.uuid),lr={instances:{}},Ts=u.createSlice({name:"assetProcedureSteps",initialState:lr,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,lr)),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:or,setAssetProcedureStep:hr,setAssetProcedureSteps:mr,addAssetProcedureStep:yr,addAssetProcedureSteps:pr,updateAssetProcedureStep:Ar,updateAssetProcedureSteps:fr,deleteAssetProcedureStep:Sr,deleteAssetProcedureSteps:Tr}=Ts.actions,Ir=Ts.reducer,ft=t=>t.assetProcedureStepReducer.instances,Or=t=>s=>s.assetProcedureStepReducer.instances[t],Is=u.createSelector([ft],t=>Object.values(t)),PF=f(u.createSelector([ft,(t,s)=>s],(t,s)=>{const e={};for(const[a,n]of Object.entries(t))n.asset_procedure_type===s&&(e[a]=n);return ht(e)})),gF=f(u.createSelector([Is,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_procedure_type===s)))),Fr=f(u.createSelector([Is,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),Pr=f(u.createSelector([ft,(t,s)=>s],(t,s)=>{if(!t[s])return S([]);const n=Qa(s,Object.values(t)).all().map(({model:c})=>c);return S(n)})),x=P(t=>t.uuid),gr={instances:{}},Os=u.createSlice({name:"assets",initialState:gr,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,gr)),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:br,addAsset:_r,addAssets:Fs,updateAsset:Mr,updateAssets:Rr,deleteAsset:wr,deleteAssets:Ps,setAsset:vr,setAssets:Er}=Os.actions,Vr=t=>t.assetReducer.instances,gs=u.createSelector([Vr],t=>S(Object.values(t))),bs=f(u.createSelector([gs,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_type===s)))),zr=t=>s=>s.assetReducer.instances[t],Br=f(u.createSelector([gs,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),bF=t=>s=>bs(t)(s).length,jr=Os.reducer,ee=P(t=>t.uuid),qr={instances:{}},_s=u.createSlice({name:"assetStageCompletions",initialState:qr,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,qr)),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:$r,addAssetStageCompletion:Dr,addAssetStageCompletions:Ur,setAssetStageCompletion:Cr,setAssetStageCompletions:Lr,updateAssetStageCompletion:Gr,updateAssetStageCompletions:kr,deleteAssetStageCompletion:Nr,deleteAssetStageCompletions:Hr}=_s.actions,Wr=_s.reducer,Kr=t=>t.assetStageCompletionReducer.instances,Yr=u.createSelector([Kr],t=>Object.values(t)),Zr=t=>s=>s.assetStageCompletionReducer.instances[t],Jr=f(u.createSelector([Yr,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),te=P(t=>t.uuid),Xr={instances:{}},Ms=u.createSlice({name:"assetStages",initialState:Xr,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,Xr)),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:Qr,setAssetStage:xr,setAssetStages:eu,addAssetStage:tu,addAssetStages:su,updateAssetStage:iu,updateAssetStages:au,deleteAssetStage:nu,deleteAssetStages:cu}=Ms.actions,du=Ms.reducer,Rs=t=>t.assetStageReducer.instances,ru=t=>s=>s.assetStageReducer.instances[t],ws=u.createSelector([Rs],t=>Object.values(t)),_F=f(u.createSelector([Rs,(t,s)=>s],(t,s)=>{const e={};for(const[a,n]of Object.entries(t))n.asset_procedure_type===s&&(e[a]=n);return ht(e)})),MF=f(u.createSelector([ws,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_procedure_type===s)))),uu=f(u.createSelector([ws,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),se=P(t=>t.uuid),lu={instances:{}},vs=u.createSlice({name:"assetTypeAttachments",initialState:lu,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,lu)),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:ou,addAssetTypeAttachment:hu,addAssetTypeAttachments:Es,setAssetTypeAttachment:mu,setAssetTypeAttachments:yu,updateAssetTypeAttachment:pu,updateAssetTypeAttachments:Au,deleteAssetTypeAttachment:fu,deleteAssetTypeAttachments:Vs}=vs.actions,Su=t=>t.assetTypeAttachmentReducer.instances,zs=u.createSelector([Su],t=>Object.values(t)),Tu=t=>s=>s.assetTypeAttachmentReducer.instances[t],Iu=f(u.createSelector([zs,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),Ou=f(u.createSelector([zs,(t,s)=>s],(t,s)=>S(t.filter(({asset_type:e})=>s===e)))),Fu=vs.reducer,ie=P(t=>t.uuid),Pu={instances:{}},Bs=u.createSlice({name:"assetTypeFieldsAttachments",initialState:Pu,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,Pu)),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:gu,addAssetTypeFieldsAttachment:bu,addAssetTypeFieldsAttachments:_u,setAssetTypeFieldsAttachment:Mu,setAssetTypeFieldsAttachments:Ru,updateAssetTypeFieldsAttachment:wu,updateAssetTypeFieldsAttachments:vu,deleteAssetTypeFieldsAttachment:Eu,deleteAssetTypeFieldsAttachments:Vu}=Bs.actions,zu=t=>t.assetTypeFieldsAttachmentReducer.instances,js=u.createSelector([zu],t=>Object.values(t)),RF=f(u.createSelector([js,(t,s)=>s],(t,s)=>S(t.filter(e=>e.fields_revision===s)))),Bu=t=>s=>s.assetTypeFieldsAttachmentReducer.instances[t],ju=f(u.createSelector([js,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),qu=Bs.reducer,ae=P(t=>t.uuid),$u={instances:{}},qs=u.createSlice({name:"assetTypeFields",initialState:$u,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,$u)),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:Du,addAssetTypeFields:Uu,addAssetTypeFieldsMany:Cu,setAssetTypeFields:Lu,setAssetTypeFieldsMany:Gu,updateAssetTypeFields:ku,updateAssetTypeFieldsMany:Nu,deleteAssetTypeFields:Hu,deleteAssetTypeFieldsMany:Wu}=qs.actions,Ku=t=>t.assetTypeFieldsReducer.instances,dt=u.createSelector([Ku],t=>Object.values(t)),wF=f(u.createSelector([dt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_type===s)))),vF=f(u.createSelector([dt,(t,s)=>s],(t,s)=>t.filter(e=>e.asset_type===s).sort((e,a)=>e.submitted_at>a.submitted_at?-1:1)[0])),Yu=t=>s=>s.assetTypeFieldsReducer.instances[t],Zu=f(u.createSelector([dt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),Ju=qs.reducer,ne=P(t=>t.uuid),Xu={instances:{}},$s=u.createSlice({name:"assetTypeFieldValuesAttachments",initialState:Xu,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,Xu)),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:Qu,addAssetTypeFieldValuesAttachment:xu,addAssetTypeFieldValuesAttachments:Ds,setAssetTypeFieldValuesAttachment:el,setAssetTypeFieldValuesAttachments:tl,updateAssetTypeFieldValuesAttachment:sl,updateAssetTypeFieldValuesAttachments:il,deleteAssetTypeFieldValuesAttachment:al,deleteAssetTypeFieldValuesAttachments:Us}=$s.actions,nl=t=>t.assetTypeFieldValuesAttachmentReducer.instances,Cs=u.createSelector([nl],t=>Object.values(t)),cl=t=>s=>s.assetTypeFieldValuesAttachmentReducer.instances[t],dl=f(u.createSelector([Cs,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),rl=f(u.createSelector([Cs,(t,s)=>s],(t,s)=>S(t.filter(e=>e.field_values===s)))),ul=$s.reducer,ce=P(t=>t.uuid),ll={instances:{}},Ls=u.createSlice({name:"assetTypeFieldValues",initialState:ll,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,ll)),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:ol,addAssetTypeFieldValues:hl,addAssetTypeFieldValuesMany:ml,setAssetTypeFieldValues:yl,setAssetTypeFieldValuesMany:pl,updateAssetTypeFieldValues:Al,updateAssetTypeFieldValuesMany:fl,deleteAssetTypeFieldValues:Sl,deleteAssetTypeFieldValuesMany:Tl}=Ls.actions,Il=t=>t.assetTypeFieldValuesReducer.instances,St=u.createSelector([Il],t=>Object.values(t)),EF=f(u.createSelector([St,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset===s)))),VF=f(u.createSelector([dt,St,(t,s)=>s],(t,s,e)=>{const a=new Set(t.filter(n=>n.asset_type===e).map(n=>n.uuid));return S(s.filter(n=>a.has(n.fields_revision)))})),Ol=t=>s=>s.assetTypeFieldValuesReducer.instances[t],Fl=f(u.createSelector([St,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),Pl=Ls.reducer,de=P(t=>t.uuid),gl={instances:{}},Gs=u.createSlice({name:"assetTypeIdentifiers",initialState:gl,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,gl)),reducers:{initializeAssetTypeIdentifiers:de.initialize,addAssetTypeIdentifier:de.addOne,addAssetTypeIdentifiers:de.addMany,setAssetTypeIdentifier:de.setOne,setAssetTypeIdentifiers:de.setMany,updateAssetTypeIdentifier:de.updateOne,updateAssetTypeIdentifiers:de.updateMany,deleteAssetTypeIdentifier:de.deleteOne,deleteAssetTypeIdentifiers:de.deleteMany}}),{initializeAssetTypeIdentifiers:bl,addAssetTypeIdentifier:_l,addAssetTypeIdentifiers:Ml,setAssetTypeIdentifier:Rl,setAssetTypeIdentifiers:wl,updateAssetTypeIdentifier:vl,updateAssetTypeIdentifiers:El,deleteAssetTypeIdentifier:Vl,deleteAssetTypeIdentifiers:zl}=Gs.actions,Bl=t=>t.assetTypeIdentifierReducer.instances,ks=u.createSelector([Bl],t=>Object.values(t)),jl=t=>s=>s.assetTypeIdentifierReducer.instances[t],ql=f(u.createSelector([ks,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),zF=f(u.createSelector([ks,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_type===s)))),$l=Gs.reducer,re=P(t=>t.uuid),Dl={instances:{}},Ns=u.createSlice({name:"assetTypeIdentifierValues",initialState:Dl,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,Dl)),reducers:{initializeAssetTypeIdentifierValues:re.initialize,addAssetTypeIdentifierValue:re.addOne,addAssetTypeIdentifierValues:re.addMany,setAssetTypeIdentifierValue:re.setOne,setAssetTypeIdentifierValues:re.setMany,updateAssetTypeIdentifierValue:re.updateOne,updateAssetTypeIdentifierValues:re.updateMany,deleteAssetTypeIdentifierValue:re.deleteOne,deleteAssetTypeIdentifierValues:re.deleteMany}}),{initializeAssetTypeIdentifierValues:Ul,addAssetTypeIdentifierValue:Cl,addAssetTypeIdentifierValues:Ll,setAssetTypeIdentifierValue:Gl,setAssetTypeIdentifierValues:kl,updateAssetTypeIdentifierValue:Nl,updateAssetTypeIdentifierValues:Hl,deleteAssetTypeIdentifierValue:Wl,deleteAssetTypeIdentifierValues:Kl}=Ns.actions,Yl=t=>t.assetTypeIdentifierValueReducer.instances,Tt=u.createSelector([Yl],t=>Object.values(t)),Zl=t=>s=>s.assetTypeIdentifierValueReducer.instances[t],Jl=f(u.createSelector([Tt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),BF=f(u.createSelector([Tt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset===s)))),jF=f(u.createSelector([Tt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_type_identifier===s)))),Xl=Ns.reducer,ue=P(t=>t.uuid),Ql={instances:{}},Hs=u.createSlice({name:"assetTypes",initialState:Ql,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,Ql)),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:xl,setAssetType:eo,setAssetTypes:to,addAssetType:so,addAssetTypes:io,updateAssetType:ao,updateAssetTypes:no,deleteAssetType:co,deleteAssetTypes:ro}=Hs.actions,uo=t=>t.assetTypeReducer.instances,Ws=u.createSelector([uo],t=>Object.values(t)),lo=t=>s=>s.assetTypeReducer.instances[t],oo=f(u.createSelector([Ws,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),qF=f(u.createSelector([Ws,(t,s)=>s],(t,s)=>S(t.filter(e=>e.organization===s)))),ho=Hs.reducer,le=P(t=>t.uuid),mo={instances:{}},Ks=u.createSlice({name:"assetTypeStatuses",initialState:mo,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,mo)),reducers:{initializeAssetTypeStatuses:le.initialize,addAssetTypeStatus:le.addOne,addAssetTypeStatuses:le.addMany,setAssetTypeStatus:le.setOne,setAssetTypeStatuses:le.setMany,updateAssetTypeStatus:le.updateOne,updateAssetTypeStatuses:le.updateMany,deleteAssetTypeStatus:le.deleteOne,deleteAssetTypeStatuses:le.deleteMany}}),{initializeAssetTypeStatuses:yo,addAssetTypeStatus:po,addAssetTypeStatuses:Ao,setAssetTypeStatus:fo,setAssetTypeStatuses:So,updateAssetTypeStatus:To,updateAssetTypeStatuses:Io,deleteAssetTypeStatus:Oo,deleteAssetTypeStatuses:Fo}=Ks.actions,Po=t=>t.assetTypeStatusReducer.instances,Ys=u.createSelector([Po],t=>S(Object.values(t).toSorted(xa))),go=t=>s=>s.assetTypeStatusReducer.instances[t],bo=f(u.createSelector([Ys,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),$F=f(u.createSelector([Ys,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_type===s)))),_o=Ks.reducer,Mo={accessToken:"",refreshToken:"",isLoggedIn:!1},It=u.createSlice({name:"auth",initialState:Mo,extraReducers:t=>t.addCase(O,s=>Object.assign(s,Mo)),reducers:{setTokens:(t,s)=>{t.accessToken=s.payload.accessToken,t.refreshToken=s.payload.refreshToken},clearTokens:t=>{t.accessToken="",t.refreshToken=""},setLoggedIn:(t,s)=>{s.payload||It.caseReducers.clearTokens(t),t.isLoggedIn=s.payload}}}),{setTokens:DF,clearTokens:UF,setLoggedIn:Ro}=It.actions,CF=t=>t.authReducer.accessToken,LF=t=>t.authReducer.isLoggedIn,wo=It.reducer,oe=P(t=>t.uuid),vo={instances:{}},Zs=u.createSlice({name:"categories",initialState:vo,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,vo)),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:Eo,addCategory:Vo,addCategories:zo,setCategory:Bo,setCategories:jo,updateCategory:qo,updateCategories:$o,deleteCategory:Do,deleteCategories:Uo}=Zs.actions,Co=t=>t.categoryReducer.instances,Js=u.createSelector([Co],t=>Object.values(t)),Xs=t=>s=>s.categoryReducer.instances[t],Lo=f(u.createSelector([Js,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),GF=f(u.createSelector([Js,(t,s)=>s],(t,s)=>S(t.filter(e=>e.project===s)))),Go=Zs.reducer,he=P(t=>t.uuid),ko={instances:{}},Qs=u.createSlice({name:"documentAttachments",initialState:ko,extraReducers:t=>t.addCase(O,s=>Object.assign(s,ko)),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:No,addDocumentAttachment:Ho,addDocumentAttachments:Wo,setDocumentAttachment:Ko,setDocumentAttachments:Yo,updateDocumentAttachment:Zo,updateDocumentAttachments:Jo,deleteDocumentAttachment:Xo,deleteDocumentAttachments:Qo}=Qs.actions,xo=t=>t.documentAttachmentReducer.instances,xs=u.createSelector([xo],t=>Object.values(t)),eh=t=>s=>s.documentAttachmentReducer.instances[t],th=f(u.createSelector([xs,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),kF=f(u.createSelector([xs,(t,s)=>s],(t,s)=>S(t.filter(({document:e})=>s===e)))),sh=Qs.reducer,me=P(({uuid:t})=>t),ih={instances:{}},ei=u.createSlice({name:"documents",initialState:ih,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>{Object.assign(s,ih)}),reducers:{initializeDocuments:me.initialize,addDocument:me.addOne,addDocuments:me.addMany,setDocument:me.setOne,setDocuments:me.setMany,updateDocument:me.updateOne,updateDocuments:me.updateMany,deleteDocument:me.deleteOne,deleteDocuments:me.deleteMany}}),{initializeDocuments:ah,addDocument:nh,addDocuments:ch,setDocument:dh,setDocuments:rh,updateDocument:uh,updateDocuments:lh,deleteDocument:oh,deleteDocuments:hh}=ei.actions,mh=t=>t.documentsReducer.instances,Ot=u.createSelector([mh],t=>Object.values(t)),yh=t=>s=>s.documentsReducer.instances[t],ph=f(u.createSelector([Ot,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),NF=f(u.createSelector([Ot,(t,s)=>s],(t,s)=>t.filter(e=>e.project===s))),HF=f(u.createSelector([Ot,(t,s)=>s],(t,s)=>t.filter(e=>e.organization===s))),Ah=ei.reducer,ye=P(t=>t.uuid),fh={instances:{}},ti=u.createSlice({name:"emailDomains",initialState:fh,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,fh)),reducers:{initializeEmailDomains:ye.initialize,addEmailDomain:ye.addOne,addEmailDomains:ye.addMany,setEmailDomain:ye.setOne,setEmailDomains:ye.setMany,updateEmailDomain:ye.updateOne,updateEmailDomains:ye.updateMany,deleteEmailDomain:ye.deleteOne,deleteEmailDomains:ye.deleteMany}}),{initializeEmailDomains:Sh,addEmailDomain:Th,addEmailDomains:Ih,setEmailDomain:Oh,setEmailDomains:Fh,updateEmailDomain:Ph,updateEmailDomains:gh,deleteEmailDomain:bh,deleteEmailDomains:_h}=ti.actions,Mh=t=>t.emailDomainsReducer.instances,si=u.createSelector([Mh],t=>Object.values(t)),Rh=t=>s=>s.emailDomainsReducer.instances[t],wh=f(u.createSelector([si,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),WF=f(u.createSelector([si,(t,s)=>s],(t,s)=>S(t.filter(e=>e.organization===s)))),vh=ti.reducer,Eh={s3Urls:{}},Vh=1e3*60*60,KF=Vh*24*7,ii=u.createSlice({name:"file",initialState:Eh,extraReducers:t=>t.addCase(O,s=>Object.assign(s,Eh)),reducers:{setUploadUrl:(t,s)=>{const{url:e,fields:a,sha1:n}=s.payload,c=new Date,d=new Date(c.getTime()+KF);t.s3Urls[n]={url:e,fields:a,exp:d.getTime()}}}}),{setUploadUrl:zh}=ii.actions,Bh=t=>s=>{const e=s.fileReducer.s3Urls[t];if(!e)return;const a=new Date().getTime();if(!((e.exp??a)-a<Vh))return e},jh=ii.reducer,pe=P(t=>t.uuid),qh={instances:{}},ai=u.createSlice({name:"formIdentifiers",initialState:qh,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,qh)),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:$h,addFormIdentifier:Dh,addFormIdentifiers:Uh,setFormIdentifier:Ch,setFormIdentifiers:Lh,updateFormIdentifier:Gh,updateFormIdentifiers:kh,deleteFormIdentifier:Nh,deleteFormIdentifiers:Hh}=ai.actions,Wh=t=>t.formIdentifierReducer.instances,ni=u.createSelector([Wh],t=>Object.values(t)),Kh=t=>s=>s.formIdentifierReducer.instances[t],Yh=f(u.createSelector([ni,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),YF=f(u.createSelector([ni,(t,s)=>s],(t,s)=>S(t.filter(e=>e.form===s)))),Zh=ai.reducer,Ae=P(t=>t.uuid),Jh={instances:{}},ci=u.createSlice({name:"formIdentifierValues",initialState:Jh,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,Jh)),reducers:{initializeFormIdentifierValues:Ae.initialize,addFormIdentifierValue:Ae.addOne,addFormIdentifierValues:Ae.addMany,setFormIdentifierValue:Ae.setOne,setFormIdentifierValues:Ae.setMany,updateFormIdentifierValue:Ae.updateOne,updateFormIdentifierValues:Ae.updateMany,deleteFormIdentifierValue:Ae.deleteOne,deleteFormIdentifierValues:Ae.deleteMany}}),{initializeFormIdentifierValues:Xh,addFormIdentifierValue:Qh,addFormIdentifierValues:xh,setFormIdentifierValue:em,setFormIdentifierValues:tm,updateFormIdentifierValue:sm,updateFormIdentifierValues:im,deleteFormIdentifierValue:am,deleteFormIdentifierValues:nm}=ci.actions,cm=t=>t.formIdentifierValueReducer.instances,Ft=u.createSelector([cm],t=>Object.values(t)),dm=t=>s=>s.formIdentifierValueReducer.instances[t],rm=f(u.createSelector([Ft,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),ZF=f(u.createSelector([Ft,(t,s)=>s],(t,s)=>S(t.filter(e=>e.form_submission===s)))),JF=f(u.createSelector([Ft,(t,s)=>s],(t,s)=>S(t.filter(e=>e.form_identifier===s)))),um=ci.reducer,fe=P(t=>t.uuid),lm={instances:{}},di=u.createSlice({name:"formRevisionAttachments",initialState:lm,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,lm)),reducers:{initializeFormRevisionAttachments:fe.initialize,addFormRevisionAttachment:fe.addOne,addFormRevisionAttachments:fe.addMany,setFormRevisionAttachment:fe.setOne,setFormRevisionAttachments:fe.setMany,updateFormRevisionAttachment:fe.updateOne,updateFormRevisionAttachments:fe.updateMany,deleteFormRevisionAttachment:fe.deleteOne,deleteFormRevisionAttachments:fe.deleteMany}}),{initializeFormRevisionAttachments:om,addFormRevisionAttachment:hm,addFormRevisionAttachments:mm,setFormRevisionAttachment:ym,setFormRevisionAttachments:pm,updateFormRevisionAttachment:Am,updateFormRevisionAttachments:fm,deleteFormRevisionAttachment:Sm,deleteFormRevisionAttachments:Tm}=di.actions,Pt=t=>t.formRevisionAttachmentReducer.instances,Im=u.createSelector([Pt],t=>Object.values(t)),Om=f(u.createSelector([Pt,(t,s)=>s],(t,s)=>t[s])),Fm=f(u.createSelector([Im,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),XF=f(u.createSelector([Pt,(t,s)=>s],(t,s)=>S(Object.values(t).filter(e=>e.form_revision===s)))),Pm=di.reducer,Se=P(t=>t.uuid),gm={instances:{}},ri=u.createSlice({name:"formRevisions",initialState:gm,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,gm)),reducers:{initializeFormRevisions:Se.initialize,addFormRevision:Se.addOne,addFormRevisions:Se.addMany,setFormRevision:Se.setOne,setFormRevisions:Se.setMany,updateFormRevision:Se.updateOne,updateFormRevisions:Se.updateMany,deleteFormRevision:Se.deleteOne,deleteFormRevisions:Se.deleteMany}}),{initializeFormRevisions:bm,addFormRevision:ui,addFormRevisions:li,setFormRevision:_m,setFormRevisions:Mm,updateFormRevision:Rm,updateFormRevisions:wm,deleteFormRevision:oi,deleteFormRevisions:hi}=ri.actions,mi=t=>t.formRevisionReducer.instances,gt=u.createSelector([mi],t=>Object.values(t)),vm=t=>s=>s.formRevisionReducer.instances[t],Em=f(u.createSelector([gt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),QF=f(u.createSelector([gt,(t,s)=>s],(t,s)=>t.filter(e=>e.form===s).sort((e,a)=>e.submitted_at>a.submitted_at?-1:1)[0])),Vm=f(u.createSelector([gt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.form===s)))),zm=ri.reducer,Te=P(t=>t.uuid),Bm={instances:{}},yi=u.createSlice({name:"forms",initialState:Bm,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,Bm)),reducers:{initializeForms:Te.initialize,addForm:Te.addOne,addForms:Te.addMany,setForm:Te.setOne,setForms:Te.setMany,updateForm:Te.updateOne,updateForms:Te.updateMany,deleteForm:Te.deleteOne,deleteForms:Te.deleteMany}}),{initializeForms:jm,addForm:qm,addForms:$m,setForm:Dm,setForms:Um,updateForm:Cm,updateForms:Lm,deleteForm:Gm,deleteForms:km}=yi.actions,Nm=yi.reducer,Hm=t=>t.formReducer.instances,pi=u.createSelector([Hm],t=>Object.values(t)),Wm=t=>s=>s.formReducer.instances[t],Km=f(u.createSelector([pi,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),xF=f(u.createSelector([pi,(t,s)=>s],(t,s)=>S(t.filter(e=>e.organization===s)))),Ie=P(t=>t.uuid),Ym={instances:{}},Ai=u.createSlice({name:"formSubmissionAttachments",initialState:Ym,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,Ym)),reducers:{initializeFormSubmissionAttachments:Ie.initialize,addFormSubmissionAttachment:Ie.addOne,addFormSubmissionAttachments:Ie.addMany,setFormSubmissionAttachment:Ie.setOne,setFormSubmissionAttachments:Ie.setMany,updateFormSubmissionAttachment:Ie.updateOne,updateFormSubmissionAttachments:Ie.updateMany,deleteFormSubmissionAttachment:Ie.deleteOne,deleteFormSubmissionAttachments:Ie.deleteMany}}),{initializeFormSubmissionAttachments:Zm,addFormSubmissionAttachment:Jm,addFormSubmissionAttachments:fi,setFormSubmissionAttachment:Xm,setFormSubmissionAttachments:Qm,updateFormSubmissionAttachment:xm,updateFormSubmissionAttachments:ey,deleteFormSubmissionAttachment:ty,deleteFormSubmissionAttachments:Si}=Ai.actions,Ti=t=>t.formSubmissionAttachmentReducer.instances,Ii=u.createSelector([Ti],t=>Object.values(t)),sy=f(u.createSelector([Ti,(t,s)=>s],(t,s)=>t[s])),Oi=f(u.createSelector([Ii,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(a=>e.has(a.uuid)))})),iy=Oi,ay=f(u.createSelector([Ii,(t,s)=>s],(t,s)=>S(t.filter(e=>e.form_submission===s)))),ny=Ai.reducer,Oe=P(t=>t.uuid),cy={instances:{}},Fi=u.createSlice({name:"formSubmissions",initialState:cy,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,cy)),reducers:{initializeFormSubmissions:Oe.initialize,setFormSubmission:Oe.setOne,setFormSubmissions:Oe.setMany,addFormSubmission:Oe.addOne,addFormSubmissions:Oe.addMany,updateFormSubmission:Oe.updateOne,updateFormSubmissions:Oe.updateMany,deleteFormSubmission:Oe.deleteOne,deleteFormSubmissions:Oe.deleteMany}}),{initializeFormSubmissions:dy,setFormSubmission:ry,setFormSubmissions:uy,addFormSubmission:ly,addFormSubmissions:Pi,updateFormSubmission:oy,updateFormSubmissions:hy,deleteFormSubmission:my,deleteFormSubmissions:gi}=Fi.actions,bi=t=>t.formSubmissionReducer.instances,yy=u.createSelector([bi],t=>Object.values(t)),py=t=>s=>s.formSubmissionReducer.instances[t],Ay=f(u.createSelector([yy,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),fy=f(u.createSelector([bi,mi,(t,s)=>s],(t,s,e)=>{const a=new Set;for(const n of Object.values(s))n.form===e&&a.add(n.uuid);return Object.values(t).filter(n=>a.has(n.form_revision))})),Sy=Fi.reducer,Fe=P(t=>t.uuid),Ty={instances:{}},_i=u.createSlice({name:"geoImages",initialState:Ty,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,Ty)),reducers:{initializeGeoImages:Fe.initialize,setGeoImage:Fe.setOne,setGeoImages:Fe.setMany,addGeoImage:Fe.addOne,addGeoImages:Fe.addMany,updateGeoImage:Fe.updateOne,updateGeoImages:Fe.updateMany,deleteGeoImage:Fe.deleteOne,deleteGeoImages:Fe.deleteMany}}),{initializeGeoImages:Iy,setGeoImage:Oy,setGeoImages:Fy,addGeoImage:Py,addGeoImages:gy,updateGeoImage:by,updateGeoImages:_y,deleteGeoImage:My,deleteGeoImages:Ry}=_i.actions,wy=t=>t.geoImageReducer.instances,Mi=u.createSelector([wy],t=>Object.values(t)),vy=t=>s=>s.geoImageReducer.instances[t],Ey=f(u.createSelector([Mi,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),eP=f(u.createSelector([Mi,(t,s)=>s],(t,s)=>S(t.filter(e=>e.project===s)))),Vy=_i.reducer,Pe=P(t=>t.uuid),zy={instances:{}},Ri=u.createSlice({name:"issueAssociations",initialState:zy,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,zy)),reducers:{initializeIssueAssociations:Pe.initialize,addIssueAssociation:Pe.addOne,addIssueAssociations:Pe.addMany,setIssueAssociation:Pe.setOne,setIssueAssociations:Pe.setMany,updateIssueAssociation:Pe.updateOne,updateIssueAssociations:Pe.updateMany,deleteIssueAssociation:Pe.deleteOne,deleteIssueAssociations:Pe.deleteMany}}),{initializeIssueAssociations:By,setIssueAssociations:jy,setIssueAssociation:qy,updateIssueAssociation:$y,updateIssueAssociations:Dy,addIssueAssociation:Uy,addIssueAssociations:bt,deleteIssueAssociation:Cy,deleteIssueAssociations:_t}=Ri.actions,rt=t=>t.issueAssociationReducer.instances,Ly=u.createSelector([rt],t=>Object.values(t)),Gy=t=>s=>s.issueAssociationReducer.instances[t],ky=f(u.createSelector([Ly,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),Ny=f(u.createSelector([rt,(t,s)=>s],(t,s)=>S(Object.values(t).filter(e=>e.associated_issue===s)))),Hy=f(u.createSelector([rt,(t,s)=>s],(t,s)=>S(Object.values(t).filter(e=>e.issue===s)))),Wy=f(u.createSelector([rt,(t,s)=>s],(t,s)=>S(Object.values(t).filter(e=>e.asset===s)))),Ky=Ri.reducer,ge=P(t=>t.uuid),Yy={instances:{}},wi=u.createSlice({name:"issueAttachments",initialState:Yy,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,Yy)),reducers:{initializeIssueAttachments:ge.initialize,addIssueAttachment:ge.addOne,addIssueAttachments:ge.addMany,setIssueAttachment:ge.setOne,setIssueAttachments:ge.setMany,updateIssueAttachment:ge.updateOne,updateIssueAttachments:ge.updateMany,deleteIssueAttachment:ge.deleteOne,deleteIssueAttachments:ge.deleteMany}}),{initializeIssueAttachments:Zy,addIssueAttachment:Jy,addIssueAttachments:vi,setIssueAttachment:Xy,setIssueAttachments:Qy,updateIssueAttachment:xy,updateIssueAttachments:ep,deleteIssueAttachment:tp,deleteIssueAttachments:Ei}=wi.actions,sp=t=>t.issueAttachmentReducer.instances,Vi=u.createSelector([sp],t=>Object.values(t)),ip=f(u.createSelector([Vi,(t,s)=>s],(t,s)=>S(t.filter(({issue:e})=>s===e)))),ap=t=>s=>s.issueAttachmentReducer.instances[t],np=f(u.createSelector([Vi,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),cp=wi.reducer,be=P(t=>t.uuid),dp={instances:{}},zi=u.createSlice({name:"issueCommentAttachments",initialState:dp,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,dp)),reducers:{initializeIssueCommentAttachments:be.initialize,addIssueCommentAttachment:be.addOne,addIssueCommentAttachments:be.addMany,setIssueCommentAttachment:be.setOne,setIssueCommentAttachments:be.setMany,updateIssueCommentAttachment:be.updateOne,updateIssueCommentAttachments:be.updateMany,deleteIssueCommentAttachment:be.deleteOne,deleteIssueCommentAttachments:be.deleteMany}}),{initializeIssueCommentAttachments:rp,addIssueCommentAttachment:up,addIssueCommentAttachments:lp,setIssueCommentAttachment:op,setIssueCommentAttachments:hp,updateIssueCommentAttachment:mp,updateIssueCommentAttachments:yp,deleteIssueCommentAttachment:pp,deleteIssueCommentAttachments:Ap}=zi.actions,fp=t=>t.issueCommentAttachmentReducer.instances,Bi=u.createSelector([fp],t=>Object.values(t)),Sp=t=>s=>s.issueCommentAttachmentReducer.instances[t],Tp=f(u.createSelector([Bi,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),tP=f(u.createSelector([Bi,(t,s)=>s],(t,s)=>S(t.filter(({issue_comment:e})=>s===e)))),Ip=zi.reducer,_e=P(t=>t.uuid),Op={instances:{}},ji=u.createSlice({name:"issueComments",initialState:Op,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,Op)),reducers:{initializeIssueComments:_e.initialize,addIssueComment:_e.addOne,addIssueComments:_e.addMany,setIssueComment:_e.setOne,setIssueComments:_e.setMany,updateIssueComment:_e.updateOne,updateIssueComments:_e.updateMany,deleteIssueComment:_e.deleteOne,deleteIssueComments:_e.deleteMany}}),{initializeIssueComments:Fp,addIssueComment:Pp,addIssueComments:gp,setIssueComment:bp,setIssueComments:_p,updateIssueComment:Mp,updateIssueComments:Rp,deleteIssueComment:wp,deleteIssueComments:vp}=ji.actions,qi=t=>t.issueCommentReducer.instances,Ep=t=>s=>s.issueCommentReducer.instances[t],Vp=f(u.createSelector([qi,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(Object.values(t).filter(({uuid:a})=>e.has(a)))})),sP=f(u.createSelector([qi,(t,s)=>s],(t,s)=>S(Object.values(t).filter(e=>e.issue===s)))),zp=ji.reducer,Me=P(t=>t.uuid),Bp={instances:{}},$i=u.createSlice({name:"issues",initialState:Bp,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,Bp)),reducers:{initializeIssues:Me.initialize,addIssue:Me.addOne,addIssues:Me.addMany,setIssue:Me.setOne,setIssues:Me.setMany,updateIssue:Me.updateOne,updateIssues:Me.updateMany,deleteIssue:Me.deleteOne,deleteIssues:Me.deleteMany}}),{initializeIssues:jp,addIssue:qp,addIssues:Di,setIssue:$p,setIssues:Dp,updateIssue:Up,updateIssues:Cp,deleteIssue:Lp,deleteIssues:Ui}=$i.actions,Gp=t=>t.issueReducer.instances,Mt=u.createSelector([Gp],t=>Object.values(t)),kp=t=>s=>s.issueReducer.instances[t],Np=f(u.createSelector([Mt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),iP=f(u.createSelector([Mt,(t,s)=>s],(t,s)=>t.filter(e=>e.project===s))),Hp=f(u.createSelector([Mt,(t,s)=>s],(t,s)=>t.filter(e=>e.issue_type===s))),Wp=$i.reducer,Re=P(t=>t.uuid),Kp={instances:{}},Ci=u.createSlice({name:"issueTypeAttachments",initialState:Kp,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,Kp)),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:Yp,addIssueTypeAttachment:Zp,addIssueTypeAttachments:Jp,setIssueTypeAttachment:Xp,setIssueTypeAttachments:Qp,updateIssueTypeAttachment:xp,updateIssueTypeAttachments:eA,deleteIssueTypeAttachment:tA,deleteIssueTypeAttachments:sA}=Ci.actions,iA=t=>t.issueTypeAttachmentReducer.instances,Li=u.createSelector([iA],t=>Object.values(t)),aA=t=>s=>s.issueTypeAttachmentReducer.instances[t],nA=f(u.createSelector([Li,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),aP=f(u.createSelector([Li,(t,s)=>s],(t,s)=>S(t.filter(({issue_type:e})=>s===e)))),cA=Ci.reducer,we=P(t=>t.uuid),dA={instances:{}},Gi=u.createSlice({name:"issueTypeFieldsAttachments",initialState:dA,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,dA)),reducers:{initializeIssueTypeFieldsAttachments:we.initialize,addIssueTypeFieldsAttachment:we.addOne,addIssueTypeFieldsAttachments:we.addMany,setIssueTypeFieldsAttachment:we.setOne,setIssueTypeFieldsAttachments:we.setMany,updateIssueTypeFieldsAttachment:we.updateOne,updateIssueTypeFieldsAttachments:we.updateMany,deleteIssueTypeFieldsAttachment:we.deleteOne,deleteIssueTypeFieldsAttachments:we.deleteMany}}),{initializeIssueTypeFieldsAttachments:rA,addIssueTypeFieldsAttachment:uA,addIssueTypeFieldsAttachments:lA,setIssueTypeFieldsAttachment:oA,setIssueTypeFieldsAttachments:hA,updateIssueTypeFieldsAttachment:mA,updateIssueTypeFieldsAttachments:yA,deleteIssueTypeFieldsAttachment:pA,deleteIssueTypeFieldsAttachments:AA}=Gi.actions,fA=t=>t.issueTypeFieldsAttachmentReducer.instances,ki=u.createSelector([fA],t=>Object.values(t)),nP=f(u.createSelector([ki,(t,s)=>s],(t,s)=>S(t.filter(e=>e.fields_revision===s)))),SA=t=>s=>s.issueTypeFieldsAttachmentReducer.instances[t],TA=f(u.createSelector([ki,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),IA=Gi.reducer,ve=P(t=>t.uuid),OA={instances:{}},Ni=u.createSlice({name:"issueTypeFieldValues",initialState:OA,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,OA)),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:FA,addIssueTypeFieldValues:PA,addIssueTypeFieldValuesMany:gA,setIssueTypeFieldValues:bA,setIssueTypeFieldValuesMany:_A,updateIssueTypeFieldValues:MA,updateIssueTypeFieldValuesMany:RA,deleteIssueTypeFieldValues:wA,deleteIssueTypeFieldValuesMany:vA}=Ni.actions,EA=t=>t.issueTypeFieldValuesReducer.instances,Rt=u.createSelector([EA],t=>Object.values(t)),cP=f(u.createSelector([Rt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.issue===s)))),VA=t=>s=>s.issueTypeFieldValuesReducer.instances[t],zA=f(u.createSelector([Rt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),BA=Ni.reducer,Ee=P(t=>t.uuid),jA={instances:{}},Hi=u.createSlice({name:"issueTypeFields",initialState:jA,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,jA)),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:qA,addIssueTypeFields:$A,addIssueTypeFieldsMany:DA,setIssueTypeFields:UA,setIssueTypeFieldsMany:CA,updateIssueTypeFields:LA,updateIssueTypeFieldsMany:GA,deleteIssueTypeFields:kA,deleteIssueTypeFieldsMany:NA}=Hi.actions,HA=t=>t.issueTypeFieldsReducer.instances,ut=u.createSelector([HA],t=>Object.values(t)),dP=f(u.createSelector([ut,(t,s)=>s],(t,s)=>S(t.filter(e=>e.issue_type===s)))),rP=f(u.createSelector([ut,(t,s)=>s],(t,s)=>t.filter(e=>e.issue_type===s).sort((e,a)=>e.submitted_at>a.submitted_at?-1:1)[0])),uP=f(u.createSelector([ut,Rt,(t,s)=>s],(t,s,e)=>{const a=new Set(t.filter(n=>n.issue_type===e).map(n=>n.uuid));return S(s.filter(n=>a.has(n.fields_revision)))})),WA=t=>s=>s.issueTypeFieldsReducer.instances[t],KA=f(u.createSelector([ut,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),YA=Hi.reducer,Ve=P(t=>t.uuid),ZA={instances:{}},Wi=u.createSlice({name:"issueTypeFieldValuesAttachments",initialState:ZA,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,ZA)),reducers:{initializeIssueTypeFieldValuesAttachments:Ve.initialize,addIssueTypeFieldValuesAttachment:Ve.addOne,addIssueTypeFieldValuesAttachments:Ve.addMany,setIssueTypeFieldValuesAttachment:Ve.setOne,setIssueTypeFieldValuesAttachments:Ve.setMany,updateIssueTypeFieldValuesAttachment:Ve.updateOne,updateIssueTypeFieldValuesAttachments:Ve.updateMany,deleteIssueTypeFieldValuesAttachment:Ve.deleteOne,deleteIssueTypeFieldValuesAttachments:Ve.deleteMany}}),{initializeIssueTypeFieldValuesAttachments:JA,addIssueTypeFieldValuesAttachment:XA,addIssueTypeFieldValuesAttachments:Ki,setIssueTypeFieldValuesAttachment:QA,setIssueTypeFieldValuesAttachments:xA,updateIssueTypeFieldValuesAttachment:ef,updateIssueTypeFieldValuesAttachments:tf,deleteIssueTypeFieldValuesAttachment:sf,deleteIssueTypeFieldValuesAttachments:Yi}=Wi.actions,af=t=>t.issueTypeFieldValuesAttachmentReducer.instances,Zi=u.createSelector([af],t=>Object.values(t)),nf=t=>s=>s.issueTypeFieldValuesAttachmentReducer.instances[t],cf=f(u.createSelector([Zi,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),df=f(u.createSelector([Zi,(t,s)=>s],(t,s)=>S(t.filter(e=>e.field_values===s)))),rf=Wi.reducer,ze=P(t=>t.uuid),uf={instances:{}},Ji=u.createSlice({name:"issueTypeIdentifiers",initialState:uf,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,uf)),reducers:{initializeIssueTypeIdentifiers:ze.initialize,addIssueTypeIdentifier:ze.addOne,addIssueTypeIdentifiers:ze.addMany,setIssueTypeIdentifier:ze.setOne,setIssueTypeIdentifiers:ze.setMany,updateIssueTypeIdentifier:ze.updateOne,updateIssueTypeIdentifiers:ze.updateMany,deleteIssueTypeIdentifier:ze.deleteOne,deleteIssueTypeIdentifiers:ze.deleteMany}}),{initializeIssueTypeIdentifiers:lf,addIssueTypeIdentifier:of,addIssueTypeIdentifiers:hf,setIssueTypeIdentifier:mf,setIssueTypeIdentifiers:yf,updateIssueTypeIdentifier:pf,updateIssueTypeIdentifiers:Af,deleteIssueTypeIdentifier:ff,deleteIssueTypeIdentifiers:Sf}=Ji.actions,Tf=t=>t.issueTypeIdentifierReducer.instances,Xi=u.createSelector([Tf],t=>Object.values(t)),If=t=>s=>s.issueTypeIdentifierReducer.instances[t],Of=f(u.createSelector([Xi,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),lP=f(u.createSelector([Xi,(t,s)=>s],(t,s)=>S(t.filter(e=>e.issue_type===s)))),Ff=Ji.reducer,Be=P(t=>t.uuid),Pf={instances:{}},Qi=u.createSlice({name:"issueTypeIdentifierValues",initialState:Pf,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,Pf)),reducers:{initializeIssueTypeIdentifierValues:Be.initialize,addIssueTypeIdentifierValue:Be.addOne,addIssueTypeIdentifierValues:Be.addMany,setIssueTypeIdentifierValue:Be.setOne,setIssueTypeIdentifierValues:Be.setMany,updateIssueTypeIdentifierValue:Be.updateOne,updateIssueTypeIdentifierValues:Be.updateMany,deleteIssueTypeIdentifierValue:Be.deleteOne,deleteIssueTypeIdentifierValues:Be.deleteMany}}),{initializeIssueTypeIdentifierValues:gf,addIssueTypeIdentifierValue:bf,addIssueTypeIdentifierValues:_f,setIssueTypeIdentifierValue:Mf,setIssueTypeIdentifierValues:Rf,updateIssueTypeIdentifierValue:wf,updateIssueTypeIdentifierValues:vf,deleteIssueTypeIdentifierValue:Ef,deleteIssueTypeIdentifierValues:Vf}=Qi.actions,zf=t=>t.issueTypeIdentifierValueReducer.instances,wt=u.createSelector([zf],t=>Object.values(t)),Bf=t=>s=>s.issueTypeIdentifierValueReducer.instances[t],jf=f(u.createSelector([wt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),oP=f(u.createSelector([wt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.issue===s)))),hP=f(u.createSelector([wt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.issue_type_identifier===s)))),qf=Qi.reducer,je=P(t=>t.uuid),$f={instances:{}},xi=u.createSlice({name:"issueTypes",initialState:$f,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,$f)),reducers:{initializeIssueTypes:je.initialize,addIssueType:je.addOne,addIssueTypes:je.addMany,setIssueType:je.setOne,setIssueTypes:je.setMany,updateIssueType:je.updateOne,updateIssueTypes:je.updateMany,deleteIssueType:je.deleteOne,deleteIssueTypes:je.deleteMany}}),{initializeIssueTypes:Df,addIssueType:Uf,addIssueTypes:Cf,setIssueType:Lf,setIssueTypes:Gf,updateIssueType:kf,updateIssueTypes:Nf,deleteIssueType:Hf,deleteIssueTypes:Wf}=xi.actions,Kf=t=>t.issueTypeReducer.instances,ea=u.createSelector(Kf,t=>Object.values(t)),Yf=t=>s=>s.issueTypeReducer.instances[t],Zf=f(u.createSelector([ea,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),mP=f(u.createSelector([ea,(t,s)=>s],(t,s)=>S(t.filter(e=>e.organization===s)))),Jf=xi.reducer,qe=P(t=>t.uuid),Xf={instances:{}},ta=u.createSlice({name:"issueTypeStatuses",initialState:Xf,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,Xf)),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:Qf,addIssueTypeStatus:xf,addIssueTypeStatuses:eS,setIssueTypeStatus:tS,setIssueTypeStatuses:sS,updateIssueTypeStatus:iS,updateIssueTypeStatuses:aS,deleteIssueTypeStatus:nS,deleteIssueTypeStatuses:cS}=ta.actions,dS=t=>t.issueTypeStatusReducer.instances,sa=u.createSelector([dS],t=>S(Object.values(t).toSorted(en))),ia=t=>s=>s.issueTypeStatusReducer.instances[t],rS=f(u.createSelector([sa,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),yP=f(u.createSelector([sa,(t,s)=>s],(t,s)=>S(t.filter(e=>e.issue_type===s)))),uS=ta.reducer,$e=P(t=>t.uuid),lS={instances:{}},aa=u.createSlice({name:"issueUpdates",initialState:lS,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,lS)),reducers:{initializeIssueUpdates:$e.initialize,addIssueUpdate:$e.addOne,addIssueUpdates:$e.addMany,setIssueUpdate:$e.setOne,setIssueUpdates:$e.setMany,updateIssueUpdate:$e.updateOne,updateIssueUpdates:$e.updateMany,deleteIssueUpdate:$e.deleteOne,deleteIssueUpdates:$e.deleteMany}}),{initializeIssueUpdates:oS,addIssueUpdate:na,addIssueUpdates:ca,setIssueUpdate:hS,setIssueUpdates:mS,updateIssueUpdate:yS,updateIssueUpdates:pS,deleteIssueUpdate:da,deleteIssueUpdates:ra}=aa.actions,ua=t=>t.issueUpdateReducer.instances,la=u.createSelector([ua],t=>Object.values(t)),AS=f(u.createSelector([ua,(t,s)=>s],(t,s)=>t[s])),fS=f(u.createSelector([la,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),SS=f(u.createSelector([la,(t,s)=>s],(t,s)=>S(t.filter(e=>e.issue===s)))),TS=aa.reducer,De=P(t=>t.id),IS={instances:{},currentUser:null},oa=u.createSlice({name:"users",initialState:IS,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,IS)),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,s)=>{t.currentUser=s.payload},setProfilePicture:(t,s)=>{if(!t.currentUser)return;t.currentUser.profile.file=s.payload.file??null,t.currentUser.profile.file_sha1=s.payload.file_sha1??null;const e=t.instances[t.currentUser.id];if(!e)throw new Error("Unable to find current user in users slice");e.profile.file=s.payload.file??null,e.profile.file_sha1=s.payload.file_sha1??null}}}),{initializeUsers:OS,setUsers:FS,setUser:PS,addUsers:gS,addUser:ha,updateUsers:bS,updateUser:_S,deleteUser:ma,deleteUsers:MS,setCurrentUser:pP,setProfilePicture:AP}=oa.actions,RS=oa.reducer,wS=t=>t.userReducer.currentUser,ya=t=>t.userReducer.instances,vt=u.createSelector([ya],t=>Object.values(t)),Et=t=>s=>s.userReducer.instances[t],vS=f(u.createSelector([vt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({id:a})=>e.has(a)))})),Ue=P(t=>t.uuid),ES={instances:{}},pa=u.createSlice({name:"organizationAccess",initialState:ES,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,ES)),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:VS,addOrganizationAccess:zS,addOrganizationAccesses:BS,setOrganizationAccess:jS,setOrganizationAccesses:qS,updateOrganizationAccess:$S,updateOrganizationAccesses:DS,deleteOrganizationAccess:US,deleteOrganizationAccesses:CS}=pa.actions,LS=pa.reducer,Vt=t=>t.organizationAccessReducer.instances,GS=t=>s=>s.organizationAccessReducer.instances[t],kS=f(u.createSelector([Vt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(Object.values(t).filter(({uuid:a})=>e.has(a)))})),fP=u.createSelector([wS,Vt],(t,s)=>Object.values(s).find(a=>a.user===(t==null?void 0:t.id))??null),NS=u.createSelector([Vt],t=>{const s={};for(const e of Object.values(t))s[e.user]=e;return ht(s)}),SP=f(u.createSelector([ya,NS,(t,s)=>s],(t,s,e)=>S(Object.values(t).filter(a=>{const n=s[a.id];return!!n&&n.organization===e})))),Ce=P(t=>t.uuid),HS={instances:{}},Aa=u.createSlice({name:"organizations",initialState:HS,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,HS)),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:WS,setOrganizations:KS,setOrganization:YS,addOrganizations:ZS,addOrganization:JS,updateOrganizations:XS,updateOrganization:QS,deleteOrganization:xS,deleteOrganizations:eT}=Aa.actions,tT=t=>t.organizationReducer.instances,sT=u.createSelector([tT],t=>Object.values(t)),iT=t=>s=>s.organizationReducer.instances[t],aT=f(u.createSelector([sT,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),nT=Aa.reducer,cT=(t,s,e)=>{const a=t.uuid?t:{...t,uuid:xe.v4()};return{payload:a,type:"",meta:{offline:{effect:{timestamp:new Date().toISOString(),request:a,BASE_URL:s,serviceName:e}}}}},dT={deletedRequests:[],latestRetryTime:0},fa=u.createSlice({name:"outbox",initialState:dT,extraReducers:t=>t.addCase(O,s=>Object.assign(s,dT)),reducers:{enqueueRequest:{reducer:(t,s)=>t,prepare:t=>{console.debug("Preparing to enqueue request",t);const{BASE_URL:s,serviceName:e,...a}=t;return cT(a,s,e)}},markForDeletion(t,s){t.deletedRequests.push(s.payload)},markAsDeleted(t,s){const e=t.deletedRequests.indexOf(s.payload);e!==-1&&t.deletedRequests.splice(e,1)},_setLatestRetryTime:(t,s)=>{t.latestRetryTime=s.payload}}}),TP=t=>t.outboxReducer.deletedRequests,IP=t=>t.outboxReducer.latestRetryTime,{enqueueRequest:rT,markForDeletion:OP,markAsDeleted:uT,_setLatestRetryTime:lT}=fa.actions,oT=fa.reducer,Le=P(t=>t.uuid),hT={instances:{}},Sa=u.createSlice({name:"projectAccess",initialState:hT,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,hT)),reducers:{initializeProjectAccesses:Le.initialize,addProjectAccess:Le.addOne,addProjectAccesses:Le.addMany,setProjectAccess:Le.setOne,setProjectAccesses:Le.setMany,updateProjectAccess:Le.updateOne,updateProjectAccesses:Le.updateMany,deleteProjectAccess:Le.deleteOne,deleteProjectAccesses:Le.deleteMany}}),{initializeProjectAccesses:mT,addProjectAccess:yT,addProjectAccesses:pT,setProjectAccess:AT,setProjectAccesses:fT,updateProjectAccess:ST,updateProjectAccesses:TT,deleteProjectAccess:IT,deleteProjectAccesses:OT}=Sa.actions,FT=Sa.reducer,Ta=t=>t.projectAccessReducer.instances,lt=u.createSelector(Ta,t=>Object.values(t)),PT=t=>s=>s.projectAccessReducer.instances[t],gT=f(u.createSelector([lt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),FP=f(u.createSelector([Ta,(t,s)=>s],(t,s)=>S(Object.values(t).filter(e=>e.project===s)))),PP=f(u.createSelector([lt,(t,s)=>s],(t,s)=>{const e={};for(const a of t.filter(n=>n.project===s))e[a.user]=a;return e})),gP=f(u.createSelector([vt,lt,(t,s)=>s],(t,s,e)=>{const a=new Set(s.filter(n=>n.project===e).map(n=>n.user));return S(t.filter(n=>a.has(n.id)))})),Ge=P(t=>t.uuid),bT={instances:{}},Ia=u.createSlice({name:"projectAttachments",initialState:bT,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,bT)),reducers:{initializeProjectAttachments:Ge.initialize,addProjectAttachment:Ge.addOne,addProjectAttachments:Ge.addMany,setProjectAttachment:Ge.setOne,setProjectAttachments:Ge.setMany,updateProjectAttachment:Ge.updateOne,updateProjectAttachments:Ge.updateMany,deleteProjectAttachment:Ge.deleteOne,deleteProjectAttachments:Ge.deleteMany}}),{initializeProjectAttachments:_T,addProjectAttachment:MT,addProjectAttachments:RT,setProjectAttachment:wT,setProjectAttachments:vT,updateProjectAttachment:ET,updateProjectAttachments:VT,deleteProjectAttachment:zT,deleteProjectAttachments:BT}=Ia.actions,jT=t=>t.projectAttachmentReducer.instances,Oa=u.createSelector([jT],t=>Object.values(t)),qT=t=>s=>s.projectAttachmentReducer.instances[t],$T=f(u.createSelector([Oa,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),bP=f(u.createSelector([Oa,(t,s)=>s],(t,s)=>S(t.filter(({project:e})=>s===e)))),DT=Ia.reducer,ke=P(t=>t.uuid),UT={instances:{},activeProjectFileId:null,isImportingProjectFile:!1},Fa=u.createSlice({name:"projectFiles",initialState:UT,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,UT)),reducers:{initializeProjectFiles:ke.initialize,setProjectFile:ke.setOne,setProjectFiles:ke.setMany,addProjectFile:ke.addOne,addProjectFiles:ke.addMany,updateProjectFile:ke.updateOne,updateProjectFiles:ke.updateMany,deleteProjectFile:ke.deleteOne,deleteProjectFiles:ke.deleteMany,setIsImportingProjectFile:(t,s)=>{t.isImportingProjectFile=s.payload},saveActiveProjectFileBounds:(t,s)=>{const e=t.activeProjectFileId;if(!e)throw new Error("Tried to save bounds for active project file, but no active project file was set.");if(!t.instances[e])throw new Error(`Tried to save bounds for active project file, but project file with ID ${e}
2
- doesn't exist.`);t.instances[e].bounds=s.payload},setActiveProjectFileId:(t,s)=>{t.activeProjectFileId=s.payload}}}),{initializeProjectFiles:CT,setProjectFile:LT,setProjectFiles:GT,addProjectFile:kT,addProjectFiles:NT,updateProjectFile:HT,updateProjectFiles:WT,deleteProjectFile:KT,deleteProjectFiles:YT,setIsImportingProjectFile:ZT,setActiveProjectFileId:JT,saveActiveProjectFileBounds:XT}=Fa.actions,QT=t=>t.projectFileReducer.instances,xT=u.createSelector([QT],t=>S(Object.values(t).sort((s,e)=>s.z_index-e.z_index))),eI=t=>s=>s.projectFileReducer.instances[t],tI=f(u.createSelector([xT,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),_P=t=>t.projectFileReducer.activeProjectFileId,MP=t=>t.projectFileReducer.isImportingProjectFile,sI=Fa.reducer,Ne=P(t=>t.uuid),iI={instances:{}},Pa=u.createSlice({name:"projects",initialState:iI,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,iI)),reducers:{initializeProjects:Ne.initialize,setProjects:Ne.setMany,setProject:Ne.setOne,addProjects:Ne.addMany,addProject:Ne.addOne,updateProjects:Ne.updateMany,updateProject:Ne.updateOne,deleteProject:Ne.deleteOne,deleteProjects:Ne.deleteMany}}),{initializeProjects:aI,setProjects:nI,setProject:cI,addProjects:dI,addProject:rI,updateProjects:uI,updateProject:lI,deleteProject:oI,deleteProjects:hI}=Pa.actions,mI=Pa.reducer,yI=t=>t.projectReducer.instances,zt=u.createSelector([yI],t=>S(Object.values(t))),pI=t=>s=>s.projectReducer.instances[t],AI=f(u.createSelector([zt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),RP=f(u.createSelector([zt,lt,(t,s)=>s],(t,s,e)=>{const a=new Set(s.filter(n=>n.user===e).map(n=>n.project));return S(t.filter(n=>a.has(n.uuid)))})),wP=f(u.createSelector([zt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.organization===s)))),vP={isRehydrated:!1},ga=u.createSlice({name:"rehydrated",initialState:vP,reducers:{setRehydrated:(t,s)=>{t.isRehydrated=s.payload}}}),{setRehydrated:EP}=ga.actions,VP=t=>t.rehydratedReducer.isRehydrated,fI=ga.reducer,He=P(t=>t.uuid),SI={instances:{}},ba=u.createSlice({name:"teamMemberships",initialState:SI,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,SI)),reducers:{initializeTeamMemberships:He.initialize,addTeamMembership:He.addOne,addTeamMemberships:He.addMany,setTeamMembership:He.setOne,setTeamMemberships:He.setMany,updateTeamMembership:He.updateOne,updateTeamMemberships:He.updateMany,deleteTeamMembership:He.deleteOne,deleteTeamMemberships:He.deleteMany}}),{initializeTeamMemberships:TI,addTeamMembership:II,addTeamMemberships:OI,setTeamMembership:FI,setTeamMemberships:PI,updateTeamMembership:gI,updateTeamMemberships:bI,deleteTeamMembership:_I,deleteTeamMemberships:MI}=ba.actions,RI=ba.reducer,wI=t=>t.teamMembershipReducer.instances,Bt=u.createSelector([wI],t=>Object.values(t)),vI=t=>s=>s.teamMembershipReducer.instances[t],EI=f(u.createSelector([Bt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),zP=f(u.createSelector([Bt,(t,s)=>s],(t,s)=>{const e={};for(const a of t.filter(n=>n.team===s))e[a.user]=a;return e})),BP=f(u.createSelector([vt,Bt,(t,s)=>s],(t,s,e)=>{const a=new Set(s.filter(n=>n.team===e).map(n=>n.user));return S(t.filter(n=>a.has(n.id)))})),We=P(t=>t.uuid),VI={instances:{}},_a=u.createSlice({name:"teams",initialState:VI,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,VI)),reducers:{initializeTeams:We.initialize,addTeam:We.addOne,addTeams:We.addMany,setTeam:We.setOne,setTeams:We.setMany,updateTeam:We.updateOne,updateTeams:We.updateMany,deleteTeam:We.deleteOne,deleteTeams:We.deleteMany}}),{initializeTeams:zI,addTeam:BI,addTeams:jI,setTeam:qI,setTeams:$I,updateTeam:DI,updateTeams:UI,deleteTeam:CI,deleteTeams:LI}=_a.actions,GI=t=>t.teamReducer.instances,Ma=u.createSelector([GI],t=>Object.values(t)),kI=t=>s=>s.teamReducer.instances[t],NI=f(u.createSelector([Ma,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),jP=f(u.createSelector([Ma,(t,s)=>s],(t,s)=>S(t.filter(e=>e.organization===s)))),HI=_a.reducer,qP={version:0},WI=u.createSlice({name:"versioning",initialState:qP,reducers:{}}),KI=WI.reducer,Ra={outboxReducer:oT,fileReducer:jh,authReducer:wo},$P=u.combineReducers(Ra),YI={...Ra,[nt]:KI,categoryReducer:Go,assetReducer:jr,assetAttachmentReducer:On,assetStageCompletionReducer:Wr,assetStageReducer:du,assetTypeReducer:ho,assetTypeAttachmentReducer:Fu,issueReducer:Wp,issueAttachmentReducer:cp,issueTypeReducer:Jf,issueTypeAttachmentReducer:cA,organizationReducer:nT,projectReducer:mI,projectAttachmentReducer:DT,projectAccessReducer:FT,organizationAccessReducer:LS,projectFileReducer:sI,rehydratedReducer:fI,formReducer:Nm,formRevisionReducer:zm,formRevisionAttachmentReducer:Pm,formSubmissionAttachmentReducer:ny,formSubmissionReducer:Sy,formIdentifierReducer:Zh,formIdentifierValueReducer:um,userReducer:RS,emailDomainsReducer:vh,documentsReducer:Ah,documentAttachmentReducer:sh,teamReducer:HI,agentsReducer:rn,issueCommentReducer:zp,issueCommentAttachmentReducer:Ip,issueUpdateReducer:TS,geoImageReducer:Vy,issueAssociationReducer:Ky,issueTypeFieldsReducer:YA,issueTypeFieldValuesReducer:BA,issueTypeFieldsAttachmentReducer:IA,issueTypeFieldValuesAttachmentReducer:rf,issueTypeIdentifierReducer:Ff,issueTypeIdentifierValueReducer:qf,issueTypeStatusReducer:uS,assetTypeFieldsReducer:Ju,assetTypeFieldValuesReducer:Pl,assetTypeFieldsAttachmentReducer:qu,assetTypeFieldValuesAttachmentReducer:ul,assetTypeIdentifierReducer:$l,assetTypeIdentifierValueReducer:Xl,assetTypeStatusReducer:_o,assetProcedureTypeReducer:cd,assetProcedureReducer:Hc,assetProcedureTypeFieldsReducer:cc,assetProcedureTypeFieldValuesReducer:zc,assetProcedureTypeFieldsAttachmentReducer:Wn,assetProcedureTypeFieldValuesAttachmentReducer:Sc,assetProcedureTypeAttachmentReducer:Vn,assetProcedureStepFieldsAttachmentReducer:Pd,assetProcedureStepFieldsReducer:qd,assetProcedureStepFieldValuesAttachmentReducer:Zd,assetProcedureStepFieldValuesReducer:ur,assetProcedureStepReducer:Ir,teamMembershipReducer:RI},DP=u.combineReducers(YI);function UP(t,s){return FO.useMemo(t,s)}class CP{constructor(s){h(this,"operations",[]);h(this,"getData");this.getData=s}performOperations(s){let e=s;for(const a of this.operations)e=a(e);return e}filter(s,e){return this.operations.push(a=>a.filter(n=>n[s]===e)),this}exclude(s,e){return this.operations.push(a=>a.filter(n=>n[s]!==e)),this}orderBy(s){return this.operations.push(e=>[...e].sort((a,n)=>a[s]<=n[s]?1:-1)),this}reverse(){return this.operations.push(s=>[...s].reverse()),this}all(){return this.operations.push(s=>s),this}get(s,e){return u.createSelector([this.getData],a=>this.performOperations(a).find(n=>n[s]===e))}count(){return u.createSelector([this.getData],s=>this.performOperations(s).length)}first(){return u.createSelector([this.getData],s=>this.performOperations(s)[0])}last(){return u.createSelector([this.getData],s=>{const e=this.performOperations(s);return e[e.length-1]})}exists(){return u.createSelector([this.getData],s=>this.performOperations(s).length>0)}toSelector(){return u.createSelector([this.getData],s=>S(this.performOperations(s)))}}const ZI=1e4,JI=200,wa=[400,409,403,404,405,500],XI={};class QI{constructor(s){h(this,"client");h(this,"pageSize",ZI);XI[this.constructor.name]=this,this.client=s}async performRequest(s,e){return this.client.performRequest(this.host,s,this,e)}async enqueueRequest(s){return this.client.enqueueRequest(s,this.host,this.constructor.name)}async performPagination(s,e){return this.client.performPagination(this.host,s,this.pageSize,this,e)}dispatch(s){this.client.store.dispatch(s)}}const xI=()=>sO.length-1,eO=t=>(t[nt]={version:xI()},t),tO=()=>eO({}),LP=t=>(t.outboxReducer&&(t.outboxReducer.deletedRequests=[]),t),GP=t=>s=>{var e;return s===void 0&&(s={}),((e=s[nt])==null?void 0:e.version)===xI()?s:t(s)},sO=[eO,tO,tO,LP],kP=Object.fromEntries(sO.map((t,s)=>[s,GP(t)])),NP=t=>{if(t)throw t;const s=at();s?s.dispatch({type:"rehydrated/setRehydrated",payload:!0}):console.error("Client store not set")},iO=(t,s,e)=>{const a=Xe();return a?(a.addRequest(s),a.getQueue()):(console.warn("Outbox coordinator not set; cannot enqueue request yet."),[])},aO=(t,s,e)=>{const a=Xe();if(!a)return console.warn("Outbox coordinator not set; cannot dequeue request yet."),[];const c=s.meta.offlineAction.payload.uuid;return a.remove(c),a.getQueue()};async function HP(t,s){if(!s.payload)throw new Error("Received empty payload");return fO(s)}const WP={...$a,effect:HP,discard:cO,returnPromises:!0,persistCallback:NP,retry:JP,persistOptions:{storage:gO},queue:{...$a.queue,enqueue:iO,dequeue:aO,peek:(...t)=>ZP(...t)}},KP=bO(kP,nt),YP=u.compose(PO.offline(WP),KP);async function nO(t,s,e){if(s.store.getState().outboxReducer.deletedRequests.includes(t.payload.uuid))throw new Error("Request was marked for deletion");const n=XI[t.meta.offline.effect.serviceName];if(!n)throw new Error(`Service ${t.meta.offline.effect.serviceName} not found`);return za(t.meta.offline.effect.BASE_URL,t.meta.offline.effect.request,s,n,e)}function cO(t,s,e=0){var m;if(console.debug("Considering discarding request due to error:",t,`(${typeof t})`,`
1
+ (function(i,q){typeof exports=="object"&&typeof module<"u"?q(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("localforage"),require("redux-persist-migrate"),require("buffer"),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","localforage","redux-persist-migrate","buffer","@overmap-ai/forms","idb","jwt-decode","dependency-graph","@tiptap/core"],q):(i=typeof globalThis<"u"?globalThis:i||self,q(i["overmap-core"]={},null,i.toolkit,i.request,i.uuid,i.fileSaver,i.buildTree,i.tsTreeLib,i.react,i.reduxOffline,i.offlineConfig,i.localforage,i.createMigration,null,null,i.idb,i.jwtDecode,i.dependencyGraph))})(this,function(i,q,u,Qe,xe,OO,qa,ot,FO,PO,$a,gO,bO,Tb,Ib,_O,MO,RO){"use strict";var fb=Object.defineProperty;var Sb=(i,q,u)=>q in i?fb(i,q,{enumerable:!0,configurable:!0,writable:!0,value:u}):i[q]=u;var h=(i,q,u)=>Sb(i,typeof q!="symbol"?q+"":q,u);var TO;const Da=Object.freeze([]),Ua=Object.freeze({});var Ca=(t=>(t[t.GUEST=0]="GUEST",t[t.BASIC=2]="BASIC",t[t.ADMIN=4]="ADMIN",t))(Ca||{}),y=(t=>(t.GET="GET",t.POST="POST",t.PATCH="PATCH",t.PUT="PUT",t.DELETE="DELETE",t))(y||{}),La=(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))(La||{}),Ga=(t=>(t.Issue="issue",t.Asset="asset",t.AssetType="asset_type",t.Project="project",t.Document="document",t))(Ga||{}),$t=(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))($t||{}),z=(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))(z||{}),ka=(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))(ka||{});const wO=$t.MEDIUM,Na=6e4;function P(t){return{addOne:(l,p)=>{const A=t(p.payload);l.instances[A]=p.payload},addMany:(l,p)=>{for(const A of p.payload){const T=t(A);l.instances[T]=A}},setOne:(l,p)=>{const A=t(p.payload);l.instances[A]=p.payload},setMany:(l,p)=>{for(const A of p.payload){const T=t(A);l.instances[T]=A}},updateOne:(l,p)=>{const A=t(p.payload);l.instances[A]=p.payload},updateMany:(l,p)=>{for(const A of p.payload){const T=t(A);l.instances[T]=A}},deleteOne:(l,p)=>{delete l.instances[p.payload]},deleteMany:(l,p)=>{for(const A of p.payload)delete l.instances[A]},initialize:(l,p)=>{l.instances={};const A=new Set;for(const T of p.payload){const I=t(T);A.add(I),l.instances[I]=T}A.size!==p.payload.length&&console.warn("duplicate ids detected when initializing model instances.")}}}function vO(){return{initializeSelection:(o,m)=>{o.selection=Array.from(new Set(m.payload))},selectOne:(o,m)=>{new Set(o.selection).has(m.payload)||o.selection.push(m.payload)},selectMany:(o,m)=>{const l=new Set(o.selection);for(const p of m.payload)l.has(p)||l.add(p);o.selection=Array.from(l)},unselectOne:(o,m)=>{const l=new Set(o.selection);l.has(m.payload)&&(l.delete(m.payload),o.selection=Array.from(l))},unselectMany:(o,m)=>{const l=new Set(o.selection);for(const p of m.payload)l.has(p)&&l.delete(p);o.selection=Array.from(l)},toggleOne:(o,m)=>{const l=new Set(o.selection);l.has(m.payload)?l.delete(m.payload):l.add(m.payload),o.selection=Array.from(l)},toggleMany:(o,m)=>{const l=new Set(o.selection);for(const p of m.payload)l.has(p)?l.delete(p):l.add(p);o.selection=Array.from(l)},getInitialState:o=>({...o,selection:[]})}}const nt="versioning",O=u.createAction("RESET"),E=u.createAction("RESET_PROJECT_STATE"),b=u.createAction("RESET_ORGANIZATION_STATE");TO=Symbol.toStringTag;class Dt{constructor(){h(this,TO,"Promise");h(this,"_promise");h(this,"_resolve");h(this,"_reject");h(this,"_state","pending");this._resolve=null,this._reject=null,this._promise=new Promise((s,e)=>{this._resolve=s,this._reject=e})}get state(){return this._state}then(s,e){return this._promise.then(s,e)}catch(s){return this._promise.catch(s)}resolve(s){if(!this._resolve)throw new Error("No resolve callback");this._resolve(s),this._state="fulfilled"}reject(s){if(!this._reject)throw s;this._reject(s),this._state="rejected"}finally(s){throw new Error("`finally` not implemented")}}let Ut=!1;["true","1"].includes("".toLowerCase())&&(Ut=!0);function EO(t,s){if(t===s)return!0;if(typeof t!=typeof s)return!1;const e=Object.keys(t),a=Object.keys(s),n=e.length;if(n!==a.length)return!1;for(let c=0;c<n;c++){const d=e[c];if(!Object.prototype.hasOwnProperty.call(s,d)||t[d]!==s[d])return!1}return!0}function Ct(t){const s={};return function(){const e=Array.prototype.slice.call(arguments);return e in s?(Ut&&console.debug(`Memoization debug: Using memorized return value for ${t.toString()}(`,e,")"),s[e]):(Ut&&console.debug(`Memoization debug: Cache miss! Memoizing ${t.toString()}(`,e,")"),s[e]=t.apply(this,e))}}function VO(t,s){if(t.length!==s.length)return!1;for(let e=0;e<t.length;e++)if(t[e]!==s[e])return!1;return!0}const S=t=>t.length===0?Da:t,ht=t=>Object.keys(t).length===0?Ua:t,Ha=Ct(t=>{if(!t)return"";const s=new Date(t),e=s.getFullYear()===Lt.getFullYear(),a={day:"numeric",month:"short"};return e||(a.year="numeric"),s.toLocaleDateString([],a)}),zO=new Intl.RelativeTimeFormat([],{style:"long",numeric:"auto"}),BO=1e3*86400,Lt=new Date,jO=t=>new Date(t).toDateString()===Lt.toDateString(),qO=Ct((t,s,e)=>{const a=Math.round((new Date(t).getTime()-Lt.getTime())/BO);return a<s||a>e?Ha(t):zO.format(a,"days")});function $O(t){return new Uint8Array(t).reduce((e,a)=>e+a.toString(16).padStart(2,"0"),"")}const Gt=async(t,s)=>{s||(s=await et(t));let e=t.type;if(e.includes("/")&&(e=e.split("/")[1]),!e)throw new Error(`Could not extract file type from ${t.type}`);return`${s}.${e}`};function et(t){return new Promise((s,e)=>{const a=new FileReader;a.onload=()=>{const n=a.result;if(!n){e(new Error("FileReader did not return a valid ArrayBuffer."));return}crypto.subtle.digest("SHA-1",n).then(c=>{const d=$O(c);s(d)})},a.readAsArrayBuffer(t)})}function DO(t){if(!t.name||!t.type||!t.size){const s="File has no name, type, and/or size";throw new Error(s)}return`${t.name}&${t.type}${t.size}`}function Wa(t,s){return new File([t],s,{type:t.type})}function UO(t,s){const e=document.createElement("a");e.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(s)),e.setAttribute("download",t),e.style.display="none",document.body.appendChild(e),e.click(),document.body.removeChild(e)}const CO=async t=>{const s={};for(const e of t){const a=await et(e);s[a]={sha1:a,extension:e.name.split(".").pop()||"",file_type:e.type,size:e.size}}return Object.values(s)},Ka=async t=>(await fetch(t)).blob(),LO=t=>new Promise((s,e)=>{const a=new FileReader;a.onloadend=()=>{var n;s(((n=a.result)==null?void 0:n.toString())||"")},a.readAsDataURL(t)});function GO(t){const s=new Blob([t]);OO.saveAs(s,t.name)}const Ya={};function kO(t,s,e,...a){const n=Ya[t];let c=!1;n?n[s]||(n[s]=!0,c=!0):(Ya[t]={[s]:!0},c=!0),c&&console[e](...a)}const Za=["created_at","updated_at","index","revision"];function F(t){return{...t,uuid:xe.v4()}}function NO(t){const s={};for(const e of t)s[e.uuid]=e;return s}function Ja(t){return t.map(({uuid:s})=>s)}function HO(t,s=void 0,e=255){let a=t.replace(/[^a-z0-9_\-.]/gi,"_").replace(/_{2,}/g,"_");if(!s){const c=t.split(".");c.length>1&&(s=c[c.length-1])}s&&!s.startsWith(".")&&(s="."+s);const n=s?s.length:0;return a.length+n>e&&(a=a.slice(0,e-n)+(s||"")),a}function WO(t){return t.toLowerCase().replace(" ","-")}function KO(t,s=!1){return t.normalize("NFKD").toLowerCase().replace(/[^\w\s-]/g,"").trim().replace(/[-\s]+/g,s?"_":"-")}function YO(t,s){if(t.length<=s)return t;const e=t.slice(0,s-1);return e.slice(0,e.lastIndexOf(" "))+"…"}const f=t=>s=>e=>t(e,s);function ZO(t,s,e){return e.findIndex(a=>a.uuid===t.uuid)===s}function JO(t,s,e){return e.findIndex(a=>a.file_sha1===t.file_sha1)===s}const XO=/^.+@.+\..+$/;function w(t){const s={...t};for(const e of[...Za,"created_by"])e in s&&delete s[e];return s}const Xa=t=>{const s=t.toSorted((e,a)=>e.order-a.order);return qa(s,{id:e=>e.uuid,parentId:e=>e.parent,includeEmptyChildrenArray:!0,valueKey:!1})},QO=t=>{const{roots:s}=Xa(t);return s.map(e=>new ot.Tree(e))},Qa=(t,s)=>{const{nodes:e}=Xa(s),a=e.get(t);if(!a)throw new Error(`Node with uuid ${t} does not exist in asset procedure step tree.`);return new ot.Tree(a)},xa=(t,s)=>t.type!==s.type?t.type-s.type:t.order-s.order,en=(t,s)=>t.type!==s.type?t.type-s.type:t.order-s.order,tn=t=>qa(t,{id:s=>s.uuid,parentId:s=>s.parent_document,includeEmptyChildrenArray:!0,valueKey:!1}),xO=t=>{const{roots:s}=tn(t);return s.map(e=>new ot.Tree(e))},eF=(t,s)=>{const{nodes:e}=tn(s),a=e.get(t);if(!a)throw new Error(`Node with uuid ${t} does not exist in document tree.`);return new ot.Tree(a)},D=P(t=>t.uuid),sn={instances:{}},kt=u.createSlice({name:"agents",initialState:sn,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,sn)),reducers:{initializeConversations:D.initialize,addConversation:D.addOne,addConversations:D.addMany,setConversation:D.setOne,setConversations:D.setMany,updateConversation:D.updateOne,updateConversations:D.updateMany,deleteConversation:D.deleteOne,deleteConversations:D.deleteMany}}),{initializeConversations:an,addConversation:nn,addConversations:tF,setConversation:cn,setConversations:sF,updateConversation:dn,updateConversations:iF,deleteConversation:aF,deleteConversations:nF}=kt.actions,Nt=t=>t.agentsReducer.instances,cF=u.createSelector([Nt],t=>Object.values(t)),dF=f(u.createSelector([Nt,(t,s)=>s],(t,s)=>t[s])),rn=kt.reducer,U=P(t=>t.uuid),un={instances:{}},Ht=u.createSlice({name:"assetAttachments",initialState:un,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,un)),reducers:{initializeAssetAttachments:U.initialize,addAssetAttachment:U.addOne,addAssetAttachments:U.addMany,setAssetAttachment:U.setOne,setAssetAttachments:U.setMany,updateAssetAttachment:U.updateOne,updateAssetAttachments:U.updateMany,deleteAssetAttachment:U.deleteOne,deleteAssetAttachments:U.deleteMany}}),{initializeAssetAttachments:ln,addAssetAttachment:on,addAssetAttachments:Wt,setAssetAttachment:hn,setAssetAttachments:mn,updateAssetAttachment:yn,updateAssetAttachments:pn,deleteAssetAttachment:An,deleteAssetAttachments:Kt}=Ht.actions,fn=t=>t.assetAttachmentReducer.instances,Yt=u.createSelector([fn],t=>Object.values(t)),Sn=t=>s=>s.assetAttachmentReducer.instances[t],Tn=f(u.createSelector([Yt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),In=f(u.createSelector([Yt,(t,s)=>s],(t,s)=>S(t.filter(({asset:e})=>s===e)))),On=Ht.reducer,C=P(({uuid:t})=>t),Fn={instances:{}},Zt=u.createSlice({name:"assetProcedureTypeAttachments",initialState:Fn,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,Fn)),reducers:{initializeAssetProcedureTypeAttachments:C.initialize,addAssetProcedureTypeAttachment:C.addOne,addAssetProcedureTypeAttachments:C.addMany,setAssetProcedureTypeAttachment:C.setOne,setAssetProcedureTypeAttachments:C.setMany,updateAssetProcedureTypeAttachment:C.updateOne,updateAssetProcedureTypeAttachments:C.updateMany,deleteAssetProcedureTypeAttachment:C.deleteOne,deleteAssetProcedureTypeAttachments:C.deleteMany}}),{initializeAssetProcedureTypeAttachments:Pn,addAssetProcedureTypeAttachment:gn,addAssetProcedureTypeAttachments:bn,setAssetProcedureTypeAttachment:_n,setAssetProcedureTypeAttachments:Mn,updateAssetProcedureTypeAttachment:Rn,updateAssetProcedureTypeAttachments:wn,deleteAssetProcedureTypeAttachment:vn,deleteAssetProcedureTypeAttachments:En}=Zt.actions,Vn=Zt.reducer,zn=t=>t.assetProcedureTypeAttachmentReducer.instances,Jt=u.createSelector([zn],t=>Object.values(t)),Bn=t=>s=>s.assetProcedureTypeAttachmentReducer.instances[t],jn=f(u.createSelector([Jt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),rF=f(u.createSelector([Jt,(t,s)=>s],(t,s)=>S(t.filter(({asset_procedure_type:e})=>s===e)))),L=P(({uuid:t})=>t),qn={instances:{}},Xt=u.createSlice({name:"assetProcedureTypeFieldsAttachments",initialState:qn,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,qn)),reducers:{initializeAssetProcedureTypeFieldsAttachments:L.initialize,addAssetProcedureTypeFieldsAttachment:L.addOne,addAssetProcedureTypeFieldsAttachments:L.addMany,setAssetProcedureTypeFieldsAttachment:L.setOne,setAssetProcedureTypeFieldsAttachments:L.setMany,updateAssetProcedureTypeFieldsAttachment:L.updateOne,updateAssetProcedureTypeFieldsAttachments:L.updateMany,deleteAssetProcedureTypeFieldsAttachment:L.deleteOne,deleteAssetProcedureTypeFieldsAttachments:L.deleteMany}}),{initializeAssetProcedureTypeFieldsAttachments:$n,addAssetProcedureTypeFieldsAttachment:Dn,addAssetProcedureTypeFieldsAttachments:Un,setAssetProcedureTypeFieldsAttachment:Cn,setAssetProcedureTypeFieldsAttachments:Ln,updateAssetProcedureTypeFieldsAttachment:Gn,updateAssetProcedureTypeFieldsAttachments:kn,deleteAssetProcedureTypeFieldsAttachment:Nn,deleteAssetProcedureTypeFieldsAttachments:Hn}=Xt.actions,Wn=Xt.reducer,Kn=t=>t.assetProcedureTypeFieldsAttachmentReducer.instances,Qt=u.createSelector([Kn],t=>Object.values(t)),uF=f(u.createSelector([Qt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.fields_revision===s)))),Yn=t=>s=>s.assetProcedureTypeFieldsAttachmentReducer.instances[t],Zn=f(u.createSelector([Qt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),G=P(({uuid:t})=>t),Jn={instances:{}},xt=u.createSlice({name:"assetProcedureTypeFields",initialState:Jn,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,Jn)),reducers:{initializeAssetProcedureTypeFields:G.initialize,addAssetProcedureTypeFields:G.addOne,addAssetProcedureTypeFieldsMany:G.addMany,setAssetProcedureTypeFields:G.setOne,setAssetProcedureTypeFieldsMany:G.setMany,updateAssetProcedureTypeFields:G.updateOne,updateAssetProcedureTypeFieldsMany:G.updateMany,deleteAssetProcedureTypeFields:G.deleteOne,deleteAssetProcedureTypeFieldsMany:G.deleteMany}}),{initializeAssetProcedureTypeFields:Xn,addAssetProcedureTypeFields:Qn,addAssetProcedureTypeFieldsMany:xn,setAssetProcedureTypeFields:ec,setAssetProcedureTypeFieldsMany:tc,updateAssetProcedureTypeFields:sc,updateAssetProcedureTypeFieldsMany:ic,deleteAssetProcedureTypeFields:ac,deleteAssetProcedureTypeFieldsMany:nc}=xt.actions,cc=xt.reducer,dc=t=>t.assetProcedureTypeFieldsReducer.instances,mt=u.createSelector([dc],t=>Object.values(t)),lF=f(u.createSelector([mt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_procedure_type===s)))),oF=f(u.createSelector([mt,(t,s)=>s],(t,s)=>t.filter(e=>e.asset_procedure_type===s).sort((e,a)=>e.submitted_at>a.submitted_at?-1:1)[0])),rc=t=>s=>s.assetProcedureTypeFieldsReducer.instances[t],uc=f(u.createSelector([mt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),k=P(({uuid:t})=>t),lc={instances:{}},es=u.createSlice({name:"assetProcedureTypeFieldValuesAttachments",initialState:lc,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,lc)),reducers:{initializeAssetProcedureTypeFieldValuesAttachments:k.initialize,addAssetProcedureTypeFieldValuesAttachment:k.addOne,addAssetProcedureTypeFieldValuesAttachments:k.addMany,setAssetProcedureTypeFieldValuesAttachment:k.setOne,setAssetProcedureTypeFieldValuesAttachments:k.setMany,updateAssetProcedureTypeFieldValuesAttachment:k.updateOne,updateAssetProcedureTypeFieldValuesAttachments:k.updateMany,deleteAssetProcedureTypeFieldValuesAttachment:k.deleteOne,deleteAssetProcedureTypeFieldValuesAttachments:k.deleteMany}}),{initializeAssetProcedureTypeFieldValuesAttachments:oc,addAssetProcedureTypeFieldValuesAttachment:hc,addAssetProcedureTypeFieldValuesAttachments:ts,setAssetProcedureTypeFieldValuesAttachment:mc,setAssetProcedureTypeFieldValuesAttachments:yc,updateAssetProcedureTypeFieldValuesAttachment:pc,updateAssetProcedureTypeFieldValuesAttachments:Ac,deleteAssetProcedureTypeFieldValuesAttachment:fc,deleteAssetProcedureTypeFieldValuesAttachments:ss}=es.actions,Sc=es.reducer,Tc=t=>t.assetProcedureTypeFieldValuesAttachmentReducer.instances,is=u.createSelector([Tc],t=>Object.values(t)),Ic=t=>s=>s.assetProcedureTypeFieldValuesAttachmentReducer.instances[t],Oc=f(u.createSelector([is,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),Fc=f(u.createSelector([is,(t,s)=>s],(t,s)=>S(t.filter(e=>e.field_values===s)))),N=P(({uuid:t})=>t),Pc={instances:{}},as=u.createSlice({name:"assetProcedureTypeFieldValues",initialState:Pc,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,Pc)),reducers:{initializeAssetProcedureTypeFieldValues:N.initialize,addAssetProcedureTypeFieldValues:N.addOne,addAssetProcedureTypeFieldValuesMany:N.addMany,setAssetProcedureTypeFieldValues:N.setOne,setAssetProcedureTypeFieldValuesMany:N.setMany,updateAssetProcedureTypeFieldValues:N.updateOne,updateAssetProcedureTypeFieldValuesMany:N.updateMany,deleteAssetProcedureTypeFieldValues:N.deleteOne,deleteAssetProcedureTypeFieldValuesMany:N.deleteMany}}),{initializeAssetProcedureTypeFieldValues:gc,addAssetProcedureTypeFieldValues:bc,addAssetProcedureTypeFieldValuesMany:_c,setAssetProcedureTypeFieldValues:Mc,setAssetProcedureTypeFieldValuesMany:Rc,updateAssetProcedureTypeFieldValues:wc,updateAssetProcedureTypeFieldValuesMany:vc,deleteAssetProcedureTypeFieldValues:Ec,deleteAssetProcedureTypeFieldValuesMany:Vc}=as.actions,zc=as.reducer,Bc=t=>t.assetProcedureTypeFieldValuesReducer.instances,yt=u.createSelector([Bc],t=>Object.values(t)),hF=f(u.createSelector([yt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset===s)))),mF=f(u.createSelector([yt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_procedure===s)))),jc=t=>s=>s.assetProcedureTypeFieldValuesReducer.instances[t],qc=f(u.createSelector([yt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),H=P(({uuid:t})=>t),$c={instances:{}},ns=u.createSlice({name:"assetProcedures",initialState:$c,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,$c)),reducers:{initializeAssetProcedures:H.initialize,addAssetProcedure:H.addOne,addAssetProcedures:H.addMany,setAssetProcedure:H.setOne,setAssetProcedures:H.setMany,updateAssetProcedure:H.updateOne,updateAssetProcedures:H.updateMany,deleteAssetProcedure:H.deleteOne,deleteAssetProcedures:H.deleteMany}}),{initializeAssetProcedures:Dc,addAssetProcedure:Uc,addAssetProcedures:cs,updateAssetProcedure:Cc,updateAssetProcedures:Lc,deleteAssetProcedure:Gc,deleteAssetProcedures:ds,setAssetProcedure:kc,setAssetProcedures:Nc}=ns.actions,Hc=ns.reducer,Wc=t=>t.assetProcedureReducer.instances,pt=u.createSelector([Wc],t=>Object.values(t)),Kc=f(u.createSelector([pt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_procedure_type===s)))),yF=f(u.createSelector([pt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_type===s)))),Yc=t=>s=>s.assetProcedureReducer.instances[t],Zc=f(u.createSelector([pt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),W=P(t=>t.uuid),Jc={instances:{}},rs=u.createSlice({name:"assetProcedureTypes",initialState:Jc,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,Jc)),reducers:{initializeAssetProcedureTypes:W.initialize,addAssetProcedureType:W.addOne,addAssetProcedureTypes:W.addMany,setAssetProcedureType:W.setOne,setAssetProcedureTypes:W.setMany,updateAssetProcedureType:W.updateOne,updateAssetProcedureTypes:W.updateMany,deleteAssetProcedureType:W.deleteOne,deleteAssetProcedureTypes:W.deleteMany}}),{initializeAssetProcedureTypes:Xc,addAssetProcedureType:Qc,addAssetProcedureTypes:xc,updateAssetProcedureType:ed,updateAssetProcedureTypes:td,deleteAssetProcedureType:sd,deleteAssetProcedureTypes:id,setAssetProcedureType:ad,setAssetProcedureTypes:nd}=rs.actions,cd=rs.reducer,dd=t=>t.assetProcedureTypeReducer.instances,us=u.createSelector([dd],t=>Object.values(t)),rd=t=>s=>s.assetProcedureTypeReducer.instances[t],ud=f(u.createSelector([us,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),pF=f(u.createSelector([us,(t,s)=>s],(t,s)=>S(t.filter(e=>e.organization===s)))),K=P(t=>t.uuid),ld={instances:{}},ls=u.createSlice({name:"assetProcedureStepFieldsAttachments",initialState:ld,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,ld)),reducers:{initializeAssetProcedureStepFieldsAttachments:K.initialize,addAssetProcedureStepFieldsAttachment:K.addOne,addAssetProcedureStepFieldsAttachments:K.addMany,setAssetProcedureStepFieldsAttachment:K.setOne,setAssetProcedureStepFieldsAttachments:K.setMany,updateAssetProcedureStepFieldsAttachment:K.updateOne,updateAssetProcedureStepFieldsAttachments:K.updateMany,deleteAssetProcedureStepFieldsAttachment:K.deleteOne,deleteAssetProcedureStepFieldsAttachments:K.deleteMany}}),{initializeAssetProcedureStepFieldsAttachments:od,addAssetProcedureStepFieldsAttachment:hd,addAssetProcedureStepFieldsAttachments:md,setAssetProcedureStepFieldsAttachment:yd,setAssetProcedureStepFieldsAttachments:pd,updateAssetProcedureStepFieldsAttachment:Ad,updateAssetProcedureStepFieldsAttachments:fd,deleteAssetProcedureStepFieldsAttachment:Sd,deleteAssetProcedureStepFieldsAttachments:Td}=ls.actions,Id=t=>t.assetProcedureStepFieldsAttachmentReducer.instances,os=u.createSelector([Id],t=>Object.values(t)),AF=f(u.createSelector([os,(t,s)=>s],(t,s)=>S(t.filter(e=>e.fields_revision===s)))),Od=t=>s=>s.assetProcedureStepFieldsAttachmentReducer.instances[t],Fd=f(u.createSelector([os,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),Pd=ls.reducer,Y=P(t=>t.uuid),gd={instances:{}},hs=u.createSlice({name:"assetProcedureStepFields",initialState:gd,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,gd)),reducers:{initializeAssetProcedureStepFields:Y.initialize,addAssetProcedureStepFields:Y.addOne,addAssetProcedureStepFieldsMany:Y.addMany,setAssetProcedureStepFields:Y.setOne,setAssetProcedureStepFieldsMany:Y.setMany,updateAssetProcedureStepFields:Y.updateOne,updateAssetProcedureStepFieldsMany:Y.updateMany,deleteAssetProcedureStepFields:Y.deleteOne,deleteAssetProcedureStepFieldsMany:Y.deleteMany}}),{initializeAssetProcedureStepFields:bd,addAssetProcedureStepFields:_d,addAssetProcedureStepFieldsMany:Md,setAssetProcedureStepFields:Rd,setAssetProcedureStepFieldsMany:wd,updateAssetProcedureStepFields:vd,updateAssetProcedureStepFieldsMany:Ed,deleteAssetProcedureStepFields:Vd,deleteAssetProcedureStepFieldsMany:zd}=hs.actions,ms=t=>t.assetProcedureStepFieldsReducer.instances,At=u.createSelector([ms],t=>Object.values(t)),fF=f(u.createSelector([At,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_procedure_step===s)))),SF=f(u.createSelector([At,(t,s)=>s],(t,s)=>t.filter(e=>e.asset_procedure_step===s).sort((e,a)=>e.submitted_at>a.submitted_at?-1:1)[0])),TF=u.createSelector([ms],t=>{const s={};for(const e of Object.values(t)){const a=s[e.asset_procedure_step];(!a||a.submitted_at<e.submitted_at)&&(s[e.asset_procedure_step]=e)}return s}),Bd=t=>s=>s.assetProcedureStepFieldsReducer.instances[t],jd=f(u.createSelector([At,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),qd=hs.reducer,Z=P(t=>t.uuid),$d={instances:{}},ys=u.createSlice({name:"assetProcedureStepFieldValuesAttachments",initialState:$d,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,$d)),reducers:{initializeAssetProcedureStepFieldValuesAttachments:Z.initialize,addAssetProcedureStepFieldValuesAttachment:Z.addOne,addAssetProcedureStepFieldValuesAttachments:Z.addMany,setAssetProcedureStepFieldValuesAttachment:Z.setOne,setAssetProcedureStepFieldValuesAttachments:Z.setMany,updateAssetProcedureStepFieldValuesAttachment:Z.updateOne,updateAssetProcedureStepFieldValuesAttachments:Z.updateMany,deleteAssetProcedureStepFieldValuesAttachment:Z.deleteOne,deleteAssetProcedureStepFieldValuesAttachments:Z.deleteMany}}),{initializeAssetProcedureStepFieldValuesAttachments:Dd,addAssetProcedureStepFieldValuesAttachment:Ud,addAssetProcedureStepFieldValuesAttachments:ps,setAssetProcedureStepFieldValuesAttachment:Cd,setAssetProcedureStepFieldValuesAttachments:Ld,updateAssetProcedureStepFieldValuesAttachment:Gd,updateAssetProcedureStepFieldValuesAttachments:kd,deleteAssetProcedureStepFieldValuesAttachment:Nd,deleteAssetProcedureStepFieldValuesAttachments:As}=ys.actions,Hd=t=>t.assetProcedureStepFieldValuesAttachmentReducer.instances,fs=u.createSelector([Hd],t=>Object.values(t)),Wd=t=>s=>s.assetProcedureStepFieldValuesAttachmentReducer.instances[t],Kd=f(u.createSelector([fs,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),Yd=f(u.createSelector([fs,(t,s)=>s],(t,s)=>S(t.filter(e=>e.field_values===s)))),Zd=ys.reducer,J=P(t=>t.uuid),Jd={instances:{}},Ss=u.createSlice({name:"assetProcedureStepFieldValues",initialState:Jd,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,Jd)),reducers:{initializeAssetProcedureStepFieldValues:J.initialize,addAssetProcedureStepFieldValues:J.addOne,addAssetProcedureStepFieldValuesMany:J.addMany,setAssetProcedureStepFieldValues:J.setOne,setAssetProcedureStepFieldValuesMany:J.setMany,updateAssetProcedureStepFieldValues:J.updateOne,updateAssetProcedureStepFieldValuesMany:J.updateMany,deleteAssetProcedureStepFieldValues:J.deleteOne,deleteAssetProcedureStepFieldValuesMany:J.deleteMany}}),{initializeAssetProcedureStepFieldValues:Xd,addAssetProcedureStepFieldValues:Qd,addAssetProcedureStepFieldValuesMany:xd,setAssetProcedureStepFieldValues:er,setAssetProcedureStepFieldValuesMany:tr,updateAssetProcedureStepFieldValues:sr,updateAssetProcedureStepFieldValuesMany:ir,deleteAssetProcedureStepFieldValues:ar,deleteAssetProcedureStepFieldValuesMany:nr}=Ss.actions,cr=t=>t.assetProcedureStepFieldValuesReducer.instances,ct=u.createSelector([cr],t=>Object.values(t)),IF=f(u.createSelector([ct,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset===s)))),OF=f(u.createSelector([ct,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_procedure===s)))),FF=f(u.createSelector([ct,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_procedure_step===s)))),dr=t=>s=>s.assetProcedureStepFieldValuesReducer.instances[t],rr=f(u.createSelector([ct,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),ur=Ss.reducer,X=P(t=>t.uuid),lr={instances:{}},Ts=u.createSlice({name:"assetProcedureSteps",initialState:lr,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,lr)),reducers:{initializeAssetProcedureSteps:X.initialize,setAssetProcedureStep:X.setOne,setAssetProcedureSteps:X.setMany,addAssetProcedureStep:X.addOne,addAssetProcedureSteps:X.addMany,updateAssetProcedureStep:X.updateOne,updateAssetProcedureSteps:X.updateMany,deleteAssetProcedureStep:X.deleteOne,deleteAssetProcedureSteps:X.deleteMany}}),{initializeAssetProcedureSteps:or,setAssetProcedureStep:hr,setAssetProcedureSteps:mr,addAssetProcedureStep:yr,addAssetProcedureSteps:pr,updateAssetProcedureStep:Ar,updateAssetProcedureSteps:fr,deleteAssetProcedureStep:Sr,deleteAssetProcedureSteps:Tr}=Ts.actions,Ir=Ts.reducer,ft=t=>t.assetProcedureStepReducer.instances,Or=t=>s=>s.assetProcedureStepReducer.instances[t],Is=u.createSelector([ft],t=>Object.values(t)),PF=f(u.createSelector([ft,(t,s)=>s],(t,s)=>{const e={};for(const[a,n]of Object.entries(t))n.asset_procedure_type===s&&(e[a]=n);return ht(e)})),gF=f(u.createSelector([Is,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_procedure_type===s)))),Fr=f(u.createSelector([Is,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),Pr=f(u.createSelector([ft,(t,s)=>s],(t,s)=>{if(!t[s])return S([]);const n=Qa(s,Object.values(t)).all().map(({model:c})=>c);return S(n)})),Q=P(t=>t.uuid),gr={instances:{}},Os=u.createSlice({name:"assets",initialState:gr,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,gr)),reducers:{initializeAssets:Q.initialize,addAsset:Q.addOne,addAssets:Q.addMany,setAsset:Q.setOne,setAssets:Q.setMany,updateAsset:Q.updateOne,updateAssets:Q.updateMany,deleteAsset:Q.deleteOne,deleteAssets:Q.deleteMany}}),{initializeAssets:br,addAsset:_r,addAssets:Fs,updateAsset:Mr,updateAssets:Rr,deleteAsset:wr,deleteAssets:Ps,setAsset:vr,setAssets:Er}=Os.actions,Vr=t=>t.assetReducer.instances,gs=u.createSelector([Vr],t=>S(Object.values(t))),bs=f(u.createSelector([gs,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_type===s)))),zr=t=>s=>s.assetReducer.instances[t],Br=f(u.createSelector([gs,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),bF=t=>s=>bs(t)(s).length,jr=Os.reducer,x=P(t=>t.uuid),qr={instances:{}},_s=u.createSlice({name:"assetStageCompletions",initialState:qr,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,qr)),reducers:{initializeAssetStageCompletions:x.initialize,addAssetStageCompletion:x.addOne,addAssetStageCompletions:x.addMany,setAssetStageCompletion:x.setOne,setAssetStageCompletions:x.setMany,updateAssetStageCompletion:x.updateOne,updateAssetStageCompletions:x.updateMany,deleteAssetStageCompletion:x.deleteOne,deleteAssetStageCompletions:x.deleteMany}}),{initializeAssetStageCompletions:$r,addAssetStageCompletion:Dr,addAssetStageCompletions:Ur,setAssetStageCompletion:Cr,setAssetStageCompletions:Lr,updateAssetStageCompletion:Gr,updateAssetStageCompletions:kr,deleteAssetStageCompletion:Nr,deleteAssetStageCompletions:Hr}=_s.actions,Wr=_s.reducer,Kr=t=>t.assetStageCompletionReducer.instances,Yr=u.createSelector([Kr],t=>Object.values(t)),Zr=t=>s=>s.assetStageCompletionReducer.instances[t],Jr=f(u.createSelector([Yr,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),ee=P(t=>t.uuid),Xr={instances:{}},Ms=u.createSlice({name:"assetStages",initialState:Xr,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,Xr)),reducers:{initializeAssetStages:ee.initialize,setAssetStage:ee.setOne,setAssetStages:ee.setMany,addAssetStage:ee.addOne,addAssetStages:ee.addMany,updateAssetStage:ee.updateOne,updateAssetStages:ee.updateMany,deleteAssetStage:ee.deleteOne,deleteAssetStages:ee.deleteMany}}),{initializeAssetStages:Qr,setAssetStage:xr,setAssetStages:eu,addAssetStage:tu,addAssetStages:su,updateAssetStage:iu,updateAssetStages:au,deleteAssetStage:nu,deleteAssetStages:cu}=Ms.actions,du=Ms.reducer,Rs=t=>t.assetStageReducer.instances,ru=t=>s=>s.assetStageReducer.instances[t],ws=u.createSelector([Rs],t=>Object.values(t)),_F=f(u.createSelector([Rs,(t,s)=>s],(t,s)=>{const e={};for(const[a,n]of Object.entries(t))n.asset_procedure_type===s&&(e[a]=n);return ht(e)})),MF=f(u.createSelector([ws,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_procedure_type===s)))),uu=f(u.createSelector([ws,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),te=P(t=>t.uuid),lu={instances:{}},vs=u.createSlice({name:"assetTypeAttachments",initialState:lu,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,lu)),reducers:{initializeAssetTypeAttachments:te.initialize,addAssetTypeAttachment:te.addOne,addAssetTypeAttachments:te.addMany,setAssetTypeAttachment:te.setOne,setAssetTypeAttachments:te.setMany,updateAssetTypeAttachment:te.updateOne,updateAssetTypeAttachments:te.updateMany,deleteAssetTypeAttachment:te.deleteOne,deleteAssetTypeAttachments:te.deleteMany}}),{initializeAssetTypeAttachments:ou,addAssetTypeAttachment:hu,addAssetTypeAttachments:Es,setAssetTypeAttachment:mu,setAssetTypeAttachments:yu,updateAssetTypeAttachment:pu,updateAssetTypeAttachments:Au,deleteAssetTypeAttachment:fu,deleteAssetTypeAttachments:Vs}=vs.actions,Su=t=>t.assetTypeAttachmentReducer.instances,zs=u.createSelector([Su],t=>Object.values(t)),Tu=t=>s=>s.assetTypeAttachmentReducer.instances[t],Iu=f(u.createSelector([zs,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),Ou=f(u.createSelector([zs,(t,s)=>s],(t,s)=>S(t.filter(({asset_type:e})=>s===e)))),Fu=vs.reducer,se=P(t=>t.uuid),Pu={instances:{}},Bs=u.createSlice({name:"assetTypeFieldsAttachments",initialState:Pu,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,Pu)),reducers:{initializeAssetTypeFieldsAttachments:se.initialize,addAssetTypeFieldsAttachment:se.addOne,addAssetTypeFieldsAttachments:se.addMany,setAssetTypeFieldsAttachment:se.setOne,setAssetTypeFieldsAttachments:se.setMany,updateAssetTypeFieldsAttachment:se.updateOne,updateAssetTypeFieldsAttachments:se.updateMany,deleteAssetTypeFieldsAttachment:se.deleteOne,deleteAssetTypeFieldsAttachments:se.deleteMany}}),{initializeAssetTypeFieldsAttachments:gu,addAssetTypeFieldsAttachment:bu,addAssetTypeFieldsAttachments:_u,setAssetTypeFieldsAttachment:Mu,setAssetTypeFieldsAttachments:Ru,updateAssetTypeFieldsAttachment:wu,updateAssetTypeFieldsAttachments:vu,deleteAssetTypeFieldsAttachment:Eu,deleteAssetTypeFieldsAttachments:Vu}=Bs.actions,zu=t=>t.assetTypeFieldsAttachmentReducer.instances,js=u.createSelector([zu],t=>Object.values(t)),RF=f(u.createSelector([js,(t,s)=>s],(t,s)=>S(t.filter(e=>e.fields_revision===s)))),Bu=t=>s=>s.assetTypeFieldsAttachmentReducer.instances[t],ju=f(u.createSelector([js,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),qu=Bs.reducer,ie=P(t=>t.uuid),$u={instances:{}},qs=u.createSlice({name:"assetTypeFields",initialState:$u,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,$u)),reducers:{initializeAssetTypeFields:ie.initialize,addAssetTypeFields:ie.addOne,addAssetTypeFieldsMany:ie.addMany,setAssetTypeFields:ie.setOne,setAssetTypeFieldsMany:ie.setMany,updateAssetTypeFields:ie.updateOne,updateAssetTypeFieldsMany:ie.updateMany,deleteAssetTypeFields:ie.deleteOne,deleteAssetTypeFieldsMany:ie.deleteMany}}),{initializeAssetTypeFields:Du,addAssetTypeFields:Uu,addAssetTypeFieldsMany:Cu,setAssetTypeFields:Lu,setAssetTypeFieldsMany:Gu,updateAssetTypeFields:ku,updateAssetTypeFieldsMany:Nu,deleteAssetTypeFields:Hu,deleteAssetTypeFieldsMany:Wu}=qs.actions,Ku=t=>t.assetTypeFieldsReducer.instances,dt=u.createSelector([Ku],t=>Object.values(t)),wF=f(u.createSelector([dt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_type===s)))),vF=f(u.createSelector([dt,(t,s)=>s],(t,s)=>t.filter(e=>e.asset_type===s).sort((e,a)=>e.submitted_at>a.submitted_at?-1:1)[0])),Yu=t=>s=>s.assetTypeFieldsReducer.instances[t],Zu=f(u.createSelector([dt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),Ju=qs.reducer,ae=P(t=>t.uuid),Xu={instances:{}},$s=u.createSlice({name:"assetTypeFieldValuesAttachments",initialState:Xu,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,Xu)),reducers:{initializeAssetTypeFieldValuesAttachments:ae.initialize,addAssetTypeFieldValuesAttachment:ae.addOne,addAssetTypeFieldValuesAttachments:ae.addMany,setAssetTypeFieldValuesAttachment:ae.setOne,setAssetTypeFieldValuesAttachments:ae.setMany,updateAssetTypeFieldValuesAttachment:ae.updateOne,updateAssetTypeFieldValuesAttachments:ae.updateMany,deleteAssetTypeFieldValuesAttachment:ae.deleteOne,deleteAssetTypeFieldValuesAttachments:ae.deleteMany}}),{initializeAssetTypeFieldValuesAttachments:Qu,addAssetTypeFieldValuesAttachment:xu,addAssetTypeFieldValuesAttachments:Ds,setAssetTypeFieldValuesAttachment:el,setAssetTypeFieldValuesAttachments:tl,updateAssetTypeFieldValuesAttachment:sl,updateAssetTypeFieldValuesAttachments:il,deleteAssetTypeFieldValuesAttachment:al,deleteAssetTypeFieldValuesAttachments:Us}=$s.actions,nl=t=>t.assetTypeFieldValuesAttachmentReducer.instances,Cs=u.createSelector([nl],t=>Object.values(t)),cl=t=>s=>s.assetTypeFieldValuesAttachmentReducer.instances[t],dl=f(u.createSelector([Cs,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),rl=f(u.createSelector([Cs,(t,s)=>s],(t,s)=>S(t.filter(e=>e.field_values===s)))),ul=$s.reducer,ne=P(t=>t.uuid),ll={instances:{}},Ls=u.createSlice({name:"assetTypeFieldValues",initialState:ll,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,ll)),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:ol,addAssetTypeFieldValues:hl,addAssetTypeFieldValuesMany:ml,setAssetTypeFieldValues:yl,setAssetTypeFieldValuesMany:pl,updateAssetTypeFieldValues:Al,updateAssetTypeFieldValuesMany:fl,deleteAssetTypeFieldValues:Sl,deleteAssetTypeFieldValuesMany:Tl}=Ls.actions,Il=t=>t.assetTypeFieldValuesReducer.instances,St=u.createSelector([Il],t=>Object.values(t)),EF=f(u.createSelector([St,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset===s)))),VF=f(u.createSelector([dt,St,(t,s)=>s],(t,s,e)=>{const a=new Set(t.filter(n=>n.asset_type===e).map(n=>n.uuid));return S(s.filter(n=>a.has(n.fields_revision)))})),Ol=t=>s=>s.assetTypeFieldValuesReducer.instances[t],Fl=f(u.createSelector([St,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),Pl=Ls.reducer,ce=P(t=>t.uuid),gl={instances:{}},Gs=u.createSlice({name:"assetTypeIdentifiers",initialState:gl,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,gl)),reducers:{initializeAssetTypeIdentifiers:ce.initialize,addAssetTypeIdentifier:ce.addOne,addAssetTypeIdentifiers:ce.addMany,setAssetTypeIdentifier:ce.setOne,setAssetTypeIdentifiers:ce.setMany,updateAssetTypeIdentifier:ce.updateOne,updateAssetTypeIdentifiers:ce.updateMany,deleteAssetTypeIdentifier:ce.deleteOne,deleteAssetTypeIdentifiers:ce.deleteMany}}),{initializeAssetTypeIdentifiers:bl,addAssetTypeIdentifier:_l,addAssetTypeIdentifiers:Ml,setAssetTypeIdentifier:Rl,setAssetTypeIdentifiers:wl,updateAssetTypeIdentifier:vl,updateAssetTypeIdentifiers:El,deleteAssetTypeIdentifier:Vl,deleteAssetTypeIdentifiers:zl}=Gs.actions,Bl=t=>t.assetTypeIdentifierReducer.instances,ks=u.createSelector([Bl],t=>Object.values(t)),jl=t=>s=>s.assetTypeIdentifierReducer.instances[t],ql=f(u.createSelector([ks,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),zF=f(u.createSelector([ks,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_type===s)))),$l=Gs.reducer,de=P(t=>t.uuid),Dl={instances:{}},Ns=u.createSlice({name:"assetTypeIdentifierValues",initialState:Dl,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,Dl)),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:Ul,addAssetTypeIdentifierValue:Cl,addAssetTypeIdentifierValues:Ll,setAssetTypeIdentifierValue:Gl,setAssetTypeIdentifierValues:kl,updateAssetTypeIdentifierValue:Nl,updateAssetTypeIdentifierValues:Hl,deleteAssetTypeIdentifierValue:Wl,deleteAssetTypeIdentifierValues:Kl}=Ns.actions,Yl=t=>t.assetTypeIdentifierValueReducer.instances,Tt=u.createSelector([Yl],t=>Object.values(t)),Zl=t=>s=>s.assetTypeIdentifierValueReducer.instances[t],Jl=f(u.createSelector([Tt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),BF=f(u.createSelector([Tt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset===s)))),jF=f(u.createSelector([Tt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_type_identifier===s)))),Xl=Ns.reducer,re=P(t=>t.uuid),Ql={instances:{}},Hs=u.createSlice({name:"assetTypes",initialState:Ql,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,Ql)),reducers:{initializeAssetTypes:re.initialize,setAssetType:re.setOne,setAssetTypes:re.setMany,addAssetType:re.addOne,addAssetTypes:re.addMany,updateAssetType:re.updateOne,updateAssetTypes:re.updateMany,deleteAssetType:re.deleteOne,deleteAssetTypes:re.deleteMany}}),{initializeAssetTypes:xl,setAssetType:eo,setAssetTypes:to,addAssetType:so,addAssetTypes:io,updateAssetType:ao,updateAssetTypes:no,deleteAssetType:co,deleteAssetTypes:ro}=Hs.actions,uo=t=>t.assetTypeReducer.instances,Ws=u.createSelector([uo],t=>Object.values(t)),lo=t=>s=>s.assetTypeReducer.instances[t],oo=f(u.createSelector([Ws,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),qF=f(u.createSelector([Ws,(t,s)=>s],(t,s)=>S(t.filter(e=>e.organization===s)))),ho=Hs.reducer,ue=P(t=>t.uuid),mo={instances:{}},Ks=u.createSlice({name:"assetTypeStatuses",initialState:mo,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,mo)),reducers:{initializeAssetTypeStatuses:ue.initialize,addAssetTypeStatus:ue.addOne,addAssetTypeStatuses:ue.addMany,setAssetTypeStatus:ue.setOne,setAssetTypeStatuses:ue.setMany,updateAssetTypeStatus:ue.updateOne,updateAssetTypeStatuses:ue.updateMany,deleteAssetTypeStatus:ue.deleteOne,deleteAssetTypeStatuses:ue.deleteMany}}),{initializeAssetTypeStatuses:yo,addAssetTypeStatus:po,addAssetTypeStatuses:Ao,setAssetTypeStatus:fo,setAssetTypeStatuses:So,updateAssetTypeStatus:To,updateAssetTypeStatuses:Io,deleteAssetTypeStatus:Oo,deleteAssetTypeStatuses:Fo}=Ks.actions,Po=t=>t.assetTypeStatusReducer.instances,Ys=u.createSelector([Po],t=>S(Object.values(t).toSorted(xa))),go=t=>s=>s.assetTypeStatusReducer.instances[t],bo=f(u.createSelector([Ys,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),$F=f(u.createSelector([Ys,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_type===s)))),_o=Ks.reducer,Mo={accessToken:"",refreshToken:"",isLoggedIn:!1},It=u.createSlice({name:"auth",initialState:Mo,extraReducers:t=>t.addCase(O,s=>Object.assign(s,Mo)),reducers:{setTokens:(t,s)=>{t.accessToken=s.payload.accessToken,t.refreshToken=s.payload.refreshToken},clearTokens:t=>{t.accessToken="",t.refreshToken=""},setLoggedIn:(t,s)=>{s.payload||It.caseReducers.clearTokens(t),t.isLoggedIn=s.payload}}}),{setTokens:DF,clearTokens:UF,setLoggedIn:Ro}=It.actions,CF=t=>t.authReducer.accessToken,LF=t=>t.authReducer.isLoggedIn,wo=It.reducer,le=P(t=>t.uuid),vo={instances:{}},Zs=u.createSlice({name:"categories",initialState:vo,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,vo)),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:Eo,addCategory:Vo,addCategories:zo,setCategory:Bo,setCategories:jo,updateCategory:qo,updateCategories:$o,deleteCategory:Do,deleteCategories:Uo}=Zs.actions,Co=t=>t.categoryReducer.instances,Js=u.createSelector([Co],t=>Object.values(t)),Xs=t=>s=>s.categoryReducer.instances[t],Lo=f(u.createSelector([Js,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),GF=f(u.createSelector([Js,(t,s)=>s],(t,s)=>S(t.filter(e=>e.project===s)))),Go=Zs.reducer,oe=P(t=>t.uuid),ko={instances:{}},Qs=u.createSlice({name:"documentAttachments",initialState:ko,extraReducers:t=>t.addCase(O,s=>Object.assign(s,ko)),reducers:{initializeDocumentAttachments:oe.initialize,addDocumentAttachment:oe.addOne,addDocumentAttachments:oe.addMany,setDocumentAttachment:oe.setOne,setDocumentAttachments:oe.setMany,updateDocumentAttachment:oe.updateOne,updateDocumentAttachments:oe.updateMany,deleteDocumentAttachment:oe.deleteOne,deleteDocumentAttachments:oe.deleteMany}}),{initializeDocumentAttachments:No,addDocumentAttachment:Ho,addDocumentAttachments:Wo,setDocumentAttachment:Ko,setDocumentAttachments:Yo,updateDocumentAttachment:Zo,updateDocumentAttachments:Jo,deleteDocumentAttachment:Xo,deleteDocumentAttachments:Qo}=Qs.actions,xo=t=>t.documentAttachmentReducer.instances,xs=u.createSelector([xo],t=>Object.values(t)),eh=t=>s=>s.documentAttachmentReducer.instances[t],th=f(u.createSelector([xs,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),kF=f(u.createSelector([xs,(t,s)=>s],(t,s)=>S(t.filter(({document:e})=>s===e)))),sh=Qs.reducer,he=P(({uuid:t})=>t),ih={instances:{}},ei=u.createSlice({name:"documents",initialState:ih,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>{Object.assign(s,ih)}),reducers:{initializeDocuments:he.initialize,addDocument:he.addOne,addDocuments:he.addMany,setDocument:he.setOne,setDocuments:he.setMany,updateDocument:he.updateOne,updateDocuments:he.updateMany,deleteDocument:he.deleteOne,deleteDocuments:he.deleteMany}}),{initializeDocuments:ah,addDocument:nh,addDocuments:ch,setDocument:dh,setDocuments:rh,updateDocument:uh,updateDocuments:lh,deleteDocument:oh,deleteDocuments:hh}=ei.actions,mh=t=>t.documentsReducer.instances,Ot=u.createSelector([mh],t=>Object.values(t)),yh=t=>s=>s.documentsReducer.instances[t],ph=f(u.createSelector([Ot,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),NF=f(u.createSelector([Ot,(t,s)=>s],(t,s)=>t.filter(e=>e.project===s))),HF=f(u.createSelector([Ot,(t,s)=>s],(t,s)=>t.filter(e=>e.organization===s))),Ah=ei.reducer,me=P(t=>t.uuid),fh={instances:{}},ti=u.createSlice({name:"emailDomains",initialState:fh,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,fh)),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:Sh,addEmailDomain:Th,addEmailDomains:Ih,setEmailDomain:Oh,setEmailDomains:Fh,updateEmailDomain:Ph,updateEmailDomains:gh,deleteEmailDomain:bh,deleteEmailDomains:_h}=ti.actions,Mh=t=>t.emailDomainsReducer.instances,si=u.createSelector([Mh],t=>Object.values(t)),Rh=t=>s=>s.emailDomainsReducer.instances[t],wh=f(u.createSelector([si,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),WF=f(u.createSelector([si,(t,s)=>s],(t,s)=>S(t.filter(e=>e.organization===s)))),vh=ti.reducer,Eh={s3Urls:{}},Vh=1e3*60*60,KF=Vh*24*7,ii=u.createSlice({name:"file",initialState:Eh,extraReducers:t=>t.addCase(O,s=>Object.assign(s,Eh)),reducers:{setUploadUrl:(t,s)=>{const{url:e,fields:a,sha1:n}=s.payload,c=new Date,d=new Date(c.getTime()+KF);t.s3Urls[n]={url:e,fields:a,exp:d.getTime()}}}}),{setUploadUrl:zh}=ii.actions,Bh=t=>s=>{const e=s.fileReducer.s3Urls[t];if(!e)return;const a=new Date().getTime();if(!((e.exp??a)-a<Vh))return e},jh=ii.reducer,ye=P(t=>t.uuid),qh={instances:{}},ai=u.createSlice({name:"formIdentifiers",initialState:qh,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,qh)),reducers:{initializeFormIdentifiers:ye.initialize,addFormIdentifier:ye.addOne,addFormIdentifiers:ye.addMany,setFormIdentifier:ye.setOne,setFormIdentifiers:ye.setMany,updateFormIdentifier:ye.updateOne,updateFormIdentifiers:ye.updateMany,deleteFormIdentifier:ye.deleteOne,deleteFormIdentifiers:ye.deleteMany}}),{initializeFormIdentifiers:$h,addFormIdentifier:Dh,addFormIdentifiers:Uh,setFormIdentifier:Ch,setFormIdentifiers:Lh,updateFormIdentifier:Gh,updateFormIdentifiers:kh,deleteFormIdentifier:Nh,deleteFormIdentifiers:Hh}=ai.actions,Wh=t=>t.formIdentifierReducer.instances,ni=u.createSelector([Wh],t=>Object.values(t)),Kh=t=>s=>s.formIdentifierReducer.instances[t],Yh=f(u.createSelector([ni,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),YF=f(u.createSelector([ni,(t,s)=>s],(t,s)=>S(t.filter(e=>e.form===s)))),Zh=ai.reducer,pe=P(t=>t.uuid),Jh={instances:{}},ci=u.createSlice({name:"formIdentifierValues",initialState:Jh,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,Jh)),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:Xh,addFormIdentifierValue:Qh,addFormIdentifierValues:xh,setFormIdentifierValue:em,setFormIdentifierValues:tm,updateFormIdentifierValue:sm,updateFormIdentifierValues:im,deleteFormIdentifierValue:am,deleteFormIdentifierValues:nm}=ci.actions,cm=t=>t.formIdentifierValueReducer.instances,Ft=u.createSelector([cm],t=>Object.values(t)),dm=t=>s=>s.formIdentifierValueReducer.instances[t],rm=f(u.createSelector([Ft,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),ZF=f(u.createSelector([Ft,(t,s)=>s],(t,s)=>S(t.filter(e=>e.form_submission===s)))),JF=f(u.createSelector([Ft,(t,s)=>s],(t,s)=>S(t.filter(e=>e.form_identifier===s)))),um=ci.reducer,Ae=P(t=>t.uuid),lm={instances:{}},di=u.createSlice({name:"formRevisionAttachments",initialState:lm,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,lm)),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:om,addFormRevisionAttachment:hm,addFormRevisionAttachments:mm,setFormRevisionAttachment:ym,setFormRevisionAttachments:pm,updateFormRevisionAttachment:Am,updateFormRevisionAttachments:fm,deleteFormRevisionAttachment:Sm,deleteFormRevisionAttachments:Tm}=di.actions,Pt=t=>t.formRevisionAttachmentReducer.instances,Im=u.createSelector([Pt],t=>Object.values(t)),Om=f(u.createSelector([Pt,(t,s)=>s],(t,s)=>t[s])),Fm=f(u.createSelector([Im,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),XF=f(u.createSelector([Pt,(t,s)=>s],(t,s)=>S(Object.values(t).filter(e=>e.form_revision===s)))),Pm=di.reducer,fe=P(t=>t.uuid),gm={instances:{}},ri=u.createSlice({name:"formRevisions",initialState:gm,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,gm)),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:bm,addFormRevision:ui,addFormRevisions:li,setFormRevision:_m,setFormRevisions:Mm,updateFormRevision:Rm,updateFormRevisions:wm,deleteFormRevision:oi,deleteFormRevisions:hi}=ri.actions,mi=t=>t.formRevisionReducer.instances,gt=u.createSelector([mi],t=>Object.values(t)),vm=t=>s=>s.formRevisionReducer.instances[t],Em=f(u.createSelector([gt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),QF=f(u.createSelector([gt,(t,s)=>s],(t,s)=>t.filter(e=>e.form===s).sort((e,a)=>e.submitted_at>a.submitted_at?-1:1)[0])),Vm=f(u.createSelector([gt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.form===s)))),zm=ri.reducer,Se=P(t=>t.uuid),Bm={instances:{}},yi=u.createSlice({name:"forms",initialState:Bm,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,Bm)),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:jm,addForm:qm,addForms:$m,setForm:Dm,setForms:Um,updateForm:Cm,updateForms:Lm,deleteForm:Gm,deleteForms:km}=yi.actions,Nm=yi.reducer,Hm=t=>t.formReducer.instances,pi=u.createSelector([Hm],t=>Object.values(t)),Wm=t=>s=>s.formReducer.instances[t],Km=f(u.createSelector([pi,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),xF=f(u.createSelector([pi,(t,s)=>s],(t,s)=>S(t.filter(e=>e.organization===s)))),Te=P(t=>t.uuid),Ym={instances:{}},Ai=u.createSlice({name:"formSubmissionAttachments",initialState:Ym,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,Ym)),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:Zm,addFormSubmissionAttachment:Jm,addFormSubmissionAttachments:fi,setFormSubmissionAttachment:Xm,setFormSubmissionAttachments:Qm,updateFormSubmissionAttachment:xm,updateFormSubmissionAttachments:ey,deleteFormSubmissionAttachment:ty,deleteFormSubmissionAttachments:Si}=Ai.actions,Ti=t=>t.formSubmissionAttachmentReducer.instances,Ii=u.createSelector([Ti],t=>Object.values(t)),sy=f(u.createSelector([Ti,(t,s)=>s],(t,s)=>t[s])),Oi=f(u.createSelector([Ii,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(a=>e.has(a.uuid)))})),iy=Oi,ay=f(u.createSelector([Ii,(t,s)=>s],(t,s)=>S(t.filter(e=>e.form_submission===s)))),ny=Ai.reducer,Ie=P(t=>t.uuid),cy={instances:{}},Fi=u.createSlice({name:"formSubmissions",initialState:cy,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,cy)),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:dy,setFormSubmission:ry,setFormSubmissions:uy,addFormSubmission:ly,addFormSubmissions:Pi,updateFormSubmission:oy,updateFormSubmissions:hy,deleteFormSubmission:my,deleteFormSubmissions:gi}=Fi.actions,bi=t=>t.formSubmissionReducer.instances,yy=u.createSelector([bi],t=>Object.values(t)),py=t=>s=>s.formSubmissionReducer.instances[t],Ay=f(u.createSelector([yy,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),fy=f(u.createSelector([bi,mi,(t,s)=>s],(t,s,e)=>{const a=new Set;for(const n of Object.values(s))n.form===e&&a.add(n.uuid);return Object.values(t).filter(n=>a.has(n.form_revision))})),Sy=Fi.reducer,Oe=P(t=>t.uuid),Ty={instances:{}},_i=u.createSlice({name:"geoImages",initialState:Ty,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,Ty)),reducers:{initializeGeoImages:Oe.initialize,setGeoImage:Oe.setOne,setGeoImages:Oe.setMany,addGeoImage:Oe.addOne,addGeoImages:Oe.addMany,updateGeoImage:Oe.updateOne,updateGeoImages:Oe.updateMany,deleteGeoImage:Oe.deleteOne,deleteGeoImages:Oe.deleteMany}}),{initializeGeoImages:Iy,setGeoImage:Oy,setGeoImages:Fy,addGeoImage:Py,addGeoImages:gy,updateGeoImage:by,updateGeoImages:_y,deleteGeoImage:My,deleteGeoImages:Ry}=_i.actions,wy=t=>t.geoImageReducer.instances,Mi=u.createSelector([wy],t=>Object.values(t)),vy=t=>s=>s.geoImageReducer.instances[t],Ey=f(u.createSelector([Mi,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),eP=f(u.createSelector([Mi,(t,s)=>s],(t,s)=>S(t.filter(e=>e.project===s)))),Vy=_i.reducer,Fe=P(t=>t.uuid),zy={instances:{}},Ri=u.createSlice({name:"issueAssociations",initialState:zy,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,zy)),reducers:{initializeIssueAssociations:Fe.initialize,addIssueAssociation:Fe.addOne,addIssueAssociations:Fe.addMany,setIssueAssociation:Fe.setOne,setIssueAssociations:Fe.setMany,updateIssueAssociation:Fe.updateOne,updateIssueAssociations:Fe.updateMany,deleteIssueAssociation:Fe.deleteOne,deleteIssueAssociations:Fe.deleteMany}}),{initializeIssueAssociations:By,setIssueAssociations:jy,setIssueAssociation:qy,updateIssueAssociation:$y,updateIssueAssociations:Dy,addIssueAssociation:Uy,addIssueAssociations:bt,deleteIssueAssociation:Cy,deleteIssueAssociations:_t}=Ri.actions,rt=t=>t.issueAssociationReducer.instances,Ly=u.createSelector([rt],t=>Object.values(t)),Gy=t=>s=>s.issueAssociationReducer.instances[t],ky=f(u.createSelector([Ly,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),Ny=f(u.createSelector([rt,(t,s)=>s],(t,s)=>S(Object.values(t).filter(e=>e.associated_issue===s)))),Hy=f(u.createSelector([rt,(t,s)=>s],(t,s)=>S(Object.values(t).filter(e=>e.issue===s)))),Wy=f(u.createSelector([rt,(t,s)=>s],(t,s)=>S(Object.values(t).filter(e=>e.asset===s)))),Ky=Ri.reducer,Pe=P(t=>t.uuid),Yy={instances:{}},wi=u.createSlice({name:"issueAttachments",initialState:Yy,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,Yy)),reducers:{initializeIssueAttachments:Pe.initialize,addIssueAttachment:Pe.addOne,addIssueAttachments:Pe.addMany,setIssueAttachment:Pe.setOne,setIssueAttachments:Pe.setMany,updateIssueAttachment:Pe.updateOne,updateIssueAttachments:Pe.updateMany,deleteIssueAttachment:Pe.deleteOne,deleteIssueAttachments:Pe.deleteMany}}),{initializeIssueAttachments:Zy,addIssueAttachment:Jy,addIssueAttachments:vi,setIssueAttachment:Xy,setIssueAttachments:Qy,updateIssueAttachment:xy,updateIssueAttachments:ep,deleteIssueAttachment:tp,deleteIssueAttachments:Ei}=wi.actions,sp=t=>t.issueAttachmentReducer.instances,Vi=u.createSelector([sp],t=>Object.values(t)),ip=f(u.createSelector([Vi,(t,s)=>s],(t,s)=>S(t.filter(({issue:e})=>s===e)))),ap=t=>s=>s.issueAttachmentReducer.instances[t],np=f(u.createSelector([Vi,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),cp=wi.reducer,ge=P(t=>t.uuid),dp={instances:{}},zi=u.createSlice({name:"issueCommentAttachments",initialState:dp,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,dp)),reducers:{initializeIssueCommentAttachments:ge.initialize,addIssueCommentAttachment:ge.addOne,addIssueCommentAttachments:ge.addMany,setIssueCommentAttachment:ge.setOne,setIssueCommentAttachments:ge.setMany,updateIssueCommentAttachment:ge.updateOne,updateIssueCommentAttachments:ge.updateMany,deleteIssueCommentAttachment:ge.deleteOne,deleteIssueCommentAttachments:ge.deleteMany}}),{initializeIssueCommentAttachments:rp,addIssueCommentAttachment:up,addIssueCommentAttachments:lp,setIssueCommentAttachment:op,setIssueCommentAttachments:hp,updateIssueCommentAttachment:mp,updateIssueCommentAttachments:yp,deleteIssueCommentAttachment:pp,deleteIssueCommentAttachments:Ap}=zi.actions,fp=t=>t.issueCommentAttachmentReducer.instances,Bi=u.createSelector([fp],t=>Object.values(t)),Sp=t=>s=>s.issueCommentAttachmentReducer.instances[t],Tp=f(u.createSelector([Bi,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),tP=f(u.createSelector([Bi,(t,s)=>s],(t,s)=>S(t.filter(({issue_comment:e})=>s===e)))),Ip=zi.reducer,be=P(t=>t.uuid),Op={instances:{}},ji=u.createSlice({name:"issueComments",initialState:Op,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,Op)),reducers:{initializeIssueComments:be.initialize,addIssueComment:be.addOne,addIssueComments:be.addMany,setIssueComment:be.setOne,setIssueComments:be.setMany,updateIssueComment:be.updateOne,updateIssueComments:be.updateMany,deleteIssueComment:be.deleteOne,deleteIssueComments:be.deleteMany}}),{initializeIssueComments:Fp,addIssueComment:Pp,addIssueComments:gp,setIssueComment:bp,setIssueComments:_p,updateIssueComment:Mp,updateIssueComments:Rp,deleteIssueComment:wp,deleteIssueComments:vp}=ji.actions,qi=t=>t.issueCommentReducer.instances,Ep=t=>s=>s.issueCommentReducer.instances[t],Vp=f(u.createSelector([qi,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(Object.values(t).filter(({uuid:a})=>e.has(a)))})),sP=f(u.createSelector([qi,(t,s)=>s],(t,s)=>S(Object.values(t).filter(e=>e.issue===s)))),zp=ji.reducer,_e=P(t=>t.uuid),Bp={instances:{}},$i=u.createSlice({name:"issues",initialState:Bp,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,Bp)),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:jp,addIssue:qp,addIssues:Di,setIssue:$p,setIssues:Dp,updateIssue:Up,updateIssues:Cp,deleteIssue:Lp,deleteIssues:Ui}=$i.actions,Gp=t=>t.issueReducer.instances,Mt=u.createSelector([Gp],t=>Object.values(t)),kp=t=>s=>s.issueReducer.instances[t],Np=f(u.createSelector([Mt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),iP=f(u.createSelector([Mt,(t,s)=>s],(t,s)=>t.filter(e=>e.project===s))),Hp=f(u.createSelector([Mt,(t,s)=>s],(t,s)=>t.filter(e=>e.issue_type===s))),Wp=$i.reducer,Me=P(t=>t.uuid),Kp={instances:{}},Ci=u.createSlice({name:"issueTypeAttachments",initialState:Kp,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,Kp)),reducers:{initializeIssueTypeAttachments:Me.initialize,addIssueTypeAttachment:Me.addOne,addIssueTypeAttachments:Me.addMany,setIssueTypeAttachment:Me.setOne,setIssueTypeAttachments:Me.setMany,updateIssueTypeAttachment:Me.updateOne,updateIssueTypeAttachments:Me.updateMany,deleteIssueTypeAttachment:Me.deleteOne,deleteIssueTypeAttachments:Me.deleteMany}}),{initializeIssueTypeAttachments:Yp,addIssueTypeAttachment:Zp,addIssueTypeAttachments:Jp,setIssueTypeAttachment:Xp,setIssueTypeAttachments:Qp,updateIssueTypeAttachment:xp,updateIssueTypeAttachments:eA,deleteIssueTypeAttachment:tA,deleteIssueTypeAttachments:sA}=Ci.actions,iA=t=>t.issueTypeAttachmentReducer.instances,Li=u.createSelector([iA],t=>Object.values(t)),aA=t=>s=>s.issueTypeAttachmentReducer.instances[t],nA=f(u.createSelector([Li,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),aP=f(u.createSelector([Li,(t,s)=>s],(t,s)=>S(t.filter(({issue_type:e})=>s===e)))),cA=Ci.reducer,Re=P(t=>t.uuid),dA={instances:{}},Gi=u.createSlice({name:"issueTypeFieldsAttachments",initialState:dA,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,dA)),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:rA,addIssueTypeFieldsAttachment:uA,addIssueTypeFieldsAttachments:lA,setIssueTypeFieldsAttachment:oA,setIssueTypeFieldsAttachments:hA,updateIssueTypeFieldsAttachment:mA,updateIssueTypeFieldsAttachments:yA,deleteIssueTypeFieldsAttachment:pA,deleteIssueTypeFieldsAttachments:AA}=Gi.actions,fA=t=>t.issueTypeFieldsAttachmentReducer.instances,ki=u.createSelector([fA],t=>Object.values(t)),nP=f(u.createSelector([ki,(t,s)=>s],(t,s)=>S(t.filter(e=>e.fields_revision===s)))),SA=t=>s=>s.issueTypeFieldsAttachmentReducer.instances[t],TA=f(u.createSelector([ki,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),IA=Gi.reducer,we=P(t=>t.uuid),OA={instances:{}},Ni=u.createSlice({name:"issueTypeFieldValues",initialState:OA,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,OA)),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:FA,addIssueTypeFieldValues:PA,addIssueTypeFieldValuesMany:gA,setIssueTypeFieldValues:bA,setIssueTypeFieldValuesMany:_A,updateIssueTypeFieldValues:MA,updateIssueTypeFieldValuesMany:RA,deleteIssueTypeFieldValues:wA,deleteIssueTypeFieldValuesMany:vA}=Ni.actions,EA=t=>t.issueTypeFieldValuesReducer.instances,Rt=u.createSelector([EA],t=>Object.values(t)),cP=f(u.createSelector([Rt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.issue===s)))),VA=t=>s=>s.issueTypeFieldValuesReducer.instances[t],zA=f(u.createSelector([Rt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),BA=Ni.reducer,ve=P(t=>t.uuid),jA={instances:{}},Hi=u.createSlice({name:"issueTypeFields",initialState:jA,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,jA)),reducers:{initializeIssueTypeFields:ve.initialize,addIssueTypeFields:ve.addOne,addIssueTypeFieldsMany:ve.addMany,setIssueTypeFields:ve.setOne,setIssueTypeFieldsMany:ve.setMany,updateIssueTypeFields:ve.updateOne,updateIssueTypeFieldsMany:ve.updateMany,deleteIssueTypeFields:ve.deleteOne,deleteIssueTypeFieldsMany:ve.deleteMany}}),{initializeIssueTypeFields:qA,addIssueTypeFields:$A,addIssueTypeFieldsMany:DA,setIssueTypeFields:UA,setIssueTypeFieldsMany:CA,updateIssueTypeFields:LA,updateIssueTypeFieldsMany:GA,deleteIssueTypeFields:kA,deleteIssueTypeFieldsMany:NA}=Hi.actions,HA=t=>t.issueTypeFieldsReducer.instances,ut=u.createSelector([HA],t=>Object.values(t)),dP=f(u.createSelector([ut,(t,s)=>s],(t,s)=>S(t.filter(e=>e.issue_type===s)))),rP=f(u.createSelector([ut,(t,s)=>s],(t,s)=>t.filter(e=>e.issue_type===s).sort((e,a)=>e.submitted_at>a.submitted_at?-1:1)[0])),uP=f(u.createSelector([ut,Rt,(t,s)=>s],(t,s,e)=>{const a=new Set(t.filter(n=>n.issue_type===e).map(n=>n.uuid));return S(s.filter(n=>a.has(n.fields_revision)))})),WA=t=>s=>s.issueTypeFieldsReducer.instances[t],KA=f(u.createSelector([ut,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),YA=Hi.reducer,Ee=P(t=>t.uuid),ZA={instances:{}},Wi=u.createSlice({name:"issueTypeFieldValuesAttachments",initialState:ZA,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,ZA)),reducers:{initializeIssueTypeFieldValuesAttachments:Ee.initialize,addIssueTypeFieldValuesAttachment:Ee.addOne,addIssueTypeFieldValuesAttachments:Ee.addMany,setIssueTypeFieldValuesAttachment:Ee.setOne,setIssueTypeFieldValuesAttachments:Ee.setMany,updateIssueTypeFieldValuesAttachment:Ee.updateOne,updateIssueTypeFieldValuesAttachments:Ee.updateMany,deleteIssueTypeFieldValuesAttachment:Ee.deleteOne,deleteIssueTypeFieldValuesAttachments:Ee.deleteMany}}),{initializeIssueTypeFieldValuesAttachments:JA,addIssueTypeFieldValuesAttachment:XA,addIssueTypeFieldValuesAttachments:Ki,setIssueTypeFieldValuesAttachment:QA,setIssueTypeFieldValuesAttachments:xA,updateIssueTypeFieldValuesAttachment:ef,updateIssueTypeFieldValuesAttachments:tf,deleteIssueTypeFieldValuesAttachment:sf,deleteIssueTypeFieldValuesAttachments:Yi}=Wi.actions,af=t=>t.issueTypeFieldValuesAttachmentReducer.instances,Zi=u.createSelector([af],t=>Object.values(t)),nf=t=>s=>s.issueTypeFieldValuesAttachmentReducer.instances[t],cf=f(u.createSelector([Zi,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),df=f(u.createSelector([Zi,(t,s)=>s],(t,s)=>S(t.filter(e=>e.field_values===s)))),rf=Wi.reducer,Ve=P(t=>t.uuid),uf={instances:{}},Ji=u.createSlice({name:"issueTypeIdentifiers",initialState:uf,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,uf)),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:lf,addIssueTypeIdentifier:of,addIssueTypeIdentifiers:hf,setIssueTypeIdentifier:mf,setIssueTypeIdentifiers:yf,updateIssueTypeIdentifier:pf,updateIssueTypeIdentifiers:Af,deleteIssueTypeIdentifier:ff,deleteIssueTypeIdentifiers:Sf}=Ji.actions,Tf=t=>t.issueTypeIdentifierReducer.instances,Xi=u.createSelector([Tf],t=>Object.values(t)),If=t=>s=>s.issueTypeIdentifierReducer.instances[t],Of=f(u.createSelector([Xi,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),lP=f(u.createSelector([Xi,(t,s)=>s],(t,s)=>S(t.filter(e=>e.issue_type===s)))),Ff=Ji.reducer,ze=P(t=>t.uuid),Pf={instances:{}},Qi=u.createSlice({name:"issueTypeIdentifierValues",initialState:Pf,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,Pf)),reducers:{initializeIssueTypeIdentifierValues:ze.initialize,addIssueTypeIdentifierValue:ze.addOne,addIssueTypeIdentifierValues:ze.addMany,setIssueTypeIdentifierValue:ze.setOne,setIssueTypeIdentifierValues:ze.setMany,updateIssueTypeIdentifierValue:ze.updateOne,updateIssueTypeIdentifierValues:ze.updateMany,deleteIssueTypeIdentifierValue:ze.deleteOne,deleteIssueTypeIdentifierValues:ze.deleteMany}}),{initializeIssueTypeIdentifierValues:gf,addIssueTypeIdentifierValue:bf,addIssueTypeIdentifierValues:_f,setIssueTypeIdentifierValue:Mf,setIssueTypeIdentifierValues:Rf,updateIssueTypeIdentifierValue:wf,updateIssueTypeIdentifierValues:vf,deleteIssueTypeIdentifierValue:Ef,deleteIssueTypeIdentifierValues:Vf}=Qi.actions,zf=t=>t.issueTypeIdentifierValueReducer.instances,wt=u.createSelector([zf],t=>Object.values(t)),Bf=t=>s=>s.issueTypeIdentifierValueReducer.instances[t],jf=f(u.createSelector([wt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),oP=f(u.createSelector([wt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.issue===s)))),hP=f(u.createSelector([wt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.issue_type_identifier===s)))),qf=Qi.reducer,Be=P(t=>t.uuid),$f={instances:{}},xi=u.createSlice({name:"issueTypes",initialState:$f,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,$f)),reducers:{initializeIssueTypes:Be.initialize,addIssueType:Be.addOne,addIssueTypes:Be.addMany,setIssueType:Be.setOne,setIssueTypes:Be.setMany,updateIssueType:Be.updateOne,updateIssueTypes:Be.updateMany,deleteIssueType:Be.deleteOne,deleteIssueTypes:Be.deleteMany}}),{initializeIssueTypes:Df,addIssueType:Uf,addIssueTypes:Cf,setIssueType:Lf,setIssueTypes:Gf,updateIssueType:kf,updateIssueTypes:Nf,deleteIssueType:Hf,deleteIssueTypes:Wf}=xi.actions,Kf=t=>t.issueTypeReducer.instances,ea=u.createSelector(Kf,t=>Object.values(t)),Yf=t=>s=>s.issueTypeReducer.instances[t],Zf=f(u.createSelector([ea,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),mP=f(u.createSelector([ea,(t,s)=>s],(t,s)=>S(t.filter(e=>e.organization===s)))),Jf=xi.reducer,je=P(t=>t.uuid),Xf={instances:{}},ta=u.createSlice({name:"issueTypeStatuses",initialState:Xf,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,Xf)),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:Qf,addIssueTypeStatus:xf,addIssueTypeStatuses:eS,setIssueTypeStatus:tS,setIssueTypeStatuses:sS,updateIssueTypeStatus:iS,updateIssueTypeStatuses:aS,deleteIssueTypeStatus:nS,deleteIssueTypeStatuses:cS}=ta.actions,dS=t=>t.issueTypeStatusReducer.instances,sa=u.createSelector([dS],t=>S(Object.values(t).toSorted(en))),ia=t=>s=>s.issueTypeStatusReducer.instances[t],rS=f(u.createSelector([sa,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),yP=f(u.createSelector([sa,(t,s)=>s],(t,s)=>S(t.filter(e=>e.issue_type===s)))),uS=ta.reducer,qe=P(t=>t.uuid),lS={instances:{}},aa=u.createSlice({name:"issueUpdates",initialState:lS,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,lS)),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:oS,addIssueUpdate:na,addIssueUpdates:ca,setIssueUpdate:hS,setIssueUpdates:mS,updateIssueUpdate:yS,updateIssueUpdates:pS,deleteIssueUpdate:da,deleteIssueUpdates:ra}=aa.actions,ua=t=>t.issueUpdateReducer.instances,la=u.createSelector([ua],t=>Object.values(t)),AS=f(u.createSelector([ua,(t,s)=>s],(t,s)=>t[s])),fS=f(u.createSelector([la,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),SS=f(u.createSelector([la,(t,s)=>s],(t,s)=>S(t.filter(e=>e.issue===s)))),TS=aa.reducer,$e=P(t=>t.id),IS={instances:{},currentUser:null},oa=u.createSlice({name:"users",initialState:IS,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,IS)),reducers:{initializeUsers:$e.initialize,setUsers:$e.setMany,setUser:$e.setOne,addUsers:$e.addMany,addUser:$e.addOne,updateUsers:$e.updateMany,updateUser:$e.updateOne,deleteUser:$e.deleteOne,deleteUsers:$e.deleteMany,setCurrentUser:(t,s)=>{t.currentUser=s.payload},setProfilePicture:(t,s)=>{if(!t.currentUser)return;t.currentUser.profile.file=s.payload.file??null,t.currentUser.profile.file_sha1=s.payload.file_sha1??null;const e=t.instances[t.currentUser.id];if(!e)throw new Error("Unable to find current user in users slice");e.profile.file=s.payload.file??null,e.profile.file_sha1=s.payload.file_sha1??null}}}),{initializeUsers:OS,setUsers:FS,setUser:PS,addUsers:gS,addUser:ha,updateUsers:bS,updateUser:_S,deleteUser:ma,deleteUsers:MS,setCurrentUser:pP,setProfilePicture:AP}=oa.actions,RS=oa.reducer,wS=t=>t.userReducer.currentUser,ya=t=>t.userReducer.instances,vt=u.createSelector([ya],t=>Object.values(t)),Et=t=>s=>s.userReducer.instances[t],vS=f(u.createSelector([vt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({id:a})=>e.has(a)))})),De=P(t=>t.uuid),ES={instances:{}},pa=u.createSlice({name:"organizationAccess",initialState:ES,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,ES)),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:VS,addOrganizationAccess:zS,addOrganizationAccesses:BS,setOrganizationAccess:jS,setOrganizationAccesses:qS,updateOrganizationAccess:$S,updateOrganizationAccesses:DS,deleteOrganizationAccess:US,deleteOrganizationAccesses:CS}=pa.actions,LS=pa.reducer,Vt=t=>t.organizationAccessReducer.instances,GS=t=>s=>s.organizationAccessReducer.instances[t],kS=f(u.createSelector([Vt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(Object.values(t).filter(({uuid:a})=>e.has(a)))})),fP=u.createSelector([wS,Vt],(t,s)=>Object.values(s).find(a=>a.user===(t==null?void 0:t.id))??null),NS=u.createSelector([Vt],t=>{const s={};for(const e of Object.values(t))s[e.user]=e;return ht(s)}),SP=f(u.createSelector([ya,NS,(t,s)=>s],(t,s,e)=>S(Object.values(t).filter(a=>{const n=s[a.id];return!!n&&n.organization===e})))),Ue=P(t=>t.uuid),HS={instances:{}},Aa=u.createSlice({name:"organizations",initialState:HS,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,HS)),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:WS,setOrganizations:KS,setOrganization:YS,addOrganizations:ZS,addOrganization:JS,updateOrganizations:XS,updateOrganization:QS,deleteOrganization:xS,deleteOrganizations:eT}=Aa.actions,tT=t=>t.organizationReducer.instances,sT=u.createSelector([tT],t=>Object.values(t)),iT=t=>s=>s.organizationReducer.instances[t],aT=f(u.createSelector([sT,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),nT=Aa.reducer,cT=(t,s,e)=>{const a=t.uuid?t:{...t,uuid:xe.v4()};return{payload:a,type:"",meta:{offline:{effect:{timestamp:new Date().toISOString(),request:a,BASE_URL:s,serviceName:e}}}}},dT={deletedRequests:[],latestRetryTime:0},fa=u.createSlice({name:"outbox",initialState:dT,extraReducers:t=>t.addCase(O,s=>Object.assign(s,dT)),reducers:{enqueueRequest:{reducer:(t,s)=>t,prepare:t=>{console.debug("Preparing to enqueue request",t);const{BASE_URL:s,serviceName:e,...a}=t;return cT(a,s,e)}},markForDeletion(t,s){t.deletedRequests.push(s.payload)},markAsDeleted(t,s){const e=t.deletedRequests.indexOf(s.payload);e!==-1&&t.deletedRequests.splice(e,1)},_setLatestRetryTime:(t,s)=>{t.latestRetryTime=s.payload}}}),TP=t=>t.outboxReducer.deletedRequests,IP=t=>t.outboxReducer.latestRetryTime,{enqueueRequest:rT,markForDeletion:OP,markAsDeleted:uT,_setLatestRetryTime:lT}=fa.actions,oT=fa.reducer,Ce=P(t=>t.uuid),hT={instances:{}},Sa=u.createSlice({name:"projectAccess",initialState:hT,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,hT)),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:mT,addProjectAccess:yT,addProjectAccesses:pT,setProjectAccess:AT,setProjectAccesses:fT,updateProjectAccess:ST,updateProjectAccesses:TT,deleteProjectAccess:IT,deleteProjectAccesses:OT}=Sa.actions,FT=Sa.reducer,Ta=t=>t.projectAccessReducer.instances,lt=u.createSelector(Ta,t=>Object.values(t)),PT=t=>s=>s.projectAccessReducer.instances[t],gT=f(u.createSelector([lt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),FP=f(u.createSelector([Ta,(t,s)=>s],(t,s)=>S(Object.values(t).filter(e=>e.project===s)))),PP=f(u.createSelector([lt,(t,s)=>s],(t,s)=>{const e={};for(const a of t.filter(n=>n.project===s))e[a.user]=a;return e})),gP=f(u.createSelector([vt,lt,(t,s)=>s],(t,s,e)=>{const a=new Set(s.filter(n=>n.project===e).map(n=>n.user));return S(t.filter(n=>a.has(n.id)))})),Le=P(t=>t.uuid),bT={instances:{}},Ia=u.createSlice({name:"projectAttachments",initialState:bT,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,bT)),reducers:{initializeProjectAttachments:Le.initialize,addProjectAttachment:Le.addOne,addProjectAttachments:Le.addMany,setProjectAttachment:Le.setOne,setProjectAttachments:Le.setMany,updateProjectAttachment:Le.updateOne,updateProjectAttachments:Le.updateMany,deleteProjectAttachment:Le.deleteOne,deleteProjectAttachments:Le.deleteMany}}),{initializeProjectAttachments:_T,addProjectAttachment:MT,addProjectAttachments:RT,setProjectAttachment:wT,setProjectAttachments:vT,updateProjectAttachment:ET,updateProjectAttachments:VT,deleteProjectAttachment:zT,deleteProjectAttachments:BT}=Ia.actions,jT=t=>t.projectAttachmentReducer.instances,Oa=u.createSelector([jT],t=>Object.values(t)),qT=t=>s=>s.projectAttachmentReducer.instances[t],$T=f(u.createSelector([Oa,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),bP=f(u.createSelector([Oa,(t,s)=>s],(t,s)=>S(t.filter(({project:e})=>s===e)))),DT=Ia.reducer,Ge=P(t=>t.uuid),UT={instances:{},activeProjectFileId:null,isImportingProjectFile:!1},Fa=u.createSlice({name:"projectFiles",initialState:UT,extraReducers:t=>t.addMatcher(u.isAnyOf(O,E,b),s=>Object.assign(s,UT)),reducers:{initializeProjectFiles:Ge.initialize,setProjectFile:Ge.setOne,setProjectFiles:Ge.setMany,addProjectFile:Ge.addOne,addProjectFiles:Ge.addMany,updateProjectFile:Ge.updateOne,updateProjectFiles:Ge.updateMany,deleteProjectFile:Ge.deleteOne,deleteProjectFiles:Ge.deleteMany,setIsImportingProjectFile:(t,s)=>{t.isImportingProjectFile=s.payload},saveActiveProjectFileBounds:(t,s)=>{const e=t.activeProjectFileId;if(!e)throw new Error("Tried to save bounds for active project file, but no active project file was set.");if(!t.instances[e])throw new Error(`Tried to save bounds for active project file, but project file with ID ${e}
2
+ doesn't exist.`);t.instances[e].bounds=s.payload},setActiveProjectFileId:(t,s)=>{t.activeProjectFileId=s.payload}}}),{initializeProjectFiles:CT,setProjectFile:LT,setProjectFiles:GT,addProjectFile:kT,addProjectFiles:NT,updateProjectFile:HT,updateProjectFiles:WT,deleteProjectFile:KT,deleteProjectFiles:YT,setIsImportingProjectFile:ZT,setActiveProjectFileId:JT,saveActiveProjectFileBounds:XT}=Fa.actions,QT=t=>t.projectFileReducer.instances,xT=u.createSelector([QT],t=>S(Object.values(t).sort((s,e)=>s.z_index-e.z_index))),eI=t=>s=>s.projectFileReducer.instances[t],tI=f(u.createSelector([xT,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),_P=t=>t.projectFileReducer.activeProjectFileId,MP=t=>t.projectFileReducer.isImportingProjectFile,sI=Fa.reducer,ke=P(t=>t.uuid),iI={instances:{}},Pa=u.createSlice({name:"projects",initialState:iI,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,iI)),reducers:{initializeProjects:ke.initialize,setProjects:ke.setMany,setProject:ke.setOne,addProjects:ke.addMany,addProject:ke.addOne,updateProjects:ke.updateMany,updateProject:ke.updateOne,deleteProject:ke.deleteOne,deleteProjects:ke.deleteMany}}),{initializeProjects:aI,setProjects:nI,setProject:cI,addProjects:dI,addProject:rI,updateProjects:uI,updateProject:lI,deleteProject:oI,deleteProjects:hI}=Pa.actions,mI=Pa.reducer,yI=t=>t.projectReducer.instances,zt=u.createSelector([yI],t=>S(Object.values(t))),pI=t=>s=>s.projectReducer.instances[t],AI=f(u.createSelector([zt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),RP=f(u.createSelector([zt,lt,(t,s)=>s],(t,s,e)=>{const a=new Set(s.filter(n=>n.user===e).map(n=>n.project));return S(t.filter(n=>a.has(n.uuid)))})),wP=f(u.createSelector([zt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.organization===s)))),vP={isRehydrated:!1},ga=u.createSlice({name:"rehydrated",initialState:vP,reducers:{setRehydrated:(t,s)=>{t.isRehydrated=s.payload}}}),{setRehydrated:EP}=ga.actions,VP=t=>t.rehydratedReducer.isRehydrated,fI=ga.reducer,Ne=P(t=>t.uuid),SI={instances:{}},ba=u.createSlice({name:"teamMemberships",initialState:SI,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,SI)),reducers:{initializeTeamMemberships:Ne.initialize,addTeamMembership:Ne.addOne,addTeamMemberships:Ne.addMany,setTeamMembership:Ne.setOne,setTeamMemberships:Ne.setMany,updateTeamMembership:Ne.updateOne,updateTeamMemberships:Ne.updateMany,deleteTeamMembership:Ne.deleteOne,deleteTeamMemberships:Ne.deleteMany}}),{initializeTeamMemberships:TI,addTeamMembership:II,addTeamMemberships:OI,setTeamMembership:FI,setTeamMemberships:PI,updateTeamMembership:gI,updateTeamMemberships:bI,deleteTeamMembership:_I,deleteTeamMemberships:MI}=ba.actions,RI=ba.reducer,wI=t=>t.teamMembershipReducer.instances,Bt=u.createSelector([wI],t=>Object.values(t)),vI=t=>s=>s.teamMembershipReducer.instances[t],EI=f(u.createSelector([Bt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),zP=f(u.createSelector([Bt,(t,s)=>s],(t,s)=>{const e={};for(const a of t.filter(n=>n.team===s))e[a.user]=a;return e})),BP=f(u.createSelector([vt,Bt,(t,s)=>s],(t,s,e)=>{const a=new Set(s.filter(n=>n.team===e).map(n=>n.user));return S(t.filter(n=>a.has(n.id)))})),He=P(t=>t.uuid),VI={instances:{}},_a=u.createSlice({name:"teams",initialState:VI,extraReducers:t=>t.addMatcher(u.isAnyOf(O,b),s=>Object.assign(s,VI)),reducers:{initializeTeams:He.initialize,addTeam:He.addOne,addTeams:He.addMany,setTeam:He.setOne,setTeams:He.setMany,updateTeam:He.updateOne,updateTeams:He.updateMany,deleteTeam:He.deleteOne,deleteTeams:He.deleteMany}}),{initializeTeams:zI,addTeam:BI,addTeams:jI,setTeam:qI,setTeams:$I,updateTeam:DI,updateTeams:UI,deleteTeam:CI,deleteTeams:LI}=_a.actions,GI=t=>t.teamReducer.instances,Ma=u.createSelector([GI],t=>Object.values(t)),kI=t=>s=>s.teamReducer.instances[t],NI=f(u.createSelector([Ma,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:a})=>e.has(a)))})),jP=f(u.createSelector([Ma,(t,s)=>s],(t,s)=>S(t.filter(e=>e.organization===s)))),HI=_a.reducer,qP={version:0},WI=u.createSlice({name:"versioning",initialState:qP,reducers:{}}),KI=WI.reducer,Ra={outboxReducer:oT,fileReducer:jh,authReducer:wo},$P=u.combineReducers(Ra),YI={...Ra,[nt]:KI,categoryReducer:Go,assetReducer:jr,assetAttachmentReducer:On,assetStageCompletionReducer:Wr,assetStageReducer:du,assetTypeReducer:ho,assetTypeAttachmentReducer:Fu,issueReducer:Wp,issueAttachmentReducer:cp,issueTypeReducer:Jf,issueTypeAttachmentReducer:cA,organizationReducer:nT,projectReducer:mI,projectAttachmentReducer:DT,projectAccessReducer:FT,organizationAccessReducer:LS,projectFileReducer:sI,rehydratedReducer:fI,formReducer:Nm,formRevisionReducer:zm,formRevisionAttachmentReducer:Pm,formSubmissionAttachmentReducer:ny,formSubmissionReducer:Sy,formIdentifierReducer:Zh,formIdentifierValueReducer:um,userReducer:RS,emailDomainsReducer:vh,documentsReducer:Ah,documentAttachmentReducer:sh,teamReducer:HI,agentsReducer:rn,issueCommentReducer:zp,issueCommentAttachmentReducer:Ip,issueUpdateReducer:TS,geoImageReducer:Vy,issueAssociationReducer:Ky,issueTypeFieldsReducer:YA,issueTypeFieldValuesReducer:BA,issueTypeFieldsAttachmentReducer:IA,issueTypeFieldValuesAttachmentReducer:rf,issueTypeIdentifierReducer:Ff,issueTypeIdentifierValueReducer:qf,issueTypeStatusReducer:uS,assetTypeFieldsReducer:Ju,assetTypeFieldValuesReducer:Pl,assetTypeFieldsAttachmentReducer:qu,assetTypeFieldValuesAttachmentReducer:ul,assetTypeIdentifierReducer:$l,assetTypeIdentifierValueReducer:Xl,assetTypeStatusReducer:_o,assetProcedureTypeReducer:cd,assetProcedureReducer:Hc,assetProcedureTypeFieldsReducer:cc,assetProcedureTypeFieldValuesReducer:zc,assetProcedureTypeFieldsAttachmentReducer:Wn,assetProcedureTypeFieldValuesAttachmentReducer:Sc,assetProcedureTypeAttachmentReducer:Vn,assetProcedureStepFieldsAttachmentReducer:Pd,assetProcedureStepFieldsReducer:qd,assetProcedureStepFieldValuesAttachmentReducer:Zd,assetProcedureStepFieldValuesReducer:ur,assetProcedureStepReducer:Ir,teamMembershipReducer:RI},DP=u.combineReducers(YI);function UP(t,s){return FO.useMemo(t,s)}class CP{constructor(s){h(this,"operations",[]);h(this,"getData");this.getData=s}performOperations(s){let e=s;for(const a of this.operations)e=a(e);return e}filter(s,e){return this.operations.push(a=>a.filter(n=>n[s]===e)),this}exclude(s,e){return this.operations.push(a=>a.filter(n=>n[s]!==e)),this}orderBy(s){return this.operations.push(e=>[...e].sort((a,n)=>a[s]<=n[s]?1:-1)),this}reverse(){return this.operations.push(s=>[...s].reverse()),this}all(){return this.operations.push(s=>s),this}get(s,e){return u.createSelector([this.getData],a=>this.performOperations(a).find(n=>n[s]===e))}count(){return u.createSelector([this.getData],s=>this.performOperations(s).length)}first(){return u.createSelector([this.getData],s=>this.performOperations(s)[0])}last(){return u.createSelector([this.getData],s=>{const e=this.performOperations(s);return e[e.length-1]})}exists(){return u.createSelector([this.getData],s=>this.performOperations(s).length>0)}toSelector(){return u.createSelector([this.getData],s=>S(this.performOperations(s)))}}const ZI=1e4,JI=200,wa=[400,409,403,404,405,500],XI={};class QI{constructor(s){h(this,"client");h(this,"pageSize",ZI);XI[this.constructor.name]=this,this.client=s}async performRequest(s,e){return this.client.performRequest(this.host,s,this,e)}async enqueueRequest(s){return this.client.enqueueRequest(s,this.host,this.constructor.name)}async performPagination(s,e){return this.client.performPagination(this.host,s,this.pageSize,this,e)}dispatch(s){this.client.store.dispatch(s)}}const xI=()=>sO.length-1,eO=t=>(t[nt]={version:xI()},t),tO=()=>eO({}),LP=t=>(t.outboxReducer&&(t.outboxReducer.deletedRequests=[]),t),GP=t=>s=>{var e;return s===void 0&&(s={}),((e=s[nt])==null?void 0:e.version)===xI()?s:t(s)},sO=[eO,tO,tO,LP],kP=Object.fromEntries(sO.map((t,s)=>[s,GP(t)])),NP=t=>{if(t)throw t;const s=at();s?s.dispatch({type:"rehydrated/setRehydrated",payload:!0}):console.error("Client store not set")},iO=(t,s,e)=>{const a=Xe();return a?(a.addRequest(s),a.getQueue()):(console.warn("Outbox coordinator not set; cannot enqueue request yet."),[])},aO=(t,s,e)=>{const a=Xe();if(!a)return console.warn("Outbox coordinator not set; cannot dequeue request yet."),[];const c=s.meta.offlineAction.payload.uuid;return a.remove(c),a.getQueue()};async function HP(t,s){if(!s.payload)throw new Error("Received empty payload");return fO(s)}const WP={...$a,effect:HP,discard:cO,returnPromises:!0,persistCallback:NP,retry:JP,persistOptions:{storage:gO},queue:{...$a.queue,enqueue:iO,dequeue:aO,peek:(...t)=>ZP(...t)}},KP=bO(kP,nt),YP=u.compose(PO.offline(WP),KP);async function nO(t,s,e){if(s.store.getState().outboxReducer.deletedRequests.includes(t.payload.uuid))throw new Error("Request was marked for deletion");const n=XI[t.meta.offline.effect.serviceName];if(!n)throw new Error(`Service ${t.meta.offline.effect.serviceName} not found`);return za(t.meta.offline.effect.BASE_URL,t.meta.offline.effect.request,s,n,e)}function cO(t,s,e=0){var m;if(console.debug("Considering discarding request due to error:",t,`(${typeof t})`,`
3
3
  Action:`,s,`
4
- Retries:`,e),!(t instanceof Error))throw console.error("ENCOUNTERED NON-ERROR ERROR:",t,"(throwing immediately, which may lead to unexpected behavior)"),t;const a=at(),c=a.getState().outboxReducer.deletedRequests,d=s.payload.uuid;function r(){a.dispatch(uT(d));const l=Xe();if(!l)throw new Error("Outbox coordinator not set");l.remove(s.payload.uuid);const p=s.meta.offline.rollback;throw p&&(console.warn("Rolling back request due to SDK error:",s),a.dispatch(p)),t}if(t instanceof q&&t.options.discard&&(console.debug("Discarding request due to explicit discard:",s),r()),c.includes(d)&&(console.debug("Discarding request due to deletion:",s),r()),t instanceof q){const l=t.status||((m=t.response)==null?void 0:m.status);if(l||console.warn("Error has no status code:",t),l!==void 0&&wa.includes(l)){console.warn("Discarding request due to error:",t,`
4
+ Retries:`,e),!(t instanceof Error))throw console.error("ENCOUNTERED NON-ERROR ERROR:",t,"(throwing immediately, which may lead to unexpected behavior)"),t;const a=at(),c=a.getState().outboxReducer.deletedRequests,d=s.payload.uuid;function r(){a.dispatch(uT(d));const l=Xe();if(!l)throw new Error("Outbox coordinator not set");l.remove(s.payload.uuid);const p=s.meta.offline.rollback;throw p&&(console.warn("Rolling back request due to SDK error:",s),a.dispatch(p)),t}if(t instanceof j&&t.options.discard&&(console.debug("Discarding request due to explicit discard:",s),r()),c.includes(d)&&(console.debug("Discarding request due to deletion:",s),r()),t instanceof j){const l=t.status||((m=t.response)==null?void 0:m.status);if(l||console.warn("Error has no status code:",t),l!==void 0&&wa.includes(l)){console.warn("Discarding request due to error:",t,`
5
5
  Action:`,s);const p=Xe();if(!p)throw new Error("Outbox coordinator not set");p.remove(s.payload.uuid),t.options.discard=!0,r()}}console.debug("Registering a retry for request:",s.payload.uuid);const o=Xe();if(!o)throw new Error("Outbox coordinator not set");return o.registerRetry(s.payload.uuid),!1}function ZP(t,s,e){var a;return(a=Xe())==null?void 0:a.peek()}function JP(t,s){return at().dispatch(lT(new Date().getTime())),Na}const tt="An unknown error occurred",XP=500,dO=["non_field_errors","detail"];function QP(t,s){let e;if(t!=null&&t.body)if(typeof t.body=="object"){const a=t.body;if(typeof a.error=="string")e=a.error;else if(typeof a.message=="string")e=a.message;else try{e=Object.entries(a).map(([n,c])=>typeof c=="string"?dO.includes(n)?c:`${n}: ${c}`:Array.isArray(c)?dO.includes(n)?c.join(`
6
6
  `):c.map(d=>`${n}: ${d}`).join(`
7
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"&&(e=t.body);else t!=null&&t.text?e=t.text:s instanceof Error&&(e=s.message);return!e||e.length>XP?tt:e}class q extends Error{constructor(e){super(tt);h(this,"status");h(this,"response");h(this,"message");h(this,"options");const{response:a,innerError:n}=e;this.message=e.message??QP(a,n)??tt,this.status=(a==null?void 0:a.status)??0,this.response=a,e.discard=e.discard??!1,this.options=e}}function rO(t){function s(e){return typeof e=="object"&&e!==null&&["ok","redirect","clientError","serverError","error"].every(n=>n in e)}if(s(t))return t;if(typeof t=="object"&&t!==null){const e=t;if(s(e.response))return e.response;if(e.response&&s(e.response.response))return e.response.response}}class xP extends QI{constructor(s){super(s)}}class Ze extends QI{constructor(e,a){super(e);h(this,"auth");this.auth=a}}class eg extends Ze{async startConversation(s,e){return this.enqueueRequest({description:"Start agent conversation",method:y.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:e},blockers:["prompt"],blocks:["prompt"]}).then(a=>(this.dispatch(nn(a)),a))}async continueConversation(s,e,a){return this.enqueueRequest({description:"Prompt agent",method:y.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:a},blockers:["prompt"],blocks:["prompt"],queryParams:{conversation_id:e}}).then(n=>{this.dispatch(dn(n))})}async fetchDetails(s){return this.enqueueRequest({description:"Get agent conversation",method:y.GET,url:`/agents/conversations/${s}/`,blockers:["conversation"],blocks:["conversation"]}).then(e=>{this.dispatch(cn(e))})}async rate(s,e){return this.enqueueRequest({description:"Rate agent response",method:y.PUT,url:`/agents/responses/${s}/rate/`,payload:{rating:e},blockers:["rate"],blocks:["rate"]})}async refreshStore(s,e){const a=await this.performRequest({method:y.GET,url:"/agents/conversations/",queryParams:{project:s}},e);return this.dispatch(an(a)),a}}class w extends Ze{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:y.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:y.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:y.GET,...s},e)}}class z extends w{constructor(){super(...arguments);h(this,"pageSize",JI)}async _bulkAdd(e){var T;const{store:a}=this.client,{addMany:n,updateMany:c,deleteMany:d}=this.actions,r=((T=a.getState().userReducer.currentUser)==null?void 0:T.id)??null,o=new Date().toISOString(),m=[],l=[],p={};for(const I of e){const{modelUuid:_,file:M}=I,g=await this.client.files.getFilePayload(M);g.sha1 in p||(p[g.sha1]=g);const v=this.buildModel({file:M,file_sha1:g.sha1,submitted_at:o,created_by:r,modelUuid:_});m.push(v),l.push(this.buildPayload(v,g))}this.dispatch(n(m));const A=this.enqueueRequest({description:`Add ${this.name}`,method:y.POST,url:`${this.url}/bulk/`,payload:{submitted_at:o,attachments:l,files:Object.values(p)},blocks:m.map(I=>this.getId(I)),blockers:m.map(I=>I.file_sha1)});return A.then(({attachments:I,presigned_urls:_})=>{this.dispatch(c(I)),this.client.files.processPresignedUrls(_)}).catch(()=>{this.dispatch(d(m.map(I=>this.getId(I))))}),[m,A.then(({attachments:I})=>I)]}async _delete(e){const{store:a}=this.client,{addOne:n,deleteOne:c}=this.actions,{selectById:d}=this.selectors,r=d(e)(a.getState());if(!r)throw new Error(`Attempting to delete attachment with uuid ${e} that does not exist in the store`);this.dispatch(c(this.getId(r)));const o=this.enqueueRequest({description:`Delete ${this.name}`,method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return o.then(()=>{this.client.files.removeCache(r.file_sha1)}).catch(()=>{this.dispatch(n(r))}),o}}class tg extends z{constructor(){super(...arguments);h(this,"name","Asset attachment");h(this,"url","/asset-attachments");h(this,"actions",{addOne:on,addMany:Wt,setOne:hn,setMany:mn,updateOne:yn,updateMany:pn,deleteOne:An,deleteMany:Kt,initialize:ln});h(this,"selectors",{selectById:Sn,selectByIds:Tn})}getId(e){return e.uuid}buildModel(e){return F({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,asset:e.modelUuid})}buildPayload(e,a){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:a.extension,asset:e.asset}}async bulkAdd(e){return this._bulkAdd(e.map(a=>({modelUuid:a.assetUuid,file:a.file})))}async delete(e){return this._delete(e)}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{asset__project:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class sg extends z{constructor(){super(...arguments);h(this,"name","Asset Procedure Attachment");h(this,"url","/asset-procedure-type-attachments");h(this,"actions",{addOne:gn,addMany:bn,setOne:_n,setMany:Mn,updateOne:Rn,updateMany:wn,deleteOne:vn,deleteMany:En,initialize:Pn});h(this,"selectors",{selectById:Bn,selectByIds:jn})}getId(e){return e.uuid}buildModel(e){return F({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,asset_procedure_type:e.modelUuid})}buildPayload(e,a){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:a.extension,asset_procedure_type:e.asset_procedure_type}}async bulkAdd(e){return this._bulkAdd(e.map(a=>({modelUuid:a.assetProcedureTypeUuid,file:a.file})))}async delete(e){return this._delete(e)}async refreshStore(e,a){const{initialize:n}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},a);return this.dispatch(n(c)),c}}class ig extends z{constructor(){super(...arguments);h(this,"name","Asset Procedure Type Fields Attachment");h(this,"url","/asset-procedure-type-fields-attachments");h(this,"actions",{addOne:Dn,addMany:Un,setOne:Cn,setMany:Ln,updateOne:Gn,updateMany:kn,deleteOne:Nn,deleteMany:Hn,initialize:$n});h(this,"selectors",{selectById:Yn,selectByIds:Zn})}async bulkAdd(e){var m;const a=new Date().toISOString(),n=((m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id)??null,c={},d=[],r=[];for(const l of e){const{fieldsRevisionUuid:p,fieldIdentifier:A,file:T}=l,I=await this.client.files.getFilePayload(T);I.sha1 in c||(c[I.sha1]=I);const _=F({file:URL.createObjectURL(T),file_type:T.type,file_name:T.name,file_sha1:I.sha1,created_by:n,fields_revision:p,submitted_at:a,field_identifier:A});d.push(_);const M={uuid:_.uuid,file_name:T.name,field_identifier:A,file_extension:I.extension,file_sha1:I.sha1,fields_revision:p};r.push(M)}this.dispatch(this.actions.addMany(d));const o=this.enqueueRequest({description:"Add asset procedure type fields attachments",method:y.POST,url:`${this.url}/bulk/`,payload:{submitted_at:a,attachments:r,files:Object.values(c)},blockers:d.map(l=>l.fields_revision),blocks:d.map(l=>l.uuid)});return o.then(l=>{this.client.files.processPresignedUrls(l.presigned_urls),this.dispatch(this.actions.setMany(l.attachments))}).catch(()=>{this.dispatch(this.actions.deleteMany(d.map(l=>l.uuid)))}),[d,o.then(({attachments:l})=>l)]}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{fields_revision__asset_procedure_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class ag extends w{constructor(){super(...arguments);h(this,"name","Asset Procedure Type Fields");h(this,"url","/asset-procedure-type-fields");h(this,"actions",{addOne:Qn,addMany:xn,setOne:ec,setMany:tc,updateOne:sc,updateMany:ic,deleteOne:ac,deleteMany:nc,initialize:Xn});h(this,"selectors",{selectById:rc,selectByIds:uc})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Add Asset Procedure Type Fields",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[d.asset_procedure_type],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(m=>{throw this.dispatch(this.actions.deleteOne(d.uuid)),m}),[d,r]}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{asset_procedure_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}function Je(t,s){const e=[];let a=0;const n=t.length;for(;a<n;)e.push(t.slice(a,a+=s));return e}class ng extends z{constructor(){super(...arguments);h(this,"name","Asset Procedure Type Field Values Attachment");h(this,"url","/asset-procedure-type-field-values-attachments");h(this,"actions",{addOne:hc,addMany:ts,setOne:mc,setMany:yc,updateOne:pc,updateMany:Ac,deleteOne:fc,deleteMany:ss,initialize:oc});h(this,"selectors",{selectById:Ic,selectByIds:Oc})}async bulkAdd(e,a){var l;const n=new Date().toISOString(),c=((l=this.client.store.getState().userReducer.currentUser)==null?void 0:l.id)??null,d=Je(e,a??e.length),r=[],o=[];for(const p of d){const A={},T=[];for(const I of p){const{fieldValuesUuid:_,fieldIdentifier:M,file:g}=I,v=await this.client.files.getFilePayload(g);v.sha1 in A||(A[v.sha1]=v);const V=F({file:URL.createObjectURL(g),file_type:g.type,file_name:g.name,file_sha1:v.sha1,created_by:c,field_values:_,submitted_at:n,field_identifier:M});r.push(V);const Ke={uuid:V.uuid,file_name:g.name,file_sha1:v.sha1,file_extension:v.extension,field_identifier:M,field_values:_};T.push(Ke)}o.push({submitted_at:n,attachments:T,files:Object.values(A)})}this.dispatch(this.actions.addMany(r));const m=o.map(p=>this.enqueueRequest({description:"Add asset procedure type field values attachments",method:y.POST,url:`${this.url}/bulk/`,payload:p,blockers:p.attachments.map(A=>A.field_values),blocks:p.attachments.map(A=>A.uuid)}));return Promise.all(m).then(p=>{for(const T of p)this.client.files.processPresignedUrls(T.presigned_urls);const A=p.flatMap(T=>T.attachments);this.dispatch(this.actions.setMany(A))}).catch(p=>{throw this.dispatch(this.actions.deleteMany(r.map(A=>A.uuid))),p}),[r,m.map(p=>p.then(({attachments:A})=>A))]}async bulkDelete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectByIds(e)(n);this.dispatch(this.actions.deleteMany(e));try{await this.enqueueRequest({description:"Delete asset procedure type field values attachments",method:y.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(this.actions.addMany(c)),d}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{field_values__asset_procedure__project:e,latest:!0}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class cg extends w{constructor(){super(...arguments);h(this,"name","Asset Procedure Type Field Values");h(this,"url","/asset-procedure-type-field-values");h(this,"actions",{addOne:bc,addMany:_c,setOne:Mc,setMany:Rc,updateOne:wc,updateMany:vc,deleteOne:Ec,deleteMany:Vc,initialize:gc});h(this,"selectors",{selectById:jc,selectByIds:qc})}add(e){var m;const{store:a}=this.client,c=((m=a.getState().userReducer.currentUser)==null?void 0:m.id)??null,d=new Date().toISOString(),r=F({...e,created_by:c,submitted_at:d}),o=this.enqueueRequest({description:"Add asset procedure type field values",method:y.POST,url:`${this.url}/`,payload:R(r),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[r.uuid]});return this.dispatch(this.actions.addOne(r)),o.then(l=>(this.dispatch(this.actions.setOne(l)),l)).catch(()=>{this.dispatch(this.actions.deleteOne(r.uuid))}),[r,o]}bulkAdd(e,a){var l;const n=new Date().toISOString(),c=((l=this.client.store.getState().userReducer.currentUser)==null?void 0:l.id)??null,d=[],r=Je(e.payloads,a??e.payloads.length),o=[];for(const p of r){const A=[];for(const T of p){const I=F({...T,values:T.values,created_by:c,submitted_at:n});d.push(I),A.push({uuid:I.uuid,asset:T.asset,fields_revision:T.fields_revision,asset_procedure:T.asset_procedure,published_at:T.published_at,values:I.values})}o.push({submitted_at:n,values:e.values,field_values:A})}this.dispatch(this.actions.addMany(d));const m=[];for(const p of o){const A=p.field_values.map(g=>g.asset),T=p.field_values.map(g=>g.fields_revision),I=p.field_values.map(g=>g.asset_procedure),_=p.field_values.map(g=>g.uuid),M=this.enqueueRequest({description:"Bulk add asset procedure type field values",method:y.POST,url:`${this.url}/bulk/`,payload:p,blockers:[...A,...T,...I],blocks:_});m.push(M)}return Promise.all(m).then(p=>{this.dispatch(this.actions.setMany(p.flat()))}).catch(()=>{this.dispatch(this.actions.deleteMany(d.map(p=>p.uuid)))}),[d,m]}update(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e.uuid)(n);if(!c)throw new Error(`Expected AssetProcedureTypeFieldValues with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(this.actions.setOne(d));const r=this.enqueueRequest({description:"Update asset procedure type field values",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.fields_revision,d.asset,d.asset_procedure],blocks:[d.uuid]});return r.then(o=>{this.dispatch(this.actions.setOne(o))}).catch(()=>{this.dispatch(this.actions.setOne(c))}),[d,r]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const d=Fc(e)(n);this.dispatch(this.actions.deleteOne(e)),this.dispatch(ss(d.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset procedure type field values",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(this.actions.addOne(c)),this.dispatch(ts(d)),r}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{asset_procedure__project:e,latest:!0}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class dg extends w{constructor(){super(...arguments);h(this,"name","Asset Procedure");h(this,"url","/asset-procedures");h(this,"actions",{addOne:Uc,addMany:cs,setOne:kc,setMany:Nc,updateOne:Cc,updateMany:Lc,deleteOne:Gc,deleteMany:ds,initialize:Dc});h(this,"selectors",{selectById:Yc,selectByIds:Zc})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create asset procedure",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[e.asset_procedure_type,e.asset_type],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`Expected asset procedure with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update asset procedure",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}async remove(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected asset procedure with uuid ${e} to exist`);return this.dispatch(this.actions.deleteOne(e)),this.enqueueRequest({description:"Delete asset procedure",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]}).catch(d=>{throw this.dispatch(this.actions.addOne(c)),d})}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{project:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class rg extends w{constructor(){super(...arguments);h(this,"name","Asset Procedure Type");h(this,"url","/asset-procedure-types");h(this,"actions",{addOne:Qc,addMany:xc,setOne:ad,setMany:nd,updateOne:ed,updateMany:td,deleteOne:sd,deleteMany:id,initialize:Xc});h(this,"selectors",{selectById:rd,selectByIds:ud})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create asset procedure type",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`Expected asset procedure type with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update asset procedure type",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}async remove(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected asset procedure type with uuid ${e} to exist`);const d=Kc(e)(n);return this.dispatch(this.actions.deleteOne(e)),this.dispatch(ds(d.map(({uuid:r})=>r))),this.enqueueRequest({description:"Delete asset procedure type",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]}).catch(r=>{throw this.dispatch(this.actions.addOne(c)),this.dispatch(cs(d)),r})}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class ug extends z{constructor(){super(...arguments);h(this,"name","Asset Procedure Step Fields Attachment");h(this,"url","/asset-procedure-step-fields-attachments");h(this,"actions",{addOne:hd,addMany:md,setOne:yd,setMany:pd,updateOne:Ad,updateMany:fd,deleteOne:Sd,deleteMany:Td,initialize:od});h(this,"selectors",{selectById:Od,selectByIds:Fd})}async bulkAdd(e){var m;const a=new Date().toISOString(),n=((m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id)??null,c={},d=[],r=[];for(const l of e){const{fieldsRevisionUuid:p,fieldIdentifier:A,file:T}=l,I=await this.client.files.getFilePayload(T);I.sha1 in c||(c[I.sha1]=I);const _=F({file:URL.createObjectURL(T),file_type:T.type,file_name:T.name,file_sha1:I.sha1,created_by:n,fields_revision:p,submitted_at:a,field_identifier:A});d.push(_);const M={uuid:_.uuid,file_name:T.name,field_identifier:A,file_extension:I.extension,file_sha1:I.sha1,fields_revision:p};r.push(M)}this.dispatch(this.actions.addMany(d));const o=this.enqueueRequest({description:"Add asset procedure step fields attachments",method:y.POST,url:`${this.url}/bulk/`,payload:{submitted_at:a,attachments:r,files:Object.values(c)},blockers:d.map(l=>l.fields_revision),blocks:d.map(l=>l.uuid)});return o.then(l=>{this.client.files.processPresignedUrls(l.presigned_urls),this.dispatch(this.actions.setMany(l.attachments))}).catch(()=>{this.dispatch(this.actions.deleteMany(d.map(l=>l.uuid)))}),[d,o.then(({attachments:l})=>l)]}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{fields_revision__asset_procedure_step__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class lg extends w{constructor(){super(...arguments);h(this,"name","Asset Procedure Step Fields");h(this,"url","/asset-procedure-step-fields");h(this,"actions",{addOne:_d,addMany:Md,setOne:Rd,setMany:wd,updateOne:vd,updateMany:Ed,deleteOne:Vd,deleteMany:zd,initialize:bd});h(this,"selectors",{selectById:Bd,selectByIds:jd})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Add Asset Procedure Step Fields",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[d.asset_procedure_step],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(m=>{throw this.dispatch(this.actions.deleteOne(d.uuid)),m}),[d,r]}update(e){const{store:a}=this.client,n=a.getState().assetProcedureStepFieldsReducer.instances[e.uuid];if(!n)throw new Error(`AssetProcedureStepFields with uuid ${e.uuid} not found`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update Asset Procedure Step Fields",method:y.PATCH,url:`${this.url}/${n.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(r=>{throw this.dispatch(this.actions.setOne(n)),r}),[c,d]}delete(e){const{store:a}=this.client,n=a.getState().assetProcedureStepFieldsReducer.instances[e];if(!n)throw new Error(`AssetProcedureStepFields with uuid ${e} not found`);this.dispatch(this.actions.deleteOne(e));const c=this.enqueueRequest({description:"Delete Asset Procedure Step Fields",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]});return c.catch(d=>{throw this.dispatch(this.actions.addOne(n)),d}),c}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{asset_procedure_step__asset_procedure_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class og extends z{constructor(){super(...arguments);h(this,"name","Asset Procedure Step Field Values Attachment");h(this,"url","/asset-procedure-step-field-values-attachments");h(this,"actions",{addOne:Ud,addMany:ps,setOne:Cd,setMany:Ld,updateOne:Gd,updateMany:kd,deleteOne:Nd,deleteMany:As,initialize:Dd});h(this,"selectors",{selectById:Wd,selectByIds:Kd})}async bulkAdd(e,a){var l;const n=new Date().toISOString(),c=((l=this.client.store.getState().userReducer.currentUser)==null?void 0:l.id)??null,d=Je(e,a??e.length),r=[],o=[];for(const p of d){const A={},T=[];for(const I of p){const{fieldValuesUuid:_,fieldIdentifier:M,file:g}=I,v=await this.client.files.getFilePayload(g);v.sha1 in A||(A[v.sha1]=v);const V=F({file:URL.createObjectURL(g),file_type:g.type,file_name:g.name,file_sha1:v.sha1,created_by:c,field_values:_,submitted_at:n,field_identifier:M});r.push(V);const Ke={uuid:V.uuid,file_name:g.name,file_sha1:v.sha1,file_extension:v.extension,field_identifier:M,field_values:_};T.push(Ke)}o.push({submitted_at:n,attachments:T,files:Object.values(A)})}this.dispatch(this.actions.addMany(r));const m=o.map(p=>this.enqueueRequest({description:"Add asset procedure step field values attachments",method:y.POST,url:`${this.url}/bulk/`,payload:p,blockers:p.attachments.map(A=>A.field_values),blocks:p.attachments.map(A=>A.uuid)}));return Promise.all(m).then(p=>{for(const T of p)this.client.files.processPresignedUrls(T.presigned_urls);const A=p.flatMap(T=>T.attachments);this.dispatch(this.actions.setMany(A))}).catch(p=>{throw this.dispatch(this.actions.deleteMany(r.map(A=>A.uuid))),p}),[r,m.map(p=>p.then(({attachments:A})=>A))]}async bulkDelete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectByIds(e)(n);this.dispatch(this.actions.deleteMany(e));try{await this.enqueueRequest({description:"Delete asset procedure step field values attachments",method:y.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(this.actions.addMany(c)),d}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{field_values__asset_procedure__project:e,latest:!0}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class hg extends w{constructor(){super(...arguments);h(this,"name","Asset Procedure Step Field Values");h(this,"url","/asset-procedure-step-field-values");h(this,"actions",{addOne:Qd,addMany:xd,setOne:er,setMany:tr,updateOne:sr,updateMany:ir,deleteOne:ar,deleteMany:nr,initialize:Xd});h(this,"selectors",{selectById:dr,selectByIds:rr})}add(e){var m;const{store:a}=this.client,c=((m=a.getState().userReducer.currentUser)==null?void 0:m.id)??null,d=new Date().toISOString(),r=F({...e,created_by:c,submitted_at:d}),o=this.enqueueRequest({description:"Add asset procedure step field values",method:y.POST,url:`${this.url}/`,payload:R(r),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[r.uuid]});return this.dispatch(this.actions.addOne(r)),o.then(l=>(this.dispatch(this.actions.setOne(l)),l)).catch(()=>{this.dispatch(this.actions.deleteOne(r.uuid))}),[r,o]}bulkAdd(e,a){var l;const n=new Date().toISOString(),c=((l=this.client.store.getState().userReducer.currentUser)==null?void 0:l.id)??null,d=[],r=Je(e.payloads,a??e.payloads.length),o=[];for(const p of r){const A=[];for(const T of p){const I=F({...T,values:T.values,created_by:c,submitted_at:n});d.push(I),A.push({uuid:I.uuid,asset:T.asset,fields_revision:T.fields_revision,asset_procedure:T.asset_procedure,asset_procedure_step:T.asset_procedure_step,published_at:T.published_at,values:I.values})}o.push({submitted_at:n,values:e.values,field_values:A})}this.dispatch(this.actions.addMany(d));const m=[];for(const p of o){const A=p.field_values.map(g=>g.asset),T=p.field_values.map(g=>g.fields_revision),I=p.field_values.map(g=>g.asset_procedure),_=p.field_values.map(g=>g.uuid),M=this.enqueueRequest({description:"Bulk add asset procedure step field values",method:y.POST,url:`${this.url}/bulk/`,payload:p,blockers:[...A,...T,...I],blocks:_});m.push(M)}return Promise.all(m).then(p=>{this.dispatch(this.actions.setMany(p.flat()))}).catch(()=>{this.dispatch(this.actions.deleteMany(d.map(p=>p.uuid)))}),[d,m]}update(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e.uuid)(n);if(!c)throw new Error(`Expected AssetProcedureStepFieldValues with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(this.actions.setOne(d));const r=this.enqueueRequest({description:"Update asset procedure step field values",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.fields_revision,d.asset,d.asset_procedure],blocks:[d.uuid]});return r.then(o=>{this.dispatch(this.actions.setOne(o))}).catch(()=>{this.dispatch(this.actions.setOne(c))}),[d,r]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const d=Yd(e)(n);this.dispatch(this.actions.deleteOne(e)),this.dispatch(As(d.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset procedure step field values",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(this.actions.addOne(c)),this.dispatch(ps(d)),r}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{asset_procedure__project:e,latest:!0}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class mg extends w{constructor(){super(...arguments);h(this,"name","Asset Procedure Step");h(this,"url","/asset-procedure-steps");h(this,"actions",{addOne:yr,addMany:pr,setOne:hr,setMany:mr,updateOne:Ar,updateMany:fr,deleteOne:Sr,deleteMany:Tr,initialize:or});h(this,"selectors",{selectById:Or,selectByIds:Fr})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create asset procedure step",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[d.asset_procedure_type],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`No asset procedure step with uuid ${e.uuid} found in the store`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update asset procedure step",method:y.PATCH,url:`${this.url}/${n.uuid}/`,payload:{name:e.name,description:e.description,priority:e.order,color:e.color},blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`No asset procedure step with uuid ${e} found in the store`);const d=Pr(e)(n);return this.dispatch(this.actions.deleteMany([e,...Ja(d)])),this.enqueueRequest({description:"Delete asset stage",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]}).catch(r=>{throw this.dispatch(this.actions.addMany([c,...d])),r})}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{asset_procedure_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class yg extends w{constructor(){super(...arguments);h(this,"url","/assets");h(this,"name","Asset");h(this,"actions",{addOne:_r,addMany:Fs,setOne:vr,setMany:Er,updateOne:Mr,updateMany:Rr,deleteOne:wr,deleteMany:Ps,initialize:br});h(this,"selectors",{selectById:zr,selectByIds:Br})}add(e){var p;const{store:a}=this.client,{addOne:n,updateOne:c,deleteOne:d}=this.actions,r=((p=a.getState().userReducer.currentUser)==null?void 0:p.id)??null,o=new Date().toISOString(),m=F({...e,created_by:r,submitted_at:o});this.dispatch(n(m));const l=this.enqueueRequest({description:`Create ${this.name}`,method:y.POST,url:`${this.url}/`,payload:R(m),blockers:[m.asset_type],blocks:[m.uuid]});return l.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(m.uuid))}),[m,l]}update(e){const{store:a}=this.client,{updateOne:n}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(a.getState());if(!d)throw new Error(`No asset with uuid ${e.uuid} found in the store`);const r={...d,...e};this.dispatch(n(r));const o=this.enqueueRequest({description:`Edit ${this.name}`,method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return o.then(m=>{this.dispatch(n(m))}).catch(()=>{this.dispatch(n(d))}),[r,o]}async delete(e){const{store:a}=this.client,{addOne:n,deleteOne:c}=this.actions,{selectById:d}=this.selectors,r=a.getState(),o=d(e)(r);if(!o)throw new Error(`No asset with uuid ${e} found in the store`);const m=In(e)(r),l=Wy(e)(r);if(this.dispatch(c(e)),m.length>0){const p=m.map(({uuid:A})=>A);this.dispatch(Kt(p))}if(l.length>0){const p=l.map(({uuid:A})=>A);this.dispatch(_t(p))}return this.enqueueRequest({description:`Delete ${this.name}`,method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]}).catch(p=>{throw this.dispatch(n(o)),this.dispatch(Wt(m)),this.dispatch(bt(l)),p})}bulkAdd(e,a){const{addMany:n}=this.actions,c=new Date().toISOString(),d=xe.v4(),r=Je(e,a).map(l=>{const p=l.map(A=>F(A));return{batchId:xe.v4(),payload:{transaction_id:d,submitted_at:c,assets:p}}}),o=[];let m=null;for(const l of r){const{batchId:p,payload:A}=l,T=A.assets.map(({uuid:V})=>V),I=A.assets.map(({asset_type:V})=>V),_=A.assets.map(({project:V})=>V),M=I.concat(_);m&&M.push(m);const g=T;g.push(p);const v=this.enqueueRequest({description:`Bulk create ${this.name}s`,method:y.POST,url:`${this.url}/bulk/`,payload:A,blockers:M,blocks:g});m=l.batchId,o.push(v)}return Promise.all(o).then(l=>{const p=l.flat();this.dispatch(n(p))}),o}async bulkDelete(e){const{store:a}=this.client,{addMany:n,deleteMany:c}=this.actions,{selectByIds:d}=this.selectors,r=a.getState(),o=d(e)(r);this.dispatch(c(e));try{await this.enqueueRequest({description:`Bulk delete ${this.name}s`,method:y.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(m){throw this.dispatch(n(o)),m}}async refreshStore(e,a){const{initialize:n}=this.actions,d=(await this.listPaginated({queryParams:{project:e}},a)).flat();return this.dispatch(n(d)),d}}class pg extends w{constructor(){super(...arguments);h(this,"name","Asset Stage Completion");h(this,"url","/asset-stage-completions");h(this,"actions",{addOne:Dr,addMany:Ur,setOne:Cr,setMany:Lr,updateOne:Gr,updateMany:kr,deleteOne:Nr,deleteMany:Hr,initialize:$r});h(this,"selectors",{selectById:Zr,selectByIds:Jr})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Add asset stage completion",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[e.asset,e.asset_stage],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}delete(e){const{store:a}=this.client,n=this.selectors.selectById(e)(a.getState());if(!n)throw new Error(`Expected asset stage completion with uuid ${e} to exist`);this.dispatch(this.actions.deleteOne(e));const c=this.enqueueRequest({description:"Delete asset stage completion",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return c.catch(()=>{this.dispatch(this.actions.addOne(n))}),c}bulkAdd(e){var l;const{store:a}=this.client,n=new Date().toISOString(),c=((l=a.getState().userReducer.currentUser)==null?void 0:l.id)??null,d=e.map(p=>F(p)),r=d.map(p=>({...p,created_by:c,submitted_at:n})),o=r.map(({uuid:p})=>p);this.dispatch(this.actions.addMany(r));const m=this.enqueueRequest({description:"Bulk create asset stage completions",method:y.POST,url:`${this.url}/bulk/`,payload:{submitted_at:n,completions:d},blockers:[...e.map(p=>p.asset_procedure),...e.map(p=>p.asset_stage),...e.map(p=>p.asset)],blocks:o});return m.then(p=>{this.dispatch(this.actions.setMany(p))}).catch(()=>{this.dispatch(this.actions.deleteMany(o))}),[r,m]}bulkDelete(e){const{store:a}=this.client,n=this.selectors.selectByIds(e)(a.getState());this.dispatch(this.actions.deleteMany(e));const c=this.enqueueRequest({description:"Deleting asset stage completions",method:y.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]});return c.catch(()=>{this.dispatch(this.actions.addMany(n))}),c}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{asset_procedure__project:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class Ag extends w{constructor(){super(...arguments);h(this,"name","Asset Stage");h(this,"url","/asset-stages");h(this,"actions",{addOne:tu,addMany:su,setOne:xr,setMany:eu,updateOne:iu,updateMany:au,deleteOne:nu,deleteMany:cu,initialize:Qr});h(this,"selectors",{selectById:ru,selectByIds:uu})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create asset",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[d.asset_procedure_type],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`No asset stage with uuid ${e.uuid} found in the store`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update asset stage",method:y.PATCH,url:`${this.url}/${n.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`No asset stage with uuid ${e} found in the store`);return this.dispatch(this.actions.deleteOne(e)),this.enqueueRequest({description:"Delete asset stage",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]}).catch(d=>{throw this.dispatch(this.actions.addOne(c)),d})}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{asset_procedure_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class fg extends z{constructor(){super(...arguments);h(this,"name","Asset Type Attachment");h(this,"url","/asset-type-attachments");h(this,"actions",{addOne:hu,addMany:Es,setOne:mu,setMany:yu,updateOne:pu,updateMany:Au,deleteOne:fu,deleteMany:Vs,initialize:ou});h(this,"selectors",{selectById:Tu,selectByIds:Iu})}getId(e){return e.uuid}buildModel(e){return F({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,asset_type:e.modelUuid})}buildPayload(e,a){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:a.extension,asset_type:e.asset_type}}async bulkAdd(e){return this._bulkAdd(e.map(a=>({modelUuid:a.assetTypeUuid,file:a.file})))}async delete(e){return this._delete(e)}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{asset_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class Sg extends z{constructor(){super(...arguments);h(this,"name","Asset Type Fields Attachment");h(this,"url","/asset-type-fields-attachments");h(this,"actions",{addOne:bu,addMany:_u,setOne:Mu,setMany:Ru,updateOne:wu,updateMany:vu,deleteOne:Eu,deleteMany:Vu,initialize:gu});h(this,"selectors",{selectById:Bu,selectByIds:ju})}async bulkAdd(e){var m;const a=new Date().toISOString(),n=((m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id)??null,c={},d=[],r=[];for(const l of e){const{fieldsRevisionUuid:p,fieldIdentifier:A,file:T}=l,I=await this.client.files.getFilePayload(T);I.sha1 in c||(c[I.sha1]=I);const _=F({file:URL.createObjectURL(T),file_type:T.type,file_name:T.name,file_sha1:I.sha1,created_by:n,fields_revision:p,submitted_at:a,field_identifier:A});d.push(_);const M={uuid:_.uuid,file_name:T.name,field_identifier:A,file_extension:I.extension,file_sha1:I.sha1,fields_revision:p};r.push(M)}this.dispatch(this.actions.addMany(d));const o=this.enqueueRequest({description:"Add asset type fields attachments",method:y.POST,url:`${this.url}/bulk/`,payload:{submitted_at:a,attachments:r,files:Object.values(c)},blockers:d.map(l=>l.fields_revision),blocks:d.map(l=>l.uuid)});return o.then(l=>{this.client.files.processPresignedUrls(l.presigned_urls),this.dispatch(this.actions.setMany(l.attachments))}).catch(()=>{this.dispatch(this.actions.deleteMany(d.map(l=>l.uuid)))}),[d,o.then(({attachments:l})=>l)]}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{fields_revision__asset_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class Tg extends w{constructor(){super(...arguments);h(this,"name","Asset Type Fields");h(this,"url","/asset-type-fields");h(this,"actions",{addOne:Uu,addMany:Cu,setOne:Lu,setMany:Gu,updateOne:ku,updateMany:Nu,deleteOne:Hu,deleteMany:Wu,initialize:Du});h(this,"selectors",{selectById:Yu,selectByIds:Zu})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Add Asset Type Fields",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[d.asset_type],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(m=>{throw this.dispatch(this.actions.deleteOne(d.uuid)),m}),[d,r]}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{asset_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class Ig extends z{constructor(){super(...arguments);h(this,"name","Asset Type Field Values Attachment");h(this,"url","/asset-type-field-values-attachments");h(this,"actions",{addOne:xu,addMany:Ds,setOne:el,setMany:tl,updateOne:sl,updateMany:il,deleteOne:al,deleteMany:Us,initialize:Qu});h(this,"selectors",{selectById:cl,selectByIds:dl})}async bulkAdd(e,a){var l;const n=new Date().toISOString(),c=((l=this.client.store.getState().userReducer.currentUser)==null?void 0:l.id)??null,d=Je(e,a??e.length),r=[],o=[];for(const p of d){const A={},T=[];for(const I of p){const{fieldValuesUuid:_,fieldIdentifier:M,file:g}=I,v=await this.client.files.getFilePayload(g);v.sha1 in A||(A[v.sha1]=v);const V=F({file:URL.createObjectURL(g),file_type:g.type,file_name:g.name,file_sha1:v.sha1,created_by:c,field_values:_,submitted_at:n,field_identifier:M});r.push(V);const Ke={uuid:V.uuid,file_name:g.name,file_sha1:v.sha1,file_extension:v.extension,field_identifier:M,field_values:_};T.push(Ke)}o.push({submitted_at:n,attachments:T,files:Object.values(A)})}this.dispatch(this.actions.addMany(r));const m=o.map(p=>this.enqueueRequest({description:"Add asset type field values attachments",method:y.POST,url:`${this.url}/bulk/`,payload:p,blockers:p.attachments.map(A=>A.field_values),blocks:p.attachments.map(A=>A.uuid)}));return Promise.all(m).then(p=>{for(const T of p)this.client.files.processPresignedUrls(T.presigned_urls);const A=p.flatMap(T=>T.attachments);this.dispatch(this.actions.setMany(A))}).catch(p=>{throw this.dispatch(this.actions.deleteMany(r.map(A=>A.uuid))),p}),[r,m.map(p=>p.then(({attachments:A})=>A))]}async bulkDelete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectByIds(e)(n);this.dispatch(this.actions.deleteMany(e));try{await this.enqueueRequest({description:"Delete asset type field values attachments",method:y.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(this.actions.addMany(c)),d}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{field_values__asset__project:e,latest:!0}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class Og extends w{constructor(){super(...arguments);h(this,"name","Asset Type Field Values");h(this,"url","/asset-type-field-values");h(this,"actions",{addOne:hl,addMany:ml,setOne:yl,setMany:pl,updateOne:Al,updateMany:fl,deleteOne:Sl,deleteMany:Tl,initialize:ol});h(this,"selectors",{selectById:Ol,selectByIds:Fl})}add(e){var m;const{store:a}=this.client,c=((m=a.getState().userReducer.currentUser)==null?void 0:m.id)??null,d=new Date().toISOString(),r=F({...e,created_by:c,submitted_at:d}),o=this.enqueueRequest({description:"Add asset type field values",method:y.POST,url:`${this.url}/`,payload:R(r),blockers:[e.asset,e.fields_revision],blocks:[r.uuid]});return this.dispatch(this.actions.addOne(r)),o.then(l=>(this.dispatch(this.actions.setOne(l)),l)).catch(()=>{this.dispatch(this.actions.deleteOne(r.uuid))}),[r,o]}bulkAdd(e,a){var m;const n=new Date().toISOString(),c=[],d=Je(e.payloads,a??e.payloads.length),r=[];for(const l of d){const p=[];for(const A of l){const T=F({...A,values:A.values,created_by:((m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id)??null,submitted_at:n});c.push(T),p.push({uuid:T.uuid,asset:A.asset,fields_revision:A.fields_revision,published_at:A.published_at,values:T.values})}r.push({submitted_at:n,values:e.values,field_values:p})}this.dispatch(this.actions.addMany(c));const o=[];for(const l of r){const p=l.field_values.map(_=>_.asset),A=l.field_values.map(_=>_.fields_revision),T=l.field_values.map(_=>_.uuid),I=this.enqueueRequest({description:"Bulk add asset type field values",method:y.POST,url:`${this.url}/bulk/`,payload:l,blockers:[...p,...A],blocks:T});o.push(I)}return Promise.all(o).then(l=>{this.dispatch(this.actions.setMany(l.flat()))}).catch(()=>{this.dispatch(this.actions.deleteMany(c.map(l=>l.uuid)))}),[c,o]}update(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e.uuid)(n);if(!c)throw new Error(`Expected AssetTypeFieldValues with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(this.actions.setOne(d));const r=this.enqueueRequest({description:"Delete asset type field values",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.uuid,d.fields_revision,d.asset],blocks:[d.uuid]});return r.then(o=>{this.dispatch(this.actions.setOne(o))}).catch(()=>{this.dispatch(this.actions.setOne(c))}),[d,r]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const d=rl(e)(n);this.dispatch(this.actions.deleteOne(e)),this.dispatch(Us(d.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset type field values",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(this.actions.addOne(c)),this.dispatch(Ds(d)),r}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{asset__project:e,latest:!0}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class Fg extends w{constructor(){super(...arguments);h(this,"name","Asset Type Identifier");h(this,"url","/asset-type-identifiers");h(this,"actions",{addOne:_l,addMany:Ml,setOne:Rl,setMany:wl,updateOne:vl,updateMany:El,deleteOne:Vl,deleteMany:zl,initialize:bl});h(this,"selectors",{selectById:jl,selectByIds:ql})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create asset type identifier",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[d.asset_type],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`Expected asset type identifier with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update asset type identifier",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected asset type identifier with uuid ${e} to exist`);this.dispatch(this.actions.deleteOne(e));try{return await this.enqueueRequest({description:"Delete asset type identifier",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(this.actions.addOne(c)),d}}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{asset_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class Pg extends w{constructor(){super(...arguments);h(this,"name","Asset Type Identifier Value");h(this,"url","/asset-type-identifier-values");h(this,"actions",{addOne:Cl,addMany:Ll,setOne:Gl,setMany:kl,updateOne:Nl,updateMany:Hl,deleteOne:Wl,deleteMany:Kl,initialize:Ul});h(this,"selectors",{selectById:Zl,selectByIds:Jl})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create asset type identifier value",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[e.asset,e.asset_type_identifier],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`Expected asset type identifier value with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update asset type identifier value",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected asset type identifier value with uuid ${e} to exist`);this.dispatch(this.actions.deleteOne(e));try{return await this.enqueueRequest({description:"Delete asset type identifier value",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(this.actions.addOne(c)),d}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{asset__project:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class gg extends w{constructor(){super(...arguments);h(this,"name","Asset Type");h(this,"url","/asset-types");h(this,"actions",{addOne:so,addMany:io,setOne:eo,setMany:to,updateOne:ao,updateMany:no,deleteOne:co,deleteMany:ro,initialize:xl});h(this,"selectors",{selectById:lo,selectByIds:oo})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create asset type",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`Expected asset type with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update asset type",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected asset type with uuid ${e} to exist`);const d=bs(e)(n),r=Ou(e)(n);return this.dispatch(this.actions.deleteOne(e)),this.dispatch(Ps(d.map(o=>o.uuid))),this.dispatch(Vs(r.map(({uuid:o})=>o))),this.enqueueRequest({description:"Delete asset type",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]}).catch(o=>{throw this.dispatch(this.actions.addOne(c)),this.dispatch(Fs(d)),this.dispatch(Es(r)),o})}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class bg extends w{constructor(){super(...arguments);h(this,"name","Asset Type Status");h(this,"url","/asset-type-statuses");h(this,"actions",{addOne:po,addMany:Ao,setOne:fo,setMany:So,updateOne:To,updateMany:Io,deleteOne:Oo,deleteMany:Fo,initialize:yo});h(this,"selectors",{selectById:go,selectByIds:bo})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create Asset Type Status",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[e.asset_type],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const a=this.client.store.getState(),n=this.selectors.selectById(e.uuid)(a);if(!n)throw new Error(`Expected an existing asset type status with uuid ${e.uuid}`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Edit Asset Type Status",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}delete(e){const{store:a}=this.client,n=this.selectors.selectById(e)(a.getState());if(!n)throw new Error(`No asset type status with uuid ${e} found in the store`);this.dispatch(this.actions.deleteOne(e));const c=this.enqueueRequest({description:"Delete Asset Type Status",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return c.catch(()=>{this.dispatch(this.actions.addOne(n))}),c}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{asset_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class _g extends w{constructor(){super(...arguments);h(this,"name","Category");h(this,"url","/categories");h(this,"actions",{addOne:Vo,addMany:zo,setOne:Bo,setMany:jo,updateOne:qo,updateMany:$o,deleteOne:Do,deleteMany:Uo,initialize:Eo});h(this,"selectors",{selectById:Xs,selectByIds:Lo})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create Category",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[e.project],blocks:[d.uuid]});return[d,r]}update(e){const a=this.client.store.getState(),n=this.selectors.selectById(e.uuid)(a);if(!n)throw new Error(`Expected an existing category with uuid ${e.uuid}`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Edit Category",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return[c,d]}remove(e){const{store:a}=this.client,n=this.selectors.selectById(e)(a.getState());if(!n)throw new Error(`No category with uuid ${e} found in the store`);this.dispatch(this.actions.deleteOne(e));const c=this.enqueueRequest({description:"Delete Category",method:y.DELETE,url:`${this.url}/${n.uuid}/`,blockers:[n.uuid],blocks:[]});return c.catch(()=>{this.dispatch(this.actions.addOne(n))}),c}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{project__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class Mg extends z{constructor(){super(...arguments);h(this,"name","Document Attachment");h(this,"url","/document-attachments");h(this,"actions",{addOne:Ho,addMany:Wo,setOne:Ko,setMany:Yo,updateOne:Zo,updateMany:Jo,deleteOne:Xo,deleteMany:Qo,initialize:No});h(this,"selectors",{selectById:eh,selectByIds:th})}getId(e){return e.uuid}buildModel(e){return F({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,document:e.modelUuid})}buildPayload(e,a){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:a.extension,document:e.document}}async bulkAdd(e){var I;const{store:a}=this.client,{addMany:n,updateMany:c,deleteMany:d}=this.actions,r=((I=a.getState().userReducer.currentUser)==null?void 0:I.id)??null,o=new Date().toISOString(),m=[],l=[],p={},A={};for(const _ of e){const{documentUuid:M,file:g}=_,v=await this.client.files.getFilePayload(g);v.sha1 in p||(p[v.sha1]=v,A[v.sha1]=[]);const V=this.buildModel({file:g,file_sha1:v.sha1,submitted_at:o,created_by:r,modelUuid:M});m.push(V),l.push(this.buildPayload(V,v)),A[v.sha1].push(V.uuid)}this.dispatch(n(m));const T=this.enqueueRequest({description:"Attach files to document",method:y.POST,url:`${this.url}/bulk/`,payload:{submitted_at:o,attachments:l,files:Object.values(p)},blocks:m.map(_=>_.uuid),blockers:m.map(_=>_.file_sha1)});return T.then(({attachments:_,presigned_urls:M})=>{this.dispatch(c(_));const g=this.client.files.processPresignedUrls(M);for(const[v,V]of Object.entries(g))V.then(()=>{const Ke=A[v];for(const D of Ke)this.makeReadable(D)})}).catch(()=>{this.dispatch(d(m.map(_=>_.uuid)))}),[m,T.then(({attachments:_})=>_)]}async delete(e){return this._delete(e)}makeReadable(e){this.enqueueRequest({description:"Add attachment to AI assistant",method:y.PATCH,url:`${this.url}/${e}/`,payload:{readable_to_assistant:!0},blockers:["index-document-attachment",e],blocks:["index-document-attachment"]})}async refreshStore(e,a){const n=this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{document__project__organization:e}},a),c=this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{document__organization:e}},a),r=(await Promise.all([n,c])).flat();return this.dispatch(this.actions.initialize(r)),r}}class Rg extends w{constructor(){super(...arguments);h(this,"name","Document");h(this,"url","/documents");h(this,"actions",{addOne:nh,addMany:ch,setOne:dh,setMany:rh,updateOne:uh,updateMany:lh,deleteOne:oh,deleteMany:hh,initialize:ah});h(this,"selectors",{selectById:yh,selectByIds:ph})}add(e){var p;const{store:a}=this.client,{addOne:n,deleteOne:c,updateOne:d}=this.actions,r=((p=a.getState().userReducer.currentUser)==null?void 0:p.id)??null,o=new Date().toISOString(),m=F({...e,created_by:r,submitted_at:o});this.dispatch(n(m));const l=this.enqueueRequest({description:"Create Document",method:y.POST,url:`${this.url}/`,payload:R(m),blockers:m.parent_document?[m.parent_document]:[],blocks:[m.uuid]});return l.then(A=>{this.dispatch(d(A))}).catch(()=>{this.dispatch(c(m.uuid))}),[m,l]}update(e){const{store:a}=this.client,{updateOne:n}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(a.getState());if(!d)throw new Error(`attempting to update a document with uuid ${e.uuid} that does not exist in store.documents`);const r={...d,...e};this.dispatch(n(r));const o=this.enqueueRequest({description:"Update Document",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return o.then(m=>{this.dispatch(n(m))}).catch(()=>{this.dispatch(n(d))}),[r,o]}delete(e){const{store:a}=this.client,{deleteOne:n,addOne:c}=this.actions,{selectById:d}=this.selectors,r=d(e)(a.getState());if(!r)throw new Error(`attempting to delete a document with uuid ${e} that does not exist in store.documents`);this.dispatch(n(e));const o=this.enqueueRequest({description:"Delete Document",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return o.catch(()=>{this.dispatch(c(r))}),o}async refreshStore(e,a){const n=this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{project__organization:e}},a),c=this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{organization:e}},a),r=(await Promise.all([n,c])).flat();return this.dispatch(this.actions.initialize(r)),r}}class st extends Ze{async get(s,e){return this.performRequest({url:`/${this.url}${s}`,method:y.GET},e)}async list(s,e){return this.performRequest({url:`/${this.url}`,method:y.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`/${this.url}`,method:y.GET,...s},e)}}class wg extends st{constructor(){super(...arguments);h(this,"name","Email Domains");h(this,"url","/organization-email-domains");h(this,"actions",{addOne:Th,addMany:Ih,setOne:Oh,setMany:Fh,updateOne:Ph,updateMany:gh,deleteOne:bh,deleteMany:_h,initialize:Sh});h(this,"selectors",{selectById:Rh,selectByIds:wh})}async add(e,a){return this.enqueueRequest({description:"Add email domain to organization",method:y.POST,url:`${this.url}/`,payload:{email:a,organization:e},blockers:[e,"create-org"],blocks:[]})}async remove(e){return this.dispatch(this.actions.deleteOne(e.uuid)),this.enqueueRequest({description:"Remove email domain from organization",method:y.DELETE,url:`${this.url}/${e.uuid}/`,blockers:[e.domain],blocks:[]}).catch(a=>{throw this.dispatch(this.actions.addOne(e)),a})}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class vg extends Ze{async getVerificationCode(s){return this.enqueueRequest({description:"Get verification code",method:y.GET,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}validateVerificationCode(s,e=void 0){return this.enqueueRequest({description:"Validate verification code",method:y.POST,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,payload:e,blockers:[],blocks:[]})}}const jt={},va=new Set;let qt=0,Ea=0,Va=0;const Eg=20;class Vg extends Ze{constructor(){super(...arguments);h(this,"host");h(this,"_dbPromise",_O.openDB("fileCache",1,{upgrade(e){e.createObjectStore("files")}}))}async renewUploadUrl(e){const a=await this.fetchCache(e);if(!a)throw new Error(`File with sha1 ${e} not found in cache`);const n=await Gt(a,e),c=await this.enqueueRequest({description:"Get S3 URL",method:y.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-${n}`]});return"url"in c&&this.dispatch(zh({sha1:e,...c})),c}async addCache(e,a){if(va.has(a))return;if(!e.type){const d=e.name.split("."),r=d[d.length-1];e=new File([e],e.name,{type:r})}if(!e.name||!e.size||!e.type)throw new Error("Cannot add files to cache that do not have a name, size and type.");const n=await this._dbPromise;!!await n.get("files",a)?(console.error("File already cached (this is unexpected at this point):",e.name,a),qt++):(await n.put("files",e,a),Ea++),va.add(a),Va++,Va%Eg===0&&console.debug(`File cache summary: ${qt} hits and ${Ea} misses, ${qt/(qt+Ea)*100}% hit rate over ${Va} calls to addCache.`)}async removeCache(e){await(await this._dbPromise).delete("files",e),va.delete(e)}async fetchCache(e){return(await this._dbPromise).get("files",e)}async getOrRenewUploadUrl(e){const a=this.client.store.getState();return Bh(e)(a)??await this.renewUploadUrl(e)}async uploadFileToS3(e){const a=await this.fetchCache(e);if(!a)throw new Error(`File with sha1 ${e} not found in cache`);const n=await Gt(a,e),c={file_name:a.name,file_sha1:e,file:n},d=await this.getOrRenewUploadUrl(e);if("warning"in d){if(d.warning==="already_uploaded")return[c,Promise.resolve(void 0)];throw new Error(d.warning)}const r=d.url,o=this.enqueueRequest({url:r,description:"Upload file",method:y.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:e,blockers:[`s3-${n}`],blocks:[e],s3url:d});return[c,o]}async fetchFileFromUrl(e,a,n){const c=e.split("?")[0]??e,d=await this.fetchCache(a);if(d){if(!d.name)throw new Error("Cached file unexpectedly has no name.");return d}if(e.startsWith("blob:")){const l=await Ka(e),p=new File([l],n??a,{type:l.type});return await this.addCache(p,a),p}let r=jt[c],o=!0;r?o=!1:(r=new Promise(l=>{this.enqueueRequest({description:"Download file",method:y.GET,url:e,isExternalUrl:!0,isResponseBlob:!0,isAuthNeeded:!1,blockers:[a],blocks:[a]}).then(p=>{const A=new File([p],n??a,{type:p.type});l(A)})}),jt[c]=r);let m;try{m=await r}catch(l){throw o&&l instanceof q&&delete jt[c],l}if(o){const l=await et(m);if(l!==a){const T=`The hash of the file returned from the server (${l}) does not match the
8
+ `)}catch(n){console.error("Failed to extract error message from response body",n)}}else typeof t.body=="string"&&(e=t.body);else t!=null&&t.text?e=t.text:s instanceof Error&&(e=s.message);return!e||e.length>XP?tt:e}class j extends Error{constructor(e){super(tt);h(this,"status");h(this,"response");h(this,"message");h(this,"options");const{response:a,innerError:n}=e;this.message=e.message??QP(a,n)??tt,this.status=(a==null?void 0:a.status)??0,this.response=a,e.discard=e.discard??!1,this.options=e}}function rO(t){function s(e){return typeof e=="object"&&e!==null&&["ok","redirect","clientError","serverError","error"].every(n=>n in e)}if(s(t))return t;if(typeof t=="object"&&t!==null){const e=t;if(s(e.response))return e.response;if(e.response&&s(e.response.response))return e.response.response}}class xP extends QI{constructor(s){super(s)}}class Ze extends QI{constructor(e,a){super(e);h(this,"auth");this.auth=a}}class eg extends Ze{async startConversation(s,e){return this.enqueueRequest({description:"Start agent conversation",method:y.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:e},blockers:["prompt"],blocks:["prompt"]}).then(a=>(this.dispatch(nn(a)),a))}async continueConversation(s,e,a){return this.enqueueRequest({description:"Prompt agent",method:y.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:a},blockers:["prompt"],blocks:["prompt"],queryParams:{conversation_id:e}}).then(n=>{this.dispatch(dn(n))})}async fetchDetails(s){return this.enqueueRequest({description:"Get agent conversation",method:y.GET,url:`/agents/conversations/${s}/`,blockers:["conversation"],blocks:["conversation"]}).then(e=>{this.dispatch(cn(e))})}async rate(s,e){return this.enqueueRequest({description:"Rate agent response",method:y.PUT,url:`/agents/responses/${s}/rate/`,payload:{rating:e},blockers:["rate"],blocks:["rate"]})}async refreshStore(s,e){const a=await this.performRequest({method:y.GET,url:"/agents/conversations/",queryParams:{project:s}},e);return this.dispatch(an(a)),a}}class R extends Ze{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:y.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:y.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:y.GET,...s},e)}}class We extends R{constructor(){super(...arguments);h(this,"pageSize",JI)}async _bulkAdd(e){var T;const{store:a}=this.client,{addMany:n,updateMany:c,deleteMany:d}=this.actions,r=((T=a.getState().userReducer.currentUser)==null?void 0:T.id)??null,o=new Date().toISOString(),m=[],l=[],p={};for(const I of e){const{modelUuid:_,file:M}=I,g=await this.client.files.getFilePayload(M);g.sha1 in p||(p[g.sha1]=g);const v=this.buildModel({file:M,file_sha1:g.sha1,submitted_at:o,created_by:r,modelUuid:_});m.push(v),l.push(this.buildPayload(v,g))}this.dispatch(n(m));const A=this.enqueueRequest({description:`Add ${this.name}`,method:y.POST,url:`${this.url}/bulk/`,payload:{submitted_at:o,attachments:l,files:Object.values(p)},blocks:m.map(I=>this.getId(I)),blockers:m.map(I=>I.file_sha1)});return A.then(({attachments:I,presigned_urls:_})=>{this.dispatch(c(I)),this.client.files.processPresignedUrls(_)}).catch(()=>{this.dispatch(d(m.map(I=>this.getId(I))))}),[m,A.then(({attachments:I})=>I)]}async _delete(e){const{store:a}=this.client,{addOne:n,deleteOne:c}=this.actions,{selectById:d}=this.selectors,r=d(e)(a.getState());if(!r)throw new Error(`Attempting to delete attachment with uuid ${e} that does not exist in the store`);this.dispatch(c(this.getId(r)));const o=this.enqueueRequest({description:`Delete ${this.name}`,method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return o.then(()=>{this.client.files.removeCache(r.file_sha1)}).catch(()=>{this.dispatch(n(r))}),o}}class tg extends We{constructor(){super(...arguments);h(this,"name","Asset attachment");h(this,"url","/asset-attachments");h(this,"actions",{addOne:on,addMany:Wt,setOne:hn,setMany:mn,updateOne:yn,updateMany:pn,deleteOne:An,deleteMany:Kt,initialize:ln});h(this,"selectors",{selectById:Sn,selectByIds:Tn})}getId(e){return e.uuid}buildModel(e){return F({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,asset:e.modelUuid})}buildPayload(e,a){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:a.extension,asset:e.asset}}async bulkAdd(e){return this._bulkAdd(e.map(a=>({modelUuid:a.assetUuid,file:a.file})))}async delete(e){return this._delete(e)}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{asset__project:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class sg extends We{constructor(){super(...arguments);h(this,"name","Asset Procedure Attachment");h(this,"url","/asset-procedure-type-attachments");h(this,"actions",{addOne:gn,addMany:bn,setOne:_n,setMany:Mn,updateOne:Rn,updateMany:wn,deleteOne:vn,deleteMany:En,initialize:Pn});h(this,"selectors",{selectById:Bn,selectByIds:jn})}getId(e){return e.uuid}buildModel(e){return F({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,asset_procedure_type:e.modelUuid})}buildPayload(e,a){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:a.extension,asset_procedure_type:e.asset_procedure_type}}async bulkAdd(e){return this._bulkAdd(e.map(a=>({modelUuid:a.assetProcedureTypeUuid,file:a.file})))}async delete(e){return this._delete(e)}async refreshStore(e,a){const{initialize:n}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},a);return this.dispatch(n(c)),c}}class ig extends R{constructor(){super(...arguments);h(this,"name","Asset Procedure Type Fields Attachment");h(this,"url","/asset-procedure-type-fields-attachments");h(this,"actions",{addOne:Dn,addMany:Un,setOne:Cn,setMany:Ln,updateOne:Gn,updateMany:kn,deleteOne:Nn,deleteMany:Hn,initialize:$n});h(this,"selectors",{selectById:Yn,selectByIds:Zn})}async bulkAdd(e){var m;const a=new Date().toISOString(),n=((m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id)??null,c={},d=[],r=[];for(const l of e){const{fieldsRevisionUuid:p,fieldIdentifier:A,file:T}=l,I=await this.client.files.getFilePayload(T);I.sha1 in c||(c[I.sha1]=I);const _=F({file:URL.createObjectURL(T),file_type:T.type,file_name:T.name,file_sha1:I.sha1,created_by:n,fields_revision:p,submitted_at:a,field_identifier:A});d.push(_);const M={uuid:_.uuid,file_name:T.name,field_identifier:A,file_extension:I.extension,file_sha1:I.sha1,fields_revision:p};r.push(M)}this.dispatch(this.actions.addMany(d));const o=this.enqueueRequest({description:"Add asset procedure type fields attachments",method:y.POST,url:`${this.url}/bulk/`,payload:{submitted_at:a,attachments:r,files:Object.values(c)},blockers:d.map(l=>l.fields_revision),blocks:d.map(l=>l.uuid)});return o.then(l=>{this.client.files.processPresignedUrls(l.presigned_urls),this.dispatch(this.actions.setMany(l.attachments))}).catch(()=>{this.dispatch(this.actions.deleteMany(d.map(l=>l.uuid)))}),[d,o.then(({attachments:l})=>l)]}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{fields_revision__asset_procedure_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class ag extends R{constructor(){super(...arguments);h(this,"name","Asset Procedure Type Fields");h(this,"url","/asset-procedure-type-fields");h(this,"actions",{addOne:Qn,addMany:xn,setOne:ec,setMany:tc,updateOne:sc,updateMany:ic,deleteOne:ac,deleteMany:nc,initialize:Xn});h(this,"selectors",{selectById:rc,selectByIds:uc})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Add Asset Procedure Type Fields",method:y.POST,url:`${this.url}/`,payload:w(d),blockers:[d.asset_procedure_type],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(m=>{throw this.dispatch(this.actions.deleteOne(d.uuid)),m}),[d,r]}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{asset_procedure_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}function Je(t,s){const e=[];let a=0;const n=t.length;for(;a<n;)e.push(t.slice(a,a+=s));return e}class ng extends R{constructor(){super(...arguments);h(this,"name","Asset Procedure Type Field Values Attachment");h(this,"url","/asset-procedure-type-field-values-attachments");h(this,"actions",{addOne:hc,addMany:ts,setOne:mc,setMany:yc,updateOne:pc,updateMany:Ac,deleteOne:fc,deleteMany:ss,initialize:oc});h(this,"selectors",{selectById:Ic,selectByIds:Oc})}async bulkAdd(e,a){var l;const n=new Date().toISOString(),c=((l=this.client.store.getState().userReducer.currentUser)==null?void 0:l.id)??null,d=Je(e,a??e.length),r=[],o=[];for(const p of d){const A={},T=[];for(const I of p){const{fieldValuesUuid:_,fieldIdentifier:M,file:g}=I,v=await this.client.files.getFilePayload(g);v.sha1 in A||(A[v.sha1]=v);const V=F({file:URL.createObjectURL(g),file_type:g.type,file_name:g.name,file_sha1:v.sha1,created_by:c,field_values:_,submitted_at:n,field_identifier:M});r.push(V);const Ke={uuid:V.uuid,file_name:g.name,file_sha1:v.sha1,file_extension:v.extension,field_identifier:M,field_values:_};T.push(Ke)}o.push({submitted_at:n,attachments:T,files:Object.values(A)})}this.dispatch(this.actions.addMany(r));const m=o.map(p=>this.enqueueRequest({description:"Add asset procedure type field values attachments",method:y.POST,url:`${this.url}/bulk/`,payload:p,blockers:p.attachments.map(A=>A.field_values),blocks:p.attachments.map(A=>A.uuid)}));return Promise.all(m).then(p=>{for(const T of p)this.client.files.processPresignedUrls(T.presigned_urls);const A=p.flatMap(T=>T.attachments);this.dispatch(this.actions.setMany(A))}).catch(p=>{throw this.dispatch(this.actions.deleteMany(r.map(A=>A.uuid))),p}),[r,m.map(p=>p.then(({attachments:A})=>A))]}async bulkDelete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectByIds(e)(n);this.dispatch(this.actions.deleteMany(e));try{await this.enqueueRequest({description:"Delete asset procedure type field values attachments",method:y.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(this.actions.addMany(c)),d}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{field_values__asset_procedure__project:e,latest:!0}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class cg extends R{constructor(){super(...arguments);h(this,"name","Asset Procedure Type Field Values");h(this,"url","/asset-procedure-type-field-values");h(this,"actions",{addOne:bc,addMany:_c,setOne:Mc,setMany:Rc,updateOne:wc,updateMany:vc,deleteOne:Ec,deleteMany:Vc,initialize:gc});h(this,"selectors",{selectById:jc,selectByIds:qc})}add(e){var m;const{store:a}=this.client,c=((m=a.getState().userReducer.currentUser)==null?void 0:m.id)??null,d=new Date().toISOString(),r=F({...e,created_by:c,submitted_at:d}),o=this.enqueueRequest({description:"Add asset procedure type field values",method:y.POST,url:`${this.url}/`,payload:w(r),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[r.uuid]});return this.dispatch(this.actions.addOne(r)),o.then(l=>(this.dispatch(this.actions.setOne(l)),l)).catch(()=>{this.dispatch(this.actions.deleteOne(r.uuid))}),[r,o]}bulkAdd(e,a){var l;const n=new Date().toISOString(),c=((l=this.client.store.getState().userReducer.currentUser)==null?void 0:l.id)??null,d=[],r=Je(e.payloads,a??e.payloads.length),o=[];for(const p of r){const A=[];for(const T of p){const I=F({...T,values:T.values,created_by:c,submitted_at:n});d.push(I),A.push({uuid:I.uuid,asset:T.asset,fields_revision:T.fields_revision,asset_procedure:T.asset_procedure,published_at:T.published_at,values:I.values})}o.push({submitted_at:n,values:e.values,field_values:A})}this.dispatch(this.actions.addMany(d));const m=[];for(const p of o){const A=p.field_values.map(g=>g.asset),T=p.field_values.map(g=>g.fields_revision),I=p.field_values.map(g=>g.asset_procedure),_=p.field_values.map(g=>g.uuid),M=this.enqueueRequest({description:"Bulk add asset procedure type field values",method:y.POST,url:`${this.url}/bulk/`,payload:p,blockers:[...A,...T,...I],blocks:_});m.push(M)}return Promise.all(m).then(p=>{this.dispatch(this.actions.setMany(p.flat()))}).catch(()=>{this.dispatch(this.actions.deleteMany(d.map(p=>p.uuid)))}),[d,m]}update(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e.uuid)(n);if(!c)throw new Error(`Expected AssetProcedureTypeFieldValues with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(this.actions.setOne(d));const r=this.enqueueRequest({description:"Update asset procedure type field values",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.fields_revision,d.asset,d.asset_procedure],blocks:[d.uuid]});return r.then(o=>{this.dispatch(this.actions.setOne(o))}).catch(()=>{this.dispatch(this.actions.setOne(c))}),[d,r]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const d=Fc(e)(n);this.dispatch(this.actions.deleteOne(e)),this.dispatch(ss(d.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset procedure type field values",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(this.actions.addOne(c)),this.dispatch(ts(d)),r}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{asset_procedure__project:e,latest:!0}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class dg extends R{constructor(){super(...arguments);h(this,"name","Asset Procedure");h(this,"url","/asset-procedures");h(this,"actions",{addOne:Uc,addMany:cs,setOne:kc,setMany:Nc,updateOne:Cc,updateMany:Lc,deleteOne:Gc,deleteMany:ds,initialize:Dc});h(this,"selectors",{selectById:Yc,selectByIds:Zc})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create asset procedure",method:y.POST,url:`${this.url}/`,payload:w(d),blockers:[e.asset_procedure_type,e.asset_type],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`Expected asset procedure with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update asset procedure",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}async remove(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected asset procedure with uuid ${e} to exist`);return this.dispatch(this.actions.deleteOne(e)),this.enqueueRequest({description:"Delete asset procedure",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]}).catch(d=>{throw this.dispatch(this.actions.addOne(c)),d})}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{project:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class rg extends R{constructor(){super(...arguments);h(this,"name","Asset Procedure Type");h(this,"url","/asset-procedure-types");h(this,"actions",{addOne:Qc,addMany:xc,setOne:ad,setMany:nd,updateOne:ed,updateMany:td,deleteOne:sd,deleteMany:id,initialize:Xc});h(this,"selectors",{selectById:rd,selectByIds:ud})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create asset procedure type",method:y.POST,url:`${this.url}/`,payload:w(d),blockers:[],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`Expected asset procedure type with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update asset procedure type",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}async remove(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected asset procedure type with uuid ${e} to exist`);const d=Kc(e)(n);return this.dispatch(this.actions.deleteOne(e)),this.dispatch(ds(d.map(({uuid:r})=>r))),this.enqueueRequest({description:"Delete asset procedure type",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]}).catch(r=>{throw this.dispatch(this.actions.addOne(c)),this.dispatch(cs(d)),r})}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class ug extends R{constructor(){super(...arguments);h(this,"name","Asset Procedure Step Fields Attachment");h(this,"url","/asset-procedure-step-fields-attachments");h(this,"actions",{addOne:hd,addMany:md,setOne:yd,setMany:pd,updateOne:Ad,updateMany:fd,deleteOne:Sd,deleteMany:Td,initialize:od});h(this,"selectors",{selectById:Od,selectByIds:Fd})}async bulkAdd(e){var m;const a=new Date().toISOString(),n=((m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id)??null,c={},d=[],r=[];for(const l of e){const{fieldsRevisionUuid:p,fieldIdentifier:A,file:T}=l,I=await this.client.files.getFilePayload(T);I.sha1 in c||(c[I.sha1]=I);const _=F({file:URL.createObjectURL(T),file_type:T.type,file_name:T.name,file_sha1:I.sha1,created_by:n,fields_revision:p,submitted_at:a,field_identifier:A});d.push(_);const M={uuid:_.uuid,file_name:T.name,field_identifier:A,file_extension:I.extension,file_sha1:I.sha1,fields_revision:p};r.push(M)}this.dispatch(this.actions.addMany(d));const o=this.enqueueRequest({description:"Add asset procedure step fields attachments",method:y.POST,url:`${this.url}/bulk/`,payload:{submitted_at:a,attachments:r,files:Object.values(c)},blockers:d.map(l=>l.fields_revision),blocks:d.map(l=>l.uuid)});return o.then(l=>{this.client.files.processPresignedUrls(l.presigned_urls),this.dispatch(this.actions.setMany(l.attachments))}).catch(()=>{this.dispatch(this.actions.deleteMany(d.map(l=>l.uuid)))}),[d,o.then(({attachments:l})=>l)]}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{fields_revision__asset_procedure_step__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class lg extends R{constructor(){super(...arguments);h(this,"name","Asset Procedure Step Fields");h(this,"url","/asset-procedure-step-fields");h(this,"actions",{addOne:_d,addMany:Md,setOne:Rd,setMany:wd,updateOne:vd,updateMany:Ed,deleteOne:Vd,deleteMany:zd,initialize:bd});h(this,"selectors",{selectById:Bd,selectByIds:jd})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Add Asset Procedure Step Fields",method:y.POST,url:`${this.url}/`,payload:w(d),blockers:[d.asset_procedure_step],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(m=>{throw this.dispatch(this.actions.deleteOne(d.uuid)),m}),[d,r]}update(e){const{store:a}=this.client,n=a.getState().assetProcedureStepFieldsReducer.instances[e.uuid];if(!n)throw new Error(`AssetProcedureStepFields with uuid ${e.uuid} not found`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update Asset Procedure Step Fields",method:y.PATCH,url:`${this.url}/${n.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(r=>{throw this.dispatch(this.actions.setOne(n)),r}),[c,d]}delete(e){const{store:a}=this.client,n=a.getState().assetProcedureStepFieldsReducer.instances[e];if(!n)throw new Error(`AssetProcedureStepFields with uuid ${e} not found`);this.dispatch(this.actions.deleteOne(e));const c=this.enqueueRequest({description:"Delete Asset Procedure Step Fields",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]});return c.catch(d=>{throw this.dispatch(this.actions.addOne(n)),d}),c}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{asset_procedure_step__asset_procedure_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class og extends R{constructor(){super(...arguments);h(this,"name","Asset Procedure Step Field Values Attachment");h(this,"url","/asset-procedure-step-field-values-attachments");h(this,"actions",{addOne:Ud,addMany:ps,setOne:Cd,setMany:Ld,updateOne:Gd,updateMany:kd,deleteOne:Nd,deleteMany:As,initialize:Dd});h(this,"selectors",{selectById:Wd,selectByIds:Kd})}async bulkAdd(e,a){var l;const n=new Date().toISOString(),c=((l=this.client.store.getState().userReducer.currentUser)==null?void 0:l.id)??null,d=Je(e,a??e.length),r=[],o=[];for(const p of d){const A={},T=[];for(const I of p){const{fieldValuesUuid:_,fieldIdentifier:M,file:g}=I,v=await this.client.files.getFilePayload(g);v.sha1 in A||(A[v.sha1]=v);const V=F({file:URL.createObjectURL(g),file_type:g.type,file_name:g.name,file_sha1:v.sha1,created_by:c,field_values:_,submitted_at:n,field_identifier:M});r.push(V);const Ke={uuid:V.uuid,file_name:g.name,file_sha1:v.sha1,file_extension:v.extension,field_identifier:M,field_values:_};T.push(Ke)}o.push({submitted_at:n,attachments:T,files:Object.values(A)})}this.dispatch(this.actions.addMany(r));const m=o.map(p=>this.enqueueRequest({description:"Add asset procedure step field values attachments",method:y.POST,url:`${this.url}/bulk/`,payload:p,blockers:p.attachments.map(A=>A.field_values),blocks:p.attachments.map(A=>A.uuid)}));return Promise.all(m).then(p=>{for(const T of p)this.client.files.processPresignedUrls(T.presigned_urls);const A=p.flatMap(T=>T.attachments);this.dispatch(this.actions.setMany(A))}).catch(p=>{throw this.dispatch(this.actions.deleteMany(r.map(A=>A.uuid))),p}),[r,m.map(p=>p.then(({attachments:A})=>A))]}async bulkDelete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectByIds(e)(n);this.dispatch(this.actions.deleteMany(e));try{await this.enqueueRequest({description:"Delete asset procedure step field values attachments",method:y.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(this.actions.addMany(c)),d}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{field_values__asset_procedure__project:e,latest:!0}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class hg extends R{constructor(){super(...arguments);h(this,"name","Asset Procedure Step Field Values");h(this,"url","/asset-procedure-step-field-values");h(this,"actions",{addOne:Qd,addMany:xd,setOne:er,setMany:tr,updateOne:sr,updateMany:ir,deleteOne:ar,deleteMany:nr,initialize:Xd});h(this,"selectors",{selectById:dr,selectByIds:rr})}add(e){var m;const{store:a}=this.client,c=((m=a.getState().userReducer.currentUser)==null?void 0:m.id)??null,d=new Date().toISOString(),r=F({...e,created_by:c,submitted_at:d}),o=this.enqueueRequest({description:"Add asset procedure step field values",method:y.POST,url:`${this.url}/`,payload:w(r),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[r.uuid]});return this.dispatch(this.actions.addOne(r)),o.then(l=>(this.dispatch(this.actions.setOne(l)),l)).catch(()=>{this.dispatch(this.actions.deleteOne(r.uuid))}),[r,o]}bulkAdd(e,a){var l;const n=new Date().toISOString(),c=((l=this.client.store.getState().userReducer.currentUser)==null?void 0:l.id)??null,d=[],r=Je(e.payloads,a??e.payloads.length),o=[];for(const p of r){const A=[];for(const T of p){const I=F({...T,values:T.values,created_by:c,submitted_at:n});d.push(I),A.push({uuid:I.uuid,asset:T.asset,fields_revision:T.fields_revision,asset_procedure:T.asset_procedure,asset_procedure_step:T.asset_procedure_step,published_at:T.published_at,values:I.values})}o.push({submitted_at:n,values:e.values,field_values:A})}this.dispatch(this.actions.addMany(d));const m=[];for(const p of o){const A=p.field_values.map(g=>g.asset),T=p.field_values.map(g=>g.fields_revision),I=p.field_values.map(g=>g.asset_procedure),_=p.field_values.map(g=>g.uuid),M=this.enqueueRequest({description:"Bulk add asset procedure step field values",method:y.POST,url:`${this.url}/bulk/`,payload:p,blockers:[...A,...T,...I],blocks:_});m.push(M)}return Promise.all(m).then(p=>{this.dispatch(this.actions.setMany(p.flat()))}).catch(()=>{this.dispatch(this.actions.deleteMany(d.map(p=>p.uuid)))}),[d,m]}update(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e.uuid)(n);if(!c)throw new Error(`Expected AssetProcedureStepFieldValues with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(this.actions.setOne(d));const r=this.enqueueRequest({description:"Update asset procedure step field values",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.fields_revision,d.asset,d.asset_procedure],blocks:[d.uuid]});return r.then(o=>{this.dispatch(this.actions.setOne(o))}).catch(()=>{this.dispatch(this.actions.setOne(c))}),[d,r]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const d=Yd(e)(n);this.dispatch(this.actions.deleteOne(e)),this.dispatch(As(d.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset procedure step field values",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(this.actions.addOne(c)),this.dispatch(ps(d)),r}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{asset_procedure__project:e,latest:!0}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class mg extends R{constructor(){super(...arguments);h(this,"name","Asset Procedure Step");h(this,"url","/asset-procedure-steps");h(this,"actions",{addOne:yr,addMany:pr,setOne:hr,setMany:mr,updateOne:Ar,updateMany:fr,deleteOne:Sr,deleteMany:Tr,initialize:or});h(this,"selectors",{selectById:Or,selectByIds:Fr})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create asset procedure step",method:y.POST,url:`${this.url}/`,payload:w(d),blockers:[d.asset_procedure_type],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`No asset procedure step with uuid ${e.uuid} found in the store`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update asset procedure step",method:y.PATCH,url:`${this.url}/${n.uuid}/`,payload:{name:e.name,description:e.description,priority:e.order,color:e.color},blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`No asset procedure step with uuid ${e} found in the store`);const d=Pr(e)(n);return this.dispatch(this.actions.deleteMany([e,...Ja(d)])),this.enqueueRequest({description:"Delete asset stage",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]}).catch(r=>{throw this.dispatch(this.actions.addMany([c,...d])),r})}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{asset_procedure_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class yg extends R{constructor(){super(...arguments);h(this,"url","/assets");h(this,"name","Asset");h(this,"actions",{addOne:_r,addMany:Fs,setOne:vr,setMany:Er,updateOne:Mr,updateMany:Rr,deleteOne:wr,deleteMany:Ps,initialize:br});h(this,"selectors",{selectById:zr,selectByIds:Br})}add(e){var p;const{store:a}=this.client,{addOne:n,updateOne:c,deleteOne:d}=this.actions,r=((p=a.getState().userReducer.currentUser)==null?void 0:p.id)??null,o=new Date().toISOString(),m=F({...e,created_by:r,submitted_at:o});this.dispatch(n(m));const l=this.enqueueRequest({description:`Create ${this.name}`,method:y.POST,url:`${this.url}/`,payload:w(m),blockers:[m.asset_type],blocks:[m.uuid]});return l.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(d(m.uuid))}),[m,l]}update(e){const{store:a}=this.client,{updateOne:n}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(a.getState());if(!d)throw new Error(`No asset with uuid ${e.uuid} found in the store`);const r={...d,...e};this.dispatch(n(r));const o=this.enqueueRequest({description:`Edit ${this.name}`,method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return o.then(m=>{this.dispatch(n(m))}).catch(()=>{this.dispatch(n(d))}),[r,o]}async delete(e){const{store:a}=this.client,{addOne:n,deleteOne:c}=this.actions,{selectById:d}=this.selectors,r=a.getState(),o=d(e)(r);if(!o)throw new Error(`No asset with uuid ${e} found in the store`);const m=In(e)(r),l=Wy(e)(r);if(this.dispatch(c(e)),m.length>0){const p=m.map(({uuid:A})=>A);this.dispatch(Kt(p))}if(l.length>0){const p=l.map(({uuid:A})=>A);this.dispatch(_t(p))}return this.enqueueRequest({description:`Delete ${this.name}`,method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]}).catch(p=>{throw this.dispatch(n(o)),this.dispatch(Wt(m)),this.dispatch(bt(l)),p})}bulkAdd(e,a){const{addMany:n}=this.actions,c=new Date().toISOString(),d=xe.v4(),r=Je(e,a).map(l=>{const p=l.map(A=>F(A));return{batchId:xe.v4(),payload:{transaction_id:d,submitted_at:c,assets:p}}}),o=[];let m=null;for(const l of r){const{batchId:p,payload:A}=l,T=A.assets.map(({uuid:V})=>V),I=A.assets.map(({asset_type:V})=>V),_=A.assets.map(({project:V})=>V),M=I.concat(_);m&&M.push(m);const g=T;g.push(p);const v=this.enqueueRequest({description:`Bulk create ${this.name}s`,method:y.POST,url:`${this.url}/bulk/`,payload:A,blockers:M,blocks:g});m=l.batchId,o.push(v)}return Promise.all(o).then(l=>{const p=l.flat();this.dispatch(n(p))}),o}async bulkDelete(e){const{store:a}=this.client,{addMany:n,deleteMany:c}=this.actions,{selectByIds:d}=this.selectors,r=a.getState(),o=d(e)(r);this.dispatch(c(e));try{await this.enqueueRequest({description:`Bulk delete ${this.name}s`,method:y.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(m){throw this.dispatch(n(o)),m}}async refreshStore(e,a){const{initialize:n}=this.actions,d=(await this.listPaginated({queryParams:{project:e}},a)).flat();return this.dispatch(n(d)),d}}class pg extends R{constructor(){super(...arguments);h(this,"name","Asset Stage Completion");h(this,"url","/asset-stage-completions");h(this,"actions",{addOne:Dr,addMany:Ur,setOne:Cr,setMany:Lr,updateOne:Gr,updateMany:kr,deleteOne:Nr,deleteMany:Hr,initialize:$r});h(this,"selectors",{selectById:Zr,selectByIds:Jr})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Add asset stage completion",method:y.POST,url:`${this.url}/`,payload:w(d),blockers:[e.asset,e.asset_stage],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}delete(e){const{store:a}=this.client,n=this.selectors.selectById(e)(a.getState());if(!n)throw new Error(`Expected asset stage completion with uuid ${e} to exist`);this.dispatch(this.actions.deleteOne(e));const c=this.enqueueRequest({description:"Delete asset stage completion",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return c.catch(()=>{this.dispatch(this.actions.addOne(n))}),c}bulkAdd(e){var l;const{store:a}=this.client,n=new Date().toISOString(),c=((l=a.getState().userReducer.currentUser)==null?void 0:l.id)??null,d=e.map(p=>F(p)),r=d.map(p=>({...p,created_by:c,submitted_at:n})),o=r.map(({uuid:p})=>p);this.dispatch(this.actions.addMany(r));const m=this.enqueueRequest({description:"Bulk create asset stage completions",method:y.POST,url:`${this.url}/bulk/`,payload:{submitted_at:n,completions:d},blockers:[...e.map(p=>p.asset_procedure),...e.map(p=>p.asset_stage),...e.map(p=>p.asset)],blocks:o});return m.then(p=>{this.dispatch(this.actions.setMany(p))}).catch(()=>{this.dispatch(this.actions.deleteMany(o))}),[r,m]}bulkDelete(e){const{store:a}=this.client,n=this.selectors.selectByIds(e)(a.getState());this.dispatch(this.actions.deleteMany(e));const c=this.enqueueRequest({description:"Deleting asset stage completions",method:y.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]});return c.catch(()=>{this.dispatch(this.actions.addMany(n))}),c}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{asset_procedure__project:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class Ag extends R{constructor(){super(...arguments);h(this,"name","Asset Stage");h(this,"url","/asset-stages");h(this,"actions",{addOne:tu,addMany:su,setOne:xr,setMany:eu,updateOne:iu,updateMany:au,deleteOne:nu,deleteMany:cu,initialize:Qr});h(this,"selectors",{selectById:ru,selectByIds:uu})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create asset",method:y.POST,url:`${this.url}/`,payload:w(d),blockers:[d.asset_procedure_type],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`No asset stage with uuid ${e.uuid} found in the store`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update asset stage",method:y.PATCH,url:`${this.url}/${n.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`No asset stage with uuid ${e} found in the store`);return this.dispatch(this.actions.deleteOne(e)),this.enqueueRequest({description:"Delete asset stage",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]}).catch(d=>{throw this.dispatch(this.actions.addOne(c)),d})}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{asset_procedure_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class fg extends We{constructor(){super(...arguments);h(this,"name","Asset Type Attachment");h(this,"url","/asset-type-attachments");h(this,"actions",{addOne:hu,addMany:Es,setOne:mu,setMany:yu,updateOne:pu,updateMany:Au,deleteOne:fu,deleteMany:Vs,initialize:ou});h(this,"selectors",{selectById:Tu,selectByIds:Iu})}getId(e){return e.uuid}buildModel(e){return F({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,asset_type:e.modelUuid})}buildPayload(e,a){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:a.extension,asset_type:e.asset_type}}async bulkAdd(e){return this._bulkAdd(e.map(a=>({modelUuid:a.assetTypeUuid,file:a.file})))}async delete(e){return this._delete(e)}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{asset_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class Sg extends R{constructor(){super(...arguments);h(this,"name","Asset Type Fields Attachment");h(this,"url","/asset-type-fields-attachments");h(this,"actions",{addOne:bu,addMany:_u,setOne:Mu,setMany:Ru,updateOne:wu,updateMany:vu,deleteOne:Eu,deleteMany:Vu,initialize:gu});h(this,"selectors",{selectById:Bu,selectByIds:ju})}async bulkAdd(e){var m;const a=new Date().toISOString(),n=((m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id)??null,c={},d=[],r=[];for(const l of e){const{fieldsRevisionUuid:p,fieldIdentifier:A,file:T}=l,I=await this.client.files.getFilePayload(T);I.sha1 in c||(c[I.sha1]=I);const _=F({file:URL.createObjectURL(T),file_type:T.type,file_name:T.name,file_sha1:I.sha1,created_by:n,fields_revision:p,submitted_at:a,field_identifier:A});d.push(_);const M={uuid:_.uuid,file_name:T.name,field_identifier:A,file_extension:I.extension,file_sha1:I.sha1,fields_revision:p};r.push(M)}this.dispatch(this.actions.addMany(d));const o=this.enqueueRequest({description:"Add asset type fields attachments",method:y.POST,url:`${this.url}/bulk/`,payload:{submitted_at:a,attachments:r,files:Object.values(c)},blockers:d.map(l=>l.fields_revision),blocks:d.map(l=>l.uuid)});return o.then(l=>{this.client.files.processPresignedUrls(l.presigned_urls),this.dispatch(this.actions.setMany(l.attachments))}).catch(()=>{this.dispatch(this.actions.deleteMany(d.map(l=>l.uuid)))}),[d,o.then(({attachments:l})=>l)]}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{fields_revision__asset_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class Tg extends R{constructor(){super(...arguments);h(this,"name","Asset Type Fields");h(this,"url","/asset-type-fields");h(this,"actions",{addOne:Uu,addMany:Cu,setOne:Lu,setMany:Gu,updateOne:ku,updateMany:Nu,deleteOne:Hu,deleteMany:Wu,initialize:Du});h(this,"selectors",{selectById:Yu,selectByIds:Zu})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Add Asset Type Fields",method:y.POST,url:`${this.url}/`,payload:w(d),blockers:[d.asset_type],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(m=>{throw this.dispatch(this.actions.deleteOne(d.uuid)),m}),[d,r]}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{asset_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class Ig extends R{constructor(){super(...arguments);h(this,"name","Asset Type Field Values Attachment");h(this,"url","/asset-type-field-values-attachments");h(this,"actions",{addOne:xu,addMany:Ds,setOne:el,setMany:tl,updateOne:sl,updateMany:il,deleteOne:al,deleteMany:Us,initialize:Qu});h(this,"selectors",{selectById:cl,selectByIds:dl})}async bulkAdd(e,a){var l;const n=new Date().toISOString(),c=((l=this.client.store.getState().userReducer.currentUser)==null?void 0:l.id)??null,d=Je(e,a??e.length),r=[],o=[];for(const p of d){const A={},T=[];for(const I of p){const{fieldValuesUuid:_,fieldIdentifier:M,file:g}=I,v=await this.client.files.getFilePayload(g);v.sha1 in A||(A[v.sha1]=v);const V=F({file:URL.createObjectURL(g),file_type:g.type,file_name:g.name,file_sha1:v.sha1,created_by:c,field_values:_,submitted_at:n,field_identifier:M});r.push(V);const Ke={uuid:V.uuid,file_name:g.name,file_sha1:v.sha1,file_extension:v.extension,field_identifier:M,field_values:_};T.push(Ke)}o.push({submitted_at:n,attachments:T,files:Object.values(A)})}this.dispatch(this.actions.addMany(r));const m=o.map(p=>this.enqueueRequest({description:"Add asset type field values attachments",method:y.POST,url:`${this.url}/bulk/`,payload:p,blockers:p.attachments.map(A=>A.field_values),blocks:p.attachments.map(A=>A.uuid)}));return Promise.all(m).then(p=>{for(const T of p)this.client.files.processPresignedUrls(T.presigned_urls);const A=p.flatMap(T=>T.attachments);this.dispatch(this.actions.setMany(A))}).catch(p=>{throw this.dispatch(this.actions.deleteMany(r.map(A=>A.uuid))),p}),[r,m.map(p=>p.then(({attachments:A})=>A))]}async bulkDelete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectByIds(e)(n);this.dispatch(this.actions.deleteMany(e));try{await this.enqueueRequest({description:"Delete asset type field values attachments",method:y.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(this.actions.addMany(c)),d}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{field_values__asset__project:e,latest:!0}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class Og extends R{constructor(){super(...arguments);h(this,"name","Asset Type Field Values");h(this,"url","/asset-type-field-values");h(this,"actions",{addOne:hl,addMany:ml,setOne:yl,setMany:pl,updateOne:Al,updateMany:fl,deleteOne:Sl,deleteMany:Tl,initialize:ol});h(this,"selectors",{selectById:Ol,selectByIds:Fl})}add(e){var m;const{store:a}=this.client,c=((m=a.getState().userReducer.currentUser)==null?void 0:m.id)??null,d=new Date().toISOString(),r=F({...e,created_by:c,submitted_at:d}),o=this.enqueueRequest({description:"Add asset type field values",method:y.POST,url:`${this.url}/`,payload:w(r),blockers:[e.asset,e.fields_revision],blocks:[r.uuid]});return this.dispatch(this.actions.addOne(r)),o.then(l=>(this.dispatch(this.actions.setOne(l)),l)).catch(()=>{this.dispatch(this.actions.deleteOne(r.uuid))}),[r,o]}bulkAdd(e,a){var m;const n=new Date().toISOString(),c=[],d=Je(e.payloads,a??e.payloads.length),r=[];for(const l of d){const p=[];for(const A of l){const T=F({...A,values:A.values,created_by:((m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id)??null,submitted_at:n});c.push(T),p.push({uuid:T.uuid,asset:A.asset,fields_revision:A.fields_revision,published_at:A.published_at,values:T.values})}r.push({submitted_at:n,values:e.values,field_values:p})}this.dispatch(this.actions.addMany(c));const o=[];for(const l of r){const p=l.field_values.map(_=>_.asset),A=l.field_values.map(_=>_.fields_revision),T=l.field_values.map(_=>_.uuid),I=this.enqueueRequest({description:"Bulk add asset type field values",method:y.POST,url:`${this.url}/bulk/`,payload:l,blockers:[...p,...A],blocks:T});o.push(I)}return Promise.all(o).then(l=>{this.dispatch(this.actions.setMany(l.flat()))}).catch(()=>{this.dispatch(this.actions.deleteMany(c.map(l=>l.uuid)))}),[c,o]}update(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e.uuid)(n);if(!c)throw new Error(`Expected AssetTypeFieldValues with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(this.actions.setOne(d));const r=this.enqueueRequest({description:"Delete asset type field values",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.uuid,d.fields_revision,d.asset],blocks:[d.uuid]});return r.then(o=>{this.dispatch(this.actions.setOne(o))}).catch(()=>{this.dispatch(this.actions.setOne(c))}),[d,r]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const d=rl(e)(n);this.dispatch(this.actions.deleteOne(e)),this.dispatch(Us(d.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset type field values",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(this.actions.addOne(c)),this.dispatch(Ds(d)),r}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{asset__project:e,latest:!0}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class Fg extends R{constructor(){super(...arguments);h(this,"name","Asset Type Identifier");h(this,"url","/asset-type-identifiers");h(this,"actions",{addOne:_l,addMany:Ml,setOne:Rl,setMany:wl,updateOne:vl,updateMany:El,deleteOne:Vl,deleteMany:zl,initialize:bl});h(this,"selectors",{selectById:jl,selectByIds:ql})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create asset type identifier",method:y.POST,url:`${this.url}/`,payload:w(d),blockers:[d.asset_type],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`Expected asset type identifier with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update asset type identifier",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected asset type identifier with uuid ${e} to exist`);this.dispatch(this.actions.deleteOne(e));try{return await this.enqueueRequest({description:"Delete asset type identifier",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(this.actions.addOne(c)),d}}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{asset_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class Pg extends R{constructor(){super(...arguments);h(this,"name","Asset Type Identifier Value");h(this,"url","/asset-type-identifier-values");h(this,"actions",{addOne:Cl,addMany:Ll,setOne:Gl,setMany:kl,updateOne:Nl,updateMany:Hl,deleteOne:Wl,deleteMany:Kl,initialize:Ul});h(this,"selectors",{selectById:Zl,selectByIds:Jl})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create asset type identifier value",method:y.POST,url:`${this.url}/`,payload:w(d),blockers:[e.asset,e.asset_type_identifier],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`Expected asset type identifier value with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update asset type identifier value",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected asset type identifier value with uuid ${e} to exist`);this.dispatch(this.actions.deleteOne(e));try{return await this.enqueueRequest({description:"Delete asset type identifier value",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(this.actions.addOne(c)),d}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{asset__project:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class gg extends R{constructor(){super(...arguments);h(this,"name","Asset Type");h(this,"url","/asset-types");h(this,"actions",{addOne:so,addMany:io,setOne:eo,setMany:to,updateOne:ao,updateMany:no,deleteOne:co,deleteMany:ro,initialize:xl});h(this,"selectors",{selectById:lo,selectByIds:oo})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create asset type",method:y.POST,url:`${this.url}/`,payload:w(d),blockers:[],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`Expected asset type with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update asset type",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[n.uuid],blocks:[n.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected asset type with uuid ${e} to exist`);const d=bs(e)(n),r=Ou(e)(n);return this.dispatch(this.actions.deleteOne(e)),this.dispatch(Ps(d.map(o=>o.uuid))),this.dispatch(Vs(r.map(({uuid:o})=>o))),this.enqueueRequest({description:"Delete asset type",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]}).catch(o=>{throw this.dispatch(this.actions.addOne(c)),this.dispatch(Fs(d)),this.dispatch(Es(r)),o})}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class bg extends R{constructor(){super(...arguments);h(this,"name","Asset Type Status");h(this,"url","/asset-type-statuses");h(this,"actions",{addOne:po,addMany:Ao,setOne:fo,setMany:So,updateOne:To,updateMany:Io,deleteOne:Oo,deleteMany:Fo,initialize:yo});h(this,"selectors",{selectById:go,selectByIds:bo})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create Asset Type Status",method:y.POST,url:`${this.url}/`,payload:w(d),blockers:[e.asset_type],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const a=this.client.store.getState(),n=this.selectors.selectById(e.uuid)(a);if(!n)throw new Error(`Expected an existing asset type status with uuid ${e.uuid}`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Edit Asset Type Status",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}delete(e){const{store:a}=this.client,n=this.selectors.selectById(e)(a.getState());if(!n)throw new Error(`No asset type status with uuid ${e} found in the store`);this.dispatch(this.actions.deleteOne(e));const c=this.enqueueRequest({description:"Delete Asset Type Status",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return c.catch(()=>{this.dispatch(this.actions.addOne(n))}),c}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{asset_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class _g extends R{constructor(){super(...arguments);h(this,"name","Category");h(this,"url","/categories");h(this,"actions",{addOne:Vo,addMany:zo,setOne:Bo,setMany:jo,updateOne:qo,updateMany:$o,deleteOne:Do,deleteMany:Uo,initialize:Eo});h(this,"selectors",{selectById:Xs,selectByIds:Lo})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create Category",method:y.POST,url:`${this.url}/`,payload:w(d),blockers:[e.project],blocks:[d.uuid]});return[d,r]}update(e){const a=this.client.store.getState(),n=this.selectors.selectById(e.uuid)(a);if(!n)throw new Error(`Expected an existing category with uuid ${e.uuid}`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Edit Category",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return[c,d]}remove(e){const{store:a}=this.client,n=this.selectors.selectById(e)(a.getState());if(!n)throw new Error(`No category with uuid ${e} found in the store`);this.dispatch(this.actions.deleteOne(e));const c=this.enqueueRequest({description:"Delete Category",method:y.DELETE,url:`${this.url}/${n.uuid}/`,blockers:[n.uuid],blocks:[]});return c.catch(()=>{this.dispatch(this.actions.addOne(n))}),c}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{project__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class Mg extends We{constructor(){super(...arguments);h(this,"name","Document Attachment");h(this,"url","/document-attachments");h(this,"actions",{addOne:Ho,addMany:Wo,setOne:Ko,setMany:Yo,updateOne:Zo,updateMany:Jo,deleteOne:Xo,deleteMany:Qo,initialize:No});h(this,"selectors",{selectById:eh,selectByIds:th})}getId(e){return e.uuid}buildModel(e){return F({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,document:e.modelUuid})}buildPayload(e,a){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:a.extension,document:e.document}}async bulkAdd(e){var I;const{store:a}=this.client,{addMany:n,updateMany:c,deleteMany:d}=this.actions,r=((I=a.getState().userReducer.currentUser)==null?void 0:I.id)??null,o=new Date().toISOString(),m=[],l=[],p={},A={};for(const _ of e){const{documentUuid:M,file:g}=_,v=await this.client.files.getFilePayload(g);v.sha1 in p||(p[v.sha1]=v,A[v.sha1]=[]);const V=this.buildModel({file:g,file_sha1:v.sha1,submitted_at:o,created_by:r,modelUuid:M});m.push(V),l.push(this.buildPayload(V,v)),A[v.sha1].push(V.uuid)}this.dispatch(n(m));const T=this.enqueueRequest({description:"Attach files to document",method:y.POST,url:`${this.url}/bulk/`,payload:{submitted_at:o,attachments:l,files:Object.values(p)},blocks:m.map(_=>_.uuid),blockers:m.map(_=>_.file_sha1)});return T.then(({attachments:_,presigned_urls:M})=>{this.dispatch(c(_));const g=this.client.files.processPresignedUrls(M);for(const[v,V]of Object.entries(g))V.then(()=>{const Ke=A[v];for(const $ of Ke)this.makeReadable($)})}).catch(()=>{this.dispatch(d(m.map(_=>_.uuid)))}),[m,T.then(({attachments:_})=>_)]}async delete(e){return this._delete(e)}makeReadable(e){this.enqueueRequest({description:"Add attachment to AI assistant",method:y.PATCH,url:`${this.url}/${e}/`,payload:{readable_to_assistant:!0},blockers:["index-document-attachment",e],blocks:["index-document-attachment"]})}async refreshStore(e,a){const n=this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{document__project__organization:e}},a),c=this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{document__organization:e}},a),r=(await Promise.all([n,c])).flat();return this.dispatch(this.actions.initialize(r)),r}}class Rg extends R{constructor(){super(...arguments);h(this,"name","Document");h(this,"url","/documents");h(this,"actions",{addOne:nh,addMany:ch,setOne:dh,setMany:rh,updateOne:uh,updateMany:lh,deleteOne:oh,deleteMany:hh,initialize:ah});h(this,"selectors",{selectById:yh,selectByIds:ph})}add(e){var p;const{store:a}=this.client,{addOne:n,deleteOne:c,updateOne:d}=this.actions,r=((p=a.getState().userReducer.currentUser)==null?void 0:p.id)??null,o=new Date().toISOString(),m=F({...e,created_by:r,submitted_at:o});this.dispatch(n(m));const l=this.enqueueRequest({description:"Create Document",method:y.POST,url:`${this.url}/`,payload:w(m),blockers:m.parent_document?[m.parent_document]:[],blocks:[m.uuid]});return l.then(A=>{this.dispatch(d(A))}).catch(()=>{this.dispatch(c(m.uuid))}),[m,l]}update(e){const{store:a}=this.client,{updateOne:n}=this.actions,{selectById:c}=this.selectors,d=c(e.uuid)(a.getState());if(!d)throw new Error(`attempting to update a document with uuid ${e.uuid} that does not exist in store.documents`);const r={...d,...e};this.dispatch(n(r));const o=this.enqueueRequest({description:"Update Document",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return o.then(m=>{this.dispatch(n(m))}).catch(()=>{this.dispatch(n(d))}),[r,o]}delete(e){const{store:a}=this.client,{deleteOne:n,addOne:c}=this.actions,{selectById:d}=this.selectors,r=d(e)(a.getState());if(!r)throw new Error(`attempting to delete a document with uuid ${e} that does not exist in store.documents`);this.dispatch(n(e));const o=this.enqueueRequest({description:"Delete Document",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return o.catch(()=>{this.dispatch(c(r))}),o}async refreshStore(e,a){const n=this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{project__organization:e}},a),c=this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{organization:e}},a),r=(await Promise.all([n,c])).flat();return this.dispatch(this.actions.initialize(r)),r}}class st extends Ze{async get(s,e){return this.performRequest({url:`/${this.url}${s}`,method:y.GET},e)}async list(s,e){return this.performRequest({url:`/${this.url}`,method:y.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`/${this.url}`,method:y.GET,...s},e)}}class wg extends st{constructor(){super(...arguments);h(this,"name","Email Domains");h(this,"url","/organization-email-domains");h(this,"actions",{addOne:Th,addMany:Ih,setOne:Oh,setMany:Fh,updateOne:Ph,updateMany:gh,deleteOne:bh,deleteMany:_h,initialize:Sh});h(this,"selectors",{selectById:Rh,selectByIds:wh})}async add(e,a){return this.enqueueRequest({description:"Add email domain to organization",method:y.POST,url:`${this.url}/`,payload:{email:a,organization:e},blockers:[e,"create-org"],blocks:[]})}async remove(e){return this.dispatch(this.actions.deleteOne(e.uuid)),this.enqueueRequest({description:"Remove email domain from organization",method:y.DELETE,url:`${this.url}/${e.uuid}/`,blockers:[e.domain],blocks:[]}).catch(a=>{throw this.dispatch(this.actions.addOne(e)),a})}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class vg extends Ze{async getVerificationCode(s){return this.enqueueRequest({description:"Get verification code",method:y.GET,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}validateVerificationCode(s,e=void 0){return this.enqueueRequest({description:"Validate verification code",method:y.POST,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,payload:e,blockers:[],blocks:[]})}}const jt={},va=new Set;let qt=0,Ea=0,Va=0;const Eg=20;class Vg extends Ze{constructor(){super(...arguments);h(this,"host");h(this,"_dbPromise",_O.openDB("fileCache",1,{upgrade(e){e.createObjectStore("files")}}))}async renewUploadUrl(e){const a=await this.fetchCache(e);if(!a)throw new Error(`File with sha1 ${e} not found in cache`);const n=await Gt(a,e),c=await this.enqueueRequest({description:"Get S3 URL",method:y.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-${n}`]});return"url"in c&&this.dispatch(zh({sha1:e,...c})),c}async addCache(e,a){if(va.has(a))return;if(!e.type){const d=e.name.split("."),r=d[d.length-1];e=new File([e],e.name,{type:r})}if(!e.name||!e.size||!e.type)throw new Error("Cannot add files to cache that do not have a name, size and type.");const n=await this._dbPromise;!!await n.get("files",a)?(console.error("File already cached (this is unexpected at this point):",e.name,a),qt++):(await n.put("files",e,a),Ea++),va.add(a),Va++,Va%Eg===0&&console.debug(`File cache summary: ${qt} hits and ${Ea} misses, ${qt/(qt+Ea)*100}% hit rate over ${Va} calls to addCache.`)}async removeCache(e){await(await this._dbPromise).delete("files",e),va.delete(e)}async fetchCache(e){return(await this._dbPromise).get("files",e)}async getOrRenewUploadUrl(e){const a=this.client.store.getState();return Bh(e)(a)??await this.renewUploadUrl(e)}async uploadFileToS3(e){const a=await this.fetchCache(e);if(!a)throw new Error(`File with sha1 ${e} not found in cache`);const n=await Gt(a,e),c={file_name:a.name,file_sha1:e,file:n},d=await this.getOrRenewUploadUrl(e);if("warning"in d){if(d.warning==="already_uploaded")return[c,Promise.resolve(void 0)];throw new Error(d.warning)}const r=d.url,o=this.enqueueRequest({url:r,description:"Upload file",method:y.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:e,blockers:[`s3-${n}`],blocks:[e],s3url:d});return[c,o]}async fetchFileFromUrl(e,a,n){const c=e.split("?")[0]??e,d=await this.fetchCache(a);if(d){if(!d.name)throw new Error("Cached file unexpectedly has no name.");return d}if(e.startsWith("blob:")){const l=await Ka(e),p=new File([l],n??a,{type:l.type});return await this.addCache(p,a),p}let r=jt[c],o=!0;r?o=!1:(r=new Promise(l=>{this.enqueueRequest({description:"Download file",method:y.GET,url:e,isExternalUrl:!0,isResponseBlob:!0,isAuthNeeded:!1,blockers:[a],blocks:[a]}).then(p=>{const A=new File([p],n??a,{type:p.type});l(A)})}),jt[c]=r);let m;try{m=await r}catch(l){throw o&&l instanceof j&&delete jt[c],l}if(o){const l=await et(m);if(l!==a){const T=`The hash of the file returned from the server (${l}) 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(T)}const p=m.type.split("/")[1];if(!p)throw new Error("File has no extension");const A=n??l+"."+p;if(m=Wa(m,A),!m.name)throw new Error("Failed to set file's name");await this.addCache(m,l),jt[c]=new Promise(T=>{T(m)})}return m}processPresignedUrls(e){const a={};for(const[n,c]of Object.entries(e))a[n]=this.enqueueRequest({url:c.url,description:"Upload file to S3",method:y.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:n,blockers:[`s3-${c.fields.key}`],blocks:[n],s3url:c});return a}async getFilePayload(e){const a=await et(e),n={sha1:a,file_type:e.type,extension:e.name.split(".").pop(),size:e.size};return await this.client.files.addCache(e,a),n}}class zg extends w{constructor(){super(...arguments);h(this,"name","Form Identifier");h(this,"url","/form-identifiers");h(this,"actions",{addOne:Dh,addMany:Uh,setOne:Ch,setMany:Lh,updateOne:Gh,updateMany:kh,deleteOne:Nh,deleteMany:Hh,initialize:$h});h(this,"selectors",{selectById:Kh,selectByIds:Yh})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create form identifier",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[d.form],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`Expected form identifier with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update form identifier",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected form identifier with uuid ${e} to exist`);this.dispatch(this.actions.deleteOne(e));try{return await this.enqueueRequest({description:"Delete form identifier",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(this.actions.addOne(c)),d}}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{form__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class Bg extends w{constructor(){super(...arguments);h(this,"name","Form Identifier Value");h(this,"url","/form-identifier-values");h(this,"actions",{addOne:Qh,addMany:xh,setOne:em,setMany:tm,updateOne:sm,updateMany:im,deleteOne:am,deleteMany:nm,initialize:Xh});h(this,"selectors",{selectById:dm,selectByIds:rm})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create form identifier value",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[e.form_submission,e.form_identifier],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`Expected form identifier value with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update form identifier value",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected form identifier value with uuid ${e} to exist`);this.dispatch(this.actions.deleteOne(e));try{return await this.enqueueRequest({description:"Delete form identifier value",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(this.actions.addOne(c)),d}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{form_submission__form_revision__form__organization:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class jg extends z{constructor(){super(...arguments);h(this,"name","Form Revision Attachment");h(this,"url","/form-revision-attachments");h(this,"actions",{addOne:hm,addMany:mm,setOne:ym,setMany:pm,updateOne:Am,updateMany:fm,deleteOne:Sm,deleteMany:Tm,initialize:om});h(this,"selectors",{selectById:Om,selectByIds:Fm})}async bulkAdd(e){var m;const a=new Date().toISOString(),n=((m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id)??null,c={},d=[],r=[];for(const l of e){const{revisionUuid:p,fieldIdentifier:A,file:T}=l,I=await this.client.files.getFilePayload(T);I.sha1 in c||(c[I.sha1]=I);const _=F({file:URL.createObjectURL(T),file_type:T.type,file_name:T.name,file_sha1:I.sha1,created_by:n,form_revision:p,submitted_at:a,field_identifier:A});d.push(_);const M={uuid:_.uuid,file_name:T.name,field_identifier:A,file_extension:I.extension,file_sha1:I.sha1,form_revision:p};r.push(M)}this.dispatch(this.actions.addMany(d));const o=this.enqueueRequest({description:"Attach files to form revision",method:y.POST,url:`${this.url}/bulk/`,payload:{submitted_at:a,attachments:r,files:Object.values(c)},blockers:d.map(l=>l.form_revision),blocks:d.map(l=>l.uuid)});return o.then(l=>{this.client.files.processPresignedUrls(l.presigned_urls),this.dispatch(this.actions.setMany(l.attachments))}).catch(()=>{this.dispatch(this.actions.deleteMany(d.map(l=>l.uuid)))}),[d,o.then(({attachments:l})=>l)]}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{form_revision__form__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class qg extends w{constructor(){super(...arguments);h(this,"name","Form Revision");h(this,"url","/form-revisions");h(this,"actions",{addOne:ui,addMany:li,setOne:_m,setMany:Mm,updateOne:Rm,updateMany:wm,deleteOne:oi,deleteMany:hi,initialize:bm});h(this,"selectors",{selectById:vm,selectByIds:Em})}add(e){var m;const{store:a}=this.client,c=((m=a.getState().userReducer.currentUser)==null?void 0:m.id)??null,d=new Date().toISOString(),r=F({...e,created_by:c,submitted_at:d});this.dispatch(this.actions.addOne(r));const o=this.enqueueRequest({description:"Create form revision",method:y.POST,url:`${this.url}/`,payload:R(r),blockers:[e.form],blocks:[r.uuid]});return o.then(l=>{this.dispatch(this.actions.setOne(l))}).catch(()=>{this.dispatch(this.actions.deleteOne(r.uuid))}),[r,o]}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{form__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class $g extends w{constructor(){super(...arguments);h(this,"name","Form");h(this,"url","/forms");h(this,"actions",{addOne:qm,addMany:$m,setOne:Dm,setMany:Um,updateOne:Cm,updateMany:Lm,deleteOne:Gm,deleteMany:km,initialize:jm});h(this,"selectors",{selectById:Wm,selectByIds:Km})}add(e,a){var l;const{store:n}=this.client,c=new Date().toISOString(),d=((l=n.getState().userReducer.currentUser)==null?void 0:l.id)??null,r=F({...e,submitted_at:c,created_by:d}),o=F({...a,form:r.uuid,submitted_at:c,created_by:d});this.dispatch(this.actions.addOne(r)),this.dispatch(ui(o));const m=this.enqueueRequest({description:"Create form",method:y.POST,url:`${this.url}/`,payload:{...R(r),initial_revision:{uuid:o.uuid,submitted_at:o.submitted_at,title:o.title,description:o.description,fields:o.fields}},blockers:[],blocks:[r.uuid,o.uuid]});return m.catch(p=>{throw this.dispatch(this.actions.deleteOne(r.uuid)),this.dispatch(oi(o.uuid)),p}),[r,o,m]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error("Expected form to exist");const d=fy(e)(n);d.length>0&&this.dispatch(gi(d.map(({uuid:o})=>o)));const r=Vm(e)(n);r.length>0&&this.dispatch(hi(r.map(({uuid:o})=>o))),this.dispatch(this.actions.deleteOne(e));try{return await this.enqueueRequest({description:"Delete form",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(this.actions.addOne(c)),r.length>0&&this.dispatch(li(r)),d.length>0&&this.dispatch(Pi(d)),o}}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class Dg extends z{constructor(){super(...arguments);h(this,"name","Form Submission Attachment");h(this,"url","/form-submission-attachments");h(this,"actions",{addOne:Jm,addMany:fi,setOne:Xm,setMany:Qm,updateOne:xm,updateMany:ey,deleteOne:ty,deleteMany:Si,initialize:Zm});h(this,"selectors",{selectById:sy,selectByIds:iy})}async bulkAdd(e){var m;const a=new Date().toISOString(),n=((m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id)??null,c={},d=[],r=[];for(const l of e){const{submissionUuid:p,fieldIdentifier:A,file:T}=l,I=await this.client.files.getFilePayload(T);I.sha1 in c||(c[I.sha1]=I);const _=F({file:URL.createObjectURL(T),file_type:T.type,file_name:T.name,file_sha1:I.sha1,created_by:n,form_submission:p,submitted_at:a,field_identifier:A});d.push(_);const M={uuid:_.uuid,file_name:T.name,file_sha1:I.sha1,file_extension:I.extension,field_identifier:A,form_submission:p};r.push(M)}this.dispatch(this.actions.addMany(d));const o=this.enqueueRequest({description:"Attach files to form submission",method:y.POST,url:`${this.url}/bulk/`,payload:{submitted_at:a,attachments:r,files:Object.values(c)},blockers:d.map(l=>l.form_submission),blocks:d.map(l=>l.uuid)});return o.then(l=>{this.client.files.processPresignedUrls(l.presigned_urls),this.dispatch(this.actions.setMany(l.attachments))}).catch(l=>{throw this.dispatch(this.actions.deleteMany(d.map(p=>p.uuid))),l}),[d,o.then(({attachments:l})=>l)]}async bulkDelete(e){const{store:a}=this.client,n=a.getState(),c=Oi(e)(n);this.dispatch(this.actions.deleteMany(e));try{await this.enqueueRequest({description:"Delete form submission attachments",method:y.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(this.actions.addMany(c)),d}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{form_submission__form_revision__form__organization:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class Ug extends w{constructor(){super(...arguments);h(this,"name","Form Submission");h(this,"url","/form-submissions");h(this,"actions",{addOne:ly,addMany:Pi,setOne:ry,setMany:uy,updateOne:oy,updateMany:hy,deleteOne:my,deleteMany:gi,initialize:dy});h(this,"selectors",{selectById:py,selectByIds:Ay})}add(e){var m;const{store:a}=this.client,c=((m=a.getState().userReducer.currentUser)==null?void 0:m.id)??null,d=new Date().toISOString(),r=F({...e,created_by:c,submitted_at:d}),o=this.enqueueRequest({description:"Add form submission",method:y.POST,url:`${this.url}/`,payload:R(r),blockers:[e.form_revision],blocks:[r.uuid]});return this.dispatch(this.actions.addOne(r)),o.then(l=>(this.dispatch(this.actions.setOne(l)),l)).catch(()=>{this.dispatch(this.actions.deleteOne(r.uuid))}),[r,o]}update(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e.uuid)(n);if(!c)throw new Error(`Expected submission with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(this.actions.setOne(d));const r=this.enqueueRequest({description:"Delete user form submissions",method:y.PATCH,url:`${this.url}/${d.uuid}/`,payload:e,blockers:[d.uuid],blocks:[d.uuid]});return r.then(o=>{this.dispatch(this.actions.setOne(o))}).catch(()=>{this.dispatch(this.actions.setOne(c))}),[d,r]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const d=ay(e)(n);this.dispatch(this.actions.deleteOne(e)),this.dispatch(Si(d.map(r=>r.uuid)));try{return await this.enqueueRequest({description:"Delete user form submissions",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(this.actions.addOne(c)),this.dispatch(fi(d)),r}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{limit:this.pageSize,paginate:!0,form_revision__form_organization:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class Cg extends w{constructor(){super(...arguments);h(this,"name","Geo Image");h(this,"url","/geo-images");h(this,"actions",{addOne:Py,addMany:gy,setOne:Oy,setMany:Fy,updateOne:by,updateMany:_y,deleteOne:My,deleteMany:Ry,initialize:Iy});h(this,"selectors",{selectById:vy,selectByIds:Ey})}async add(e){var A;const{store:a}=this.client,{file:n,...c}=e,d=new Date().toISOString(),r=((A=a.getState().userReducer.currentUser)==null?void 0:A.id)??null,o=c.project,m=await this.client.files.getFilePayload(n),l=F({...c,file_name:n.name,file_sha1:m.sha1,file_type:n.type,file:URL.createObjectURL(n),submitted_at:d,created_by:r});this.dispatch(this.actions.addOne(l));const p=this.enqueueRequest({description:"Add geo image",method:y.POST,url:`${this.url}/`,payload:{uuid:l.uuid,submitted_at:d,title:l.title,description:l.description,geo_marker:l.geo_marker,canvas_marker:l.canvas_marker,sha1:l.file_sha1,project:l.project,file_name:l.file_name,direction:l.direction,original_date:l.original_date,file:m},blocks:[o],blockers:[o]});return p.then(T=>{this.client.files.processPresignedUrls(T.presigned_urls),this.dispatch(this.actions.setOne(T.geo_image))}).catch(()=>{this.dispatch(this.actions.deleteOne(l.uuid))}),[l,p.then(T=>T.geo_image)]}async bulkAdd(e,a){var A;const{store:n}=this.client,c=new Date().toISOString(),d=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,r=[],o=[],m=[],l={};for(const T of e){const{file:I,..._}=T,M=await this.client.files.getFilePayload(I);M.sha1 in l||(l[M.sha1]=M);const g=F({..._,file_name:I.name,file_sha1:M.sha1,file_type:I.type,file:URL.createObjectURL(I),submitted_at:c,created_by:d,project:a});r.push(g),o.push(g.uuid),m.push({uuid:g.uuid,sha1:g.file_sha1,file_name:g.file_name,title:g.title,description:g.description,geo_marker:g.geo_marker,canvas_marker:g.canvas_marker,direction:g.direction,original_date:g.original_date})}this.dispatch(this.actions.addMany(r));const p=this.enqueueRequest({description:"Bulk add geo images",method:y.POST,url:`${this.url}/bulk/`,payload:{submitted_at:c,project:a,geo_images:m,files:Object.values(l)},blocks:[a],blockers:o});return p.then(T=>{this.client.files.processPresignedUrls(T.presigned_urls),this.dispatch(this.actions.setMany(T.geo_images))}).catch(()=>{this.dispatch(this.actions.deleteMany(o))}),[r,p.then(T=>T.geo_images)]}update(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e.uuid)(n);if(!c)throw new Error(`Map image with uuid ${e.uuid} does not exist in the store`);const d={...c,...e};this.dispatch(this.actions.setOne(d));const r=this.enqueueRequest({description:"Update geo image",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return r.then(o=>{this.dispatch(this.actions.setOne(o))}).catch(()=>{this.dispatch(this.actions.setOne(c))}),[d,r]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Map image with uuid ${e} does not exist in the store`);this.dispatch(this.actions.deleteOne(e));const d=this.enqueueRequest({description:"Delete geo image",method:y.DELETE,url:`${this.url}/${e}/`,blocks:[e],blockers:[e]});return d.catch(()=>{this.dispatch(this.actions.setOne(c))}),d}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{project:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class Lg extends w{constructor(){super(...arguments);h(this,"name","Issue Association");h(this,"url","/issue-associations");h(this,"actions",{addOne:Uy,addMany:bt,setOne:qy,setMany:jy,updateOne:$y,updateMany:Dy,deleteOne:Cy,deleteMany:_t,initialize:By});h(this,"selectors",{selectById:Gy,selectByIds:ky})}add(e){var o;const{store:a}=this.client,n=new Date().toISOString(),c=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,d=F({...e,submitted_at:n,created_by:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Add issue association",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[e.associated_issue,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}async delete(e){const{store:a}=this.client,n=this.selectors.selectById(e)(a.getState());if(!n)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(this.actions.deleteOne(e));const c=this.enqueueRequest({description:"Delete issue association",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return c.catch(()=>{this.dispatch(this.actions.addOne(n))}),c}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{associated_issue__project:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class Gg extends z{constructor(){super(...arguments);h(this,"name","Issue Attachment");h(this,"url","/issue-attachments");h(this,"actions",{addOne:Jy,addMany:vi,setOne:Xy,setMany:Qy,updateOne:xy,updateMany:ep,deleteOne:tp,deleteMany:Ei,initialize:Zy});h(this,"selectors",{selectById:ap,selectByIds:np})}getId(e){return e.uuid}buildModel(e){return F({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,issue:e.modelUuid})}buildPayload(e,a){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:a.extension,issue:e.issue}}async bulkAdd(e){return this._bulkAdd(e.map(a=>({modelUuid:a.issueUuid,file:a.file})))}async delete(e){return this._delete(e)}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{issue__project:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class kg extends z{constructor(){super(...arguments);h(this,"name","Issue Comment Attachment");h(this,"url","/issue-comment-attachments");h(this,"actions",{addOne:up,addMany:lp,setOne:op,setMany:hp,updateOne:mp,updateMany:yp,deleteOne:pp,deleteMany:Ap,initialize:rp});h(this,"selectors",{selectById:Sp,selectByIds:Tp})}getId(e){return e.uuid}buildModel(e){return F({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,issue_comment:e.modelUuid})}buildPayload(e,a){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:a.extension,issue_comment:e.issue_comment}}async bulkAdd(e){return this._bulkAdd(e.map(a=>({modelUuid:a.issueCommentUuid,file:a.file})))}async delete(e){return this._delete(e)}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{issue_comment__issue__project:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class Ng extends w{constructor(){super(...arguments);h(this,"name","Issue Comment");h(this,"url","/issue-comments");h(this,"actions",{addOne:Pp,addMany:gp,setOne:bp,setMany:_p,updateOne:Mp,updateMany:Rp,deleteOne:wp,deleteMany:vp,initialize:Fp});h(this,"selectors",{selectById:Ep,selectByIds:Vp})}add(e){const{store:a}=this.client,n=F({...e,author:a.getState().userReducer.currentUser.id,submitted_at:new Date().toISOString()});this.dispatch(this.actions.addOne(n));const c=this.enqueueRequest({description:"Add issue comment",method:y.POST,url:`${this.url}/`,payload:R(n),blockers:[e.issue],blocks:[n.uuid]});return c.catch(()=>{this.dispatch(this.actions.deleteOne(n.uuid))}),[n,c]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Edit issue comment",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}remove(e){const{store:a}=this.client,n=this.selectors.selectById(e)(a.getState());if(!n)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(this.actions.deleteOne(e));const c=this.enqueueRequest({description:"Delete comment",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return c.catch(()=>{this.dispatch(this.actions.addOne(n))}),c}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{issue__project:e}},a);return this.dispatch(this.actions.setMany(n)),n}}class Hg extends w{constructor(){super(...arguments);h(this,"name","Issue");h(this,"url","/issues");h(this,"actions",{addOne:qp,addMany:Di,setOne:$p,setMany:Dp,updateOne:Up,updateMany:Cp,deleteOne:Lp,deleteMany:Ui,initialize:jp});h(this,"selectors",{selectById:kp,selectByIds:Np})}add(e){var m;const{store:a}=this.client,n=a.getState(),c=new Date().toISOString(),d=((m=n.userReducer.currentUser)==null?void 0:m.id)??null,r=F({...e,submitted_at:c,created_by:d});this.dispatch(this.actions.addOne(r));const o=this.enqueueRequest({description:"Create issue",method:y.POST,url:`${this.url}/`,payload:R(r),blockers:[r.project,r.issue_type,...r.category?[r.category]:[]],blocks:[r.uuid]});return o.then(l=>{this.dispatch(this.actions.setOne(l))}).catch(l=>{throw this.dispatch(this.actions.deleteOne(r.uuid)),l}),[r,o]}update(e){var m;const a=this.client.store.getState(),n=this.selectors.selectById(e.uuid)(a);if(!n)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d={};for(const l of[B.TITLE,B.DESCRIPTION,B.STATUS,B.CATEGORY,B.PRIORITY,B.ASSIGNED_TO,B.DUE_DATE])if(l in e&&e[l]!==n[l])switch(l){case B.PRIORITY:d[l]=e[l];break;case B.DUE_DATE:d[l]=e[l];break;case B.DESCRIPTION:d[l]=e[l];break;case B.TITLE:d[l]=e[l];break;case B.STATUS:{const p=e[l],A=ia(p)(a);if(!A)throw new Error(`Trying to update issue type status with ${p} which does not exist in store`);d[l]={name:A.name,color:A.color,uuid:A.uuid};break}case B.CATEGORY:{const p=e[l];if(p===null)d[l]=null;else{const A=Xs(p)(a);if(!A)throw new Error(`Trying to update category with ${p} which does not exist in store.`);d[l]={name:A.name,color:A.color,uuid:A.uuid}}break}case B.ASSIGNED_TO:{const p=e[l];if(p===null)d[l]=null;else{const A=Et(p)(a);if(!A)throw new Error(`Trying to update assigned to with ${p} which does not exist in store.`);d[l]={full_name:A.username,id:A.id}}break}}const r=F({created_by:((m=a.userReducer.currentUser)==null?void 0:m.id)??null,submitted_at:new Date().toISOString(),issue:n.uuid,changes:d});this.dispatch(na(r));const o=this.enqueueRequest({description:"Edit issue",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return o.catch(()=>{this.dispatch(this.actions.setOne(n)),this.dispatch(da(r.uuid))}),[c,o]}async remove(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`No issue with uuid ${e} found in the store`);const d=ip(e)(n),r=SS(e)(n),o={};for(const l of Ny(e)(n))o[l.uuid]=l;for(const l of Hy(e)(n))o[l.uuid]=l;const m=Object.values(o);this.dispatch(this.actions.deleteOne(e)),d.length>0&&this.dispatch(Ei(d.map(({uuid:l})=>l))),r.length>0&&this.dispatch(ra(r.map(({uuid:l})=>l))),m.length>0&&this.dispatch(_t(m.map(({uuid:l})=>l)));try{return await this.enqueueRequest({description:"Delete issue",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(l){throw this.dispatch(this.actions.addOne(c)),this.dispatch(vi(d)),this.dispatch(ca(r)),this.dispatch(bt(m)),l}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{project:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class Wg extends z{constructor(){super(...arguments);h(this,"name","Issue Type Attachment");h(this,"url","/issue-type-attachments");h(this,"actions",{addOne:Zp,addMany:Jp,setOne:Xp,setMany:Qp,updateOne:xp,updateMany:eA,deleteOne:tA,deleteMany:sA,initialize:Yp});h(this,"selectors",{selectById:aA,selectByIds:nA})}getId(e){return e.uuid}buildModel(e){return F({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,issue_type:e.modelUuid})}buildPayload(e,a){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:a.extension,issue_type:e.issue_type}}async bulkAdd(e){return this._bulkAdd(e.map(a=>({modelUuid:a.issueTypeUuid,file:a.file})))}async delete(e){return this._delete(e)}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{issue_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class Kg extends z{constructor(){super(...arguments);h(this,"name","Issue Type Fields Attachment");h(this,"url","/issue-type-fields-attachments");h(this,"actions",{addOne:uA,addMany:lA,setOne:oA,setMany:hA,updateOne:mA,updateMany:yA,deleteOne:pA,deleteMany:AA,initialize:rA});h(this,"selectors",{selectById:SA,selectByIds:TA})}async bulkAdd(e){var m;const a=new Date().toISOString(),n=((m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id)??null,c={},d=[],r=[];for(const l of e){const{fieldsRevisionUuid:p,fieldIdentifier:A,file:T}=l,I=await this.client.files.getFilePayload(T);I.sha1 in c||(c[I.sha1]=I);const _=F({file:URL.createObjectURL(T),file_type:T.type,file_name:T.name,file_sha1:I.sha1,created_by:n,fields_revision:p,submitted_at:a,field_identifier:A});d.push(_);const M={uuid:_.uuid,file_name:T.name,file_extension:I.extension,field_identifier:A,file_sha1:I.sha1,fields_revision:p};r.push(M)}this.dispatch(this.actions.addMany(d));const o=this.enqueueRequest({description:"Add issue type fields attachments",method:y.POST,url:`${this.url}/bulk/`,payload:{submitted_at:a,attachments:r,files:Object.values(c)},blockers:d.map(l=>l.fields_revision),blocks:d.map(l=>l.uuid)});return o.then(l=>{this.client.files.processPresignedUrls(l.presigned_urls),this.dispatch(this.actions.setMany(l.attachments))}).catch(()=>{this.dispatch(this.actions.deleteMany(d.map(l=>l.uuid)))}),[d,o.then(({attachments:l})=>l)]}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{fields_revision__issue_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class Yg extends w{constructor(){super(...arguments);h(this,"name","Issue Type Fields");h(this,"url","/issue-type-fields");h(this,"actions",{addOne:$A,addMany:DA,setOne:UA,setMany:CA,updateOne:LA,updateMany:GA,deleteOne:kA,deleteMany:NA,initialize:qA});h(this,"selectors",{selectById:WA,selectByIds:KA})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Add Issue Type Fields",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[d.issue_type],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(m=>{throw this.dispatch(this.actions.deleteOne(d.uuid)),m}),[d,r]}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{issue_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class Zg extends z{constructor(){super(...arguments);h(this,"name","Issue Type Field Values Attachment");h(this,"url","/issue-type-field-values-attachments");h(this,"actions",{addOne:XA,addMany:Ki,setOne:QA,setMany:xA,updateOne:ef,updateMany:tf,deleteOne:sf,deleteMany:Yi,initialize:JA});h(this,"selectors",{selectById:nf,selectByIds:cf})}async bulkAdd(e){var m;const a=new Date().toISOString(),n=((m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id)??null,c={},d=[],r=[];for(const l of e){const{fieldValuesUuid:p,fieldIdentifier:A,file:T}=l,I=await this.client.files.getFilePayload(T);I.sha1 in c||(c[I.sha1]=I);const _=F({file:URL.createObjectURL(T),file_type:T.type,file_name:T.name,file_sha1:I.sha1,created_by:n,field_values:p,submitted_at:a,field_identifier:A});d.push(_);const M={uuid:_.uuid,file_name:T.name,file_sha1:I.sha1,file_extension:I.extension,field_identifier:A,field_values:p};r.push(M)}this.dispatch(this.actions.addMany(d));const o=this.enqueueRequest({description:"Add issue type field values attachments",method:y.POST,url:`${this.url}/bulk/`,payload:{submitted_at:a,attachments:r,files:Object.values(c)},blockers:d.map(l=>l.field_values),blocks:d.map(l=>l.uuid)});return o.then(({presigned_urls:l,attachments:p})=>{this.client.files.processPresignedUrls(l),this.dispatch(this.actions.setMany(p))}).catch(l=>{throw this.dispatch(this.actions.deleteMany(d.map(p=>p.uuid))),l}),[d,o.then(({attachments:l})=>l)]}async bulkDelete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectByIds(e)(n);this.dispatch(this.actions.deleteMany(e));try{await this.enqueueRequest({description:"Delete issue type field values attachments",method:y.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(this.actions.addMany(c)),d}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{field_values__issue__project:e,latest:!0}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class Jg extends w{constructor(){super(...arguments);h(this,"name","Issue Type Field Values");h(this,"url","/issue-type-field-values");h(this,"actions",{addOne:PA,addMany:gA,setOne:bA,setMany:_A,updateOne:MA,updateMany:RA,deleteOne:wA,deleteMany:vA,initialize:FA});h(this,"selectors",{selectById:VA,selectByIds:zA})}add(e){var m;const{store:a}=this.client,c=((m=a.getState().userReducer.currentUser)==null?void 0:m.id)??null,d=new Date().toISOString(),r=F({...e,created_by:c,submitted_at:d}),o=this.enqueueRequest({description:"Add issue type field values",method:y.POST,url:`${this.url}/`,payload:R(r),blockers:[e.issue,e.fields_revision],blocks:[r.uuid]});return this.dispatch(this.actions.addOne(r)),o.then(l=>(this.dispatch(this.actions.setOne(l)),l)).catch(()=>{this.dispatch(this.actions.deleteOne(r.uuid))}),[r,o]}update(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e.uuid)(n);if(!c)throw new Error(`Expected IssueTypeFieldValues with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(this.actions.setOne(d));const r=this.enqueueRequest({description:"Update issue type field values",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.uuid,d.fields_revision,d.issue],blocks:[d.uuid]});return r.then(o=>{this.dispatch(this.actions.setOne(o))}).catch(()=>{this.dispatch(this.actions.setOne(c))}),[d,r]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const d=df(e)(n);this.dispatch(this.actions.deleteOne(e)),this.dispatch(Yi(d.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete issue type field values",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(this.actions.addOne(c)),this.dispatch(Ki(d)),r}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{issue__project:e,latest:!0}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class Xg extends w{constructor(){super(...arguments);h(this,"name","Issue Type Identifier");h(this,"url","/issue-type-identifiers");h(this,"actions",{addOne:of,addMany:hf,setOne:mf,setMany:yf,updateOne:pf,updateMany:Af,deleteOne:ff,deleteMany:Sf,initialize:lf});h(this,"selectors",{selectById:If,selectByIds:Of})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create issue type identifier",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[d.issue_type],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`Expected issue type identifier with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update issue type identifier",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected issue type identifier with uuid ${e} to exist`);this.dispatch(this.actions.deleteOne(e));try{return await this.enqueueRequest({description:"Delete issue type identifier",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(this.actions.addOne(c)),d}}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{issue_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class Qg extends w{constructor(){super(...arguments);h(this,"name","Issue Type Identifier Value");h(this,"url","/issue-type-identifier-values");h(this,"actions",{addOne:bf,addMany:_f,setOne:Mf,setMany:Rf,updateOne:wf,updateMany:vf,deleteOne:Ef,deleteMany:Vf,initialize:gf});h(this,"selectors",{selectById:Bf,selectByIds:jf})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create issue type identifier value",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[e.issue,e.issue_type_identifier],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`Expected issue type identifier value with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update issue type identifier value",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected issue type identifier value with uuid ${e} to exist`);this.dispatch(this.actions.deleteOne(e));try{return await this.enqueueRequest({description:"Delete issue type identifier value",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(this.actions.addOne(c)),d}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{issue__project:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class xg extends w{constructor(){super(...arguments);h(this,"name","Issue Type");h(this,"url","/issue-types");h(this,"actions",{addOne:Uf,addMany:Cf,setOne:Lf,setMany:Gf,updateOne:kf,updateMany:Nf,deleteOne:Hf,deleteMany:Wf,initialize:Df});h(this,"selectors",{selectById:Yf,selectByIds:Zf})}add(e){var m;const{store:a}=this.client,c=((m=a.getState().userReducer.currentUser)==null?void 0:m.id)??null,d=new Date().toISOString(),r=F({...e,submitted_at:d,created_by:c});this.dispatch(this.actions.addOne(r));const o=this.enqueueRequest({method:y.POST,url:`${this.url}/`,payload:R(r),blockers:[],blocks:[r.uuid]});return o.then(l=>{this.dispatch(this.actions.setOne(l))}).catch(()=>{this.dispatch(this.actions.deleteOne(r.uuid))}),[r,o]}update(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e.uuid)(n);if(!c)throw new Error(`IssueType with uuid ${e.uuid} does not exist in the store.`);const d={...c,...e};this.dispatch(this.actions.setOne(d));const r=this.enqueueRequest({method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(o=>{this.dispatch(this.actions.setOne(o))}).catch(()=>{this.dispatch(this.actions.setOne(c))}),[d,r]}delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const d=Hp(e)(n);this.dispatch(this.actions.deleteOne(e)),this.dispatch(Ui(d.map(o=>o.uuid)));const r=this.enqueueRequest({method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return r.catch(()=>{this.dispatch(this.actions.setOne(c)),this.dispatch(Di(d))}),r}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class eb extends w{constructor(){super(...arguments);h(this,"name","Issue Type Status");h(this,"url","/issue-type-statuses");h(this,"actions",{addOne:xf,addMany:eS,setOne:tS,setMany:sS,updateOne:iS,updateMany:aS,deleteOne:nS,deleteMany:cS,initialize:Qf});h(this,"selectors",{selectById:ia,selectByIds:rS})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create Issue Type Status",method:y.POST,url:`${this.url}/`,payload:R(d),blockers:[e.issue_type],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const a=this.client.store.getState(),n=this.selectors.selectById(e.uuid)(a);if(!n)throw new Error(`Expected an existing issue type status with uuid ${e.uuid}`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Edit Issue Type Status",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}delete(e){const{store:a}=this.client,n=this.selectors.selectById(e)(a.getState());if(!n)throw new Error(`No issue type status with uuid ${e} found in the store`);this.dispatch(this.actions.deleteOne(e));const c=this.enqueueRequest({description:"Delete Issue Type Status",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return c.catch(()=>{this.dispatch(this.actions.addOne(n))}),c}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{issue_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class tb extends w{constructor(){super(...arguments);h(this,"name","Issue Update");h(this,"url","/issue-updates");h(this,"actions",{addOne:na,addMany:ca,setOne:hS,setMany:mS,updateOne:yS,updateMany:pS,deleteOne:da,deleteMany:ra,initialize:oS});h(this,"selectors",{selectById:AS,selectByIds:fS})}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{issue__project:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}const sb=1800;function ib(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 ab extends xP{constructor(){super(...arguments);h(this,"_getRenewedTokens",async e=>{const a=this.performRequest({method:y.POST,url:this.refreshTokensUrl,payload:{refresh:e},isAuthNeeded:!1,checkAuth:!1});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(Ro(!1)),this.clearTokens(),this.dispatch(O()),this.dispatch(O())}async renewTokens(){const e=this.getRefreshToken();if(!e)throw new Error("No refresh token found");console.debug(this.constructor.name,"renewing tokens");try{const a=await this._getRenewedTokens(e);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 e=this.getAccessToken();if(!e)return!1;const a=Date.now()/1e3;let n;try{n=MO(e).exp??a}catch{n=a}return n-a<sb}getAuthHeader(){return`Bearer ${this.getAccessToken()}`}async prepareAuth(){if(this.tokenIsExpiringSoon()){console.debug(this.constructor.name,"preparing auth");try{await this.renewTokens()}catch(e){return e instanceof q&&this.clearAuth(),e instanceof Error?Promise.reject(e):Promise.reject(new Error((e??tt).toString()))}}}async handleUnauthorized(e,a){const n=this.client.store.getState();if(e.url.endsWith("/token/refresh/"))throw n.authReducer.isLoggedIn&&console.warn("No signed-in user to sign out."),this.clearAuth(),new q({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 q({message:"Incorrect username or password.",response:a,discard:!0})}async initAuth(e){const a=xe.v4();return console.debug(this.constructor.name,"Initiating auth"),this.performRequest({uuid:a,method:y.POST,url:this.initTokensUrl,payload:e,isAuthNeeded:!1,checkAuth:!1}).then(n=>{this.setTokens(ib(n))})}}class nb extends st{constructor(){super(...arguments);h(this,"name","Organization Access");h(this,"url","/organization-accesses");h(this,"actions",{addOne:zS,addMany:BS,setOne:jS,setMany:qS,updateOne:$S,updateMany:DS,deleteOne:US,deleteMany:CS,initialize:VS});h(this,"selectors",{selectById:GS,selectByIds:kS})}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState()),c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Edit organization access",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(r=>{throw this.dispatch(this.actions.setOne(n)),r}),[c,d]}async remove(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n),d=Et(c.user)(n);this.dispatch(this.actions.deleteOne(c.uuid)),this.dispatch(ma(c.user));try{await this.enqueueRequest({description:"Remove organization access",method:y.DELETE,url:`${this.url}/${c.uuid}/`,blockers:[c.uuid],blocks:[]})}catch(r){throw this.dispatch(this.actions.addOne(c)),this.dispatch(ha(d)),r}}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class cb extends st{constructor(){super(...arguments);h(this,"name","Organization");h(this,"url","/organizations");h(this,"actions",{addOne:JS,addMany:ZS,setOne:YS,setMany:KS,updateOne:QS,updateMany:XS,deleteOne:xS,deleteMany:eT,initialize:WS});h(this,"selectors",{selectById:iT,selectByIds:aT})}async add(e){const a=await this.enqueueRequest({description:"Create organization",method:y.POST,url:`${this.url}/`,payload:e,blockers:[],blocks:[]});return this.dispatch(this.actions.addOne(a)),a}async update(e){const a=await this.enqueueRequest({description:"Edit organization",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return this.dispatch(this.actions.setOne(a)),a}async invite(e,a){return this.enqueueRequest({description:"Invite user to organization",method:y.POST,url:`${this.url}/${e}/invite/${a}/`,blockers:[],blocks:[]})}async refreshStore(e){const a=await this.performRequest({method:y.GET,url:`${this.url}/`},e);return this.dispatch(this.actions.initialize(a)),a}}class db extends w{constructor(){super(...arguments);h(this,"name","Project Access");h(this,"url","/project-accesses");h(this,"actions",{addOne:yT,addMany:pT,setOne:AT,setMany:fT,updateOne:ST,updateMany:TT,deleteOne:IT,deleteMany:OT,initialize:mT});h(this,"selectors",{selectById:PT,selectByIds:gT})}add(e){var d;const{store:a}=this.client,n=F({...e,created_by:((d=a.getState().userReducer.currentUser)==null?void 0:d.id)??null});this.dispatch(this.actions.addOne(n));const c=this.enqueueRequest({description:"Add project access",method:y.POST,url:`${this.url}/`,payload:R(n),blockers:[n.organization_access,n.project],blocks:[n.uuid]});return c.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(r=>{throw this.dispatch(this.actions.deleteOne(n.uuid)),r}),[n,c]}bulkAdd(e){var r;const{store:a}=this.client,n=((r=a.getState().userReducer.currentUser)==null?void 0:r.id)??null,c=e.map(o=>F({...o,created_by:n}));this.dispatch(this.actions.addMany(c));const d=this.enqueueRequest({description:"Add project accesses",method:y.POST,url:`${this.url}/bulk/`,payload:{project_accesses:c.map(o=>R(o))},blockers:c.flatMap(o=>[o.project,o.organization_access]),blocks:c.map(o=>o.uuid)});return d.then(o=>{this.dispatch(this.actions.setMany(o))}).catch(o=>{throw this.dispatch(this.actions.deleteMany(c.map(m=>m.uuid))),o}),[c,d]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState()),c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Edit project access",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(r=>{throw this.dispatch(this.actions.setOne(n)),r}),[c,d]}async remove(e){const{store:a}=this.client,n=this.selectors.selectById(e)(a.getState());this.dispatch(this.actions.deleteOne(e));try{await this.enqueueRequest({description:"Delete project access",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(this.actions.addOne(n)),c}}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{project__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class rb extends z{constructor(){super(...arguments);h(this,"name","Project Attachment");h(this,"url","/project-attachments");h(this,"actions",{addOne:MT,addMany:RT,setOne:wT,setMany:vT,updateOne:ET,updateMany:VT,deleteOne:zT,deleteMany:BT,initialize:_T});h(this,"selectors",{selectById:qT,selectByIds:$T})}getId(e){return e.uuid}buildModel(e){return F({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,project:e.modelUuid})}buildPayload(e,a){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:a.extension,project:e.project}}async bulkAdd(e){return this._bulkAdd(e.map(a=>({modelUuid:a.projectUuid,file:a.file})))}async delete(e){return this._delete(e)}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{project__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class ub extends w{constructor(){super(...arguments);h(this,"name","Project File");h(this,"url","/project-files");h(this,"actions",{addOne:kT,addMany:NT,setOne:LT,setMany:GT,updateOne:HT,updateMany:WT,deleteOne:KT,deleteMany:YT,initialize:CT});h(this,"selectors",{selectById:eI,selectByIds:tI})}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 a={...e};delete a.file;const n=this.enqueueRequest({method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:a,blockers:[e.uuid],blocks:[e.uuid]});return n.then(c=>{this.dispatch(this.actions.setOne(c))}),n}saveActive(){const{store:e}=this.client,a=e.getState(),n=a.projectFileReducer.activeProjectFileId;if(!n)throw new Error("No active project file");const c=a.projectFileReducer.instances[n];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 d;if(typeof c.file=="string"&&!c.file.startsWith("blob:")){const m={...c};delete m.file,d={method:y.PATCH,url:`${this.url}/${n}/`,payload:m,blockers:[n],blocks:[n]}}else d=new Promise((m,l)=>{this.client.files.uploadFileToS3(c.file_sha1).then(([p])=>{m({method:y.POST,url:`${this.url}/`,payload:{...c,...p},blockers:[n],blocks:[n]})}).catch(l)});const o=Promise.resolve(d).then(m=>this.enqueueRequest(m));return o.then(m=>{this.dispatch(this.actions.setOne(m))}),this.dispatch(XT),this.dispatch(JT(null)),this.dispatch(ZT(!1)),[c,o]}delete(e){return this.dispatch(this.actions.deleteOne(e)),this.enqueueRequest({method:y.DELETE,url:`${this.url}/${e}`,blockers:[e],blocks:[]})}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{project:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class lb extends st{constructor(){super(...arguments);h(this,"name","Project");h(this,"url","/projects");h(this,"actions",{addOne:rI,addMany:dI,setOne:cI,setMany:nI,updateOne:lI,updateMany:uI,deleteOne:oI,deleteMany:hI,initialize:aI});h(this,"selectors",{selectById:pI,selectByIds:AI})}async add(e){const{addOne:a}=this.actions,n=await this.performRequest({method:y.POST,url:`${this.url}/`,payload:R(e)});return this.dispatch(a(n)),n}async update(e){const{updateOne:a}=this.actions,n=await this.performRequest({method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:R(e)});return this.dispatch(a(n)),n}async delete(e){const{deleteOne:a}=this.actions,n=await this.enqueueRequest({description:"Delete project",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return this.dispatch(a(e)),n}async refreshStore(e,a){const{initialize:n}=this.actions,c=await this.list({queryParams:{organization:e}},a);return this.dispatch(n(c)),c}}class ob extends w{constructor(){super(...arguments);h(this,"name","Team Membership");h(this,"url","/team-memberships");h(this,"actions",{addOne:II,addMany:OI,setOne:FI,setMany:PI,updateOne:gI,updateMany:bI,deleteOne:_I,deleteMany:MI,initialize:TI});h(this,"selectors",{selectById:vI,selectByIds:EI})}add(e){var d;const{store:a}=this.client,n=F({...e,created_by:((d=a.getState().userReducer.currentUser)==null?void 0:d.id)??null});this.dispatch(this.actions.addOne(n));const c=this.enqueueRequest({description:"Create team membership",method:y.POST,url:`${this.url}/`,payload:R(n),blockers:[e.team],blocks:[n.uuid]});return c.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.deleteOne(n.uuid))}),[n,c]}bulkAdd(e){var r;const{store:a}=this.client,n=((r=a.getState().userReducer.currentUser)==null?void 0:r.id)??null,c=e.map(o=>F({...o,created_by:n}));this.dispatch(this.actions.addMany(c));const d=this.enqueueRequest({description:"Create team memberships",method:y.POST,url:`${this.url}/bulk/`,payload:{team_memberships:c.map(o=>R(o))},blockers:c.map(o=>o.team),blocks:c.map(o=>o.uuid)});return d.then(o=>{this.dispatch(this.actions.setMany(o))}).catch(()=>{this.dispatch(this.actions.deleteMany(c.map(o=>o.uuid)))}),[c,d]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected team membership with uuid ${e} to exist`);this.dispatch(this.actions.deleteOne(e));try{return await this.enqueueRequest({description:"Delete team membership",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(d){throw this.dispatch(this.actions.setOne(c)),d}}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{team__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class hb extends w{constructor(){super(...arguments);h(this,"name","Team");h(this,"url","/teams");h(this,"actions",{addOne:BI,addMany:jI,setOne:qI,setMany:$I,updateOne:DI,updateMany:UI,deleteOne:CI,deleteMany:LI,initialize:zI});h(this,"selectors",{selectById:kI,selectByIds:NI})}add(e){var d;const{store:a}=this.client,n=F({...e,submitted_at:new Date().toISOString(),created_by:((d=a.getState().userReducer.currentUser)==null?void 0:d.id)??null});this.dispatch(this.actions.addOne(n));const c=this.enqueueRequest({description:"Create team",method:y.POST,url:`${this.url}/`,payload:R(n),blockers:[],blocks:[n.uuid]});return c.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.deleteOne(n.uuid))}),[n,c]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`Expected team with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update team",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:R(e),blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(this.actions.deleteOne(e));try{return await this.enqueueRequest({description:"Delete team",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(d){throw this.dispatch(this.actions.setOne(c)),d}}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class mb extends st{constructor(){super(...arguments);h(this,"name","User");h(this,"url","/user");h(this,"actions",{addOne:ha,addMany:gS,setOne:PS,setMany:FS,updateOne:_S,updateMany:bS,deleteOne:ma,deleteMany:MS,initialize:OS});h(this,"selectors",{selectById:Et,selectByIds:vS})}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`/organizations/${e}${this.url}s/`},a);return this.dispatch(this.actions.initialize(n)),n}}async function za(t,s,e,a,n){const c=a instanceof Ze;c&&s.checkAuth!==!1&&await a.auth.prepareAuth();const d={queryParams:"",isAuthNeeded:!0},{s3url:r,payload:o,headers:m,method:l,queryParams:p,attachmentHash:A,isExternalUrl:T,isAuthNeeded:I,isResponseBlob:_}={...d,...s};let M=s.url;const g=A?await e.files.fetchCache(A):void 0;if(A&&!g)throw new Error(`Cannot upload file ${A} because it's not cached.`);!T&&!M.startsWith("http")&&(!M.startsWith("/")&&!M.startsWith("blob:")&&(M="/"+M),M=t+M);const v=j=>{if(A){if(!r)throw new Error(`No S3 URL for file ${A}`);if("warning"in r)throw new Error(`S3 URL warning for file ${A}`);if(!g)throw new Error(`No file for file ${A}`);const Ye=r.fields["x-amz-checksum-sha1"];if(!Ye)throw new Error(`No checksum for file ${A}`);return j.set("x-amz-checksum-sha1",Ye).field({...o,...r.fields}).attach("file",g)}return j.send(o)},Ke={[y.GET]:()=>_?Qe.get(M.toString()).responseType("blob"):Qe.get(M.toString()),[y.POST]:()=>{const j=Qe.post(M.toString());return v(j)},[y.PATCH]:()=>{const j=Qe.patch(M.toString());return v(j)},[y.PUT]:()=>{const j=Qe.put(M.toString());return v(j)},[y.DELETE]:()=>{const j=Qe.delete(M.toString());return v(j)}}[l];let D=Ke();if(n==null||n.addEventListener("abort",()=>{console.debug("aborting request:",s),D.abort()}),I&&c){const j=a.auth.getAuthHeader();D=D.set("Authorization",j)}m&&(D=D.set(m));try{return await D.query(p)}catch(j){const Ye=rO(j),IO=Ye==null?void 0:Ye.status;if(c&&IO===401)return await a.auth.handleUnauthorized(D,Ye),D.query(p);throw new q({response:Ye,innerError:j,discard:wa.includes(IO)})}}class yb{constructor(s){h(this,"store");this.store=s}_performRequest(s,e,a,n){const c=new Dt,d={...e,uuid:e.uuid??xe.v4()};return za(s,d,this,a,n).then(r=>{c.resolve(r.body)}).catch(r=>{r instanceof Error?c.reject(r):c.reject(new Error((r??tt).toString()))}),c}async performRequest(s,e,a,n){return this._performRequest(s,e,a,n).then(c=>{if(c instanceof q)throw c;return c})}async enqueueRequest(s,e,a){return this._enqueueRequest(s,e,a).then(n=>{if(n instanceof q)throw n;return n})}_enqueueRequest(s,e,a){const n=new Dt,c={...s,BASE_URL:e,serviceName:a},d=this.store.dispatch(rT(c)),r=m=>{if(m)n.resolve(m.body);else{const l=new q({message:"Could not get a response from the server.",response:m,discard:!0});n.reject(l)}},o=m=>{m instanceof q?m.options.discard=!0:(console.error("Received an unexpected error while processing a request:",m,`
15
- Converting error to APIError and discarding.`),m=new q({message:"An error occurred while processing the request.",innerError:m,discard:!0})),n.reject(m)};return d.then(r,o),n}async performPagination(s,e,a,n,c){const d={...e,queryParams:{...e.queryParams,paginate:!0,limit:a}},{method:r}=d,o=[];let m=await this.performRequest(s,d,n,c);for(o.push(m.results);m.next;)m=await this.performRequest(s,{url:m.next,method:r},n,c),o.push(m.results);return o}}class it{constructor(){h(this,"graph");h(this,"requestAttemptCounter");this.graph=new RO.DepGraph,this.requestAttemptCounter={}}static _fromOutbox(s){const e=new it;for(let a=0;a<s.length;a++){const n=s[a];if(!n){console.error("Outbox item was undefined");continue}e.sneakRequest(n);for(let c=0;c<a;c++){const d=s[c];if(!d){console.error("Previous outbox item was undefined");continue}d.payload.uuid!==n.payload.uuid&&d.payload.blocks.some(r=>n.payload.blockers.includes(r))&&it._addDependency(n.payload.uuid,d.payload.uuid,e.graph)}}return e}_addDependency(s,e){it._addDependency(s,e,this.graph)}static _addDependency(s,e,a){if(s===e)throw new Error(`Tried to add dependency from node to itself: ${s}`);if(!a.hasNode(s))throw new Error(`Tried to add dependency from non-existent node: ${s} (to node: ${e})`);if(!a.hasNode(e))throw new Error(`Tried to add dependency to non-existent node: ${e} (from node: ${s})`);a.addDependency(s,e)}addRequest(s){if(this.graph.addNode(s.payload.uuid,s),!(s.payload.blockers.length===0||this.graph.size()===1))for(const e of this.graph.overallOrder()){if(e===s.payload.uuid)continue;const a=this.graph.getNodeData(e);s.payload.blockers.some(n=>a.payload.blocks.includes(n))&&this._addDependency(s.payload.uuid,e)}}insertRequest(s){this.graph.addNode(s.payload.uuid,s);for(const e of this.graph.overallOrder()){if(e===s.payload.uuid)continue;this.graph.getNodeData(e).payload.blockers.some(n=>s.payload.blocks.includes(n))&&this._addDependency(e,s.payload.uuid)}}sneakRequest(s){this.graph.addNode(s.payload.uuid,s)}_getNextNode(){const s=this.graph.overallOrder(!0);let e=1/0,a;for(const n of s){const c=this.requestAttemptCounter[n]||0;c<e&&(e=c,a=n)}return a}peek(){const s=this._getNextNode();if(s)return this.graph.getNodeData(s)}remove(s){this.graph.removeNode(s),delete this.requestAttemptCounter[s]}pop(){const s=this.peek();return s&&this.graph.removeNode(s.payload.uuid),s}getQueue(){const s=this.graph.overallOrder().map(a=>this.graph.getNodeData(a)),e=this._getNextNode();if(e){const a=this.graph.getNodeData(e),n=s.findIndex(c=>c.payload.uuid===a.payload.uuid);n!==-1&&(s.splice(n,1),s.unshift(a))}return s}getReady(){let s=this.graph.overallOrder(!0).map(e=>this.graph.getNodeData(e));return s=s.sort((e,a)=>e.meta.offline.effect.timestamp.localeCompare(a.meta.offline.effect.timestamp)),s=s.sort((e,a)=>{const n=this.requestAttemptCounter[e.payload.uuid]||0,c=this.requestAttemptCounter[a.payload.uuid]||0;return n-c}),s}registerRetry(s){this.requestAttemptCounter[s]=(this.requestAttemptCounter[s]||0)+1}}let uO;function lO(t){uO=t}function at(){return uO}let oO;function hO(t){oO=t}function mO(){return oO}let Ba=null;function Xe(){const t=at();if(!t)return console.warn("Client store not set; cannot get outbox coordinator yet."),null;if(Ba)return Ba;const s=t.getState().offline.outbox,e=it._fromOutbox(s);return Ba=e,e}const pb=(t,s)=>{const e=new s(t);return hO(e),lO(t),e};class Ab{constructor(s){h(this,"_all");h(this,"_previous");this._all=[s],this._previous=s,this.then=this.then.bind(this),this.compile=this.compile.bind(this)}then(s){return this._previous&&(this._previous.next=s),this._all.push(s),this._previous=s,{then:this.then,compile:this.compile}}compile(){return this._all}}class ja{constructor(){h(this,"next");this.next=null}then(s){return new Ab(this).then(s)}async run(s){if(this.next)return this.next.run(s);{if(console.debug("Middleware finished. Performing request:",s),!at())throw new Error("Client store not set");const a=mO();if(!a)throw new Error("Client SDK not set");return nO(s,a)}}}class yO extends ja{async run(s){return super.run(s)}}class pO extends ja{async run(s){return super.run(s)}}const AO=new yO().then(new pO).compile();function fO(t){var s;return(s=AO[0])==null?void 0:s.run(t)}var SO=(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))(SO||{});i.ALL_MIDDLEWARE=AO,i.APIError=q,i.ATTACHMENT_MODEL_DEFAULT_PAGE_SIZE=JI,i.AgentService=eg,i.AssetAttachmentService=tg,i.AssetProcedureService=dg,i.AssetProcedureStepFieldValuesAttachmentService=og,i.AssetProcedureStepFieldValuesService=hg,i.AssetProcedureStepFieldsAttachmentService=ug,i.AssetProcedureStepFieldsService=lg,i.AssetProcedureStepService=mg,i.AssetProcedureTypeAttachmentService=sg,i.AssetProcedureTypeFieldValuesAttachmentService=ng,i.AssetProcedureTypeFieldValuesService=cg,i.AssetProcedureTypeFieldsAttachmentService=ig,i.AssetProcedureTypeFieldsService=ag,i.AssetProcedureTypeService=rg,i.AssetService=yg,i.AssetStageCompletionService=pg,i.AssetStageService=Ag,i.AssetStatusType=La,i.AssetTypeAttachmentService=fg,i.AssetTypeFieldValuesAttachmentService=Ig,i.AssetTypeFieldValuesService=Og,i.AssetTypeFieldsAttachmentService=Sg,i.AssetTypeFieldsService=Tg,i.AssetTypeIdentifierService=Fg,i.AssetTypeIdentifierValueService=Pg,i.AssetTypeService=gg,i.AssetTypeStatusService=bg,i.AttachmentModel=Ga,i.BaseApiService=Ze,i.BaseModelApiService=st,i.BaseOfflineAttachmentModelService=z,i.BaseOfflineModelApiService=w,i.BaseSDK=yb,i.COMMON_AUTO_FIELDS=Za,i.CategoryService=_g,i.DEFAULT_ISSUE_PRIORITY=wO,i.DEFAULT_PAGE_SIZE=ZI,i.DISCARD_HTTP_STATUSES=wa,i.DeferredPromise=Dt,i.DocumentAttachmentService=Mg,i.DocumentService=Rg,i.EMPTY_ARRAY=Da,i.EMPTY_OBJECT=Ua,i.EmailDomainsService=wg,i.EmailVerificationService=vg,i.FileService=Vg,i.FormIdentifierService=zg,i.FormIdentifierValueService=Bg,i.FormRevisionAttachmentService=jg,i.FormRevisionService=qg,i.FormService=$g,i.FormSubmissionAttachmentService=Dg,i.FormSubmissionService=Ug,i.GeoImageService=Cg,i.HttpMethod=y,i.IssueAssociationService=Lg,i.IssueAttachmentService=Gg,i.IssueCommentAttachmentService=kg,i.IssueCommentService=Ng,i.IssuePriority=$t,i.IssueService=Hg,i.IssueStatusType=ka,i.IssueTypeAttachmentService=Wg,i.IssueTypeFieldValuesAttachmentService=Zg,i.IssueTypeFieldValuesService=Jg,i.IssueTypeFieldsAttachmentService=Kg,i.IssueTypeFieldsService=Yg,i.IssueTypeIdentifierService=Xg,i.IssueTypeIdentifierValueService=Qg,i.IssueTypeService=xg,i.IssueTypeStatusService=eb,i.IssueUpdateChange=B,i.IssueUpdateService=tb,i.JWTService=ab,i.OUTBOX_RETRY_DELAY=Na,i.OfflineAnalyticsMiddleware=yO,i.OfflineMiddleware=ja,i.OrganizationAccessLevel=Ca,i.OrganizationAccessService=nb,i.OrganizationService=cb,i.OutboxCoordinator=it,i.ProjectAccessService=db,i.ProjectAttachmentService=rb,i.ProjectFileService=ub,i.ProjectService=lb,i.RESET_ORGANIZATION_STATE=b,i.RESET_PROJECT_STATE=E,i.RESET_STATE=O,i.RateLimitingMiddleware=pO,i.SelectorBuilder=CP,i.TeamMembershipService=ob,i.TeamService=hb,i.UNKNOWN_ERROR_MESSAGE=tt,i.UserService=mb,i.VERSION_REDUCER_KEY=nt,i.VerificationCodeType=SO,i._setLatestRetryTime=lT,i.addAsset=_r,i.addAssetAttachment=on,i.addAssetAttachments=Wt,i.addAssetProcedure=Uc,i.addAssetProcedureStep=yr,i.addAssetProcedureStepFieldValues=Qd,i.addAssetProcedureStepFieldValuesAttachment=Ud,i.addAssetProcedureStepFieldValuesAttachments=ps,i.addAssetProcedureStepFieldValuesMany=xd,i.addAssetProcedureStepFields=_d,i.addAssetProcedureStepFieldsAttachment=hd,i.addAssetProcedureStepFieldsAttachments=md,i.addAssetProcedureStepFieldsMany=Md,i.addAssetProcedureSteps=pr,i.addAssetProcedureType=Qc,i.addAssetProcedureTypeAttachment=gn,i.addAssetProcedureTypeAttachments=bn,i.addAssetProcedureTypeFieldValues=bc,i.addAssetProcedureTypeFieldValuesAttachment=hc,i.addAssetProcedureTypeFieldValuesAttachments=ts,i.addAssetProcedureTypeFieldValuesMany=_c,i.addAssetProcedureTypeFields=Qn,i.addAssetProcedureTypeFieldsAttachment=Dn,i.addAssetProcedureTypeFieldsAttachments=Un,i.addAssetProcedureTypeFieldsMany=xn,i.addAssetProcedureTypes=xc,i.addAssetProcedures=cs,i.addAssetStage=tu,i.addAssetStageCompletion=Dr,i.addAssetStageCompletions=Ur,i.addAssetStages=su,i.addAssetType=so,i.addAssetTypeAttachment=hu,i.addAssetTypeAttachments=Es,i.addAssetTypeFieldValues=hl,i.addAssetTypeFieldValuesAttachment=xu,i.addAssetTypeFieldValuesAttachments=Ds,i.addAssetTypeFieldValuesMany=ml,i.addAssetTypeFields=Uu,i.addAssetTypeFieldsAttachment=bu,i.addAssetTypeFieldsAttachments=_u,i.addAssetTypeFieldsMany=Cu,i.addAssetTypeIdentifier=_l,i.addAssetTypeIdentifierValue=Cl,i.addAssetTypeIdentifierValues=Ll,i.addAssetTypeIdentifiers=Ml,i.addAssetTypeStatus=po,i.addAssetTypeStatuses=Ao,i.addAssetTypes=io,i.addAssets=Fs,i.addCategories=zo,i.addCategory=Vo,i.addConversation=nn,i.addConversations=tF,i.addDocument=nh,i.addDocumentAttachment=Ho,i.addDocumentAttachments=Wo,i.addDocuments=ch,i.addEmailDomain=Th,i.addEmailDomains=Ih,i.addForm=qm,i.addFormIdentifier=Dh,i.addFormIdentifierValue=Qh,i.addFormIdentifierValues=xh,i.addFormIdentifiers=Uh,i.addFormRevision=ui,i.addFormRevisionAttachment=hm,i.addFormRevisionAttachments=mm,i.addFormRevisions=li,i.addFormSubmission=ly,i.addFormSubmissionAttachment=Jm,i.addFormSubmissionAttachments=fi,i.addFormSubmissions=Pi,i.addForms=$m,i.addGeoImage=Py,i.addGeoImages=gy,i.addIssue=qp,i.addIssueAssociation=Uy,i.addIssueAssociations=bt,i.addIssueAttachment=Jy,i.addIssueAttachments=vi,i.addIssueComment=Pp,i.addIssueCommentAttachment=up,i.addIssueCommentAttachments=lp,i.addIssueComments=gp,i.addIssueType=Uf,i.addIssueTypeAttachment=Zp,i.addIssueTypeAttachments=Jp,i.addIssueTypeFieldValues=PA,i.addIssueTypeFieldValuesAttachment=XA,i.addIssueTypeFieldValuesAttachments=Ki,i.addIssueTypeFieldValuesMany=gA,i.addIssueTypeFields=$A,i.addIssueTypeFieldsAttachment=uA,i.addIssueTypeFieldsAttachments=lA,i.addIssueTypeFieldsMany=DA,i.addIssueTypeIdentifier=of,i.addIssueTypeIdentifierValue=bf,i.addIssueTypeIdentifierValues=_f,i.addIssueTypeIdentifiers=hf,i.addIssueTypeStatus=xf,i.addIssueTypeStatuses=eS,i.addIssueTypes=Cf,i.addIssueUpdate=na,i.addIssueUpdates=ca,i.addIssues=Di,i.addOrganization=JS,i.addOrganizationAccess=zS,i.addOrganizationAccesses=BS,i.addOrganizations=ZS,i.addProject=rI,i.addProjectAccess=yT,i.addProjectAccesses=pT,i.addProjectAttachment=MT,i.addProjectAttachments=RT,i.addProjectFile=kT,i.addProjectFiles=NT,i.addProjects=dI,i.addTeam=BI,i.addTeamMembership=II,i.addTeamMemberships=OI,i.addTeams=jI,i.addUser=ha,i.addUsers=gS,i.agentsReducer=rn,i.agentsSlice=kt,i.areArraysEqual=VO,i.assetAttachmentReducer=On,i.assetAttachmentSlice=Ht,i.assetProcedureReducer=Hc,i.assetProcedureSlice=ns,i.assetProcedureStepFieldValuesAttachmentReducer=Zd,i.assetProcedureStepFieldValuesAttachmentSlice=ys,i.assetProcedureStepFieldValuesReducer=ur,i.assetProcedureStepFieldValuesSlice=Ss,i.assetProcedureStepFieldsAttachmentReducer=Pd,i.assetProcedureStepFieldsAttachmentSlice=ls,i.assetProcedureStepFieldsReducer=qd,i.assetProcedureStepFieldsSlice=hs,i.assetProcedureStepReducer=Ir,i.assetProcedureStepSlice=Ts,i.assetProcedureTypeAttachmentReducer=Vn,i.assetProcedureTypeAttachmentSlice=Zt,i.assetProcedureTypeFieldValuesAttachmentReducer=Sc,i.assetProcedureTypeFieldValuesAttachmentSlice=es,i.assetProcedureTypeFieldValuesReducer=zc,i.assetProcedureTypeFieldValuesSlice=as,i.assetProcedureTypeFieldsAttachmentReducer=Wn,i.assetProcedureTypeFieldsAttachmentSlice=Xt,i.assetProcedureTypeFieldsReducer=cc,i.assetProcedureTypeFieldsSlice=xt,i.assetProcedureTypeReducer=cd,i.assetProcedureTypeSlice=rs,i.assetReducer=jr,i.assetSlice=Os,i.assetStageCompletionReducer=Wr,i.assetStageCompletionSlice=_s,i.assetStageReducer=du,i.assetStageSlice=Ms,i.assetTypeAttachmentReducer=Fu,i.assetTypeAttachmentSlice=vs,i.assetTypeFieldValuesAttachmentReducer=ul,i.assetTypeFieldValuesAttachmentSlice=$s,i.assetTypeFieldValuesReducer=Pl,i.assetTypeFieldValuesSlice=Ls,i.assetTypeFieldsAttachmentReducer=qu,i.assetTypeFieldsAttachmentSlice=Bs,i.assetTypeFieldsReducer=Ju,i.assetTypeFieldsSlice=qs,i.assetTypeIdentifierReducer=$l,i.assetTypeIdentifierSlice=Gs,i.assetTypeIdentifierValueReducer=Xl,i.assetTypeIdentifierValueSlice=Ns,i.assetTypeReducer=ho,i.assetTypeSlice=Hs,i.assetTypeStatusReducer=_o,i.assetTypeStatusSlice=Ks,i.assetTypeStatusSortFn=xa,i.authReducer=wo,i.authSlice=It,i.baseReducer=$P,i.baseReducers=Ra,i.blobToBase64=LO,i.categoryReducer=Go,i.categorySlice=Zs,i.clearTokens=UF,i.constructUploadedFilePayloads=CO,i.createModelAdapter=P,i.createOfflineAction=cT,i.createPayload=R,i.createSelectionAdapter=vO,i.deleteAsset=wr,i.deleteAssetAttachment=An,i.deleteAssetAttachments=Kt,i.deleteAssetProcedure=Gc,i.deleteAssetProcedureStep=Sr,i.deleteAssetProcedureStepFieldValues=ar,i.deleteAssetProcedureStepFieldValuesAttachment=Nd,i.deleteAssetProcedureStepFieldValuesAttachments=As,i.deleteAssetProcedureStepFieldValuesMany=nr,i.deleteAssetProcedureStepFields=Vd,i.deleteAssetProcedureStepFieldsAttachment=Sd,i.deleteAssetProcedureStepFieldsAttachments=Td,i.deleteAssetProcedureStepFieldsMany=zd,i.deleteAssetProcedureSteps=Tr,i.deleteAssetProcedureType=sd,i.deleteAssetProcedureTypeAttachment=vn,i.deleteAssetProcedureTypeAttachments=En,i.deleteAssetProcedureTypeFieldValues=Ec,i.deleteAssetProcedureTypeFieldValuesAttachment=fc,i.deleteAssetProcedureTypeFieldValuesAttachments=ss,i.deleteAssetProcedureTypeFieldValuesMany=Vc,i.deleteAssetProcedureTypeFields=ac,i.deleteAssetProcedureTypeFieldsAttachment=Nn,i.deleteAssetProcedureTypeFieldsAttachments=Hn,i.deleteAssetProcedureTypeFieldsMany=nc,i.deleteAssetProcedureTypes=id,i.deleteAssetProcedures=ds,i.deleteAssetStage=nu,i.deleteAssetStageCompletion=Nr,i.deleteAssetStageCompletions=Hr,i.deleteAssetStages=cu,i.deleteAssetType=co,i.deleteAssetTypeAttachment=fu,i.deleteAssetTypeAttachments=Vs,i.deleteAssetTypeFieldValues=Sl,i.deleteAssetTypeFieldValuesAttachment=al,i.deleteAssetTypeFieldValuesAttachments=Us,i.deleteAssetTypeFieldValuesMany=Tl,i.deleteAssetTypeFields=Hu,i.deleteAssetTypeFieldsAttachment=Eu,i.deleteAssetTypeFieldsAttachments=Vu,i.deleteAssetTypeFieldsMany=Wu,i.deleteAssetTypeIdentifier=Vl,i.deleteAssetTypeIdentifierValue=Wl,i.deleteAssetTypeIdentifierValues=Kl,i.deleteAssetTypeIdentifiers=zl,i.deleteAssetTypeStatus=Oo,i.deleteAssetTypeStatuses=Fo,i.deleteAssetTypes=ro,i.deleteAssets=Ps,i.deleteCategories=Uo,i.deleteCategory=Do,i.deleteConversation=aF,i.deleteConversations=nF,i.deleteDocument=oh,i.deleteDocumentAttachment=Xo,i.deleteDocumentAttachments=Qo,i.deleteDocuments=hh,i.deleteEmailDomain=bh,i.deleteEmailDomains=_h,i.deleteForm=Gm,i.deleteFormIdentifier=Nh,i.deleteFormIdentifierValue=am,i.deleteFormIdentifierValues=nm,i.deleteFormIdentifiers=Hh,i.deleteFormRevision=oi,i.deleteFormRevisionAttachment=Sm,i.deleteFormRevisionAttachments=Tm,i.deleteFormRevisions=hi,i.deleteFormSubmission=my,i.deleteFormSubmissionAttachment=ty,i.deleteFormSubmissionAttachments=Si,i.deleteFormSubmissions=gi,i.deleteForms=km,i.deleteGeoImage=My,i.deleteGeoImages=Ry,i.deleteIssue=Lp,i.deleteIssueAssociation=Cy,i.deleteIssueAssociations=_t,i.deleteIssueAttachment=tp,i.deleteIssueAttachments=Ei,i.deleteIssueComment=wp,i.deleteIssueCommentAttachment=pp,i.deleteIssueCommentAttachments=Ap,i.deleteIssueComments=vp,i.deleteIssueType=Hf,i.deleteIssueTypeAttachment=tA,i.deleteIssueTypeAttachments=sA,i.deleteIssueTypeFieldValues=wA,i.deleteIssueTypeFieldValuesAttachment=sf,i.deleteIssueTypeFieldValuesAttachments=Yi,i.deleteIssueTypeFieldValuesMany=vA,i.deleteIssueTypeFields=kA,i.deleteIssueTypeFieldsAttachment=pA,i.deleteIssueTypeFieldsAttachments=AA,i.deleteIssueTypeFieldsMany=NA,i.deleteIssueTypeIdentifier=ff,i.deleteIssueTypeIdentifierValue=Ef,i.deleteIssueTypeIdentifierValues=Vf,i.deleteIssueTypeIdentifiers=Sf,i.deleteIssueTypeStatus=nS,i.deleteIssueTypeStatuses=cS,i.deleteIssueTypes=Wf,i.deleteIssueUpdate=da,i.deleteIssueUpdates=ra,i.deleteIssues=Ui,i.deleteOrganization=xS,i.deleteOrganizationAccess=US,i.deleteOrganizationAccesses=CS,i.deleteOrganizations=eT,i.deleteProject=oI,i.deleteProjectAccess=IT,i.deleteProjectAccesses=OT,i.deleteProjectAttachment=zT,i.deleteProjectAttachments=BT,i.deleteProjectFile=KT,i.deleteProjectFiles=YT,i.deleteProjects=hI,i.deleteTeam=CI,i.deleteTeamMembership=_I,i.deleteTeamMemberships=MI,i.deleteTeams=LI,i.deleteUser=ma,i.deleteUsers=MS,i.dequeue=aO,i.discard=cO,i.documentAttachmentReducer=sh,i.documentAttachmentSlice=Qs,i.documentSlice=ei,i.documentsReducer=Ah,i.downloadFile=GO,i.downloadInMemoryFile=UO,i.emailDomainsReducer=vh,i.emailDomainsSlice=ti,i.emailRegex=XO,i.enqueue=iO,i.enqueueRequest=rT,i.extractResponseFromError=rO,i.fallbackToEmptyArray=S,i.fallbackToEmptyObject=ht,i.fileReducer=jh,i.fileSlice=ii,i.fileToBlob=Ka,i.formIdentifierReducer=Zh,i.formIdentifierSlice=ai,i.formIdentifierValueReducer=um,i.formIdentifierValueSlice=ci,i.formReducer=Nm,i.formRevisionAttachmentReducer=Pm,i.formRevisionAttachmentSlice=di,i.formRevisionReducer=zm,i.formRevisionsSlice=ri,i.formSlice=yi,i.formSubmissionAttachmentReducer=ny,i.formSubmissionAttachmentSlice=Ai,i.formSubmissionReducer=Sy,i.formSubmissionSlice=Fi,i.geoImageReducer=Vy,i.geoImageSlice=_i,i.getAssetProcedureStepSubTree=Qa,i.getAssetProcedureStepTrees=QO,i.getClientSDK=mO,i.getClientStore=at,i.getDocumentSubTree=eF,i.getDocumentTrees=xO,i.getFileIdentifier=DO,i.getFileS3Key=Gt,i.getLocalDateString=Ha,i.getLocalRelativeDateString=qO,i.getOutboxCoordinator=Xe,i.getRenamedFile=Wa,i.hashFile=et,i.initSDK=pb,i.initializeAssetAttachments=ln,i.initializeAssetProcedureStepFieldValues=Xd,i.initializeAssetProcedureStepFieldValuesAttachments=Dd,i.initializeAssetProcedureStepFields=bd,i.initializeAssetProcedureStepFieldsAttachments=od,i.initializeAssetProcedureSteps=or,i.initializeAssetProcedureTypeAttachments=Pn,i.initializeAssetProcedureTypeFieldValues=gc,i.initializeAssetProcedureTypeFieldValuesAttachments=oc,i.initializeAssetProcedureTypeFields=Xn,i.initializeAssetProcedureTypeFieldsAttachments=$n,i.initializeAssetProcedureTypes=Xc,i.initializeAssetProcedures=Dc,i.initializeAssetStageCompletions=$r,i.initializeAssetStages=Qr,i.initializeAssetTypeAttachments=ou,i.initializeAssetTypeFieldValues=ol,i.initializeAssetTypeFieldValuesAttachments=Qu,i.initializeAssetTypeFields=Du,i.initializeAssetTypeFieldsAttachments=gu,i.initializeAssetTypeIdentifierValues=Ul,i.initializeAssetTypeIdentifiers=bl,i.initializeAssetTypeStatuses=yo,i.initializeAssetTypes=xl,i.initializeAssets=br,i.initializeCategories=Eo,i.initializeConversations=an,i.initializeDocumentAttachments=No,i.initializeDocuments=ah,i.initializeEmailDomains=Sh,i.initializeFormIdentifierValues=Xh,i.initializeFormIdentifiers=$h,i.initializeFormRevisionAttachments=om,i.initializeFormRevisions=bm,i.initializeFormSubmissionAttachments=Zm,i.initializeFormSubmissions=dy,i.initializeForms=jm,i.initializeGeoImages=Iy,i.initializeIssueAssociations=By,i.initializeIssueAttachments=Zy,i.initializeIssueCommentAttachments=rp,i.initializeIssueComments=Fp,i.initializeIssueTypeAttachments=Yp,i.initializeIssueTypeFieldValues=FA,i.initializeIssueTypeFieldValuesAttachments=JA,i.initializeIssueTypeFields=qA,i.initializeIssueTypeFieldsAttachments=rA,i.initializeIssueTypeIdentifierValues=gf,i.initializeIssueTypeIdentifiers=lf,i.initializeIssueTypeStatuses=Qf,i.initializeIssueTypes=Df,i.initializeIssueUpdates=oS,i.initializeIssues=jp,i.initializeOrganizationAccesses=VS,i.initializeOrganizations=WS,i.initializeProjectAccesses=mT,i.initializeProjectAttachments=_T,i.initializeProjectFiles=CT,i.initializeProjects=aI,i.initializeTeamMemberships=TI,i.initializeTeams=zI,i.initializeUsers=OS,i.isToday=jO,i.issueAssociationReducer=Ky,i.issueAssociationSlice=Ri,i.issueAttachmentReducer=cp,i.issueAttachmentSlice=wi,i.issueCommentAttachmentReducer=Ip,i.issueCommentAttachmentSlice=zi,i.issueCommentReducer=zp,i.issueCommentSlice=ji,i.issueReducer=Wp,i.issueSlice=$i,i.issueTypeAttachmentReducer=cA,i.issueTypeAttachmentSlice=Ci,i.issueTypeFieldValuesAttachmentReducer=rf,i.issueTypeFieldValuesAttachmentSlice=Wi,i.issueTypeFieldValuesReducer=BA,i.issueTypeFieldValuesSlice=Ni,i.issueTypeFieldsAttachmentReducer=IA,i.issueTypeFieldsAttachmentSlice=Gi,i.issueTypeFieldsReducer=YA,i.issueTypeFieldsSlice=Hi,i.issueTypeIdentifierReducer=Ff,i.issueTypeIdentifierSlice=Ji,i.issueTypeIdentifierValueReducer=qf,i.issueTypeIdentifierValueSlice=Qi,i.issueTypeReducer=Jf,i.issueTypeSlice=xi,i.issueTypeStatusReducer=uS,i.issueTypeStatusSlice=ta,i.issueTypeStatusSortFn=en,i.issueUpdateReducer=TS,i.issueUpdateSlice=aa,i.logOnlyOnce=kO,i.markAsDeleted=uT,i.markForDeletion=OP,i.memoize=Ct,i.onlyUniqueHashes=JO,i.onlyUniqueOfflineIds=ZO,i.organizationAccessReducer=LS,i.organizationAccessSlice=pa,i.organizationReducer=nT,i.organizationSlice=Aa,i.outboxReducer=oT,i.outboxSlice=fa,i.overmapEnhancer=YP,i.overmapReducer=DP,i.overmapReducers=YI,i.performRequest=za,i.performRequestFromAction=nO,i.projectAccessReducer=FT,i.projectAccessSlice=Sa,i.projectAttachmentReducer=DT,i.projectAttachmentSlice=Ia,i.projectFileReducer=sI,i.projectFileSlice=Fa,i.projectReducer=mI,i.projectSlice=Pa,i.rehydratedReducer=fI,i.rehydratedSlice=ga,i.restructureCreateSelectorWithArgs=f,i.runMiddleware=fO,i.saveActiveProjectFileBounds=XT,i.selectAccessToken=CF,i.selectAccessesByUserOfProject=PP,i.selectAccessibleProjects=RP,i.selectActiveOrganizationAccess=fP,i.selectActiveProjectFileId=_P,i.selectAllDocumentAttachments=xs,i.selectAllProjectAttachments=Oa,i.selectAssetAttachmentById=Sn,i.selectAssetAttachmentMapping=fn,i.selectAssetAttachments=Yt,i.selectAssetAttachmentsByIds=Tn,i.selectAssetById=zr,i.selectAssetProcedureById=Yc,i.selectAssetProcedureStepById=Or,i.selectAssetProcedureStepFieldValues=ct,i.selectAssetProcedureStepFieldValuesAttachmentById=Wd,i.selectAssetProcedureStepFieldValuesAttachments=fs,i.selectAssetProcedureStepFieldValuesAttachmentsByIds=Kd,i.selectAssetProcedureStepFieldValuesAttachmentsMapping=Hd,i.selectAssetProcedureStepFieldValuesById=dr,i.selectAssetProcedureStepFieldValuesByIds=rr,i.selectAssetProcedureStepFieldValuesMapping=cr,i.selectAssetProcedureStepFieldValuesOfAsset=IF,i.selectAssetProcedureStepFieldValuesOfAssetProcedure=OF,i.selectAssetProcedureStepFieldValuesOfAssetProcedureStep=FF,i.selectAssetProcedureStepFields=At,i.selectAssetProcedureStepFieldsAttachmentById=Od,i.selectAssetProcedureStepFieldsAttachments=os,i.selectAssetProcedureStepFieldsAttachmentsByIds=Fd,i.selectAssetProcedureStepFieldsAttachmentsMapping=Id,i.selectAssetProcedureStepFieldsById=Bd,i.selectAssetProcedureStepFieldsByIds=jd,i.selectAssetProcedureStepFieldsMapping=ms,i.selectAssetProcedureStepFieldsOfAssetProcedureStep=fF,i.selectAssetProcedureStepMapping=ft,i.selectAssetProcedureSteps=Is,i.selectAssetProcedureStepsByIds=Fr,i.selectAssetProcedureStepsMappingOfAssetProcedureType=PF,i.selectAssetProcedureStepsOfAssetProcedureType=gF,i.selectAssetProcedureTypeAttachmentById=Bn,i.selectAssetProcedureTypeAttachmentMapping=zn,i.selectAssetProcedureTypeAttachments=Jt,i.selectAssetProcedureTypeAttachmentsByIds=jn,i.selectAssetProcedureTypeById=rd,i.selectAssetProcedureTypeFieldValues=yt,i.selectAssetProcedureTypeFieldValuesAttachmentById=Ic,i.selectAssetProcedureTypeFieldValuesAttachments=is,i.selectAssetProcedureTypeFieldValuesAttachmentsByIds=Oc,i.selectAssetProcedureTypeFieldValuesAttachmentsMapping=Tc,i.selectAssetProcedureTypeFieldValuesById=jc,i.selectAssetProcedureTypeFieldValuesByIds=qc,i.selectAssetProcedureTypeFieldValuesMapping=Bc,i.selectAssetProcedureTypeFieldValuesOfAsset=hF,i.selectAssetProcedureTypeFields=mt,i.selectAssetProcedureTypeFieldsAttachmentById=Yn,i.selectAssetProcedureTypeFieldsAttachments=Qt,i.selectAssetProcedureTypeFieldsAttachmentsByIds=Zn,i.selectAssetProcedureTypeFieldsAttachmentsMapping=Kn,i.selectAssetProcedureTypeFieldsById=rc,i.selectAssetProcedureTypeFieldsByIds=uc,i.selectAssetProcedureTypeFieldsMapping=dc,i.selectAssetProcedureTypeFieldsOfAssetProcedureType=lF,i.selectAssetProcedureTypes=us,i.selectAssetProcedureTypesByIds=ud,i.selectAssetProcedureTypesMapping=dd,i.selectAssetProcedureTypesOfOrganization=pF,i.selectAssetProcedures=pt,i.selectAssetProceduresByIds=Zc,i.selectAssetProceduresMapping=Wc,i.selectAssetProceduresOfAssetProcedureType=Kc,i.selectAssetProceduresOfAssetType=yF,i.selectAssetStageById=ru,i.selectAssetStageCompletionById=Zr,i.selectAssetStageCompletionMapping=Kr,i.selectAssetStageCompletions=Yr,i.selectAssetStageCompletionsByIds=Jr,i.selectAssetStages=ws,i.selectAssetStagesByIds=uu,i.selectAssetStagesMappingOfAssetProcedureType=_F,i.selectAssetStagesOfAssetProcedureType=MF,i.selectAssetTypeAttachmentById=Tu,i.selectAssetTypeAttachmentMapping=Su,i.selectAssetTypeAttachments=zs,i.selectAssetTypeAttachmentsByIds=Iu,i.selectAssetTypeById=lo,i.selectAssetTypeFieldValues=St,i.selectAssetTypeFieldValuesAttachmentById=cl,i.selectAssetTypeFieldValuesAttachments=Cs,i.selectAssetTypeFieldValuesAttachmentsByIds=dl,i.selectAssetTypeFieldValuesAttachmentsMapping=nl,i.selectAssetTypeFieldValuesById=Ol,i.selectAssetTypeFieldValuesByIds=Fl,i.selectAssetTypeFieldValuesMapping=Il,i.selectAssetTypeFieldValuesOfAsset=EF,i.selectAssetTypeFields=dt,i.selectAssetTypeFieldsAttachmentById=Bu,i.selectAssetTypeFieldsAttachments=js,i.selectAssetTypeFieldsAttachmentsByIds=ju,i.selectAssetTypeFieldsAttachmentsMapping=zu,i.selectAssetTypeFieldsById=Yu,i.selectAssetTypeFieldsByIds=Zu,i.selectAssetTypeFieldsMapping=Ku,i.selectAssetTypeFieldsOfAssetType=wF,i.selectAssetTypeIdentifierById=jl,i.selectAssetTypeIdentifierMapping=Bl,i.selectAssetTypeIdentifierValueById=Zl,i.selectAssetTypeIdentifierValueMapping=Yl,i.selectAssetTypeIdentifierValues=Tt,i.selectAssetTypeIdentifierValuesByIds=Jl,i.selectAssetTypeIdentifierValuesOfAsset=BF,i.selectAssetTypeIdentifierValuesOfIdentifier=jF,i.selectAssetTypeIdentifiers=ks,i.selectAssetTypeIdentifiersByIds=ql,i.selectAssetTypeIdentifiersOfAssetType=zF,i.selectAssetTypeStatusById=go,i.selectAssetTypeStatusMapping=Po,i.selectAssetTypeStatuses=Ys,i.selectAssetTypeStatusesByIds=bo,i.selectAssetTypeStatusesOfAssetType=$F,i.selectAssetTypeValuesOfAssetType=VF,i.selectAssetTypes=Ws,i.selectAssetTypesByIds=oo,i.selectAssetTypesMapping=uo,i.selectAssetTypesOfOrganization=qF,i.selectAssets=gs,i.selectAssetsByIds=Br,i.selectAssetsMapping=Vr,i.selectAssetsOfAssetType=bs,i.selectAttachmentsOfAsset=In,i.selectAttachmentsOfAssetProcedureStepFieldValues=Yd,i.selectAttachmentsOfAssetProcedureStepFields=AF,i.selectAttachmentsOfAssetProcedureType=rF,i.selectAttachmentsOfAssetProcedureTypeFieldValues=Fc,i.selectAttachmentsOfAssetProcedureTypeFields=uF,i.selectAttachmentsOfAssetType=Ou,i.selectAttachmentsOfAssetTypeFieldValues=rl,i.selectAttachmentsOfAssetTypeFields=RF,i.selectAttachmentsOfDocument=kF,i.selectAttachmentsOfFormRevision=XF,i.selectAttachmentsOfFormSubmission=ay,i.selectAttachmentsOfIssue=ip,i.selectAttachmentsOfIssueComment=tP,i.selectAttachmentsOfIssueType=aP,i.selectAttachmentsOfIssueTypeFieldValues=df,i.selectAttachmentsOfIssueTypeFields=nP,i.selectAttachmentsOfProject=bP,i.selectCategories=Js,i.selectCategoriesByIds=Lo,i.selectCategoriesOfProject=GF,i.selectCategoryById=Xs,i.selectCategoryMapping=Co,i.selectCommentsOfIssue=sP,i.selectConversation=dF,i.selectConversationMapping=Nt,i.selectConversations=cF,i.selectCurrentUser=wS,i.selectDeletedRequests=TP,i.selectDescendantsOfAssetProcedureStep=Pr,i.selectDocumentAttachmentById=eh,i.selectDocumentAttachmentMapping=xo,i.selectDocumentAttachmentsByIds=th,i.selectDocumentById=yh,i.selectDocuments=Ot,i.selectDocumentsByIds=ph,i.selectDocumentsMapping=mh,i.selectEmailDomainById=Rh,i.selectEmailDomains=si,i.selectEmailDomainsAsMapping=Mh,i.selectEmailDomainsByIds=wh,i.selectEmailDomainsOfOrganization=WF,i.selectFieldValuesOfAssetProcedure=mF,i.selectFormById=Wm,i.selectFormIdentifierById=Kh,i.selectFormIdentifierMapping=Wh,i.selectFormIdentifierValueById=dm,i.selectFormIdentifierValueMapping=cm,i.selectFormIdentifierValues=Ft,i.selectFormIdentifierValuesByIds=rm,i.selectFormIdentifierValuesOfFormSubmission=ZF,i.selectFormIdentifierValuesOfIdentifier=JF,i.selectFormIdentifiers=ni,i.selectFormIdentifiersByIds=Yh,i.selectFormIdentifiersOfForm=YF,i.selectFormMapping=Hm,i.selectFormRevisionAttachmentById=Om,i.selectFormRevisionAttachments=Im,i.selectFormRevisionAttachmentsByIds=Fm,i.selectFormRevisionAttachmentsMapping=Pt,i.selectFormRevisionById=vm,i.selectFormRevisionMapping=mi,i.selectFormRevisions=gt,i.selectFormRevisionsByIds=Em,i.selectFormRevisionsOfForm=Vm,i.selectFormSubmissionAttachemntsByIds=Oi,i.selectFormSubmissionAttachmentById=sy,i.selectFormSubmissionAttachments=Ii,i.selectFormSubmissionAttachmentsByIds=iy,i.selectFormSubmissionAttachmentsMapping=Ti,i.selectFormSubmissionById=py,i.selectFormSubmissions=yy,i.selectFormSubmissionsByIds=Ay,i.selectFormSubmissionsMapping=bi,i.selectFormSubmissionsOfForm=fy,i.selectForms=pi,i.selectFormsByIds=Km,i.selectFormsOfOrganization=xF,i.selectGeoImageById=vy,i.selectGeoImageMapping=wy,i.selectGeoImages=Mi,i.selectGeoImagesByIds=Ey,i.selectGeoImagesOfProject=eP,i.selectIsImportingProjectFile=MP,i.selectIsLoggedIn=LF,i.selectIssueAssociationById=Gy,i.selectIssueAssociationMapping=rt,i.selectIssueAssociations=Ly,i.selectIssueAssociationsByIds=ky,i.selectIssueAssociationsOfAsset=Wy,i.selectIssueAssociationsOfIssue=Hy,i.selectIssueAssociationsToIssue=Ny,i.selectIssueAttachmentById=ap,i.selectIssueAttachmentMapping=sp,i.selectIssueAttachments=Vi,i.selectIssueAttachmentsByIds=np,i.selectIssueById=kp,i.selectIssueCommentAttachmentById=Sp,i.selectIssueCommentAttachmentMapping=fp,i.selectIssueCommentAttachments=Bi,i.selectIssueCommentAttachmentsByIds=Tp,i.selectIssueCommentById=Ep,i.selectIssueCommentMapping=qi,i.selectIssueCommentsByIds=Vp,i.selectIssueMapping=Gp,i.selectIssueTypeAttachmentById=aA,i.selectIssueTypeAttachmentMapping=iA,i.selectIssueTypeAttachments=Li,i.selectIssueTypeAttachmentsByIds=nA,i.selectIssueTypeById=Yf,i.selectIssueTypeFieldValues=Rt,i.selectIssueTypeFieldValuesAttachmentById=nf,i.selectIssueTypeFieldValuesAttachments=Zi,i.selectIssueTypeFieldValuesAttachmentsByIds=cf,i.selectIssueTypeFieldValuesAttachmentsMapping=af,i.selectIssueTypeFieldValuesById=VA,i.selectIssueTypeFieldValuesByIds=zA,i.selectIssueTypeFieldValuesMapping=EA,i.selectIssueTypeFieldValuesOfIssue=cP,i.selectIssueTypeFields=ut,i.selectIssueTypeFieldsAttachmentById=SA,i.selectIssueTypeFieldsAttachments=ki,i.selectIssueTypeFieldsAttachmentsByIds=TA,i.selectIssueTypeFieldsAttachmentsMapping=fA,i.selectIssueTypeFieldsById=WA,i.selectIssueTypeFieldsByIds=KA,i.selectIssueTypeFieldsMapping=HA,i.selectIssueTypeFieldsOfIssueType=dP,i.selectIssueTypeIdentifierById=If,i.selectIssueTypeIdentifierMapping=Tf,i.selectIssueTypeIdentifierValueById=Bf,i.selectIssueTypeIdentifierValueMapping=zf,i.selectIssueTypeIdentifierValues=wt,i.selectIssueTypeIdentifierValuesByIds=jf,i.selectIssueTypeIdentifierValuesOfIdentifier=hP,i.selectIssueTypeIdentifierValuesOfIssue=oP,i.selectIssueTypeIdentifiers=Xi,i.selectIssueTypeIdentifiersByIds=Of,i.selectIssueTypeIdentifiersOfIssueType=lP,i.selectIssueTypeMapping=Kf,i.selectIssueTypeStatusById=ia,i.selectIssueTypeStatusMapping=dS,i.selectIssueTypeStatuses=sa,i.selectIssueTypeStatusesByIds=rS,i.selectIssueTypeStatusesOfIssueType=yP,i.selectIssueTypeValuesOfIssueType=uP,i.selectIssueTypes=ea,i.selectIssueTypesByIds=Zf,i.selectIssueTypesOfOrganization=mP,i.selectIssueUpdateById=AS,i.selectIssueUpdateMapping=ua,i.selectIssueUpdates=la,i.selectIssueUpdatesByIds=fS,i.selectIssueUpdatesOfIssue=SS,i.selectIssues=Mt,i.selectIssuesByIds=Np,i.selectIssuesOfIssueType=Hp,i.selectIssuesOfProject=iP,i.selectLatestAssetProcedureStepFieldsOfAssetProcedureStep=SF,i.selectLatestAssetProcedureTypeFieldsOfAssetProcedureType=oF,i.selectLatestAssetTypeFieldsOfAssetType=vF,i.selectLatestFieldsByAssetProcedureStep=TF,i.selectLatestFormRevisionOfForm=QF,i.selectLatestIssueTypeFieldsOfIssueType=rP,i.selectLatestRetryTime=IP,i.selectMembershipsByUserOfTeam=zP,i.selectNumberOfAssetsOfAssetType=bF,i.selectOrganizationAccessById=GS,i.selectOrganizationAccessMapping=Vt,i.selectOrganizationAccessUserMapping=NS,i.selectOrganizationAccessesByIds=kS,i.selectOrganizationById=iT,i.selectOrganizationDocuments=HF,i.selectOrganizations=sT,i.selectOrganizationsByIds=aT,i.selectOrganizationsMapping=tT,i.selectProjectAccessById=PT,i.selectProjectAccessMapping=Ta,i.selectProjectAccesses=lt,i.selectProjectAccessesByIds=gT,i.selectProjectAccessesOfProject=FP,i.selectProjectAttachmentById=qT,i.selectProjectAttachmentMapping=jT,i.selectProjectAttachmentsByIds=$T,i.selectProjectById=pI,i.selectProjectDocuments=NF,i.selectProjectFileById=eI,i.selectProjectFileMapping=QT,i.selectProjectFiles=xT,i.selectProjectFilesByIds=tI,i.selectProjectMapping=yI,i.selectProjects=zt,i.selectProjectsByIds=AI,i.selectProjectsOfOrganization=wP,i.selectRehydrated=VP,i.selectStageMapping=Rs,i.selectTeamById=kI,i.selectTeamMembershipById=vI,i.selectTeamMemberships=Bt,i.selectTeamMembershipsByIds=EI,i.selectTeamMembershipsMapping=wI,i.selectTeams=Ma,i.selectTeamsByIds=NI,i.selectTeamsMapping=GI,i.selectTeamsOfOrganization=jP,i.selectUploadUrl=Bh,i.selectUserById=Et,i.selectUsers=vt,i.selectUsersByIds=vS,i.selectUsersMapping=ya,i.selectUsersOfOrganization=SP,i.selectUsersOfProject=gP,i.selectUsersOfTeam=BP,i.setActiveProjectFileId=JT,i.setAsset=vr,i.setAssetAttachment=hn,i.setAssetAttachments=mn,i.setAssetProcedure=kc,i.setAssetProcedureStep=hr,i.setAssetProcedureStepFieldValues=er,i.setAssetProcedureStepFieldValuesAttachment=Cd,i.setAssetProcedureStepFieldValuesAttachments=Ld,i.setAssetProcedureStepFieldValuesMany=tr,i.setAssetProcedureStepFields=Rd,i.setAssetProcedureStepFieldsAttachment=yd,i.setAssetProcedureStepFieldsAttachments=pd,i.setAssetProcedureStepFieldsMany=wd,i.setAssetProcedureSteps=mr,i.setAssetProcedureType=ad,i.setAssetProcedureTypeAttachment=_n,i.setAssetProcedureTypeAttachments=Mn,i.setAssetProcedureTypeFieldValues=Mc,i.setAssetProcedureTypeFieldValuesAttachment=mc,i.setAssetProcedureTypeFieldValuesAttachments=yc,i.setAssetProcedureTypeFieldValuesMany=Rc,i.setAssetProcedureTypeFields=ec,i.setAssetProcedureTypeFieldsAttachment=Cn,i.setAssetProcedureTypeFieldsAttachments=Ln,i.setAssetProcedureTypeFieldsMany=tc,i.setAssetProcedureTypes=nd,i.setAssetProcedures=Nc,i.setAssetStage=xr,i.setAssetStageCompletion=Cr,i.setAssetStageCompletions=Lr,i.setAssetStages=eu,i.setAssetType=eo,i.setAssetTypeAttachment=mu,i.setAssetTypeAttachments=yu,i.setAssetTypeFieldValues=yl,i.setAssetTypeFieldValuesAttachment=el,i.setAssetTypeFieldValuesAttachments=tl,i.setAssetTypeFieldValuesMany=pl,i.setAssetTypeFields=Lu,i.setAssetTypeFieldsAttachment=Mu,i.setAssetTypeFieldsAttachments=Ru,i.setAssetTypeFieldsMany=Gu,i.setAssetTypeIdentifier=Rl,i.setAssetTypeIdentifierValue=Gl,i.setAssetTypeIdentifierValues=kl,i.setAssetTypeIdentifiers=wl,i.setAssetTypeStatus=fo,i.setAssetTypeStatuses=So,i.setAssetTypes=to,i.setAssets=Er,i.setCategories=jo,i.setCategory=Bo,i.setClientSDK=hO,i.setClientStore=lO,i.setConversation=cn,i.setConversations=sF,i.setCurrentUser=pP,i.setDocument=dh,i.setDocumentAttachment=Ko,i.setDocumentAttachments=Yo,i.setDocuments=rh,i.setEmailDomain=Oh,i.setEmailDomains=Fh,i.setForm=Dm,i.setFormIdentifier=Ch,i.setFormIdentifierValue=em,i.setFormIdentifierValues=tm,i.setFormIdentifiers=Lh,i.setFormRevision=_m,i.setFormRevisionAttachment=ym,i.setFormRevisionAttachments=pm,i.setFormRevisions=Mm,i.setFormSubmission=ry,i.setFormSubmissionAttachment=Xm,i.setFormSubmissionAttachments=Qm,i.setFormSubmissions=uy,i.setForms=Um,i.setGeoImage=Oy,i.setGeoImages=Fy,i.setIsImportingProjectFile=ZT,i.setIssue=$p,i.setIssueAssociation=qy,i.setIssueAssociations=jy,i.setIssueAttachment=Xy,i.setIssueAttachments=Qy,i.setIssueComment=bp,i.setIssueCommentAttachment=op,i.setIssueCommentAttachments=hp,i.setIssueComments=_p,i.setIssueType=Lf,i.setIssueTypeAttachment=Xp,i.setIssueTypeAttachments=Qp,i.setIssueTypeFieldValues=bA,i.setIssueTypeFieldValuesAttachment=QA,i.setIssueTypeFieldValuesAttachments=xA,i.setIssueTypeFieldValuesMany=_A,i.setIssueTypeFields=UA,i.setIssueTypeFieldsAttachment=oA,i.setIssueTypeFieldsAttachments=hA,i.setIssueTypeFieldsMany=CA,i.setIssueTypeIdentifier=mf,i.setIssueTypeIdentifierValue=Mf,i.setIssueTypeIdentifierValues=Rf,i.setIssueTypeIdentifiers=yf,i.setIssueTypeStatus=tS,i.setIssueTypeStatuses=sS,i.setIssueTypes=Gf,i.setIssueUpdate=hS,i.setIssueUpdates=mS,i.setIssues=Dp,i.setLoggedIn=Ro,i.setOrganization=YS,i.setOrganizationAccess=jS,i.setOrganizationAccesses=qS,i.setOrganizations=KS,i.setProfilePicture=AP,i.setProject=cI,i.setProjectAccess=AT,i.setProjectAccesses=fT,i.setProjectAttachment=wT,i.setProjectAttachments=vT,i.setProjectFile=LT,i.setProjectFiles=GT,i.setProjects=nI,i.setRehydrated=EP,i.setTeam=qI,i.setTeamMembership=FI,i.setTeamMemberships=PI,i.setTeams=$I,i.setTokens=DF,i.setUploadUrl=zh,i.setUser=PS,i.setUsers=FS,i.shallowEqual=EO,i.slugify=KO,i.spacesToDashesLower=WO,i.teamMembershipReducer=RI,i.teamMembershipSlice=ba,i.teamReducer=HI,i.teamSlice=_a,i.toFileNameSafeString=HO,i.toUuidArray=Ja,i.toUuidIdRecord=NO,i.truncate=YO,i.updateAsset=Mr,i.updateAssetAttachment=yn,i.updateAssetAttachments=pn,i.updateAssetProcedure=Cc,i.updateAssetProcedureStep=Ar,i.updateAssetProcedureStepFieldValues=sr,i.updateAssetProcedureStepFieldValuesAttachment=Gd,i.updateAssetProcedureStepFieldValuesAttachments=kd,i.updateAssetProcedureStepFieldValuesMany=ir,i.updateAssetProcedureStepFields=vd,i.updateAssetProcedureStepFieldsAttachment=Ad,i.updateAssetProcedureStepFieldsAttachments=fd,i.updateAssetProcedureStepFieldsMany=Ed,i.updateAssetProcedureSteps=fr,i.updateAssetProcedureType=ed,i.updateAssetProcedureTypeAttachment=Rn,i.updateAssetProcedureTypeAttachments=wn,i.updateAssetProcedureTypeFieldValues=wc,i.updateAssetProcedureTypeFieldValuesAttachment=pc,i.updateAssetProcedureTypeFieldValuesAttachments=Ac,i.updateAssetProcedureTypeFieldValuesMany=vc,i.updateAssetProcedureTypeFields=sc,i.updateAssetProcedureTypeFieldsAttachment=Gn,i.updateAssetProcedureTypeFieldsAttachments=kn,i.updateAssetProcedureTypeFieldsMany=ic,i.updateAssetProcedureTypes=td,i.updateAssetProcedures=Lc,i.updateAssetStage=iu,i.updateAssetStageCompletion=Gr,i.updateAssetStageCompletions=kr,i.updateAssetStages=au,i.updateAssetType=ao,i.updateAssetTypeAttachment=pu,i.updateAssetTypeAttachments=Au,i.updateAssetTypeFieldValues=Al,i.updateAssetTypeFieldValuesAttachment=sl,i.updateAssetTypeFieldValuesAttachments=il,i.updateAssetTypeFieldValuesMany=fl,i.updateAssetTypeFields=ku,i.updateAssetTypeFieldsAttachment=wu,i.updateAssetTypeFieldsAttachments=vu,i.updateAssetTypeFieldsMany=Nu,i.updateAssetTypeIdentifier=vl,i.updateAssetTypeIdentifierValue=Nl,i.updateAssetTypeIdentifierValues=Hl,i.updateAssetTypeIdentifiers=El,i.updateAssetTypeStatus=To,i.updateAssetTypeStatuses=Io,i.updateAssetTypes=no,i.updateAssets=Rr,i.updateCategories=$o,i.updateCategory=qo,i.updateConversation=dn,i.updateConversations=iF,i.updateDocument=uh,i.updateDocumentAttachment=Zo,i.updateDocumentAttachments=Jo,i.updateDocuments=lh,i.updateEmailDomain=Ph,i.updateEmailDomains=gh,i.updateForm=Cm,i.updateFormIdentifier=Gh,i.updateFormIdentifierValue=sm,i.updateFormIdentifierValues=im,i.updateFormIdentifiers=kh,i.updateFormRevision=Rm,i.updateFormRevisionAttachment=Am,i.updateFormRevisionAttachments=fm,i.updateFormRevisions=wm,i.updateFormSubmission=oy,i.updateFormSubmissionAttachment=xm,i.updateFormSubmissionAttachments=ey,i.updateFormSubmissions=hy,i.updateForms=Lm,i.updateGeoImage=by,i.updateGeoImages=_y,i.updateIssue=Up,i.updateIssueAssociation=$y,i.updateIssueAssociations=Dy,i.updateIssueAttachment=xy,i.updateIssueAttachments=ep,i.updateIssueComment=Mp,i.updateIssueCommentAttachment=mp,i.updateIssueCommentAttachments=yp,i.updateIssueComments=Rp,i.updateIssueType=kf,i.updateIssueTypeAttachment=xp,i.updateIssueTypeAttachments=eA,i.updateIssueTypeFieldValues=MA,i.updateIssueTypeFieldValuesAttachment=ef,i.updateIssueTypeFieldValuesAttachments=tf,i.updateIssueTypeFieldValuesMany=RA,i.updateIssueTypeFields=LA,i.updateIssueTypeFieldsAttachment=mA,i.updateIssueTypeFieldsAttachments=yA,i.updateIssueTypeFieldsMany=GA,i.updateIssueTypeIdentifier=pf,i.updateIssueTypeIdentifierValue=wf,i.updateIssueTypeIdentifierValues=vf,i.updateIssueTypeIdentifiers=Af,i.updateIssueTypeStatus=iS,i.updateIssueTypeStatuses=aS,i.updateIssueTypes=Nf,i.updateIssueUpdate=yS,i.updateIssueUpdates=pS,i.updateIssues=Cp,i.updateOrganization=QS,i.updateOrganizationAccess=$S,i.updateOrganizationAccesses=DS,i.updateOrganizations=XS,i.updateProject=lI,i.updateProjectAccess=ST,i.updateProjectAccesses=TT,i.updateProjectAttachment=ET,i.updateProjectAttachments=VT,i.updateProjectFile=HT,i.updateProjectFiles=WT,i.updateProjects=uI,i.updateTeam=DI,i.updateTeamMembership=gI,i.updateTeamMemberships=bI,i.updateTeams=UI,i.updateUser=_S,i.updateUsers=bS,i.useSelectorBuilder=UP,i.userReducer=RS,i.userSlice=oa,i.uuidObj=F,i.versioningReducer=KI,i.versioningSlice=WI,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
14
+ external URLs and therefore not prepended with VITE_API_URL.`;throw new Error(T)}const p=m.type.split("/")[1];if(!p)throw new Error("File has no extension");const A=n??l+"."+p;if(m=Wa(m,A),!m.name)throw new Error("Failed to set file's name");await this.addCache(m,l),jt[c]=new Promise(T=>{T(m)})}return m}processPresignedUrls(e){const a={};for(const[n,c]of Object.entries(e))a[n]=this.enqueueRequest({url:c.url,description:"Upload file to S3",method:y.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:n,blockers:[`s3-${c.fields.key}`],blocks:[n],s3url:c});return a}async getFilePayload(e){const a=await et(e),n={sha1:a,file_type:e.type,extension:e.name.split(".").pop(),size:e.size};return await this.client.files.addCache(e,a),n}}class zg extends R{constructor(){super(...arguments);h(this,"name","Form Identifier");h(this,"url","/form-identifiers");h(this,"actions",{addOne:Dh,addMany:Uh,setOne:Ch,setMany:Lh,updateOne:Gh,updateMany:kh,deleteOne:Nh,deleteMany:Hh,initialize:$h});h(this,"selectors",{selectById:Kh,selectByIds:Yh})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create form identifier",method:y.POST,url:`${this.url}/`,payload:w(d),blockers:[d.form],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`Expected form identifier with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update form identifier",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected form identifier with uuid ${e} to exist`);this.dispatch(this.actions.deleteOne(e));try{return await this.enqueueRequest({description:"Delete form identifier",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(this.actions.addOne(c)),d}}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{form__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class Bg extends R{constructor(){super(...arguments);h(this,"name","Form Identifier Value");h(this,"url","/form-identifier-values");h(this,"actions",{addOne:Qh,addMany:xh,setOne:em,setMany:tm,updateOne:sm,updateMany:im,deleteOne:am,deleteMany:nm,initialize:Xh});h(this,"selectors",{selectById:dm,selectByIds:rm})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create form identifier value",method:y.POST,url:`${this.url}/`,payload:w(d),blockers:[e.form_submission,e.form_identifier],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`Expected form identifier value with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update form identifier value",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected form identifier value with uuid ${e} to exist`);this.dispatch(this.actions.deleteOne(e));try{return await this.enqueueRequest({description:"Delete form identifier value",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(this.actions.addOne(c)),d}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{form_submission__form_revision__form__organization:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class jg extends R{constructor(){super(...arguments);h(this,"name","Form Revision Attachment");h(this,"url","/form-revision-attachments");h(this,"actions",{addOne:hm,addMany:mm,setOne:ym,setMany:pm,updateOne:Am,updateMany:fm,deleteOne:Sm,deleteMany:Tm,initialize:om});h(this,"selectors",{selectById:Om,selectByIds:Fm})}async bulkAdd(e){var m;const a=new Date().toISOString(),n=((m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id)??null,c={},d=[],r=[];for(const l of e){const{revisionUuid:p,fieldIdentifier:A,file:T}=l,I=await this.client.files.getFilePayload(T);I.sha1 in c||(c[I.sha1]=I);const _=F({file:URL.createObjectURL(T),file_type:T.type,file_name:T.name,file_sha1:I.sha1,created_by:n,form_revision:p,submitted_at:a,field_identifier:A});d.push(_);const M={uuid:_.uuid,file_name:T.name,field_identifier:A,file_extension:I.extension,file_sha1:I.sha1,form_revision:p};r.push(M)}this.dispatch(this.actions.addMany(d));const o=this.enqueueRequest({description:"Attach files to form revision",method:y.POST,url:`${this.url}/bulk/`,payload:{submitted_at:a,attachments:r,files:Object.values(c)},blockers:d.map(l=>l.form_revision),blocks:d.map(l=>l.uuid)});return o.then(l=>{this.client.files.processPresignedUrls(l.presigned_urls),this.dispatch(this.actions.setMany(l.attachments))}).catch(()=>{this.dispatch(this.actions.deleteMany(d.map(l=>l.uuid)))}),[d,o.then(({attachments:l})=>l)]}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{form_revision__form__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class qg extends R{constructor(){super(...arguments);h(this,"name","Form Revision");h(this,"url","/form-revisions");h(this,"actions",{addOne:ui,addMany:li,setOne:_m,setMany:Mm,updateOne:Rm,updateMany:wm,deleteOne:oi,deleteMany:hi,initialize:bm});h(this,"selectors",{selectById:vm,selectByIds:Em})}add(e){var m;const{store:a}=this.client,c=((m=a.getState().userReducer.currentUser)==null?void 0:m.id)??null,d=new Date().toISOString(),r=F({...e,created_by:c,submitted_at:d});this.dispatch(this.actions.addOne(r));const o=this.enqueueRequest({description:"Create form revision",method:y.POST,url:`${this.url}/`,payload:w(r),blockers:[e.form],blocks:[r.uuid]});return o.then(l=>{this.dispatch(this.actions.setOne(l))}).catch(()=>{this.dispatch(this.actions.deleteOne(r.uuid))}),[r,o]}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{form__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class $g extends R{constructor(){super(...arguments);h(this,"name","Form");h(this,"url","/forms");h(this,"actions",{addOne:qm,addMany:$m,setOne:Dm,setMany:Um,updateOne:Cm,updateMany:Lm,deleteOne:Gm,deleteMany:km,initialize:jm});h(this,"selectors",{selectById:Wm,selectByIds:Km})}add(e,a){var l;const{store:n}=this.client,c=new Date().toISOString(),d=((l=n.getState().userReducer.currentUser)==null?void 0:l.id)??null,r=F({...e,submitted_at:c,created_by:d}),o=F({...a,form:r.uuid,submitted_at:c,created_by:d});this.dispatch(this.actions.addOne(r)),this.dispatch(ui(o));const m=this.enqueueRequest({description:"Create form",method:y.POST,url:`${this.url}/`,payload:{...w(r),initial_revision:{uuid:o.uuid,submitted_at:o.submitted_at,title:o.title,description:o.description,fields:o.fields}},blockers:[],blocks:[r.uuid,o.uuid]});return m.catch(p=>{throw this.dispatch(this.actions.deleteOne(r.uuid)),this.dispatch(oi(o.uuid)),p}),[r,o,m]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error("Expected form to exist");const d=fy(e)(n);d.length>0&&this.dispatch(gi(d.map(({uuid:o})=>o)));const r=Vm(e)(n);r.length>0&&this.dispatch(hi(r.map(({uuid:o})=>o))),this.dispatch(this.actions.deleteOne(e));try{return await this.enqueueRequest({description:"Delete form",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(this.actions.addOne(c)),r.length>0&&this.dispatch(li(r)),d.length>0&&this.dispatch(Pi(d)),o}}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class Dg extends R{constructor(){super(...arguments);h(this,"name","Form Submission Attachment");h(this,"url","/form-submission-attachments");h(this,"actions",{addOne:Jm,addMany:fi,setOne:Xm,setMany:Qm,updateOne:xm,updateMany:ey,deleteOne:ty,deleteMany:Si,initialize:Zm});h(this,"selectors",{selectById:sy,selectByIds:iy})}async bulkAdd(e){var m;const a=new Date().toISOString(),n=((m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id)??null,c={},d=[],r=[];for(const l of e){const{submissionUuid:p,fieldIdentifier:A,file:T}=l,I=await this.client.files.getFilePayload(T);I.sha1 in c||(c[I.sha1]=I);const _=F({file:URL.createObjectURL(T),file_type:T.type,file_name:T.name,file_sha1:I.sha1,created_by:n,form_submission:p,submitted_at:a,field_identifier:A});d.push(_);const M={uuid:_.uuid,file_name:T.name,file_sha1:I.sha1,file_extension:I.extension,field_identifier:A,form_submission:p};r.push(M)}this.dispatch(this.actions.addMany(d));const o=this.enqueueRequest({description:"Attach files to form submission",method:y.POST,url:`${this.url}/bulk/`,payload:{submitted_at:a,attachments:r,files:Object.values(c)},blockers:d.map(l=>l.form_submission),blocks:d.map(l=>l.uuid)});return o.then(l=>{this.client.files.processPresignedUrls(l.presigned_urls),this.dispatch(this.actions.setMany(l.attachments))}).catch(l=>{throw this.dispatch(this.actions.deleteMany(d.map(p=>p.uuid))),l}),[d,o.then(({attachments:l})=>l)]}async bulkDelete(e){const{store:a}=this.client,n=a.getState(),c=Oi(e)(n);this.dispatch(this.actions.deleteMany(e));try{await this.enqueueRequest({description:"Delete form submission attachments",method:y.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(this.actions.addMany(c)),d}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{form_submission__form_revision__form__organization:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class Ug extends R{constructor(){super(...arguments);h(this,"name","Form Submission");h(this,"url","/form-submissions");h(this,"actions",{addOne:ly,addMany:Pi,setOne:ry,setMany:uy,updateOne:oy,updateMany:hy,deleteOne:my,deleteMany:gi,initialize:dy});h(this,"selectors",{selectById:py,selectByIds:Ay})}add(e){var m;const{store:a}=this.client,c=((m=a.getState().userReducer.currentUser)==null?void 0:m.id)??null,d=new Date().toISOString(),r=F({...e,created_by:c,submitted_at:d}),o=this.enqueueRequest({description:"Add form submission",method:y.POST,url:`${this.url}/`,payload:w(r),blockers:[e.form_revision],blocks:[r.uuid]});return this.dispatch(this.actions.addOne(r)),o.then(l=>(this.dispatch(this.actions.setOne(l)),l)).catch(()=>{this.dispatch(this.actions.deleteOne(r.uuid))}),[r,o]}update(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e.uuid)(n);if(!c)throw new Error(`Expected submission with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(this.actions.setOne(d));const r=this.enqueueRequest({description:"Delete user form submissions",method:y.PATCH,url:`${this.url}/${d.uuid}/`,payload:e,blockers:[d.uuid],blocks:[d.uuid]});return r.then(o=>{this.dispatch(this.actions.setOne(o))}).catch(()=>{this.dispatch(this.actions.setOne(c))}),[d,r]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const d=ay(e)(n);this.dispatch(this.actions.deleteOne(e)),this.dispatch(Si(d.map(r=>r.uuid)));try{return await this.enqueueRequest({description:"Delete user form submissions",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(this.actions.addOne(c)),this.dispatch(fi(d)),r}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{limit:this.pageSize,paginate:!0,form_revision__form_organization:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class Cg extends R{constructor(){super(...arguments);h(this,"name","Geo Image");h(this,"url","/geo-images");h(this,"actions",{addOne:Py,addMany:gy,setOne:Oy,setMany:Fy,updateOne:by,updateMany:_y,deleteOne:My,deleteMany:Ry,initialize:Iy});h(this,"selectors",{selectById:vy,selectByIds:Ey})}async add(e){var A;const{store:a}=this.client,{file:n,...c}=e,d=new Date().toISOString(),r=((A=a.getState().userReducer.currentUser)==null?void 0:A.id)??null,o=c.project,m=await this.client.files.getFilePayload(n),l=F({...c,file_name:n.name,file_sha1:m.sha1,file_type:n.type,file:URL.createObjectURL(n),submitted_at:d,created_by:r});this.dispatch(this.actions.addOne(l));const p=this.enqueueRequest({description:"Add geo image",method:y.POST,url:`${this.url}/`,payload:{uuid:l.uuid,submitted_at:d,title:l.title,description:l.description,geo_marker:l.geo_marker,canvas_marker:l.canvas_marker,sha1:l.file_sha1,project:l.project,file_name:l.file_name,direction:l.direction,original_date:l.original_date,file:m},blocks:[o],blockers:[o]});return p.then(T=>{this.client.files.processPresignedUrls(T.presigned_urls),this.dispatch(this.actions.setOne(T.geo_image))}).catch(()=>{this.dispatch(this.actions.deleteOne(l.uuid))}),[l,p.then(T=>T.geo_image)]}async bulkAdd(e,a){var A;const{store:n}=this.client,c=new Date().toISOString(),d=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,r=[],o=[],m=[],l={};for(const T of e){const{file:I,..._}=T,M=await this.client.files.getFilePayload(I);M.sha1 in l||(l[M.sha1]=M);const g=F({..._,file_name:I.name,file_sha1:M.sha1,file_type:I.type,file:URL.createObjectURL(I),submitted_at:c,created_by:d,project:a});r.push(g),o.push(g.uuid),m.push({uuid:g.uuid,sha1:g.file_sha1,file_name:g.file_name,title:g.title,description:g.description,geo_marker:g.geo_marker,canvas_marker:g.canvas_marker,direction:g.direction,original_date:g.original_date})}this.dispatch(this.actions.addMany(r));const p=this.enqueueRequest({description:"Bulk add geo images",method:y.POST,url:`${this.url}/bulk/`,payload:{submitted_at:c,project:a,geo_images:m,files:Object.values(l)},blocks:[a],blockers:o});return p.then(T=>{this.client.files.processPresignedUrls(T.presigned_urls),this.dispatch(this.actions.setMany(T.geo_images))}).catch(()=>{this.dispatch(this.actions.deleteMany(o))}),[r,p.then(T=>T.geo_images)]}update(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e.uuid)(n);if(!c)throw new Error(`Map image with uuid ${e.uuid} does not exist in the store`);const d={...c,...e};this.dispatch(this.actions.setOne(d));const r=this.enqueueRequest({description:"Update geo image",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return r.then(o=>{this.dispatch(this.actions.setOne(o))}).catch(()=>{this.dispatch(this.actions.setOne(c))}),[d,r]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Map image with uuid ${e} does not exist in the store`);this.dispatch(this.actions.deleteOne(e));const d=this.enqueueRequest({description:"Delete geo image",method:y.DELETE,url:`${this.url}/${e}/`,blocks:[e],blockers:[e]});return d.catch(()=>{this.dispatch(this.actions.setOne(c))}),d}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{project:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class Lg extends R{constructor(){super(...arguments);h(this,"name","Issue Association");h(this,"url","/issue-associations");h(this,"actions",{addOne:Uy,addMany:bt,setOne:qy,setMany:jy,updateOne:$y,updateMany:Dy,deleteOne:Cy,deleteMany:_t,initialize:By});h(this,"selectors",{selectById:Gy,selectByIds:ky})}add(e){var o;const{store:a}=this.client,n=new Date().toISOString(),c=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,d=F({...e,submitted_at:n,created_by:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Add issue association",method:y.POST,url:`${this.url}/`,payload:w(d),blockers:[e.associated_issue,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}async delete(e){const{store:a}=this.client,n=this.selectors.selectById(e)(a.getState());if(!n)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(this.actions.deleteOne(e));const c=this.enqueueRequest({description:"Delete issue association",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return c.catch(()=>{this.dispatch(this.actions.addOne(n))}),c}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{associated_issue__project:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class Gg extends We{constructor(){super(...arguments);h(this,"name","Issue Attachment");h(this,"url","/issue-attachments");h(this,"actions",{addOne:Jy,addMany:vi,setOne:Xy,setMany:Qy,updateOne:xy,updateMany:ep,deleteOne:tp,deleteMany:Ei,initialize:Zy});h(this,"selectors",{selectById:ap,selectByIds:np})}getId(e){return e.uuid}buildModel(e){return F({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,issue:e.modelUuid})}buildPayload(e,a){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:a.extension,issue:e.issue}}async bulkAdd(e){return this._bulkAdd(e.map(a=>({modelUuid:a.issueUuid,file:a.file})))}async delete(e){return this._delete(e)}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{issue__project:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class kg extends We{constructor(){super(...arguments);h(this,"name","Issue Comment Attachment");h(this,"url","/issue-comment-attachments");h(this,"actions",{addOne:up,addMany:lp,setOne:op,setMany:hp,updateOne:mp,updateMany:yp,deleteOne:pp,deleteMany:Ap,initialize:rp});h(this,"selectors",{selectById:Sp,selectByIds:Tp})}getId(e){return e.uuid}buildModel(e){return F({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,issue_comment:e.modelUuid})}buildPayload(e,a){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:a.extension,issue_comment:e.issue_comment}}async bulkAdd(e){return this._bulkAdd(e.map(a=>({modelUuid:a.issueCommentUuid,file:a.file})))}async delete(e){return this._delete(e)}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{issue_comment__issue__project:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class Ng extends R{constructor(){super(...arguments);h(this,"name","Issue Comment");h(this,"url","/issue-comments");h(this,"actions",{addOne:Pp,addMany:gp,setOne:bp,setMany:_p,updateOne:Mp,updateMany:Rp,deleteOne:wp,deleteMany:vp,initialize:Fp});h(this,"selectors",{selectById:Ep,selectByIds:Vp})}add(e){const{store:a}=this.client,n=F({...e,author:a.getState().userReducer.currentUser.id,submitted_at:new Date().toISOString()});this.dispatch(this.actions.addOne(n));const c=this.enqueueRequest({description:"Add issue comment",method:y.POST,url:`${this.url}/`,payload:w(n),blockers:[e.issue],blocks:[n.uuid]});return c.catch(()=>{this.dispatch(this.actions.deleteOne(n.uuid))}),[n,c]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Edit issue comment",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}remove(e){const{store:a}=this.client,n=this.selectors.selectById(e)(a.getState());if(!n)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(this.actions.deleteOne(e));const c=this.enqueueRequest({description:"Delete comment",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return c.catch(()=>{this.dispatch(this.actions.addOne(n))}),c}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{issue__project:e}},a);return this.dispatch(this.actions.setMany(n)),n}}class Hg extends R{constructor(){super(...arguments);h(this,"name","Issue");h(this,"url","/issues");h(this,"actions",{addOne:qp,addMany:Di,setOne:$p,setMany:Dp,updateOne:Up,updateMany:Cp,deleteOne:Lp,deleteMany:Ui,initialize:jp});h(this,"selectors",{selectById:kp,selectByIds:Np})}add(e){var m;const{store:a}=this.client,n=a.getState(),c=new Date().toISOString(),d=((m=n.userReducer.currentUser)==null?void 0:m.id)??null,r=F({...e,submitted_at:c,created_by:d});this.dispatch(this.actions.addOne(r));const o=this.enqueueRequest({description:"Create issue",method:y.POST,url:`${this.url}/`,payload:w(r),blockers:[r.project,r.issue_type,...r.category?[r.category]:[]],blocks:[r.uuid]});return o.then(l=>{this.dispatch(this.actions.setOne(l))}).catch(l=>{throw this.dispatch(this.actions.deleteOne(r.uuid)),l}),[r,o]}update(e){var m;const a=this.client.store.getState(),n=this.selectors.selectById(e.uuid)(a);if(!n)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d={};for(const l of[z.TITLE,z.DESCRIPTION,z.STATUS,z.CATEGORY,z.PRIORITY,z.ASSIGNED_TO,z.DUE_DATE])if(l in e&&e[l]!==n[l])switch(l){case z.PRIORITY:d[l]=e[l];break;case z.DUE_DATE:d[l]=e[l];break;case z.DESCRIPTION:d[l]=e[l];break;case z.TITLE:d[l]=e[l];break;case z.STATUS:{const p=e[l],A=ia(p)(a);if(!A)throw new Error(`Trying to update issue type status with ${p} which does not exist in store`);d[l]={name:A.name,color:A.color,uuid:A.uuid};break}case z.CATEGORY:{const p=e[l];if(p===null)d[l]=null;else{const A=Xs(p)(a);if(!A)throw new Error(`Trying to update category with ${p} which does not exist in store.`);d[l]={name:A.name,color:A.color,uuid:A.uuid}}break}case z.ASSIGNED_TO:{const p=e[l];if(p===null)d[l]=null;else{const A=Et(p)(a);if(!A)throw new Error(`Trying to update assigned to with ${p} which does not exist in store.`);d[l]={full_name:A.username,id:A.id}}break}}const r=F({created_by:((m=a.userReducer.currentUser)==null?void 0:m.id)??null,submitted_at:new Date().toISOString(),issue:n.uuid,changes:d});this.dispatch(na(r));const o=this.enqueueRequest({description:"Edit issue",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return o.catch(()=>{this.dispatch(this.actions.setOne(n)),this.dispatch(da(r.uuid))}),[c,o]}async remove(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`No issue with uuid ${e} found in the store`);const d=ip(e)(n),r=SS(e)(n),o={};for(const l of Ny(e)(n))o[l.uuid]=l;for(const l of Hy(e)(n))o[l.uuid]=l;const m=Object.values(o);this.dispatch(this.actions.deleteOne(e)),d.length>0&&this.dispatch(Ei(d.map(({uuid:l})=>l))),r.length>0&&this.dispatch(ra(r.map(({uuid:l})=>l))),m.length>0&&this.dispatch(_t(m.map(({uuid:l})=>l)));try{return await this.enqueueRequest({description:"Delete issue",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(l){throw this.dispatch(this.actions.addOne(c)),this.dispatch(vi(d)),this.dispatch(ca(r)),this.dispatch(bt(m)),l}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{project:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class Wg extends We{constructor(){super(...arguments);h(this,"name","Issue Type Attachment");h(this,"url","/issue-type-attachments");h(this,"actions",{addOne:Zp,addMany:Jp,setOne:Xp,setMany:Qp,updateOne:xp,updateMany:eA,deleteOne:tA,deleteMany:sA,initialize:Yp});h(this,"selectors",{selectById:aA,selectByIds:nA})}getId(e){return e.uuid}buildModel(e){return F({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,issue_type:e.modelUuid})}buildPayload(e,a){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:a.extension,issue_type:e.issue_type}}async bulkAdd(e){return this._bulkAdd(e.map(a=>({modelUuid:a.issueTypeUuid,file:a.file})))}async delete(e){return this._delete(e)}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{issue_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class Kg extends R{constructor(){super(...arguments);h(this,"name","Issue Type Fields Attachment");h(this,"url","/issue-type-fields-attachments");h(this,"actions",{addOne:uA,addMany:lA,setOne:oA,setMany:hA,updateOne:mA,updateMany:yA,deleteOne:pA,deleteMany:AA,initialize:rA});h(this,"selectors",{selectById:SA,selectByIds:TA})}async bulkAdd(e){var m;const a=new Date().toISOString(),n=((m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id)??null,c={},d=[],r=[];for(const l of e){const{fieldsRevisionUuid:p,fieldIdentifier:A,file:T}=l,I=await this.client.files.getFilePayload(T);I.sha1 in c||(c[I.sha1]=I);const _=F({file:URL.createObjectURL(T),file_type:T.type,file_name:T.name,file_sha1:I.sha1,created_by:n,fields_revision:p,submitted_at:a,field_identifier:A});d.push(_);const M={uuid:_.uuid,file_name:T.name,file_extension:I.extension,field_identifier:A,file_sha1:I.sha1,fields_revision:p};r.push(M)}this.dispatch(this.actions.addMany(d));const o=this.enqueueRequest({description:"Add issue type fields attachments",method:y.POST,url:`${this.url}/bulk/`,payload:{submitted_at:a,attachments:r,files:Object.values(c)},blockers:d.map(l=>l.fields_revision),blocks:d.map(l=>l.uuid)});return o.then(l=>{this.client.files.processPresignedUrls(l.presigned_urls),this.dispatch(this.actions.setMany(l.attachments))}).catch(()=>{this.dispatch(this.actions.deleteMany(d.map(l=>l.uuid)))}),[d,o.then(({attachments:l})=>l)]}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{fields_revision__issue_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class Yg extends R{constructor(){super(...arguments);h(this,"name","Issue Type Fields");h(this,"url","/issue-type-fields");h(this,"actions",{addOne:$A,addMany:DA,setOne:UA,setMany:CA,updateOne:LA,updateMany:GA,deleteOne:kA,deleteMany:NA,initialize:qA});h(this,"selectors",{selectById:WA,selectByIds:KA})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Add Issue Type Fields",method:y.POST,url:`${this.url}/`,payload:w(d),blockers:[d.issue_type],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(m=>{throw this.dispatch(this.actions.deleteOne(d.uuid)),m}),[d,r]}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{issue_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class Zg extends R{constructor(){super(...arguments);h(this,"name","Issue Type Field Values Attachment");h(this,"url","/issue-type-field-values-attachments");h(this,"actions",{addOne:XA,addMany:Ki,setOne:QA,setMany:xA,updateOne:ef,updateMany:tf,deleteOne:sf,deleteMany:Yi,initialize:JA});h(this,"selectors",{selectById:nf,selectByIds:cf})}async bulkAdd(e){var m;const a=new Date().toISOString(),n=((m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id)??null,c={},d=[],r=[];for(const l of e){const{fieldValuesUuid:p,fieldIdentifier:A,file:T}=l,I=await this.client.files.getFilePayload(T);I.sha1 in c||(c[I.sha1]=I);const _=F({file:URL.createObjectURL(T),file_type:T.type,file_name:T.name,file_sha1:I.sha1,created_by:n,field_values:p,submitted_at:a,field_identifier:A});d.push(_);const M={uuid:_.uuid,file_name:T.name,file_sha1:I.sha1,file_extension:I.extension,field_identifier:A,field_values:p};r.push(M)}this.dispatch(this.actions.addMany(d));const o=this.enqueueRequest({description:"Add issue type field values attachments",method:y.POST,url:`${this.url}/bulk/`,payload:{submitted_at:a,attachments:r,files:Object.values(c)},blockers:d.map(l=>l.field_values),blocks:d.map(l=>l.uuid)});return o.then(({presigned_urls:l,attachments:p})=>{this.client.files.processPresignedUrls(l),this.dispatch(this.actions.setMany(p))}).catch(l=>{throw this.dispatch(this.actions.deleteMany(d.map(p=>p.uuid))),l}),[d,o.then(({attachments:l})=>l)]}async bulkDelete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectByIds(e)(n);this.dispatch(this.actions.deleteMany(e));try{await this.enqueueRequest({description:"Delete issue type field values attachments",method:y.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(this.actions.addMany(c)),d}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{field_values__issue__project:e,latest:!0}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class Jg extends R{constructor(){super(...arguments);h(this,"name","Issue Type Field Values");h(this,"url","/issue-type-field-values");h(this,"actions",{addOne:PA,addMany:gA,setOne:bA,setMany:_A,updateOne:MA,updateMany:RA,deleteOne:wA,deleteMany:vA,initialize:FA});h(this,"selectors",{selectById:VA,selectByIds:zA})}add(e){var m;const{store:a}=this.client,c=((m=a.getState().userReducer.currentUser)==null?void 0:m.id)??null,d=new Date().toISOString(),r=F({...e,created_by:c,submitted_at:d}),o=this.enqueueRequest({description:"Add issue type field values",method:y.POST,url:`${this.url}/`,payload:w(r),blockers:[e.issue,e.fields_revision],blocks:[r.uuid]});return this.dispatch(this.actions.addOne(r)),o.then(l=>(this.dispatch(this.actions.setOne(l)),l)).catch(()=>{this.dispatch(this.actions.deleteOne(r.uuid))}),[r,o]}update(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e.uuid)(n);if(!c)throw new Error(`Expected IssueTypeFieldValues with uuid ${e.uuid} to exist`);const d={...c,...e};this.dispatch(this.actions.setOne(d));const r=this.enqueueRequest({description:"Update issue type field values",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[d.uuid,d.fields_revision,d.issue],blocks:[d.uuid]});return r.then(o=>{this.dispatch(this.actions.setOne(o))}).catch(()=>{this.dispatch(this.actions.setOne(c))}),[d,r]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected submission with uuid ${e} to exist`);const d=df(e)(n);this.dispatch(this.actions.deleteOne(e)),this.dispatch(Yi(d.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete issue type field values",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(this.actions.addOne(c)),this.dispatch(Ki(d)),r}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{issue__project:e,latest:!0}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class Xg extends R{constructor(){super(...arguments);h(this,"name","Issue Type Identifier");h(this,"url","/issue-type-identifiers");h(this,"actions",{addOne:of,addMany:hf,setOne:mf,setMany:yf,updateOne:pf,updateMany:Af,deleteOne:ff,deleteMany:Sf,initialize:lf});h(this,"selectors",{selectById:If,selectByIds:Of})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create issue type identifier",method:y.POST,url:`${this.url}/`,payload:w(d),blockers:[d.issue_type],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`Expected issue type identifier with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update issue type identifier",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected issue type identifier with uuid ${e} to exist`);this.dispatch(this.actions.deleteOne(e));try{return await this.enqueueRequest({description:"Delete issue type identifier",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(this.actions.addOne(c)),d}}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{issue_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class Qg extends R{constructor(){super(...arguments);h(this,"name","Issue Type Identifier Value");h(this,"url","/issue-type-identifier-values");h(this,"actions",{addOne:bf,addMany:_f,setOne:Mf,setMany:Rf,updateOne:wf,updateMany:vf,deleteOne:Ef,deleteMany:Vf,initialize:gf});h(this,"selectors",{selectById:Bf,selectByIds:jf})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create issue type identifier value",method:y.POST,url:`${this.url}/`,payload:w(d),blockers:[e.issue,e.issue_type_identifier],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`Expected issue type identifier value with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update issue type identifier value",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected issue type identifier value with uuid ${e} to exist`);this.dispatch(this.actions.deleteOne(e));try{return await this.enqueueRequest({description:"Delete issue type identifier value",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(this.actions.addOne(c)),d}}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{issue__project:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class xg extends R{constructor(){super(...arguments);h(this,"name","Issue Type");h(this,"url","/issue-types");h(this,"actions",{addOne:Uf,addMany:Cf,setOne:Lf,setMany:Gf,updateOne:kf,updateMany:Nf,deleteOne:Hf,deleteMany:Wf,initialize:Df});h(this,"selectors",{selectById:Yf,selectByIds:Zf})}add(e){var m;const{store:a}=this.client,c=((m=a.getState().userReducer.currentUser)==null?void 0:m.id)??null,d=new Date().toISOString(),r=F({...e,submitted_at:d,created_by:c});this.dispatch(this.actions.addOne(r));const o=this.enqueueRequest({method:y.POST,url:`${this.url}/`,payload:w(r),blockers:[],blocks:[r.uuid]});return o.then(l=>{this.dispatch(this.actions.setOne(l))}).catch(()=>{this.dispatch(this.actions.deleteOne(r.uuid))}),[r,o]}update(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e.uuid)(n);if(!c)throw new Error(`IssueType with uuid ${e.uuid} does not exist in the store.`);const d={...c,...e};this.dispatch(this.actions.setOne(d));const r=this.enqueueRequest({method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(o=>{this.dispatch(this.actions.setOne(o))}).catch(()=>{this.dispatch(this.actions.setOne(c))}),[d,r]}delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const d=Hp(e)(n);this.dispatch(this.actions.deleteOne(e)),this.dispatch(Ui(d.map(o=>o.uuid)));const r=this.enqueueRequest({method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return r.catch(()=>{this.dispatch(this.actions.setOne(c)),this.dispatch(Di(d))}),r}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class eb extends R{constructor(){super(...arguments);h(this,"name","Issue Type Status");h(this,"url","/issue-type-statuses");h(this,"actions",{addOne:xf,addMany:eS,setOne:tS,setMany:sS,updateOne:iS,updateMany:aS,deleteOne:nS,deleteMany:cS,initialize:Qf});h(this,"selectors",{selectById:ia,selectByIds:rS})}add(e){var o;const{store:a}=this.client,n=((o=a.getState().userReducer.currentUser)==null?void 0:o.id)??null,c=new Date().toISOString(),d=F({...e,created_by:n,submitted_at:c});this.dispatch(this.actions.addOne(d));const r=this.enqueueRequest({description:"Create Issue Type Status",method:y.POST,url:`${this.url}/`,payload:w(d),blockers:[e.issue_type],blocks:[d.uuid]});return r.then(m=>{this.dispatch(this.actions.setOne(m))}).catch(()=>{this.dispatch(this.actions.deleteOne(d.uuid))}),[d,r]}update(e){const a=this.client.store.getState(),n=this.selectors.selectById(e.uuid)(a);if(!n)throw new Error(`Expected an existing issue type status with uuid ${e.uuid}`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Edit Issue Type Status",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}delete(e){const{store:a}=this.client,n=this.selectors.selectById(e)(a.getState());if(!n)throw new Error(`No issue type status with uuid ${e} found in the store`);this.dispatch(this.actions.deleteOne(e));const c=this.enqueueRequest({description:"Delete Issue Type Status",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return c.catch(()=>{this.dispatch(this.actions.addOne(n))}),c}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{issue_type__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class tb extends R{constructor(){super(...arguments);h(this,"name","Issue Update");h(this,"url","/issue-updates");h(this,"actions",{addOne:na,addMany:ca,setOne:hS,setMany:mS,updateOne:yS,updateMany:pS,deleteOne:da,deleteMany:ra,initialize:oS});h(this,"selectors",{selectById:AS,selectByIds:fS})}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{issue__project:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}const sb=1800;function ib(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 ab extends xP{constructor(){super(...arguments);h(this,"_getRenewedTokens",async e=>{const a=this.performRequest({method:y.POST,url:this.refreshTokensUrl,payload:{refresh:e},isAuthNeeded:!1,checkAuth:!1});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(Ro(!1)),this.clearTokens(),this.dispatch(O()),this.dispatch(O())}async renewTokens(){const e=this.getRefreshToken();if(!e)throw new Error("No refresh token found");console.debug(this.constructor.name,"renewing tokens");try{const a=await this._getRenewedTokens(e);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 e=this.getAccessToken();if(!e)return!1;const a=Date.now()/1e3;let n;try{n=MO(e).exp??a}catch{n=a}return n-a<sb}getAuthHeader(){return`Bearer ${this.getAccessToken()}`}async prepareAuth(){if(this.tokenIsExpiringSoon()){console.debug(this.constructor.name,"preparing auth");try{await this.renewTokens()}catch(e){return e instanceof j&&this.clearAuth(),e instanceof Error?Promise.reject(e):Promise.reject(new Error((e??tt).toString()))}}}async handleUnauthorized(e,a){const n=this.client.store.getState();if(e.url.endsWith("/token/refresh/"))throw n.authReducer.isLoggedIn&&console.warn("No signed-in user to sign out."),this.clearAuth(),new j({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 j({message:"Incorrect username or password.",response:a,discard:!0})}async initAuth(e){const a=xe.v4();return console.debug(this.constructor.name,"Initiating auth"),this.performRequest({uuid:a,method:y.POST,url:this.initTokensUrl,payload:e,isAuthNeeded:!1,checkAuth:!1}).then(n=>{this.setTokens(ib(n))})}}class nb extends st{constructor(){super(...arguments);h(this,"name","Organization Access");h(this,"url","/organization-accesses");h(this,"actions",{addOne:zS,addMany:BS,setOne:jS,setMany:qS,updateOne:$S,updateMany:DS,deleteOne:US,deleteMany:CS,initialize:VS});h(this,"selectors",{selectById:GS,selectByIds:kS})}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState()),c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Edit organization access",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(r=>{throw this.dispatch(this.actions.setOne(n)),r}),[c,d]}async remove(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n),d=Et(c.user)(n);this.dispatch(this.actions.deleteOne(c.uuid)),this.dispatch(ma(c.user));try{await this.enqueueRequest({description:"Remove organization access",method:y.DELETE,url:`${this.url}/${c.uuid}/`,blockers:[c.uuid],blocks:[]})}catch(r){throw this.dispatch(this.actions.addOne(c)),this.dispatch(ha(d)),r}}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class cb extends st{constructor(){super(...arguments);h(this,"name","Organization");h(this,"url","/organizations");h(this,"actions",{addOne:JS,addMany:ZS,setOne:YS,setMany:KS,updateOne:QS,updateMany:XS,deleteOne:xS,deleteMany:eT,initialize:WS});h(this,"selectors",{selectById:iT,selectByIds:aT})}async add(e){const a=await this.enqueueRequest({description:"Create organization",method:y.POST,url:`${this.url}/`,payload:e,blockers:[],blocks:[]});return this.dispatch(this.actions.addOne(a)),a}async update(e){const a=await this.enqueueRequest({description:"Edit organization",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return this.dispatch(this.actions.setOne(a)),a}async invite(e,a){return this.enqueueRequest({description:"Invite user to organization",method:y.POST,url:`${this.url}/${e}/invite/${a}/`,blockers:[],blocks:[]})}async refreshStore(e){const a=await this.performRequest({method:y.GET,url:`${this.url}/`},e);return this.dispatch(this.actions.initialize(a)),a}}class db extends R{constructor(){super(...arguments);h(this,"name","Project Access");h(this,"url","/project-accesses");h(this,"actions",{addOne:yT,addMany:pT,setOne:AT,setMany:fT,updateOne:ST,updateMany:TT,deleteOne:IT,deleteMany:OT,initialize:mT});h(this,"selectors",{selectById:PT,selectByIds:gT})}add(e){var d;const{store:a}=this.client,n=F({...e,created_by:((d=a.getState().userReducer.currentUser)==null?void 0:d.id)??null});this.dispatch(this.actions.addOne(n));const c=this.enqueueRequest({description:"Add project access",method:y.POST,url:`${this.url}/`,payload:w(n),blockers:[n.organization_access,n.project],blocks:[n.uuid]});return c.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(r=>{throw this.dispatch(this.actions.deleteOne(n.uuid)),r}),[n,c]}bulkAdd(e){var r;const{store:a}=this.client,n=((r=a.getState().userReducer.currentUser)==null?void 0:r.id)??null,c=e.map(o=>F({...o,created_by:n}));this.dispatch(this.actions.addMany(c));const d=this.enqueueRequest({description:"Add project accesses",method:y.POST,url:`${this.url}/bulk/`,payload:{project_accesses:c.map(o=>w(o))},blockers:c.flatMap(o=>[o.project,o.organization_access]),blocks:c.map(o=>o.uuid)});return d.then(o=>{this.dispatch(this.actions.setMany(o))}).catch(o=>{throw this.dispatch(this.actions.deleteMany(c.map(m=>m.uuid))),o}),[c,d]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState()),c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Edit project access",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(r=>{throw this.dispatch(this.actions.setOne(n)),r}),[c,d]}async remove(e){const{store:a}=this.client,n=this.selectors.selectById(e)(a.getState());this.dispatch(this.actions.deleteOne(e));try{await this.enqueueRequest({description:"Delete project access",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(this.actions.addOne(n)),c}}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{project__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class rb extends We{constructor(){super(...arguments);h(this,"name","Project Attachment");h(this,"url","/project-attachments");h(this,"actions",{addOne:MT,addMany:RT,setOne:wT,setMany:vT,updateOne:ET,updateMany:VT,deleteOne:zT,deleteMany:BT,initialize:_T});h(this,"selectors",{selectById:qT,selectByIds:$T})}getId(e){return e.uuid}buildModel(e){return F({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,project:e.modelUuid})}buildPayload(e,a){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:a.extension,project:e.project}}async bulkAdd(e){return this._bulkAdd(e.map(a=>({modelUuid:a.projectUuid,file:a.file})))}async delete(e){return this._delete(e)}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{project__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class ub extends R{constructor(){super(...arguments);h(this,"name","Project File");h(this,"url","/project-files");h(this,"actions",{addOne:kT,addMany:NT,setOne:LT,setMany:GT,updateOne:HT,updateMany:WT,deleteOne:KT,deleteMany:YT,initialize:CT});h(this,"selectors",{selectById:eI,selectByIds:tI})}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 a={...e};delete a.file;const n=this.enqueueRequest({method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:a,blockers:[e.uuid],blocks:[e.uuid]});return n.then(c=>{this.dispatch(this.actions.setOne(c))}),n}saveActive(){const{store:e}=this.client,a=e.getState(),n=a.projectFileReducer.activeProjectFileId;if(!n)throw new Error("No active project file");const c=a.projectFileReducer.instances[n];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 d;if(typeof c.file=="string"&&!c.file.startsWith("blob:")){const m={...c};delete m.file,d={method:y.PATCH,url:`${this.url}/${n}/`,payload:m,blockers:[n],blocks:[n]}}else d=new Promise((m,l)=>{this.client.files.uploadFileToS3(c.file_sha1).then(([p])=>{m({method:y.POST,url:`${this.url}/`,payload:{...c,...p},blockers:[n],blocks:[n]})}).catch(l)});const o=Promise.resolve(d).then(m=>this.enqueueRequest(m));return o.then(m=>{this.dispatch(this.actions.setOne(m))}),this.dispatch(XT),this.dispatch(JT(null)),this.dispatch(ZT(!1)),[c,o]}delete(e){return this.dispatch(this.actions.deleteOne(e)),this.enqueueRequest({method:y.DELETE,url:`${this.url}/${e}`,blockers:[e],blocks:[]})}async refreshStore(e,a){const c=(await this.performPagination({method:y.GET,url:`${this.url}/`,queryParams:{project:e}},a)).flat();return this.dispatch(this.actions.initialize(c)),c}}class lb extends st{constructor(){super(...arguments);h(this,"name","Project");h(this,"url","/projects");h(this,"actions",{addOne:rI,addMany:dI,setOne:cI,setMany:nI,updateOne:lI,updateMany:uI,deleteOne:oI,deleteMany:hI,initialize:aI});h(this,"selectors",{selectById:pI,selectByIds:AI})}async add(e){const{addOne:a}=this.actions,n=await this.performRequest({method:y.POST,url:`${this.url}/`,payload:w(e)});return this.dispatch(a(n)),n}async update(e){const{updateOne:a}=this.actions,n=await this.performRequest({method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:w(e)});return this.dispatch(a(n)),n}async delete(e){const{deleteOne:a}=this.actions,n=await this.enqueueRequest({description:"Delete project",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return this.dispatch(a(e)),n}async refreshStore(e,a){const{initialize:n}=this.actions,c=await this.list({queryParams:{organization:e}},a);return this.dispatch(n(c)),c}}class ob extends R{constructor(){super(...arguments);h(this,"name","Team Membership");h(this,"url","/team-memberships");h(this,"actions",{addOne:II,addMany:OI,setOne:FI,setMany:PI,updateOne:gI,updateMany:bI,deleteOne:_I,deleteMany:MI,initialize:TI});h(this,"selectors",{selectById:vI,selectByIds:EI})}add(e){var d;const{store:a}=this.client,n=F({...e,created_by:((d=a.getState().userReducer.currentUser)==null?void 0:d.id)??null});this.dispatch(this.actions.addOne(n));const c=this.enqueueRequest({description:"Create team membership",method:y.POST,url:`${this.url}/`,payload:w(n),blockers:[e.team],blocks:[n.uuid]});return c.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.deleteOne(n.uuid))}),[n,c]}bulkAdd(e){var r;const{store:a}=this.client,n=((r=a.getState().userReducer.currentUser)==null?void 0:r.id)??null,c=e.map(o=>F({...o,created_by:n}));this.dispatch(this.actions.addMany(c));const d=this.enqueueRequest({description:"Create team memberships",method:y.POST,url:`${this.url}/bulk/`,payload:{team_memberships:c.map(o=>w(o))},blockers:c.map(o=>o.team),blocks:c.map(o=>o.uuid)});return d.then(o=>{this.dispatch(this.actions.setMany(o))}).catch(()=>{this.dispatch(this.actions.deleteMany(c.map(o=>o.uuid)))}),[c,d]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected team membership with uuid ${e} to exist`);this.dispatch(this.actions.deleteOne(e));try{return await this.enqueueRequest({description:"Delete team membership",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(d){throw this.dispatch(this.actions.setOne(c)),d}}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{team__organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class hb extends R{constructor(){super(...arguments);h(this,"name","Team");h(this,"url","/teams");h(this,"actions",{addOne:BI,addMany:jI,setOne:qI,setMany:$I,updateOne:DI,updateMany:UI,deleteOne:CI,deleteMany:LI,initialize:zI});h(this,"selectors",{selectById:kI,selectByIds:NI})}add(e){var d;const{store:a}=this.client,n=F({...e,submitted_at:new Date().toISOString(),created_by:((d=a.getState().userReducer.currentUser)==null?void 0:d.id)??null});this.dispatch(this.actions.addOne(n));const c=this.enqueueRequest({description:"Create team",method:y.POST,url:`${this.url}/`,payload:w(n),blockers:[],blocks:[n.uuid]});return c.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.deleteOne(n.uuid))}),[n,c]}update(e){const{store:a}=this.client,n=this.selectors.selectById(e.uuid)(a.getState());if(!n)throw new Error(`Expected team with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(this.actions.setOne(c));const d=this.enqueueRequest({description:"Update team",method:y.PATCH,url:`${this.url}/${e.uuid}/`,payload:w(e),blockers:[e.uuid],blocks:[e.uuid]});return d.then(r=>{this.dispatch(this.actions.setOne(r))}).catch(()=>{this.dispatch(this.actions.setOne(n))}),[c,d]}async delete(e){const{store:a}=this.client,n=a.getState(),c=this.selectors.selectById(e)(n);if(!c)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(this.actions.deleteOne(e));try{return await this.enqueueRequest({description:"Delete team",method:y.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(d){throw this.dispatch(this.actions.setOne(c)),d}}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`${this.url}/`,queryParams:{organization:e}},a);return this.dispatch(this.actions.initialize(n)),n}}class mb extends st{constructor(){super(...arguments);h(this,"name","User");h(this,"url","/user");h(this,"actions",{addOne:ha,addMany:gS,setOne:PS,setMany:FS,updateOne:_S,updateMany:bS,deleteOne:ma,deleteMany:MS,initialize:OS});h(this,"selectors",{selectById:Et,selectByIds:vS})}async refreshStore(e,a){const n=await this.performRequest({method:y.GET,url:`/organizations/${e}${this.url}s/`},a);return this.dispatch(this.actions.initialize(n)),n}}async function za(t,s,e,a,n){const c=a instanceof Ze;c&&s.checkAuth!==!1&&await a.auth.prepareAuth();const d={queryParams:"",isAuthNeeded:!0},{s3url:r,payload:o,headers:m,method:l,queryParams:p,attachmentHash:A,isExternalUrl:T,isAuthNeeded:I,isResponseBlob:_}={...d,...s};let M=s.url;const g=A?await e.files.fetchCache(A):void 0;if(A&&!g)throw new Error(`Cannot upload file ${A} because it's not cached.`);!T&&!M.startsWith("http")&&(!M.startsWith("/")&&!M.startsWith("blob:")&&(M="/"+M),M=t+M);const v=B=>{if(A){if(!r)throw new Error(`No S3 URL for file ${A}`);if("warning"in r)throw new Error(`S3 URL warning for file ${A}`);if(!g)throw new Error(`No file for file ${A}`);const Ye=r.fields["x-amz-checksum-sha1"];if(!Ye)throw new Error(`No checksum for file ${A}`);return B.set("x-amz-checksum-sha1",Ye).field({...o,...r.fields}).attach("file",g)}return B.send(o)},Ke={[y.GET]:()=>_?Qe.get(M.toString()).responseType("blob"):Qe.get(M.toString()),[y.POST]:()=>{const B=Qe.post(M.toString());return v(B)},[y.PATCH]:()=>{const B=Qe.patch(M.toString());return v(B)},[y.PUT]:()=>{const B=Qe.put(M.toString());return v(B)},[y.DELETE]:()=>{const B=Qe.delete(M.toString());return v(B)}}[l];let $=Ke();if(n==null||n.addEventListener("abort",()=>{console.debug("aborting request:",s),$.abort()}),I&&c){const B=a.auth.getAuthHeader();$=$.set("Authorization",B)}m&&($=$.set(m));try{return await $.query(p)}catch(B){const Ye=rO(B),IO=Ye==null?void 0:Ye.status;if(c&&IO===401)return await a.auth.handleUnauthorized($,Ye),$.query(p);throw new j({response:Ye,innerError:B,discard:wa.includes(IO)})}}class yb{constructor(s){h(this,"store");this.store=s}_performRequest(s,e,a,n){const c=new Dt,d={...e,uuid:e.uuid??xe.v4()};return za(s,d,this,a,n).then(r=>{c.resolve(r.body)}).catch(r=>{r instanceof Error?c.reject(r):c.reject(new Error((r??tt).toString()))}),c}async performRequest(s,e,a,n){return this._performRequest(s,e,a,n).then(c=>{if(c instanceof j)throw c;return c})}async enqueueRequest(s,e,a){return this._enqueueRequest(s,e,a).then(n=>{if(n instanceof j)throw n;return n})}_enqueueRequest(s,e,a){const n=new Dt,c={...s,BASE_URL:e,serviceName:a},d=this.store.dispatch(rT(c)),r=m=>{if(m)n.resolve(m.body);else{const l=new j({message:"Could not get a response from the server.",response:m,discard:!0});n.reject(l)}},o=m=>{m instanceof j?m.options.discard=!0:(console.error("Received an unexpected error while processing a request:",m,`
15
+ Converting error to APIError and discarding.`),m=new j({message:"An error occurred while processing the request.",innerError:m,discard:!0})),n.reject(m)};return d.then(r,o),n}async performPagination(s,e,a,n,c){const d={...e,queryParams:{...e.queryParams,paginate:!0,limit:a}},{method:r}=d,o=[];let m=await this.performRequest(s,d,n,c);for(o.push(m.results);m.next;)m=await this.performRequest(s,{url:m.next,method:r},n,c),o.push(m.results);return o}}class it{constructor(){h(this,"graph");h(this,"requestAttemptCounter");this.graph=new RO.DepGraph,this.requestAttemptCounter={}}static _fromOutbox(s){const e=new it;for(let a=0;a<s.length;a++){const n=s[a];if(!n){console.error("Outbox item was undefined");continue}e.sneakRequest(n);for(let c=0;c<a;c++){const d=s[c];if(!d){console.error("Previous outbox item was undefined");continue}d.payload.uuid!==n.payload.uuid&&d.payload.blocks.some(r=>n.payload.blockers.includes(r))&&it._addDependency(n.payload.uuid,d.payload.uuid,e.graph)}}return e}_addDependency(s,e){it._addDependency(s,e,this.graph)}static _addDependency(s,e,a){if(s===e)throw new Error(`Tried to add dependency from node to itself: ${s}`);if(!a.hasNode(s))throw new Error(`Tried to add dependency from non-existent node: ${s} (to node: ${e})`);if(!a.hasNode(e))throw new Error(`Tried to add dependency to non-existent node: ${e} (from node: ${s})`);a.addDependency(s,e)}addRequest(s){if(this.graph.addNode(s.payload.uuid,s),!(s.payload.blockers.length===0||this.graph.size()===1))for(const e of this.graph.overallOrder()){if(e===s.payload.uuid)continue;const a=this.graph.getNodeData(e);s.payload.blockers.some(n=>a.payload.blocks.includes(n))&&this._addDependency(s.payload.uuid,e)}}insertRequest(s){this.graph.addNode(s.payload.uuid,s);for(const e of this.graph.overallOrder()){if(e===s.payload.uuid)continue;this.graph.getNodeData(e).payload.blockers.some(n=>s.payload.blocks.includes(n))&&this._addDependency(e,s.payload.uuid)}}sneakRequest(s){this.graph.addNode(s.payload.uuid,s)}_getNextNode(){const s=this.graph.overallOrder(!0);let e=1/0,a;for(const n of s){const c=this.requestAttemptCounter[n]||0;c<e&&(e=c,a=n)}return a}peek(){const s=this._getNextNode();if(s)return this.graph.getNodeData(s)}remove(s){this.graph.removeNode(s),delete this.requestAttemptCounter[s]}pop(){const s=this.peek();return s&&this.graph.removeNode(s.payload.uuid),s}getQueue(){const s=this.graph.overallOrder().map(a=>this.graph.getNodeData(a)),e=this._getNextNode();if(e){const a=this.graph.getNodeData(e),n=s.findIndex(c=>c.payload.uuid===a.payload.uuid);n!==-1&&(s.splice(n,1),s.unshift(a))}return s}getReady(){let s=this.graph.overallOrder(!0).map(e=>this.graph.getNodeData(e));return s=s.sort((e,a)=>e.meta.offline.effect.timestamp.localeCompare(a.meta.offline.effect.timestamp)),s=s.sort((e,a)=>{const n=this.requestAttemptCounter[e.payload.uuid]||0,c=this.requestAttemptCounter[a.payload.uuid]||0;return n-c}),s}registerRetry(s){this.requestAttemptCounter[s]=(this.requestAttemptCounter[s]||0)+1}}let uO;function lO(t){uO=t}function at(){return uO}let oO;function hO(t){oO=t}function mO(){return oO}let Ba=null;function Xe(){const t=at();if(!t)return console.warn("Client store not set; cannot get outbox coordinator yet."),null;if(Ba)return Ba;const s=t.getState().offline.outbox,e=it._fromOutbox(s);return Ba=e,e}const pb=(t,s)=>{const e=new s(t);return hO(e),lO(t),e};class Ab{constructor(s){h(this,"_all");h(this,"_previous");this._all=[s],this._previous=s,this.then=this.then.bind(this),this.compile=this.compile.bind(this)}then(s){return this._previous&&(this._previous.next=s),this._all.push(s),this._previous=s,{then:this.then,compile:this.compile}}compile(){return this._all}}class ja{constructor(){h(this,"next");this.next=null}then(s){return new Ab(this).then(s)}async run(s){if(this.next)return this.next.run(s);{if(console.debug("Middleware finished. Performing request:",s),!at())throw new Error("Client store not set");const a=mO();if(!a)throw new Error("Client SDK not set");return nO(s,a)}}}class yO extends ja{async run(s){return super.run(s)}}class pO extends ja{async run(s){return super.run(s)}}const AO=new yO().then(new pO).compile();function fO(t){var s;return(s=AO[0])==null?void 0:s.run(t)}var SO=(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))(SO||{});i.ALL_MIDDLEWARE=AO,i.APIError=j,i.ATTACHMENT_MODEL_DEFAULT_PAGE_SIZE=JI,i.AgentService=eg,i.AssetAttachmentService=tg,i.AssetProcedureService=dg,i.AssetProcedureStepFieldValuesAttachmentService=og,i.AssetProcedureStepFieldValuesService=hg,i.AssetProcedureStepFieldsAttachmentService=ug,i.AssetProcedureStepFieldsService=lg,i.AssetProcedureStepService=mg,i.AssetProcedureTypeAttachmentService=sg,i.AssetProcedureTypeFieldValuesAttachmentService=ng,i.AssetProcedureTypeFieldValuesService=cg,i.AssetProcedureTypeFieldsAttachmentService=ig,i.AssetProcedureTypeFieldsService=ag,i.AssetProcedureTypeService=rg,i.AssetService=yg,i.AssetStageCompletionService=pg,i.AssetStageService=Ag,i.AssetStatusType=La,i.AssetTypeAttachmentService=fg,i.AssetTypeFieldValuesAttachmentService=Ig,i.AssetTypeFieldValuesService=Og,i.AssetTypeFieldsAttachmentService=Sg,i.AssetTypeFieldsService=Tg,i.AssetTypeIdentifierService=Fg,i.AssetTypeIdentifierValueService=Pg,i.AssetTypeService=gg,i.AssetTypeStatusService=bg,i.AttachmentModel=Ga,i.BaseApiService=Ze,i.BaseModelApiService=st,i.BaseOfflineAttachmentModelService=We,i.BaseOfflineModelApiService=R,i.BaseSDK=yb,i.COMMON_AUTO_FIELDS=Za,i.CategoryService=_g,i.DEFAULT_ISSUE_PRIORITY=wO,i.DEFAULT_PAGE_SIZE=ZI,i.DISCARD_HTTP_STATUSES=wa,i.DeferredPromise=Dt,i.DocumentAttachmentService=Mg,i.DocumentService=Rg,i.EMPTY_ARRAY=Da,i.EMPTY_OBJECT=Ua,i.EmailDomainsService=wg,i.EmailVerificationService=vg,i.FileService=Vg,i.FormIdentifierService=zg,i.FormIdentifierValueService=Bg,i.FormRevisionAttachmentService=jg,i.FormRevisionService=qg,i.FormService=$g,i.FormSubmissionAttachmentService=Dg,i.FormSubmissionService=Ug,i.GeoImageService=Cg,i.HttpMethod=y,i.IssueAssociationService=Lg,i.IssueAttachmentService=Gg,i.IssueCommentAttachmentService=kg,i.IssueCommentService=Ng,i.IssuePriority=$t,i.IssueService=Hg,i.IssueStatusType=ka,i.IssueTypeAttachmentService=Wg,i.IssueTypeFieldValuesAttachmentService=Zg,i.IssueTypeFieldValuesService=Jg,i.IssueTypeFieldsAttachmentService=Kg,i.IssueTypeFieldsService=Yg,i.IssueTypeIdentifierService=Xg,i.IssueTypeIdentifierValueService=Qg,i.IssueTypeService=xg,i.IssueTypeStatusService=eb,i.IssueUpdateChange=z,i.IssueUpdateService=tb,i.JWTService=ab,i.OUTBOX_RETRY_DELAY=Na,i.OfflineAnalyticsMiddleware=yO,i.OfflineMiddleware=ja,i.OrganizationAccessLevel=Ca,i.OrganizationAccessService=nb,i.OrganizationService=cb,i.OutboxCoordinator=it,i.ProjectAccessService=db,i.ProjectAttachmentService=rb,i.ProjectFileService=ub,i.ProjectService=lb,i.RESET_ORGANIZATION_STATE=b,i.RESET_PROJECT_STATE=E,i.RESET_STATE=O,i.RateLimitingMiddleware=pO,i.SelectorBuilder=CP,i.TeamMembershipService=ob,i.TeamService=hb,i.UNKNOWN_ERROR_MESSAGE=tt,i.UserService=mb,i.VERSION_REDUCER_KEY=nt,i.VerificationCodeType=SO,i._setLatestRetryTime=lT,i.addAsset=_r,i.addAssetAttachment=on,i.addAssetAttachments=Wt,i.addAssetProcedure=Uc,i.addAssetProcedureStep=yr,i.addAssetProcedureStepFieldValues=Qd,i.addAssetProcedureStepFieldValuesAttachment=Ud,i.addAssetProcedureStepFieldValuesAttachments=ps,i.addAssetProcedureStepFieldValuesMany=xd,i.addAssetProcedureStepFields=_d,i.addAssetProcedureStepFieldsAttachment=hd,i.addAssetProcedureStepFieldsAttachments=md,i.addAssetProcedureStepFieldsMany=Md,i.addAssetProcedureSteps=pr,i.addAssetProcedureType=Qc,i.addAssetProcedureTypeAttachment=gn,i.addAssetProcedureTypeAttachments=bn,i.addAssetProcedureTypeFieldValues=bc,i.addAssetProcedureTypeFieldValuesAttachment=hc,i.addAssetProcedureTypeFieldValuesAttachments=ts,i.addAssetProcedureTypeFieldValuesMany=_c,i.addAssetProcedureTypeFields=Qn,i.addAssetProcedureTypeFieldsAttachment=Dn,i.addAssetProcedureTypeFieldsAttachments=Un,i.addAssetProcedureTypeFieldsMany=xn,i.addAssetProcedureTypes=xc,i.addAssetProcedures=cs,i.addAssetStage=tu,i.addAssetStageCompletion=Dr,i.addAssetStageCompletions=Ur,i.addAssetStages=su,i.addAssetType=so,i.addAssetTypeAttachment=hu,i.addAssetTypeAttachments=Es,i.addAssetTypeFieldValues=hl,i.addAssetTypeFieldValuesAttachment=xu,i.addAssetTypeFieldValuesAttachments=Ds,i.addAssetTypeFieldValuesMany=ml,i.addAssetTypeFields=Uu,i.addAssetTypeFieldsAttachment=bu,i.addAssetTypeFieldsAttachments=_u,i.addAssetTypeFieldsMany=Cu,i.addAssetTypeIdentifier=_l,i.addAssetTypeIdentifierValue=Cl,i.addAssetTypeIdentifierValues=Ll,i.addAssetTypeIdentifiers=Ml,i.addAssetTypeStatus=po,i.addAssetTypeStatuses=Ao,i.addAssetTypes=io,i.addAssets=Fs,i.addCategories=zo,i.addCategory=Vo,i.addConversation=nn,i.addConversations=tF,i.addDocument=nh,i.addDocumentAttachment=Ho,i.addDocumentAttachments=Wo,i.addDocuments=ch,i.addEmailDomain=Th,i.addEmailDomains=Ih,i.addForm=qm,i.addFormIdentifier=Dh,i.addFormIdentifierValue=Qh,i.addFormIdentifierValues=xh,i.addFormIdentifiers=Uh,i.addFormRevision=ui,i.addFormRevisionAttachment=hm,i.addFormRevisionAttachments=mm,i.addFormRevisions=li,i.addFormSubmission=ly,i.addFormSubmissionAttachment=Jm,i.addFormSubmissionAttachments=fi,i.addFormSubmissions=Pi,i.addForms=$m,i.addGeoImage=Py,i.addGeoImages=gy,i.addIssue=qp,i.addIssueAssociation=Uy,i.addIssueAssociations=bt,i.addIssueAttachment=Jy,i.addIssueAttachments=vi,i.addIssueComment=Pp,i.addIssueCommentAttachment=up,i.addIssueCommentAttachments=lp,i.addIssueComments=gp,i.addIssueType=Uf,i.addIssueTypeAttachment=Zp,i.addIssueTypeAttachments=Jp,i.addIssueTypeFieldValues=PA,i.addIssueTypeFieldValuesAttachment=XA,i.addIssueTypeFieldValuesAttachments=Ki,i.addIssueTypeFieldValuesMany=gA,i.addIssueTypeFields=$A,i.addIssueTypeFieldsAttachment=uA,i.addIssueTypeFieldsAttachments=lA,i.addIssueTypeFieldsMany=DA,i.addIssueTypeIdentifier=of,i.addIssueTypeIdentifierValue=bf,i.addIssueTypeIdentifierValues=_f,i.addIssueTypeIdentifiers=hf,i.addIssueTypeStatus=xf,i.addIssueTypeStatuses=eS,i.addIssueTypes=Cf,i.addIssueUpdate=na,i.addIssueUpdates=ca,i.addIssues=Di,i.addOrganization=JS,i.addOrganizationAccess=zS,i.addOrganizationAccesses=BS,i.addOrganizations=ZS,i.addProject=rI,i.addProjectAccess=yT,i.addProjectAccesses=pT,i.addProjectAttachment=MT,i.addProjectAttachments=RT,i.addProjectFile=kT,i.addProjectFiles=NT,i.addProjects=dI,i.addTeam=BI,i.addTeamMembership=II,i.addTeamMemberships=OI,i.addTeams=jI,i.addUser=ha,i.addUsers=gS,i.agentsReducer=rn,i.agentsSlice=kt,i.areArraysEqual=VO,i.assetAttachmentReducer=On,i.assetAttachmentSlice=Ht,i.assetProcedureReducer=Hc,i.assetProcedureSlice=ns,i.assetProcedureStepFieldValuesAttachmentReducer=Zd,i.assetProcedureStepFieldValuesAttachmentSlice=ys,i.assetProcedureStepFieldValuesReducer=ur,i.assetProcedureStepFieldValuesSlice=Ss,i.assetProcedureStepFieldsAttachmentReducer=Pd,i.assetProcedureStepFieldsAttachmentSlice=ls,i.assetProcedureStepFieldsReducer=qd,i.assetProcedureStepFieldsSlice=hs,i.assetProcedureStepReducer=Ir,i.assetProcedureStepSlice=Ts,i.assetProcedureTypeAttachmentReducer=Vn,i.assetProcedureTypeAttachmentSlice=Zt,i.assetProcedureTypeFieldValuesAttachmentReducer=Sc,i.assetProcedureTypeFieldValuesAttachmentSlice=es,i.assetProcedureTypeFieldValuesReducer=zc,i.assetProcedureTypeFieldValuesSlice=as,i.assetProcedureTypeFieldsAttachmentReducer=Wn,i.assetProcedureTypeFieldsAttachmentSlice=Xt,i.assetProcedureTypeFieldsReducer=cc,i.assetProcedureTypeFieldsSlice=xt,i.assetProcedureTypeReducer=cd,i.assetProcedureTypeSlice=rs,i.assetReducer=jr,i.assetSlice=Os,i.assetStageCompletionReducer=Wr,i.assetStageCompletionSlice=_s,i.assetStageReducer=du,i.assetStageSlice=Ms,i.assetTypeAttachmentReducer=Fu,i.assetTypeAttachmentSlice=vs,i.assetTypeFieldValuesAttachmentReducer=ul,i.assetTypeFieldValuesAttachmentSlice=$s,i.assetTypeFieldValuesReducer=Pl,i.assetTypeFieldValuesSlice=Ls,i.assetTypeFieldsAttachmentReducer=qu,i.assetTypeFieldsAttachmentSlice=Bs,i.assetTypeFieldsReducer=Ju,i.assetTypeFieldsSlice=qs,i.assetTypeIdentifierReducer=$l,i.assetTypeIdentifierSlice=Gs,i.assetTypeIdentifierValueReducer=Xl,i.assetTypeIdentifierValueSlice=Ns,i.assetTypeReducer=ho,i.assetTypeSlice=Hs,i.assetTypeStatusReducer=_o,i.assetTypeStatusSlice=Ks,i.assetTypeStatusSortFn=xa,i.authReducer=wo,i.authSlice=It,i.baseReducer=$P,i.baseReducers=Ra,i.blobToBase64=LO,i.categoryReducer=Go,i.categorySlice=Zs,i.clearTokens=UF,i.constructUploadedFilePayloads=CO,i.createModelAdapter=P,i.createOfflineAction=cT,i.createPayload=w,i.createSelectionAdapter=vO,i.deleteAsset=wr,i.deleteAssetAttachment=An,i.deleteAssetAttachments=Kt,i.deleteAssetProcedure=Gc,i.deleteAssetProcedureStep=Sr,i.deleteAssetProcedureStepFieldValues=ar,i.deleteAssetProcedureStepFieldValuesAttachment=Nd,i.deleteAssetProcedureStepFieldValuesAttachments=As,i.deleteAssetProcedureStepFieldValuesMany=nr,i.deleteAssetProcedureStepFields=Vd,i.deleteAssetProcedureStepFieldsAttachment=Sd,i.deleteAssetProcedureStepFieldsAttachments=Td,i.deleteAssetProcedureStepFieldsMany=zd,i.deleteAssetProcedureSteps=Tr,i.deleteAssetProcedureType=sd,i.deleteAssetProcedureTypeAttachment=vn,i.deleteAssetProcedureTypeAttachments=En,i.deleteAssetProcedureTypeFieldValues=Ec,i.deleteAssetProcedureTypeFieldValuesAttachment=fc,i.deleteAssetProcedureTypeFieldValuesAttachments=ss,i.deleteAssetProcedureTypeFieldValuesMany=Vc,i.deleteAssetProcedureTypeFields=ac,i.deleteAssetProcedureTypeFieldsAttachment=Nn,i.deleteAssetProcedureTypeFieldsAttachments=Hn,i.deleteAssetProcedureTypeFieldsMany=nc,i.deleteAssetProcedureTypes=id,i.deleteAssetProcedures=ds,i.deleteAssetStage=nu,i.deleteAssetStageCompletion=Nr,i.deleteAssetStageCompletions=Hr,i.deleteAssetStages=cu,i.deleteAssetType=co,i.deleteAssetTypeAttachment=fu,i.deleteAssetTypeAttachments=Vs,i.deleteAssetTypeFieldValues=Sl,i.deleteAssetTypeFieldValuesAttachment=al,i.deleteAssetTypeFieldValuesAttachments=Us,i.deleteAssetTypeFieldValuesMany=Tl,i.deleteAssetTypeFields=Hu,i.deleteAssetTypeFieldsAttachment=Eu,i.deleteAssetTypeFieldsAttachments=Vu,i.deleteAssetTypeFieldsMany=Wu,i.deleteAssetTypeIdentifier=Vl,i.deleteAssetTypeIdentifierValue=Wl,i.deleteAssetTypeIdentifierValues=Kl,i.deleteAssetTypeIdentifiers=zl,i.deleteAssetTypeStatus=Oo,i.deleteAssetTypeStatuses=Fo,i.deleteAssetTypes=ro,i.deleteAssets=Ps,i.deleteCategories=Uo,i.deleteCategory=Do,i.deleteConversation=aF,i.deleteConversations=nF,i.deleteDocument=oh,i.deleteDocumentAttachment=Xo,i.deleteDocumentAttachments=Qo,i.deleteDocuments=hh,i.deleteEmailDomain=bh,i.deleteEmailDomains=_h,i.deleteForm=Gm,i.deleteFormIdentifier=Nh,i.deleteFormIdentifierValue=am,i.deleteFormIdentifierValues=nm,i.deleteFormIdentifiers=Hh,i.deleteFormRevision=oi,i.deleteFormRevisionAttachment=Sm,i.deleteFormRevisionAttachments=Tm,i.deleteFormRevisions=hi,i.deleteFormSubmission=my,i.deleteFormSubmissionAttachment=ty,i.deleteFormSubmissionAttachments=Si,i.deleteFormSubmissions=gi,i.deleteForms=km,i.deleteGeoImage=My,i.deleteGeoImages=Ry,i.deleteIssue=Lp,i.deleteIssueAssociation=Cy,i.deleteIssueAssociations=_t,i.deleteIssueAttachment=tp,i.deleteIssueAttachments=Ei,i.deleteIssueComment=wp,i.deleteIssueCommentAttachment=pp,i.deleteIssueCommentAttachments=Ap,i.deleteIssueComments=vp,i.deleteIssueType=Hf,i.deleteIssueTypeAttachment=tA,i.deleteIssueTypeAttachments=sA,i.deleteIssueTypeFieldValues=wA,i.deleteIssueTypeFieldValuesAttachment=sf,i.deleteIssueTypeFieldValuesAttachments=Yi,i.deleteIssueTypeFieldValuesMany=vA,i.deleteIssueTypeFields=kA,i.deleteIssueTypeFieldsAttachment=pA,i.deleteIssueTypeFieldsAttachments=AA,i.deleteIssueTypeFieldsMany=NA,i.deleteIssueTypeIdentifier=ff,i.deleteIssueTypeIdentifierValue=Ef,i.deleteIssueTypeIdentifierValues=Vf,i.deleteIssueTypeIdentifiers=Sf,i.deleteIssueTypeStatus=nS,i.deleteIssueTypeStatuses=cS,i.deleteIssueTypes=Wf,i.deleteIssueUpdate=da,i.deleteIssueUpdates=ra,i.deleteIssues=Ui,i.deleteOrganization=xS,i.deleteOrganizationAccess=US,i.deleteOrganizationAccesses=CS,i.deleteOrganizations=eT,i.deleteProject=oI,i.deleteProjectAccess=IT,i.deleteProjectAccesses=OT,i.deleteProjectAttachment=zT,i.deleteProjectAttachments=BT,i.deleteProjectFile=KT,i.deleteProjectFiles=YT,i.deleteProjects=hI,i.deleteTeam=CI,i.deleteTeamMembership=_I,i.deleteTeamMemberships=MI,i.deleteTeams=LI,i.deleteUser=ma,i.deleteUsers=MS,i.dequeue=aO,i.discard=cO,i.documentAttachmentReducer=sh,i.documentAttachmentSlice=Qs,i.documentSlice=ei,i.documentsReducer=Ah,i.downloadFile=GO,i.downloadInMemoryFile=UO,i.emailDomainsReducer=vh,i.emailDomainsSlice=ti,i.emailRegex=XO,i.enqueue=iO,i.enqueueRequest=rT,i.extractResponseFromError=rO,i.fallbackToEmptyArray=S,i.fallbackToEmptyObject=ht,i.fileReducer=jh,i.fileSlice=ii,i.fileToBlob=Ka,i.formIdentifierReducer=Zh,i.formIdentifierSlice=ai,i.formIdentifierValueReducer=um,i.formIdentifierValueSlice=ci,i.formReducer=Nm,i.formRevisionAttachmentReducer=Pm,i.formRevisionAttachmentSlice=di,i.formRevisionReducer=zm,i.formRevisionsSlice=ri,i.formSlice=yi,i.formSubmissionAttachmentReducer=ny,i.formSubmissionAttachmentSlice=Ai,i.formSubmissionReducer=Sy,i.formSubmissionSlice=Fi,i.geoImageReducer=Vy,i.geoImageSlice=_i,i.getAssetProcedureStepSubTree=Qa,i.getAssetProcedureStepTrees=QO,i.getClientSDK=mO,i.getClientStore=at,i.getDocumentSubTree=eF,i.getDocumentTrees=xO,i.getFileIdentifier=DO,i.getFileS3Key=Gt,i.getLocalDateString=Ha,i.getLocalRelativeDateString=qO,i.getOutboxCoordinator=Xe,i.getRenamedFile=Wa,i.hashFile=et,i.initSDK=pb,i.initializeAssetAttachments=ln,i.initializeAssetProcedureStepFieldValues=Xd,i.initializeAssetProcedureStepFieldValuesAttachments=Dd,i.initializeAssetProcedureStepFields=bd,i.initializeAssetProcedureStepFieldsAttachments=od,i.initializeAssetProcedureSteps=or,i.initializeAssetProcedureTypeAttachments=Pn,i.initializeAssetProcedureTypeFieldValues=gc,i.initializeAssetProcedureTypeFieldValuesAttachments=oc,i.initializeAssetProcedureTypeFields=Xn,i.initializeAssetProcedureTypeFieldsAttachments=$n,i.initializeAssetProcedureTypes=Xc,i.initializeAssetProcedures=Dc,i.initializeAssetStageCompletions=$r,i.initializeAssetStages=Qr,i.initializeAssetTypeAttachments=ou,i.initializeAssetTypeFieldValues=ol,i.initializeAssetTypeFieldValuesAttachments=Qu,i.initializeAssetTypeFields=Du,i.initializeAssetTypeFieldsAttachments=gu,i.initializeAssetTypeIdentifierValues=Ul,i.initializeAssetTypeIdentifiers=bl,i.initializeAssetTypeStatuses=yo,i.initializeAssetTypes=xl,i.initializeAssets=br,i.initializeCategories=Eo,i.initializeConversations=an,i.initializeDocumentAttachments=No,i.initializeDocuments=ah,i.initializeEmailDomains=Sh,i.initializeFormIdentifierValues=Xh,i.initializeFormIdentifiers=$h,i.initializeFormRevisionAttachments=om,i.initializeFormRevisions=bm,i.initializeFormSubmissionAttachments=Zm,i.initializeFormSubmissions=dy,i.initializeForms=jm,i.initializeGeoImages=Iy,i.initializeIssueAssociations=By,i.initializeIssueAttachments=Zy,i.initializeIssueCommentAttachments=rp,i.initializeIssueComments=Fp,i.initializeIssueTypeAttachments=Yp,i.initializeIssueTypeFieldValues=FA,i.initializeIssueTypeFieldValuesAttachments=JA,i.initializeIssueTypeFields=qA,i.initializeIssueTypeFieldsAttachments=rA,i.initializeIssueTypeIdentifierValues=gf,i.initializeIssueTypeIdentifiers=lf,i.initializeIssueTypeStatuses=Qf,i.initializeIssueTypes=Df,i.initializeIssueUpdates=oS,i.initializeIssues=jp,i.initializeOrganizationAccesses=VS,i.initializeOrganizations=WS,i.initializeProjectAccesses=mT,i.initializeProjectAttachments=_T,i.initializeProjectFiles=CT,i.initializeProjects=aI,i.initializeTeamMemberships=TI,i.initializeTeams=zI,i.initializeUsers=OS,i.isToday=jO,i.issueAssociationReducer=Ky,i.issueAssociationSlice=Ri,i.issueAttachmentReducer=cp,i.issueAttachmentSlice=wi,i.issueCommentAttachmentReducer=Ip,i.issueCommentAttachmentSlice=zi,i.issueCommentReducer=zp,i.issueCommentSlice=ji,i.issueReducer=Wp,i.issueSlice=$i,i.issueTypeAttachmentReducer=cA,i.issueTypeAttachmentSlice=Ci,i.issueTypeFieldValuesAttachmentReducer=rf,i.issueTypeFieldValuesAttachmentSlice=Wi,i.issueTypeFieldValuesReducer=BA,i.issueTypeFieldValuesSlice=Ni,i.issueTypeFieldsAttachmentReducer=IA,i.issueTypeFieldsAttachmentSlice=Gi,i.issueTypeFieldsReducer=YA,i.issueTypeFieldsSlice=Hi,i.issueTypeIdentifierReducer=Ff,i.issueTypeIdentifierSlice=Ji,i.issueTypeIdentifierValueReducer=qf,i.issueTypeIdentifierValueSlice=Qi,i.issueTypeReducer=Jf,i.issueTypeSlice=xi,i.issueTypeStatusReducer=uS,i.issueTypeStatusSlice=ta,i.issueTypeStatusSortFn=en,i.issueUpdateReducer=TS,i.issueUpdateSlice=aa,i.logOnlyOnce=kO,i.markAsDeleted=uT,i.markForDeletion=OP,i.memoize=Ct,i.onlyUniqueHashes=JO,i.onlyUniqueOfflineIds=ZO,i.organizationAccessReducer=LS,i.organizationAccessSlice=pa,i.organizationReducer=nT,i.organizationSlice=Aa,i.outboxReducer=oT,i.outboxSlice=fa,i.overmapEnhancer=YP,i.overmapReducer=DP,i.overmapReducers=YI,i.performRequest=za,i.performRequestFromAction=nO,i.projectAccessReducer=FT,i.projectAccessSlice=Sa,i.projectAttachmentReducer=DT,i.projectAttachmentSlice=Ia,i.projectFileReducer=sI,i.projectFileSlice=Fa,i.projectReducer=mI,i.projectSlice=Pa,i.rehydratedReducer=fI,i.rehydratedSlice=ga,i.restructureCreateSelectorWithArgs=f,i.runMiddleware=fO,i.saveActiveProjectFileBounds=XT,i.selectAccessToken=CF,i.selectAccessesByUserOfProject=PP,i.selectAccessibleProjects=RP,i.selectActiveOrganizationAccess=fP,i.selectActiveProjectFileId=_P,i.selectAllDocumentAttachments=xs,i.selectAllProjectAttachments=Oa,i.selectAssetAttachmentById=Sn,i.selectAssetAttachmentMapping=fn,i.selectAssetAttachments=Yt,i.selectAssetAttachmentsByIds=Tn,i.selectAssetById=zr,i.selectAssetProcedureById=Yc,i.selectAssetProcedureStepById=Or,i.selectAssetProcedureStepFieldValues=ct,i.selectAssetProcedureStepFieldValuesAttachmentById=Wd,i.selectAssetProcedureStepFieldValuesAttachments=fs,i.selectAssetProcedureStepFieldValuesAttachmentsByIds=Kd,i.selectAssetProcedureStepFieldValuesAttachmentsMapping=Hd,i.selectAssetProcedureStepFieldValuesById=dr,i.selectAssetProcedureStepFieldValuesByIds=rr,i.selectAssetProcedureStepFieldValuesMapping=cr,i.selectAssetProcedureStepFieldValuesOfAsset=IF,i.selectAssetProcedureStepFieldValuesOfAssetProcedure=OF,i.selectAssetProcedureStepFieldValuesOfAssetProcedureStep=FF,i.selectAssetProcedureStepFields=At,i.selectAssetProcedureStepFieldsAttachmentById=Od,i.selectAssetProcedureStepFieldsAttachments=os,i.selectAssetProcedureStepFieldsAttachmentsByIds=Fd,i.selectAssetProcedureStepFieldsAttachmentsMapping=Id,i.selectAssetProcedureStepFieldsById=Bd,i.selectAssetProcedureStepFieldsByIds=jd,i.selectAssetProcedureStepFieldsMapping=ms,i.selectAssetProcedureStepFieldsOfAssetProcedureStep=fF,i.selectAssetProcedureStepMapping=ft,i.selectAssetProcedureSteps=Is,i.selectAssetProcedureStepsByIds=Fr,i.selectAssetProcedureStepsMappingOfAssetProcedureType=PF,i.selectAssetProcedureStepsOfAssetProcedureType=gF,i.selectAssetProcedureTypeAttachmentById=Bn,i.selectAssetProcedureTypeAttachmentMapping=zn,i.selectAssetProcedureTypeAttachments=Jt,i.selectAssetProcedureTypeAttachmentsByIds=jn,i.selectAssetProcedureTypeById=rd,i.selectAssetProcedureTypeFieldValues=yt,i.selectAssetProcedureTypeFieldValuesAttachmentById=Ic,i.selectAssetProcedureTypeFieldValuesAttachments=is,i.selectAssetProcedureTypeFieldValuesAttachmentsByIds=Oc,i.selectAssetProcedureTypeFieldValuesAttachmentsMapping=Tc,i.selectAssetProcedureTypeFieldValuesById=jc,i.selectAssetProcedureTypeFieldValuesByIds=qc,i.selectAssetProcedureTypeFieldValuesMapping=Bc,i.selectAssetProcedureTypeFieldValuesOfAsset=hF,i.selectAssetProcedureTypeFields=mt,i.selectAssetProcedureTypeFieldsAttachmentById=Yn,i.selectAssetProcedureTypeFieldsAttachments=Qt,i.selectAssetProcedureTypeFieldsAttachmentsByIds=Zn,i.selectAssetProcedureTypeFieldsAttachmentsMapping=Kn,i.selectAssetProcedureTypeFieldsById=rc,i.selectAssetProcedureTypeFieldsByIds=uc,i.selectAssetProcedureTypeFieldsMapping=dc,i.selectAssetProcedureTypeFieldsOfAssetProcedureType=lF,i.selectAssetProcedureTypes=us,i.selectAssetProcedureTypesByIds=ud,i.selectAssetProcedureTypesMapping=dd,i.selectAssetProcedureTypesOfOrganization=pF,i.selectAssetProcedures=pt,i.selectAssetProceduresByIds=Zc,i.selectAssetProceduresMapping=Wc,i.selectAssetProceduresOfAssetProcedureType=Kc,i.selectAssetProceduresOfAssetType=yF,i.selectAssetStageById=ru,i.selectAssetStageCompletionById=Zr,i.selectAssetStageCompletionMapping=Kr,i.selectAssetStageCompletions=Yr,i.selectAssetStageCompletionsByIds=Jr,i.selectAssetStages=ws,i.selectAssetStagesByIds=uu,i.selectAssetStagesMappingOfAssetProcedureType=_F,i.selectAssetStagesOfAssetProcedureType=MF,i.selectAssetTypeAttachmentById=Tu,i.selectAssetTypeAttachmentMapping=Su,i.selectAssetTypeAttachments=zs,i.selectAssetTypeAttachmentsByIds=Iu,i.selectAssetTypeById=lo,i.selectAssetTypeFieldValues=St,i.selectAssetTypeFieldValuesAttachmentById=cl,i.selectAssetTypeFieldValuesAttachments=Cs,i.selectAssetTypeFieldValuesAttachmentsByIds=dl,i.selectAssetTypeFieldValuesAttachmentsMapping=nl,i.selectAssetTypeFieldValuesById=Ol,i.selectAssetTypeFieldValuesByIds=Fl,i.selectAssetTypeFieldValuesMapping=Il,i.selectAssetTypeFieldValuesOfAsset=EF,i.selectAssetTypeFields=dt,i.selectAssetTypeFieldsAttachmentById=Bu,i.selectAssetTypeFieldsAttachments=js,i.selectAssetTypeFieldsAttachmentsByIds=ju,i.selectAssetTypeFieldsAttachmentsMapping=zu,i.selectAssetTypeFieldsById=Yu,i.selectAssetTypeFieldsByIds=Zu,i.selectAssetTypeFieldsMapping=Ku,i.selectAssetTypeFieldsOfAssetType=wF,i.selectAssetTypeIdentifierById=jl,i.selectAssetTypeIdentifierMapping=Bl,i.selectAssetTypeIdentifierValueById=Zl,i.selectAssetTypeIdentifierValueMapping=Yl,i.selectAssetTypeIdentifierValues=Tt,i.selectAssetTypeIdentifierValuesByIds=Jl,i.selectAssetTypeIdentifierValuesOfAsset=BF,i.selectAssetTypeIdentifierValuesOfIdentifier=jF,i.selectAssetTypeIdentifiers=ks,i.selectAssetTypeIdentifiersByIds=ql,i.selectAssetTypeIdentifiersOfAssetType=zF,i.selectAssetTypeStatusById=go,i.selectAssetTypeStatusMapping=Po,i.selectAssetTypeStatuses=Ys,i.selectAssetTypeStatusesByIds=bo,i.selectAssetTypeStatusesOfAssetType=$F,i.selectAssetTypeValuesOfAssetType=VF,i.selectAssetTypes=Ws,i.selectAssetTypesByIds=oo,i.selectAssetTypesMapping=uo,i.selectAssetTypesOfOrganization=qF,i.selectAssets=gs,i.selectAssetsByIds=Br,i.selectAssetsMapping=Vr,i.selectAssetsOfAssetType=bs,i.selectAttachmentsOfAsset=In,i.selectAttachmentsOfAssetProcedureStepFieldValues=Yd,i.selectAttachmentsOfAssetProcedureStepFields=AF,i.selectAttachmentsOfAssetProcedureType=rF,i.selectAttachmentsOfAssetProcedureTypeFieldValues=Fc,i.selectAttachmentsOfAssetProcedureTypeFields=uF,i.selectAttachmentsOfAssetType=Ou,i.selectAttachmentsOfAssetTypeFieldValues=rl,i.selectAttachmentsOfAssetTypeFields=RF,i.selectAttachmentsOfDocument=kF,i.selectAttachmentsOfFormRevision=XF,i.selectAttachmentsOfFormSubmission=ay,i.selectAttachmentsOfIssue=ip,i.selectAttachmentsOfIssueComment=tP,i.selectAttachmentsOfIssueType=aP,i.selectAttachmentsOfIssueTypeFieldValues=df,i.selectAttachmentsOfIssueTypeFields=nP,i.selectAttachmentsOfProject=bP,i.selectCategories=Js,i.selectCategoriesByIds=Lo,i.selectCategoriesOfProject=GF,i.selectCategoryById=Xs,i.selectCategoryMapping=Co,i.selectCommentsOfIssue=sP,i.selectConversation=dF,i.selectConversationMapping=Nt,i.selectConversations=cF,i.selectCurrentUser=wS,i.selectDeletedRequests=TP,i.selectDescendantsOfAssetProcedureStep=Pr,i.selectDocumentAttachmentById=eh,i.selectDocumentAttachmentMapping=xo,i.selectDocumentAttachmentsByIds=th,i.selectDocumentById=yh,i.selectDocuments=Ot,i.selectDocumentsByIds=ph,i.selectDocumentsMapping=mh,i.selectEmailDomainById=Rh,i.selectEmailDomains=si,i.selectEmailDomainsAsMapping=Mh,i.selectEmailDomainsByIds=wh,i.selectEmailDomainsOfOrganization=WF,i.selectFieldValuesOfAssetProcedure=mF,i.selectFormById=Wm,i.selectFormIdentifierById=Kh,i.selectFormIdentifierMapping=Wh,i.selectFormIdentifierValueById=dm,i.selectFormIdentifierValueMapping=cm,i.selectFormIdentifierValues=Ft,i.selectFormIdentifierValuesByIds=rm,i.selectFormIdentifierValuesOfFormSubmission=ZF,i.selectFormIdentifierValuesOfIdentifier=JF,i.selectFormIdentifiers=ni,i.selectFormIdentifiersByIds=Yh,i.selectFormIdentifiersOfForm=YF,i.selectFormMapping=Hm,i.selectFormRevisionAttachmentById=Om,i.selectFormRevisionAttachments=Im,i.selectFormRevisionAttachmentsByIds=Fm,i.selectFormRevisionAttachmentsMapping=Pt,i.selectFormRevisionById=vm,i.selectFormRevisionMapping=mi,i.selectFormRevisions=gt,i.selectFormRevisionsByIds=Em,i.selectFormRevisionsOfForm=Vm,i.selectFormSubmissionAttachemntsByIds=Oi,i.selectFormSubmissionAttachmentById=sy,i.selectFormSubmissionAttachments=Ii,i.selectFormSubmissionAttachmentsByIds=iy,i.selectFormSubmissionAttachmentsMapping=Ti,i.selectFormSubmissionById=py,i.selectFormSubmissions=yy,i.selectFormSubmissionsByIds=Ay,i.selectFormSubmissionsMapping=bi,i.selectFormSubmissionsOfForm=fy,i.selectForms=pi,i.selectFormsByIds=Km,i.selectFormsOfOrganization=xF,i.selectGeoImageById=vy,i.selectGeoImageMapping=wy,i.selectGeoImages=Mi,i.selectGeoImagesByIds=Ey,i.selectGeoImagesOfProject=eP,i.selectIsImportingProjectFile=MP,i.selectIsLoggedIn=LF,i.selectIssueAssociationById=Gy,i.selectIssueAssociationMapping=rt,i.selectIssueAssociations=Ly,i.selectIssueAssociationsByIds=ky,i.selectIssueAssociationsOfAsset=Wy,i.selectIssueAssociationsOfIssue=Hy,i.selectIssueAssociationsToIssue=Ny,i.selectIssueAttachmentById=ap,i.selectIssueAttachmentMapping=sp,i.selectIssueAttachments=Vi,i.selectIssueAttachmentsByIds=np,i.selectIssueById=kp,i.selectIssueCommentAttachmentById=Sp,i.selectIssueCommentAttachmentMapping=fp,i.selectIssueCommentAttachments=Bi,i.selectIssueCommentAttachmentsByIds=Tp,i.selectIssueCommentById=Ep,i.selectIssueCommentMapping=qi,i.selectIssueCommentsByIds=Vp,i.selectIssueMapping=Gp,i.selectIssueTypeAttachmentById=aA,i.selectIssueTypeAttachmentMapping=iA,i.selectIssueTypeAttachments=Li,i.selectIssueTypeAttachmentsByIds=nA,i.selectIssueTypeById=Yf,i.selectIssueTypeFieldValues=Rt,i.selectIssueTypeFieldValuesAttachmentById=nf,i.selectIssueTypeFieldValuesAttachments=Zi,i.selectIssueTypeFieldValuesAttachmentsByIds=cf,i.selectIssueTypeFieldValuesAttachmentsMapping=af,i.selectIssueTypeFieldValuesById=VA,i.selectIssueTypeFieldValuesByIds=zA,i.selectIssueTypeFieldValuesMapping=EA,i.selectIssueTypeFieldValuesOfIssue=cP,i.selectIssueTypeFields=ut,i.selectIssueTypeFieldsAttachmentById=SA,i.selectIssueTypeFieldsAttachments=ki,i.selectIssueTypeFieldsAttachmentsByIds=TA,i.selectIssueTypeFieldsAttachmentsMapping=fA,i.selectIssueTypeFieldsById=WA,i.selectIssueTypeFieldsByIds=KA,i.selectIssueTypeFieldsMapping=HA,i.selectIssueTypeFieldsOfIssueType=dP,i.selectIssueTypeIdentifierById=If,i.selectIssueTypeIdentifierMapping=Tf,i.selectIssueTypeIdentifierValueById=Bf,i.selectIssueTypeIdentifierValueMapping=zf,i.selectIssueTypeIdentifierValues=wt,i.selectIssueTypeIdentifierValuesByIds=jf,i.selectIssueTypeIdentifierValuesOfIdentifier=hP,i.selectIssueTypeIdentifierValuesOfIssue=oP,i.selectIssueTypeIdentifiers=Xi,i.selectIssueTypeIdentifiersByIds=Of,i.selectIssueTypeIdentifiersOfIssueType=lP,i.selectIssueTypeMapping=Kf,i.selectIssueTypeStatusById=ia,i.selectIssueTypeStatusMapping=dS,i.selectIssueTypeStatuses=sa,i.selectIssueTypeStatusesByIds=rS,i.selectIssueTypeStatusesOfIssueType=yP,i.selectIssueTypeValuesOfIssueType=uP,i.selectIssueTypes=ea,i.selectIssueTypesByIds=Zf,i.selectIssueTypesOfOrganization=mP,i.selectIssueUpdateById=AS,i.selectIssueUpdateMapping=ua,i.selectIssueUpdates=la,i.selectIssueUpdatesByIds=fS,i.selectIssueUpdatesOfIssue=SS,i.selectIssues=Mt,i.selectIssuesByIds=Np,i.selectIssuesOfIssueType=Hp,i.selectIssuesOfProject=iP,i.selectLatestAssetProcedureStepFieldsOfAssetProcedureStep=SF,i.selectLatestAssetProcedureTypeFieldsOfAssetProcedureType=oF,i.selectLatestAssetTypeFieldsOfAssetType=vF,i.selectLatestFieldsByAssetProcedureStep=TF,i.selectLatestFormRevisionOfForm=QF,i.selectLatestIssueTypeFieldsOfIssueType=rP,i.selectLatestRetryTime=IP,i.selectMembershipsByUserOfTeam=zP,i.selectNumberOfAssetsOfAssetType=bF,i.selectOrganizationAccessById=GS,i.selectOrganizationAccessMapping=Vt,i.selectOrganizationAccessUserMapping=NS,i.selectOrganizationAccessesByIds=kS,i.selectOrganizationById=iT,i.selectOrganizationDocuments=HF,i.selectOrganizations=sT,i.selectOrganizationsByIds=aT,i.selectOrganizationsMapping=tT,i.selectProjectAccessById=PT,i.selectProjectAccessMapping=Ta,i.selectProjectAccesses=lt,i.selectProjectAccessesByIds=gT,i.selectProjectAccessesOfProject=FP,i.selectProjectAttachmentById=qT,i.selectProjectAttachmentMapping=jT,i.selectProjectAttachmentsByIds=$T,i.selectProjectById=pI,i.selectProjectDocuments=NF,i.selectProjectFileById=eI,i.selectProjectFileMapping=QT,i.selectProjectFiles=xT,i.selectProjectFilesByIds=tI,i.selectProjectMapping=yI,i.selectProjects=zt,i.selectProjectsByIds=AI,i.selectProjectsOfOrganization=wP,i.selectRehydrated=VP,i.selectStageMapping=Rs,i.selectTeamById=kI,i.selectTeamMembershipById=vI,i.selectTeamMemberships=Bt,i.selectTeamMembershipsByIds=EI,i.selectTeamMembershipsMapping=wI,i.selectTeams=Ma,i.selectTeamsByIds=NI,i.selectTeamsMapping=GI,i.selectTeamsOfOrganization=jP,i.selectUploadUrl=Bh,i.selectUserById=Et,i.selectUsers=vt,i.selectUsersByIds=vS,i.selectUsersMapping=ya,i.selectUsersOfOrganization=SP,i.selectUsersOfProject=gP,i.selectUsersOfTeam=BP,i.setActiveProjectFileId=JT,i.setAsset=vr,i.setAssetAttachment=hn,i.setAssetAttachments=mn,i.setAssetProcedure=kc,i.setAssetProcedureStep=hr,i.setAssetProcedureStepFieldValues=er,i.setAssetProcedureStepFieldValuesAttachment=Cd,i.setAssetProcedureStepFieldValuesAttachments=Ld,i.setAssetProcedureStepFieldValuesMany=tr,i.setAssetProcedureStepFields=Rd,i.setAssetProcedureStepFieldsAttachment=yd,i.setAssetProcedureStepFieldsAttachments=pd,i.setAssetProcedureStepFieldsMany=wd,i.setAssetProcedureSteps=mr,i.setAssetProcedureType=ad,i.setAssetProcedureTypeAttachment=_n,i.setAssetProcedureTypeAttachments=Mn,i.setAssetProcedureTypeFieldValues=Mc,i.setAssetProcedureTypeFieldValuesAttachment=mc,i.setAssetProcedureTypeFieldValuesAttachments=yc,i.setAssetProcedureTypeFieldValuesMany=Rc,i.setAssetProcedureTypeFields=ec,i.setAssetProcedureTypeFieldsAttachment=Cn,i.setAssetProcedureTypeFieldsAttachments=Ln,i.setAssetProcedureTypeFieldsMany=tc,i.setAssetProcedureTypes=nd,i.setAssetProcedures=Nc,i.setAssetStage=xr,i.setAssetStageCompletion=Cr,i.setAssetStageCompletions=Lr,i.setAssetStages=eu,i.setAssetType=eo,i.setAssetTypeAttachment=mu,i.setAssetTypeAttachments=yu,i.setAssetTypeFieldValues=yl,i.setAssetTypeFieldValuesAttachment=el,i.setAssetTypeFieldValuesAttachments=tl,i.setAssetTypeFieldValuesMany=pl,i.setAssetTypeFields=Lu,i.setAssetTypeFieldsAttachment=Mu,i.setAssetTypeFieldsAttachments=Ru,i.setAssetTypeFieldsMany=Gu,i.setAssetTypeIdentifier=Rl,i.setAssetTypeIdentifierValue=Gl,i.setAssetTypeIdentifierValues=kl,i.setAssetTypeIdentifiers=wl,i.setAssetTypeStatus=fo,i.setAssetTypeStatuses=So,i.setAssetTypes=to,i.setAssets=Er,i.setCategories=jo,i.setCategory=Bo,i.setClientSDK=hO,i.setClientStore=lO,i.setConversation=cn,i.setConversations=sF,i.setCurrentUser=pP,i.setDocument=dh,i.setDocumentAttachment=Ko,i.setDocumentAttachments=Yo,i.setDocuments=rh,i.setEmailDomain=Oh,i.setEmailDomains=Fh,i.setForm=Dm,i.setFormIdentifier=Ch,i.setFormIdentifierValue=em,i.setFormIdentifierValues=tm,i.setFormIdentifiers=Lh,i.setFormRevision=_m,i.setFormRevisionAttachment=ym,i.setFormRevisionAttachments=pm,i.setFormRevisions=Mm,i.setFormSubmission=ry,i.setFormSubmissionAttachment=Xm,i.setFormSubmissionAttachments=Qm,i.setFormSubmissions=uy,i.setForms=Um,i.setGeoImage=Oy,i.setGeoImages=Fy,i.setIsImportingProjectFile=ZT,i.setIssue=$p,i.setIssueAssociation=qy,i.setIssueAssociations=jy,i.setIssueAttachment=Xy,i.setIssueAttachments=Qy,i.setIssueComment=bp,i.setIssueCommentAttachment=op,i.setIssueCommentAttachments=hp,i.setIssueComments=_p,i.setIssueType=Lf,i.setIssueTypeAttachment=Xp,i.setIssueTypeAttachments=Qp,i.setIssueTypeFieldValues=bA,i.setIssueTypeFieldValuesAttachment=QA,i.setIssueTypeFieldValuesAttachments=xA,i.setIssueTypeFieldValuesMany=_A,i.setIssueTypeFields=UA,i.setIssueTypeFieldsAttachment=oA,i.setIssueTypeFieldsAttachments=hA,i.setIssueTypeFieldsMany=CA,i.setIssueTypeIdentifier=mf,i.setIssueTypeIdentifierValue=Mf,i.setIssueTypeIdentifierValues=Rf,i.setIssueTypeIdentifiers=yf,i.setIssueTypeStatus=tS,i.setIssueTypeStatuses=sS,i.setIssueTypes=Gf,i.setIssueUpdate=hS,i.setIssueUpdates=mS,i.setIssues=Dp,i.setLoggedIn=Ro,i.setOrganization=YS,i.setOrganizationAccess=jS,i.setOrganizationAccesses=qS,i.setOrganizations=KS,i.setProfilePicture=AP,i.setProject=cI,i.setProjectAccess=AT,i.setProjectAccesses=fT,i.setProjectAttachment=wT,i.setProjectAttachments=vT,i.setProjectFile=LT,i.setProjectFiles=GT,i.setProjects=nI,i.setRehydrated=EP,i.setTeam=qI,i.setTeamMembership=FI,i.setTeamMemberships=PI,i.setTeams=$I,i.setTokens=DF,i.setUploadUrl=zh,i.setUser=PS,i.setUsers=FS,i.shallowEqual=EO,i.slugify=KO,i.spacesToDashesLower=WO,i.teamMembershipReducer=RI,i.teamMembershipSlice=ba,i.teamReducer=HI,i.teamSlice=_a,i.toFileNameSafeString=HO,i.toUuidArray=Ja,i.toUuidIdRecord=NO,i.truncate=YO,i.updateAsset=Mr,i.updateAssetAttachment=yn,i.updateAssetAttachments=pn,i.updateAssetProcedure=Cc,i.updateAssetProcedureStep=Ar,i.updateAssetProcedureStepFieldValues=sr,i.updateAssetProcedureStepFieldValuesAttachment=Gd,i.updateAssetProcedureStepFieldValuesAttachments=kd,i.updateAssetProcedureStepFieldValuesMany=ir,i.updateAssetProcedureStepFields=vd,i.updateAssetProcedureStepFieldsAttachment=Ad,i.updateAssetProcedureStepFieldsAttachments=fd,i.updateAssetProcedureStepFieldsMany=Ed,i.updateAssetProcedureSteps=fr,i.updateAssetProcedureType=ed,i.updateAssetProcedureTypeAttachment=Rn,i.updateAssetProcedureTypeAttachments=wn,i.updateAssetProcedureTypeFieldValues=wc,i.updateAssetProcedureTypeFieldValuesAttachment=pc,i.updateAssetProcedureTypeFieldValuesAttachments=Ac,i.updateAssetProcedureTypeFieldValuesMany=vc,i.updateAssetProcedureTypeFields=sc,i.updateAssetProcedureTypeFieldsAttachment=Gn,i.updateAssetProcedureTypeFieldsAttachments=kn,i.updateAssetProcedureTypeFieldsMany=ic,i.updateAssetProcedureTypes=td,i.updateAssetProcedures=Lc,i.updateAssetStage=iu,i.updateAssetStageCompletion=Gr,i.updateAssetStageCompletions=kr,i.updateAssetStages=au,i.updateAssetType=ao,i.updateAssetTypeAttachment=pu,i.updateAssetTypeAttachments=Au,i.updateAssetTypeFieldValues=Al,i.updateAssetTypeFieldValuesAttachment=sl,i.updateAssetTypeFieldValuesAttachments=il,i.updateAssetTypeFieldValuesMany=fl,i.updateAssetTypeFields=ku,i.updateAssetTypeFieldsAttachment=wu,i.updateAssetTypeFieldsAttachments=vu,i.updateAssetTypeFieldsMany=Nu,i.updateAssetTypeIdentifier=vl,i.updateAssetTypeIdentifierValue=Nl,i.updateAssetTypeIdentifierValues=Hl,i.updateAssetTypeIdentifiers=El,i.updateAssetTypeStatus=To,i.updateAssetTypeStatuses=Io,i.updateAssetTypes=no,i.updateAssets=Rr,i.updateCategories=$o,i.updateCategory=qo,i.updateConversation=dn,i.updateConversations=iF,i.updateDocument=uh,i.updateDocumentAttachment=Zo,i.updateDocumentAttachments=Jo,i.updateDocuments=lh,i.updateEmailDomain=Ph,i.updateEmailDomains=gh,i.updateForm=Cm,i.updateFormIdentifier=Gh,i.updateFormIdentifierValue=sm,i.updateFormIdentifierValues=im,i.updateFormIdentifiers=kh,i.updateFormRevision=Rm,i.updateFormRevisionAttachment=Am,i.updateFormRevisionAttachments=fm,i.updateFormRevisions=wm,i.updateFormSubmission=oy,i.updateFormSubmissionAttachment=xm,i.updateFormSubmissionAttachments=ey,i.updateFormSubmissions=hy,i.updateForms=Lm,i.updateGeoImage=by,i.updateGeoImages=_y,i.updateIssue=Up,i.updateIssueAssociation=$y,i.updateIssueAssociations=Dy,i.updateIssueAttachment=xy,i.updateIssueAttachments=ep,i.updateIssueComment=Mp,i.updateIssueCommentAttachment=mp,i.updateIssueCommentAttachments=yp,i.updateIssueComments=Rp,i.updateIssueType=kf,i.updateIssueTypeAttachment=xp,i.updateIssueTypeAttachments=eA,i.updateIssueTypeFieldValues=MA,i.updateIssueTypeFieldValuesAttachment=ef,i.updateIssueTypeFieldValuesAttachments=tf,i.updateIssueTypeFieldValuesMany=RA,i.updateIssueTypeFields=LA,i.updateIssueTypeFieldsAttachment=mA,i.updateIssueTypeFieldsAttachments=yA,i.updateIssueTypeFieldsMany=GA,i.updateIssueTypeIdentifier=pf,i.updateIssueTypeIdentifierValue=wf,i.updateIssueTypeIdentifierValues=vf,i.updateIssueTypeIdentifiers=Af,i.updateIssueTypeStatus=iS,i.updateIssueTypeStatuses=aS,i.updateIssueTypes=Nf,i.updateIssueUpdate=yS,i.updateIssueUpdates=pS,i.updateIssues=Cp,i.updateOrganization=QS,i.updateOrganizationAccess=$S,i.updateOrganizationAccesses=DS,i.updateOrganizations=XS,i.updateProject=lI,i.updateProjectAccess=ST,i.updateProjectAccesses=TT,i.updateProjectAttachment=ET,i.updateProjectAttachments=VT,i.updateProjectFile=HT,i.updateProjectFiles=WT,i.updateProjects=uI,i.updateTeam=DI,i.updateTeamMembership=gI,i.updateTeamMemberships=bI,i.updateTeams=UI,i.updateUser=_S,i.updateUsers=bS,i.useSelectorBuilder=UP,i.userReducer=RS,i.userSlice=oa,i.uuidObj=F,i.versioningReducer=KI,i.versioningSlice=WI,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});