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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,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,U){typeof exports=="object"&&typeof module<"u"?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"],U):(i=typeof globalThis<"u"?globalThis:i||self,U(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,o,Qe,xe,OO,Dn,ot,FO,PO,$n,gO,bO,Tb,Ib,_O,MO,RO){"use strict";var fb=Object.defineProperty;var Sb=(i,U,o)=>U in i?fb(i,U,{enumerable:!0,configurable:!0,writable:!0,value:o}):i[U]=o;var m=(i,U,o)=>Sb(i,typeof U!="symbol"?U+"":U,o);var TO;const Un=Object.freeze([]),Cn=Object.freeze({});var Ln=(t=>(t[t.GUEST=0]="GUEST",t[t.BASIC=2]="BASIC",t[t.ADMIN=4]="ADMIN",t))(Ln||{}),f=(t=>(t.GET="GET",t.POST="POST",t.PATCH="PATCH",t.PUT="PUT",t.DELETE="DELETE",t))(f||{}),kn=(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))(kn||{}),Nn=(t=>(t.Issue="issue",t.Asset="asset",t.AssetType="asset_type",t.Project="project",t.Document="document",t))(Nn||{}),Dt=(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))(Dt||{}),q=(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))(q||{}),Gn=(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))(Gn||{});const wO=Dt.MEDIUM,Hn=6e4;function _(t){return{addOne:(h,y)=>{const A=t(y.payload);h.instances[A]=y.payload},addMany:(h,y)=>{for(const A of y.payload){const p=t(A);h.instances[p]=A}},setOne:(h,y)=>{const A=t(y.payload);h.instances[A]=y.payload},setMany:(h,y)=>{for(const A of y.payload){const p=t(A);h.instances[p]=A}},updateOne:(h,y)=>{const A=t(y.payload);h.instances[A]=y.payload},updateMany:(h,y)=>{for(const A of y.payload){const p=t(A);h.instances[p]=A}},deleteOne:(h,y)=>{delete h.instances[y.payload]},deleteMany:(h,y)=>{for(const A of y.payload)delete h.instances[A]},initialize:(h,y)=>{h.instances={};const A=new Set;for(const p of y.payload){const S=t(p);A.add(S),h.instances[S]=p}A.size!==y.payload.length&&console.warn("duplicate ids detected when initializing model instances.")}}}function vO(){return{initializeSelection:(u,d)=>{u.selection=Array.from(new Set(d.payload))},selectOne:(u,d)=>{new Set(u.selection).has(d.payload)||u.selection.push(d.payload)},selectMany:(u,d)=>{const h=new Set(u.selection);for(const y of d.payload)h.has(y)||h.add(y);u.selection=Array.from(h)},unselectOne:(u,d)=>{const h=new Set(u.selection);h.has(d.payload)&&(h.delete(d.payload),u.selection=Array.from(h))},unselectMany:(u,d)=>{const h=new Set(u.selection);for(const y of d.payload)h.has(y)&&h.delete(y);u.selection=Array.from(h)},toggleOne:(u,d)=>{const h=new Set(u.selection);h.has(d.payload)?h.delete(d.payload):h.add(d.payload),u.selection=Array.from(h)},toggleMany:(u,d)=>{const h=new Set(u.selection);for(const y of d.payload)h.has(y)?h.delete(y):h.add(y);u.selection=Array.from(h)},getInitialState:u=>({...u,selection:[]})}}const at="versioning",g=o.createAction("RESET"),B=o.createAction("RESET_PROJECT_STATE"),M=o.createAction("RESET_ORGANIZATION_STATE");TO=Symbol.toStringTag;class $t{constructor(){m(this,TO,"Promise");m(this,"_promise");m(this,"_resolve");m(this,"_reject");m(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 VO(t,s){if(t===s)return!0;if(typeof t!=typeof s)return!1;const e=Object.keys(t),n=Object.keys(s),a=e.length;if(a!==n.length)return!1;for(let c=0;c<a;c++){const r=e[c];if(!Object.prototype.hasOwnProperty.call(s,r)||t[r]!==s[r])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 zO(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 I=t=>t.length===0?Un:t,ht=t=>Object.keys(t).length===0?Cn:t,Wn=Ct(t=>{if(!t)return"";const s=new Date(t),e=s.getFullYear()===Lt.getFullYear(),n={day:"numeric",month:"short"};return e||(n.year="numeric"),s.toLocaleDateString([],n)}),EO=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 n=Math.round((new Date(t).getTime()-Lt.getTime())/BO);return n<s||n>e?Wn(t):EO.format(n,"days")});function DO(t){return new Uint8Array(t).reduce((e,n)=>e+n.toString(16).padStart(2,"0"),"")}const kt=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 n=new FileReader;n.onload=()=>{const a=n.result;if(!a){e(new Error("FileReader did not return a valid ArrayBuffer."));return}crypto.subtle.digest("SHA-1",a).then(c=>{const r=DO(c);s(r)})},n.readAsArrayBuffer(t)})}function $O(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 Kn(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 n=await et(e);s[n]={sha1:n,extension:e.name.split(".").pop()||"",file_type:e.type,size:e.size}}return Object.values(s)},Yn=async t=>(await fetch(t)).blob(),LO=t=>new Promise((s,e)=>{const n=new FileReader;n.onloadend=()=>{var a;s(((a=n.result)==null?void 0:a.toString())||"")},n.readAsDataURL(t)});function kO(t){const s=new Blob([t]);OO.saveAs(s,t.name)}const Zn={};function NO(t,s,e,...n){const a=Zn[t];let c=!1;a?a[s]||(a[s]=!0,c=!0):(Zn[t]={[s]:!0},c=!0),c&&console[e](...n)}const Jn=["created_at","updated_at","index","revision"];function b(t){return{...t,uuid:xe.v4()}}function GO(t){const s={};for(const e of t)s[e.uuid]=e;return s}function Xn(t){return t.map(({uuid:s})=>s)}function HO(t,s=void 0,e=255){let n=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 a=s?s.length:0;return n.length+a>e&&(n=n.slice(0,e-a)+(s||"")),n}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 T=t=>s=>e=>t(e,s);function ZO(t,s,e){return e.findIndex(n=>n.uuid===t.uuid)===s}function JO(t,s,e){return e.findIndex(n=>n.file_sha1===t.file_sha1)===s}const XO=/^.+@.+\..+$/;function z(t){const s={...t};for(const e of[...Jn,"created_by"])e in s&&delete s[e];return s}const Qn=t=>{const s=t.toSorted((e,n)=>e.order-n.order);return Dn(s,{id:e=>e.uuid,parentId:e=>e.parent,includeEmptyChildrenArray:!0,valueKey:!1})},QO=t=>{const{roots:s}=Qn(t);return s.map(e=>new ot.Tree(e))},xn=(t,s)=>{const{nodes:e}=Qn(s),n=e.get(t);if(!n)throw new Error(`Node with uuid ${t} does not exist in asset procedure step tree.`);return new ot.Tree(n)},ea=(t,s)=>t.type!==s.type?t.type-s.type:t.order-s.order,ta=(t,s)=>t.type!==s.type?t.type-s.type:t.order-s.order,sa=t=>Dn(t,{id:s=>s.uuid,parentId:s=>s.parent_document,includeEmptyChildrenArray:!0,valueKey:!1}),xO=t=>{const{roots:s}=sa(t);return s.map(e=>new ot.Tree(e))},eF=(t,s)=>{const{nodes:e}=sa(s),n=e.get(t);if(!n)throw new Error(`Node with uuid ${t} does not exist in document tree.`);return new ot.Tree(n)},C=_(t=>t.uuid),ia={instances:{}},Nt=o.createSlice({name:"agents",initialState:ia,extraReducers:t=>t.addMatcher(o.isAnyOf(g,B,M),s=>Object.assign(s,ia)),reducers:{initializeConversations:C.initialize,addConversation:C.addOne,addConversations:C.addMany,setConversation:C.setOne,setConversations:C.setMany,updateConversation:C.updateOne,updateConversations:C.updateMany,deleteConversation:C.deleteOne,deleteConversations:C.deleteMany}}),{initializeConversations:na,addConversation:aa,addConversations:tF,setConversation:ca,setConversations:sF,updateConversation:da,updateConversations:iF,deleteConversation:nF,deleteConversations:aF}=Nt.actions,Gt=t=>t.agentsReducer.instances,cF=o.createSelector([Gt],t=>Object.values(t)),dF=T(o.createSelector([Gt,(t,s)=>s],(t,s)=>t[s])),ra=Nt.reducer,L=_(t=>t.uuid),ua={instances:{}},Ht=o.createSlice({name:"assetAttachments",initialState:ua,extraReducers:t=>t.addMatcher(o.isAnyOf(g,B,M),s=>Object.assign(s,ua)),reducers:{initializeAssetAttachments:L.initialize,addAssetAttachment:L.addOne,addAssetAttachments:L.addMany,setAssetAttachment:L.setOne,setAssetAttachments:L.setMany,updateAssetAttachment:L.updateOne,updateAssetAttachments:L.updateMany,deleteAssetAttachment:L.deleteOne,deleteAssetAttachments:L.deleteMany}}),{initializeAssetAttachments:la,addAssetAttachment:oa,addAssetAttachments:Wt,setAssetAttachment:ha,setAssetAttachments:ma,updateAssetAttachment:ya,updateAssetAttachments:pa,deleteAssetAttachment:Aa,deleteAssetAttachments:Kt}=Ht.actions,fa=t=>t.assetAttachmentReducer.instances,Yt=o.createSelector([fa],t=>Object.values(t)),Sa=t=>s=>s.assetAttachmentReducer.instances[t],Ta=T(o.createSelector([Yt,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),Ia=T(o.createSelector([Yt,(t,s)=>s],(t,s)=>I(t.filter(({asset:e})=>s===e)))),Oa=Ht.reducer,k=_(({uuid:t})=>t),Fa={instances:{}},Zt=o.createSlice({name:"assetProcedureTypeAttachments",initialState:Fa,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),s=>Object.assign(s,Fa)),reducers:{initializeAssetProcedureTypeAttachments:k.initialize,addAssetProcedureTypeAttachment:k.addOne,addAssetProcedureTypeAttachments:k.addMany,setAssetProcedureTypeAttachment:k.setOne,setAssetProcedureTypeAttachments:k.setMany,updateAssetProcedureTypeAttachment:k.updateOne,updateAssetProcedureTypeAttachments:k.updateMany,deleteAssetProcedureTypeAttachment:k.deleteOne,deleteAssetProcedureTypeAttachments:k.deleteMany}}),{initializeAssetProcedureTypeAttachments:Pa,addAssetProcedureTypeAttachment:ga,addAssetProcedureTypeAttachments:ba,setAssetProcedureTypeAttachment:_a,setAssetProcedureTypeAttachments:Ma,updateAssetProcedureTypeAttachment:Ra,updateAssetProcedureTypeAttachments:wa,deleteAssetProcedureTypeAttachment:va,deleteAssetProcedureTypeAttachments:Va}=Zt.actions,za=Zt.reducer,Ea=t=>t.assetProcedureTypeAttachmentReducer.instances,Jt=o.createSelector([Ea],t=>Object.values(t)),Ba=t=>s=>s.assetProcedureTypeAttachmentReducer.instances[t],ja=T(o.createSelector([Jt,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),rF=T(o.createSelector([Jt,(t,s)=>s],(t,s)=>I(t.filter(({asset_procedure_type:e})=>s===e)))),N=_(({uuid:t})=>t),qa={instances:{}},Xt=o.createSlice({name:"assetProcedureTypeFieldsAttachments",initialState:qa,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),s=>Object.assign(s,qa)),reducers:{initializeAssetProcedureTypeFieldsAttachments:N.initialize,addAssetProcedureTypeFieldsAttachment:N.addOne,addAssetProcedureTypeFieldsAttachments:N.addMany,setAssetProcedureTypeFieldsAttachment:N.setOne,setAssetProcedureTypeFieldsAttachments:N.setMany,updateAssetProcedureTypeFieldsAttachment:N.updateOne,updateAssetProcedureTypeFieldsAttachments:N.updateMany,deleteAssetProcedureTypeFieldsAttachment:N.deleteOne,deleteAssetProcedureTypeFieldsAttachments:N.deleteMany}}),{initializeAssetProcedureTypeFieldsAttachments:Da,addAssetProcedureTypeFieldsAttachment:$a,addAssetProcedureTypeFieldsAttachments:Ua,setAssetProcedureTypeFieldsAttachment:Ca,setAssetProcedureTypeFieldsAttachments:La,updateAssetProcedureTypeFieldsAttachment:ka,updateAssetProcedureTypeFieldsAttachments:Na,deleteAssetProcedureTypeFieldsAttachment:Ga,deleteAssetProcedureTypeFieldsAttachments:Ha}=Xt.actions,Wa=Xt.reducer,Ka=t=>t.assetProcedureTypeFieldsAttachmentReducer.instances,Qt=o.createSelector([Ka],t=>Object.values(t)),uF=T(o.createSelector([Qt,(t,s)=>s],(t,s)=>I(t.filter(e=>e.fields_revision===s)))),Ya=t=>s=>s.assetProcedureTypeFieldsAttachmentReducer.instances[t],Za=T(o.createSelector([Qt,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),G=_(({uuid:t})=>t),Ja={instances:{}},xt=o.createSlice({name:"assetProcedureTypeFields",initialState:Ja,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),s=>Object.assign(s,Ja)),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:Xa,addAssetProcedureTypeFields:Qa,addAssetProcedureTypeFieldsMany:xa,setAssetProcedureTypeFields:ec,setAssetProcedureTypeFieldsMany:tc,updateAssetProcedureTypeFields:sc,updateAssetProcedureTypeFieldsMany:ic,deleteAssetProcedureTypeFields:nc,deleteAssetProcedureTypeFieldsMany:ac}=xt.actions,cc=xt.reducer,dc=t=>t.assetProcedureTypeFieldsReducer.instances,mt=o.createSelector([dc],t=>Object.values(t)),lF=T(o.createSelector([mt,(t,s)=>s],(t,s)=>I(t.filter(e=>e.asset_procedure_type===s)))),oF=T(o.createSelector([mt,(t,s)=>s],(t,s)=>t.filter(e=>e.asset_procedure_type===s).sort((e,n)=>e.submitted_at>n.submitted_at?-1:1)[0])),rc=t=>s=>s.assetProcedureTypeFieldsReducer.instances[t],uc=T(o.createSelector([mt,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),H=_(({uuid:t})=>t),lc={instances:{}},es=o.createSlice({name:"assetProcedureTypeFieldValuesAttachments",initialState:lc,extraReducers:t=>t.addMatcher(o.isAnyOf(g,B,M),s=>Object.assign(s,lc)),reducers:{initializeAssetProcedureTypeFieldValuesAttachments:H.initialize,addAssetProcedureTypeFieldValuesAttachment:H.addOne,addAssetProcedureTypeFieldValuesAttachments:H.addMany,setAssetProcedureTypeFieldValuesAttachment:H.setOne,setAssetProcedureTypeFieldValuesAttachments:H.setMany,updateAssetProcedureTypeFieldValuesAttachment:H.updateOne,updateAssetProcedureTypeFieldValuesAttachments:H.updateMany,deleteAssetProcedureTypeFieldValuesAttachment:H.deleteOne,deleteAssetProcedureTypeFieldValuesAttachments:H.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=o.createSelector([Tc],t=>Object.values(t)),Ic=t=>s=>s.assetProcedureTypeFieldValuesAttachmentReducer.instances[t],Oc=T(o.createSelector([is,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),Fc=T(o.createSelector([is,(t,s)=>s],(t,s)=>I(t.filter(e=>e.field_values===s)))),W=_(({uuid:t})=>t),Pc={instances:{}},ns=o.createSlice({name:"assetProcedureTypeFieldValues",initialState:Pc,extraReducers:t=>t.addMatcher(o.isAnyOf(g,B,M),s=>Object.assign(s,Pc)),reducers:{initializeAssetProcedureTypeFieldValues:W.initialize,addAssetProcedureTypeFieldValues:W.addOne,addAssetProcedureTypeFieldValuesMany:W.addMany,setAssetProcedureTypeFieldValues:W.setOne,setAssetProcedureTypeFieldValuesMany:W.setMany,updateAssetProcedureTypeFieldValues:W.updateOne,updateAssetProcedureTypeFieldValuesMany:W.updateMany,deleteAssetProcedureTypeFieldValues:W.deleteOne,deleteAssetProcedureTypeFieldValuesMany:W.deleteMany}}),{initializeAssetProcedureTypeFieldValues:gc,addAssetProcedureTypeFieldValues:bc,addAssetProcedureTypeFieldValuesMany:_c,setAssetProcedureTypeFieldValues:Mc,setAssetProcedureTypeFieldValuesMany:Rc,updateAssetProcedureTypeFieldValues:wc,updateAssetProcedureTypeFieldValuesMany:vc,deleteAssetProcedureTypeFieldValues:Vc,deleteAssetProcedureTypeFieldValuesMany:zc}=ns.actions,Ec=ns.reducer,Bc=t=>t.assetProcedureTypeFieldValuesReducer.instances,yt=o.createSelector([Bc],t=>Object.values(t)),hF=T(o.createSelector([yt,(t,s)=>s],(t,s)=>I(t.filter(e=>e.asset===s)))),mF=T(o.createSelector([yt,(t,s)=>s],(t,s)=>I(t.filter(e=>e.asset_procedure===s)))),jc=t=>s=>s.assetProcedureTypeFieldValuesReducer.instances[t],qc=T(o.createSelector([yt,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),K=_(({uuid:t})=>t),Dc={instances:{}},as=o.createSlice({name:"assetProcedures",initialState:Dc,extraReducers:t=>t.addMatcher(o.isAnyOf(g,B,M),s=>Object.assign(s,Dc)),reducers:{initializeAssetProcedures:K.initialize,addAssetProcedure:K.addOne,addAssetProcedures:K.addMany,setAssetProcedure:K.setOne,setAssetProcedures:K.setMany,updateAssetProcedure:K.updateOne,updateAssetProcedures:K.updateMany,deleteAssetProcedure:K.deleteOne,deleteAssetProcedures:K.deleteMany}}),{initializeAssetProcedures:$c,addAssetProcedure:Uc,addAssetProcedures:cs,updateAssetProcedure:Cc,updateAssetProcedures:Lc,deleteAssetProcedure:kc,deleteAssetProcedures:ds,setAssetProcedure:Nc,setAssetProcedures:Gc}=as.actions,Hc=as.reducer,Wc=t=>t.assetProcedureReducer.instances,pt=o.createSelector([Wc],t=>Object.values(t)),Kc=T(o.createSelector([pt,(t,s)=>s],(t,s)=>I(t.filter(e=>e.asset_procedure_type===s)))),yF=T(o.createSelector([pt,(t,s)=>s],(t,s)=>I(t.filter(e=>e.asset_type===s)))),Yc=t=>s=>s.assetProcedureReducer.instances[t],Zc=T(o.createSelector([pt,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),Y=_(t=>t.uuid),Jc={instances:{}},rs=o.createSlice({name:"assetProcedureTypes",initialState:Jc,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),s=>Object.assign(s,Jc)),reducers:{initializeAssetProcedureTypes:Y.initialize,addAssetProcedureType:Y.addOne,addAssetProcedureTypes:Y.addMany,setAssetProcedureType:Y.setOne,setAssetProcedureTypes:Y.setMany,updateAssetProcedureType:Y.updateOne,updateAssetProcedureTypes:Y.updateMany,deleteAssetProcedureType:Y.deleteOne,deleteAssetProcedureTypes:Y.deleteMany}}),{initializeAssetProcedureTypes:Xc,addAssetProcedureType:Qc,addAssetProcedureTypes:xc,updateAssetProcedureType:ed,updateAssetProcedureTypes:td,deleteAssetProcedureType:sd,deleteAssetProcedureTypes:id,setAssetProcedureType:nd,setAssetProcedureTypes:ad}=rs.actions,cd=rs.reducer,dd=t=>t.assetProcedureTypeReducer.instances,us=o.createSelector([dd],t=>Object.values(t)),rd=t=>s=>s.assetProcedureTypeReducer.instances[t],ud=T(o.createSelector([us,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),pF=T(o.createSelector([us,(t,s)=>s],(t,s)=>I(t.filter(e=>e.organization===s)))),Z=_(t=>t.uuid),ld={instances:{}},ls=o.createSlice({name:"assetProcedureStepFieldsAttachments",initialState:ld,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),s=>Object.assign(s,ld)),reducers:{initializeAssetProcedureStepFieldsAttachments:Z.initialize,addAssetProcedureStepFieldsAttachment:Z.addOne,addAssetProcedureStepFieldsAttachments:Z.addMany,setAssetProcedureStepFieldsAttachment:Z.setOne,setAssetProcedureStepFieldsAttachments:Z.setMany,updateAssetProcedureStepFieldsAttachment:Z.updateOne,updateAssetProcedureStepFieldsAttachments:Z.updateMany,deleteAssetProcedureStepFieldsAttachment:Z.deleteOne,deleteAssetProcedureStepFieldsAttachments:Z.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=o.createSelector([Id],t=>Object.values(t)),AF=T(o.createSelector([os,(t,s)=>s],(t,s)=>I(t.filter(e=>e.fields_revision===s)))),Od=t=>s=>s.assetProcedureStepFieldsAttachmentReducer.instances[t],Fd=T(o.createSelector([os,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),Pd=ls.reducer,J=_(t=>t.uuid),gd={instances:{}},hs=o.createSlice({name:"assetProcedureStepFields",initialState:gd,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),s=>Object.assign(s,gd)),reducers:{initializeAssetProcedureStepFields:J.initialize,addAssetProcedureStepFields:J.addOne,addAssetProcedureStepFieldsMany:J.addMany,setAssetProcedureStepFields:J.setOne,setAssetProcedureStepFieldsMany:J.setMany,updateAssetProcedureStepFields:J.updateOne,updateAssetProcedureStepFieldsMany:J.updateMany,deleteAssetProcedureStepFields:J.deleteOne,deleteAssetProcedureStepFieldsMany:J.deleteMany}}),{initializeAssetProcedureStepFields:bd,addAssetProcedureStepFields:_d,addAssetProcedureStepFieldsMany:Md,setAssetProcedureStepFields:Rd,setAssetProcedureStepFieldsMany:wd,updateAssetProcedureStepFields:vd,updateAssetProcedureStepFieldsMany:Vd,deleteAssetProcedureStepFields:zd,deleteAssetProcedureStepFieldsMany:Ed}=hs.actions,ms=t=>t.assetProcedureStepFieldsReducer.instances,At=o.createSelector([ms],t=>Object.values(t)),fF=T(o.createSelector([At,(t,s)=>s],(t,s)=>I(t.filter(e=>e.asset_procedure_step===s)))),SF=T(o.createSelector([At,(t,s)=>s],(t,s)=>t.filter(e=>e.asset_procedure_step===s).sort((e,n)=>e.submitted_at>n.submitted_at?-1:1)[0])),TF=o.createSelector([ms],t=>{const s={};for(const e of Object.values(t)){const n=s[e.asset_procedure_step];(!n||n.submitted_at<e.submitted_at)&&(s[e.asset_procedure_step]=e)}return s}),Bd=t=>s=>s.assetProcedureStepFieldsReducer.instances[t],jd=T(o.createSelector([At,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),qd=hs.reducer,X=_(t=>t.uuid),Dd={instances:{}},ys=o.createSlice({name:"assetProcedureStepFieldValuesAttachments",initialState:Dd,extraReducers:t=>t.addMatcher(o.isAnyOf(g,B,M),s=>Object.assign(s,Dd)),reducers:{initializeAssetProcedureStepFieldValuesAttachments:X.initialize,addAssetProcedureStepFieldValuesAttachment:X.addOne,addAssetProcedureStepFieldValuesAttachments:X.addMany,setAssetProcedureStepFieldValuesAttachment:X.setOne,setAssetProcedureStepFieldValuesAttachments:X.setMany,updateAssetProcedureStepFieldValuesAttachment:X.updateOne,updateAssetProcedureStepFieldValuesAttachments:X.updateMany,deleteAssetProcedureStepFieldValuesAttachment:X.deleteOne,deleteAssetProcedureStepFieldValuesAttachments:X.deleteMany}}),{initializeAssetProcedureStepFieldValuesAttachments:$d,addAssetProcedureStepFieldValuesAttachment:Ud,addAssetProcedureStepFieldValuesAttachments:ps,setAssetProcedureStepFieldValuesAttachment:Cd,setAssetProcedureStepFieldValuesAttachments:Ld,updateAssetProcedureStepFieldValuesAttachment:kd,updateAssetProcedureStepFieldValuesAttachments:Nd,deleteAssetProcedureStepFieldValuesAttachment:Gd,deleteAssetProcedureStepFieldValuesAttachments:As}=ys.actions,Hd=t=>t.assetProcedureStepFieldValuesAttachmentReducer.instances,fs=o.createSelector([Hd],t=>Object.values(t)),Wd=t=>s=>s.assetProcedureStepFieldValuesAttachmentReducer.instances[t],Kd=T(o.createSelector([fs,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),Yd=T(o.createSelector([fs,(t,s)=>s],(t,s)=>I(t.filter(e=>e.field_values===s)))),Zd=ys.reducer,Q=_(t=>t.uuid),Jd={instances:{}},Ss=o.createSlice({name:"assetProcedureStepFieldValues",initialState:Jd,extraReducers:t=>t.addMatcher(o.isAnyOf(g,B,M),s=>Object.assign(s,Jd)),reducers:{initializeAssetProcedureStepFieldValues:Q.initialize,addAssetProcedureStepFieldValues:Q.addOne,addAssetProcedureStepFieldValuesMany:Q.addMany,setAssetProcedureStepFieldValues:Q.setOne,setAssetProcedureStepFieldValuesMany:Q.setMany,updateAssetProcedureStepFieldValues:Q.updateOne,updateAssetProcedureStepFieldValuesMany:Q.updateMany,deleteAssetProcedureStepFieldValues:Q.deleteOne,deleteAssetProcedureStepFieldValuesMany:Q.deleteMany}}),{initializeAssetProcedureStepFieldValues:Xd,addAssetProcedureStepFieldValues:Qd,addAssetProcedureStepFieldValuesMany:xd,setAssetProcedureStepFieldValues:er,setAssetProcedureStepFieldValuesMany:tr,updateAssetProcedureStepFieldValues:sr,updateAssetProcedureStepFieldValuesMany:ir,deleteAssetProcedureStepFieldValues:nr,deleteAssetProcedureStepFieldValuesMany:ar}=Ss.actions,cr=t=>t.assetProcedureStepFieldValuesReducer.instances,ct=o.createSelector([cr],t=>Object.values(t)),IF=T(o.createSelector([ct,(t,s)=>s],(t,s)=>I(t.filter(e=>e.asset===s)))),OF=T(o.createSelector([ct,(t,s)=>s],(t,s)=>I(t.filter(e=>e.asset_procedure===s)))),FF=T(o.createSelector([ct,(t,s)=>s],(t,s)=>I(t.filter(e=>e.asset_procedure_step===s)))),dr=t=>s=>s.assetProcedureStepFieldValuesReducer.instances[t],rr=T(o.createSelector([ct,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),ur=Ss.reducer,x=_(t=>t.uuid),lr={instances:{}},Ts=o.createSlice({name:"assetProcedureSteps",initialState:lr,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),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=o.createSelector([ft],t=>Object.values(t)),PF=T(o.createSelector([ft,(t,s)=>s],(t,s)=>{const e={};for(const[n,a]of Object.entries(t))a.asset_procedure_type===s&&(e[n]=a);return ht(e)})),gF=T(o.createSelector([Is,(t,s)=>s],(t,s)=>I(t.filter(e=>e.asset_procedure_type===s)))),Fr=T(o.createSelector([Is,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),Pr=T(o.createSelector([ft,(t,s)=>s],(t,s)=>{if(!t[s])return I([]);const a=xn(s,Object.values(t)).all().map(({model:c})=>c);return I(a)})),ee=_(t=>t.uuid),gr={instances:{}},Os=o.createSlice({name:"assets",initialState:gr,extraReducers:t=>t.addMatcher(o.isAnyOf(g,B,M),s=>Object.assign(s,gr)),reducers:{initializeAssets:ee.initialize,addAsset:ee.addOne,addAssets:ee.addMany,setAsset:ee.setOne,setAssets:ee.setMany,updateAsset:ee.updateOne,updateAssets:ee.updateMany,deleteAsset:ee.deleteOne,deleteAssets:ee.deleteMany}}),{initializeAssets:br,addAsset:_r,addAssets:Fs,updateAsset:Mr,updateAssets:Rr,deleteAsset:wr,deleteAssets:Ps,setAsset:vr,setAssets:Vr}=Os.actions,zr=t=>t.assetReducer.instances,gs=o.createSelector([zr],t=>I(Object.values(t))),bs=T(o.createSelector([gs,(t,s)=>s],(t,s)=>I(t.filter(e=>e.asset_type===s)))),Er=t=>s=>s.assetReducer.instances[t],Br=T(o.createSelector([gs,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),bF=t=>s=>bs(t)(s).length,jr=Os.reducer,te=_(t=>t.uuid),qr={instances:{}},_s=o.createSlice({name:"assetStageCompletions",initialState:qr,extraReducers:t=>t.addMatcher(o.isAnyOf(g,B,M),s=>Object.assign(s,qr)),reducers:{initializeAssetStageCompletions:te.initialize,addAssetStageCompletion:te.addOne,addAssetStageCompletions:te.addMany,setAssetStageCompletion:te.setOne,setAssetStageCompletions:te.setMany,updateAssetStageCompletion:te.updateOne,updateAssetStageCompletions:te.updateMany,deleteAssetStageCompletion:te.deleteOne,deleteAssetStageCompletions:te.deleteMany}}),{initializeAssetStageCompletions:Dr,addAssetStageCompletion:$r,addAssetStageCompletions:Ur,setAssetStageCompletion:Cr,setAssetStageCompletions:Lr,updateAssetStageCompletion:kr,updateAssetStageCompletions:Nr,deleteAssetStageCompletion:Gr,deleteAssetStageCompletions:Hr}=_s.actions,Wr=_s.reducer,Kr=t=>t.assetStageCompletionReducer.instances,Yr=o.createSelector([Kr],t=>Object.values(t)),Zr=t=>s=>s.assetStageCompletionReducer.instances[t],Jr=T(o.createSelector([Yr,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),se=_(t=>t.uuid),Xr={instances:{}},Ms=o.createSlice({name:"assetStages",initialState:Xr,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),s=>Object.assign(s,Xr)),reducers:{initializeAssetStages:se.initialize,setAssetStage:se.setOne,setAssetStages:se.setMany,addAssetStage:se.addOne,addAssetStages:se.addMany,updateAssetStage:se.updateOne,updateAssetStages:se.updateMany,deleteAssetStage:se.deleteOne,deleteAssetStages:se.deleteMany}}),{initializeAssetStages:Qr,setAssetStage:xr,setAssetStages:eu,addAssetStage:tu,addAssetStages:su,updateAssetStage:iu,updateAssetStages:nu,deleteAssetStage:au,deleteAssetStages:cu}=Ms.actions,du=Ms.reducer,Rs=t=>t.assetStageReducer.instances,ru=t=>s=>s.assetStageReducer.instances[t],ws=o.createSelector([Rs],t=>Object.values(t)),_F=T(o.createSelector([Rs,(t,s)=>s],(t,s)=>{const e={};for(const[n,a]of Object.entries(t))a.asset_procedure_type===s&&(e[n]=a);return ht(e)})),MF=T(o.createSelector([ws,(t,s)=>s],(t,s)=>I(t.filter(e=>e.asset_procedure_type===s)))),uu=T(o.createSelector([ws,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),ie=_(t=>t.uuid),lu={instances:{}},vs=o.createSlice({name:"assetTypeAttachments",initialState:lu,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),s=>Object.assign(s,lu)),reducers:{initializeAssetTypeAttachments:ie.initialize,addAssetTypeAttachment:ie.addOne,addAssetTypeAttachments:ie.addMany,setAssetTypeAttachment:ie.setOne,setAssetTypeAttachments:ie.setMany,updateAssetTypeAttachment:ie.updateOne,updateAssetTypeAttachments:ie.updateMany,deleteAssetTypeAttachment:ie.deleteOne,deleteAssetTypeAttachments:ie.deleteMany}}),{initializeAssetTypeAttachments:ou,addAssetTypeAttachment:hu,addAssetTypeAttachments:Vs,setAssetTypeAttachment:mu,setAssetTypeAttachments:yu,updateAssetTypeAttachment:pu,updateAssetTypeAttachments:Au,deleteAssetTypeAttachment:fu,deleteAssetTypeAttachments:zs}=vs.actions,Su=t=>t.assetTypeAttachmentReducer.instances,Es=o.createSelector([Su],t=>Object.values(t)),Tu=t=>s=>s.assetTypeAttachmentReducer.instances[t],Iu=T(o.createSelector([Es,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),Ou=T(o.createSelector([Es,(t,s)=>s],(t,s)=>I(t.filter(({asset_type:e})=>s===e)))),Fu=vs.reducer,ne=_(t=>t.uuid),Pu={instances:{}},Bs=o.createSlice({name:"assetTypeFieldsAttachments",initialState:Pu,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),s=>Object.assign(s,Pu)),reducers:{initializeAssetTypeFieldsAttachments:ne.initialize,addAssetTypeFieldsAttachment:ne.addOne,addAssetTypeFieldsAttachments:ne.addMany,setAssetTypeFieldsAttachment:ne.setOne,setAssetTypeFieldsAttachments:ne.setMany,updateAssetTypeFieldsAttachment:ne.updateOne,updateAssetTypeFieldsAttachments:ne.updateMany,deleteAssetTypeFieldsAttachment:ne.deleteOne,deleteAssetTypeFieldsAttachments:ne.deleteMany}}),{initializeAssetTypeFieldsAttachments:gu,addAssetTypeFieldsAttachment:bu,addAssetTypeFieldsAttachments:_u,setAssetTypeFieldsAttachment:Mu,setAssetTypeFieldsAttachments:Ru,updateAssetTypeFieldsAttachment:wu,updateAssetTypeFieldsAttachments:vu,deleteAssetTypeFieldsAttachment:Vu,deleteAssetTypeFieldsAttachments:zu}=Bs.actions,Eu=t=>t.assetTypeFieldsAttachmentReducer.instances,js=o.createSelector([Eu],t=>Object.values(t)),RF=T(o.createSelector([js,(t,s)=>s],(t,s)=>I(t.filter(e=>e.fields_revision===s)))),Bu=t=>s=>s.assetTypeFieldsAttachmentReducer.instances[t],ju=T(o.createSelector([js,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),qu=Bs.reducer,ae=_(t=>t.uuid),Du={instances:{}},qs=o.createSlice({name:"assetTypeFields",initialState:Du,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),s=>Object.assign(s,Du)),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:$u,addAssetTypeFields:Uu,addAssetTypeFieldsMany:Cu,setAssetTypeFields:Lu,setAssetTypeFieldsMany:ku,updateAssetTypeFields:Nu,updateAssetTypeFieldsMany:Gu,deleteAssetTypeFields:Hu,deleteAssetTypeFieldsMany:Wu}=qs.actions,Ku=t=>t.assetTypeFieldsReducer.instances,dt=o.createSelector([Ku],t=>Object.values(t)),wF=T(o.createSelector([dt,(t,s)=>s],(t,s)=>I(t.filter(e=>e.asset_type===s)))),vF=T(o.createSelector([dt,(t,s)=>s],(t,s)=>t.filter(e=>e.asset_type===s).sort((e,n)=>e.submitted_at>n.submitted_at?-1:1)[0])),Yu=t=>s=>s.assetTypeFieldsReducer.instances[t],Zu=T(o.createSelector([dt,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),Ju=qs.reducer,ce=_(t=>t.uuid),Xu={instances:{}},Ds=o.createSlice({name:"assetTypeFieldValuesAttachments",initialState:Xu,extraReducers:t=>t.addMatcher(o.isAnyOf(g,B,M),s=>Object.assign(s,Xu)),reducers:{initializeAssetTypeFieldValuesAttachments:ce.initialize,addAssetTypeFieldValuesAttachment:ce.addOne,addAssetTypeFieldValuesAttachments:ce.addMany,setAssetTypeFieldValuesAttachment:ce.setOne,setAssetTypeFieldValuesAttachments:ce.setMany,updateAssetTypeFieldValuesAttachment:ce.updateOne,updateAssetTypeFieldValuesAttachments:ce.updateMany,deleteAssetTypeFieldValuesAttachment:ce.deleteOne,deleteAssetTypeFieldValuesAttachments:ce.deleteMany}}),{initializeAssetTypeFieldValuesAttachments:Qu,addAssetTypeFieldValuesAttachment:xu,addAssetTypeFieldValuesAttachments:$s,setAssetTypeFieldValuesAttachment:el,setAssetTypeFieldValuesAttachments:tl,updateAssetTypeFieldValuesAttachment:sl,updateAssetTypeFieldValuesAttachments:il,deleteAssetTypeFieldValuesAttachment:nl,deleteAssetTypeFieldValuesAttachments:Us}=Ds.actions,al=t=>t.assetTypeFieldValuesAttachmentReducer.instances,Cs=o.createSelector([al],t=>Object.values(t)),cl=t=>s=>s.assetTypeFieldValuesAttachmentReducer.instances[t],dl=T(o.createSelector([Cs,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),rl=T(o.createSelector([Cs,(t,s)=>s],(t,s)=>I(t.filter(e=>e.field_values===s)))),ul=Ds.reducer,de=_(t=>t.uuid),ll={instances:{}},Ls=o.createSlice({name:"assetTypeFieldValues",initialState:ll,extraReducers:t=>t.addMatcher(o.isAnyOf(g,B,M),s=>Object.assign(s,ll)),reducers:{initializeAssetTypeFieldValues:de.initialize,addAssetTypeFieldValues:de.addOne,addAssetTypeFieldValuesMany:de.addMany,setAssetTypeFieldValues:de.setOne,setAssetTypeFieldValuesMany:de.setMany,updateAssetTypeFieldValues:de.updateOne,updateAssetTypeFieldValuesMany:de.updateMany,deleteAssetTypeFieldValues:de.deleteOne,deleteAssetTypeFieldValuesMany:de.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=o.createSelector([Il],t=>Object.values(t)),VF=T(o.createSelector([St,(t,s)=>s],(t,s)=>I(t.filter(e=>e.asset===s)))),zF=T(o.createSelector([dt,St,(t,s)=>s],(t,s,e)=>{const n=new Set(t.filter(a=>a.asset_type===e).map(a=>a.uuid));return I(s.filter(a=>n.has(a.fields_revision)))})),Ol=t=>s=>s.assetTypeFieldValuesReducer.instances[t],Fl=T(o.createSelector([St,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),Pl=Ls.reducer,re=_(t=>t.uuid),gl={instances:{}},ks=o.createSlice({name:"assetTypeIdentifiers",initialState:gl,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),s=>Object.assign(s,gl)),reducers:{initializeAssetTypeIdentifiers:re.initialize,addAssetTypeIdentifier:re.addOne,addAssetTypeIdentifiers:re.addMany,setAssetTypeIdentifier:re.setOne,setAssetTypeIdentifiers:re.setMany,updateAssetTypeIdentifier:re.updateOne,updateAssetTypeIdentifiers:re.updateMany,deleteAssetTypeIdentifier:re.deleteOne,deleteAssetTypeIdentifiers:re.deleteMany}}),{initializeAssetTypeIdentifiers:bl,addAssetTypeIdentifier:_l,addAssetTypeIdentifiers:Ml,setAssetTypeIdentifier:Rl,setAssetTypeIdentifiers:wl,updateAssetTypeIdentifier:vl,updateAssetTypeIdentifiers:Vl,deleteAssetTypeIdentifier:zl,deleteAssetTypeIdentifiers:El}=ks.actions,Bl=t=>t.assetTypeIdentifierReducer.instances,Ns=o.createSelector([Bl],t=>Object.values(t)),jl=t=>s=>s.assetTypeIdentifierReducer.instances[t],ql=T(o.createSelector([Ns,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),EF=T(o.createSelector([Ns,(t,s)=>s],(t,s)=>I(t.filter(e=>e.asset_type===s)))),Dl=ks.reducer,ue=_(t=>t.uuid),$l={instances:{}},Gs=o.createSlice({name:"assetTypeIdentifierValues",initialState:$l,extraReducers:t=>t.addMatcher(o.isAnyOf(g,B,M),s=>Object.assign(s,$l)),reducers:{initializeAssetTypeIdentifierValues:ue.initialize,addAssetTypeIdentifierValue:ue.addOne,addAssetTypeIdentifierValues:ue.addMany,setAssetTypeIdentifierValue:ue.setOne,setAssetTypeIdentifierValues:ue.setMany,updateAssetTypeIdentifierValue:ue.updateOne,updateAssetTypeIdentifierValues:ue.updateMany,deleteAssetTypeIdentifierValue:ue.deleteOne,deleteAssetTypeIdentifierValues:ue.deleteMany}}),{initializeAssetTypeIdentifierValues:Ul,addAssetTypeIdentifierValue:Cl,addAssetTypeIdentifierValues:Ll,setAssetTypeIdentifierValue:kl,setAssetTypeIdentifierValues:Nl,updateAssetTypeIdentifierValue:Gl,updateAssetTypeIdentifierValues:Hl,deleteAssetTypeIdentifierValue:Wl,deleteAssetTypeIdentifierValues:Kl}=Gs.actions,Yl=t=>t.assetTypeIdentifierValueReducer.instances,Tt=o.createSelector([Yl],t=>Object.values(t)),Zl=t=>s=>s.assetTypeIdentifierValueReducer.instances[t],Jl=T(o.createSelector([Tt,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),BF=T(o.createSelector([Tt,(t,s)=>s],(t,s)=>I(t.filter(e=>e.asset===s)))),jF=T(o.createSelector([Tt,(t,s)=>s],(t,s)=>I(t.filter(e=>e.asset_type_identifier===s)))),Xl=Gs.reducer,le=_(t=>t.uuid),Ql={instances:{}},Hs=o.createSlice({name:"assetTypes",initialState:Ql,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),s=>Object.assign(s,Ql)),reducers:{initializeAssetTypes:le.initialize,setAssetType:le.setOne,setAssetTypes:le.setMany,addAssetType:le.addOne,addAssetTypes:le.addMany,updateAssetType:le.updateOne,updateAssetTypes:le.updateMany,deleteAssetType:le.deleteOne,deleteAssetTypes:le.deleteMany}}),{initializeAssetTypes:xl,setAssetType:eo,setAssetTypes:to,addAssetType:so,addAssetTypes:io,updateAssetType:no,updateAssetTypes:ao,deleteAssetType:co,deleteAssetTypes:ro}=Hs.actions,uo=t=>t.assetTypeReducer.instances,Ws=o.createSelector([uo],t=>Object.values(t)),lo=t=>s=>s.assetTypeReducer.instances[t],oo=T(o.createSelector([Ws,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),qF=T(o.createSelector([Ws,(t,s)=>s],(t,s)=>I(t.filter(e=>e.organization===s)))),ho=Hs.reducer,oe=_(t=>t.uuid),mo={instances:{}},Ks=o.createSlice({name:"assetTypeStatuses",initialState:mo,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),s=>Object.assign(s,mo)),reducers:{initializeAssetTypeStatuses:oe.initialize,addAssetTypeStatus:oe.addOne,addAssetTypeStatuses:oe.addMany,setAssetTypeStatus:oe.setOne,setAssetTypeStatuses:oe.setMany,updateAssetTypeStatus:oe.updateOne,updateAssetTypeStatuses:oe.updateMany,deleteAssetTypeStatus:oe.deleteOne,deleteAssetTypeStatuses:oe.deleteMany}}),{initializeAssetTypeStatuses: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=o.createSelector([Po],t=>I(Object.values(t).toSorted(ea))),go=t=>s=>s.assetTypeStatusReducer.instances[t],bo=T(o.createSelector([Ys,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),DF=T(o.createSelector([Ys,(t,s)=>s],(t,s)=>I(t.filter(e=>e.asset_type===s)))),_o=Ks.reducer,Mo={accessToken:"",refreshToken:"",isLoggedIn:!1},It=o.createSlice({name:"auth",initialState:Mo,extraReducers:t=>t.addCase(g,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:$F,clearTokens:UF,setLoggedIn:Ro}=It.actions,CF=t=>t.authReducer.accessToken,LF=t=>t.authReducer.isLoggedIn,wo=It.reducer,he=_(t=>t.uuid),vo={instances:{}},Zs=o.createSlice({name:"categories",initialState:vo,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),s=>Object.assign(s,vo)),reducers:{initializeCategories:he.initialize,addCategory:he.addOne,addCategories:he.addMany,setCategory:he.setOne,setCategories:he.setMany,updateCategory:he.updateOne,updateCategories:he.updateMany,deleteCategory:he.deleteOne,deleteCategories:he.deleteMany}}),{initializeCategories:Vo,addCategory:zo,addCategories:Eo,setCategory:Bo,setCategories:jo,updateCategory:qo,updateCategories:Do,deleteCategory:$o,deleteCategories:Uo}=Zs.actions,Co=t=>t.categoryReducer.instances,Js=o.createSelector([Co],t=>Object.values(t)),Xs=t=>s=>s.categoryReducer.instances[t],Lo=T(o.createSelector([Js,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),kF=T(o.createSelector([Js,(t,s)=>s],(t,s)=>I(t.filter(e=>e.project===s)))),ko=Zs.reducer,me=_(t=>t.uuid),No={instances:{}},Qs=o.createSlice({name:"documentAttachments",initialState:No,extraReducers:t=>t.addCase(g,s=>Object.assign(s,No)),reducers:{initializeDocumentAttachments:me.initialize,addDocumentAttachment:me.addOne,addDocumentAttachments:me.addMany,setDocumentAttachment:me.setOne,setDocumentAttachments:me.setMany,updateDocumentAttachment:me.updateOne,updateDocumentAttachments:me.updateMany,deleteDocumentAttachment:me.deleteOne,deleteDocumentAttachments:me.deleteMany}}),{initializeDocumentAttachments:Go,addDocumentAttachment:Ho,addDocumentAttachments:Wo,setDocumentAttachment:Ko,setDocumentAttachments:Yo,updateDocumentAttachment:Zo,updateDocumentAttachments:Jo,deleteDocumentAttachment:Xo,deleteDocumentAttachments:Qo}=Qs.actions,xo=t=>t.documentAttachmentReducer.instances,xs=o.createSelector([xo],t=>Object.values(t)),eh=t=>s=>s.documentAttachmentReducer.instances[t],th=T(o.createSelector([xs,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),NF=T(o.createSelector([xs,(t,s)=>s],(t,s)=>I(t.filter(({document:e})=>s===e)))),sh=Qs.reducer,ye=_(({uuid:t})=>t),ih={instances:{}},ei=o.createSlice({name:"documents",initialState:ih,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),s=>{Object.assign(s,ih)}),reducers:{initializeDocuments:ye.initialize,addDocument:ye.addOne,addDocuments:ye.addMany,setDocument:ye.setOne,setDocuments:ye.setMany,updateDocument:ye.updateOne,updateDocuments:ye.updateMany,deleteDocument:ye.deleteOne,deleteDocuments:ye.deleteMany}}),{initializeDocuments:nh,addDocument:ah,addDocuments:ch,setDocument:dh,setDocuments:rh,updateDocument:uh,updateDocuments:lh,deleteDocument:oh,deleteDocuments:hh}=ei.actions,mh=t=>t.documentsReducer.instances,Ot=o.createSelector([mh],t=>Object.values(t)),yh=t=>s=>s.documentsReducer.instances[t],ph=T(o.createSelector([Ot,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),GF=T(o.createSelector([Ot,(t,s)=>s],(t,s)=>t.filter(e=>e.project===s))),HF=T(o.createSelector([Ot,(t,s)=>s],(t,s)=>t.filter(e=>e.organization===s))),Ah=ei.reducer,pe=_(t=>t.uuid),fh={instances:{}},ti=o.createSlice({name:"emailDomains",initialState:fh,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),s=>Object.assign(s,fh)),reducers:{initializeEmailDomains:pe.initialize,addEmailDomain:pe.addOne,addEmailDomains:pe.addMany,setEmailDomain:pe.setOne,setEmailDomains:pe.setMany,updateEmailDomain:pe.updateOne,updateEmailDomains:pe.updateMany,deleteEmailDomain:pe.deleteOne,deleteEmailDomains:pe.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=o.createSelector([Mh],t=>Object.values(t)),Rh=t=>s=>s.emailDomainsReducer.instances[t],wh=T(o.createSelector([si,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),WF=T(o.createSelector([si,(t,s)=>s],(t,s)=>I(t.filter(e=>e.organization===s)))),vh=ti.reducer,Vh={s3Urls:{}},zh=1e3*60*60,KF=zh*24*7,ii=o.createSlice({name:"file",initialState:Vh,extraReducers:t=>t.addCase(g,s=>Object.assign(s,Vh)),reducers:{setUploadUrl:(t,s)=>{const{url:e,fields:n,sha1:a}=s.payload,c=new Date,r=new Date(c.getTime()+KF);t.s3Urls[a]={url:e,fields:n,exp:r.getTime()}}}}),{setUploadUrl:Eh}=ii.actions,Bh=t=>s=>{const e=s.fileReducer.s3Urls[t];if(!e)return;const n=new Date().getTime();if(!((e.exp??n)-n<zh))return e},jh=ii.reducer,Ae=_(t=>t.uuid),qh={instances:{}},ni=o.createSlice({name:"formIdentifiers",initialState:qh,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),s=>Object.assign(s,qh)),reducers:{initializeFormIdentifiers:Ae.initialize,addFormIdentifier:Ae.addOne,addFormIdentifiers:Ae.addMany,setFormIdentifier:Ae.setOne,setFormIdentifiers:Ae.setMany,updateFormIdentifier:Ae.updateOne,updateFormIdentifiers:Ae.updateMany,deleteFormIdentifier:Ae.deleteOne,deleteFormIdentifiers:Ae.deleteMany}}),{initializeFormIdentifiers:Dh,addFormIdentifier:$h,addFormIdentifiers:Uh,setFormIdentifier:Ch,setFormIdentifiers:Lh,updateFormIdentifier:kh,updateFormIdentifiers:Nh,deleteFormIdentifier:Gh,deleteFormIdentifiers:Hh}=ni.actions,Wh=t=>t.formIdentifierReducer.instances,ai=o.createSelector([Wh],t=>Object.values(t)),Kh=t=>s=>s.formIdentifierReducer.instances[t],Yh=T(o.createSelector([ai,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),YF=T(o.createSelector([ai,(t,s)=>s],(t,s)=>I(t.filter(e=>e.form===s)))),Zh=ni.reducer,fe=_(t=>t.uuid),Jh={instances:{}},ci=o.createSlice({name:"formIdentifierValues",initialState:Jh,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),s=>Object.assign(s,Jh)),reducers:{initializeFormIdentifierValues:fe.initialize,addFormIdentifierValue:fe.addOne,addFormIdentifierValues:fe.addMany,setFormIdentifierValue:fe.setOne,setFormIdentifierValues:fe.setMany,updateFormIdentifierValue:fe.updateOne,updateFormIdentifierValues:fe.updateMany,deleteFormIdentifierValue:fe.deleteOne,deleteFormIdentifierValues:fe.deleteMany}}),{initializeFormIdentifierValues:Xh,addFormIdentifierValue:Qh,addFormIdentifierValues:xh,setFormIdentifierValue:em,setFormIdentifierValues:tm,updateFormIdentifierValue:sm,updateFormIdentifierValues:im,deleteFormIdentifierValue:nm,deleteFormIdentifierValues:am}=ci.actions,cm=t=>t.formIdentifierValueReducer.instances,Ft=o.createSelector([cm],t=>Object.values(t)),dm=t=>s=>s.formIdentifierValueReducer.instances[t],rm=T(o.createSelector([Ft,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),ZF=T(o.createSelector([Ft,(t,s)=>s],(t,s)=>I(t.filter(e=>e.form_submission===s)))),JF=T(o.createSelector([Ft,(t,s)=>s],(t,s)=>I(t.filter(e=>e.form_identifier===s)))),um=ci.reducer,Se=_(t=>t.uuid),lm={instances:{}},di=o.createSlice({name:"formRevisionAttachments",initialState:lm,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),s=>Object.assign(s,lm)),reducers:{initializeFormRevisionAttachments:Se.initialize,addFormRevisionAttachment:Se.addOne,addFormRevisionAttachments:Se.addMany,setFormRevisionAttachment:Se.setOne,setFormRevisionAttachments:Se.setMany,updateFormRevisionAttachment:Se.updateOne,updateFormRevisionAttachments:Se.updateMany,deleteFormRevisionAttachment:Se.deleteOne,deleteFormRevisionAttachments:Se.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=o.createSelector([Pt],t=>Object.values(t)),Om=T(o.createSelector([Pt,(t,s)=>s],(t,s)=>t[s])),Fm=T(o.createSelector([Im,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),XF=T(o.createSelector([Pt,(t,s)=>s],(t,s)=>I(Object.values(t).filter(e=>e.form_revision===s)))),Pm=di.reducer,Te=_(t=>t.uuid),gm={instances:{}},ri=o.createSlice({name:"formRevisions",initialState:gm,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),s=>Object.assign(s,gm)),reducers:{initializeFormRevisions:Te.initialize,addFormRevision:Te.addOne,addFormRevisions:Te.addMany,setFormRevision:Te.setOne,setFormRevisions:Te.setMany,updateFormRevision:Te.updateOne,updateFormRevisions:Te.updateMany,deleteFormRevision:Te.deleteOne,deleteFormRevisions:Te.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=o.createSelector([mi],t=>Object.values(t)),vm=t=>s=>s.formRevisionReducer.instances[t],Vm=T(o.createSelector([gt,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),QF=T(o.createSelector([gt,(t,s)=>s],(t,s)=>t.filter(e=>e.form===s).sort((e,n)=>e.submitted_at>n.submitted_at?-1:1)[0])),zm=T(o.createSelector([gt,(t,s)=>s],(t,s)=>I(t.filter(e=>e.form===s)))),Em=ri.reducer,Ie=_(t=>t.uuid),Bm={instances:{}},yi=o.createSlice({name:"forms",initialState:Bm,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),s=>Object.assign(s,Bm)),reducers:{initializeForms:Ie.initialize,addForm:Ie.addOne,addForms:Ie.addMany,setForm:Ie.setOne,setForms:Ie.setMany,updateForm:Ie.updateOne,updateForms:Ie.updateMany,deleteForm:Ie.deleteOne,deleteForms:Ie.deleteMany}}),{initializeForms:jm,addForm:qm,addForms:Dm,setForm:$m,setForms:Um,updateForm:Cm,updateForms:Lm,deleteForm:km,deleteForms:Nm}=yi.actions,Gm=yi.reducer,Hm=t=>t.formReducer.instances,pi=o.createSelector([Hm],t=>Object.values(t)),Wm=t=>s=>s.formReducer.instances[t],Km=T(o.createSelector([pi,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),xF=T(o.createSelector([pi,(t,s)=>s],(t,s)=>I(t.filter(e=>e.organization===s)))),Oe=_(t=>t.uuid),Ym={instances:{}},Ai=o.createSlice({name:"formSubmissionAttachments",initialState:Ym,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),s=>Object.assign(s,Ym)),reducers:{initializeFormSubmissionAttachments:Oe.initialize,addFormSubmissionAttachment:Oe.addOne,addFormSubmissionAttachments:Oe.addMany,setFormSubmissionAttachment:Oe.setOne,setFormSubmissionAttachments:Oe.setMany,updateFormSubmissionAttachment:Oe.updateOne,updateFormSubmissionAttachments:Oe.updateMany,deleteFormSubmissionAttachment:Oe.deleteOne,deleteFormSubmissionAttachments:Oe.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=o.createSelector([Ti],t=>Object.values(t)),sy=T(o.createSelector([Ti,(t,s)=>s],(t,s)=>t[s])),Oi=T(o.createSelector([Ii,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(n=>e.has(n.uuid)))})),iy=Oi,ny=T(o.createSelector([Ii,(t,s)=>s],(t,s)=>I(t.filter(e=>e.form_submission===s)))),ay=Ai.reducer,Fe=_(t=>t.uuid),cy={instances:{}},Fi=o.createSlice({name:"formSubmissions",initialState:cy,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),s=>Object.assign(s,cy)),reducers:{initializeFormSubmissions:Fe.initialize,setFormSubmission:Fe.setOne,setFormSubmissions:Fe.setMany,addFormSubmission:Fe.addOne,addFormSubmissions:Fe.addMany,updateFormSubmission:Fe.updateOne,updateFormSubmissions:Fe.updateMany,deleteFormSubmission:Fe.deleteOne,deleteFormSubmissions:Fe.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=o.createSelector([bi],t=>Object.values(t)),py=t=>s=>s.formSubmissionReducer.instances[t],Ay=T(o.createSelector([yy,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),fy=T(o.createSelector([bi,mi,(t,s)=>s],(t,s,e)=>{const n=new Set;for(const a of Object.values(s))a.form===e&&n.add(a.uuid);return Object.values(t).filter(a=>n.has(a.form_revision))})),Sy=Fi.reducer,Pe=_(t=>t.uuid),Ty={instances:{}},_i=o.createSlice({name:"geoImages",initialState:Ty,extraReducers:t=>t.addMatcher(o.isAnyOf(g,B,M),s=>Object.assign(s,Ty)),reducers:{initializeGeoImages:Pe.initialize,setGeoImage:Pe.setOne,setGeoImages:Pe.setMany,addGeoImage:Pe.addOne,addGeoImages:Pe.addMany,updateGeoImage:Pe.updateOne,updateGeoImages:Pe.updateMany,deleteGeoImage:Pe.deleteOne,deleteGeoImages:Pe.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=o.createSelector([wy],t=>Object.values(t)),vy=t=>s=>s.geoImageReducer.instances[t],Vy=T(o.createSelector([Mi,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),eP=T(o.createSelector([Mi,(t,s)=>s],(t,s)=>I(t.filter(e=>e.project===s)))),zy=_i.reducer,ge=_(t=>t.uuid),Ey={instances:{}},Ri=o.createSlice({name:"issueAssociations",initialState:Ey,extraReducers:t=>t.addMatcher(o.isAnyOf(g,B,M),s=>Object.assign(s,Ey)),reducers:{initializeIssueAssociations:ge.initialize,addIssueAssociation:ge.addOne,addIssueAssociations:ge.addMany,setIssueAssociation:ge.setOne,setIssueAssociations:ge.setMany,updateIssueAssociation:ge.updateOne,updateIssueAssociations:ge.updateMany,deleteIssueAssociation:ge.deleteOne,deleteIssueAssociations:ge.deleteMany}}),{initializeIssueAssociations:By,setIssueAssociations:jy,setIssueAssociation:qy,updateIssueAssociation:Dy,updateIssueAssociations:$y,addIssueAssociation:Uy,addIssueAssociations:bt,deleteIssueAssociation:Cy,deleteIssueAssociations:_t}=Ri.actions,rt=t=>t.issueAssociationReducer.instances,Ly=o.createSelector([rt],t=>Object.values(t)),ky=t=>s=>s.issueAssociationReducer.instances[t],Ny=T(o.createSelector([Ly,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),Gy=T(o.createSelector([rt,(t,s)=>s],(t,s)=>I(Object.values(t).filter(e=>e.associated_issue===s)))),Hy=T(o.createSelector([rt,(t,s)=>s],(t,s)=>I(Object.values(t).filter(e=>e.issue===s)))),Wy=T(o.createSelector([rt,(t,s)=>s],(t,s)=>I(Object.values(t).filter(e=>e.asset===s)))),Ky=Ri.reducer,be=_(t=>t.uuid),Yy={instances:{}},wi=o.createSlice({name:"issueAttachments",initialState:Yy,extraReducers:t=>t.addMatcher(o.isAnyOf(g,B,M),s=>Object.assign(s,Yy)),reducers:{initializeIssueAttachments:be.initialize,addIssueAttachment:be.addOne,addIssueAttachments:be.addMany,setIssueAttachment:be.setOne,setIssueAttachments:be.setMany,updateIssueAttachment:be.updateOne,updateIssueAttachments:be.updateMany,deleteIssueAttachment:be.deleteOne,deleteIssueAttachments:be.deleteMany}}),{initializeIssueAttachments:Zy,addIssueAttachment:Jy,addIssueAttachments:vi,setIssueAttachment:Xy,setIssueAttachments:Qy,updateIssueAttachment:xy,updateIssueAttachments:ep,deleteIssueAttachment:tp,deleteIssueAttachments:Vi}=wi.actions,sp=t=>t.issueAttachmentReducer.instances,zi=o.createSelector([sp],t=>Object.values(t)),ip=T(o.createSelector([zi,(t,s)=>s],(t,s)=>I(t.filter(({issue:e})=>s===e)))),np=t=>s=>s.issueAttachmentReducer.instances[t],ap=T(o.createSelector([zi,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),cp=wi.reducer,_e=_(t=>t.uuid),dp={instances:{}},Ei=o.createSlice({name:"issueCommentAttachments",initialState:dp,extraReducers:t=>t.addMatcher(o.isAnyOf(g,B,M),s=>Object.assign(s,dp)),reducers:{initializeIssueCommentAttachments:_e.initialize,addIssueCommentAttachment:_e.addOne,addIssueCommentAttachments:_e.addMany,setIssueCommentAttachment:_e.setOne,setIssueCommentAttachments:_e.setMany,updateIssueCommentAttachment:_e.updateOne,updateIssueCommentAttachments:_e.updateMany,deleteIssueCommentAttachment:_e.deleteOne,deleteIssueCommentAttachments:_e.deleteMany}}),{initializeIssueCommentAttachments:rp,addIssueCommentAttachment:up,addIssueCommentAttachments:lp,setIssueCommentAttachment:op,setIssueCommentAttachments:hp,updateIssueCommentAttachment:mp,updateIssueCommentAttachments:yp,deleteIssueCommentAttachment:pp,deleteIssueCommentAttachments:Ap}=Ei.actions,fp=t=>t.issueCommentAttachmentReducer.instances,Bi=o.createSelector([fp],t=>Object.values(t)),Sp=t=>s=>s.issueCommentAttachmentReducer.instances[t],Tp=T(o.createSelector([Bi,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),tP=T(o.createSelector([Bi,(t,s)=>s],(t,s)=>I(t.filter(({issue_comment:e})=>s===e)))),Ip=Ei.reducer,Me=_(t=>t.uuid),Op={instances:{}},ji=o.createSlice({name:"issueComments",initialState:Op,extraReducers:t=>t.addMatcher(o.isAnyOf(g,B,M),s=>Object.assign(s,Op)),reducers:{initializeIssueComments:Me.initialize,addIssueComment:Me.addOne,addIssueComments:Me.addMany,setIssueComment:Me.setOne,setIssueComments:Me.setMany,updateIssueComment:Me.updateOne,updateIssueComments:Me.updateMany,deleteIssueComment:Me.deleteOne,deleteIssueComments:Me.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,Vp=t=>s=>s.issueCommentReducer.instances[t],zp=T(o.createSelector([qi,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(Object.values(t).filter(({uuid:n})=>e.has(n)))})),sP=T(o.createSelector([qi,(t,s)=>s],(t,s)=>I(Object.values(t).filter(e=>e.issue===s)))),Ep=ji.reducer,Re=_(t=>t.uuid),Bp={instances:{}},Di=o.createSlice({name:"issues",initialState:Bp,extraReducers:t=>t.addMatcher(o.isAnyOf(g,B,M),s=>Object.assign(s,Bp)),reducers:{initializeIssues:Re.initialize,addIssue:Re.addOne,addIssues:Re.addMany,setIssue:Re.setOne,setIssues:Re.setMany,updateIssue:Re.updateOne,updateIssues:Re.updateMany,deleteIssue:Re.deleteOne,deleteIssues:Re.deleteMany}}),{initializeIssues:jp,addIssue:qp,addIssues:$i,setIssue:Dp,setIssues:$p,updateIssue:Up,updateIssues:Cp,deleteIssue:Lp,deleteIssues:Ui}=Di.actions,kp=t=>t.issueReducer.instances,Mt=o.createSelector([kp],t=>Object.values(t)),Np=t=>s=>s.issueReducer.instances[t],Gp=T(o.createSelector([Mt,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),iP=T(o.createSelector([Mt,(t,s)=>s],(t,s)=>t.filter(e=>e.project===s))),Hp=T(o.createSelector([Mt,(t,s)=>s],(t,s)=>t.filter(e=>e.issue_type===s))),Wp=Di.reducer,we=_(t=>t.uuid),Kp={instances:{}},Ci=o.createSlice({name:"issueTypeAttachments",initialState:Kp,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),s=>Object.assign(s,Kp)),reducers:{initializeIssueTypeAttachments:we.initialize,addIssueTypeAttachment:we.addOne,addIssueTypeAttachments:we.addMany,setIssueTypeAttachment:we.setOne,setIssueTypeAttachments:we.setMany,updateIssueTypeAttachment:we.updateOne,updateIssueTypeAttachments:we.updateMany,deleteIssueTypeAttachment:we.deleteOne,deleteIssueTypeAttachments:we.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=o.createSelector([iA],t=>Object.values(t)),nA=t=>s=>s.issueTypeAttachmentReducer.instances[t],aA=T(o.createSelector([Li,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),nP=T(o.createSelector([Li,(t,s)=>s],(t,s)=>I(t.filter(({issue_type:e})=>s===e)))),cA=Ci.reducer,ve=_(t=>t.uuid),dA={instances:{}},ki=o.createSlice({name:"issueTypeFieldsAttachments",initialState:dA,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),s=>Object.assign(s,dA)),reducers:{initializeIssueTypeFieldsAttachments:ve.initialize,addIssueTypeFieldsAttachment:ve.addOne,addIssueTypeFieldsAttachments:ve.addMany,setIssueTypeFieldsAttachment:ve.setOne,setIssueTypeFieldsAttachments:ve.setMany,updateIssueTypeFieldsAttachment:ve.updateOne,updateIssueTypeFieldsAttachments:ve.updateMany,deleteIssueTypeFieldsAttachment:ve.deleteOne,deleteIssueTypeFieldsAttachments:ve.deleteMany}}),{initializeIssueTypeFieldsAttachments:rA,addIssueTypeFieldsAttachment:uA,addIssueTypeFieldsAttachments:lA,setIssueTypeFieldsAttachment:oA,setIssueTypeFieldsAttachments:hA,updateIssueTypeFieldsAttachment:mA,updateIssueTypeFieldsAttachments:yA,deleteIssueTypeFieldsAttachment:pA,deleteIssueTypeFieldsAttachments:AA}=ki.actions,fA=t=>t.issueTypeFieldsAttachmentReducer.instances,Ni=o.createSelector([fA],t=>Object.values(t)),aP=T(o.createSelector([Ni,(t,s)=>s],(t,s)=>I(t.filter(e=>e.fields_revision===s)))),SA=t=>s=>s.issueTypeFieldsAttachmentReducer.instances[t],TA=T(o.createSelector([Ni,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),IA=ki.reducer,Ve=_(t=>t.uuid),OA={instances:{}},Gi=o.createSlice({name:"issueTypeFieldValues",initialState:OA,extraReducers:t=>t.addMatcher(o.isAnyOf(g,B,M),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}=Gi.actions,VA=t=>t.issueTypeFieldValuesReducer.instances,Rt=o.createSelector([VA],t=>Object.values(t)),cP=T(o.createSelector([Rt,(t,s)=>s],(t,s)=>I(t.filter(e=>e.issue===s)))),zA=t=>s=>s.issueTypeFieldValuesReducer.instances[t],EA=T(o.createSelector([Rt,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),BA=Gi.reducer,ze=_(t=>t.uuid),jA={instances:{}},Hi=o.createSlice({name:"issueTypeFields",initialState:jA,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),s=>Object.assign(s,jA)),reducers:{initializeIssueTypeFields:ze.initialize,addIssueTypeFields:ze.addOne,addIssueTypeFieldsMany:ze.addMany,setIssueTypeFields:ze.setOne,setIssueTypeFieldsMany:ze.setMany,updateIssueTypeFields:ze.updateOne,updateIssueTypeFieldsMany:ze.updateMany,deleteIssueTypeFields:ze.deleteOne,deleteIssueTypeFieldsMany:ze.deleteMany}}),{initializeIssueTypeFields:qA,addIssueTypeFields:DA,addIssueTypeFieldsMany:$A,setIssueTypeFields:UA,setIssueTypeFieldsMany:CA,updateIssueTypeFields:LA,updateIssueTypeFieldsMany:kA,deleteIssueTypeFields:NA,deleteIssueTypeFieldsMany:GA}=Hi.actions,HA=t=>t.issueTypeFieldsReducer.instances,ut=o.createSelector([HA],t=>Object.values(t)),dP=T(o.createSelector([ut,(t,s)=>s],(t,s)=>I(t.filter(e=>e.issue_type===s)))),rP=T(o.createSelector([ut,(t,s)=>s],(t,s)=>t.filter(e=>e.issue_type===s).sort((e,n)=>e.submitted_at>n.submitted_at?-1:1)[0])),uP=T(o.createSelector([ut,Rt,(t,s)=>s],(t,s,e)=>{const n=new Set(t.filter(a=>a.issue_type===e).map(a=>a.uuid));return I(s.filter(a=>n.has(a.fields_revision)))})),WA=t=>s=>s.issueTypeFieldsReducer.instances[t],KA=T(o.createSelector([ut,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),YA=Hi.reducer,Ee=_(t=>t.uuid),ZA={instances:{}},Wi=o.createSlice({name:"issueTypeFieldValuesAttachments",initialState:ZA,extraReducers:t=>t.addMatcher(o.isAnyOf(g,B,M),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,nf=t=>t.issueTypeFieldValuesAttachmentReducer.instances,Zi=o.createSelector([nf],t=>Object.values(t)),af=t=>s=>s.issueTypeFieldValuesAttachmentReducer.instances[t],cf=T(o.createSelector([Zi,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),df=T(o.createSelector([Zi,(t,s)=>s],(t,s)=>I(t.filter(e=>e.field_values===s)))),rf=Wi.reducer,Be=_(t=>t.uuid),uf={instances:{}},Ji=o.createSlice({name:"issueTypeIdentifiers",initialState:uf,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),s=>Object.assign(s,uf)),reducers:{initializeIssueTypeIdentifiers:Be.initialize,addIssueTypeIdentifier:Be.addOne,addIssueTypeIdentifiers:Be.addMany,setIssueTypeIdentifier:Be.setOne,setIssueTypeIdentifiers:Be.setMany,updateIssueTypeIdentifier:Be.updateOne,updateIssueTypeIdentifiers:Be.updateMany,deleteIssueTypeIdentifier:Be.deleteOne,deleteIssueTypeIdentifiers:Be.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=o.createSelector([Tf],t=>Object.values(t)),If=t=>s=>s.issueTypeIdentifierReducer.instances[t],Of=T(o.createSelector([Xi,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),lP=T(o.createSelector([Xi,(t,s)=>s],(t,s)=>I(t.filter(e=>e.issue_type===s)))),Ff=Ji.reducer,je=_(t=>t.uuid),Pf={instances:{}},Qi=o.createSlice({name:"issueTypeIdentifierValues",initialState:Pf,extraReducers:t=>t.addMatcher(o.isAnyOf(g,B,M),s=>Object.assign(s,Pf)),reducers:{initializeIssueTypeIdentifierValues:je.initialize,addIssueTypeIdentifierValue:je.addOne,addIssueTypeIdentifierValues:je.addMany,setIssueTypeIdentifierValue:je.setOne,setIssueTypeIdentifierValues:je.setMany,updateIssueTypeIdentifierValue:je.updateOne,updateIssueTypeIdentifierValues:je.updateMany,deleteIssueTypeIdentifierValue:je.deleteOne,deleteIssueTypeIdentifierValues:je.deleteMany}}),{initializeIssueTypeIdentifierValues:gf,addIssueTypeIdentifierValue:bf,addIssueTypeIdentifierValues:_f,setIssueTypeIdentifierValue:Mf,setIssueTypeIdentifierValues:Rf,updateIssueTypeIdentifierValue:wf,updateIssueTypeIdentifierValues:vf,deleteIssueTypeIdentifierValue:Vf,deleteIssueTypeIdentifierValues:zf}=Qi.actions,Ef=t=>t.issueTypeIdentifierValueReducer.instances,wt=o.createSelector([Ef],t=>Object.values(t)),Bf=t=>s=>s.issueTypeIdentifierValueReducer.instances[t],jf=T(o.createSelector([wt,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),oP=T(o.createSelector([wt,(t,s)=>s],(t,s)=>I(t.filter(e=>e.issue===s)))),hP=T(o.createSelector([wt,(t,s)=>s],(t,s)=>I(t.filter(e=>e.issue_type_identifier===s)))),qf=Qi.reducer,qe=_(t=>t.uuid),Df={instances:{}},xi=o.createSlice({name:"issueTypes",initialState:Df,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),s=>Object.assign(s,Df)),reducers:{initializeIssueTypes:qe.initialize,addIssueType:qe.addOne,addIssueTypes:qe.addMany,setIssueType:qe.setOne,setIssueTypes:qe.setMany,updateIssueType:qe.updateOne,updateIssueTypes:qe.updateMany,deleteIssueType:qe.deleteOne,deleteIssueTypes:qe.deleteMany}}),{initializeIssueTypes:$f,addIssueType:Uf,addIssueTypes:Cf,setIssueType:Lf,setIssueTypes:kf,updateIssueType:Nf,updateIssueTypes:Gf,deleteIssueType:Hf,deleteIssueTypes:Wf}=xi.actions,Kf=t=>t.issueTypeReducer.instances,en=o.createSelector(Kf,t=>Object.values(t)),Yf=t=>s=>s.issueTypeReducer.instances[t],Zf=T(o.createSelector([en,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),mP=T(o.createSelector([en,(t,s)=>s],(t,s)=>I(t.filter(e=>e.organization===s)))),Jf=xi.reducer,De=_(t=>t.uuid),Xf={instances:{}},tn=o.createSlice({name:"issueTypeStatuses",initialState:Xf,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),s=>Object.assign(s,Xf)),reducers:{initializeIssueTypeStatuses:De.initialize,addIssueTypeStatus:De.addOne,addIssueTypeStatuses:De.addMany,setIssueTypeStatus:De.setOne,setIssueTypeStatuses:De.setMany,updateIssueTypeStatus:De.updateOne,updateIssueTypeStatuses:De.updateMany,deleteIssueTypeStatus:De.deleteOne,deleteIssueTypeStatuses:De.deleteMany}}),{initializeIssueTypeStatuses:Qf,addIssueTypeStatus:xf,addIssueTypeStatuses:eS,setIssueTypeStatus:tS,setIssueTypeStatuses:sS,updateIssueTypeStatus:iS,updateIssueTypeStatuses:nS,deleteIssueTypeStatus:aS,deleteIssueTypeStatuses:cS}=tn.actions,dS=t=>t.issueTypeStatusReducer.instances,sn=o.createSelector([dS],t=>I(Object.values(t).toSorted(ta))),nn=t=>s=>s.issueTypeStatusReducer.instances[t],rS=T(o.createSelector([sn,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),yP=T(o.createSelector([sn,(t,s)=>s],(t,s)=>I(t.filter(e=>e.issue_type===s)))),uS=tn.reducer,$e=_(t=>t.uuid),lS={instances:{}},an=o.createSlice({name:"issueUpdates",initialState:lS,extraReducers:t=>t.addMatcher(o.isAnyOf(g,B,M),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:cn,addIssueUpdates:dn,setIssueUpdate:hS,setIssueUpdates:mS,updateIssueUpdate:yS,updateIssueUpdates:pS,deleteIssueUpdate:rn,deleteIssueUpdates:un}=an.actions,ln=t=>t.issueUpdateReducer.instances,on=o.createSelector([ln],t=>Object.values(t)),AS=T(o.createSelector([ln,(t,s)=>s],(t,s)=>t[s])),fS=T(o.createSelector([on,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),SS=T(o.createSelector([on,(t,s)=>s],(t,s)=>I(t.filter(e=>e.issue===s)))),TS=an.reducer,Ue=_(t=>t.id),IS={instances:{},currentUser:null},hn=o.createSlice({name:"users",initialState:IS,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),s=>Object.assign(s,IS)),reducers:{initializeUsers:Ue.initialize,setUsers:Ue.setMany,setUser:Ue.setOne,addUsers:Ue.addMany,addUser:Ue.addOne,updateUsers:Ue.updateMany,updateUser:Ue.updateOne,deleteUser:Ue.deleteOne,deleteUsers:Ue.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:mn,updateUsers:bS,updateUser:_S,deleteUser:yn,deleteUsers:MS,setCurrentUser:pP,setProfilePicture:AP}=hn.actions,RS=hn.reducer,wS=t=>t.userReducer.currentUser,pn=t=>t.userReducer.instances,vt=o.createSelector([pn],t=>Object.values(t)),Vt=t=>s=>s.userReducer.instances[t],vS=T(o.createSelector([vt,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({id:n})=>e.has(n)))})),Ce=_(t=>t.uuid),VS={instances:{}},An=o.createSlice({name:"organizationAccess",initialState:VS,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),s=>Object.assign(s,VS)),reducers:{initializeOrganizationAccesses:Ce.initialize,addOrganizationAccess:Ce.addOne,addOrganizationAccesses:Ce.addMany,setOrganizationAccess:Ce.setOne,setOrganizationAccesses:Ce.setMany,updateOrganizationAccess:Ce.updateOne,updateOrganizationAccesses:Ce.updateMany,deleteOrganizationAccess:Ce.deleteOne,deleteOrganizationAccesses:Ce.deleteMany}}),{initializeOrganizationAccesses:zS,addOrganizationAccess:ES,addOrganizationAccesses:BS,setOrganizationAccess:jS,setOrganizationAccesses:qS,updateOrganizationAccess:DS,updateOrganizationAccesses:$S,deleteOrganizationAccess:US,deleteOrganizationAccesses:CS}=An.actions,LS=An.reducer,zt=t=>t.organizationAccessReducer.instances,kS=t=>s=>s.organizationAccessReducer.instances[t],NS=T(o.createSelector([zt,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(Object.values(t).filter(({uuid:n})=>e.has(n)))})),fP=o.createSelector([wS,zt],(t,s)=>Object.values(s).find(n=>n.user===(t==null?void 0:t.id))??null),GS=o.createSelector([zt],t=>{const s={};for(const e of Object.values(t))s[e.user]=e;return ht(s)}),SP=T(o.createSelector([pn,GS,(t,s)=>s],(t,s,e)=>I(Object.values(t).filter(n=>{const a=s[n.id];return!!a&&a.organization===e})))),Le=_(t=>t.uuid),HS={instances:{}},fn=o.createSlice({name:"organizations",initialState:HS,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),s=>Object.assign(s,HS)),reducers:{initializeOrganizations:Le.initialize,setOrganizations:Le.setMany,setOrganization:Le.setOne,addOrganizations:Le.addMany,addOrganization:Le.addOne,updateOrganizations:Le.updateMany,updateOrganization:Le.updateOne,deleteOrganization:Le.deleteOne,deleteOrganizations:Le.deleteMany}}),{initializeOrganizations:WS,setOrganizations:KS,setOrganization:YS,addOrganizations:ZS,addOrganization:JS,updateOrganizations:XS,updateOrganization:QS,deleteOrganization:xS,deleteOrganizations:eT}=fn.actions,tT=t=>t.organizationReducer.instances,sT=o.createSelector([tT],t=>Object.values(t)),iT=t=>s=>s.organizationReducer.instances[t],nT=T(o.createSelector([sT,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),aT=fn.reducer,cT=(t,s,e)=>{const n=t.uuid?t:{...t,uuid:xe.v4()};return{payload:n,type:"",meta:{offline:{effect:{timestamp:new Date().toISOString(),request:n,BASE_URL:s,serviceName:e}}}}},dT={deletedRequests:[],latestRetryTime:0},Sn=o.createSlice({name:"outbox",initialState:dT,extraReducers:t=>t.addCase(g,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,...n}=t;return cT(n,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}=Sn.actions,oT=Sn.reducer,ke=_(t=>t.uuid),hT={instances:{}},Tn=o.createSlice({name:"projectAccess",initialState:hT,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),s=>Object.assign(s,hT)),reducers:{initializeProjectAccesses:ke.initialize,addProjectAccess:ke.addOne,addProjectAccesses:ke.addMany,setProjectAccess:ke.setOne,setProjectAccesses:ke.setMany,updateProjectAccess:ke.updateOne,updateProjectAccesses:ke.updateMany,deleteProjectAccess:ke.deleteOne,deleteProjectAccesses:ke.deleteMany}}),{initializeProjectAccesses:mT,addProjectAccess:yT,addProjectAccesses:pT,setProjectAccess:AT,setProjectAccesses:fT,updateProjectAccess:ST,updateProjectAccesses:TT,deleteProjectAccess:IT,deleteProjectAccesses:OT}=Tn.actions,FT=Tn.reducer,In=t=>t.projectAccessReducer.instances,lt=o.createSelector(In,t=>Object.values(t)),PT=t=>s=>s.projectAccessReducer.instances[t],gT=T(o.createSelector([lt,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),FP=T(o.createSelector([In,(t,s)=>s],(t,s)=>I(Object.values(t).filter(e=>e.project===s)))),PP=T(o.createSelector([lt,(t,s)=>s],(t,s)=>{const e={};for(const n of t.filter(a=>a.project===s))e[n.user]=n;return e})),gP=T(o.createSelector([vt,lt,(t,s)=>s],(t,s,e)=>{const n=new Set(s.filter(a=>a.project===e).map(a=>a.user));return I(t.filter(a=>n.has(a.id)))})),Ne=_(t=>t.uuid),bT={instances:{}},On=o.createSlice({name:"projectAttachments",initialState:bT,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),s=>Object.assign(s,bT)),reducers:{initializeProjectAttachments:Ne.initialize,addProjectAttachment:Ne.addOne,addProjectAttachments:Ne.addMany,setProjectAttachment:Ne.setOne,setProjectAttachments:Ne.setMany,updateProjectAttachment:Ne.updateOne,updateProjectAttachments:Ne.updateMany,deleteProjectAttachment:Ne.deleteOne,deleteProjectAttachments:Ne.deleteMany}}),{initializeProjectAttachments:_T,addProjectAttachment:MT,addProjectAttachments:RT,setProjectAttachment:wT,setProjectAttachments:vT,updateProjectAttachment:VT,updateProjectAttachments:zT,deleteProjectAttachment:ET,deleteProjectAttachments:BT}=On.actions,jT=t=>t.projectAttachmentReducer.instances,Fn=o.createSelector([jT],t=>Object.values(t)),qT=t=>s=>s.projectAttachmentReducer.instances[t],DT=T(o.createSelector([Fn,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),bP=T(o.createSelector([Fn,(t,s)=>s],(t,s)=>I(t.filter(({project:e})=>s===e)))),$T=On.reducer,Ge=_(t=>t.uuid),UT={instances:{},activeProjectFileId:null,isImportingProjectFile:!1},Pn=o.createSlice({name:"projectFiles",initialState:UT,extraReducers:t=>t.addMatcher(o.isAnyOf(g,B,M),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:kT,addProjectFile:NT,addProjectFiles:GT,updateProjectFile:HT,updateProjectFiles:WT,deleteProjectFile:KT,deleteProjectFiles:YT,setIsImportingProjectFile:ZT,setActiveProjectFileId:JT,saveActiveProjectFileBounds:XT}=Pn.actions,QT=t=>t.projectFileReducer.instances,xT=o.createSelector([QT],t=>I(Object.values(t).sort((s,e)=>s.z_index-e.z_index))),eI=t=>s=>s.projectFileReducer.instances[t],tI=T(o.createSelector([xT,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),_P=t=>t.projectFileReducer.activeProjectFileId,MP=t=>t.projectFileReducer.isImportingProjectFile,sI=Pn.reducer,He=_(t=>t.uuid),iI={instances:{}},gn=o.createSlice({name:"projects",initialState:iI,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),s=>Object.assign(s,iI)),reducers:{initializeProjects:He.initialize,setProjects:He.setMany,setProject:He.setOne,addProjects:He.addMany,addProject:He.addOne,updateProjects:He.updateMany,updateProject:He.updateOne,deleteProject:He.deleteOne,deleteProjects:He.deleteMany}}),{initializeProjects:nI,setProjects:aI,setProject:cI,addProjects:dI,addProject:rI,updateProjects:uI,updateProject:lI,deleteProject:oI,deleteProjects:hI}=gn.actions,mI=gn.reducer,yI=t=>t.projectReducer.instances,Et=o.createSelector([yI],t=>I(Object.values(t))),pI=t=>s=>s.projectReducer.instances[t],AI=T(o.createSelector([Et,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),RP=T(o.createSelector([Et,lt,(t,s)=>s],(t,s,e)=>{const n=new Set(s.filter(a=>a.user===e).map(a=>a.project));return I(t.filter(a=>n.has(a.uuid)))})),wP=T(o.createSelector([Et,(t,s)=>s],(t,s)=>I(t.filter(e=>e.organization===s)))),vP={isRehydrated:!1},bn=o.createSlice({name:"rehydrated",initialState:vP,reducers:{setRehydrated:(t,s)=>{t.isRehydrated=s.payload}}}),{setRehydrated:VP}=bn.actions,zP=t=>t.rehydratedReducer.isRehydrated,fI=bn.reducer,We=_(t=>t.uuid),SI={instances:{}},_n=o.createSlice({name:"teamMemberships",initialState:SI,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),s=>Object.assign(s,SI)),reducers:{initializeTeamMemberships:We.initialize,addTeamMembership:We.addOne,addTeamMemberships:We.addMany,setTeamMembership:We.setOne,setTeamMemberships:We.setMany,updateTeamMembership:We.updateOne,updateTeamMemberships:We.updateMany,deleteTeamMembership:We.deleteOne,deleteTeamMemberships:We.deleteMany}}),{initializeTeamMemberships:TI,addTeamMembership:II,addTeamMemberships:OI,setTeamMembership:FI,setTeamMemberships:PI,updateTeamMembership:gI,updateTeamMemberships:bI,deleteTeamMembership:_I,deleteTeamMemberships:MI}=_n.actions,RI=_n.reducer,wI=t=>t.teamMembershipReducer.instances,Bt=o.createSelector([wI],t=>Object.values(t)),vI=t=>s=>s.teamMembershipReducer.instances[t],VI=T(o.createSelector([Bt,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),EP=T(o.createSelector([Bt,(t,s)=>s],(t,s)=>{const e={};for(const n of t.filter(a=>a.team===s))e[n.user]=n;return e})),BP=T(o.createSelector([vt,Bt,(t,s)=>s],(t,s,e)=>{const n=new Set(s.filter(a=>a.team===e).map(a=>a.user));return I(t.filter(a=>n.has(a.id)))})),Ke=_(t=>t.uuid),zI={instances:{}},Mn=o.createSlice({name:"teams",initialState:zI,extraReducers:t=>t.addMatcher(o.isAnyOf(g,M),s=>Object.assign(s,zI)),reducers:{initializeTeams:Ke.initialize,addTeam:Ke.addOne,addTeams:Ke.addMany,setTeam:Ke.setOne,setTeams:Ke.setMany,updateTeam:Ke.updateOne,updateTeams:Ke.updateMany,deleteTeam:Ke.deleteOne,deleteTeams:Ke.deleteMany}}),{initializeTeams:EI,addTeam:BI,addTeams:jI,setTeam:qI,setTeams:DI,updateTeam:$I,updateTeams:UI,deleteTeam:CI,deleteTeams:LI}=Mn.actions,kI=t=>t.teamReducer.instances,Rn=o.createSelector([kI],t=>Object.values(t)),NI=t=>s=>s.teamReducer.instances[t],GI=T(o.createSelector([Rn,(t,s)=>s],(t,s)=>{const e=new Set(s);return I(t.filter(({uuid:n})=>e.has(n)))})),jP=T(o.createSelector([Rn,(t,s)=>s],(t,s)=>I(t.filter(e=>e.organization===s)))),HI=Mn.reducer,qP={version:0},WI=o.createSlice({name:"versioning",initialState:qP,reducers:{}}),KI=WI.reducer,wn={outboxReducer:oT,fileReducer:jh,authReducer:wo},DP=o.combineReducers(wn),YI={...wn,[at]:KI,categoryReducer:ko,assetReducer:jr,assetAttachmentReducer:Oa,assetStageCompletionReducer:Wr,assetStageReducer:du,assetTypeReducer:ho,assetTypeAttachmentReducer:Fu,issueReducer:Wp,issueAttachmentReducer:cp,issueTypeReducer:Jf,issueTypeAttachmentReducer:cA,organizationReducer:aT,projectReducer:mI,projectAttachmentReducer:$T,projectAccessReducer:FT,organizationAccessReducer:LS,projectFileReducer:sI,rehydratedReducer:fI,formReducer:Gm,formRevisionReducer:Em,formRevisionAttachmentReducer:Pm,formSubmissionAttachmentReducer:ay,formSubmissionReducer:Sy,formIdentifierReducer:Zh,formIdentifierValueReducer:um,userReducer:RS,emailDomainsReducer:vh,documentsReducer:Ah,documentAttachmentReducer:sh,teamReducer:HI,agentsReducer:ra,issueCommentReducer:Ep,issueCommentAttachmentReducer:Ip,issueUpdateReducer:TS,geoImageReducer:zy,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:Dl,assetTypeIdentifierValueReducer:Xl,assetTypeStatusReducer:_o,assetProcedureTypeReducer:cd,assetProcedureReducer:Hc,assetProcedureTypeFieldsReducer:cc,assetProcedureTypeFieldValuesReducer:Ec,assetProcedureTypeFieldsAttachmentReducer:Wa,assetProcedureTypeFieldValuesAttachmentReducer:Sc,assetProcedureTypeAttachmentReducer:za,assetProcedureStepFieldsAttachmentReducer:Pd,assetProcedureStepFieldsReducer:qd,assetProcedureStepFieldValuesAttachmentReducer:Zd,assetProcedureStepFieldValuesReducer:ur,assetProcedureStepReducer:Ir,teamMembershipReducer:RI},$P=o.combineReducers(YI);function UP(t,s){return FO.useMemo(t,s)}class CP{constructor(s){m(this,"operations",[]);m(this,"getData");this.getData=s}performOperations(s){let e=s;for(const n of this.operations)e=n(e);return e}filter(s,e){return this.operations.push(n=>n.filter(a=>a[s]===e)),this}exclude(s,e){return this.operations.push(n=>n.filter(a=>a[s]!==e)),this}orderBy(s){return this.operations.push(e=>[...e].sort((n,a)=>n[s]<=a[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 o.createSelector([this.getData],n=>this.performOperations(n).find(a=>a[s]===e))}count(){return o.createSelector([this.getData],s=>this.performOperations(s).length)}first(){return o.createSelector([this.getData],s=>this.performOperations(s)[0])}last(){return o.createSelector([this.getData],s=>{const e=this.performOperations(s);return e[e.length-1]})}exists(){return o.createSelector([this.getData],s=>this.performOperations(s).length>0)}toSelector(){return o.createSelector([this.getData],s=>I(this.performOperations(s)))}}const ZI=1e4,JI=200,vn=[400,409,403,404,405,500],XI={};class QI{constructor(s){m(this,"client");m(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[at]={version:xI()},t),tO=()=>eO({}),LP=t=>(t.outboxReducer&&(t.outboxReducer.deletedRequests=[]),t),kP=t=>s=>{var e;return s===void 0&&(s={}),((e=s[at])==null?void 0:e.version)===xI()?s:t(s)},sO=[eO,tO,tO,LP],NP=Object.fromEntries(sO.map((t,s)=>[s,kP(t)])),GP=t=>{if(t)throw t;const s=nt();s?s.dispatch({type:"rehydrated/setRehydrated",payload:!0}):console.error("Client store not set")},iO=(t,s,e)=>{const n=Xe();return n?(n.addRequest(s),n.getQueue()):(console.warn("Outbox coordinator not set; cannot enqueue request yet."),[])},nO=(t,s,e)=>{const n=Xe();if(!n)return console.warn("Outbox coordinator not set; cannot dequeue request yet."),[];const c=s.meta.offlineAction.payload.uuid;return n.remove(c),n.getQueue()};async function HP(t,s){if(!s.payload)throw new Error("Received empty payload");return fO(s)}const WP={...$n,effect:HP,discard:cO,returnPromises:!0,persistCallback:GP,retry:JP,persistOptions:{storage:gO},queue:{...$n.queue,enqueue:iO,dequeue:nO,peek:(...t)=>ZP(...t)}},KP=bO(NP,at),YP=o.compose(PO.offline(WP),KP);async function aO(t,s,e){if(s.store.getState().outboxReducer.deletedRequests.includes(t.payload.uuid))throw new Error("Request was marked for deletion");const a=XI[t.meta.offline.effect.serviceName];if(!a)throw new Error(`Service ${t.meta.offline.effect.serviceName} not found`);return Bn(t.meta.offline.effect.BASE_URL,t.meta.offline.effect.request,s,a,e)}function cO(t,s,e=0){var d;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,`
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
- `):c.map(d=>`${n}: ${d}`).join(`
7
- `):`${n}: ${JSON.stringify(c)}`).join(`
8
- `)}catch(n){console.error("Failed to extract error message from response body",n)}}else typeof t.body=="string"&&(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
9
- expected hash (${a}). This can happen if you're using a local development server and the
4
+ Retries:`,e),!(t instanceof Error))throw console.error("ENCOUNTERED NON-ERROR ERROR:",t,"(throwing immediately, which may lead to unexpected behavior)"),t;const n=nt(),c=n.getState().outboxReducer.deletedRequests,r=s.payload.uuid;function l(){n.dispatch(uT(r));const h=Xe();if(!h)throw new Error("Outbox coordinator not set");h.remove(s.payload.uuid);const y=s.meta.offline.rollback;throw y&&(console.warn("Rolling back request due to SDK error:",s),n.dispatch(y)),t}if(t instanceof $&&t.options.discard&&(console.debug("Discarding request due to explicit discard:",s),l()),c.includes(r)&&(console.debug("Discarding request due to deletion:",s),l()),t instanceof $){const h=t.status||((d=t.response)==null?void 0:d.status);if(h||console.warn("Error has no status code:",t),h!==void 0&&vn.includes(h)){console.warn("Discarding request due to error:",t,`
5
+ Action:`,s);const y=Xe();if(!y)throw new Error("Outbox coordinator not set");y.remove(s.payload.uuid),t.options.discard=!0,l()}}console.debug("Registering a retry for request:",s.payload.uuid);const u=Xe();if(!u)throw new Error("Outbox coordinator not set");return u.registerRetry(s.payload.uuid),!1}function ZP(t,s,e){var n;return(n=Xe())==null?void 0:n.peek()}function JP(t,s){return nt().dispatch(lT(new Date().getTime())),Hn}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 n=t.body;if(typeof n.error=="string")e=n.error;else if(typeof n.message=="string")e=n.message;else try{e=Object.entries(n).map(([a,c])=>typeof c=="string"?dO.includes(a)?c:`${a}: ${c}`:Array.isArray(c)?dO.includes(a)?c.join(`
6
+ `):c.map(r=>`${a}: ${r}`).join(`
7
+ `):`${a}: ${JSON.stringify(c)}`).join(`
8
+ `)}catch(a){console.error("Failed to extract error message from response body",a)}}else typeof t.body=="string"&&(e=t.body);else t!=null&&t.text?e=t.text:s instanceof Error&&(e=s.message);return!e||e.length>XP?tt:e}class $ extends Error{constructor(e){super(tt);m(this,"status");m(this,"response");m(this,"message");m(this,"options");const{response:n,innerError:a}=e;this.message=e.message??QP(n,a)??tt,this.status=(n==null?void 0:n.status)??0,this.response=n,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(a=>a in e)}if(s(t))return t;if(typeof t=="object"&&t!==null){const e=t;if(s(e.response))return e.response;if(e.response&&s(e.response.response))return e.response.response}}class xP extends QI{constructor(s){super(s)}}class Ze extends QI{constructor(e,n){super(e);m(this,"auth");this.auth=n}}class eg extends Ze{async startConversation(s,e){return this.enqueueRequest({description:"Start agent conversation",method:f.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:e},blockers:["prompt"],blocks:["prompt"]}).then(n=>(this.dispatch(aa(n)),n))}async continueConversation(s,e,n){return this.enqueueRequest({description:"Prompt agent",method:f.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:n},blockers:["prompt"],blocks:["prompt"],queryParams:{conversation_id:e}}).then(a=>{this.dispatch(da(a))})}async fetchDetails(s){return this.enqueueRequest({description:"Get agent conversation",method:f.GET,url:`/agents/conversations/${s}/`,blockers:["conversation"],blocks:["conversation"]}).then(e=>{this.dispatch(ca(e))})}async rate(s,e){return this.enqueueRequest({description:"Rate agent response",method:f.PUT,url:`/agents/responses/${s}/rate/`,payload:{rating:e},blockers:["rate"],blocks:["rate"]})}async list(s,e){return this.performRequest({method:f.GET,url:"/agents/conversations/",...s},e)}async refreshStore(s,e){const n=await this.list({queryParams:{project:s}},e);return this.dispatch(na(n)),n}}class w extends Ze{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:f.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:f.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:f.GET,...s},e)}}class Ye extends w{constructor(){super(...arguments);m(this,"pageSize",JI)}async _bulkAdd(e){var p;const{store:n}=this.client,{addMany:a,updateMany:c,deleteMany:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=[],h=[],y={};for(const S of e){const{modelUuid:F,file:O}=S,P=await this.client.files.getFilePayload(O);P.sha1 in y||(y[P.sha1]=P);const R=this.buildModel({file:O,file_sha1:P.sha1,submitted_at:u,created_by:l,modelUuid:F});d.push(R),h.push(this.buildPayload(R,P))}this.dispatch(a(d));const A=this.enqueueRequest({description:`Add ${this.name}`,method:f.POST,url:`${this.url}/bulk/`,payload:{submitted_at:u,attachments:h,files:Object.values(y)},blocks:d.map(S=>this.getId(S)),blockers:d.map(S=>S.file_sha1)});return A.then(({attachments:S,presigned_urls:F})=>{this.dispatch(c(S)),this.client.files.processPresignedUrls(F)}).catch(()=>{this.dispatch(r(d.map(S=>this.getId(S))))}),[d,A.then(({attachments:S})=>S)]}async _delete(e){const{store:n}=this.client,{addOne:a,deleteOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`Attempting to delete attachment with uuid ${e} that does not exist in the store`);this.dispatch(c(this.getId(l)));const u=this.enqueueRequest({description:`Delete ${this.name}`,method:f.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return u.then(()=>{this.client.files.removeCache(l.file_sha1)}).catch(()=>{this.dispatch(a(l))}),u}}class tg extends Ye{constructor(){super(...arguments);m(this,"name","Asset attachment");m(this,"url","/asset-attachments");m(this,"actions",{addOne:oa,addMany:Wt,setOne:ha,setMany:ma,updateOne:ya,updateMany:pa,deleteOne:Aa,deleteMany:Kt,initialize:la});m(this,"selectors",{selectById:Sa,selectByIds:Ta})}getId(e){return e.uuid}buildModel(e){return b({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,asset:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,asset:e.asset}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.assetUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{asset__project:e}},n)).flat();return this.dispatch(a(r)),r}}class sg extends Ye{constructor(){super(...arguments);m(this,"name","Asset Procedure Attachment");m(this,"url","/asset-procedure-type-attachments");m(this,"actions",{addOne:ga,addMany:ba,setOne:_a,setMany:Ma,updateOne:Ra,updateMany:wa,deleteOne:va,deleteMany:Va,initialize:Pa});m(this,"selectors",{selectById:Ba,selectByIds:ja})}getId(e){return e.uuid}buildModel(e){return b({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,asset_procedure_type:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,asset_procedure_type:e.asset_procedure_type}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.assetProcedureTypeUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class ig extends w{constructor(){super(...arguments);m(this,"name","Asset Procedure Type Fields Attachment");m(this,"url","/asset-procedure-type-fields-attachments");m(this,"actions",{addOne:$a,addMany:Ua,setOne:Ca,setMany:La,updateOne:ka,updateMany:Na,deleteOne:Ga,deleteMany:Ha,initialize:Da});m(this,"selectors",{selectById:Ya,selectByIds:Za})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],h=[];for(const p of e){const{fieldsRevisionUuid:S,fieldIdentifier:F,file:O}=p,P=await this.client.files.getFilePayload(O);P.sha1 in u||(u[P.sha1]=P);const R=b({file:URL.createObjectURL(O),file_type:O.type,file_name:O.name,file_sha1:P.sha1,created_by:l,fields_revision:S,submitted_at:r,field_identifier:F});d.push(R);const V={uuid:R.uuid,file_name:O.name,field_identifier:F,file_extension:P.extension,file_sha1:P.sha1,fields_revision:S};h.push(V)}this.dispatch(n(d));const y=this.enqueueRequest({description:"Add asset procedure type fields attachments",method:f.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(p=>p.fields_revision),blocks:d.map(p=>p.uuid)});return y.then(p=>{this.client.files.processPresignedUrls(p.presigned_urls),this.dispatch(a(p.attachments))}).catch(()=>{this.dispatch(c(d.map(p=>p.uuid)))}),[d,y.then(({attachments:p})=>p)]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class ng extends w{constructor(){super(...arguments);m(this,"name","Asset Procedure Type Fields");m(this,"url","/asset-procedure-type-fields");m(this,"actions",{addOne:Qa,addMany:xa,setOne:ec,setMany:tc,updateOne:sc,updateMany:ic,deleteOne:nc,deleteMany:ac,initialize:Xa});m(this,"selectors",{selectById:rc,selectByIds:uc})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=b({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:"Add Asset Procedure Type Fields",method:f.POST,url:`${this.url}/`,payload:z(d),blockers:[d.asset_procedure_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(r(d.uuid)),A}),[d,h]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}function Je(t,s){const e=[];let n=0;const a=t.length;for(;n<a;)e.push(t.slice(n,n+=s));return e}class ag extends w{constructor(){super(...arguments);m(this,"name","Asset Procedure Type Field Values Attachment");m(this,"url","/asset-procedure-type-field-values-attachments");m(this,"actions",{addOne:hc,addMany:ts,setOne:mc,setMany:yc,updateOne:pc,updateMany:Ac,deleteOne:fc,deleteMany:ss,initialize:oc});m(this,"selectors",{selectById:Ic,selectByIds:Oc})}async bulkAdd(e,n){var p;const{addMany:a,setMany:c,deleteMany:r}=this.actions,l=new Date().toISOString(),u=((p=this.client.store.getState().userReducer.currentUser)==null?void 0:p.id)??null,d=Je(e,n??e.length),h=[],y=[];for(const S of d){const F={},O=[];for(const P of S){const{fieldValuesUuid:R,fieldIdentifier:V,file:v}=P,E=await this.client.files.getFilePayload(v);E.sha1 in F||(F[E.sha1]=E);const j=b({file:URL.createObjectURL(v),file_type:v.type,file_name:v.name,file_sha1:E.sha1,created_by:u,field_values:R,submitted_at:l,field_identifier:V});h.push(j);const D={uuid:j.uuid,file_name:v.name,file_sha1:E.sha1,file_extension:E.extension,field_identifier:V,field_values:R};O.push(D)}y.push({submitted_at:l,attachments:O,files:Object.values(F)})}this.dispatch(a(h));const A=y.map(S=>this.enqueueRequest({description:"Add asset procedure type field values attachments",method:f.POST,url:`${this.url}/bulk/`,payload:S,blockers:S.attachments.map(F=>F.field_values),blocks:S.attachments.map(F=>F.uuid)}));return Promise.all(A).then(S=>{for(const O of S)this.client.files.processPresignedUrls(O.presigned_urls);const F=S.flatMap(O=>O.attachments);this.dispatch(c(F))}).catch(S=>{throw this.dispatch(r(h.map(F=>F.uuid))),S}),[h,A.map(S=>S.then(({attachments:F})=>F))]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:r}=this.selectors,l=n.getState(),u=r(e)(l);this.dispatch(a(e));try{await this.enqueueRequest({description:"Delete asset procedure type field values attachments",method:f.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{field_values__asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class cg extends w{constructor(){super(...arguments);m(this,"name","Asset Procedure Type Field Values");m(this,"url","/asset-procedure-type-field-values");m(this,"actions",{addOne:bc,addMany:_c,setOne:Mc,setMany:Rc,updateOne:wc,updateMany:vc,deleteOne:Vc,deleteMany:zc,initialize:gc});m(this,"selectors",{selectById:jc,selectByIds:qc})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),h=b({...e,created_by:u,submitted_at:d}),y=this.enqueueRequest({description:"Add asset procedure type field values",method:f.POST,url:`${this.url}/`,payload:z(h),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[h.uuid]});return this.dispatch(a(h)),y.then(p=>(this.dispatch(c(p)),p)).catch(()=>{this.dispatch(r(h.uuid))}),[h,y]}bulkAdd(e,n){var p;const{addMany:a,setMany:c,deleteMany:r}=this.actions,l=new Date().toISOString(),u=((p=this.client.store.getState().userReducer.currentUser)==null?void 0:p.id)??null,d=[],h=Je(e.payloads,n??e.payloads.length),y=[];for(const S of h){const F=[];for(const O of S){const P=b({...O,values:O.values,created_by:u,submitted_at:l});d.push(P),F.push({uuid:P.uuid,asset:O.asset,fields_revision:O.fields_revision,asset_procedure:O.asset_procedure,published_at:O.published_at,values:P.values})}y.push({submitted_at:l,values:e.values,field_values:F})}this.dispatch(a(d));const A=[];for(const S of y){const F=S.field_values.map(v=>v.asset),O=S.field_values.map(v=>v.fields_revision),P=S.field_values.map(v=>v.asset_procedure),R=S.field_values.map(v=>v.uuid),V=this.enqueueRequest({description:"Bulk add asset procedure type field values",method:f.POST,url:`${this.url}/bulk/`,payload:S,blockers:[...F,...O,...P],blocks:R});A.push(V)}return Promise.all(A).then(S=>{this.dispatch(c(S.flat()))}).catch(()=>{this.dispatch(r(d.map(S=>S.uuid)))}),[d,A]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`Expected AssetProcedureTypeFieldValues with uuid ${e.uuid} to exist`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:"Update asset procedure type field values",method:f.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[u.fields_revision,u.asset,u.asset_procedure],blocks:[u.uuid]});return d.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected submission with uuid ${e} to exist`);const d=Fc(e)(l);this.dispatch(a(e)),this.dispatch(ss(d.map(h=>h.uuid)));try{await this.enqueueRequest({description:"Delete asset procedure type field values",method:f.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(ts(d)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class dg extends w{constructor(){super(...arguments);m(this,"name","Asset Procedure");m(this,"url","/asset-procedures");m(this,"actions",{addOne:Uc,addMany:cs,setOne:Nc,setMany:Gc,updateOne:Cc,updateMany:Lc,deleteOne:kc,deleteMany:ds,initialize:$c});m(this,"selectors",{selectById:Yc,selectByIds:Zc})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=b({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:"Create asset procedure",method:f.POST,url:`${this.url}/`,payload:z(d),blockers:[e.asset_procedure_type,e.asset_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected asset procedure with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:"Update asset procedure",method:f.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async remove(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected asset procedure with uuid ${e} to exist`);return this.dispatch(a(e)),this.enqueueRequest({description:"Delete asset procedure",method:f.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]}).catch(d=>{throw this.dispatch(c(u)),d})}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(r)),r}}class rg extends w{constructor(){super(...arguments);m(this,"name","Asset Procedure Type");m(this,"url","/asset-procedure-types");m(this,"actions",{addOne:Qc,addMany:xc,setOne:nd,setMany:ad,updateOne:ed,updateMany:td,deleteOne:sd,deleteMany:id,initialize:Xc});m(this,"selectors",{selectById:rd,selectByIds:ud})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=b({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:"Create asset procedure type",method:f.POST,url:`${this.url}/`,payload:z(d),blockers:[],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected asset procedure type with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:"Update asset procedure type",method:f.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async remove(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected asset procedure type with uuid ${e} to exist`);const d=Kc(e)(l);return this.dispatch(a(e)),this.dispatch(ds(d.map(({uuid:h})=>h))),this.enqueueRequest({description:"Delete asset procedure type",method:f.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]}).catch(h=>{throw this.dispatch(c(u)),this.dispatch(cs(d)),h})}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class ug extends w{constructor(){super(...arguments);m(this,"name","Asset Procedure Step Fields Attachment");m(this,"url","/asset-procedure-step-fields-attachments");m(this,"actions",{addOne:hd,addMany:md,setOne:yd,setMany:pd,updateOne:Ad,updateMany:fd,deleteOne:Sd,deleteMany:Td,initialize:od});m(this,"selectors",{selectById:Od,selectByIds:Fd})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],h=[];for(const p of e){const{fieldsRevisionUuid:S,fieldIdentifier:F,file:O}=p,P=await this.client.files.getFilePayload(O);P.sha1 in u||(u[P.sha1]=P);const R=b({file:URL.createObjectURL(O),file_type:O.type,file_name:O.name,file_sha1:P.sha1,created_by:l,fields_revision:S,submitted_at:r,field_identifier:F});d.push(R);const V={uuid:R.uuid,file_name:O.name,field_identifier:F,file_extension:P.extension,file_sha1:P.sha1,fields_revision:S};h.push(V)}this.dispatch(n(d));const y=this.enqueueRequest({description:"Add asset procedure step fields attachments",method:f.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(p=>p.fields_revision),blocks:d.map(p=>p.uuid)});return y.then(p=>{this.client.files.processPresignedUrls(p.presigned_urls),this.dispatch(a(p.attachments))}).catch(()=>{this.dispatch(c(d.map(p=>p.uuid)))}),[d,y.then(({attachments:p})=>p)]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__asset_procedure_step__organization:e}},n);return this.dispatch(a(c)),c}}class lg extends w{constructor(){super(...arguments);m(this,"name","Asset Procedure Step Fields");m(this,"url","/asset-procedure-step-fields");m(this,"actions",{addOne:_d,addMany:Md,setOne:Rd,setMany:wd,updateOne:vd,updateMany:Vd,deleteOne:zd,deleteMany:Ed,initialize:bd});m(this,"selectors",{selectById:Bd,selectByIds:jd})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=b({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:"Add Asset Procedure Step Fields",method:f.POST,url:`${this.url}/`,payload:z(d),blockers:[d.asset_procedure_step],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(r(d.uuid)),A}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,c=n.getState().assetProcedureStepFieldsReducer.instances[e.uuid];if(!c)throw new Error(`AssetProcedureStepFields with uuid ${e.uuid} not found`);const r={...c,...e};this.dispatch(a(r));const l=this.enqueueRequest({description:"Update Asset Procedure Step Fields",method:f.PATCH,url:`${this.url}/${c.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return l.then(u=>{this.dispatch(a(u))}).catch(u=>{throw this.dispatch(a(c)),u}),[r,l]}delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,r=n.getState().assetProcedureStepFieldsReducer.instances[e];if(!r)throw new Error(`AssetProcedureStepFields with uuid ${e} not found`);this.dispatch(a(e));const l=this.enqueueRequest({description:"Delete Asset Procedure Step Fields",method:f.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]});return l.catch(u=>{throw this.dispatch(c(r)),u}),l}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_step__asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class og extends w{constructor(){super(...arguments);m(this,"name","Asset Procedure Step Field Values Attachment");m(this,"url","/asset-procedure-step-field-values-attachments");m(this,"actions",{addOne:Ud,addMany:ps,setOne:Cd,setMany:Ld,updateOne:kd,updateMany:Nd,deleteOne:Gd,deleteMany:As,initialize:$d});m(this,"selectors",{selectById:Wd,selectByIds:Kd})}async bulkAdd(e,n){var p;const{addMany:a,setMany:c,deleteMany:r}=this.actions,l=new Date().toISOString(),u=((p=this.client.store.getState().userReducer.currentUser)==null?void 0:p.id)??null,d=Je(e,n??e.length),h=[],y=[];for(const S of d){const F={},O=[];for(const P of S){const{fieldValuesUuid:R,fieldIdentifier:V,file:v}=P,E=await this.client.files.getFilePayload(v);E.sha1 in F||(F[E.sha1]=E);const j=b({file:URL.createObjectURL(v),file_type:v.type,file_name:v.name,file_sha1:E.sha1,created_by:u,field_values:R,submitted_at:l,field_identifier:V});h.push(j);const D={uuid:j.uuid,file_name:v.name,file_sha1:E.sha1,file_extension:E.extension,field_identifier:V,field_values:R};O.push(D)}y.push({submitted_at:l,attachments:O,files:Object.values(F)})}this.dispatch(a(h));const A=y.map(S=>this.enqueueRequest({description:"Add asset procedure step field values attachments",method:f.POST,url:`${this.url}/bulk/`,payload:S,blockers:S.attachments.map(F=>F.field_values),blocks:S.attachments.map(F=>F.uuid)}));return Promise.all(A).then(S=>{for(const O of S)this.client.files.processPresignedUrls(O.presigned_urls);const F=S.flatMap(O=>O.attachments);this.dispatch(c(F))}).catch(S=>{throw this.dispatch(r(h.map(F=>F.uuid))),S}),[h,A.map(S=>S.then(({attachments:F})=>F))]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:r}=this.selectors,l=n.getState(),u=r(e)(l);this.dispatch(a(e));try{await this.enqueueRequest({description:"Delete asset procedure step field values attachments",method:f.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{field_values__asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class hg extends w{constructor(){super(...arguments);m(this,"name","Asset Procedure Step Field Values");m(this,"url","/asset-procedure-step-field-values");m(this,"actions",{addOne:Qd,addMany:xd,setOne:er,setMany:tr,updateOne:sr,updateMany:ir,deleteOne:nr,deleteMany:ar,initialize:Xd});m(this,"selectors",{selectById:dr,selectByIds:rr})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),h=b({...e,created_by:u,submitted_at:d}),y=this.enqueueRequest({description:"Add asset procedure step field values",method:f.POST,url:`${this.url}/`,payload:z(h),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[h.uuid]});return this.dispatch(a(h)),y.then(p=>(this.dispatch(c(p)),p)).catch(()=>{this.dispatch(r(h.uuid))}),[h,y]}bulkAdd(e,n){var p;const{addMany:a,setMany:c,deleteMany:r}=this.actions,l=new Date().toISOString(),u=((p=this.client.store.getState().userReducer.currentUser)==null?void 0:p.id)??null,d=[],h=Je(e.payloads,n??e.payloads.length),y=[];for(const S of h){const F=[];for(const O of S){const P=b({...O,values:O.values,created_by:u,submitted_at:l});d.push(P),F.push({uuid:P.uuid,asset:O.asset,fields_revision:O.fields_revision,asset_procedure:O.asset_procedure,asset_procedure_step:O.asset_procedure_step,published_at:O.published_at,values:P.values})}y.push({submitted_at:l,values:e.values,field_values:F})}this.dispatch(a(d));const A=[];for(const S of y){const F=S.field_values.map(v=>v.asset),O=S.field_values.map(v=>v.fields_revision),P=S.field_values.map(v=>v.asset_procedure),R=S.field_values.map(v=>v.uuid),V=this.enqueueRequest({description:"Bulk add asset procedure step field values",method:f.POST,url:`${this.url}/bulk/`,payload:S,blockers:[...F,...O,...P],blocks:R});A.push(V)}return Promise.all(A).then(S=>{this.dispatch(c(S.flat()))}).catch(()=>{this.dispatch(r(d.map(S=>S.uuid)))}),[d,A]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`Expected AssetProcedureStepFieldValues with uuid ${e.uuid} to exist`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:"Update asset procedure step field values",method:f.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[u.fields_revision,u.asset,u.asset_procedure],blocks:[u.uuid]});return d.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected submission with uuid ${e} to exist`);const d=Yd(e)(l);this.dispatch(a(e)),this.dispatch(As(d.map(h=>h.uuid)));try{await this.enqueueRequest({description:"Delete asset procedure step field values",method:f.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(ps(d)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class mg extends w{constructor(){super(...arguments);m(this,"name","Asset Procedure Step");m(this,"url","/asset-procedure-steps");m(this,"actions",{addOne:yr,addMany:pr,setOne:hr,setMany:mr,updateOne:Ar,updateMany:fr,deleteOne:Sr,deleteMany:Tr,initialize:or});m(this,"selectors",{selectById:Or,selectByIds:Fr})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=b({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:"Create asset procedure step",method:f.POST,url:`${this.url}/`,payload:z(d),blockers:[d.asset_procedure_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`No asset procedure step with uuid ${e.uuid} found in the store`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:"Update asset procedure step",method:f.PATCH,url:`${this.url}/${r.uuid}/`,payload:{name:e.name,description:e.description,priority:e.order,color:e.color},blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`No asset procedure step with uuid ${e} found in the store`);const d=Pr(e)(l);return this.dispatch(a([e,...Xn(d)])),this.enqueueRequest({description:"Delete asset stage",method:f.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]}).catch(h=>{throw this.dispatch(c([u,...d])),h})}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class yg extends w{constructor(){super(...arguments);m(this,"url","/assets");m(this,"name","Asset");m(this,"actions",{addOne:_r,addMany:Fs,setOne:vr,setMany:Vr,updateOne:Mr,updateMany:Rr,deleteOne:wr,deleteMany:Ps,initialize:br});m(this,"selectors",{selectById:Er,selectByIds:Br})}add(e){var y;const{store:n}=this.client,{addOne:a,updateOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=b({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:`Create ${this.name}`,method:f.POST,url:`${this.url}/`,payload:z(d),blockers:[d.asset_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`No asset with uuid ${e.uuid} found in the store`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:`Edit ${this.name}`,method:f.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{addOne:a,deleteOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`No asset with uuid ${e} found in the store`);const d=Ia(e)(l),h=Wy(e)(l);if(this.dispatch(c(e)),d.length>0){const y=d.map(({uuid:A})=>A);this.dispatch(Kt(y))}if(h.length>0){const y=h.map(({uuid:A})=>A);this.dispatch(_t(y))}return this.enqueueRequest({description:`Delete ${this.name}`,method:f.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]}).catch(y=>{throw this.dispatch(a(u)),this.dispatch(Wt(d)),this.dispatch(bt(h)),y})}bulkAdd(e,n){const{addMany:a}=this.actions,c=new Date().toISOString(),r=xe.v4(),l=Je(e,n).map(h=>{const y=h.map(A=>b(A));return{batchId:xe.v4(),payload:{transaction_id:r,submitted_at:c,assets:y}}}),u=[];let d=null;for(const h of l){const{batchId:y,payload:A}=h,p=A.assets.map(({uuid:V})=>V),S=A.assets.map(({asset_type:V})=>V),F=A.assets.map(({project:V})=>V),O=S.concat(F);d&&O.push(d);const P=p;P.push(y);const R=this.enqueueRequest({description:`Bulk create ${this.name}s`,method:f.POST,url:`${this.url}/bulk/`,payload:A,blockers:O,blocks:P});d=h.batchId,u.push(R)}return Promise.all(u).then(h=>{const y=h.flat();this.dispatch(a(y))}),u}async bulkDelete(e){const{store:n}=this.client,{addMany:a,deleteMany:c}=this.actions,{selectByIds:r}=this.selectors,l=n.getState(),u=r(e)(l);this.dispatch(c(e));try{await this.enqueueRequest({description:`Bulk delete ${this.name}s`,method:f.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(r)),r}}class pg extends w{constructor(){super(...arguments);m(this,"name","Asset Stage Completion");m(this,"url","/asset-stage-completions");m(this,"actions",{addOne:$r,addMany:Ur,setOne:Cr,setMany:Lr,updateOne:kr,updateMany:Nr,deleteOne:Gr,deleteMany:Hr,initialize:Dr});m(this,"selectors",{selectById:Zr,selectByIds:Jr})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=b({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:"Add asset stage completion",method:f.POST,url:`${this.url}/`,payload:z(d),blockers:[e.asset,e.asset_stage],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`Expected asset stage completion with uuid ${e} to exist`);this.dispatch(a(e));const u=this.enqueueRequest({description:"Delete asset stage completion",method:f.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return u.catch(()=>{this.dispatch(c(l))}),u}bulkAdd(e){var p;const{store:n}=this.client,{addMany:a,setMany:c,deleteMany:r}=this.actions,l=new Date().toISOString(),u=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,d=e.map(S=>b(S)),h=d.map(S=>({...S,created_by:u,submitted_at:l})),y=h.map(({uuid:S})=>S);this.dispatch(a(h));const A=this.enqueueRequest({description:"Bulk create asset stage completions",method:f.POST,url:`${this.url}/bulk/`,payload:{submitted_at:l,completions:d},blockers:[...e.map(S=>S.asset_procedure),...e.map(S=>S.asset_stage),...e.map(S=>S.asset)],blocks:y});return A.then(S=>{this.dispatch(c(S))}).catch(()=>{this.dispatch(r(y))}),[h,A]}bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:r}=this.selectors,l=r(e)(n.getState());this.dispatch(a(e));const u=this.enqueueRequest({description:"Deleting asset stage completions",method:f.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]});return u.catch(()=>{this.dispatch(c(l))}),u}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{asset_procedure__project:e}},n)).flat();return this.dispatch(a(r)),r}}class Ag extends w{constructor(){super(...arguments);m(this,"name","Asset Stage");m(this,"url","/asset-stages");m(this,"actions",{addOne:tu,addMany:su,setOne:xr,setMany:eu,updateOne:iu,updateMany:nu,deleteOne:au,deleteMany:cu,initialize:Qr});m(this,"selectors",{selectById:ru,selectByIds:uu})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=b({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:"Create asset",method:f.POST,url:`${this.url}/`,payload:z(d),blockers:[d.asset_procedure_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`No asset stage with uuid ${e.uuid} found in the store`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:"Update asset stage",method:f.PATCH,url:`${this.url}/${r.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`No asset stage with uuid ${e} found in the store`);return this.dispatch(a(e)),this.enqueueRequest({description:"Delete asset stage",method:f.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]}).catch(d=>{throw this.dispatch(c(u)),d})}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class fg extends Ye{constructor(){super(...arguments);m(this,"name","Asset Type Attachment");m(this,"url","/asset-type-attachments");m(this,"actions",{addOne:hu,addMany:Vs,setOne:mu,setMany:yu,updateOne:pu,updateMany:Au,deleteOne:fu,deleteMany:zs,initialize:ou});m(this,"selectors",{selectById:Tu,selectByIds:Iu})}getId(e){return e.uuid}buildModel(e){return b({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,asset_type:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,asset_type:e.asset_type}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.assetTypeUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class Sg extends w{constructor(){super(...arguments);m(this,"name","Asset Type Fields Attachment");m(this,"url","/asset-type-fields-attachments");m(this,"actions",{addOne:bu,addMany:_u,setOne:Mu,setMany:Ru,updateOne:wu,updateMany:vu,deleteOne:Vu,deleteMany:zu,initialize:gu});m(this,"selectors",{selectById:Bu,selectByIds:ju})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],h=[];for(const p of e){const{fieldsRevisionUuid:S,fieldIdentifier:F,file:O}=p,P=await this.client.files.getFilePayload(O);P.sha1 in u||(u[P.sha1]=P);const R=b({file:URL.createObjectURL(O),file_type:O.type,file_name:O.name,file_sha1:P.sha1,created_by:l,fields_revision:S,submitted_at:r,field_identifier:F});d.push(R);const V={uuid:R.uuid,file_name:O.name,field_identifier:F,file_extension:P.extension,file_sha1:P.sha1,fields_revision:S};h.push(V)}this.dispatch(n(d));const y=this.enqueueRequest({description:"Add asset type fields attachments",method:f.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(p=>p.fields_revision),blocks:d.map(p=>p.uuid)});return y.then(p=>{this.client.files.processPresignedUrls(p.presigned_urls),this.dispatch(a(p.attachments))}).catch(()=>{this.dispatch(c(d.map(p=>p.uuid)))}),[d,y.then(({attachments:p})=>p)]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class Tg extends w{constructor(){super(...arguments);m(this,"name","Asset Type Fields");m(this,"url","/asset-type-fields");m(this,"actions",{addOne:Uu,addMany:Cu,setOne:Lu,setMany:ku,updateOne:Nu,updateMany:Gu,deleteOne:Hu,deleteMany:Wu,initialize:$u});m(this,"selectors",{selectById:Yu,selectByIds:Zu})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=b({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:"Add Asset Type Fields",method:f.POST,url:`${this.url}/`,payload:z(d),blockers:[d.asset_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(r(d.uuid)),A}),[d,h]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class Ig extends w{constructor(){super(...arguments);m(this,"name","Asset Type Field Values Attachment");m(this,"url","/asset-type-field-values-attachments");m(this,"actions",{addOne:xu,addMany:$s,setOne:el,setMany:tl,updateOne:sl,updateMany:il,deleteOne:nl,deleteMany:Us,initialize:Qu});m(this,"selectors",{selectById:cl,selectByIds:dl})}async bulkAdd(e,n){var p;const{addMany:a,setMany:c,deleteMany:r}=this.actions,l=new Date().toISOString(),u=((p=this.client.store.getState().userReducer.currentUser)==null?void 0:p.id)??null,d=Je(e,n??e.length),h=[],y=[];for(const S of d){const F={},O=[];for(const P of S){const{fieldValuesUuid:R,fieldIdentifier:V,file:v}=P,E=await this.client.files.getFilePayload(v);E.sha1 in F||(F[E.sha1]=E);const j=b({file:URL.createObjectURL(v),file_type:v.type,file_name:v.name,file_sha1:E.sha1,created_by:u,field_values:R,submitted_at:l,field_identifier:V});h.push(j);const D={uuid:j.uuid,file_name:v.name,file_sha1:E.sha1,file_extension:E.extension,field_identifier:V,field_values:R};O.push(D)}y.push({submitted_at:l,attachments:O,files:Object.values(F)})}this.dispatch(a(h));const A=y.map(S=>this.enqueueRequest({description:"Add asset type field values attachments",method:f.POST,url:`${this.url}/bulk/`,payload:S,blockers:S.attachments.map(F=>F.field_values),blocks:S.attachments.map(F=>F.uuid)}));return Promise.all(A).then(S=>{for(const O of S)this.client.files.processPresignedUrls(O.presigned_urls);const F=S.flatMap(O=>O.attachments);this.dispatch(c(F))}).catch(S=>{throw this.dispatch(r(h.map(F=>F.uuid))),S}),[h,A.map(S=>S.then(({attachments:F})=>F))]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:r}=this.selectors,l=n.getState(),u=r(e)(l);this.dispatch(a(e));try{await this.enqueueRequest({description:"Delete asset type field values attachments",method:f.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{field_values__asset__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class Og extends w{constructor(){super(...arguments);m(this,"name","Asset Type Field Values");m(this,"url","/asset-type-field-values");m(this,"actions",{addOne:hl,addMany:ml,setOne:yl,setMany:pl,updateOne:Al,updateMany:fl,deleteOne:Sl,deleteMany:Tl,initialize:ol});m(this,"selectors",{selectById:Ol,selectByIds:Fl})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),h=b({...e,created_by:u,submitted_at:d}),y=this.enqueueRequest({description:"Add asset type field values",method:f.POST,url:`${this.url}/`,payload:z(h),blockers:[e.asset,e.fields_revision],blocks:[h.uuid]});return this.dispatch(a(h)),y.then(p=>(this.dispatch(c(p)),p)).catch(()=>{this.dispatch(r(h.uuid))}),[h,y]}bulkAdd(e,n){var A;const{addMany:a,setMany:c,deleteMany:r}=this.actions,l=new Date().toISOString(),u=[],d=Je(e.payloads,n??e.payloads.length),h=[];for(const p of d){const S=[];for(const F of p){const O=b({...F,values:F.values,created_by:((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,submitted_at:l});u.push(O),S.push({uuid:O.uuid,asset:F.asset,fields_revision:F.fields_revision,published_at:F.published_at,values:O.values})}h.push({submitted_at:l,values:e.values,field_values:S})}this.dispatch(a(u));const y=[];for(const p of h){const S=p.field_values.map(R=>R.asset),F=p.field_values.map(R=>R.fields_revision),O=p.field_values.map(R=>R.uuid),P=this.enqueueRequest({description:"Bulk add asset type field values",method:f.POST,url:`${this.url}/bulk/`,payload:p,blockers:[...S,...F],blocks:O});y.push(P)}return Promise.all(y).then(p=>{this.dispatch(c(p.flat()))}).catch(()=>{this.dispatch(r(u.map(p=>p.uuid)))}),[u,y]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`Expected AssetTypeFieldValues with uuid ${e.uuid} to exist`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:"Delete asset type field values",method:f.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[u.uuid,u.fields_revision,u.asset],blocks:[u.uuid]});return d.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected submission with uuid ${e} to exist`);const d=rl(e)(l);this.dispatch(a(e)),this.dispatch(Us(d.map(h=>h.uuid)));try{await this.enqueueRequest({description:"Delete asset type field values",method:f.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch($s(d)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{asset__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class Fg extends w{constructor(){super(...arguments);m(this,"name","Asset Type Identifier");m(this,"url","/asset-type-identifiers");m(this,"actions",{addOne:_l,addMany:Ml,setOne:Rl,setMany:wl,updateOne:vl,updateMany:Vl,deleteOne:zl,deleteMany:El,initialize:bl});m(this,"selectors",{selectById:jl,selectByIds:ql})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=b({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:"Create asset type identifier",method:f.POST,url:`${this.url}/`,payload:z(d),blockers:[d.asset_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected asset type identifier with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:"Update asset type identifier",method:f.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected asset type identifier with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:"Delete asset type identifier",method:f.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class Pg extends w{constructor(){super(...arguments);m(this,"name","Asset Type Identifier Value");m(this,"url","/asset-type-identifier-values");m(this,"actions",{addOne:Cl,addMany:Ll,setOne:kl,setMany:Nl,updateOne:Gl,updateMany:Hl,deleteOne:Wl,deleteMany:Kl,initialize:Ul});m(this,"selectors",{selectById:Zl,selectByIds:Jl})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=b({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:"Create asset type identifier value",method:f.POST,url:`${this.url}/`,payload:z(d),blockers:[e.asset,e.asset_type_identifier],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected asset type identifier value with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:"Update asset type identifier value",method:f.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected asset type identifier value with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:"Delete asset type identifier value",method:f.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{asset__project:e}},n)).flat();return this.dispatch(a(r)),r}}class gg extends w{constructor(){super(...arguments);m(this,"name","Asset Type");m(this,"url","/asset-types");m(this,"actions",{addOne:so,addMany:io,setOne:eo,setMany:to,updateOne:no,updateMany:ao,deleteOne:co,deleteMany:ro,initialize:xl});m(this,"selectors",{selectById:lo,selectByIds:oo})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=b({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:"Create asset type",method:f.POST,url:`${this.url}/`,payload:z(d),blockers:[],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected asset type with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:"Update asset type",method:f.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected asset type with uuid ${e} to exist`);const d=bs(e)(l),h=Ou(e)(l);return this.dispatch(a(e)),this.dispatch(Ps(d.map(y=>y.uuid))),this.dispatch(zs(h.map(({uuid:y})=>y))),this.enqueueRequest({description:"Delete asset type",method:f.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]}).catch(y=>{throw this.dispatch(c(u)),this.dispatch(Fs(d)),this.dispatch(Vs(h)),y})}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class bg extends w{constructor(){super(...arguments);m(this,"name","Asset Type Status");m(this,"url","/asset-type-statuses");m(this,"actions",{addOne:po,addMany:Ao,setOne:fo,setMany:So,updateOne:To,updateMany:Io,deleteOne:Oo,deleteMany:Fo,initialize:yo});m(this,"selectors",{selectById:go,selectByIds:bo})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=b({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:"Create Asset Type Status",method:f.POST,url:`${this.url}/`,payload:z(d),blockers:[e.asset_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),r=a(e.uuid)(c);if(!r)throw new Error(`Expected an existing asset type status with uuid ${e.uuid}`);const l={...r,...e};this.dispatch(n(l));const u=this.enqueueRequest({description:"Edit Asset Type Status",method:f.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[l,u]}delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`No asset type status with uuid ${e} found in the store`);this.dispatch(a(e));const u=this.enqueueRequest({description:"Delete Asset Type Status",method:f.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return u.catch(()=>{this.dispatch(c(l))}),u}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class _g extends w{constructor(){super(...arguments);m(this,"name","Category");m(this,"url","/categories");m(this,"actions",{addOne:zo,addMany:Eo,setOne:Bo,setMany:jo,updateOne:qo,updateMany:Do,deleteOne:$o,deleteMany:Uo,initialize:Vo});m(this,"selectors",{selectById:Xs,selectByIds:Lo})}add(e){var d;const{store:n}=this.client,{addOne:a}=this.actions,c=((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null,r=new Date().toISOString(),l=b({...e,created_by:c,submitted_at:r});this.dispatch(a(l));const u=this.enqueueRequest({description:"Create Category",method:f.POST,url:`${this.url}/`,payload:z(l),blockers:[e.project],blocks:[l.uuid]});return[l,u]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),r=a(e.uuid)(c);if(!r)throw new Error(`Expected an existing category with uuid ${e.uuid}`);const l={...r,...e};this.dispatch(n(l));const u=this.enqueueRequest({description:"Edit Category",method:f.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return[l,u]}remove(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`No category with uuid ${e} found in the store`);this.dispatch(a(e));const u=this.enqueueRequest({description:"Delete Category",method:f.DELETE,url:`${this.url}/${l.uuid}/`,blockers:[l.uuid],blocks:[]});return u.catch(()=>{this.dispatch(c(l))}),u}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{project__organization:e}},n);return this.dispatch(a(c)),c}}class Mg extends Ye{constructor(){super(...arguments);m(this,"name","Document Attachment");m(this,"url","/document-attachments");m(this,"actions",{addOne:Ho,addMany:Wo,setOne:Ko,setMany:Yo,updateOne:Zo,updateMany:Jo,deleteOne:Xo,deleteMany:Qo,initialize:Go});m(this,"selectors",{selectById:eh,selectByIds:th})}getId(e){return e.uuid}buildModel(e){return b({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,document:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,document:e.document}}async bulkAdd(e){var S;const{store:n}=this.client,{addMany:a,updateMany:c,deleteMany:r}=this.actions,l=((S=n.getState().userReducer.currentUser)==null?void 0:S.id)??null,u=new Date().toISOString(),d=[],h=[],y={},A={};for(const F of e){const{documentUuid:O,file:P}=F,R=await this.client.files.getFilePayload(P);R.sha1 in y||(y[R.sha1]=R,A[R.sha1]=[]);const V=this.buildModel({file:P,file_sha1:R.sha1,submitted_at:u,created_by:l,modelUuid:O});d.push(V),h.push(this.buildPayload(V,R)),A[R.sha1].push(V.uuid)}this.dispatch(a(d));const p=this.enqueueRequest({description:"Attach files to document",method:f.POST,url:`${this.url}/bulk/`,payload:{submitted_at:u,attachments:h,files:Object.values(y)},blocks:d.map(F=>F.uuid),blockers:d.map(F=>F.file_sha1)});return p.then(({attachments:F,presigned_urls:O})=>{this.dispatch(c(F));const P=this.client.files.processPresignedUrls(O);for(const[R,V]of Object.entries(P))V.then(()=>{const v=A[R];for(const E of v)this.makeReadable(E)})}).catch(()=>{this.dispatch(r(d.map(F=>F.uuid)))}),[d,p.then(({attachments:F})=>F)]}async delete(e){return this._delete(e)}makeReadable(e){this.enqueueRequest({description:"Add attachment to AI assistant",method:f.PATCH,url:`${this.url}/${e}/`,payload:{readable_to_assistant:!0},blockers:["index-document-attachment",e],blocks:["index-document-attachment"]})}async refreshStore(e,n){const{initialize:a}=this.actions,c=this.list({queryParams:{document__project__organization:e}},n),r=this.list({queryParams:{document__organization:e}},n),u=(await Promise.all([c,r])).flat();return this.dispatch(a(u)),u}}class Rg extends w{constructor(){super(...arguments);m(this,"name","Document");m(this,"url","/documents");m(this,"actions",{addOne:ah,addMany:ch,setOne:dh,setMany:rh,updateOne:uh,updateMany:lh,deleteOne:oh,deleteMany:hh,initialize:nh});m(this,"selectors",{selectById:yh,selectByIds:ph})}add(e){var y;const{store:n}=this.client,{addOne:a,deleteOne:c,updateOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=b({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:"Create Document",method:f.POST,url:`${this.url}/`,payload:z(d),blockers:d.parent_document?[d.parent_document]:[],blocks:[d.uuid]});return h.then(A=>{this.dispatch(r(A))}).catch(()=>{this.dispatch(c(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`attempting to update a document with uuid ${e.uuid} that does not exist in store.documents`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:"Update Document",method:f.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`attempting to delete a document with uuid ${e} that does not exist in store.documents`);this.dispatch(a(e));const u=this.enqueueRequest({description:"Delete Document",method:f.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return u.catch(()=>{this.dispatch(c(l))}),u}async refreshStore(e,n){const{initialize:a}=this.actions,c=this.list({queryParams:{project__organization:e}},n),r=this.list({queryParams:{organization:e}},n),u=(await Promise.all([c,r])).flat();return this.dispatch(a(u)),u}}class st extends Ze{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:f.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:f.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:f.GET,...s},e)}}class wg extends st{constructor(){super(...arguments);m(this,"name","Email Domains");m(this,"url","/organization-email-domains");m(this,"actions",{addOne:Th,addMany:Ih,setOne:Oh,setMany:Fh,updateOne:Ph,updateMany:gh,deleteOne:bh,deleteMany:_h,initialize:Sh});m(this,"selectors",{selectById:Rh,selectByIds:wh})}async add(e,n){return this.enqueueRequest({description:"Add email domain to organization",method:f.POST,url:`${this.url}/`,payload:{email:n,organization:e},blockers:[e,"create-org"],blocks:[]})}async remove(e){const{deleteOne:n,addOne:a}=this.actions;return this.dispatch(n(e.uuid)),this.enqueueRequest({description:"Remove email domain from organization",method:f.DELETE,url:`${this.url}/${e.uuid}/`,blockers:[e.domain],blocks:[]}).catch(c=>{throw this.dispatch(a(e)),c})}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class vg extends Ze{async getVerificationCode(s){return this.enqueueRequest({description:"Get verification code",method:f.GET,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}validateVerificationCode(s,e=void 0){return this.enqueueRequest({description:"Validate verification code",method:f.POST,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,payload:e,blockers:[],blocks:[]})}}const jt={},Vn=new Set;let qt=0,zn=0,En=0;const Vg=20;class zg extends Ze{constructor(){super(...arguments);m(this,"host");m(this,"_dbPromise",_O.openDB("fileCache",1,{upgrade(e){e.createObjectStore("files")}}))}async renewUploadUrl(e){const n=await this.fetchCache(e);if(!n)throw new Error(`File with sha1 ${e} not found in cache`);const a=await kt(n,e),c=await this.enqueueRequest({description:"Get S3 URL",method:f.GET,url:"/authentication/files/presigned-upload-url/",queryParams:{sha1:await et(n),file_type:n.type,extension:n.name.split(".").pop(),size:n.size.toString()},blockers:[],blocks:[`s3-${a}`]});return"url"in c&&this.dispatch(Eh({sha1:e,...c})),c}async addCache(e,n){if(Vn.has(n))return;if(!e.type){const r=e.name.split("."),l=r[r.length-1];e=new File([e],e.name,{type:l})}if(!e.name||!e.size||!e.type)throw new Error("Cannot add files to cache that do not have a name, size and type.");const a=await this._dbPromise;!!await a.get("files",n)?(console.error("File already cached (this is unexpected at this point):",e.name,n),qt++):(await a.put("files",e,n),zn++),Vn.add(n),En++,En%Vg===0&&console.debug(`File cache summary: ${qt} hits and ${zn} misses, ${qt/(qt+zn)*100}% hit rate over ${En} calls to addCache.`)}async removeCache(e){await(await this._dbPromise).delete("files",e),Vn.delete(e)}async fetchCache(e){return(await this._dbPromise).get("files",e)}async getOrRenewUploadUrl(e){const n=this.client.store.getState();return Bh(e)(n)??await this.renewUploadUrl(e)}async uploadFileToS3(e){const n=await this.fetchCache(e);if(!n)throw new Error(`File with sha1 ${e} not found in cache`);const a=await kt(n,e),c={file_name:n.name,file_sha1:e,file:a},r=await this.getOrRenewUploadUrl(e);if("warning"in r){if(r.warning==="already_uploaded")return[c,Promise.resolve(void 0)];throw new Error(r.warning)}const l=r.url,u=this.enqueueRequest({url:l,description:"Upload file",method:f.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:e,blockers:[`s3-${a}`],blocks:[e],s3url:r});return[c,u]}async fetchFileFromUrl(e,n,a){const c=e.split("?")[0]??e,r=await this.fetchCache(n);if(r){if(!r.name)throw new Error("Cached file unexpectedly has no name.");return r}if(e.startsWith("blob:")){const h=await Yn(e),y=new File([h],a??n,{type:h.type});return await this.addCache(y,n),y}let l=jt[c],u=!0;l?u=!1:(l=new Promise(h=>{this.enqueueRequest({description:"Download file",method:f.GET,url:e,isExternalUrl:!0,isResponseBlob:!0,isAuthNeeded:!1,blockers:[n],blocks:[n]}).then(y=>{const A=new File([y],a??n,{type:y.type});h(A)})}),jt[c]=l);let d;try{d=await l}catch(h){throw u&&h instanceof $&&delete jt[c],h}if(u){const h=await et(d);if(h!==n){const p=`The hash of the file returned from the server (${h}) does not match the
9
+ expected hash (${n}). This can happen if you're using a local development server and the
10
10
  isExternalUrl flag in the request details is set to true, because instead of requesting the local
11
11
  REST API, you will be requesting localhost:80 (where this app runs), resulting in a transformed blob
12
12
  (with an uuid attached) being returned. Alternatively, you may be running with
13
13
  import.meta.env.PROD, which will result in some file requests being treated as
14
- external URLs and therefore not prepended with VITE_API_URL.`;throw new Error(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(p)}const y=d.type.split("/")[1];if(!y)throw new Error("File has no extension");const A=a??h+"."+y;if(d=Kn(d,A),!d.name)throw new Error("Failed to set file's name");await this.addCache(d,h),jt[c]=new Promise(p=>{p(d)})}return d}processPresignedUrls(e){const n={};for(const[a,c]of Object.entries(e))n[a]=this.enqueueRequest({url:c.url,description:"Upload file to S3",method:f.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:a,blockers:[`s3-${c.fields.key}`],blocks:[a],s3url:c});return n}async getFilePayload(e){const n=await et(e),a={sha1:n,file_type:e.type,extension:e.name.split(".").pop(),size:e.size};return await this.client.files.addCache(e,n),a}}class Eg extends w{constructor(){super(...arguments);m(this,"name","Form Identifier");m(this,"url","/form-identifiers");m(this,"actions",{addOne:$h,addMany:Uh,setOne:Ch,setMany:Lh,updateOne:kh,updateMany:Nh,deleteOne:Gh,deleteMany:Hh,initialize:Dh});m(this,"selectors",{selectById:Kh,selectByIds:Yh})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=b({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:"Create form identifier",method:f.POST,url:`${this.url}/`,payload:z(d),blockers:[d.form],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected form identifier with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:"Update form identifier",method:f.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected form identifier with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:"Delete form identifier",method:f.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{form__organization:e}},n);return this.dispatch(a(c)),c}}class Bg extends w{constructor(){super(...arguments);m(this,"name","Form Identifier Value");m(this,"url","/form-identifier-values");m(this,"actions",{addOne:Qh,addMany:xh,setOne:em,setMany:tm,updateOne:sm,updateMany:im,deleteOne:nm,deleteMany:am,initialize:Xh});m(this,"selectors",{selectById:dm,selectByIds:rm})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=b({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:"Create form identifier value",method:f.POST,url:`${this.url}/`,payload:z(d),blockers:[e.form_submission,e.form_identifier],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected form identifier value with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:"Update form identifier value",method:f.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected form identifier value with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:"Delete form identifier value",method:f.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{form_submission__form_revision__form__organization:e}},n)).flat();return this.dispatch(a(r)),r}}class jg extends w{constructor(){super(...arguments);m(this,"name","Form Revision Attachment");m(this,"url","/form-revision-attachments");m(this,"actions",{addOne:hm,addMany:mm,setOne:ym,setMany:pm,updateOne:Am,updateMany:fm,deleteOne:Sm,deleteMany:Tm,initialize:om});m(this,"selectors",{selectById:Om,selectByIds:Fm})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],h=[];for(const p of e){const{revisionUuid:S,fieldIdentifier:F,file:O}=p,P=await this.client.files.getFilePayload(O);P.sha1 in u||(u[P.sha1]=P);const R=b({file:URL.createObjectURL(O),file_type:O.type,file_name:O.name,file_sha1:P.sha1,created_by:l,form_revision:S,submitted_at:r,field_identifier:F});d.push(R);const V={uuid:R.uuid,file_name:O.name,field_identifier:F,file_extension:P.extension,file_sha1:P.sha1,form_revision:S};h.push(V)}this.dispatch(n(d));const y=this.enqueueRequest({description:"Attach files to form revision",method:f.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(p=>p.form_revision),blocks:d.map(p=>p.uuid)});return y.then(p=>{this.client.files.processPresignedUrls(p.presigned_urls),this.dispatch(a(p.attachments))}).catch(()=>{this.dispatch(c(d.map(p=>p.uuid)))}),[d,y.then(({attachments:p})=>p)]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{form_revision__form__organization:e}},n);return this.dispatch(a(c)),c}}class qg extends w{constructor(){super(...arguments);m(this,"name","Form Revision");m(this,"url","/form-revisions");m(this,"actions",{addOne:ui,addMany:li,setOne:_m,setMany:Mm,updateOne:Rm,updateMany:wm,deleteOne:oi,deleteMany:hi,initialize:bm});m(this,"selectors",{selectById:vm,selectByIds:Vm})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),h=b({...e,created_by:u,submitted_at:d});this.dispatch(a(h));const y=this.enqueueRequest({description:"Create form revision",method:f.POST,url:`${this.url}/`,payload:z(h),blockers:[e.form],blocks:[h.uuid]});return y.then(p=>{this.dispatch(c(p))}).catch(()=>{this.dispatch(r(h.uuid))}),[h,y]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{form__organization:e}},n);return this.dispatch(a(c)),c}}class Dg extends w{constructor(){super(...arguments);m(this,"name","Form");m(this,"url","/forms");m(this,"actions",{addOne:qm,addMany:Dm,setOne:$m,setMany:Um,updateOne:Cm,updateMany:Lm,deleteOne:km,deleteMany:Nm,initialize:jm});m(this,"selectors",{selectById:Wm,selectByIds:Km})}add(e,n){var A;const{store:a}=this.client,{addOne:c,deleteOne:r}=this.actions,l=new Date().toISOString(),u=((A=a.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=b({...e,submitted_at:l,created_by:u}),h=b({...n,form:d.uuid,submitted_at:l,created_by:u});this.dispatch(c(d)),this.dispatch(ui(h));const y=this.enqueueRequest({description:"Create form",method:f.POST,url:`${this.url}/`,payload:{...z(d),initial_revision:{uuid:h.uuid,submitted_at:h.submitted_at,title:h.title,description:h.description,fields:h.fields}},blockers:[],blocks:[d.uuid,h.uuid]});return y.catch(p=>{throw this.dispatch(r(d.uuid)),this.dispatch(oi(h.uuid)),p}),[d,h,y]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error("Expected form to exist");const d=fy(e)(l);d.length>0&&this.dispatch(gi(d.map(({uuid:y})=>y)));const h=zm(e)(l);h.length>0&&this.dispatch(hi(h.map(({uuid:y})=>y))),this.dispatch(a(e));try{return await this.enqueueRequest({description:"Delete form",method:f.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(y){throw this.dispatch(c(u)),h.length>0&&this.dispatch(li(h)),d.length>0&&this.dispatch(Pi(d)),y}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class $g extends w{constructor(){super(...arguments);m(this,"name","Form Submission Attachment");m(this,"url","/form-submission-attachments");m(this,"actions",{addOne:Jm,addMany:fi,setOne:Xm,setMany:Qm,updateOne:xm,updateMany:ey,deleteOne:ty,deleteMany:Si,initialize:Zm});m(this,"selectors",{selectById:sy,selectByIds:iy})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],h=[];for(const p of e){const{submissionUuid:S,fieldIdentifier:F,file:O}=p,P=await this.client.files.getFilePayload(O);P.sha1 in u||(u[P.sha1]=P);const R=b({file:URL.createObjectURL(O),file_type:O.type,file_name:O.name,file_sha1:P.sha1,created_by:l,form_submission:S,submitted_at:r,field_identifier:F});d.push(R);const V={uuid:R.uuid,file_name:O.name,file_sha1:P.sha1,file_extension:P.extension,field_identifier:F,form_submission:S};h.push(V)}this.dispatch(n(d));const y=this.enqueueRequest({description:"Attach files to form submission",method:f.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(p=>p.form_submission),blocks:d.map(p=>p.uuid)});return y.then(p=>{this.client.files.processPresignedUrls(p.presigned_urls),this.dispatch(a(p.attachments))}).catch(p=>{throw this.dispatch(c(d.map(S=>S.uuid))),p}),[d,y.then(({attachments:p})=>p)]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,r=n.getState(),l=Oi(e)(r);this.dispatch(a(e));try{await this.enqueueRequest({description:"Delete form submission attachments",method:f.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{form_submission__form_revision__form__organization:e}},n)).flat();return this.dispatch(a(r)),r}}class Ug extends w{constructor(){super(...arguments);m(this,"name","Form Submission");m(this,"url","/form-submissions");m(this,"actions",{addOne:ly,addMany:Pi,setOne:ry,setMany:uy,updateOne:oy,updateMany:hy,deleteOne:my,deleteMany:gi,initialize:dy});m(this,"selectors",{selectById:py,selectByIds:Ay})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),h=b({...e,created_by:u,submitted_at:d}),y=this.enqueueRequest({description:"Add form submission",method:f.POST,url:`${this.url}/`,payload:z(h),blockers:[e.form_revision],blocks:[h.uuid]});return this.dispatch(a(h)),y.then(p=>(this.dispatch(c(p)),p)).catch(()=>{this.dispatch(r(h.uuid))}),[h,y]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`Expected submission with uuid ${e.uuid} to exist`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:"Delete user form submissions",method:f.PATCH,url:`${this.url}/${u.uuid}/`,payload:e,blockers:[u.uuid],blocks:[u.uuid]});return d.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected submission with uuid ${e} to exist`);const d=ny(e)(l);this.dispatch(a(e)),this.dispatch(Si(d.map(h=>h.uuid)));try{return await this.enqueueRequest({description:"Delete user form submissions",method:f.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(fi(d)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{limit:this.pageSize,paginate:!0,form_revision__form_organization:e}},n)).flat();return this.dispatch(a(r)),r}}class Cg extends w{constructor(){super(...arguments);m(this,"name","Geo Image");m(this,"url","/geo-images");m(this,"actions",{addOne:Py,addMany:gy,setOne:Oy,setMany:Fy,updateOne:by,updateMany:_y,deleteOne:My,deleteMany:Ry,initialize:Iy});m(this,"selectors",{selectById:vy,selectByIds:Vy})}async add(e){var F;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,{file:l,...u}=e,d=new Date().toISOString(),h=((F=n.getState().userReducer.currentUser)==null?void 0:F.id)??null,y=u.project,A=await this.client.files.getFilePayload(l),p=b({...u,file_name:l.name,file_sha1:A.sha1,file_type:l.type,file:URL.createObjectURL(l),submitted_at:d,created_by:h});this.dispatch(a(p));const S=this.enqueueRequest({description:"Add geo image",method:f.POST,url:`${this.url}/`,payload:{uuid:p.uuid,submitted_at:d,title:p.title,description:p.description,geo_marker:p.geo_marker,canvas_marker:p.canvas_marker,sha1:p.file_sha1,project:p.project,file_name:p.file_name,direction:p.direction,original_date:p.original_date,file:A},blocks:[y],blockers:[y]});return S.then(O=>{this.client.files.processPresignedUrls(O.presigned_urls),this.dispatch(c(O.geo_image))}).catch(()=>{this.dispatch(r(p.uuid))}),[p,S.then(O=>O.geo_image)]}async bulkAdd(e,n){var F;const{store:a}=this.client,{addMany:c,setMany:r,deleteMany:l}=this.actions,u=new Date().toISOString(),d=((F=a.getState().userReducer.currentUser)==null?void 0:F.id)??null,h=[],y=[],A=[],p={};for(const O of e){const{file:P,...R}=O,V=await this.client.files.getFilePayload(P);V.sha1 in p||(p[V.sha1]=V);const v=b({...R,file_name:P.name,file_sha1:V.sha1,file_type:P.type,file:URL.createObjectURL(P),submitted_at:u,created_by:d,project:n});h.push(v),y.push(v.uuid),A.push({uuid:v.uuid,sha1:v.file_sha1,file_name:v.file_name,title:v.title,description:v.description,geo_marker:v.geo_marker,canvas_marker:v.canvas_marker,direction:v.direction,original_date:v.original_date})}this.dispatch(c(h));const S=this.enqueueRequest({description:"Bulk add geo images",method:f.POST,url:`${this.url}/bulk/`,payload:{submitted_at:u,project:n,geo_images:A,files:Object.values(p)},blocks:[n],blockers:y});return S.then(O=>{this.client.files.processPresignedUrls(O.presigned_urls),this.dispatch(r(O.geo_images))}).catch(()=>{this.dispatch(l(y))}),[h,S.then(O=>O.geo_images)]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`Map image with uuid ${e.uuid} does not exist in the store`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:"Update geo image",method:f.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return d.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Map image with uuid ${e} does not exist in the store`);this.dispatch(a(e));const d=this.enqueueRequest({description:"Delete geo image",method:f.DELETE,url:`${this.url}/${e}/`,blocks:[e],blockers:[e]});return d.catch(()=>{this.dispatch(c(u))}),d}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{project:e}},n);return this.dispatch(a(c)),c}}class Lg extends w{constructor(){super(...arguments);m(this,"name","Issue Association");m(this,"url","/issue-associations");m(this,"actions",{addOne:Uy,addMany:bt,setOne:qy,setMany:jy,updateOne:Dy,updateMany:$y,deleteOne:Cy,deleteMany:_t,initialize:By});m(this,"selectors",{selectById:ky,selectByIds:Ny})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=new Date().toISOString(),u=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,d=b({...e,submitted_at:l,created_by:u});this.dispatch(a(d));const h=this.enqueueRequest({description:"Add issue association",method:f.POST,url:`${this.url}/`,payload:z(d),blockers:[e.associated_issue,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(a(e));const u=this.enqueueRequest({description:"Delete issue association",method:f.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return u.catch(()=>{this.dispatch(c(l))}),u}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{associated_issue__project:e}},n)).flat();return this.dispatch(a(r)),r}}class kg extends Ye{constructor(){super(...arguments);m(this,"name","Issue Attachment");m(this,"url","/issue-attachments");m(this,"actions",{addOne:Jy,addMany:vi,setOne:Xy,setMany:Qy,updateOne:xy,updateMany:ep,deleteOne:tp,deleteMany:Vi,initialize:Zy});m(this,"selectors",{selectById:np,selectByIds:ap})}getId(e){return e.uuid}buildModel(e){return b({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,issue:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,issue:e.issue}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.issueUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(r)),r}}class Ng extends Ye{constructor(){super(...arguments);m(this,"name","Issue Comment Attachment");m(this,"url","/issue-comment-attachments");m(this,"actions",{addOne:up,addMany:lp,setOne:op,setMany:hp,updateOne:mp,updateMany:yp,deleteOne:pp,deleteMany:Ap,initialize:rp});m(this,"selectors",{selectById:Sp,selectByIds:Tp})}getId(e){return e.uuid}buildModel(e){return b({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,issue_comment:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,issue_comment:e.issue_comment}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.issueCommentUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{issue_comment__issue__project:e}},n)).flat();return this.dispatch(a(r)),r}}class Gg extends w{constructor(){super(...arguments);m(this,"name","Issue Comment");m(this,"url","/issue-comments");m(this,"actions",{addOne:Pp,addMany:gp,setOne:bp,setMany:_p,updateOne:Mp,updateMany:Rp,deleteOne:wp,deleteMany:vp,initialize:Fp});m(this,"selectors",{selectById:Vp,selectByIds:zp})}add(e){const{store:n}=this.client,{addOne:a,deleteOne:c}=this.actions,r=b({...e,author:n.getState().userReducer.currentUser.id,submitted_at:new Date().toISOString()});this.dispatch(a(r));const l=this.enqueueRequest({description:"Add issue comment",method:f.POST,url:`${this.url}/`,payload:z(r),blockers:[e.issue],blocks:[r.uuid]});return l.catch(()=>{this.dispatch(c(r.uuid))}),[r,l]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:"Edit issue comment",method:f.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.catch(()=>{this.dispatch(a(r))}),[l,u]}remove(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(a(e));const u=this.enqueueRequest({description:"Delete comment",method:f.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return u.catch(()=>{this.dispatch(c(l))}),u}async refreshStore(e,n){const{setMany:a}=this.actions,c=await this.list({queryParams:{issue__project:e}},n);return this.dispatch(a(c)),c}}class Hg extends w{constructor(){super(...arguments);m(this,"name","Issue");m(this,"url","/issues");m(this,"actions",{addOne:qp,addMany:$i,setOne:Dp,setMany:$p,updateOne:Up,updateMany:Cp,deleteOne:Lp,deleteMany:Ui,initialize:jp});m(this,"selectors",{selectById:Np,selectByIds:Gp})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=n.getState(),u=new Date().toISOString(),d=((A=l.userReducer.currentUser)==null?void 0:A.id)??null,h=b({...e,submitted_at:u,created_by:d});this.dispatch(a(h));const y=this.enqueueRequest({description:"Create issue",method:f.POST,url:`${this.url}/`,payload:z(h),blockers:[h.project,h.issue_type,...h.category?[h.category]:[]],blocks:[h.uuid]});return y.then(p=>{this.dispatch(c(p))}).catch(p=>{throw this.dispatch(r(h.uuid)),p}),[h,y]}update(e){var y;const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),r=a(e.uuid)(c);if(!r)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const l={...r,...e};this.dispatch(n(l));const u={};for(const A of[q.TITLE,q.DESCRIPTION,q.STATUS,q.CATEGORY,q.PRIORITY,q.ASSIGNED_TO,q.DUE_DATE])if(A in e&&e[A]!==r[A])switch(A){case q.PRIORITY:u[A]=e[A];break;case q.DUE_DATE:u[A]=e[A];break;case q.DESCRIPTION:u[A]=e[A];break;case q.TITLE:u[A]=e[A];break;case q.STATUS:{const p=e[A],S=nn(p)(c);if(!S)throw new Error(`Trying to update issue type status with ${p} which does not exist in store`);u[A]={name:S.name,color:S.color,uuid:S.uuid};break}case q.CATEGORY:{const p=e[A];if(p===null)u[A]=null;else{const S=Xs(p)(c);if(!S)throw new Error(`Trying to update category with ${p} which does not exist in store.`);u[A]={name:S.name,color:S.color,uuid:S.uuid}}break}case q.ASSIGNED_TO:{const p=e[A];if(p===null)u[A]=null;else{const S=Vt(p)(c);if(!S)throw new Error(`Trying to update assigned to with ${p} which does not exist in store.`);u[A]={full_name:S.username,id:S.id}}break}}const d=b({created_by:((y=c.userReducer.currentUser)==null?void 0:y.id)??null,submitted_at:new Date().toISOString(),issue:r.uuid,changes:u});this.dispatch(cn(d));const h=this.enqueueRequest({description:"Edit issue",method:f.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return h.catch(()=>{this.dispatch(n(r)),this.dispatch(rn(d.uuid))}),[l,h]}async remove(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`No issue with uuid ${e} found in the store`);const d=ip(e)(l),h=SS(e)(l),y={};for(const p of Gy(e)(l))y[p.uuid]=p;for(const p of Hy(e)(l))y[p.uuid]=p;const A=Object.values(y);this.dispatch(a(e)),d.length>0&&this.dispatch(Vi(d.map(({uuid:p})=>p))),h.length>0&&this.dispatch(un(h.map(({uuid:p})=>p))),A.length>0&&this.dispatch(_t(A.map(({uuid:p})=>p)));try{return await this.enqueueRequest({description:"Delete issue",method:f.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(c(u)),this.dispatch(vi(d)),this.dispatch(dn(h)),this.dispatch(bt(A)),p}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(r)),r}}class Wg extends Ye{constructor(){super(...arguments);m(this,"name","Issue Type Attachment");m(this,"url","/issue-type-attachments");m(this,"actions",{addOne:Zp,addMany:Jp,setOne:Xp,setMany:Qp,updateOne:xp,updateMany:eA,deleteOne:tA,deleteMany:sA,initialize:Yp});m(this,"selectors",{selectById:nA,selectByIds:aA})}getId(e){return e.uuid}buildModel(e){return b({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,issue_type:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,issue_type:e.issue_type}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.issueTypeUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class Kg extends w{constructor(){super(...arguments);m(this,"name","Issue Type Fields Attachment");m(this,"url","/issue-type-fields-attachments");m(this,"actions",{addOne:uA,addMany:lA,setOne:oA,setMany:hA,updateOne:mA,updateMany:yA,deleteOne:pA,deleteMany:AA,initialize:rA});m(this,"selectors",{selectById:SA,selectByIds:TA})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],h=[];for(const p of e){const{fieldsRevisionUuid:S,fieldIdentifier:F,file:O}=p,P=await this.client.files.getFilePayload(O);P.sha1 in u||(u[P.sha1]=P);const R=b({file:URL.createObjectURL(O),file_type:O.type,file_name:O.name,file_sha1:P.sha1,created_by:l,fields_revision:S,submitted_at:r,field_identifier:F});d.push(R);const V={uuid:R.uuid,file_name:O.name,file_extension:P.extension,field_identifier:F,file_sha1:P.sha1,fields_revision:S};h.push(V)}this.dispatch(n(d));const y=this.enqueueRequest({description:"Add issue type fields attachments",method:f.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(p=>p.fields_revision),blocks:d.map(p=>p.uuid)});return y.then(p=>{this.client.files.processPresignedUrls(p.presigned_urls),this.dispatch(a(p.attachments))}).catch(()=>{this.dispatch(c(d.map(p=>p.uuid)))}),[d,y.then(({attachments:p})=>p)]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class Yg extends w{constructor(){super(...arguments);m(this,"name","Issue Type Fields");m(this,"url","/issue-type-fields");m(this,"actions",{addOne:DA,addMany:$A,setOne:UA,setMany:CA,updateOne:LA,updateMany:kA,deleteOne:NA,deleteMany:GA,initialize:qA});m(this,"selectors",{selectById:WA,selectByIds:KA})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=b({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:"Add Issue Type Fields",method:f.POST,url:`${this.url}/`,payload:z(d),blockers:[d.issue_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(r(d.uuid)),A}),[d,h]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class Zg extends w{constructor(){super(...arguments);m(this,"name","Issue Type Field Values Attachment");m(this,"url","/issue-type-field-values-attachments");m(this,"actions",{addOne:XA,addMany:Ki,setOne:QA,setMany:xA,updateOne:ef,updateMany:tf,deleteOne:sf,deleteMany:Yi,initialize:JA});m(this,"selectors",{selectById:af,selectByIds:cf})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],h=[];for(const p of e){const{fieldValuesUuid:S,fieldIdentifier:F,file:O}=p,P=await this.client.files.getFilePayload(O);P.sha1 in u||(u[P.sha1]=P);const R=b({file:URL.createObjectURL(O),file_type:O.type,file_name:O.name,file_sha1:P.sha1,created_by:l,field_values:S,submitted_at:r,field_identifier:F});d.push(R);const V={uuid:R.uuid,file_name:O.name,file_sha1:P.sha1,file_extension:P.extension,field_identifier:F,field_values:S};h.push(V)}this.dispatch(n(d));const y=this.enqueueRequest({description:"Add issue type field values attachments",method:f.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(p=>p.field_values),blocks:d.map(p=>p.uuid)});return y.then(({presigned_urls:p,attachments:S})=>{this.client.files.processPresignedUrls(p),this.dispatch(a(S))}).catch(p=>{throw this.dispatch(c(d.map(S=>S.uuid))),p}),[d,y.then(({attachments:p})=>p)]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:r}=this.selectors,l=n.getState(),u=r(e)(l);this.dispatch(a(e));try{await this.enqueueRequest({description:"Delete issue type field values attachments",method:f.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{field_values__issue__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class Jg extends w{constructor(){super(...arguments);m(this,"name","Issue Type Field Values");m(this,"url","/issue-type-field-values");m(this,"actions",{addOne:PA,addMany:gA,setOne:bA,setMany:_A,updateOne:MA,updateMany:RA,deleteOne:wA,deleteMany:vA,initialize:FA});m(this,"selectors",{selectById:zA,selectByIds:EA})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),h=b({...e,created_by:u,submitted_at:d}),y=this.enqueueRequest({description:"Add issue type field values",method:f.POST,url:`${this.url}/`,payload:z(h),blockers:[e.issue,e.fields_revision],blocks:[h.uuid]});return this.dispatch(a(h)),y.then(p=>(this.dispatch(c(p)),p)).catch(()=>{this.dispatch(r(h.uuid))}),[h,y]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`Expected IssueTypeFieldValues with uuid ${e.uuid} to exist`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:"Update issue type field values",method:f.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[u.uuid,u.fields_revision,u.issue],blocks:[u.uuid]});return d.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected submission with uuid ${e} to exist`);const d=df(e)(l);this.dispatch(a(e)),this.dispatch(Yi(d.map(h=>h.uuid)));try{await this.enqueueRequest({description:"Delete issue type field values",method:f.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(Ki(d)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{issue__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class Xg extends w{constructor(){super(...arguments);m(this,"name","Issue Type Identifier");m(this,"url","/issue-type-identifiers");m(this,"actions",{addOne:of,addMany:hf,setOne:mf,setMany:yf,updateOne:pf,updateMany:Af,deleteOne:ff,deleteMany:Sf,initialize:lf});m(this,"selectors",{selectById:If,selectByIds:Of})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=b({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:"Create issue type identifier",method:f.POST,url:`${this.url}/`,payload:z(d),blockers:[d.issue_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected issue type identifier with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:"Update issue type identifier",method:f.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected issue type identifier with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:"Delete issue type identifier",method:f.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class Qg extends w{constructor(){super(...arguments);m(this,"name","Issue Type Identifier Value");m(this,"url","/issue-type-identifier-values");m(this,"actions",{addOne:bf,addMany:_f,setOne:Mf,setMany:Rf,updateOne:wf,updateMany:vf,deleteOne:Vf,deleteMany:zf,initialize:gf});m(this,"selectors",{selectById:Bf,selectByIds:jf})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=b({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:"Create issue type identifier value",method:f.POST,url:`${this.url}/`,payload:z(d),blockers:[e.issue,e.issue_type_identifier],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected issue type identifier value with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:"Update issue type identifier value",method:f.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected issue type identifier value with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:"Delete issue type identifier value",method:f.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(r)),r}}class xg extends w{constructor(){super(...arguments);m(this,"name","Issue Type");m(this,"url","/issue-types");m(this,"actions",{addOne:Uf,addMany:Cf,setOne:Lf,setMany:kf,updateOne:Nf,updateMany:Gf,deleteOne:Hf,deleteMany:Wf,initialize:$f});m(this,"selectors",{selectById:Yf,selectByIds:Zf})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),h=b({...e,submitted_at:d,created_by:u});this.dispatch(a(h));const y=this.enqueueRequest({method:f.POST,url:`${this.url}/`,payload:z(h),blockers:[],blocks:[h.uuid]});return y.then(p=>{this.dispatch(c(p))}).catch(()=>{this.dispatch(r(h.uuid))}),[h,y]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`IssueType with uuid ${e.uuid} does not exist in the store.`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({method:f.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[u,d]}delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const d=Hp(e)(l);this.dispatch(a(e)),this.dispatch(Ui(d.map(y=>y.uuid)));const h=this.enqueueRequest({method:f.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return h.catch(()=>{this.dispatch(c(u)),this.dispatch($i(d))}),h}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class eb extends w{constructor(){super(...arguments);m(this,"name","Issue Type Status");m(this,"url","/issue-type-statuses");m(this,"actions",{addOne:xf,addMany:eS,setOne:tS,setMany:sS,updateOne:iS,updateMany:nS,deleteOne:aS,deleteMany:cS,initialize:Qf});m(this,"selectors",{selectById:nn,selectByIds:rS})}add(e){var y;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((y=n.getState().userReducer.currentUser)==null?void 0:y.id)??null,u=new Date().toISOString(),d=b({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:"Create Issue Type Status",method:f.POST,url:`${this.url}/`,payload:z(d),blockers:[e.issue_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),r=a(e.uuid)(c);if(!r)throw new Error(`Expected an existing issue type status with uuid ${e.uuid}`);const l={...r,...e};this.dispatch(n(l));const u=this.enqueueRequest({description:"Edit Issue Type Status",method:f.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[l,u]}delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`No issue type status with uuid ${e} found in the store`);this.dispatch(a(e));const u=this.enqueueRequest({description:"Delete Issue Type Status",method:f.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return u.catch(()=>{this.dispatch(c(l))}),u}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class tb extends w{constructor(){super(...arguments);m(this,"name","Issue Update");m(this,"url","/issue-updates");m(this,"actions",{addOne:cn,addMany:dn,setOne:hS,setMany:mS,updateOne:yS,updateMany:pS,deleteOne:rn,deleteMany:un,initialize:oS});m(this,"selectors",{selectById:AS,selectByIds:fS})}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(r)),r}}const 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 nb extends xP{constructor(){super(...arguments);m(this,"_getRenewedTokens",async e=>{const n=this.performRequest({method:f.POST,url:this.refreshTokensUrl,payload:{refresh:e},isAuthNeeded:!1,checkAuth:!1});let a;try{a=await n}catch(c){console.error("Could not renew tokens; clearing auth",c),this.clearAuth();return}if(!a.access)throw new Error("Missing access token");return{accessToken:a.access,refreshToken:a.refresh??this.getRefreshToken()}})}clearAuth(){console.debug(this.constructor.name,"clearing auth;"),this.dispatch(Ro(!1)),this.clearTokens(),this.dispatch(g()),this.dispatch(g())}async renewTokens(){const e=this.getRefreshToken();if(!e)throw new Error("No refresh token found");console.debug(this.constructor.name,"renewing tokens");try{const n=await this._getRenewedTokens(e);if(!n)return;console.log("Got renewed tokens"),this.setTokens(n)}catch(n){throw console.error("Could not renew tokens; clearing auth",n),this.clearAuth(),n}}tokenIsExpiringSoon(){const e=this.getAccessToken();if(!e)return!1;const n=Date.now()/1e3;let a;try{a=MO(e).exp??n}catch{a=n}return a-n<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 $&&this.clearAuth(),e instanceof Error?Promise.reject(e):Promise.reject(new Error((e??tt).toString()))}}}async handleUnauthorized(e,n){const a=this.client.store.getState();if(e.url.endsWith("/token/refresh/"))throw a.authReducer.isLoggedIn&&console.warn("No signed-in user to sign out."),this.clearAuth(),new $({message:"You have been signed out due to inactivity.",response:n,discard:!0});if(a.authReducer.isLoggedIn)await this.renewTokens();else throw console.debug("Forbidden; user is not logged in."),new $({message:"Incorrect username or password.",response:n,discard:!0})}async initAuth(e){const n=xe.v4();return console.debug(this.constructor.name,"Initiating auth"),this.performRequest({uuid:n,method:f.POST,url:this.initTokensUrl,payload:e,isAuthNeeded:!1,checkAuth:!1}).then(a=>{this.setTokens(ib(a))})}}class ab extends st{constructor(){super(...arguments);m(this,"name","Organization Access");m(this,"url","/organization-accesses");m(this,"actions",{addOne:ES,addMany:BS,setOne:jS,setMany:qS,updateOne:DS,updateMany:$S,deleteOne:US,deleteMany:CS,initialize:zS});m(this,"selectors",{selectById:kS,selectByIds:NS})}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState()),l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:"Edit organization access",method:f.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(d=>{throw this.dispatch(a(r)),d}),[l,u]}async remove(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l),d=Vt(u.user)(l);this.dispatch(a(u.uuid)),this.dispatch(yn(u.user));try{await this.enqueueRequest({description:"Remove organization access",method:f.DELETE,url:`${this.url}/${u.uuid}/`,blockers:[u.uuid],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(mn(d)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class cb extends st{constructor(){super(...arguments);m(this,"name","Organization");m(this,"url","/organizations");m(this,"actions",{addOne:JS,addMany:ZS,setOne:YS,setMany:KS,updateOne:QS,updateMany:XS,deleteOne:xS,deleteMany:eT,initialize:WS});m(this,"selectors",{selectById:iT,selectByIds:nT})}async add(e){const{addOne:n}=this.actions,a=await this.enqueueRequest({description:"Create organization",method:f.POST,url:`${this.url}/`,payload:e,blockers:[],blocks:[]});return this.dispatch(n(a)),a}async update(e){const{setOne:n}=this.actions,a=await this.enqueueRequest({description:"Edit organization",method:f.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return this.dispatch(n(a)),a}async invite(e,n){return this.enqueueRequest({description:"Invite user to organization",method:f.POST,url:`${this.url}/${e}/invite/${n}/`,blockers:[],blocks:[]})}async refreshStore(e){const{initialize:n}=this.actions,a=await this.list({},e);return this.dispatch(n(a)),a}}class db extends w{constructor(){super(...arguments);m(this,"name","Project Access");m(this,"url","/project-accesses");m(this,"actions",{addOne:yT,addMany:pT,setOne:AT,setMany:fT,updateOne:ST,updateMany:TT,deleteOne:IT,deleteMany:OT,initialize:mT});m(this,"selectors",{selectById:PT,selectByIds:gT})}add(e){var d;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=b({...e,created_by:((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null});this.dispatch(a(l));const u=this.enqueueRequest({description:"Add project access",method:f.POST,url:`${this.url}/`,payload:z(l),blockers:[l.organization_access,l.project],blocks:[l.uuid]});return u.then(h=>{this.dispatch(c(h))}).catch(h=>{throw this.dispatch(r(l.uuid)),h}),[l,u]}bulkAdd(e){var h;const{store:n}=this.client,{addMany:a,deleteMany:c,updateMany:r}=this.actions,l=((h=n.getState().userReducer.currentUser)==null?void 0:h.id)??null,u=e.map(y=>b({...y,created_by:l}));this.dispatch(a(u));const d=this.enqueueRequest({description:"Add project accesses",method:f.POST,url:`${this.url}/bulk/`,payload:{project_accesses:u.map(y=>z(y))},blockers:u.flatMap(y=>[y.project,y.organization_access]),blocks:u.map(y=>y.uuid)});return d.then(y=>{this.dispatch(r(y))}).catch(y=>{throw this.dispatch(c(u.map(A=>A.uuid))),y}),[u,d]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState()),l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:"Edit project access",method:f.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[]});return u.then(d=>{this.dispatch(a(d))}).catch(d=>{throw this.dispatch(a(r)),d}),[l,u]}async remove(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());this.dispatch(a(e));try{await this.enqueueRequest({description:"Delete project access",method:f.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{project__organization:e}},n);return this.dispatch(a(c)),c}}class rb extends Ye{constructor(){super(...arguments);m(this,"name","Project Attachment");m(this,"url","/project-attachments");m(this,"actions",{addOne:MT,addMany:RT,setOne:wT,setMany:vT,updateOne:VT,updateMany:zT,deleteOne:ET,deleteMany:BT,initialize:_T});m(this,"selectors",{selectById:qT,selectByIds:DT})}getId(e){return e.uuid}buildModel(e){return b({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,project:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,project:e.project}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.projectUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{project__organization:e}},n);return this.dispatch(a(c)),c}}class ub extends w{constructor(){super(...arguments);m(this,"name","Project File");m(this,"url","/project-files");m(this,"actions",{addOne:NT,addMany:GT,setOne:LT,setMany:kT,updateOne:HT,updateMany:WT,deleteOne:KT,deleteMany:YT,initialize:CT});m(this,"selectors",{selectById:eI,selectByIds:tI})}async saveExisting(e){const{setOne:n}=this.actions;if(!e.uuid)throw new Error("You can only use this method to save existing project files. The one provided has no uuid.");const a={...e};delete a.file;const c=this.enqueueRequest({method:f.PATCH,url:`${this.url}/${e.uuid}/`,payload:a,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(n(r))}),c}saveActive(){const{store:e}=this.client,{setOne:n}=this.actions,a=e.getState(),c=a.projectFileReducer.activeProjectFileId;if(!c)throw new Error("No active project file");const r=a.projectFileReducer.instances[c];if(!r)throw new Error("No active project file");if(!r.bounds&&!r.canvas_bounds)throw new Error("Project file must either have bounds or canvas_bounds set");let l;if(typeof r.file=="string"&&!r.file.startsWith("blob:")){const h={...r};delete h.file,l={method:f.PATCH,url:`${this.url}/${c}/`,payload:h,blockers:[c],blocks:[c]}}else l=new Promise((h,y)=>{this.client.files.uploadFileToS3(r.file_sha1).then(([A])=>{h({method:f.POST,url:`${this.url}/`,payload:{...r,...A},blockers:[c],blocks:[c]})}).catch(y)});const d=Promise.resolve(l).then(h=>this.enqueueRequest(h));return d.then(h=>{this.dispatch(n(h))}),this.dispatch(XT),this.dispatch(JT(null)),this.dispatch(ZT(!1)),[r,d]}delete(e){const{deleteOne:n}=this.actions;return this.dispatch(n(e)),this.enqueueRequest({method:f.DELETE,url:`${this.url}/${e}`,blockers:[e],blocks:[]})}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(r)),r}}class lb extends st{constructor(){super(...arguments);m(this,"name","Project");m(this,"url","/projects");m(this,"actions",{addOne:rI,addMany:dI,setOne:cI,setMany:aI,updateOne:lI,updateMany:uI,deleteOne:oI,deleteMany:hI,initialize:nI});m(this,"selectors",{selectById:pI,selectByIds:AI})}async add(e){const{addOne:n}=this.actions,a=await this.performRequest({method:f.POST,url:`${this.url}/`,payload:z(e)});return this.dispatch(n(a)),a}async update(e){const{updateOne:n}=this.actions,a=await this.performRequest({method:f.PATCH,url:`${this.url}/${e.uuid}/`,payload:z(e)});return this.dispatch(n(a)),a}async delete(e){const{deleteOne:n}=this.actions,a=await this.enqueueRequest({description:"Delete project",method:f.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return this.dispatch(n(e)),a}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class ob extends w{constructor(){super(...arguments);m(this,"name","Team Membership");m(this,"url","/team-memberships");m(this,"actions",{addOne:II,addMany:OI,setOne:FI,setMany:PI,updateOne:gI,updateMany:bI,deleteOne:_I,deleteMany:MI,initialize:TI});m(this,"selectors",{selectById:vI,selectByIds:VI})}add(e){var d;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=b({...e,created_by:((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null});this.dispatch(a(l));const u=this.enqueueRequest({description:"Create team membership",method:f.POST,url:`${this.url}/`,payload:z(l),blockers:[e.team],blocks:[l.uuid]});return u.then(h=>{this.dispatch(c(h))}).catch(()=>{this.dispatch(r(l.uuid))}),[l,u]}bulkAdd(e){var h;const{store:n}=this.client,{addMany:a,setMany:c,deleteMany:r}=this.actions,l=((h=n.getState().userReducer.currentUser)==null?void 0:h.id)??null,u=e.map(y=>b({...y,created_by:l}));this.dispatch(a(u));const d=this.enqueueRequest({description:"Create team memberships",method:f.POST,url:`${this.url}/bulk/`,payload:{team_memberships:u.map(y=>z(y))},blockers:u.map(y=>y.team),blocks:u.map(y=>y.uuid)});return d.then(y=>{this.dispatch(c(y))}).catch(()=>{this.dispatch(r(u.map(y=>y.uuid)))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected team membership with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:"Delete team membership",method:f.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{team__organization:e}},n);return this.dispatch(a(c)),c}}class hb extends w{constructor(){super(...arguments);m(this,"name","Team");m(this,"url","/teams");m(this,"actions",{addOne:BI,addMany:jI,setOne:qI,setMany:DI,updateOne:$I,updateMany:UI,deleteOne:CI,deleteMany:LI,initialize:EI});m(this,"selectors",{selectById:NI,selectByIds:GI})}add(e){var d;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=b({...e,submitted_at:new Date().toISOString(),created_by:((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null});this.dispatch(a(l));const u=this.enqueueRequest({description:"Create team",method:f.POST,url:`${this.url}/`,payload:z(l),blockers:[],blocks:[l.uuid]});return u.then(h=>{this.dispatch(c(h))}).catch(()=>{this.dispatch(r(l.uuid))}),[l,u]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected team with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:"Update team",method:f.PATCH,url:`${this.url}/${e.uuid}/`,payload:z(e),blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:"Delete team",method:f.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class mb extends st{constructor(){super(...arguments);m(this,"name","User");m(this,"url","/user");m(this,"actions",{addOne:mn,addMany:gS,setOne:PS,setMany:FS,updateOne:_S,updateMany:bS,deleteOne:yn,deleteMany:MS,initialize:OS});m(this,"selectors",{selectById:Vt,selectByIds:vS})}async list(e,n){const{organizationUuid:a,...c}=e,r=a?`/organizations/${a}${this.url}s/`:`/${this.url}`;return this.performRequest({method:f.GET,url:r,...c},n)}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({organizationUuid:e},n);return this.dispatch(a(c)),c}}async function Bn(t,s,e,n,a){const c=n instanceof Ze;c&&s.checkAuth!==!1&&await n.auth.prepareAuth();const r={queryParams:"",isAuthNeeded:!0},{s3url:l,payload:u,headers:d,method:h,queryParams:y,attachmentHash:A,isExternalUrl:p,isAuthNeeded:S,isResponseBlob:F}={...r,...s};let O=s.url;const P=A?await e.files.fetchCache(A):void 0;if(A&&!P)throw new Error(`Cannot upload file ${A} because it's not cached.`);!p&&!O.startsWith("http")&&(!O.startsWith("/")&&!O.startsWith("blob:")&&(O="/"+O),O=t+O);const R=j=>{if(A){if(!l)throw new Error(`No S3 URL for file ${A}`);if("warning"in l)throw new Error(`S3 URL warning for file ${A}`);if(!P)throw new Error(`No file for file ${A}`);const D=l.fields["x-amz-checksum-sha1"];if(!D)throw new Error(`No checksum for file ${A}`);return j.set("x-amz-checksum-sha1",D).field({...u,...l.fields}).attach("file",P)}return j.send(u)},v={[f.GET]:()=>F?Qe.get(O.toString()).responseType("blob"):Qe.get(O.toString()),[f.POST]:()=>{const j=Qe.post(O.toString());return R(j)},[f.PATCH]:()=>{const j=Qe.patch(O.toString());return R(j)},[f.PUT]:()=>{const j=Qe.put(O.toString());return R(j)},[f.DELETE]:()=>{const j=Qe.delete(O.toString());return R(j)}}[h];let E=v();if(a==null||a.addEventListener("abort",()=>{console.debug("aborting request:",s),E.abort()}),S&&c){const j=n.auth.getAuthHeader();E=E.set("Authorization",j)}d&&(E=E.set(d));try{return await E.query(y)}catch(j){const D=rO(j),IO=D==null?void 0:D.status;if(c&&IO===401)return await n.auth.handleUnauthorized(E,D),E.query(y);throw new $({response:D,innerError:j,discard:vn.includes(IO)})}}class yb{constructor(s){m(this,"store");this.store=s}_performRequest(s,e,n,a){const c=new $t,r={...e,uuid:e.uuid??xe.v4()};return Bn(s,r,this,n,a).then(l=>{c.resolve(l.body)}).catch(l=>{l instanceof Error?c.reject(l):c.reject(new Error((l??tt).toString()))}),c}async performRequest(s,e,n,a){return this._performRequest(s,e,n,a).then(c=>{if(c instanceof $)throw c;return c})}async enqueueRequest(s,e,n){return this._enqueueRequest(s,e,n).then(a=>{if(a instanceof $)throw a;return a})}_enqueueRequest(s,e,n){const a=new $t,c={...s,BASE_URL:e,serviceName:n},r=this.store.dispatch(rT(c)),l=d=>{if(d)a.resolve(d.body);else{const h=new $({message:"Could not get a response from the server.",response:d,discard:!0});a.reject(h)}},u=d=>{d instanceof $?d.options.discard=!0:(console.error("Received an unexpected error while processing a request:",d,`
15
+ Converting error to APIError and discarding.`),d=new $({message:"An error occurred while processing the request.",innerError:d,discard:!0})),a.reject(d)};return r.then(l,u),a}async performPagination(s,e,n,a,c){const r={...e,queryParams:{...e.queryParams,paginate:!0,limit:n}},{method:l}=r,u=[];let d=await this.performRequest(s,r,a,c);for(u.push(d.results);d.next;)d=await this.performRequest(s,{url:d.next,method:l},a,c),u.push(d.results);return u}}class it{constructor(){m(this,"graph");m(this,"requestAttemptCounter");this.graph=new RO.DepGraph,this.requestAttemptCounter={}}static _fromOutbox(s){const e=new it;for(let n=0;n<s.length;n++){const a=s[n];if(!a){console.error("Outbox item was undefined");continue}e.sneakRequest(a);for(let c=0;c<n;c++){const r=s[c];if(!r){console.error("Previous outbox item was undefined");continue}r.payload.uuid!==a.payload.uuid&&r.payload.blocks.some(l=>a.payload.blockers.includes(l))&&it._addDependency(a.payload.uuid,r.payload.uuid,e.graph)}}return e}_addDependency(s,e){it._addDependency(s,e,this.graph)}static _addDependency(s,e,n){if(s===e)throw new Error(`Tried to add dependency from node to itself: ${s}`);if(!n.hasNode(s))throw new Error(`Tried to add dependency from non-existent node: ${s} (to node: ${e})`);if(!n.hasNode(e))throw new Error(`Tried to add dependency to non-existent node: ${e} (from node: ${s})`);n.addDependency(s,e)}addRequest(s){if(this.graph.addNode(s.payload.uuid,s),!(s.payload.blockers.length===0||this.graph.size()===1))for(const e of this.graph.overallOrder()){if(e===s.payload.uuid)continue;const n=this.graph.getNodeData(e);s.payload.blockers.some(a=>n.payload.blocks.includes(a))&&this._addDependency(s.payload.uuid,e)}}insertRequest(s){this.graph.addNode(s.payload.uuid,s);for(const e of this.graph.overallOrder()){if(e===s.payload.uuid)continue;this.graph.getNodeData(e).payload.blockers.some(a=>s.payload.blocks.includes(a))&&this._addDependency(e,s.payload.uuid)}}sneakRequest(s){this.graph.addNode(s.payload.uuid,s)}_getNextNode(){const s=this.graph.overallOrder(!0);let e=1/0,n;for(const a of s){const c=this.requestAttemptCounter[a]||0;c<e&&(e=c,n=a)}return n}peek(){const s=this._getNextNode();if(s)return this.graph.getNodeData(s)}remove(s){this.graph.removeNode(s),delete this.requestAttemptCounter[s]}pop(){const s=this.peek();return s&&this.graph.removeNode(s.payload.uuid),s}getQueue(){const s=this.graph.overallOrder().map(n=>this.graph.getNodeData(n)),e=this._getNextNode();if(e){const n=this.graph.getNodeData(e),a=s.findIndex(c=>c.payload.uuid===n.payload.uuid);a!==-1&&(s.splice(a,1),s.unshift(n))}return s}getReady(){let s=this.graph.overallOrder(!0).map(e=>this.graph.getNodeData(e));return s=s.sort((e,n)=>e.meta.offline.effect.timestamp.localeCompare(n.meta.offline.effect.timestamp)),s=s.sort((e,n)=>{const a=this.requestAttemptCounter[e.payload.uuid]||0,c=this.requestAttemptCounter[n.payload.uuid]||0;return a-c}),s}registerRetry(s){this.requestAttemptCounter[s]=(this.requestAttemptCounter[s]||0)+1}}let uO;function lO(t){uO=t}function nt(){return uO}let oO;function hO(t){oO=t}function mO(){return oO}let jn=null;function Xe(){const t=nt();if(!t)return console.warn("Client store not set; cannot get outbox coordinator yet."),null;if(jn)return jn;const s=t.getState().offline.outbox,e=it._fromOutbox(s);return jn=e,e}const pb=(t,s)=>{const e=new s(t);return hO(e),lO(t),e};class Ab{constructor(s){m(this,"_all");m(this,"_previous");this._all=[s],this._previous=s,this.then=this.then.bind(this),this.compile=this.compile.bind(this)}then(s){return this._previous&&(this._previous.next=s),this._all.push(s),this._previous=s,{then:this.then,compile:this.compile}}compile(){return this._all}}class qn{constructor(){m(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),!nt())throw new Error("Client store not set");const n=mO();if(!n)throw new Error("Client SDK not set");return aO(s,n)}}}class yO extends qn{async run(s){return super.run(s)}}class pO extends qn{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=$,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=ag,i.AssetProcedureTypeFieldValuesService=cg,i.AssetProcedureTypeFieldsAttachmentService=ig,i.AssetProcedureTypeFieldsService=ng,i.AssetProcedureTypeService=rg,i.AssetService=yg,i.AssetStageCompletionService=pg,i.AssetStageService=Ag,i.AssetStatusType=kn,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=Nn,i.BaseApiService=Ze,i.BaseModelApiService=st,i.BaseOfflineAttachmentModelService=Ye,i.BaseOfflineModelApiService=w,i.BaseSDK=yb,i.COMMON_AUTO_FIELDS=Jn,i.CategoryService=_g,i.DEFAULT_ISSUE_PRIORITY=wO,i.DEFAULT_PAGE_SIZE=ZI,i.DISCARD_HTTP_STATUSES=vn,i.DeferredPromise=$t,i.DocumentAttachmentService=Mg,i.DocumentService=Rg,i.EMPTY_ARRAY=Un,i.EMPTY_OBJECT=Cn,i.EmailDomainsService=wg,i.EmailVerificationService=vg,i.FileService=zg,i.FormIdentifierService=Eg,i.FormIdentifierValueService=Bg,i.FormRevisionAttachmentService=jg,i.FormRevisionService=qg,i.FormService=Dg,i.FormSubmissionAttachmentService=$g,i.FormSubmissionService=Ug,i.GeoImageService=Cg,i.HttpMethod=f,i.IssueAssociationService=Lg,i.IssueAttachmentService=kg,i.IssueCommentAttachmentService=Ng,i.IssueCommentService=Gg,i.IssuePriority=Dt,i.IssueService=Hg,i.IssueStatusType=Gn,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=q,i.IssueUpdateService=tb,i.JWTService=nb,i.OUTBOX_RETRY_DELAY=Hn,i.OfflineAnalyticsMiddleware=yO,i.OfflineMiddleware=qn,i.OrganizationAccessLevel=Ln,i.OrganizationAccessService=ab,i.OrganizationService=cb,i.OutboxCoordinator=it,i.ProjectAccessService=db,i.ProjectAttachmentService=rb,i.ProjectFileService=ub,i.ProjectService=lb,i.RESET_ORGANIZATION_STATE=M,i.RESET_PROJECT_STATE=B,i.RESET_STATE=g,i.RateLimitingMiddleware=pO,i.SelectorBuilder=CP,i.TeamMembershipService=ob,i.TeamService=hb,i.UNKNOWN_ERROR_MESSAGE=tt,i.UserService=mb,i.VERSION_REDUCER_KEY=at,i.VerificationCodeType=SO,i._setLatestRetryTime=lT,i.addAsset=_r,i.addAssetAttachment=oa,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=ga,i.addAssetProcedureTypeAttachments=ba,i.addAssetProcedureTypeFieldValues=bc,i.addAssetProcedureTypeFieldValuesAttachment=hc,i.addAssetProcedureTypeFieldValuesAttachments=ts,i.addAssetProcedureTypeFieldValuesMany=_c,i.addAssetProcedureTypeFields=Qa,i.addAssetProcedureTypeFieldsAttachment=$a,i.addAssetProcedureTypeFieldsAttachments=Ua,i.addAssetProcedureTypeFieldsMany=xa,i.addAssetProcedureTypes=xc,i.addAssetProcedures=cs,i.addAssetStage=tu,i.addAssetStageCompletion=$r,i.addAssetStageCompletions=Ur,i.addAssetStages=su,i.addAssetType=so,i.addAssetTypeAttachment=hu,i.addAssetTypeAttachments=Vs,i.addAssetTypeFieldValues=hl,i.addAssetTypeFieldValuesAttachment=xu,i.addAssetTypeFieldValuesAttachments=$s,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=Eo,i.addCategory=zo,i.addConversation=aa,i.addConversations=tF,i.addDocument=ah,i.addDocumentAttachment=Ho,i.addDocumentAttachments=Wo,i.addDocuments=ch,i.addEmailDomain=Th,i.addEmailDomains=Ih,i.addForm=qm,i.addFormIdentifier=$h,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=Dm,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=DA,i.addIssueTypeFieldsAttachment=uA,i.addIssueTypeFieldsAttachments=lA,i.addIssueTypeFieldsMany=$A,i.addIssueTypeIdentifier=of,i.addIssueTypeIdentifierValue=bf,i.addIssueTypeIdentifierValues=_f,i.addIssueTypeIdentifiers=hf,i.addIssueTypeStatus=xf,i.addIssueTypeStatuses=eS,i.addIssueTypes=Cf,i.addIssueUpdate=cn,i.addIssueUpdates=dn,i.addIssues=$i,i.addOrganization=JS,i.addOrganizationAccess=ES,i.addOrganizationAccesses=BS,i.addOrganizations=ZS,i.addProject=rI,i.addProjectAccess=yT,i.addProjectAccesses=pT,i.addProjectAttachment=MT,i.addProjectAttachments=RT,i.addProjectFile=NT,i.addProjectFiles=GT,i.addProjects=dI,i.addTeam=BI,i.addTeamMembership=II,i.addTeamMemberships=OI,i.addTeams=jI,i.addUser=mn,i.addUsers=gS,i.agentsReducer=ra,i.agentsSlice=Nt,i.areArraysEqual=zO,i.assetAttachmentReducer=Oa,i.assetAttachmentSlice=Ht,i.assetProcedureReducer=Hc,i.assetProcedureSlice=as,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=za,i.assetProcedureTypeAttachmentSlice=Zt,i.assetProcedureTypeFieldValuesAttachmentReducer=Sc,i.assetProcedureTypeFieldValuesAttachmentSlice=es,i.assetProcedureTypeFieldValuesReducer=Ec,i.assetProcedureTypeFieldValuesSlice=ns,i.assetProcedureTypeFieldsAttachmentReducer=Wa,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=Ds,i.assetTypeFieldValuesReducer=Pl,i.assetTypeFieldValuesSlice=Ls,i.assetTypeFieldsAttachmentReducer=qu,i.assetTypeFieldsAttachmentSlice=Bs,i.assetTypeFieldsReducer=Ju,i.assetTypeFieldsSlice=qs,i.assetTypeIdentifierReducer=Dl,i.assetTypeIdentifierSlice=ks,i.assetTypeIdentifierValueReducer=Xl,i.assetTypeIdentifierValueSlice=Gs,i.assetTypeReducer=ho,i.assetTypeSlice=Hs,i.assetTypeStatusReducer=_o,i.assetTypeStatusSlice=Ks,i.assetTypeStatusSortFn=ea,i.authReducer=wo,i.authSlice=It,i.baseReducer=DP,i.baseReducers=wn,i.blobToBase64=LO,i.categoryReducer=ko,i.categorySlice=Zs,i.clearTokens=UF,i.constructUploadedFilePayloads=CO,i.createModelAdapter=_,i.createOfflineAction=cT,i.createPayload=z,i.createSelectionAdapter=vO,i.deleteAsset=wr,i.deleteAssetAttachment=Aa,i.deleteAssetAttachments=Kt,i.deleteAssetProcedure=kc,i.deleteAssetProcedureStep=Sr,i.deleteAssetProcedureStepFieldValues=nr,i.deleteAssetProcedureStepFieldValuesAttachment=Gd,i.deleteAssetProcedureStepFieldValuesAttachments=As,i.deleteAssetProcedureStepFieldValuesMany=ar,i.deleteAssetProcedureStepFields=zd,i.deleteAssetProcedureStepFieldsAttachment=Sd,i.deleteAssetProcedureStepFieldsAttachments=Td,i.deleteAssetProcedureStepFieldsMany=Ed,i.deleteAssetProcedureSteps=Tr,i.deleteAssetProcedureType=sd,i.deleteAssetProcedureTypeAttachment=va,i.deleteAssetProcedureTypeAttachments=Va,i.deleteAssetProcedureTypeFieldValues=Vc,i.deleteAssetProcedureTypeFieldValuesAttachment=fc,i.deleteAssetProcedureTypeFieldValuesAttachments=ss,i.deleteAssetProcedureTypeFieldValuesMany=zc,i.deleteAssetProcedureTypeFields=nc,i.deleteAssetProcedureTypeFieldsAttachment=Ga,i.deleteAssetProcedureTypeFieldsAttachments=Ha,i.deleteAssetProcedureTypeFieldsMany=ac,i.deleteAssetProcedureTypes=id,i.deleteAssetProcedures=ds,i.deleteAssetStage=au,i.deleteAssetStageCompletion=Gr,i.deleteAssetStageCompletions=Hr,i.deleteAssetStages=cu,i.deleteAssetType=co,i.deleteAssetTypeAttachment=fu,i.deleteAssetTypeAttachments=zs,i.deleteAssetTypeFieldValues=Sl,i.deleteAssetTypeFieldValuesAttachment=nl,i.deleteAssetTypeFieldValuesAttachments=Us,i.deleteAssetTypeFieldValuesMany=Tl,i.deleteAssetTypeFields=Hu,i.deleteAssetTypeFieldsAttachment=Vu,i.deleteAssetTypeFieldsAttachments=zu,i.deleteAssetTypeFieldsMany=Wu,i.deleteAssetTypeIdentifier=zl,i.deleteAssetTypeIdentifierValue=Wl,i.deleteAssetTypeIdentifierValues=Kl,i.deleteAssetTypeIdentifiers=El,i.deleteAssetTypeStatus=Oo,i.deleteAssetTypeStatuses=Fo,i.deleteAssetTypes=ro,i.deleteAssets=Ps,i.deleteCategories=Uo,i.deleteCategory=$o,i.deleteConversation=nF,i.deleteConversations=aF,i.deleteDocument=oh,i.deleteDocumentAttachment=Xo,i.deleteDocumentAttachments=Qo,i.deleteDocuments=hh,i.deleteEmailDomain=bh,i.deleteEmailDomains=_h,i.deleteForm=km,i.deleteFormIdentifier=Gh,i.deleteFormIdentifierValue=nm,i.deleteFormIdentifierValues=am,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=Nm,i.deleteGeoImage=My,i.deleteGeoImages=Ry,i.deleteIssue=Lp,i.deleteIssueAssociation=Cy,i.deleteIssueAssociations=_t,i.deleteIssueAttachment=tp,i.deleteIssueAttachments=Vi,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=NA,i.deleteIssueTypeFieldsAttachment=pA,i.deleteIssueTypeFieldsAttachments=AA,i.deleteIssueTypeFieldsMany=GA,i.deleteIssueTypeIdentifier=ff,i.deleteIssueTypeIdentifierValue=Vf,i.deleteIssueTypeIdentifierValues=zf,i.deleteIssueTypeIdentifiers=Sf,i.deleteIssueTypeStatus=aS,i.deleteIssueTypeStatuses=cS,i.deleteIssueTypes=Wf,i.deleteIssueUpdate=rn,i.deleteIssueUpdates=un,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=ET,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=yn,i.deleteUsers=MS,i.dequeue=nO,i.discard=cO,i.documentAttachmentReducer=sh,i.documentAttachmentSlice=Qs,i.documentSlice=ei,i.documentsReducer=Ah,i.downloadFile=kO,i.downloadInMemoryFile=UO,i.emailDomainsReducer=vh,i.emailDomainsSlice=ti,i.emailRegex=XO,i.enqueue=iO,i.enqueueRequest=rT,i.extractResponseFromError=rO,i.fallbackToEmptyArray=I,i.fallbackToEmptyObject=ht,i.fileReducer=jh,i.fileSlice=ii,i.fileToBlob=Yn,i.formIdentifierReducer=Zh,i.formIdentifierSlice=ni,i.formIdentifierValueReducer=um,i.formIdentifierValueSlice=ci,i.formReducer=Gm,i.formRevisionAttachmentReducer=Pm,i.formRevisionAttachmentSlice=di,i.formRevisionReducer=Em,i.formRevisionsSlice=ri,i.formSlice=yi,i.formSubmissionAttachmentReducer=ay,i.formSubmissionAttachmentSlice=Ai,i.formSubmissionReducer=Sy,i.formSubmissionSlice=Fi,i.geoImageReducer=zy,i.geoImageSlice=_i,i.getAssetProcedureStepSubTree=xn,i.getAssetProcedureStepTrees=QO,i.getClientSDK=mO,i.getClientStore=nt,i.getDocumentSubTree=eF,i.getDocumentTrees=xO,i.getFileIdentifier=$O,i.getFileS3Key=kt,i.getLocalDateString=Wn,i.getLocalRelativeDateString=qO,i.getOutboxCoordinator=Xe,i.getRenamedFile=Kn,i.hashFile=et,i.initSDK=pb,i.initializeAssetAttachments=la,i.initializeAssetProcedureStepFieldValues=Xd,i.initializeAssetProcedureStepFieldValuesAttachments=$d,i.initializeAssetProcedureStepFields=bd,i.initializeAssetProcedureStepFieldsAttachments=od,i.initializeAssetProcedureSteps=or,i.initializeAssetProcedureTypeAttachments=Pa,i.initializeAssetProcedureTypeFieldValues=gc,i.initializeAssetProcedureTypeFieldValuesAttachments=oc,i.initializeAssetProcedureTypeFields=Xa,i.initializeAssetProcedureTypeFieldsAttachments=Da,i.initializeAssetProcedureTypes=Xc,i.initializeAssetProcedures=$c,i.initializeAssetStageCompletions=Dr,i.initializeAssetStages=Qr,i.initializeAssetTypeAttachments=ou,i.initializeAssetTypeFieldValues=ol,i.initializeAssetTypeFieldValuesAttachments=Qu,i.initializeAssetTypeFields=$u,i.initializeAssetTypeFieldsAttachments=gu,i.initializeAssetTypeIdentifierValues=Ul,i.initializeAssetTypeIdentifiers=bl,i.initializeAssetTypeStatuses=yo,i.initializeAssetTypes=xl,i.initializeAssets=br,i.initializeCategories=Vo,i.initializeConversations=na,i.initializeDocumentAttachments=Go,i.initializeDocuments=nh,i.initializeEmailDomains=Sh,i.initializeFormIdentifierValues=Xh,i.initializeFormIdentifiers=Dh,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=$f,i.initializeIssueUpdates=oS,i.initializeIssues=jp,i.initializeOrganizationAccesses=zS,i.initializeOrganizations=WS,i.initializeProjectAccesses=mT,i.initializeProjectAttachments=_T,i.initializeProjectFiles=CT,i.initializeProjects=nI,i.initializeTeamMemberships=TI,i.initializeTeams=EI,i.initializeUsers=OS,i.isToday=jO,i.issueAssociationReducer=Ky,i.issueAssociationSlice=Ri,i.issueAttachmentReducer=cp,i.issueAttachmentSlice=wi,i.issueCommentAttachmentReducer=Ip,i.issueCommentAttachmentSlice=Ei,i.issueCommentReducer=Ep,i.issueCommentSlice=ji,i.issueReducer=Wp,i.issueSlice=Di,i.issueTypeAttachmentReducer=cA,i.issueTypeAttachmentSlice=Ci,i.issueTypeFieldValuesAttachmentReducer=rf,i.issueTypeFieldValuesAttachmentSlice=Wi,i.issueTypeFieldValuesReducer=BA,i.issueTypeFieldValuesSlice=Gi,i.issueTypeFieldsAttachmentReducer=IA,i.issueTypeFieldsAttachmentSlice=ki,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=tn,i.issueTypeStatusSortFn=ta,i.issueUpdateReducer=TS,i.issueUpdateSlice=an,i.logOnlyOnce=NO,i.markAsDeleted=uT,i.markForDeletion=OP,i.memoize=Ct,i.onlyUniqueHashes=JO,i.onlyUniqueOfflineIds=ZO,i.organizationAccessReducer=LS,i.organizationAccessSlice=An,i.organizationReducer=aT,i.organizationSlice=fn,i.outboxReducer=oT,i.outboxSlice=Sn,i.overmapEnhancer=YP,i.overmapReducer=$P,i.overmapReducers=YI,i.performRequest=Bn,i.performRequestFromAction=aO,i.projectAccessReducer=FT,i.projectAccessSlice=Tn,i.projectAttachmentReducer=$T,i.projectAttachmentSlice=On,i.projectFileReducer=sI,i.projectFileSlice=Pn,i.projectReducer=mI,i.projectSlice=gn,i.rehydratedReducer=fI,i.rehydratedSlice=bn,i.restructureCreateSelectorWithArgs=T,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=Fn,i.selectAssetAttachmentById=Sa,i.selectAssetAttachmentMapping=fa,i.selectAssetAttachments=Yt,i.selectAssetAttachmentsByIds=Ta,i.selectAssetById=Er,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=Ba,i.selectAssetProcedureTypeAttachmentMapping=Ea,i.selectAssetProcedureTypeAttachments=Jt,i.selectAssetProcedureTypeAttachmentsByIds=ja,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=Ya,i.selectAssetProcedureTypeFieldsAttachments=Qt,i.selectAssetProcedureTypeFieldsAttachmentsByIds=Za,i.selectAssetProcedureTypeFieldsAttachmentsMapping=Ka,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=Es,i.selectAssetTypeAttachmentsByIds=Iu,i.selectAssetTypeById=lo,i.selectAssetTypeFieldValues=St,i.selectAssetTypeFieldValuesAttachmentById=cl,i.selectAssetTypeFieldValuesAttachments=Cs,i.selectAssetTypeFieldValuesAttachmentsByIds=dl,i.selectAssetTypeFieldValuesAttachmentsMapping=al,i.selectAssetTypeFieldValuesById=Ol,i.selectAssetTypeFieldValuesByIds=Fl,i.selectAssetTypeFieldValuesMapping=Il,i.selectAssetTypeFieldValuesOfAsset=VF,i.selectAssetTypeFields=dt,i.selectAssetTypeFieldsAttachmentById=Bu,i.selectAssetTypeFieldsAttachments=js,i.selectAssetTypeFieldsAttachmentsByIds=ju,i.selectAssetTypeFieldsAttachmentsMapping=Eu,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=Ns,i.selectAssetTypeIdentifiersByIds=ql,i.selectAssetTypeIdentifiersOfAssetType=EF,i.selectAssetTypeStatusById=go,i.selectAssetTypeStatusMapping=Po,i.selectAssetTypeStatuses=Ys,i.selectAssetTypeStatusesByIds=bo,i.selectAssetTypeStatusesOfAssetType=DF,i.selectAssetTypeValuesOfAssetType=zF,i.selectAssetTypes=Ws,i.selectAssetTypesByIds=oo,i.selectAssetTypesMapping=uo,i.selectAssetTypesOfOrganization=qF,i.selectAssets=gs,i.selectAssetsByIds=Br,i.selectAssetsMapping=zr,i.selectAssetsOfAssetType=bs,i.selectAttachmentsOfAsset=Ia,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=NF,i.selectAttachmentsOfFormRevision=XF,i.selectAttachmentsOfFormSubmission=ny,i.selectAttachmentsOfIssue=ip,i.selectAttachmentsOfIssueComment=tP,i.selectAttachmentsOfIssueType=nP,i.selectAttachmentsOfIssueTypeFieldValues=df,i.selectAttachmentsOfIssueTypeFields=aP,i.selectAttachmentsOfProject=bP,i.selectCategories=Js,i.selectCategoriesByIds=Lo,i.selectCategoriesOfProject=kF,i.selectCategoryById=Xs,i.selectCategoryMapping=Co,i.selectCommentsOfIssue=sP,i.selectConversation=dF,i.selectConversationMapping=Gt,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=ai,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=Vm,i.selectFormRevisionsOfForm=zm,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=Vy,i.selectGeoImagesOfProject=eP,i.selectIsImportingProjectFile=MP,i.selectIsLoggedIn=LF,i.selectIssueAssociationById=ky,i.selectIssueAssociationMapping=rt,i.selectIssueAssociations=Ly,i.selectIssueAssociationsByIds=Ny,i.selectIssueAssociationsOfAsset=Wy,i.selectIssueAssociationsOfIssue=Hy,i.selectIssueAssociationsToIssue=Gy,i.selectIssueAttachmentById=np,i.selectIssueAttachmentMapping=sp,i.selectIssueAttachments=zi,i.selectIssueAttachmentsByIds=ap,i.selectIssueById=Np,i.selectIssueCommentAttachmentById=Sp,i.selectIssueCommentAttachmentMapping=fp,i.selectIssueCommentAttachments=Bi,i.selectIssueCommentAttachmentsByIds=Tp,i.selectIssueCommentById=Vp,i.selectIssueCommentMapping=qi,i.selectIssueCommentsByIds=zp,i.selectIssueMapping=kp,i.selectIssueTypeAttachmentById=nA,i.selectIssueTypeAttachmentMapping=iA,i.selectIssueTypeAttachments=Li,i.selectIssueTypeAttachmentsByIds=aA,i.selectIssueTypeById=Yf,i.selectIssueTypeFieldValues=Rt,i.selectIssueTypeFieldValuesAttachmentById=af,i.selectIssueTypeFieldValuesAttachments=Zi,i.selectIssueTypeFieldValuesAttachmentsByIds=cf,i.selectIssueTypeFieldValuesAttachmentsMapping=nf,i.selectIssueTypeFieldValuesById=zA,i.selectIssueTypeFieldValuesByIds=EA,i.selectIssueTypeFieldValuesMapping=VA,i.selectIssueTypeFieldValuesOfIssue=cP,i.selectIssueTypeFields=ut,i.selectIssueTypeFieldsAttachmentById=SA,i.selectIssueTypeFieldsAttachments=Ni,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=Ef,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=nn,i.selectIssueTypeStatusMapping=dS,i.selectIssueTypeStatuses=sn,i.selectIssueTypeStatusesByIds=rS,i.selectIssueTypeStatusesOfIssueType=yP,i.selectIssueTypeValuesOfIssueType=uP,i.selectIssueTypes=en,i.selectIssueTypesByIds=Zf,i.selectIssueTypesOfOrganization=mP,i.selectIssueUpdateById=AS,i.selectIssueUpdateMapping=ln,i.selectIssueUpdates=on,i.selectIssueUpdatesByIds=fS,i.selectIssueUpdatesOfIssue=SS,i.selectIssues=Mt,i.selectIssuesByIds=Gp,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=EP,i.selectNumberOfAssetsOfAssetType=bF,i.selectOrganizationAccessById=kS,i.selectOrganizationAccessMapping=zt,i.selectOrganizationAccessUserMapping=GS,i.selectOrganizationAccessesByIds=NS,i.selectOrganizationById=iT,i.selectOrganizationDocuments=HF,i.selectOrganizations=sT,i.selectOrganizationsByIds=nT,i.selectOrganizationsMapping=tT,i.selectProjectAccessById=PT,i.selectProjectAccessMapping=In,i.selectProjectAccesses=lt,i.selectProjectAccessesByIds=gT,i.selectProjectAccessesOfProject=FP,i.selectProjectAttachmentById=qT,i.selectProjectAttachmentMapping=jT,i.selectProjectAttachmentsByIds=DT,i.selectProjectById=pI,i.selectProjectDocuments=GF,i.selectProjectFileById=eI,i.selectProjectFileMapping=QT,i.selectProjectFiles=xT,i.selectProjectFilesByIds=tI,i.selectProjectMapping=yI,i.selectProjects=Et,i.selectProjectsByIds=AI,i.selectProjectsOfOrganization=wP,i.selectRehydrated=zP,i.selectStageMapping=Rs,i.selectTeamById=NI,i.selectTeamMembershipById=vI,i.selectTeamMemberships=Bt,i.selectTeamMembershipsByIds=VI,i.selectTeamMembershipsMapping=wI,i.selectTeams=Rn,i.selectTeamsByIds=GI,i.selectTeamsMapping=kI,i.selectTeamsOfOrganization=jP,i.selectUploadUrl=Bh,i.selectUserById=Vt,i.selectUsers=vt,i.selectUsersByIds=vS,i.selectUsersMapping=pn,i.selectUsersOfOrganization=SP,i.selectUsersOfProject=gP,i.selectUsersOfTeam=BP,i.setActiveProjectFileId=JT,i.setAsset=vr,i.setAssetAttachment=ha,i.setAssetAttachments=ma,i.setAssetProcedure=Nc,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=nd,i.setAssetProcedureTypeAttachment=_a,i.setAssetProcedureTypeAttachments=Ma,i.setAssetProcedureTypeFieldValues=Mc,i.setAssetProcedureTypeFieldValuesAttachment=mc,i.setAssetProcedureTypeFieldValuesAttachments=yc,i.setAssetProcedureTypeFieldValuesMany=Rc,i.setAssetProcedureTypeFields=ec,i.setAssetProcedureTypeFieldsAttachment=Ca,i.setAssetProcedureTypeFieldsAttachments=La,i.setAssetProcedureTypeFieldsMany=tc,i.setAssetProcedureTypes=ad,i.setAssetProcedures=Gc,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=ku,i.setAssetTypeIdentifier=Rl,i.setAssetTypeIdentifierValue=kl,i.setAssetTypeIdentifierValues=Nl,i.setAssetTypeIdentifiers=wl,i.setAssetTypeStatus=fo,i.setAssetTypeStatuses=So,i.setAssetTypes=to,i.setAssets=Vr,i.setCategories=jo,i.setCategory=Bo,i.setClientSDK=hO,i.setClientStore=lO,i.setConversation=ca,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=$m,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=Dp,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=kf,i.setIssueUpdate=hS,i.setIssueUpdates=mS,i.setIssues=$p,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=kT,i.setProjects=aI,i.setRehydrated=VP,i.setTeam=qI,i.setTeamMembership=FI,i.setTeamMemberships=PI,i.setTeams=DI,i.setTokens=$F,i.setUploadUrl=Eh,i.setUser=PS,i.setUsers=FS,i.shallowEqual=VO,i.slugify=KO,i.spacesToDashesLower=WO,i.teamMembershipReducer=RI,i.teamMembershipSlice=_n,i.teamReducer=HI,i.teamSlice=Mn,i.toFileNameSafeString=HO,i.toUuidArray=Xn,i.toUuidIdRecord=GO,i.truncate=YO,i.updateAsset=Mr,i.updateAssetAttachment=ya,i.updateAssetAttachments=pa,i.updateAssetProcedure=Cc,i.updateAssetProcedureStep=Ar,i.updateAssetProcedureStepFieldValues=sr,i.updateAssetProcedureStepFieldValuesAttachment=kd,i.updateAssetProcedureStepFieldValuesAttachments=Nd,i.updateAssetProcedureStepFieldValuesMany=ir,i.updateAssetProcedureStepFields=vd,i.updateAssetProcedureStepFieldsAttachment=Ad,i.updateAssetProcedureStepFieldsAttachments=fd,i.updateAssetProcedureStepFieldsMany=Vd,i.updateAssetProcedureSteps=fr,i.updateAssetProcedureType=ed,i.updateAssetProcedureTypeAttachment=Ra,i.updateAssetProcedureTypeAttachments=wa,i.updateAssetProcedureTypeFieldValues=wc,i.updateAssetProcedureTypeFieldValuesAttachment=pc,i.updateAssetProcedureTypeFieldValuesAttachments=Ac,i.updateAssetProcedureTypeFieldValuesMany=vc,i.updateAssetProcedureTypeFields=sc,i.updateAssetProcedureTypeFieldsAttachment=ka,i.updateAssetProcedureTypeFieldsAttachments=Na,i.updateAssetProcedureTypeFieldsMany=ic,i.updateAssetProcedureTypes=td,i.updateAssetProcedures=Lc,i.updateAssetStage=iu,i.updateAssetStageCompletion=kr,i.updateAssetStageCompletions=Nr,i.updateAssetStages=nu,i.updateAssetType=no,i.updateAssetTypeAttachment=pu,i.updateAssetTypeAttachments=Au,i.updateAssetTypeFieldValues=Al,i.updateAssetTypeFieldValuesAttachment=sl,i.updateAssetTypeFieldValuesAttachments=il,i.updateAssetTypeFieldValuesMany=fl,i.updateAssetTypeFields=Nu,i.updateAssetTypeFieldsAttachment=wu,i.updateAssetTypeFieldsAttachments=vu,i.updateAssetTypeFieldsMany=Gu,i.updateAssetTypeIdentifier=vl,i.updateAssetTypeIdentifierValue=Gl,i.updateAssetTypeIdentifierValues=Hl,i.updateAssetTypeIdentifiers=Vl,i.updateAssetTypeStatus=To,i.updateAssetTypeStatuses=Io,i.updateAssetTypes=ao,i.updateAssets=Rr,i.updateCategories=Do,i.updateCategory=qo,i.updateConversation=da,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=kh,i.updateFormIdentifierValue=sm,i.updateFormIdentifierValues=im,i.updateFormIdentifiers=Nh,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=Dy,i.updateIssueAssociations=$y,i.updateIssueAttachment=xy,i.updateIssueAttachments=ep,i.updateIssueComment=Mp,i.updateIssueCommentAttachment=mp,i.updateIssueCommentAttachments=yp,i.updateIssueComments=Rp,i.updateIssueType=Nf,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=kA,i.updateIssueTypeIdentifier=pf,i.updateIssueTypeIdentifierValue=wf,i.updateIssueTypeIdentifierValues=vf,i.updateIssueTypeIdentifiers=Af,i.updateIssueTypeStatus=iS,i.updateIssueTypeStatuses=nS,i.updateIssueTypes=Gf,i.updateIssueUpdate=yS,i.updateIssueUpdates=pS,i.updateIssues=Cp,i.updateOrganization=QS,i.updateOrganizationAccess=DS,i.updateOrganizationAccesses=$S,i.updateOrganizations=XS,i.updateProject=lI,i.updateProjectAccess=ST,i.updateProjectAccesses=TT,i.updateProjectAttachment=VT,i.updateProjectAttachments=zT,i.updateProjectFile=HT,i.updateProjectFiles=WT,i.updateProjects=uI,i.updateTeam=$I,i.updateTeamMembership=gI,i.updateTeamMemberships=bI,i.updateTeams=UI,i.updateUser=_S,i.updateUsers=bS,i.useSelectorBuilder=UP,i.userReducer=RS,i.userSlice=hn,i.uuidObj=b,i.versioningReducer=KI,i.versioningSlice=WI,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});