@overmap-ai/core 1.0.78-bulk-update.0 → 1.0.78-bulk-update.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/overmap-core.js +5218 -5107
- package/dist/overmap-core.umd.cjs +7 -7
- package/dist/sdk/services/AssetAttachmentService.d.ts +1 -1
- package/dist/sdk/services/AssetProcedureService.d.ts +1 -1
- package/dist/sdk/services/AssetProcedureStepFieldValuesAttachmentService.d.ts +1 -1
- package/dist/sdk/services/AssetProcedureStepFieldValuesService.d.ts +1 -1
- package/dist/sdk/services/AssetProcedureStepFieldsAttachmentService.d.ts +1 -1
- package/dist/sdk/services/AssetProcedureStepFieldsService.d.ts +1 -1
- package/dist/sdk/services/AssetProcedureStepService.d.ts +1 -1
- package/dist/sdk/services/AssetProcedureTypeAttachmentService.d.ts +1 -1
- package/dist/sdk/services/AssetProcedureTypeFieldValuesAttachmentService.d.ts +1 -1
- package/dist/sdk/services/AssetProcedureTypeFieldValuesService.d.ts +1 -1
- package/dist/sdk/services/AssetProcedureTypeFieldsAttachmentService.d.ts +1 -1
- package/dist/sdk/services/AssetProcedureTypeFieldsService.d.ts +1 -1
- package/dist/sdk/services/AssetProcedureTypeService.d.ts +1 -1
- package/dist/sdk/services/AssetService.d.ts +2 -2
- package/dist/sdk/services/AssetStageCompletionService.d.ts +1 -1
- package/dist/sdk/services/AssetStageService.d.ts +1 -1
- package/dist/sdk/services/AssetTypeAttachmentService.d.ts +1 -1
- package/dist/sdk/services/AssetTypeFieldValuesAttachmentService.d.ts +1 -1
- package/dist/sdk/services/AssetTypeFieldValuesService.d.ts +1 -1
- package/dist/sdk/services/AssetTypeFieldsAttachmentService.d.ts +1 -1
- package/dist/sdk/services/AssetTypeFieldsService.d.ts +1 -1
- package/dist/sdk/services/AssetTypeIdentifierService.d.ts +1 -1
- package/dist/sdk/services/AssetTypeIdentifierValueService.d.ts +1 -1
- package/dist/sdk/services/AssetTypeService.d.ts +1 -1
- package/dist/sdk/services/AssetTypeStatusService.d.ts +1 -1
- package/dist/sdk/services/CategoryService.d.ts +1 -1
- package/dist/sdk/services/DocumentAttachmentService.d.ts +1 -1
- package/dist/sdk/services/DocumentService.d.ts +1 -1
- package/dist/sdk/services/EmailDomainsService.d.ts +1 -1
- package/dist/sdk/services/FormIdentifierService.d.ts +1 -1
- package/dist/sdk/services/FormIdentifierValueService.d.ts +1 -1
- package/dist/sdk/services/FormRevisionAttachmentService.d.ts +2 -2
- package/dist/sdk/services/FormRevisionService.d.ts +1 -1
- package/dist/sdk/services/FormService.d.ts +1 -1
- package/dist/sdk/services/FormSubmissionAttachmentService.d.ts +2 -2
- package/dist/sdk/services/FormSubmissionService.d.ts +1 -1
- package/dist/sdk/services/GeoImageService.d.ts +1 -1
- package/dist/sdk/services/IssueAssociationService.d.ts +1 -1
- package/dist/sdk/services/IssueAttachmentService.d.ts +1 -1
- package/dist/sdk/services/IssueCommentAttachmentService.d.ts +1 -1
- package/dist/sdk/services/IssueCommentService.d.ts +1 -1
- package/dist/sdk/services/IssueService.d.ts +1 -1
- package/dist/sdk/services/IssueTypeAttachmentService.d.ts +1 -1
- package/dist/sdk/services/IssueTypeFieldValuesAttachmentService.d.ts +1 -1
- package/dist/sdk/services/IssueTypeFieldValuesService.d.ts +1 -1
- package/dist/sdk/services/IssueTypeFieldsAttachmentService.d.ts +1 -1
- package/dist/sdk/services/IssueTypeFieldsService.d.ts +1 -1
- package/dist/sdk/services/IssueTypeIdentifierService.d.ts +1 -1
- package/dist/sdk/services/IssueTypeIdentifierValueService.d.ts +1 -1
- package/dist/sdk/services/IssueTypeService.d.ts +1 -1
- package/dist/sdk/services/IssueTypeStatusService.d.ts +1 -1
- package/dist/sdk/services/IssueUpdateService.d.ts +142 -2
- package/dist/sdk/services/OrganizationAccessService.d.ts +1 -1
- package/dist/sdk/services/OrganizationService.d.ts +1 -1
- package/dist/sdk/services/ProjectAccessService.d.ts +1 -1
- package/dist/sdk/services/ProjectAttachmentService.d.ts +1 -1
- package/dist/sdk/services/ProjectFileService.d.ts +1 -1
- package/dist/sdk/services/ProjectService.d.ts +1 -1
- package/dist/sdk/services/TeamMembershipService.d.ts +1 -1
- package/dist/sdk/services/TeamService.d.ts +1 -1
- package/dist/sdk/services/UserService.d.ts +1 -1
- package/dist/store/selectors/index.d.ts +1 -0
- package/dist/store/selectors/utils.d.ts +4 -0
- package/dist/store/slices/agentsSlice.d.ts +1 -1
- package/dist/store/slices/assetAttachmentSlice.d.ts +1 -1
- package/dist/store/slices/assetProcedureSlice.d.ts +1 -1
- package/dist/store/slices/assetProcedureStepFieldValuesAttachmentSlice.d.ts +1 -1
- package/dist/store/slices/assetProcedureStepFieldValuesSlice.d.ts +1 -1
- package/dist/store/slices/assetProcedureStepFieldsAttachmentSlice.d.ts +1 -1
- package/dist/store/slices/assetProcedureStepFieldsSlice.d.ts +1 -1
- package/dist/store/slices/assetProcedureStepSlice.d.ts +2 -2
- package/dist/store/slices/assetProcedureTypeAttachmentSlice.d.ts +72 -2
- package/dist/store/slices/assetProcedureTypeFieldValuesAttachmentSlice.d.ts +1 -1
- package/dist/store/slices/assetProcedureTypeFieldValuesSlice.d.ts +1 -1
- package/dist/store/slices/assetProcedureTypeFieldsAttachmentSlice.d.ts +1 -1
- package/dist/store/slices/assetProcedureTypeFieldsSlice.d.ts +1 -1
- package/dist/store/slices/assetProcedureTypeSlice.d.ts +1 -1
- package/dist/store/slices/assetSlice.d.ts +1 -1
- package/dist/store/slices/assetStageCompletionSlice.d.ts +1 -1
- package/dist/store/slices/assetStageSlice.d.ts +1 -1
- package/dist/store/slices/assetTypeAttachmentSlice.d.ts +1 -1
- package/dist/store/slices/assetTypeFieldValuesAttachmentSlice.d.ts +1 -1
- package/dist/store/slices/assetTypeFieldValuesSlice.d.ts +1 -1
- package/dist/store/slices/assetTypeFieldsAttachmentSlice.d.ts +1 -1
- package/dist/store/slices/assetTypeFieldsSlice.d.ts +1 -1
- package/dist/store/slices/assetTypeIdentifierSlice.d.ts +2 -2
- package/dist/store/slices/assetTypeIdentifierValueSlice.d.ts +2 -2
- package/dist/store/slices/assetTypeSlice.d.ts +2 -2
- package/dist/store/slices/assetTypeStatusSlice.d.ts +1 -1
- package/dist/store/slices/categorySlice.d.ts +1 -1
- package/dist/store/slices/documentAttachmentSlice.d.ts +1 -1
- package/dist/store/slices/documentSlice.d.ts +3 -3
- package/dist/store/slices/emailDomainsSlice.d.ts +2 -2
- package/dist/store/slices/formIdentifierSlice.d.ts +2 -2
- package/dist/store/slices/formIdentifierValueSlice.d.ts +2 -2
- package/dist/store/slices/formRevisionAttachmentSlice.d.ts +2 -2
- package/dist/store/slices/formRevisionSlice.d.ts +1 -1
- package/dist/store/slices/formSlice.d.ts +2 -2
- package/dist/store/slices/formSubmissionAttachmentSlice.d.ts +3 -3
- package/dist/store/slices/formSubmissionSlice.d.ts +1 -1
- package/dist/store/slices/geoImageSlice.d.ts +1 -1
- package/dist/store/slices/issueAssociationSlice.d.ts +1 -1
- package/dist/store/slices/issueAttachmentSlice.d.ts +1 -1
- package/dist/store/slices/issueCommentAttachmentSlice.d.ts +1 -1
- package/dist/store/slices/issueCommentSlice.d.ts +1 -1
- package/dist/store/slices/issueSlice.d.ts +1 -1
- package/dist/store/slices/issueTypeAttachmentSlice.d.ts +2 -2
- package/dist/store/slices/issueTypeFieldValuesAttachmentSlice.d.ts +1 -1
- package/dist/store/slices/issueTypeFieldValuesSlice.d.ts +1 -1
- package/dist/store/slices/issueTypeFieldsAttachmentSlice.d.ts +1 -1
- package/dist/store/slices/issueTypeFieldsSlice.d.ts +1 -1
- package/dist/store/slices/issueTypeIdentifierSlice.d.ts +2 -2
- package/dist/store/slices/issueTypeIdentifierValueSlice.d.ts +2 -2
- package/dist/store/slices/issueTypeSlice.d.ts +1 -1
- package/dist/store/slices/issueTypeStatusSlice.d.ts +1 -1
- package/dist/store/slices/issueUpdateSlice.d.ts +213 -3
- package/dist/store/slices/organizationAccessSlice.d.ts +1 -1
- package/dist/store/slices/organizationSlice.d.ts +2 -2
- package/dist/store/slices/projectAccessSlice.d.ts +1 -1
- package/dist/store/slices/projectAttachmentSlice.d.ts +3 -3
- package/dist/store/slices/projectFileSlice.d.ts +1 -1
- package/dist/store/slices/projectSlice.d.ts +2 -2
- package/dist/store/slices/teamMembershipSlice.d.ts +2 -2
- package/dist/store/slices/teamSlice.d.ts +2 -2
- package/dist/store/slices/userSlice.d.ts +1 -1
- package/dist/utils/utils.d.ts +0 -7
- package/package.json +4 -3
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
(function(i,L){typeof exports=="object"&&typeof module<"u"?L(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"],L):(i=typeof globalThis<"u"?globalThis:i||self,L(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,L,o,st,xe,MO,Nn,yt,RO,wO,Hn,EO,vO,gb,bb,VO,zO,BO){"use strict";var Pb=Object.defineProperty;var Fb=(i,L,o)=>L in i?Pb(i,L,{enumerable:!0,configurable:!0,writable:!0,value:o}):i[L]=o;var y=(i,L,o)=>Fb(i,typeof L!="symbol"?L+"":L,o);var bO;const Gn=Object.freeze([]),Wn=Object.freeze({});var Kn=(t=>(t[t.GUEST=0]="GUEST",t[t.BASIC=2]="BASIC",t[t.ADMIN=4]="ADMIN",t))(Kn||{}),m=(t=>(t.GET="GET",t.POST="POST",t.PATCH="PATCH",t.PUT="PUT",t.DELETE="DELETE",t))(m||{}),Yn=(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))(Yn||{}),Zn=(t=>(t.Issue="issue",t.Asset="asset",t.AssetType="asset_type",t.Project="project",t.Document="document",t))(Zn||{}),Lt=(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))(Lt||{}),$=(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))($||{}),Jn=(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))(Jn||{});const jO=Lt.MEDIUM,Xn=6e4;function R(t){return{addOne:(h,p)=>{const A=t(p.payload);h.instances[A]=p.payload},addMany:(h,p)=>{for(const A of p.payload){const f=t(A);h.instances[f]=A}},setOne:(h,p)=>{const A=t(p.payload);h.instances[A]=p.payload},setMany:(h,p)=>{for(const A of p.payload){const f=t(A);h.instances[f]=A}},updateOne:(h,p)=>{const A=t(p.payload);h.instances[A]=p.payload},updateMany:(h,p)=>{for(const A of p.payload){const f=t(A);h.instances[f]=A}},deleteOne:(h,p)=>{delete h.instances[p.payload]},deleteMany:(h,p)=>{for(const A of p.payload)delete h.instances[A]},initialize:(h,p)=>{h.instances={};const A=new Set;for(const f of p.payload){const I=t(f);A.add(I),h.instances[I]=f}A.size!==p.payload.length&&console.warn("duplicate ids detected when initializing model instances.")}}}function qO(){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 p of d.payload)h.has(p)||h.add(p);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 p of d.payload)h.has(p)&&h.delete(p);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 p of d.payload)h.has(p)?h.delete(p):h.add(p);u.selection=Array.from(h)},getInitialState:u=>({...u,selection:[]})}}const rt="versioning",_=o.createAction("RESET"),C=o.createAction("RESET_PROJECT_STATE"),w=o.createAction("RESET_ORGANIZATION_STATE");bO=Symbol.toStringTag;class kt{constructor(){y(this,bO,"Promise");y(this,"_promise");y(this,"_resolve");y(this,"_reject");y(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 Nt=!1;["true","1"].includes("".toLowerCase())&&(Nt=!0);function DO(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 Ht(t){const s={};return function(){const e=Array.prototype.slice.call(arguments);return e in s?(Nt&&console.debug(`Memoization debug: Using memorized return value for ${t.toString()}(`,e,")"),s[e]):(Nt&&console.debug(`Memoization debug: Cache miss! Memoizing ${t.toString()}(`,e,")"),s[e]=t.apply(this,e))}}function CO(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 T=t=>t.length===0?Gn:t,pt=t=>Object.keys(t).length===0?Wn:t,Qn=Ht(t=>{if(!t)return"";const s=new Date(t),e=s.getFullYear()===Gt.getFullYear(),n={day:"numeric",month:"short"};return e||(n.year="numeric"),s.toLocaleDateString([],n)}),$O=new Intl.RelativeTimeFormat([],{style:"long",numeric:"auto"}),UO=1e3*86400,Gt=new Date,LO=t=>new Date(t).toDateString()===Gt.toDateString(),kO=Ht((t,s,e)=>{const n=Math.round((new Date(t).getTime()-Gt.getTime())/UO);return n<s||n>e?Qn(t):$O.format(n,"days")});function NO(t){return new Uint8Array(t).reduce((e,n)=>e+n.toString(16).padStart(2,"0"),"")}const Wt=async(t,s)=>{s||(s=await it(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 it(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=NO(c);s(r)})},n.readAsArrayBuffer(t)})}function HO(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 xn(t,s){return new File([t],s,{type:t.type})}function GO(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 WO=async t=>{const s={};for(const e of t){const n=await it(e);s[n]={sha1:n,extension:e.name.split(".").pop()||"",file_type:e.type,size:e.size}}return Object.values(s)},ea=async t=>(await fetch(t)).blob(),KO=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 YO(t){const s=new Blob([t]);MO.saveAs(s,t.name)}const ta={};function ZO(t,s,e,...n){const a=ta[t];let c=!1;a?a[s]||(a[s]=!0,c=!0):(ta[t]={[s]:!0},c=!0),c&&console[e](...n)}const sa=["created_at","updated_at","index","revision"];function M(t){return{...t,uuid:xe.v4()}}function JO(t){const s={};for(const e of t)s[e.uuid]=e;return s}function D(t){return t.map(({uuid:s})=>s)}function At(t,s){return t.localeCompare(s)}function Kt(t,s){return At(t.uuid,s.uuid)}function XO(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 QO(t){return t.toLowerCase().replace(" ","-")}function xO(t,s=!1){return t.normalize("NFKD").toLowerCase().replace(/[^\w\s-]/g,"").trim().replace(/[-\s]+/g,s?"_":"-")}function eP(t,s){if(t.length<=s)return t;const e=t.slice(0,s-1);return e.slice(0,e.lastIndexOf(" "))+"…"}const S=t=>s=>e=>t(e,s);function tP(t,s,e){return e.findIndex(n=>n.uuid===t.uuid)===s}function sP(t,s,e){return e.findIndex(n=>n.file_sha1===t.file_sha1)===s}const iP=/^.+@.+\..+$/;function V(t){const s={...t};for(const e of[...sa,"created_by"])e in s&&delete s[e];return s}const ia=t=>{const s=t.toSorted((e,n)=>e.order-n.order);return Nn(s,{id:e=>e.uuid,parentId:e=>e.parent,includeEmptyChildrenArray:!0,valueKey:!1})},nP=t=>{const{roots:s}=ia(t);return s.map(e=>new yt.Tree(e))},na=(t,s)=>{const{nodes:e}=ia(s),n=e.get(t);if(!n)throw new Error(`Node with uuid ${t} does not exist in asset procedure step tree.`);return new yt.Tree(n)},aa=(t,s)=>t.type!==s.type?t.type-s.type:t.order-s.order,ca=(t,s)=>t.type!==s.type?t.type-s.type:t.order-s.order,da=t=>Nn(t,{id:s=>s.uuid,parentId:s=>s.parent_document,includeEmptyChildrenArray:!0,valueKey:!1}),aP=t=>{const{roots:s}=da(t);return s.map(e=>new yt.Tree(e))},ra=(t,s)=>{const{nodes:e}=da(s),n=e.get(t);if(!n)throw new Error(`Node with uuid ${t} does not exist in document tree.`);return new yt.Tree(n)},k=R(t=>t.uuid),ua={instances:{}},Yt=o.createSlice({name:"agents",initialState:ua,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,ua)),reducers:{initializeConversations:k.initialize,addConversation:k.addOne,addConversations:k.addMany,setConversation:k.setOne,setConversations:k.setMany,updateConversation:k.updateOne,updateConversations:k.updateMany,deleteConversation:k.deleteOne,deleteConversations:k.deleteMany}}),{initializeConversations:la,addConversation:oa,addConversations:cP,setConversation:ha,setConversations:dP,updateConversation:ma,updateConversations:rP,deleteConversation:uP,deleteConversations:lP}=Yt.actions,Zt=t=>t.agentsReducer.instances,oP=o.createSelector([Zt],t=>Object.values(t)),hP=S(o.createSelector([Zt,(t,s)=>s],(t,s)=>t[s])),ya=Yt.reducer,N=R(t=>t.uuid),pa={instances:{}},Jt=o.createSlice({name:"assetAttachments",initialState:pa,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,pa)),reducers:{initializeAssetAttachments:N.initialize,addAssetAttachment:N.addOne,addAssetAttachments:N.addMany,setAssetAttachment:N.setOne,setAssetAttachments:N.setMany,updateAssetAttachment:N.updateOne,updateAssetAttachments:N.updateMany,deleteAssetAttachment:N.deleteOne,deleteAssetAttachments:N.deleteMany}}),{initializeAssetAttachments:Aa,addAssetAttachment:fa,addAssetAttachments:Xt,setAssetAttachment:Sa,setAssetAttachments:Ta,updateAssetAttachment:Ia,updateAssetAttachments:Oa,deleteAssetAttachment:Pa,deleteAssetAttachments:Qt}=Jt.actions,Fa=t=>t.assetAttachmentReducer.instances,xt=o.createSelector([Fa],t=>Object.values(t)),ga=t=>s=>s.assetAttachmentReducer.instances[t],ba=S(o.createSelector([xt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),_a=S(o.createSelector([xt,(t,s)=>s],(t,s)=>T(t.filter(({asset:e})=>s===e)))),Ma=Jt.reducer,H=R(({uuid:t})=>t),Ra={instances:{}},es=o.createSlice({name:"assetProcedureTypeAttachments",initialState:Ra,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,Ra)),reducers:{initializeAssetProcedureTypeAttachments:H.initialize,addAssetProcedureTypeAttachment:H.addOne,addAssetProcedureTypeAttachments:H.addMany,setAssetProcedureTypeAttachment:H.setOne,setAssetProcedureTypeAttachments:H.setMany,updateAssetProcedureTypeAttachment:H.updateOne,updateAssetProcedureTypeAttachments:H.updateMany,deleteAssetProcedureTypeAttachment:H.deleteOne,deleteAssetProcedureTypeAttachments:H.deleteMany}}),{initializeAssetProcedureTypeAttachments:wa,addAssetProcedureTypeAttachment:Ea,addAssetProcedureTypeAttachments:va,setAssetProcedureTypeAttachment:Va,setAssetProcedureTypeAttachments:za,updateAssetProcedureTypeAttachment:Ba,updateAssetProcedureTypeAttachments:ja,deleteAssetProcedureTypeAttachment:qa,deleteAssetProcedureTypeAttachments:Da}=es.actions,Ca=es.reducer,$a=t=>t.assetProcedureTypeAttachmentReducer.instances,ts=o.createSelector([$a],t=>Object.values(t)),Ua=t=>s=>s.assetProcedureTypeAttachmentReducer.instances[t],La=S(o.createSelector([ts,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),mP=S(o.createSelector([ts,(t,s)=>s],(t,s)=>T(t.filter(({asset_procedure_type:e})=>s===e)))),G=R(({uuid:t})=>t),ka={instances:{}},ss=o.createSlice({name:"assetProcedureTypeFieldsAttachments",initialState:ka,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,ka)),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:Na,addAssetProcedureTypeFieldsAttachment:Ha,addAssetProcedureTypeFieldsAttachments:Ga,setAssetProcedureTypeFieldsAttachment:Wa,setAssetProcedureTypeFieldsAttachments:Ka,updateAssetProcedureTypeFieldsAttachment:Ya,updateAssetProcedureTypeFieldsAttachments:Za,deleteAssetProcedureTypeFieldsAttachment:Ja,deleteAssetProcedureTypeFieldsAttachments:Xa}=ss.actions,Qa=ss.reducer,xa=t=>t.assetProcedureTypeFieldsAttachmentReducer.instances,is=o.createSelector([xa],t=>Object.values(t)),yP=S(o.createSelector([is,(t,s)=>s],(t,s)=>T(t.filter(e=>e.fields_revision===s)))),ec=t=>s=>s.assetProcedureTypeFieldsAttachmentReducer.instances[t],tc=S(o.createSelector([is,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),W=R(({uuid:t})=>t),sc={instances:{}},ns=o.createSlice({name:"assetProcedureTypeFields",initialState:sc,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,sc)),reducers:{initializeAssetProcedureTypeFields:W.initialize,addAssetProcedureTypeFields:W.addOne,addAssetProcedureTypeFieldsMany:W.addMany,setAssetProcedureTypeFields:W.setOne,setAssetProcedureTypeFieldsMany:W.setMany,updateAssetProcedureTypeFields:W.updateOne,updateAssetProcedureTypeFieldsMany:W.updateMany,deleteAssetProcedureTypeFields:W.deleteOne,deleteAssetProcedureTypeFieldsMany:W.deleteMany}}),{initializeAssetProcedureTypeFields:ic,addAssetProcedureTypeFields:nc,addAssetProcedureTypeFieldsMany:ac,setAssetProcedureTypeFields:cc,setAssetProcedureTypeFieldsMany:dc,updateAssetProcedureTypeFields:rc,updateAssetProcedureTypeFieldsMany:uc,deleteAssetProcedureTypeFields:lc,deleteAssetProcedureTypeFieldsMany:oc}=ns.actions,hc=ns.reducer,mc=t=>t.assetProcedureTypeFieldsReducer.instances,ft=o.createSelector([mc],t=>Object.values(t)),pP=S(o.createSelector([ft,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure_type===s)))),AP=S(o.createSelector([ft,(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])),yc=t=>s=>s.assetProcedureTypeFieldsReducer.instances[t],pc=S(o.createSelector([ft,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),K=R(({uuid:t})=>t),Ac={instances:{}},as=o.createSlice({name:"assetProcedureTypeFieldValuesAttachments",initialState:Ac,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,Ac)),reducers:{initializeAssetProcedureTypeFieldValuesAttachments:K.initialize,addAssetProcedureTypeFieldValuesAttachment:K.addOne,addAssetProcedureTypeFieldValuesAttachments:K.addMany,setAssetProcedureTypeFieldValuesAttachment:K.setOne,setAssetProcedureTypeFieldValuesAttachments:K.setMany,updateAssetProcedureTypeFieldValuesAttachment:K.updateOne,updateAssetProcedureTypeFieldValuesAttachments:K.updateMany,deleteAssetProcedureTypeFieldValuesAttachment:K.deleteOne,deleteAssetProcedureTypeFieldValuesAttachments:K.deleteMany}}),{initializeAssetProcedureTypeFieldValuesAttachments:fc,addAssetProcedureTypeFieldValuesAttachment:Sc,addAssetProcedureTypeFieldValuesAttachments:cs,setAssetProcedureTypeFieldValuesAttachment:Tc,setAssetProcedureTypeFieldValuesAttachments:Ic,updateAssetProcedureTypeFieldValuesAttachment:Oc,updateAssetProcedureTypeFieldValuesAttachments:Pc,deleteAssetProcedureTypeFieldValuesAttachment:Fc,deleteAssetProcedureTypeFieldValuesAttachments:ds}=as.actions,gc=as.reducer,bc=t=>t.assetProcedureTypeFieldValuesAttachmentReducer.instances,rs=o.createSelector([bc],t=>Object.values(t)),_c=t=>s=>s.assetProcedureTypeFieldValuesAttachmentReducer.instances[t],Mc=S(o.createSelector([rs,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),Rc=S(o.createSelector([rs,(t,s)=>s],(t,s)=>T(t.filter(e=>e.field_values===s)))),Y=R(({uuid:t})=>t),wc={instances:{}},us=o.createSlice({name:"assetProcedureTypeFieldValues",initialState:wc,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,wc)),reducers:{initializeAssetProcedureTypeFieldValues:Y.initialize,addAssetProcedureTypeFieldValues:Y.addOne,addAssetProcedureTypeFieldValuesMany:Y.addMany,setAssetProcedureTypeFieldValues:Y.setOne,setAssetProcedureTypeFieldValuesMany:Y.setMany,updateAssetProcedureTypeFieldValues:Y.updateOne,updateAssetProcedureTypeFieldValuesMany:Y.updateMany,deleteAssetProcedureTypeFieldValues:Y.deleteOne,deleteAssetProcedureTypeFieldValuesMany:Y.deleteMany}}),{initializeAssetProcedureTypeFieldValues:Ec,addAssetProcedureTypeFieldValues:vc,addAssetProcedureTypeFieldValuesMany:Vc,setAssetProcedureTypeFieldValues:zc,setAssetProcedureTypeFieldValuesMany:Bc,updateAssetProcedureTypeFieldValues:jc,updateAssetProcedureTypeFieldValuesMany:qc,deleteAssetProcedureTypeFieldValues:Dc,deleteAssetProcedureTypeFieldValuesMany:Cc}=us.actions,$c=us.reducer,Uc=t=>t.assetProcedureTypeFieldValuesReducer.instances,St=o.createSelector([Uc],t=>Object.values(t)),fP=S(o.createSelector([St,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset===s)))),SP=S(o.createSelector([St,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure===s)))),Lc=t=>s=>s.assetProcedureTypeFieldValuesReducer.instances[t],kc=S(o.createSelector([St,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),Z=R(({uuid:t})=>t),Nc={instances:{}},ls=o.createSlice({name:"assetProcedures",initialState:Nc,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,Nc)),reducers:{initializeAssetProcedures:Z.initialize,addAssetProcedure:Z.addOne,addAssetProcedures:Z.addMany,setAssetProcedure:Z.setOne,setAssetProcedures:Z.setMany,updateAssetProcedure:Z.updateOne,updateAssetProcedures:Z.updateMany,deleteAssetProcedure:Z.deleteOne,deleteAssetProcedures:Z.deleteMany}}),{initializeAssetProcedures:Hc,addAssetProcedure:Gc,addAssetProcedures:os,updateAssetProcedure:Wc,updateAssetProcedures:Kc,deleteAssetProcedure:Yc,deleteAssetProcedures:hs,setAssetProcedure:Zc,setAssetProcedures:Jc}=ls.actions,Xc=ls.reducer,Qc=t=>t.assetProcedureReducer.instances,Tt=o.createSelector([Qc],t=>Object.values(t)),xc=S(o.createSelector([Tt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure_type===s)))),TP=S(o.createSelector([Tt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_type===s)))),ed=t=>s=>s.assetProcedureReducer.instances[t],td=S(o.createSelector([Tt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),J=R(t=>t.uuid),sd={instances:{}},ms=o.createSlice({name:"assetProcedureTypes",initialState:sd,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,sd)),reducers:{initializeAssetProcedureTypes:J.initialize,addAssetProcedureType:J.addOne,addAssetProcedureTypes:J.addMany,setAssetProcedureType:J.setOne,setAssetProcedureTypes:J.setMany,updateAssetProcedureType:J.updateOne,updateAssetProcedureTypes:J.updateMany,deleteAssetProcedureType:J.deleteOne,deleteAssetProcedureTypes:J.deleteMany}}),{initializeAssetProcedureTypes:id,addAssetProcedureType:nd,addAssetProcedureTypes:ad,updateAssetProcedureType:cd,updateAssetProcedureTypes:dd,deleteAssetProcedureType:rd,deleteAssetProcedureTypes:ud,setAssetProcedureType:ld,setAssetProcedureTypes:od}=ms.actions,hd=ms.reducer,md=t=>t.assetProcedureTypeReducer.instances,ys=o.createSelector([md],t=>Object.values(t)),yd=t=>s=>s.assetProcedureTypeReducer.instances[t],pd=S(o.createSelector([ys,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),IP=S(o.createSelector([ys,(t,s)=>s],(t,s)=>T(t.filter(e=>e.organization===s)))),X=R(t=>t.uuid),Ad={instances:{}},ps=o.createSlice({name:"assetProcedureStepFieldsAttachments",initialState:Ad,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,Ad)),reducers:{initializeAssetProcedureStepFieldsAttachments:X.initialize,addAssetProcedureStepFieldsAttachment:X.addOne,addAssetProcedureStepFieldsAttachments:X.addMany,setAssetProcedureStepFieldsAttachment:X.setOne,setAssetProcedureStepFieldsAttachments:X.setMany,updateAssetProcedureStepFieldsAttachment:X.updateOne,updateAssetProcedureStepFieldsAttachments:X.updateMany,deleteAssetProcedureStepFieldsAttachment:X.deleteOne,deleteAssetProcedureStepFieldsAttachments:X.deleteMany}}),{initializeAssetProcedureStepFieldsAttachments:fd,addAssetProcedureStepFieldsAttachment:Sd,addAssetProcedureStepFieldsAttachments:Td,setAssetProcedureStepFieldsAttachment:Id,setAssetProcedureStepFieldsAttachments:Od,updateAssetProcedureStepFieldsAttachment:Pd,updateAssetProcedureStepFieldsAttachments:Fd,deleteAssetProcedureStepFieldsAttachment:gd,deleteAssetProcedureStepFieldsAttachments:bd}=ps.actions,_d=t=>t.assetProcedureStepFieldsAttachmentReducer.instances,As=o.createSelector([_d],t=>Object.values(t)),OP=S(o.createSelector([As,(t,s)=>s],(t,s)=>T(t.filter(e=>e.fields_revision===s)))),Md=t=>s=>s.assetProcedureStepFieldsAttachmentReducer.instances[t],Rd=S(o.createSelector([As,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),wd=ps.reducer,Q=R(t=>t.uuid),Ed={instances:{}},fs=o.createSlice({name:"assetProcedureStepFields",initialState:Ed,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,Ed)),reducers:{initializeAssetProcedureStepFields:Q.initialize,addAssetProcedureStepFields:Q.addOne,addAssetProcedureStepFieldsMany:Q.addMany,setAssetProcedureStepFields:Q.setOne,setAssetProcedureStepFieldsMany:Q.setMany,updateAssetProcedureStepFields:Q.updateOne,updateAssetProcedureStepFieldsMany:Q.updateMany,deleteAssetProcedureStepFields:Q.deleteOne,deleteAssetProcedureStepFieldsMany:Q.deleteMany}}),{initializeAssetProcedureStepFields:vd,addAssetProcedureStepFields:Vd,addAssetProcedureStepFieldsMany:zd,setAssetProcedureStepFields:Bd,setAssetProcedureStepFieldsMany:jd,updateAssetProcedureStepFields:qd,updateAssetProcedureStepFieldsMany:Dd,deleteAssetProcedureStepFields:Cd,deleteAssetProcedureStepFieldsMany:$d}=fs.actions,Ss=t=>t.assetProcedureStepFieldsReducer.instances,It=o.createSelector([Ss],t=>Object.values(t)),PP=S(o.createSelector([It,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure_step===s)))),FP=S(o.createSelector([It,(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])),gP=o.createSelector([Ss],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}),Ud=t=>s=>s.assetProcedureStepFieldsReducer.instances[t],Ld=S(o.createSelector([It,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),kd=fs.reducer,x=R(t=>t.uuid),Nd={instances:{}},Ts=o.createSlice({name:"assetProcedureStepFieldValuesAttachments",initialState:Nd,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,Nd)),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:Hd,addAssetProcedureStepFieldValuesAttachment:Gd,addAssetProcedureStepFieldValuesAttachments:Is,setAssetProcedureStepFieldValuesAttachment:Wd,setAssetProcedureStepFieldValuesAttachments:Kd,updateAssetProcedureStepFieldValuesAttachment:Yd,updateAssetProcedureStepFieldValuesAttachments:Zd,deleteAssetProcedureStepFieldValuesAttachment:Jd,deleteAssetProcedureStepFieldValuesAttachments:Os}=Ts.actions,Xd=t=>t.assetProcedureStepFieldValuesAttachmentReducer.instances,Ps=o.createSelector([Xd],t=>Object.values(t)),Qd=t=>s=>s.assetProcedureStepFieldValuesAttachmentReducer.instances[t],xd=S(o.createSelector([Ps,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),er=S(o.createSelector([Ps,(t,s)=>s],(t,s)=>T(t.filter(e=>e.field_values===s)))),tr=Ts.reducer,ee=R(t=>t.uuid),sr={instances:{}},Fs=o.createSlice({name:"assetProcedureStepFieldValues",initialState:sr,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,sr)),reducers:{initializeAssetProcedureStepFieldValues:ee.initialize,addAssetProcedureStepFieldValues:ee.addOne,addAssetProcedureStepFieldValuesMany:ee.addMany,setAssetProcedureStepFieldValues:ee.setOne,setAssetProcedureStepFieldValuesMany:ee.setMany,updateAssetProcedureStepFieldValues:ee.updateOne,updateAssetProcedureStepFieldValuesMany:ee.updateMany,deleteAssetProcedureStepFieldValues:ee.deleteOne,deleteAssetProcedureStepFieldValuesMany:ee.deleteMany}}),{initializeAssetProcedureStepFieldValues:ir,addAssetProcedureStepFieldValues:nr,addAssetProcedureStepFieldValuesMany:ar,setAssetProcedureStepFieldValues:cr,setAssetProcedureStepFieldValuesMany:dr,updateAssetProcedureStepFieldValues:rr,updateAssetProcedureStepFieldValuesMany:ur,deleteAssetProcedureStepFieldValues:lr,deleteAssetProcedureStepFieldValuesMany:or}=Fs.actions,hr=t=>t.assetProcedureStepFieldValuesReducer.instances,ut=o.createSelector([hr],t=>Object.values(t)),bP=S(o.createSelector([ut,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset===s)))),_P=S(o.createSelector([ut,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure===s)))),MP=S(o.createSelector([ut,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure_step===s)))),mr=t=>s=>s.assetProcedureStepFieldValuesReducer.instances[t],yr=S(o.createSelector([ut,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),pr=Fs.reducer,te=R(t=>t.uuid),Ar={instances:{}},gs=o.createSlice({name:"assetProcedureSteps",initialState:Ar,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,Ar)),reducers:{initializeAssetProcedureSteps:te.initialize,setAssetProcedureStep:te.setOne,setAssetProcedureSteps:te.setMany,addAssetProcedureStep:te.addOne,addAssetProcedureSteps:te.addMany,updateAssetProcedureStep:te.updateOne,updateAssetProcedureSteps:te.updateMany,deleteAssetProcedureStep:te.deleteOne,deleteAssetProcedureSteps:te.deleteMany}}),{initializeAssetProcedureSteps:fr,setAssetProcedureStep:Sr,setAssetProcedureSteps:Tr,addAssetProcedureStep:Ir,addAssetProcedureSteps:Or,updateAssetProcedureStep:Pr,updateAssetProcedureSteps:Fr,deleteAssetProcedureStep:gr,deleteAssetProcedureSteps:br}=gs.actions,_r=gs.reducer,Ot=t=>t.assetProcedureStepReducer.instances,Mr=t=>s=>s.assetProcedureStepReducer.instances[t],bs=o.createSelector([Ot],t=>Object.values(t)),RP=S(o.createSelector([Ot,(t,s)=>s],(t,s)=>{const e={};for(const[n,a]of Object.entries(t))a.asset_procedure_type===s&&(e[n]=a);return pt(e)})),wP=S(o.createSelector([bs,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure_type===s)))),Rr=S(o.createSelector([bs,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),wr=S(o.createSelector([Ot,(t,s)=>s],(t,s)=>{if(!t[s])return T([]);const a=na(s,Object.values(t)).all().map(({model:c})=>c);return T(a)})),se=R(t=>t.uuid),Er={instances:{}},_s=o.createSlice({name:"assets",initialState:Er,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,Er)),reducers:{initializeAssets:se.initialize,addAsset:se.addOne,addAssets:se.addMany,setAsset:se.setOne,setAssets:se.setMany,updateAsset:se.updateOne,updateAssets:se.updateMany,deleteAsset:se.deleteOne,deleteAssets:se.deleteMany}}),{initializeAssets:vr,addAsset:Vr,addAssets:Ms,updateAsset:zr,updateAssets:Br,deleteAsset:jr,deleteAssets:Rs,setAsset:qr,setAssets:Dr}=_s.actions,Cr=t=>t.assetReducer.instances,ws=o.createSelector([Cr],t=>T(Object.values(t))),Es=S(o.createSelector([ws,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_type===s)))),$r=t=>s=>s.assetReducer.instances[t],Ur=S(o.createSelector([ws,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),EP=t=>s=>Es(t)(s).length,Lr=_s.reducer,ie=R(t=>t.uuid),kr={instances:{}},vs=o.createSlice({name:"assetStageCompletions",initialState:kr,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,kr)),reducers:{initializeAssetStageCompletions:ie.initialize,addAssetStageCompletion:ie.addOne,addAssetStageCompletions:ie.addMany,setAssetStageCompletion:ie.setOne,setAssetStageCompletions:ie.setMany,updateAssetStageCompletion:ie.updateOne,updateAssetStageCompletions:ie.updateMany,deleteAssetStageCompletion:ie.deleteOne,deleteAssetStageCompletions:ie.deleteMany}}),{initializeAssetStageCompletions:Nr,addAssetStageCompletion:Hr,addAssetStageCompletions:Gr,setAssetStageCompletion:Wr,setAssetStageCompletions:Kr,updateAssetStageCompletion:Yr,updateAssetStageCompletions:Zr,deleteAssetStageCompletion:Jr,deleteAssetStageCompletions:Xr}=vs.actions,Qr=vs.reducer,xr=t=>t.assetStageCompletionReducer.instances,eu=o.createSelector([xr],t=>Object.values(t)),tu=t=>s=>s.assetStageCompletionReducer.instances[t],su=S(o.createSelector([eu,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),ne=R(t=>t.uuid),iu={instances:{}},Vs=o.createSlice({name:"assetStages",initialState:iu,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,iu)),reducers:{initializeAssetStages:ne.initialize,setAssetStage:ne.setOne,setAssetStages:ne.setMany,addAssetStage:ne.addOne,addAssetStages:ne.addMany,updateAssetStage:ne.updateOne,updateAssetStages:ne.updateMany,deleteAssetStage:ne.deleteOne,deleteAssetStages:ne.deleteMany}}),{initializeAssetStages:nu,setAssetStage:au,setAssetStages:cu,addAssetStage:du,addAssetStages:ru,updateAssetStage:uu,updateAssetStages:lu,deleteAssetStage:ou,deleteAssetStages:hu}=Vs.actions,mu=Vs.reducer,zs=t=>t.assetStageReducer.instances,yu=t=>s=>s.assetStageReducer.instances[t],Bs=o.createSelector([zs],t=>Object.values(t)),vP=S(o.createSelector([zs,(t,s)=>s],(t,s)=>{const e={};for(const[n,a]of Object.entries(t))a.asset_procedure_type===s&&(e[n]=a);return pt(e)})),VP=S(o.createSelector([Bs,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_procedure_type===s)))),pu=S(o.createSelector([Bs,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),ae=R(t=>t.uuid),Au={instances:{}},js=o.createSlice({name:"assetTypeAttachments",initialState:Au,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,Au)),reducers:{initializeAssetTypeAttachments:ae.initialize,addAssetTypeAttachment:ae.addOne,addAssetTypeAttachments:ae.addMany,setAssetTypeAttachment:ae.setOne,setAssetTypeAttachments:ae.setMany,updateAssetTypeAttachment:ae.updateOne,updateAssetTypeAttachments:ae.updateMany,deleteAssetTypeAttachment:ae.deleteOne,deleteAssetTypeAttachments:ae.deleteMany}}),{initializeAssetTypeAttachments:fu,addAssetTypeAttachment:Su,addAssetTypeAttachments:qs,setAssetTypeAttachment:Tu,setAssetTypeAttachments:Iu,updateAssetTypeAttachment:Ou,updateAssetTypeAttachments:Pu,deleteAssetTypeAttachment:Fu,deleteAssetTypeAttachments:Ds}=js.actions,gu=t=>t.assetTypeAttachmentReducer.instances,Cs=o.createSelector([gu],t=>Object.values(t)),bu=t=>s=>s.assetTypeAttachmentReducer.instances[t],_u=S(o.createSelector([Cs,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),Mu=S(o.createSelector([Cs,(t,s)=>s],(t,s)=>T(t.filter(({asset_type:e})=>s===e)))),Ru=js.reducer,ce=R(t=>t.uuid),wu={instances:{}},$s=o.createSlice({name:"assetTypeFieldsAttachments",initialState:wu,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,wu)),reducers:{initializeAssetTypeFieldsAttachments:ce.initialize,addAssetTypeFieldsAttachment:ce.addOne,addAssetTypeFieldsAttachments:ce.addMany,setAssetTypeFieldsAttachment:ce.setOne,setAssetTypeFieldsAttachments:ce.setMany,updateAssetTypeFieldsAttachment:ce.updateOne,updateAssetTypeFieldsAttachments:ce.updateMany,deleteAssetTypeFieldsAttachment:ce.deleteOne,deleteAssetTypeFieldsAttachments:ce.deleteMany}}),{initializeAssetTypeFieldsAttachments:Eu,addAssetTypeFieldsAttachment:vu,addAssetTypeFieldsAttachments:Vu,setAssetTypeFieldsAttachment:zu,setAssetTypeFieldsAttachments:Bu,updateAssetTypeFieldsAttachment:ju,updateAssetTypeFieldsAttachments:qu,deleteAssetTypeFieldsAttachment:Du,deleteAssetTypeFieldsAttachments:Cu}=$s.actions,$u=t=>t.assetTypeFieldsAttachmentReducer.instances,Us=o.createSelector([$u],t=>Object.values(t)),zP=S(o.createSelector([Us,(t,s)=>s],(t,s)=>T(t.filter(e=>e.fields_revision===s)))),Uu=t=>s=>s.assetTypeFieldsAttachmentReducer.instances[t],Lu=S(o.createSelector([Us,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),ku=$s.reducer,de=R(t=>t.uuid),Nu={instances:{}},Ls=o.createSlice({name:"assetTypeFields",initialState:Nu,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,Nu)),reducers:{initializeAssetTypeFields:de.initialize,addAssetTypeFields:de.addOne,addAssetTypeFieldsMany:de.addMany,setAssetTypeFields:de.setOne,setAssetTypeFieldsMany:de.setMany,updateAssetTypeFields:de.updateOne,updateAssetTypeFieldsMany:de.updateMany,deleteAssetTypeFields:de.deleteOne,deleteAssetTypeFieldsMany:de.deleteMany}}),{initializeAssetTypeFields:Hu,addAssetTypeFields:Gu,addAssetTypeFieldsMany:Wu,setAssetTypeFields:Ku,setAssetTypeFieldsMany:Yu,updateAssetTypeFields:Zu,updateAssetTypeFieldsMany:Ju,deleteAssetTypeFields:Xu,deleteAssetTypeFieldsMany:Qu}=Ls.actions,xu=t=>t.assetTypeFieldsReducer.instances,lt=o.createSelector([xu],t=>Object.values(t)),BP=S(o.createSelector([lt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_type===s)))),jP=S(o.createSelector([lt,(t,s)=>s],(t,s)=>t.filter(e=>e.asset_type===s).sort((e,n)=>e.submitted_at>n.submitted_at?-1:1)[0])),el=t=>s=>s.assetTypeFieldsReducer.instances[t],tl=S(o.createSelector([lt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),sl=Ls.reducer,re=R(t=>t.uuid),il={instances:{}},ks=o.createSlice({name:"assetTypeFieldValuesAttachments",initialState:il,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,il)),reducers:{initializeAssetTypeFieldValuesAttachments:re.initialize,addAssetTypeFieldValuesAttachment:re.addOne,addAssetTypeFieldValuesAttachments:re.addMany,setAssetTypeFieldValuesAttachment:re.setOne,setAssetTypeFieldValuesAttachments:re.setMany,updateAssetTypeFieldValuesAttachment:re.updateOne,updateAssetTypeFieldValuesAttachments:re.updateMany,deleteAssetTypeFieldValuesAttachment:re.deleteOne,deleteAssetTypeFieldValuesAttachments:re.deleteMany}}),{initializeAssetTypeFieldValuesAttachments:nl,addAssetTypeFieldValuesAttachment:al,addAssetTypeFieldValuesAttachments:Ns,setAssetTypeFieldValuesAttachment:cl,setAssetTypeFieldValuesAttachments:dl,updateAssetTypeFieldValuesAttachment:rl,updateAssetTypeFieldValuesAttachments:ul,deleteAssetTypeFieldValuesAttachment:ll,deleteAssetTypeFieldValuesAttachments:Hs}=ks.actions,ol=t=>t.assetTypeFieldValuesAttachmentReducer.instances,Gs=o.createSelector([ol],t=>Object.values(t)),hl=t=>s=>s.assetTypeFieldValuesAttachmentReducer.instances[t],ml=S(o.createSelector([Gs,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),yl=S(o.createSelector([Gs,(t,s)=>s],(t,s)=>T(t.filter(e=>e.field_values===s)))),pl=ks.reducer,ue=R(t=>t.uuid),Al={instances:{}},Ws=o.createSlice({name:"assetTypeFieldValues",initialState:Al,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,Al)),reducers:{initializeAssetTypeFieldValues:ue.initialize,addAssetTypeFieldValues:ue.addOne,addAssetTypeFieldValuesMany:ue.addMany,setAssetTypeFieldValues:ue.setOne,setAssetTypeFieldValuesMany:ue.setMany,updateAssetTypeFieldValues:ue.updateOne,updateAssetTypeFieldValuesMany:ue.updateMany,deleteAssetTypeFieldValues:ue.deleteOne,deleteAssetTypeFieldValuesMany:ue.deleteMany}}),{initializeAssetTypeFieldValues:fl,addAssetTypeFieldValues:Sl,addAssetTypeFieldValuesMany:Tl,setAssetTypeFieldValues:Il,setAssetTypeFieldValuesMany:Ol,updateAssetTypeFieldValues:Pl,updateAssetTypeFieldValuesMany:Fl,deleteAssetTypeFieldValues:gl,deleteAssetTypeFieldValuesMany:bl}=Ws.actions,_l=t=>t.assetTypeFieldValuesReducer.instances,Pt=o.createSelector([_l],t=>Object.values(t)),qP=S(o.createSelector([Pt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset===s)))),DP=S(o.createSelector([lt,Pt,(t,s)=>s],(t,s,e)=>{const n=new Set(t.filter(a=>a.asset_type===e).map(a=>a.uuid));return T(s.filter(a=>n.has(a.fields_revision)))})),Ml=t=>s=>s.assetTypeFieldValuesReducer.instances[t],Rl=S(o.createSelector([Pt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),wl=Ws.reducer,le=R(t=>t.uuid),El={instances:{}},Ks=o.createSlice({name:"assetTypeIdentifiers",initialState:El,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,El)),reducers:{initializeAssetTypeIdentifiers:le.initialize,addAssetTypeIdentifier:le.addOne,addAssetTypeIdentifiers:le.addMany,setAssetTypeIdentifier:le.setOne,setAssetTypeIdentifiers:le.setMany,updateAssetTypeIdentifier:le.updateOne,updateAssetTypeIdentifiers:le.updateMany,deleteAssetTypeIdentifier:le.deleteOne,deleteAssetTypeIdentifiers:le.deleteMany}}),{initializeAssetTypeIdentifiers:vl,addAssetTypeIdentifier:Vl,addAssetTypeIdentifiers:zl,setAssetTypeIdentifier:Bl,setAssetTypeIdentifiers:jl,updateAssetTypeIdentifier:ql,updateAssetTypeIdentifiers:Dl,deleteAssetTypeIdentifier:Cl,deleteAssetTypeIdentifiers:$l}=Ks.actions,Ul=t=>t.assetTypeIdentifierReducer.instances,Ys=o.createSelector([Ul],t=>Object.values(t)),Ll=t=>s=>s.assetTypeIdentifierReducer.instances[t],kl=S(o.createSelector([Ys,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),CP=S(o.createSelector([Ys,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_type===s)))),Nl=Ks.reducer,oe=R(t=>t.uuid),Hl={instances:{}},Zs=o.createSlice({name:"assetTypeIdentifierValues",initialState:Hl,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,Hl)),reducers:{initializeAssetTypeIdentifierValues:oe.initialize,addAssetTypeIdentifierValue:oe.addOne,addAssetTypeIdentifierValues:oe.addMany,setAssetTypeIdentifierValue:oe.setOne,setAssetTypeIdentifierValues:oe.setMany,updateAssetTypeIdentifierValue:oe.updateOne,updateAssetTypeIdentifierValues:oe.updateMany,deleteAssetTypeIdentifierValue:oe.deleteOne,deleteAssetTypeIdentifierValues:oe.deleteMany}}),{initializeAssetTypeIdentifierValues:Gl,addAssetTypeIdentifierValue:Wl,addAssetTypeIdentifierValues:Kl,setAssetTypeIdentifierValue:Yl,setAssetTypeIdentifierValues:Zl,updateAssetTypeIdentifierValue:Jl,updateAssetTypeIdentifierValues:Xl,deleteAssetTypeIdentifierValue:Ql,deleteAssetTypeIdentifierValues:xl}=Zs.actions,eo=t=>t.assetTypeIdentifierValueReducer.instances,Ft=o.createSelector([eo],t=>Object.values(t)),to=t=>s=>s.assetTypeIdentifierValueReducer.instances[t],so=S(o.createSelector([Ft,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),$P=S(o.createSelector([Ft,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset===s)))),UP=S(o.createSelector([Ft,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_type_identifier===s)))),io=Zs.reducer,he=R(t=>t.uuid),no={instances:{}},Js=o.createSlice({name:"assetTypes",initialState:no,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,no)),reducers:{initializeAssetTypes:he.initialize,setAssetType:he.setOne,setAssetTypes:he.setMany,addAssetType:he.addOne,addAssetTypes:he.addMany,updateAssetType:he.updateOne,updateAssetTypes:he.updateMany,deleteAssetType:he.deleteOne,deleteAssetTypes:he.deleteMany}}),{initializeAssetTypes:ao,setAssetType:co,setAssetTypes:ro,addAssetType:uo,addAssetTypes:lo,updateAssetType:oo,updateAssetTypes:ho,deleteAssetType:mo,deleteAssetTypes:yo}=Js.actions,po=t=>t.assetTypeReducer.instances,Xs=o.createSelector([po],t=>Object.values(t)),Ao=t=>s=>s.assetTypeReducer.instances[t],fo=S(o.createSelector([Xs,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),LP=S(o.createSelector([Xs,(t,s)=>s],(t,s)=>T(t.filter(e=>e.organization===s)))),So=Js.reducer,me=R(t=>t.uuid),To={instances:{}},Qs=o.createSlice({name:"assetTypeStatuses",initialState:To,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,To)),reducers:{initializeAssetTypeStatuses:me.initialize,addAssetTypeStatus:me.addOne,addAssetTypeStatuses:me.addMany,setAssetTypeStatus:me.setOne,setAssetTypeStatuses:me.setMany,updateAssetTypeStatus:me.updateOne,updateAssetTypeStatuses:me.updateMany,deleteAssetTypeStatus:me.deleteOne,deleteAssetTypeStatuses:me.deleteMany}}),{initializeAssetTypeStatuses:Io,addAssetTypeStatus:Oo,addAssetTypeStatuses:Po,setAssetTypeStatus:Fo,setAssetTypeStatuses:go,updateAssetTypeStatus:bo,updateAssetTypeStatuses:_o,deleteAssetTypeStatus:Mo,deleteAssetTypeStatuses:Ro}=Qs.actions,wo=t=>t.assetTypeStatusReducer.instances,xs=o.createSelector([wo],t=>T(Object.values(t).toSorted(aa))),Eo=t=>s=>s.assetTypeStatusReducer.instances[t],vo=S(o.createSelector([xs,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),kP=S(o.createSelector([xs,(t,s)=>s],(t,s)=>T(t.filter(e=>e.asset_type===s)))),Vo=Qs.reducer,zo={accessToken:"",refreshToken:"",isLoggedIn:!1},gt=o.createSlice({name:"auth",initialState:zo,extraReducers:t=>t.addCase(_,s=>Object.assign(s,zo)),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||gt.caseReducers.clearTokens(t),t.isLoggedIn=s.payload}}}),{setTokens:NP,clearTokens:HP,setLoggedIn:Bo}=gt.actions,GP=t=>t.authReducer.accessToken,WP=t=>t.authReducer.isLoggedIn,jo=gt.reducer,ye=R(t=>t.uuid),qo={instances:{}},ei=o.createSlice({name:"categories",initialState:qo,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,qo)),reducers:{initializeCategories:ye.initialize,addCategory:ye.addOne,addCategories:ye.addMany,setCategory:ye.setOne,setCategories:ye.setMany,updateCategory:ye.updateOne,updateCategories:ye.updateMany,deleteCategory:ye.deleteOne,deleteCategories:ye.deleteMany}}),{initializeCategories:Do,addCategory:Co,addCategories:$o,setCategory:Uo,setCategories:Lo,updateCategory:ko,updateCategories:No,deleteCategory:Ho,deleteCategories:Go}=ei.actions,Wo=t=>t.categoryReducer.instances,ti=o.createSelector([Wo],t=>Object.values(t)),si=t=>s=>s.categoryReducer.instances[t],Ko=S(o.createSelector([ti,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),KP=S(o.createSelector([ti,(t,s)=>s],(t,s)=>T(t.filter(e=>e.project===s)))),Yo=ei.reducer,pe=R(t=>t.uuid),Zo={instances:{}},ii=o.createSlice({name:"documentAttachments",initialState:Zo,extraReducers:t=>t.addCase(_,s=>Object.assign(s,Zo)),reducers:{initializeDocumentAttachments:pe.initialize,addDocumentAttachment:pe.addOne,addDocumentAttachments:pe.addMany,setDocumentAttachment:pe.setOne,setDocumentAttachments:pe.setMany,updateDocumentAttachment:pe.updateOne,updateDocumentAttachments:pe.updateMany,deleteDocumentAttachment:pe.deleteOne,deleteDocumentAttachments:pe.deleteMany}}),{initializeDocumentAttachments:Jo,addDocumentAttachment:Xo,addDocumentAttachments:Qo,setDocumentAttachment:xo,setDocumentAttachments:eh,updateDocumentAttachment:th,updateDocumentAttachments:sh,deleteDocumentAttachment:ih,deleteDocumentAttachments:nh}=ii.actions,ah=t=>t.documentAttachmentReducer.instances,ni=o.createSelector([ah],t=>Object.values(t)),ch=t=>s=>s.documentAttachmentReducer.instances[t],dh=S(o.createSelector([ni,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),YP=S(o.createSelector([ni,(t,s)=>s],(t,s)=>T(t.filter(({document:e})=>s===e)))),rh=ii.reducer,Ae=R(({uuid:t})=>t),uh={instances:{}},ai=o.createSlice({name:"documents",initialState:uh,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>{Object.assign(s,uh)}),reducers:{initializeDocuments:Ae.initialize,addDocument:Ae.addOne,addDocuments:Ae.addMany,setDocument:Ae.setOne,setDocuments:Ae.setMany,updateDocument:Ae.updateOne,updateDocuments:Ae.updateMany,deleteDocument:Ae.deleteOne,deleteDocuments:Ae.deleteMany}}),{initializeDocuments:lh,addDocument:oh,addDocuments:hh,setDocument:mh,setDocuments:yh,updateDocument:ph,updateDocuments:Ah,deleteDocument:fh,deleteDocuments:Sh}=ai.actions,Th=ai.reducer,ci=t=>t.documentsReducer.instances,bt=o.createSelector([ci],t=>Object.values(t)),Ih=t=>s=>s.documentsReducer.instances[t],Oh=S(o.createSelector([bt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),ZP=S(o.createSelector([bt,(t,s)=>s],(t,s)=>t.filter(e=>e.project===s))),JP=S(o.createSelector([bt,(t,s)=>s],(t,s)=>t.filter(e=>e.organization===s))),Ph=S(o.createSelector([ci,(t,s)=>s],(t,s)=>{if(!t[s])return T([]);const a=ra(s,Object.values(t)).all().map(({model:c})=>c);return T(a)})),fe=R(t=>t.uuid),Fh={instances:{}},di=o.createSlice({name:"emailDomains",initialState:Fh,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,Fh)),reducers:{initializeEmailDomains:fe.initialize,addEmailDomain:fe.addOne,addEmailDomains:fe.addMany,setEmailDomain:fe.setOne,setEmailDomains:fe.setMany,updateEmailDomain:fe.updateOne,updateEmailDomains:fe.updateMany,deleteEmailDomain:fe.deleteOne,deleteEmailDomains:fe.deleteMany}}),{initializeEmailDomains:gh,addEmailDomain:bh,addEmailDomains:_h,setEmailDomain:Mh,setEmailDomains:Rh,updateEmailDomain:wh,updateEmailDomains:Eh,deleteEmailDomain:vh,deleteEmailDomains:Vh}=di.actions,zh=t=>t.emailDomainsReducer.instances,ri=o.createSelector([zh],t=>Object.values(t)),Bh=t=>s=>s.emailDomainsReducer.instances[t],jh=S(o.createSelector([ri,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),XP=S(o.createSelector([ri,(t,s)=>s],(t,s)=>T(t.filter(e=>e.organization===s)))),qh=di.reducer,Dh={s3Urls:{}},Ch=1e3*60*60,QP=Ch*24*7,ui=o.createSlice({name:"file",initialState:Dh,extraReducers:t=>t.addCase(_,s=>Object.assign(s,Dh)),reducers:{setUploadUrl:(t,s)=>{const{url:e,fields:n,sha1:a}=s.payload,c=new Date,r=new Date(c.getTime()+QP);t.s3Urls[a]={url:e,fields:n,exp:r.getTime()}}}}),{setUploadUrl:$h}=ui.actions,Uh=t=>s=>{const e=s.fileReducer.s3Urls[t];if(!e)return;const n=new Date().getTime();if(!((e.exp??n)-n<Ch))return e},Lh=ui.reducer,Se=R(t=>t.uuid),kh={instances:{}},li=o.createSlice({name:"formIdentifiers",initialState:kh,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,kh)),reducers:{initializeFormIdentifiers:Se.initialize,addFormIdentifier:Se.addOne,addFormIdentifiers:Se.addMany,setFormIdentifier:Se.setOne,setFormIdentifiers:Se.setMany,updateFormIdentifier:Se.updateOne,updateFormIdentifiers:Se.updateMany,deleteFormIdentifier:Se.deleteOne,deleteFormIdentifiers:Se.deleteMany}}),{initializeFormIdentifiers:Nh,addFormIdentifier:Hh,addFormIdentifiers:Gh,setFormIdentifier:Wh,setFormIdentifiers:Kh,updateFormIdentifier:Yh,updateFormIdentifiers:Zh,deleteFormIdentifier:Jh,deleteFormIdentifiers:Xh}=li.actions,Qh=t=>t.formIdentifierReducer.instances,oi=o.createSelector([Qh],t=>Object.values(t)),xh=t=>s=>s.formIdentifierReducer.instances[t],em=S(o.createSelector([oi,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),xP=S(o.createSelector([oi,(t,s)=>s],(t,s)=>T(t.filter(e=>e.form===s)))),tm=li.reducer,Te=R(t=>t.uuid),sm={instances:{}},hi=o.createSlice({name:"formIdentifierValues",initialState:sm,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,sm)),reducers:{initializeFormIdentifierValues:Te.initialize,addFormIdentifierValue:Te.addOne,addFormIdentifierValues:Te.addMany,setFormIdentifierValue:Te.setOne,setFormIdentifierValues:Te.setMany,updateFormIdentifierValue:Te.updateOne,updateFormIdentifierValues:Te.updateMany,deleteFormIdentifierValue:Te.deleteOne,deleteFormIdentifierValues:Te.deleteMany}}),{initializeFormIdentifierValues:im,addFormIdentifierValue:nm,addFormIdentifierValues:am,setFormIdentifierValue:cm,setFormIdentifierValues:dm,updateFormIdentifierValue:rm,updateFormIdentifierValues:um,deleteFormIdentifierValue:lm,deleteFormIdentifierValues:om}=hi.actions,hm=t=>t.formIdentifierValueReducer.instances,_t=o.createSelector([hm],t=>Object.values(t)),mm=t=>s=>s.formIdentifierValueReducer.instances[t],ym=S(o.createSelector([_t,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),eF=S(o.createSelector([_t,(t,s)=>s],(t,s)=>T(t.filter(e=>e.form_submission===s)))),tF=S(o.createSelector([_t,(t,s)=>s],(t,s)=>T(t.filter(e=>e.form_identifier===s)))),pm=hi.reducer,Ie=R(t=>t.uuid),Am={instances:{}},mi=o.createSlice({name:"formRevisionAttachments",initialState:Am,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,Am)),reducers:{initializeFormRevisionAttachments:Ie.initialize,addFormRevisionAttachment:Ie.addOne,addFormRevisionAttachments:Ie.addMany,setFormRevisionAttachment:Ie.setOne,setFormRevisionAttachments:Ie.setMany,updateFormRevisionAttachment:Ie.updateOne,updateFormRevisionAttachments:Ie.updateMany,deleteFormRevisionAttachment:Ie.deleteOne,deleteFormRevisionAttachments:Ie.deleteMany}}),{initializeFormRevisionAttachments:fm,addFormRevisionAttachment:Sm,addFormRevisionAttachments:Tm,setFormRevisionAttachment:Im,setFormRevisionAttachments:Om,updateFormRevisionAttachment:Pm,updateFormRevisionAttachments:Fm,deleteFormRevisionAttachment:gm,deleteFormRevisionAttachments:bm}=mi.actions,Mt=t=>t.formRevisionAttachmentReducer.instances,_m=o.createSelector([Mt],t=>Object.values(t)),Mm=S(o.createSelector([Mt,(t,s)=>s],(t,s)=>t[s])),Rm=S(o.createSelector([_m,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),sF=S(o.createSelector([Mt,(t,s)=>s],(t,s)=>T(Object.values(t).filter(e=>e.form_revision===s)))),wm=mi.reducer,Oe=R(t=>t.uuid),Em={instances:{}},yi=o.createSlice({name:"formRevisions",initialState:Em,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,Em)),reducers:{initializeFormRevisions:Oe.initialize,addFormRevision:Oe.addOne,addFormRevisions:Oe.addMany,setFormRevision:Oe.setOne,setFormRevisions:Oe.setMany,updateFormRevision:Oe.updateOne,updateFormRevisions:Oe.updateMany,deleteFormRevision:Oe.deleteOne,deleteFormRevisions:Oe.deleteMany}}),{initializeFormRevisions:vm,addFormRevision:pi,addFormRevisions:Ai,setFormRevision:Vm,setFormRevisions:zm,updateFormRevision:Bm,updateFormRevisions:jm,deleteFormRevision:fi,deleteFormRevisions:Si}=yi.actions,Ti=t=>t.formRevisionReducer.instances,Rt=o.createSelector([Ti],t=>Object.values(t)),qm=t=>s=>s.formRevisionReducer.instances[t],Dm=S(o.createSelector([Rt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),iF=S(o.createSelector([Rt,(t,s)=>s],(t,s)=>t.filter(e=>e.form===s).sort((e,n)=>e.submitted_at>n.submitted_at?-1:1)[0])),Cm=S(o.createSelector([Rt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.form===s)))),$m=yi.reducer,Pe=R(t=>t.uuid),Um={instances:{}},Ii=o.createSlice({name:"forms",initialState:Um,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,Um)),reducers:{initializeForms:Pe.initialize,addForm:Pe.addOne,addForms:Pe.addMany,setForm:Pe.setOne,setForms:Pe.setMany,updateForm:Pe.updateOne,updateForms:Pe.updateMany,deleteForm:Pe.deleteOne,deleteForms:Pe.deleteMany}}),{initializeForms:Lm,addForm:km,addForms:Nm,setForm:Hm,setForms:Gm,updateForm:Wm,updateForms:Km,deleteForm:Ym,deleteForms:Zm}=Ii.actions,Jm=Ii.reducer,Xm=t=>t.formReducer.instances,Oi=o.createSelector([Xm],t=>Object.values(t)),Qm=t=>s=>s.formReducer.instances[t],xm=S(o.createSelector([Oi,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),nF=S(o.createSelector([Oi,(t,s)=>s],(t,s)=>T(t.filter(e=>e.organization===s)))),Fe=R(t=>t.uuid),ey={instances:{}},Pi=o.createSlice({name:"formSubmissionAttachments",initialState:ey,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,ey)),reducers:{initializeFormSubmissionAttachments:Fe.initialize,addFormSubmissionAttachment:Fe.addOne,addFormSubmissionAttachments:Fe.addMany,setFormSubmissionAttachment:Fe.setOne,setFormSubmissionAttachments:Fe.setMany,updateFormSubmissionAttachment:Fe.updateOne,updateFormSubmissionAttachments:Fe.updateMany,deleteFormSubmissionAttachment:Fe.deleteOne,deleteFormSubmissionAttachments:Fe.deleteMany}}),{initializeFormSubmissionAttachments:ty,addFormSubmissionAttachment:sy,addFormSubmissionAttachments:Fi,setFormSubmissionAttachment:iy,setFormSubmissionAttachments:ny,updateFormSubmissionAttachment:ay,updateFormSubmissionAttachments:cy,deleteFormSubmissionAttachment:dy,deleteFormSubmissionAttachments:gi}=Pi.actions,bi=t=>t.formSubmissionAttachmentReducer.instances,_i=o.createSelector([bi],t=>Object.values(t)),ry=S(o.createSelector([bi,(t,s)=>s],(t,s)=>t[s])),Mi=S(o.createSelector([_i,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(n=>e.has(n.uuid)))})),uy=Mi,ly=S(o.createSelector([_i,(t,s)=>s],(t,s)=>T(t.filter(e=>e.form_submission===s)))),oy=Pi.reducer,ge=R(t=>t.uuid),hy={instances:{}},Ri=o.createSlice({name:"formSubmissions",initialState:hy,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,hy)),reducers:{initializeFormSubmissions:ge.initialize,setFormSubmission:ge.setOne,setFormSubmissions:ge.setMany,addFormSubmission:ge.addOne,addFormSubmissions:ge.addMany,updateFormSubmission:ge.updateOne,updateFormSubmissions:ge.updateMany,deleteFormSubmission:ge.deleteOne,deleteFormSubmissions:ge.deleteMany}}),{initializeFormSubmissions:my,setFormSubmission:yy,setFormSubmissions:py,addFormSubmission:Ay,addFormSubmissions:wi,updateFormSubmission:fy,updateFormSubmissions:Sy,deleteFormSubmission:Ty,deleteFormSubmissions:Ei}=Ri.actions,vi=t=>t.formSubmissionReducer.instances,Iy=o.createSelector([vi],t=>Object.values(t)),Oy=t=>s=>s.formSubmissionReducer.instances[t],Py=S(o.createSelector([Iy,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),Fy=S(o.createSelector([vi,Ti,(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))})),gy=Ri.reducer,be=R(t=>t.uuid),by={instances:{}},Vi=o.createSlice({name:"geoImages",initialState:by,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,by)),reducers:{initializeGeoImages:be.initialize,setGeoImage:be.setOne,setGeoImages:be.setMany,addGeoImage:be.addOne,addGeoImages:be.addMany,updateGeoImage:be.updateOne,updateGeoImages:be.updateMany,deleteGeoImage:be.deleteOne,deleteGeoImages:be.deleteMany}}),{initializeGeoImages:_y,setGeoImage:My,setGeoImages:Ry,addGeoImage:wy,addGeoImages:Ey,updateGeoImage:vy,updateGeoImages:Vy,deleteGeoImage:zy,deleteGeoImages:By}=Vi.actions,jy=t=>t.geoImageReducer.instances,zi=o.createSelector([jy],t=>Object.values(t)),qy=t=>s=>s.geoImageReducer.instances[t],Dy=S(o.createSelector([zi,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),aF=S(o.createSelector([zi,(t,s)=>s],(t,s)=>T(t.filter(e=>e.project===s)))),Cy=Vi.reducer,_e=R(t=>t.uuid),$y={instances:{}},Bi=o.createSlice({name:"issueAssociations",initialState:$y,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,$y)),reducers:{initializeIssueAssociations:_e.initialize,addIssueAssociation:_e.addOne,addIssueAssociations:_e.addMany,setIssueAssociation:_e.setOne,setIssueAssociations:_e.setMany,updateIssueAssociation:_e.updateOne,updateIssueAssociations:_e.updateMany,deleteIssueAssociation:_e.deleteOne,deleteIssueAssociations:_e.deleteMany}}),{initializeIssueAssociations:Uy,setIssueAssociations:Ly,setIssueAssociation:ky,updateIssueAssociation:Ny,updateIssueAssociations:Hy,addIssueAssociation:Gy,addIssueAssociations:wt,deleteIssueAssociation:Wy,deleteIssueAssociations:Et}=Bi.actions,ot=t=>t.issueAssociationReducer.instances,Ky=o.createSelector([ot],t=>Object.values(t)),Yy=t=>s=>s.issueAssociationReducer.instances[t],Zy=S(o.createSelector([Ky,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),Jy=S(o.createSelector([ot,(t,s)=>s],(t,s)=>T(Object.values(t).filter(e=>e.associated_issue===s)))),Xy=S(o.createSelector([ot,(t,s)=>s],(t,s)=>T(Object.values(t).filter(e=>e.issue===s)))),Qy=S(o.createSelector([ot,(t,s)=>s],(t,s)=>T(Object.values(t).filter(e=>e.asset===s)))),xy=Bi.reducer,Me=R(t=>t.uuid),ep={instances:{}},ji=o.createSlice({name:"issueAttachments",initialState:ep,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,ep)),reducers:{initializeIssueAttachments:Me.initialize,addIssueAttachment:Me.addOne,addIssueAttachments:Me.addMany,setIssueAttachment:Me.setOne,setIssueAttachments:Me.setMany,updateIssueAttachment:Me.updateOne,updateIssueAttachments:Me.updateMany,deleteIssueAttachment:Me.deleteOne,deleteIssueAttachments:Me.deleteMany}}),{initializeIssueAttachments:tp,addIssueAttachment:sp,addIssueAttachments:qi,setIssueAttachment:ip,setIssueAttachments:np,updateIssueAttachment:ap,updateIssueAttachments:cp,deleteIssueAttachment:dp,deleteIssueAttachments:Di}=ji.actions,rp=t=>t.issueAttachmentReducer.instances,Ci=o.createSelector([rp],t=>Object.values(t)),up=S(o.createSelector([Ci,(t,s)=>s],(t,s)=>T(t.filter(({issue:e})=>s===e)))),lp=t=>s=>s.issueAttachmentReducer.instances[t],op=S(o.createSelector([Ci,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),hp=ji.reducer,Re=R(t=>t.uuid),mp={instances:{}},$i=o.createSlice({name:"issueCommentAttachments",initialState:mp,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,mp)),reducers:{initializeIssueCommentAttachments:Re.initialize,addIssueCommentAttachment:Re.addOne,addIssueCommentAttachments:Re.addMany,setIssueCommentAttachment:Re.setOne,setIssueCommentAttachments:Re.setMany,updateIssueCommentAttachment:Re.updateOne,updateIssueCommentAttachments:Re.updateMany,deleteIssueCommentAttachment:Re.deleteOne,deleteIssueCommentAttachments:Re.deleteMany}}),{initializeIssueCommentAttachments:yp,addIssueCommentAttachment:pp,addIssueCommentAttachments:Ap,setIssueCommentAttachment:fp,setIssueCommentAttachments:Sp,updateIssueCommentAttachment:Tp,updateIssueCommentAttachments:Ip,deleteIssueCommentAttachment:Op,deleteIssueCommentAttachments:Pp}=$i.actions,Fp=t=>t.issueCommentAttachmentReducer.instances,Ui=o.createSelector([Fp],t=>Object.values(t)),gp=t=>s=>s.issueCommentAttachmentReducer.instances[t],bp=S(o.createSelector([Ui,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),cF=S(o.createSelector([Ui,(t,s)=>s],(t,s)=>T(t.filter(({issue_comment:e})=>s===e)))),_p=$i.reducer,we=R(t=>t.uuid),Mp={instances:{}},Li=o.createSlice({name:"issueComments",initialState:Mp,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,Mp)),reducers:{initializeIssueComments:we.initialize,addIssueComment:we.addOne,addIssueComments:we.addMany,setIssueComment:we.setOne,setIssueComments:we.setMany,updateIssueComment:we.updateOne,updateIssueComments:we.updateMany,deleteIssueComment:we.deleteOne,deleteIssueComments:we.deleteMany}}),{initializeIssueComments:Rp,addIssueComment:wp,addIssueComments:Ep,setIssueComment:vp,setIssueComments:Vp,updateIssueComment:zp,updateIssueComments:Bp,deleteIssueComment:jp,deleteIssueComments:qp}=Li.actions,ki=t=>t.issueCommentReducer.instances,Dp=t=>s=>s.issueCommentReducer.instances[t],Cp=S(o.createSelector([ki,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(Object.values(t).filter(({uuid:n})=>e.has(n)))})),dF=S(o.createSelector([ki,(t,s)=>s],(t,s)=>T(Object.values(t).filter(e=>e.issue===s)))),$p=Li.reducer,Ee=R(t=>t.uuid),Up={instances:{}},Ni=o.createSlice({name:"issues",initialState:Up,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,Up)),reducers:{initializeIssues:Ee.initialize,addIssue:Ee.addOne,addIssues:Ee.addMany,setIssue:Ee.setOne,setIssues:Ee.setMany,updateIssue:Ee.updateOne,updateIssues:Ee.updateMany,deleteIssue:Ee.deleteOne,deleteIssues:Ee.deleteMany}}),{initializeIssues:Lp,addIssue:kp,addIssues:Hi,setIssue:Np,setIssues:Hp,updateIssue:Gp,updateIssues:Wp,deleteIssue:Kp,deleteIssues:Gi}=Ni.actions,Yp=t=>t.issueReducer.instances,vt=o.createSelector([Yp],t=>Object.values(t)),Zp=t=>s=>s.issueReducer.instances[t],Jp=S(o.createSelector([vt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),rF=S(o.createSelector([vt,(t,s)=>s],(t,s)=>t.filter(e=>e.project===s))),Xp=S(o.createSelector([vt,(t,s)=>s],(t,s)=>t.filter(e=>e.issue_type===s))),Qp=Ni.reducer,ve=R(t=>t.uuid),xp={instances:{}},Wi=o.createSlice({name:"issueTypeAttachments",initialState:xp,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,xp)),reducers:{initializeIssueTypeAttachments:ve.initialize,addIssueTypeAttachment:ve.addOne,addIssueTypeAttachments:ve.addMany,setIssueTypeAttachment:ve.setOne,setIssueTypeAttachments:ve.setMany,updateIssueTypeAttachment:ve.updateOne,updateIssueTypeAttachments:ve.updateMany,deleteIssueTypeAttachment:ve.deleteOne,deleteIssueTypeAttachments:ve.deleteMany}}),{initializeIssueTypeAttachments:eA,addIssueTypeAttachment:tA,addIssueTypeAttachments:sA,setIssueTypeAttachment:iA,setIssueTypeAttachments:nA,updateIssueTypeAttachment:aA,updateIssueTypeAttachments:cA,deleteIssueTypeAttachment:dA,deleteIssueTypeAttachments:rA}=Wi.actions,uA=t=>t.issueTypeAttachmentReducer.instances,Ki=o.createSelector([uA],t=>Object.values(t)),lA=t=>s=>s.issueTypeAttachmentReducer.instances[t],oA=S(o.createSelector([Ki,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),uF=S(o.createSelector([Ki,(t,s)=>s],(t,s)=>T(t.filter(({issue_type:e})=>s===e)))),hA=Wi.reducer,Ve=R(t=>t.uuid),mA={instances:{}},Yi=o.createSlice({name:"issueTypeFieldsAttachments",initialState:mA,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,mA)),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:yA,addIssueTypeFieldsAttachment:pA,addIssueTypeFieldsAttachments:AA,setIssueTypeFieldsAttachment:fA,setIssueTypeFieldsAttachments:SA,updateIssueTypeFieldsAttachment:TA,updateIssueTypeFieldsAttachments:IA,deleteIssueTypeFieldsAttachment:OA,deleteIssueTypeFieldsAttachments:PA}=Yi.actions,FA=t=>t.issueTypeFieldsAttachmentReducer.instances,Zi=o.createSelector([FA],t=>Object.values(t)),lF=S(o.createSelector([Zi,(t,s)=>s],(t,s)=>T(t.filter(e=>e.fields_revision===s)))),gA=t=>s=>s.issueTypeFieldsAttachmentReducer.instances[t],bA=S(o.createSelector([Zi,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),_A=Yi.reducer,ze=R(t=>t.uuid),MA={instances:{}},Ji=o.createSlice({name:"issueTypeFieldValues",initialState:MA,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,MA)),reducers:{initializeIssueTypeFieldValues:ze.initialize,addIssueTypeFieldValues:ze.addOne,addIssueTypeFieldValuesMany:ze.addMany,setIssueTypeFieldValues:ze.setOne,setIssueTypeFieldValuesMany:ze.setMany,updateIssueTypeFieldValues:ze.updateOne,updateIssueTypeFieldValuesMany:ze.updateMany,deleteIssueTypeFieldValues:ze.deleteOne,deleteIssueTypeFieldValuesMany:ze.deleteMany}}),{initializeIssueTypeFieldValues:RA,addIssueTypeFieldValues:wA,addIssueTypeFieldValuesMany:EA,setIssueTypeFieldValues:vA,setIssueTypeFieldValuesMany:VA,updateIssueTypeFieldValues:zA,updateIssueTypeFieldValuesMany:BA,deleteIssueTypeFieldValues:jA,deleteIssueTypeFieldValuesMany:qA}=Ji.actions,DA=t=>t.issueTypeFieldValuesReducer.instances,Vt=o.createSelector([DA],t=>Object.values(t)),oF=S(o.createSelector([Vt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.issue===s)))),CA=t=>s=>s.issueTypeFieldValuesReducer.instances[t],$A=S(o.createSelector([Vt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),UA=Ji.reducer,Be=R(t=>t.uuid),LA={instances:{}},Xi=o.createSlice({name:"issueTypeFields",initialState:LA,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,LA)),reducers:{initializeIssueTypeFields:Be.initialize,addIssueTypeFields:Be.addOne,addIssueTypeFieldsMany:Be.addMany,setIssueTypeFields:Be.setOne,setIssueTypeFieldsMany:Be.setMany,updateIssueTypeFields:Be.updateOne,updateIssueTypeFieldsMany:Be.updateMany,deleteIssueTypeFields:Be.deleteOne,deleteIssueTypeFieldsMany:Be.deleteMany}}),{initializeIssueTypeFields:kA,addIssueTypeFields:NA,addIssueTypeFieldsMany:HA,setIssueTypeFields:GA,setIssueTypeFieldsMany:WA,updateIssueTypeFields:KA,updateIssueTypeFieldsMany:YA,deleteIssueTypeFields:ZA,deleteIssueTypeFieldsMany:JA}=Xi.actions,XA=t=>t.issueTypeFieldsReducer.instances,ht=o.createSelector([XA],t=>Object.values(t)),hF=S(o.createSelector([ht,(t,s)=>s],(t,s)=>T(t.filter(e=>e.issue_type===s)))),mF=S(o.createSelector([ht,(t,s)=>s],(t,s)=>t.filter(e=>e.issue_type===s).sort((e,n)=>e.submitted_at>n.submitted_at?-1:1)[0])),yF=S(o.createSelector([ht,Vt,(t,s)=>s],(t,s,e)=>{const n=new Set(t.filter(a=>a.issue_type===e).map(a=>a.uuid));return T(s.filter(a=>n.has(a.fields_revision)))})),QA=t=>s=>s.issueTypeFieldsReducer.instances[t],xA=S(o.createSelector([ht,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),ef=Xi.reducer,je=R(t=>t.uuid),tf={instances:{}},Qi=o.createSlice({name:"issueTypeFieldValuesAttachments",initialState:tf,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,tf)),reducers:{initializeIssueTypeFieldValuesAttachments:je.initialize,addIssueTypeFieldValuesAttachment:je.addOne,addIssueTypeFieldValuesAttachments:je.addMany,setIssueTypeFieldValuesAttachment:je.setOne,setIssueTypeFieldValuesAttachments:je.setMany,updateIssueTypeFieldValuesAttachment:je.updateOne,updateIssueTypeFieldValuesAttachments:je.updateMany,deleteIssueTypeFieldValuesAttachment:je.deleteOne,deleteIssueTypeFieldValuesAttachments:je.deleteMany}}),{initializeIssueTypeFieldValuesAttachments:sf,addIssueTypeFieldValuesAttachment:nf,addIssueTypeFieldValuesAttachments:xi,setIssueTypeFieldValuesAttachment:af,setIssueTypeFieldValuesAttachments:cf,updateIssueTypeFieldValuesAttachment:df,updateIssueTypeFieldValuesAttachments:rf,deleteIssueTypeFieldValuesAttachment:uf,deleteIssueTypeFieldValuesAttachments:en}=Qi.actions,lf=t=>t.issueTypeFieldValuesAttachmentReducer.instances,tn=o.createSelector([lf],t=>Object.values(t)),of=t=>s=>s.issueTypeFieldValuesAttachmentReducer.instances[t],hf=S(o.createSelector([tn,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),mf=S(o.createSelector([tn,(t,s)=>s],(t,s)=>T(t.filter(e=>e.field_values===s)))),yf=Qi.reducer,qe=R(t=>t.uuid),pf={instances:{}},sn=o.createSlice({name:"issueTypeIdentifiers",initialState:pf,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,pf)),reducers:{initializeIssueTypeIdentifiers:qe.initialize,addIssueTypeIdentifier:qe.addOne,addIssueTypeIdentifiers:qe.addMany,setIssueTypeIdentifier:qe.setOne,setIssueTypeIdentifiers:qe.setMany,updateIssueTypeIdentifier:qe.updateOne,updateIssueTypeIdentifiers:qe.updateMany,deleteIssueTypeIdentifier:qe.deleteOne,deleteIssueTypeIdentifiers:qe.deleteMany}}),{initializeIssueTypeIdentifiers:Af,addIssueTypeIdentifier:ff,addIssueTypeIdentifiers:Sf,setIssueTypeIdentifier:Tf,setIssueTypeIdentifiers:If,updateIssueTypeIdentifier:Of,updateIssueTypeIdentifiers:Pf,deleteIssueTypeIdentifier:Ff,deleteIssueTypeIdentifiers:gf}=sn.actions,bf=t=>t.issueTypeIdentifierReducer.instances,nn=o.createSelector([bf],t=>Object.values(t)),_f=t=>s=>s.issueTypeIdentifierReducer.instances[t],Mf=S(o.createSelector([nn,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),pF=S(o.createSelector([nn,(t,s)=>s],(t,s)=>T(t.filter(e=>e.issue_type===s)))),Rf=sn.reducer,De=R(t=>t.uuid),wf={instances:{}},an=o.createSlice({name:"issueTypeIdentifierValues",initialState:wf,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,wf)),reducers:{initializeIssueTypeIdentifierValues:De.initialize,addIssueTypeIdentifierValue:De.addOne,addIssueTypeIdentifierValues:De.addMany,setIssueTypeIdentifierValue:De.setOne,setIssueTypeIdentifierValues:De.setMany,updateIssueTypeIdentifierValue:De.updateOne,updateIssueTypeIdentifierValues:De.updateMany,deleteIssueTypeIdentifierValue:De.deleteOne,deleteIssueTypeIdentifierValues:De.deleteMany}}),{initializeIssueTypeIdentifierValues:Ef,addIssueTypeIdentifierValue:vf,addIssueTypeIdentifierValues:Vf,setIssueTypeIdentifierValue:zf,setIssueTypeIdentifierValues:Bf,updateIssueTypeIdentifierValue:jf,updateIssueTypeIdentifierValues:qf,deleteIssueTypeIdentifierValue:Df,deleteIssueTypeIdentifierValues:Cf}=an.actions,$f=t=>t.issueTypeIdentifierValueReducer.instances,zt=o.createSelector([$f],t=>Object.values(t)),Uf=t=>s=>s.issueTypeIdentifierValueReducer.instances[t],Lf=S(o.createSelector([zt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),AF=S(o.createSelector([zt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.issue===s)))),fF=S(o.createSelector([zt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.issue_type_identifier===s)))),kf=an.reducer,Ce=R(t=>t.uuid),Nf={instances:{}},cn=o.createSlice({name:"issueTypes",initialState:Nf,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,Nf)),reducers:{initializeIssueTypes:Ce.initialize,addIssueType:Ce.addOne,addIssueTypes:Ce.addMany,setIssueType:Ce.setOne,setIssueTypes:Ce.setMany,updateIssueType:Ce.updateOne,updateIssueTypes:Ce.updateMany,deleteIssueType:Ce.deleteOne,deleteIssueTypes:Ce.deleteMany}}),{initializeIssueTypes:Hf,addIssueType:Gf,addIssueTypes:Wf,setIssueType:Kf,setIssueTypes:Yf,updateIssueType:Zf,updateIssueTypes:Jf,deleteIssueType:Xf,deleteIssueTypes:Qf}=cn.actions,xf=t=>t.issueTypeReducer.instances,dn=o.createSelector(xf,t=>Object.values(t)),eS=t=>s=>s.issueTypeReducer.instances[t],tS=S(o.createSelector([dn,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),SF=S(o.createSelector([dn,(t,s)=>s],(t,s)=>T(t.filter(e=>e.organization===s)))),sS=cn.reducer,$e=R(t=>t.uuid),iS={instances:{}},rn=o.createSlice({name:"issueTypeStatuses",initialState:iS,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,iS)),reducers:{initializeIssueTypeStatuses:$e.initialize,addIssueTypeStatus:$e.addOne,addIssueTypeStatuses:$e.addMany,setIssueTypeStatus:$e.setOne,setIssueTypeStatuses:$e.setMany,updateIssueTypeStatus:$e.updateOne,updateIssueTypeStatuses:$e.updateMany,deleteIssueTypeStatus:$e.deleteOne,deleteIssueTypeStatuses:$e.deleteMany}}),{initializeIssueTypeStatuses:nS,addIssueTypeStatus:aS,addIssueTypeStatuses:cS,setIssueTypeStatus:dS,setIssueTypeStatuses:rS,updateIssueTypeStatus:uS,updateIssueTypeStatuses:lS,deleteIssueTypeStatus:oS,deleteIssueTypeStatuses:hS}=rn.actions,mS=t=>t.issueTypeStatusReducer.instances,un=o.createSelector([mS],t=>T(Object.values(t).toSorted(ca))),ln=t=>s=>s.issueTypeStatusReducer.instances[t],yS=S(o.createSelector([un,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),TF=S(o.createSelector([un,(t,s)=>s],(t,s)=>T(t.filter(e=>e.issue_type===s)))),pS=rn.reducer,Ue=R(t=>t.uuid),AS={instances:{}},on=o.createSlice({name:"issueUpdates",initialState:AS,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,AS)),reducers:{initializeIssueUpdates:Ue.initialize,addIssueUpdate:Ue.addOne,addIssueUpdates:Ue.addMany,setIssueUpdate:Ue.setOne,setIssueUpdates:Ue.setMany,updateIssueUpdate:Ue.updateOne,updateIssueUpdates:Ue.updateMany,deleteIssueUpdate:Ue.deleteOne,deleteIssueUpdates:Ue.deleteMany}}),{initializeIssueUpdates:fS,addIssueUpdate:hn,addIssueUpdates:mn,setIssueUpdate:SS,setIssueUpdates:TS,updateIssueUpdate:IS,updateIssueUpdates:OS,deleteIssueUpdate:yn,deleteIssueUpdates:pn}=on.actions,An=t=>t.issueUpdateReducer.instances,fn=o.createSelector([An],t=>Object.values(t)),PS=S(o.createSelector([An,(t,s)=>s],(t,s)=>t[s])),FS=S(o.createSelector([fn,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),gS=S(o.createSelector([fn,(t,s)=>s],(t,s)=>T(t.filter(e=>e.issue===s)))),bS=on.reducer,Le=R(t=>t.id),_S={instances:{},currentUser:null},Sn=o.createSlice({name:"users",initialState:_S,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,_S)),reducers:{initializeUsers:Le.initialize,setUsers:Le.setMany,setUser:Le.setOne,addUsers:Le.addMany,addUser:Le.addOne,updateUsers:Le.updateMany,updateUser:Le.updateOne,deleteUser:Le.deleteOne,deleteUsers:Le.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:MS,setUsers:RS,setUser:wS,addUsers:ES,addUser:Tn,updateUsers:vS,updateUser:VS,deleteUser:In,deleteUsers:zS,setCurrentUser:IF,setProfilePicture:OF}=Sn.actions,BS=Sn.reducer,jS=t=>t.userReducer.currentUser,On=t=>t.userReducer.instances,Bt=o.createSelector([On],t=>Object.values(t)),jt=t=>s=>s.userReducer.instances[t],qS=S(o.createSelector([Bt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({id:n})=>e.has(n)))})),ke=R(t=>t.uuid),DS={instances:{}},Pn=o.createSlice({name:"organizationAccess",initialState:DS,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,DS)),reducers:{initializeOrganizationAccesses:ke.initialize,addOrganizationAccess:ke.addOne,addOrganizationAccesses:ke.addMany,setOrganizationAccess:ke.setOne,setOrganizationAccesses:ke.setMany,updateOrganizationAccess:ke.updateOne,updateOrganizationAccesses:ke.updateMany,deleteOrganizationAccess:ke.deleteOne,deleteOrganizationAccesses:ke.deleteMany}}),{initializeOrganizationAccesses:CS,addOrganizationAccess:$S,addOrganizationAccesses:US,setOrganizationAccess:LS,setOrganizationAccesses:kS,updateOrganizationAccess:NS,updateOrganizationAccesses:HS,deleteOrganizationAccess:GS,deleteOrganizationAccesses:WS}=Pn.actions,KS=Pn.reducer,qt=t=>t.organizationAccessReducer.instances,YS=t=>s=>s.organizationAccessReducer.instances[t],ZS=S(o.createSelector([qt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(Object.values(t).filter(({uuid:n})=>e.has(n)))})),PF=o.createSelector([jS,qt],(t,s)=>Object.values(s).find(n=>n.user===(t==null?void 0:t.id))??null),JS=o.createSelector([qt],t=>{const s={};for(const e of Object.values(t))s[e.user]=e;return pt(s)}),FF=S(o.createSelector([On,JS,(t,s)=>s],(t,s,e)=>T(Object.values(t).filter(n=>{const a=s[n.id];return!!a&&a.organization===e})))),Ne=R(t=>t.uuid),XS={instances:{}},Fn=o.createSlice({name:"organizations",initialState:XS,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,XS)),reducers:{initializeOrganizations:Ne.initialize,setOrganizations:Ne.setMany,setOrganization:Ne.setOne,addOrganizations:Ne.addMany,addOrganization:Ne.addOne,updateOrganizations:Ne.updateMany,updateOrganization:Ne.updateOne,deleteOrganization:Ne.deleteOne,deleteOrganizations:Ne.deleteMany}}),{initializeOrganizations:QS,setOrganizations:xS,setOrganization:eT,addOrganizations:tT,addOrganization:sT,updateOrganizations:iT,updateOrganization:nT,deleteOrganization:aT,deleteOrganizations:cT}=Fn.actions,dT=t=>t.organizationReducer.instances,rT=o.createSelector([dT],t=>Object.values(t)),uT=t=>s=>s.organizationReducer.instances[t],lT=S(o.createSelector([rT,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),oT=Fn.reducer,hT=(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}}}}},mT={deletedRequests:[],latestRetryTime:0},gn=o.createSlice({name:"outbox",initialState:mT,extraReducers:t=>t.addCase(_,s=>Object.assign(s,mT)),reducers:{enqueueRequest:{reducer:(t,s)=>t,prepare:t=>{console.debug("Preparing to enqueue request",t);const{BASE_URL:s,serviceName:e,...n}=t;return hT(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}}}),gF=t=>t.outboxReducer.deletedRequests,bF=t=>t.outboxReducer.latestRetryTime,{enqueueRequest:yT,markForDeletion:_F,markAsDeleted:pT,_setLatestRetryTime:AT}=gn.actions,fT=gn.reducer,He=R(t=>t.uuid),ST={instances:{}},bn=o.createSlice({name:"projectAccess",initialState:ST,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,ST)),reducers:{initializeProjectAccesses:He.initialize,addProjectAccess:He.addOne,addProjectAccesses:He.addMany,setProjectAccess:He.setOne,setProjectAccesses:He.setMany,updateProjectAccess:He.updateOne,updateProjectAccesses:He.updateMany,deleteProjectAccess:He.deleteOne,deleteProjectAccesses:He.deleteMany}}),{initializeProjectAccesses:TT,addProjectAccess:IT,addProjectAccesses:OT,setProjectAccess:PT,setProjectAccesses:FT,updateProjectAccess:gT,updateProjectAccesses:bT,deleteProjectAccess:_T,deleteProjectAccesses:MT}=bn.actions,RT=bn.reducer,_n=t=>t.projectAccessReducer.instances,mt=o.createSelector(_n,t=>Object.values(t)),wT=t=>s=>s.projectAccessReducer.instances[t],ET=S(o.createSelector([mt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),MF=S(o.createSelector([_n,(t,s)=>s],(t,s)=>T(Object.values(t).filter(e=>e.project===s)))),RF=S(o.createSelector([mt,(t,s)=>s],(t,s)=>{const e={};for(const n of t.filter(a=>a.project===s))e[n.user]=n;return e})),wF=S(o.createSelector([Bt,mt,(t,s)=>s],(t,s,e)=>{const n=new Set(s.filter(a=>a.project===e).map(a=>a.user));return T(t.filter(a=>n.has(a.id)))})),Ge=R(t=>t.uuid),vT={instances:{}},Mn=o.createSlice({name:"projectAttachments",initialState:vT,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,vT)),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:VT,addProjectAttachment:zT,addProjectAttachments:BT,setProjectAttachment:jT,setProjectAttachments:qT,updateProjectAttachment:DT,updateProjectAttachments:CT,deleteProjectAttachment:$T,deleteProjectAttachments:UT}=Mn.actions,LT=t=>t.projectAttachmentReducer.instances,Rn=o.createSelector([LT],t=>Object.values(t)),kT=t=>s=>s.projectAttachmentReducer.instances[t],NT=S(o.createSelector([Rn,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),EF=S(o.createSelector([Rn,(t,s)=>s],(t,s)=>T(t.filter(({project:e})=>s===e)))),HT=Mn.reducer,We=R(t=>t.uuid),GT={instances:{},activeProjectFileId:null,isImportingProjectFile:!1},wn=o.createSlice({name:"projectFiles",initialState:GT,extraReducers:t=>t.addMatcher(o.isAnyOf(_,C,w),s=>Object.assign(s,GT)),reducers:{initializeProjectFiles:We.initialize,setProjectFile:We.setOne,setProjectFiles:We.setMany,addProjectFile:We.addOne,addProjectFiles:We.addMany,updateProjectFile:We.updateOne,updateProjectFiles:We.updateMany,deleteProjectFile:We.deleteOne,deleteProjectFiles:We.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:
|
|
1
|
+
(function(i,L){typeof exports=="object"&&typeof module<"u"?L(exports,require("@redux-offline/redux-offline/lib/types"),require("@reduxjs/toolkit"),require("superagent"),require("uuid"),require("react"),require("file-saver"),require("fast-tree-builder"),require("ts-tree-lib"),require("react-fast-compare"),require("react-redux"),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","react","file-saver","fast-tree-builder","ts-tree-lib","react-fast-compare","react-redux","@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"],L):(i=typeof globalThis<"u"?globalThis:i||self,L(i["overmap-core"]={},null,i.toolkit,i.request,i.uuid,i.react,i.fileSaver,i.buildTree,i.tsTreeLib,i.isEqual,i.reactRedux,i.reduxOffline,i.offlineConfig,i.localforage,i.createMigration,null,null,i.idb,i.jwtDecode,i.dependencyGraph))})(this,function(i,L,p,it,et,RO,wO,Gn,pt,EO,vO,VO,Hn,zO,BO,_b,Mb,jO,qO,DO){"use strict";var gb=Object.defineProperty;var bb=(i,L,p)=>L in i?gb(i,L,{enumerable:!0,configurable:!0,writable:!0,value:p}):i[L]=p;var m=(i,L,p)=>bb(i,typeof L!="symbol"?L+"":L,p);var _O;const Wn=Object.freeze([]),Kn=Object.freeze({});var Yn=(t=>(t[t.GUEST=0]="GUEST",t[t.BASIC=2]="BASIC",t[t.ADMIN=4]="ADMIN",t))(Yn||{}),h=(t=>(t.GET="GET",t.POST="POST",t.PATCH="PATCH",t.PUT="PUT",t.DELETE="DELETE",t))(h||{}),Zn=(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))(Zn||{}),Jn=(t=>(t.Issue="issue",t.Asset="asset",t.AssetType="asset_type",t.Project="project",t.Document="document",t))(Jn||{}),Lt=(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))(Lt||{}),U=(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))(U||{}),Xn=(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))(Xn||{});const CO=Lt.MEDIUM,Qn=6e4;function w(t){return{addOne:(o,y)=>{const A=t(y.payload);o.instances[A]=y.payload},addMany:(o,y)=>{for(const A of y.payload){const f=t(A);o.instances[f]=A}},setOne:(o,y)=>{const A=t(y.payload);o.instances[A]=y.payload},setMany:(o,y)=>{for(const A of y.payload){const f=t(A);o.instances[f]=A}},updateOne:(o,y)=>{const A=t(y.payload);o.instances[A]=y.payload},updateMany:(o,y)=>{for(const A of y.payload){const f=t(A);o.instances[f]=A}},deleteOne:(o,y)=>{delete o.instances[y.payload]},deleteMany:(o,y)=>{for(const A of y.payload)delete o.instances[A]},initialize:(o,y)=>{o.instances={};const A=new Set;for(const f of y.payload){const I=t(f);A.add(I),o.instances[I]=f}A.size!==y.payload.length&&console.warn("duplicate ids detected when initializing model instances.")}}}function $O(){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 o=new Set(u.selection);for(const y of d.payload)o.has(y)||o.add(y);u.selection=Array.from(o)},unselectOne:(u,d)=>{const o=new Set(u.selection);o.has(d.payload)&&(o.delete(d.payload),u.selection=Array.from(o))},unselectMany:(u,d)=>{const o=new Set(u.selection);for(const y of d.payload)o.has(y)&&o.delete(y);u.selection=Array.from(o)},toggleOne:(u,d)=>{const o=new Set(u.selection);o.has(d.payload)?o.delete(d.payload):o.add(d.payload),u.selection=Array.from(o)},toggleMany:(u,d)=>{const o=new Set(u.selection);for(const y of d.payload)o.has(y)?o.delete(y):o.add(y);u.selection=Array.from(o)},getInitialState:u=>({...u,selection:[]})}}const ut="versioning",M=p.createAction("RESET"),$=p.createAction("RESET_PROJECT_STATE"),E=p.createAction("RESET_ORGANIZATION_STATE");function UO(t,s){return RO.useMemo(t,s)}_O=Symbol.toStringTag;class Nt{constructor(){m(this,_O,"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 Gt=!1;["true","1"].includes("".toLowerCase())&&(Gt=!0);function kO(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 Ht(t){const s={};return function(){const e=Array.prototype.slice.call(arguments);return e in s?(Gt&&console.debug(`Memoization debug: Using memorized return value for ${t.toString()}(`,e,")"),s[e]):(Gt&&console.debug(`Memoization debug: Cache miss! Memoizing ${t.toString()}(`,e,")"),s[e]=t.apply(this,e))}}function LO(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?Wn:t,At=t=>Object.keys(t).length===0?Kn:t,xn=Ht(t=>{if(!t)return"";const s=new Date(t),e=s.getFullYear()===Wt.getFullYear(),n={day:"numeric",month:"short"};return e||(n.year="numeric"),s.toLocaleDateString([],n)}),NO=new Intl.RelativeTimeFormat([],{style:"long",numeric:"auto"}),GO=1e3*86400,Wt=new Date,HO=t=>new Date(t).toDateString()===Wt.toDateString(),WO=Ht((t,s,e)=>{const n=Math.round((new Date(t).getTime()-Wt.getTime())/GO);return n<s||n>e?xn(t):NO.format(n,"days")});function KO(t){return new Uint8Array(t).reduce((e,n)=>e+n.toString(16).padStart(2,"0"),"")}const Kt=async(t,s)=>{s||(s=await nt(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 nt(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=KO(c);s(r)})},n.readAsArrayBuffer(t)})}function YO(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 ea(t,s){return new File([t],s,{type:t.type})}function ZO(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 JO=async t=>{const s={};for(const e of t){const n=await nt(e);s[n]={sha1:n,extension:e.name.split(".").pop()||"",file_type:e.type,size:e.size}}return Object.values(s)},ta=async t=>(await fetch(t)).blob(),XO=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 QO(t){const s=new Blob([t]);wO.saveAs(s,t.name)}const sa={};function xO(t,s,e,...n){const a=sa[t];let c=!1;a?a[s]||(a[s]=!0,c=!0):(sa[t]={[s]:!0},c=!0),c&&console[e](...n)}const ia=["created_at","updated_at","index","revision"];function R(t){return{...t,uuid:et.v4()}}function eP(t){const s={};for(const e of t)s[e.uuid]=e;return s}function C(t){return t.map(({uuid:s})=>s)}function ft(t,s){return t.localeCompare(s)}function Yt(t,s){return ft(t.uuid,s.uuid)}function tP(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 sP(t){return t.toLowerCase().replace(" ","-")}function iP(t,s=!1){return t.normalize("NFKD").toLowerCase().replace(/[^\w\s-]/g,"").trim().replace(/[-\s]+/g,s?"_":"-")}function nP(t,s){if(t.length<=s)return t;const e=t.slice(0,s-1);return e.slice(0,e.lastIndexOf(" "))+"…"}const aP=/^.+@.+\..+$/;function z(t){const s={...t};for(const e of[...ia,"created_by"])e in s&&delete s[e];return s}const na=t=>{const s=t.toSorted((e,n)=>e.order-n.order);return Gn(s,{id:e=>e.uuid,parentId:e=>e.parent,includeEmptyChildrenArray:!0,valueKey:!1})},cP=t=>{const{roots:s}=na(t);return s.map(e=>new pt.Tree(e))},aa=(t,s)=>{const{nodes:e}=na(s),n=e.get(t);if(!n)throw new Error(`Node with uuid ${t} does not exist in asset procedure step tree.`);return new pt.Tree(n)},ca=(t,s)=>t.type!==s.type?t.type-s.type:t.order-s.order,da=(t,s)=>t.type!==s.type?t.type-s.type:t.order-s.order,ra=t=>Gn(t,{id:s=>s.uuid,parentId:s=>s.parent_document,includeEmptyChildrenArray:!0,valueKey:!1}),dP=t=>{const{roots:s}=ra(t);return s.map(e=>new pt.Tree(e))},ua=(t,s)=>{const{nodes:e}=ra(s),n=e.get(t);if(!n)throw new Error(`Node with uuid ${t} does not exist in document tree.`);return new pt.Tree(n)};class rP{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 p.createSelector([this.getData],n=>this.performOperations(n).find(a=>a[s]===e))}count(){return p.createSelector([this.getData],s=>this.performOperations(s).length)}first(){return p.createSelector([this.getData],s=>this.performOperations(s)[0])}last(){return p.createSelector([this.getData],s=>{const e=this.performOperations(s);return e[e.length-1]})}exists(){return p.createSelector([this.getData],s=>this.performOperations(s).length>0)}toSelector(){return p.createSelector([this.getData],s=>S(this.performOperations(s)))}}const T=t=>s=>e=>t(e,s),O=p.createSelectorCreator({memoize:p.weakMapMemoize,memoizeOptions:{resultEqualityCheck:vO.shallowEqual}}),uP=p.createSelectorCreator({memoize:p.weakMapMemoize,memoizeOptions:{resultEqualityCheck:EO}}),G=w(t=>t.uuid),la={instances:{}},Zt=p.createSlice({name:"agents",initialState:la,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,la)),reducers:{initializeConversations:G.initialize,addConversation:G.addOne,addConversations:G.addMany,setConversation:G.setOne,setConversations:G.setMany,updateConversation:G.updateOne,updateConversations:G.updateMany,deleteConversation:G.deleteOne,deleteConversations:G.deleteMany}}),{initializeConversations:oa,addConversation:ha,addConversations:lP,setConversation:ma,setConversations:oP,updateConversation:ya,updateConversations:hP,deleteConversation:mP,deleteConversations:yP}=Zt.actions,Jt=t=>t.agentsReducer.instances,pP=p.createSelector([Jt],t=>Object.values(t)),AP=T(p.createSelector([Jt,(t,s)=>s],(t,s)=>t[s])),pa=Zt.reducer,H=w(t=>t.uuid),Aa={instances:{}},Xt=p.createSlice({name:"assetAttachments",initialState:Aa,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,Aa)),reducers:{initializeAssetAttachments:H.initialize,addAssetAttachment:H.addOne,addAssetAttachments:H.addMany,setAssetAttachment:H.setOne,setAssetAttachments:H.setMany,updateAssetAttachment:H.updateOne,updateAssetAttachments:H.updateMany,deleteAssetAttachment:H.deleteOne,deleteAssetAttachments:H.deleteMany}}),{initializeAssetAttachments:fa,addAssetAttachment:Ta,addAssetAttachments:Qt,setAssetAttachment:Sa,setAssetAttachments:Ia,updateAssetAttachment:Oa,updateAssetAttachments:Pa,deleteAssetAttachment:Fa,deleteAssetAttachments:xt}=Xt.actions,ga=t=>t.assetAttachmentReducer.instances,es=p.createSelector([ga],t=>Object.values(t)),ba=t=>s=>s.assetAttachmentReducer.instances[t],_a=T(O([es,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),Ma=T(O([es,(t,s)=>s],(t,s)=>S(t.filter(({asset:e})=>s===e)))),Ra=Xt.reducer,W=w(({uuid:t})=>t),wa={instances:{}},ts=p.createSlice({name:"assetProcedureTypeAttachments",initialState:wa,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,wa)),reducers:{initializeAssetProcedureTypeAttachments:W.initialize,addAssetProcedureTypeAttachment:W.addOne,addAssetProcedureTypeAttachments:W.addMany,setAssetProcedureTypeAttachment:W.setOne,setAssetProcedureTypeAttachments:W.setMany,updateAssetProcedureTypeAttachment:W.updateOne,updateAssetProcedureTypeAttachments:W.updateMany,deleteAssetProcedureTypeAttachment:W.deleteOne,deleteAssetProcedureTypeAttachments:W.deleteMany}}),{initializeAssetProcedureTypeAttachments:Ea,addAssetProcedureTypeAttachment:va,addAssetProcedureTypeAttachments:Va,setAssetProcedureTypeAttachment:za,setAssetProcedureTypeAttachments:Ba,updateAssetProcedureTypeAttachment:ja,updateAssetProcedureTypeAttachments:qa,deleteAssetProcedureTypeAttachment:Da,deleteAssetProcedureTypeAttachments:Ca}=ts.actions,$a=ts.reducer,Ua=t=>t.assetProcedureTypeAttachmentReducer.instances,ss=p.createSelector([Ua],t=>Object.values(t)),ka=t=>s=>s.assetProcedureTypeAttachmentReducer.instances[t],La=T(O([ss,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),fP=T(O([ss,(t,s)=>s],(t,s)=>S(t.filter(({asset_procedure_type:e})=>s===e)))),K=w(({uuid:t})=>t),Na={instances:{}},is=p.createSlice({name:"assetProcedureTypeFieldsAttachments",initialState:Na,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,Na)),reducers:{initializeAssetProcedureTypeFieldsAttachments:K.initialize,addAssetProcedureTypeFieldsAttachment:K.addOne,addAssetProcedureTypeFieldsAttachments:K.addMany,setAssetProcedureTypeFieldsAttachment:K.setOne,setAssetProcedureTypeFieldsAttachments:K.setMany,updateAssetProcedureTypeFieldsAttachment:K.updateOne,updateAssetProcedureTypeFieldsAttachments:K.updateMany,deleteAssetProcedureTypeFieldsAttachment:K.deleteOne,deleteAssetProcedureTypeFieldsAttachments:K.deleteMany}}),{initializeAssetProcedureTypeFieldsAttachments:Ga,addAssetProcedureTypeFieldsAttachment:Ha,addAssetProcedureTypeFieldsAttachments:Wa,setAssetProcedureTypeFieldsAttachment:Ka,setAssetProcedureTypeFieldsAttachments:Ya,updateAssetProcedureTypeFieldsAttachment:Za,updateAssetProcedureTypeFieldsAttachments:Ja,deleteAssetProcedureTypeFieldsAttachment:Xa,deleteAssetProcedureTypeFieldsAttachments:Qa}=is.actions,xa=is.reducer,ec=t=>t.assetProcedureTypeFieldsAttachmentReducer.instances,ns=p.createSelector([ec],t=>Object.values(t)),TP=T(O([ns,(t,s)=>s],(t,s)=>S(t.filter(e=>e.fields_revision===s)))),tc=t=>s=>s.assetProcedureTypeFieldsAttachmentReducer.instances[t],sc=T(O([ns,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),Y=w(({uuid:t})=>t),ic={instances:{}},as=p.createSlice({name:"assetProcedureTypeFields",initialState:ic,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,ic)),reducers:{initializeAssetProcedureTypeFields:Y.initialize,addAssetProcedureTypeFields:Y.addOne,addAssetProcedureTypeFieldsMany:Y.addMany,setAssetProcedureTypeFields:Y.setOne,setAssetProcedureTypeFieldsMany:Y.setMany,updateAssetProcedureTypeFields:Y.updateOne,updateAssetProcedureTypeFieldsMany:Y.updateMany,deleteAssetProcedureTypeFields:Y.deleteOne,deleteAssetProcedureTypeFieldsMany:Y.deleteMany}}),{initializeAssetProcedureTypeFields:nc,addAssetProcedureTypeFields:ac,addAssetProcedureTypeFieldsMany:cc,setAssetProcedureTypeFields:dc,setAssetProcedureTypeFieldsMany:rc,updateAssetProcedureTypeFields:uc,updateAssetProcedureTypeFieldsMany:lc,deleteAssetProcedureTypeFields:oc,deleteAssetProcedureTypeFieldsMany:hc}=as.actions,mc=as.reducer,yc=t=>t.assetProcedureTypeFieldsReducer.instances,Tt=p.createSelector([yc],t=>Object.values(t)),SP=T(O([Tt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_procedure_type===s)))),IP=T(p.createSelector([Tt,(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])),pc=t=>s=>s.assetProcedureTypeFieldsReducer.instances[t],Ac=T(O([Tt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),Z=w(({uuid:t})=>t),fc={instances:{}},cs=p.createSlice({name:"assetProcedureTypeFieldValuesAttachments",initialState:fc,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,fc)),reducers:{initializeAssetProcedureTypeFieldValuesAttachments:Z.initialize,addAssetProcedureTypeFieldValuesAttachment:Z.addOne,addAssetProcedureTypeFieldValuesAttachments:Z.addMany,setAssetProcedureTypeFieldValuesAttachment:Z.setOne,setAssetProcedureTypeFieldValuesAttachments:Z.setMany,updateAssetProcedureTypeFieldValuesAttachment:Z.updateOne,updateAssetProcedureTypeFieldValuesAttachments:Z.updateMany,deleteAssetProcedureTypeFieldValuesAttachment:Z.deleteOne,deleteAssetProcedureTypeFieldValuesAttachments:Z.deleteMany}}),{initializeAssetProcedureTypeFieldValuesAttachments:Tc,addAssetProcedureTypeFieldValuesAttachment:Sc,addAssetProcedureTypeFieldValuesAttachments:ds,setAssetProcedureTypeFieldValuesAttachment:Ic,setAssetProcedureTypeFieldValuesAttachments:Oc,updateAssetProcedureTypeFieldValuesAttachment:Pc,updateAssetProcedureTypeFieldValuesAttachments:Fc,deleteAssetProcedureTypeFieldValuesAttachment:gc,deleteAssetProcedureTypeFieldValuesAttachments:rs}=cs.actions,bc=cs.reducer,_c=t=>t.assetProcedureTypeFieldValuesAttachmentReducer.instances,us=p.createSelector([_c],t=>Object.values(t)),Mc=t=>s=>s.assetProcedureTypeFieldValuesAttachmentReducer.instances[t],Rc=T(O([us,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),wc=T(O([us,(t,s)=>s],(t,s)=>S(t.filter(e=>e.field_values===s)))),J=w(({uuid:t})=>t),Ec={instances:{}},ls=p.createSlice({name:"assetProcedureTypeFieldValues",initialState:Ec,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,Ec)),reducers:{initializeAssetProcedureTypeFieldValues:J.initialize,addAssetProcedureTypeFieldValues:J.addOne,addAssetProcedureTypeFieldValuesMany:J.addMany,setAssetProcedureTypeFieldValues:J.setOne,setAssetProcedureTypeFieldValuesMany:J.setMany,updateAssetProcedureTypeFieldValues:J.updateOne,updateAssetProcedureTypeFieldValuesMany:J.updateMany,deleteAssetProcedureTypeFieldValues:J.deleteOne,deleteAssetProcedureTypeFieldValuesMany:J.deleteMany}}),{initializeAssetProcedureTypeFieldValues:vc,addAssetProcedureTypeFieldValues:Vc,addAssetProcedureTypeFieldValuesMany:zc,setAssetProcedureTypeFieldValues:Bc,setAssetProcedureTypeFieldValuesMany:jc,updateAssetProcedureTypeFieldValues:qc,updateAssetProcedureTypeFieldValuesMany:Dc,deleteAssetProcedureTypeFieldValues:Cc,deleteAssetProcedureTypeFieldValuesMany:$c}=ls.actions,Uc=ls.reducer,kc=t=>t.assetProcedureTypeFieldValuesReducer.instances,St=p.createSelector([kc],t=>Object.values(t)),OP=T(O([St,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset===s)))),PP=T(O([St,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_procedure===s)))),Lc=t=>s=>s.assetProcedureTypeFieldValuesReducer.instances[t],Nc=T(O([St,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),X=w(({uuid:t})=>t),Gc={instances:{}},os=p.createSlice({name:"assetProcedures",initialState:Gc,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,Gc)),reducers:{initializeAssetProcedures:X.initialize,addAssetProcedure:X.addOne,addAssetProcedures:X.addMany,setAssetProcedure:X.setOne,setAssetProcedures:X.setMany,updateAssetProcedure:X.updateOne,updateAssetProcedures:X.updateMany,deleteAssetProcedure:X.deleteOne,deleteAssetProcedures:X.deleteMany}}),{initializeAssetProcedures:Hc,addAssetProcedure:Wc,addAssetProcedures:hs,updateAssetProcedure:Kc,updateAssetProcedures:Yc,deleteAssetProcedure:Zc,deleteAssetProcedures:ms,setAssetProcedure:Jc,setAssetProcedures:Xc}=os.actions,Qc=os.reducer,xc=t=>t.assetProcedureReducer.instances,It=p.createSelector([xc],t=>Object.values(t)),ed=T(O([It,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_procedure_type===s)))),FP=T(O([It,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_type===s)))),td=t=>s=>s.assetProcedureReducer.instances[t],sd=T(O([It,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),Q=w(t=>t.uuid),id={instances:{}},ys=p.createSlice({name:"assetProcedureTypes",initialState:id,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,id)),reducers:{initializeAssetProcedureTypes:Q.initialize,addAssetProcedureType:Q.addOne,addAssetProcedureTypes:Q.addMany,setAssetProcedureType:Q.setOne,setAssetProcedureTypes:Q.setMany,updateAssetProcedureType:Q.updateOne,updateAssetProcedureTypes:Q.updateMany,deleteAssetProcedureType:Q.deleteOne,deleteAssetProcedureTypes:Q.deleteMany}}),{initializeAssetProcedureTypes:nd,addAssetProcedureType:ad,addAssetProcedureTypes:cd,updateAssetProcedureType:dd,updateAssetProcedureTypes:rd,deleteAssetProcedureType:ud,deleteAssetProcedureTypes:ld,setAssetProcedureType:od,setAssetProcedureTypes:hd}=ys.actions,md=ys.reducer,yd=t=>t.assetProcedureTypeReducer.instances,ps=p.createSelector([yd],t=>Object.values(t)),pd=t=>s=>s.assetProcedureTypeReducer.instances[t],Ad=T(O([ps,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),gP=T(O([ps,(t,s)=>s],(t,s)=>S(t.filter(e=>e.organization===s)))),x=w(t=>t.uuid),fd={instances:{}},As=p.createSlice({name:"assetProcedureStepFieldsAttachments",initialState:fd,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,fd)),reducers:{initializeAssetProcedureStepFieldsAttachments:x.initialize,addAssetProcedureStepFieldsAttachment:x.addOne,addAssetProcedureStepFieldsAttachments:x.addMany,setAssetProcedureStepFieldsAttachment:x.setOne,setAssetProcedureStepFieldsAttachments:x.setMany,updateAssetProcedureStepFieldsAttachment:x.updateOne,updateAssetProcedureStepFieldsAttachments:x.updateMany,deleteAssetProcedureStepFieldsAttachment:x.deleteOne,deleteAssetProcedureStepFieldsAttachments:x.deleteMany}}),{initializeAssetProcedureStepFieldsAttachments:Td,addAssetProcedureStepFieldsAttachment:Sd,addAssetProcedureStepFieldsAttachments:Id,setAssetProcedureStepFieldsAttachment:Od,setAssetProcedureStepFieldsAttachments:Pd,updateAssetProcedureStepFieldsAttachment:Fd,updateAssetProcedureStepFieldsAttachments:gd,deleteAssetProcedureStepFieldsAttachment:bd,deleteAssetProcedureStepFieldsAttachments:_d}=As.actions,Md=t=>t.assetProcedureStepFieldsAttachmentReducer.instances,fs=p.createSelector([Md],t=>Object.values(t)),bP=T(O([fs,(t,s)=>s],(t,s)=>S(t.filter(e=>e.fields_revision===s)))),Rd=t=>s=>s.assetProcedureStepFieldsAttachmentReducer.instances[t],wd=T(O([fs,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),Ed=As.reducer,ee=w(t=>t.uuid),vd={instances:{}},Ts=p.createSlice({name:"assetProcedureStepFields",initialState:vd,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,vd)),reducers:{initializeAssetProcedureStepFields:ee.initialize,addAssetProcedureStepFields:ee.addOne,addAssetProcedureStepFieldsMany:ee.addMany,setAssetProcedureStepFields:ee.setOne,setAssetProcedureStepFieldsMany:ee.setMany,updateAssetProcedureStepFields:ee.updateOne,updateAssetProcedureStepFieldsMany:ee.updateMany,deleteAssetProcedureStepFields:ee.deleteOne,deleteAssetProcedureStepFieldsMany:ee.deleteMany}}),{initializeAssetProcedureStepFields:Vd,addAssetProcedureStepFields:zd,addAssetProcedureStepFieldsMany:Bd,setAssetProcedureStepFields:jd,setAssetProcedureStepFieldsMany:qd,updateAssetProcedureStepFields:Dd,updateAssetProcedureStepFieldsMany:Cd,deleteAssetProcedureStepFields:$d,deleteAssetProcedureStepFieldsMany:Ud}=Ts.actions,Ss=t=>t.assetProcedureStepFieldsReducer.instances,Ot=p.createSelector([Ss],t=>Object.values(t)),_P=T(O([Ot,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_procedure_step===s)))),MP=T(p.createSelector([Ot,(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])),RP=p.createSelector([Ss],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}),kd=t=>s=>s.assetProcedureStepFieldsReducer.instances[t],Ld=T(O([Ot,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),Nd=Ts.reducer,te=w(t=>t.uuid),Gd={instances:{}},Is=p.createSlice({name:"assetProcedureStepFieldValuesAttachments",initialState:Gd,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,Gd)),reducers:{initializeAssetProcedureStepFieldValuesAttachments:te.initialize,addAssetProcedureStepFieldValuesAttachment:te.addOne,addAssetProcedureStepFieldValuesAttachments:te.addMany,setAssetProcedureStepFieldValuesAttachment:te.setOne,setAssetProcedureStepFieldValuesAttachments:te.setMany,updateAssetProcedureStepFieldValuesAttachment:te.updateOne,updateAssetProcedureStepFieldValuesAttachments:te.updateMany,deleteAssetProcedureStepFieldValuesAttachment:te.deleteOne,deleteAssetProcedureStepFieldValuesAttachments:te.deleteMany}}),{initializeAssetProcedureStepFieldValuesAttachments:Hd,addAssetProcedureStepFieldValuesAttachment:Wd,addAssetProcedureStepFieldValuesAttachments:Os,setAssetProcedureStepFieldValuesAttachment:Kd,setAssetProcedureStepFieldValuesAttachments:Yd,updateAssetProcedureStepFieldValuesAttachment:Zd,updateAssetProcedureStepFieldValuesAttachments:Jd,deleteAssetProcedureStepFieldValuesAttachment:Xd,deleteAssetProcedureStepFieldValuesAttachments:Ps}=Is.actions,Qd=t=>t.assetProcedureStepFieldValuesAttachmentReducer.instances,Fs=p.createSelector([Qd],t=>Object.values(t)),xd=t=>s=>s.assetProcedureStepFieldValuesAttachmentReducer.instances[t],er=T(O([Fs,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),tr=T(O([Fs,(t,s)=>s],(t,s)=>S(t.filter(e=>e.field_values===s)))),sr=Is.reducer,se=w(t=>t.uuid),ir={instances:{}},gs=p.createSlice({name:"assetProcedureStepFieldValues",initialState:ir,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,ir)),reducers:{initializeAssetProcedureStepFieldValues:se.initialize,addAssetProcedureStepFieldValues:se.addOne,addAssetProcedureStepFieldValuesMany:se.addMany,setAssetProcedureStepFieldValues:se.setOne,setAssetProcedureStepFieldValuesMany:se.setMany,updateAssetProcedureStepFieldValues:se.updateOne,updateAssetProcedureStepFieldValuesMany:se.updateMany,deleteAssetProcedureStepFieldValues:se.deleteOne,deleteAssetProcedureStepFieldValuesMany:se.deleteMany}}),{initializeAssetProcedureStepFieldValues:nr,addAssetProcedureStepFieldValues:ar,addAssetProcedureStepFieldValuesMany:cr,setAssetProcedureStepFieldValues:dr,setAssetProcedureStepFieldValuesMany:rr,updateAssetProcedureStepFieldValues:ur,updateAssetProcedureStepFieldValuesMany:lr,deleteAssetProcedureStepFieldValues:or,deleteAssetProcedureStepFieldValuesMany:hr}=gs.actions,mr=t=>t.assetProcedureStepFieldValuesReducer.instances,lt=p.createSelector([mr],t=>Object.values(t)),wP=T(O([lt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset===s)))),EP=T(O([lt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_procedure===s)))),vP=T(O([lt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_procedure_step===s)))),yr=t=>s=>s.assetProcedureStepFieldValuesReducer.instances[t],pr=T(O([lt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),Ar=gs.reducer,ie=w(t=>t.uuid),fr={instances:{}},bs=p.createSlice({name:"assetProcedureSteps",initialState:fr,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,fr)),reducers:{initializeAssetProcedureSteps:ie.initialize,setAssetProcedureStep:ie.setOne,setAssetProcedureSteps:ie.setMany,addAssetProcedureStep:ie.addOne,addAssetProcedureSteps:ie.addMany,updateAssetProcedureStep:ie.updateOne,updateAssetProcedureSteps:ie.updateMany,deleteAssetProcedureStep:ie.deleteOne,deleteAssetProcedureSteps:ie.deleteMany}}),{initializeAssetProcedureSteps:Tr,setAssetProcedureStep:Sr,setAssetProcedureSteps:Ir,addAssetProcedureStep:Or,addAssetProcedureSteps:Pr,updateAssetProcedureStep:Fr,updateAssetProcedureSteps:gr,deleteAssetProcedureStep:br,deleteAssetProcedureSteps:_r}=bs.actions,Mr=bs.reducer,Pt=t=>t.assetProcedureStepReducer.instances,Rr=t=>s=>s.assetProcedureStepReducer.instances[t],_s=p.createSelector([Pt],t=>Object.values(t)),VP=T(p.createSelector([Pt,(t,s)=>s],(t,s)=>{const e={};for(const[n,a]of Object.entries(t))a.asset_procedure_type===s&&(e[n]=a);return At(e)})),zP=T(O([_s,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_procedure_type===s)))),wr=T(O([_s,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),Er=T(O([Pt,(t,s)=>s],(t,s)=>{if(!t[s])return S([]);const a=aa(s,Object.values(t)).all().map(({model:c})=>c);return S(a)})),ne=w(t=>t.uuid),vr={instances:{}},Ms=p.createSlice({name:"assets",initialState:vr,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,vr)),reducers:{initializeAssets:ne.initialize,addAsset:ne.addOne,addAssets:ne.addMany,setAsset:ne.setOne,setAssets:ne.setMany,updateAsset:ne.updateOne,updateAssets:ne.updateMany,deleteAsset:ne.deleteOne,deleteAssets:ne.deleteMany}}),{initializeAssets:Vr,addAsset:zr,addAssets:Rs,updateAsset:Br,updateAssets:jr,deleteAsset:qr,deleteAssets:ws,setAsset:Dr,setAssets:Cr}=Ms.actions,$r=t=>t.assetReducer.instances,Es=p.createSelector([$r],t=>S(Object.values(t))),vs=T(O([Es,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_type===s)))),Ur=t=>s=>s.assetReducer.instances[t],kr=T(O([Es,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),BP=t=>s=>vs(t)(s).length,Lr=Ms.reducer,ae=w(t=>t.uuid),Nr={instances:{}},Vs=p.createSlice({name:"assetStageCompletions",initialState:Nr,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,Nr)),reducers:{initializeAssetStageCompletions:ae.initialize,addAssetStageCompletion:ae.addOne,addAssetStageCompletions:ae.addMany,setAssetStageCompletion:ae.setOne,setAssetStageCompletions:ae.setMany,updateAssetStageCompletion:ae.updateOne,updateAssetStageCompletions:ae.updateMany,deleteAssetStageCompletion:ae.deleteOne,deleteAssetStageCompletions:ae.deleteMany}}),{initializeAssetStageCompletions:Gr,addAssetStageCompletion:Hr,addAssetStageCompletions:Wr,setAssetStageCompletion:Kr,setAssetStageCompletions:Yr,updateAssetStageCompletion:Zr,updateAssetStageCompletions:Jr,deleteAssetStageCompletion:Xr,deleteAssetStageCompletions:Qr}=Vs.actions,xr=Vs.reducer,eu=t=>t.assetStageCompletionReducer.instances,tu=p.createSelector([eu],t=>Object.values(t)),su=t=>s=>s.assetStageCompletionReducer.instances[t],iu=T(O([tu,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),ce=w(t=>t.uuid),nu={instances:{}},zs=p.createSlice({name:"assetStages",initialState:nu,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,nu)),reducers:{initializeAssetStages:ce.initialize,setAssetStage:ce.setOne,setAssetStages:ce.setMany,addAssetStage:ce.addOne,addAssetStages:ce.addMany,updateAssetStage:ce.updateOne,updateAssetStages:ce.updateMany,deleteAssetStage:ce.deleteOne,deleteAssetStages:ce.deleteMany}}),{initializeAssetStages:au,setAssetStage:cu,setAssetStages:du,addAssetStage:ru,addAssetStages:uu,updateAssetStage:lu,updateAssetStages:ou,deleteAssetStage:hu,deleteAssetStages:mu}=zs.actions,yu=zs.reducer,Bs=t=>t.assetStageReducer.instances,pu=t=>s=>s.assetStageReducer.instances[t],js=p.createSelector([Bs],t=>Object.values(t)),jP=T(p.createSelector([Bs,(t,s)=>s],(t,s)=>{const e={};for(const[n,a]of Object.entries(t))a.asset_procedure_type===s&&(e[n]=a);return At(e)})),qP=T(O([js,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_procedure_type===s)))),Au=T(O([js,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),de=w(t=>t.uuid),fu={instances:{}},qs=p.createSlice({name:"assetTypeAttachments",initialState:fu,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,fu)),reducers:{initializeAssetTypeAttachments:de.initialize,addAssetTypeAttachment:de.addOne,addAssetTypeAttachments:de.addMany,setAssetTypeAttachment:de.setOne,setAssetTypeAttachments:de.setMany,updateAssetTypeAttachment:de.updateOne,updateAssetTypeAttachments:de.updateMany,deleteAssetTypeAttachment:de.deleteOne,deleteAssetTypeAttachments:de.deleteMany}}),{initializeAssetTypeAttachments:Tu,addAssetTypeAttachment:Su,addAssetTypeAttachments:Ds,setAssetTypeAttachment:Iu,setAssetTypeAttachments:Ou,updateAssetTypeAttachment:Pu,updateAssetTypeAttachments:Fu,deleteAssetTypeAttachment:gu,deleteAssetTypeAttachments:Cs}=qs.actions,bu=t=>t.assetTypeAttachmentReducer.instances,$s=p.createSelector([bu],t=>Object.values(t)),_u=t=>s=>s.assetTypeAttachmentReducer.instances[t],Mu=T(O([$s,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),Ru=T(O([$s,(t,s)=>s],(t,s)=>S(t.filter(({asset_type:e})=>s===e)))),wu=qs.reducer,re=w(t=>t.uuid),Eu={instances:{}},Us=p.createSlice({name:"assetTypeFieldsAttachments",initialState:Eu,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,Eu)),reducers:{initializeAssetTypeFieldsAttachments:re.initialize,addAssetTypeFieldsAttachment:re.addOne,addAssetTypeFieldsAttachments:re.addMany,setAssetTypeFieldsAttachment:re.setOne,setAssetTypeFieldsAttachments:re.setMany,updateAssetTypeFieldsAttachment:re.updateOne,updateAssetTypeFieldsAttachments:re.updateMany,deleteAssetTypeFieldsAttachment:re.deleteOne,deleteAssetTypeFieldsAttachments:re.deleteMany}}),{initializeAssetTypeFieldsAttachments:vu,addAssetTypeFieldsAttachment:Vu,addAssetTypeFieldsAttachments:zu,setAssetTypeFieldsAttachment:Bu,setAssetTypeFieldsAttachments:ju,updateAssetTypeFieldsAttachment:qu,updateAssetTypeFieldsAttachments:Du,deleteAssetTypeFieldsAttachment:Cu,deleteAssetTypeFieldsAttachments:$u}=Us.actions,Uu=t=>t.assetTypeFieldsAttachmentReducer.instances,ks=p.createSelector([Uu],t=>Object.values(t)),DP=T(O([ks,(t,s)=>s],(t,s)=>S(t.filter(e=>e.fields_revision===s)))),ku=t=>s=>s.assetTypeFieldsAttachmentReducer.instances[t],Lu=T(O([ks,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),Nu=Us.reducer,ue=w(t=>t.uuid),Gu={instances:{}},Ls=p.createSlice({name:"assetTypeFields",initialState:Gu,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,Gu)),reducers:{initializeAssetTypeFields:ue.initialize,addAssetTypeFields:ue.addOne,addAssetTypeFieldsMany:ue.addMany,setAssetTypeFields:ue.setOne,setAssetTypeFieldsMany:ue.setMany,updateAssetTypeFields:ue.updateOne,updateAssetTypeFieldsMany:ue.updateMany,deleteAssetTypeFields:ue.deleteOne,deleteAssetTypeFieldsMany:ue.deleteMany}}),{initializeAssetTypeFields:Hu,addAssetTypeFields:Wu,addAssetTypeFieldsMany:Ku,setAssetTypeFields:Yu,setAssetTypeFieldsMany:Zu,updateAssetTypeFields:Ju,updateAssetTypeFieldsMany:Xu,deleteAssetTypeFields:Qu,deleteAssetTypeFieldsMany:xu}=Ls.actions,el=t=>t.assetTypeFieldsReducer.instances,ot=p.createSelector([el],t=>Object.values(t)),CP=T(O([ot,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_type===s)))),$P=T(p.createSelector([ot,(t,s)=>s],(t,s)=>t.filter(e=>e.asset_type===s).sort((e,n)=>e.submitted_at>n.submitted_at?-1:1)[0])),tl=t=>s=>s.assetTypeFieldsReducer.instances[t],sl=T(O([ot,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),il=Ls.reducer,le=w(t=>t.uuid),nl={instances:{}},Ns=p.createSlice({name:"assetTypeFieldValuesAttachments",initialState:nl,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,nl)),reducers:{initializeAssetTypeFieldValuesAttachments:le.initialize,addAssetTypeFieldValuesAttachment:le.addOne,addAssetTypeFieldValuesAttachments:le.addMany,setAssetTypeFieldValuesAttachment:le.setOne,setAssetTypeFieldValuesAttachments:le.setMany,updateAssetTypeFieldValuesAttachment:le.updateOne,updateAssetTypeFieldValuesAttachments:le.updateMany,deleteAssetTypeFieldValuesAttachment:le.deleteOne,deleteAssetTypeFieldValuesAttachments:le.deleteMany}}),{initializeAssetTypeFieldValuesAttachments:al,addAssetTypeFieldValuesAttachment:cl,addAssetTypeFieldValuesAttachments:Gs,setAssetTypeFieldValuesAttachment:dl,setAssetTypeFieldValuesAttachments:rl,updateAssetTypeFieldValuesAttachment:ul,updateAssetTypeFieldValuesAttachments:ll,deleteAssetTypeFieldValuesAttachment:ol,deleteAssetTypeFieldValuesAttachments:Hs}=Ns.actions,hl=t=>t.assetTypeFieldValuesAttachmentReducer.instances,Ws=p.createSelector([hl],t=>Object.values(t)),ml=t=>s=>s.assetTypeFieldValuesAttachmentReducer.instances[t],yl=T(O([Ws,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),pl=T(O([Ws,(t,s)=>s],(t,s)=>S(t.filter(e=>e.field_values===s)))),Al=Ns.reducer,oe=w(t=>t.uuid),fl={instances:{}},Ks=p.createSlice({name:"assetTypeFieldValues",initialState:fl,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,fl)),reducers:{initializeAssetTypeFieldValues:oe.initialize,addAssetTypeFieldValues:oe.addOne,addAssetTypeFieldValuesMany:oe.addMany,setAssetTypeFieldValues:oe.setOne,setAssetTypeFieldValuesMany:oe.setMany,updateAssetTypeFieldValues:oe.updateOne,updateAssetTypeFieldValuesMany:oe.updateMany,deleteAssetTypeFieldValues:oe.deleteOne,deleteAssetTypeFieldValuesMany:oe.deleteMany}}),{initializeAssetTypeFieldValues:Tl,addAssetTypeFieldValues:Sl,addAssetTypeFieldValuesMany:Il,setAssetTypeFieldValues:Ol,setAssetTypeFieldValuesMany:Pl,updateAssetTypeFieldValues:Fl,updateAssetTypeFieldValuesMany:gl,deleteAssetTypeFieldValues:bl,deleteAssetTypeFieldValuesMany:_l}=Ks.actions,Ml=t=>t.assetTypeFieldValuesReducer.instances,Ft=p.createSelector([Ml],t=>Object.values(t)),UP=T(O([Ft,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset===s)))),kP=T(O([ot,Ft,(t,s)=>s],(t,s,e)=>{const n=new Set(t.filter(a=>a.asset_type===e).map(a=>a.uuid));return S(s.filter(a=>n.has(a.fields_revision)))})),Rl=t=>s=>s.assetTypeFieldValuesReducer.instances[t],wl=T(O([Ft,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),El=Ks.reducer,he=w(t=>t.uuid),vl={instances:{}},Ys=p.createSlice({name:"assetTypeIdentifiers",initialState:vl,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,vl)),reducers:{initializeAssetTypeIdentifiers:he.initialize,addAssetTypeIdentifier:he.addOne,addAssetTypeIdentifiers:he.addMany,setAssetTypeIdentifier:he.setOne,setAssetTypeIdentifiers:he.setMany,updateAssetTypeIdentifier:he.updateOne,updateAssetTypeIdentifiers:he.updateMany,deleteAssetTypeIdentifier:he.deleteOne,deleteAssetTypeIdentifiers:he.deleteMany}}),{initializeAssetTypeIdentifiers:Vl,addAssetTypeIdentifier:zl,addAssetTypeIdentifiers:Bl,setAssetTypeIdentifier:jl,setAssetTypeIdentifiers:ql,updateAssetTypeIdentifier:Dl,updateAssetTypeIdentifiers:Cl,deleteAssetTypeIdentifier:$l,deleteAssetTypeIdentifiers:Ul}=Ys.actions,kl=t=>t.assetTypeIdentifierReducer.instances,Zs=p.createSelector([kl],t=>Object.values(t)),Ll=t=>s=>s.assetTypeIdentifierReducer.instances[t],Nl=T(O([Zs,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),LP=T(O([Zs,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_type===s)))),Gl=Ys.reducer,me=w(t=>t.uuid),Hl={instances:{}},Js=p.createSlice({name:"assetTypeIdentifierValues",initialState:Hl,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,Hl)),reducers:{initializeAssetTypeIdentifierValues:me.initialize,addAssetTypeIdentifierValue:me.addOne,addAssetTypeIdentifierValues:me.addMany,setAssetTypeIdentifierValue:me.setOne,setAssetTypeIdentifierValues:me.setMany,updateAssetTypeIdentifierValue:me.updateOne,updateAssetTypeIdentifierValues:me.updateMany,deleteAssetTypeIdentifierValue:me.deleteOne,deleteAssetTypeIdentifierValues:me.deleteMany}}),{initializeAssetTypeIdentifierValues:Wl,addAssetTypeIdentifierValue:Kl,addAssetTypeIdentifierValues:Yl,setAssetTypeIdentifierValue:Zl,setAssetTypeIdentifierValues:Jl,updateAssetTypeIdentifierValue:Xl,updateAssetTypeIdentifierValues:Ql,deleteAssetTypeIdentifierValue:xl,deleteAssetTypeIdentifierValues:eo}=Js.actions,to=t=>t.assetTypeIdentifierValueReducer.instances,gt=p.createSelector([to],t=>Object.values(t)),so=t=>s=>s.assetTypeIdentifierValueReducer.instances[t],io=T(O([gt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),NP=T(O([gt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset===s)))),GP=T(O([gt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_type_identifier===s)))),no=Js.reducer,ye=w(t=>t.uuid),ao={instances:{}},Xs=p.createSlice({name:"assetTypes",initialState:ao,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,ao)),reducers:{initializeAssetTypes:ye.initialize,setAssetType:ye.setOne,setAssetTypes:ye.setMany,addAssetType:ye.addOne,addAssetTypes:ye.addMany,updateAssetType:ye.updateOne,updateAssetTypes:ye.updateMany,deleteAssetType:ye.deleteOne,deleteAssetTypes:ye.deleteMany}}),{initializeAssetTypes:co,setAssetType:ro,setAssetTypes:uo,addAssetType:lo,addAssetTypes:oo,updateAssetType:ho,updateAssetTypes:mo,deleteAssetType:yo,deleteAssetTypes:po}=Xs.actions,Ao=t=>t.assetTypeReducer.instances,Qs=p.createSelector([Ao],t=>Object.values(t)),fo=t=>s=>s.assetTypeReducer.instances[t],To=T(O([Qs,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),HP=T(O([Qs,(t,s)=>s],(t,s)=>S(t.filter(e=>e.organization===s)))),So=Xs.reducer,pe=w(t=>t.uuid),Io={instances:{}},xs=p.createSlice({name:"assetTypeStatuses",initialState:Io,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,Io)),reducers:{initializeAssetTypeStatuses:pe.initialize,addAssetTypeStatus:pe.addOne,addAssetTypeStatuses:pe.addMany,setAssetTypeStatus:pe.setOne,setAssetTypeStatuses:pe.setMany,updateAssetTypeStatus:pe.updateOne,updateAssetTypeStatuses:pe.updateMany,deleteAssetTypeStatus:pe.deleteOne,deleteAssetTypeStatuses:pe.deleteMany}}),{initializeAssetTypeStatuses:Oo,addAssetTypeStatus:Po,addAssetTypeStatuses:Fo,setAssetTypeStatus:go,setAssetTypeStatuses:bo,updateAssetTypeStatus:_o,updateAssetTypeStatuses:Mo,deleteAssetTypeStatus:Ro,deleteAssetTypeStatuses:wo}=xs.actions,Eo=t=>t.assetTypeStatusReducer.instances,ei=p.createSelector([Eo],t=>S(Object.values(t).toSorted(ca))),vo=t=>s=>s.assetTypeStatusReducer.instances[t],Vo=T(O([ei,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),WP=T(O([ei,(t,s)=>s],(t,s)=>S(t.filter(e=>e.asset_type===s)))),zo=xs.reducer,Bo={accessToken:"",refreshToken:"",isLoggedIn:!1},bt=p.createSlice({name:"auth",initialState:Bo,extraReducers:t=>t.addCase(M,s=>Object.assign(s,Bo)),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||bt.caseReducers.clearTokens(t),t.isLoggedIn=s.payload}}}),{setTokens:KP,clearTokens:YP,setLoggedIn:jo}=bt.actions,ZP=t=>t.authReducer.accessToken,JP=t=>t.authReducer.isLoggedIn,qo=bt.reducer,Ae=w(t=>t.uuid),Do={instances:{}},ti=p.createSlice({name:"categories",initialState:Do,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,Do)),reducers:{initializeCategories:Ae.initialize,addCategory:Ae.addOne,addCategories:Ae.addMany,setCategory:Ae.setOne,setCategories:Ae.setMany,updateCategory:Ae.updateOne,updateCategories:Ae.updateMany,deleteCategory:Ae.deleteOne,deleteCategories:Ae.deleteMany}}),{initializeCategories:Co,addCategory:$o,addCategories:Uo,setCategory:ko,setCategories:Lo,updateCategory:No,updateCategories:Go,deleteCategory:Ho,deleteCategories:Wo}=ti.actions,Ko=t=>t.categoryReducer.instances,si=p.createSelector([Ko],t=>Object.values(t)),ii=t=>s=>s.categoryReducer.instances[t],Yo=T(O([si,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),XP=T(O([si,(t,s)=>s],(t,s)=>S(t.filter(e=>e.project===s)))),Zo=ti.reducer,fe=w(t=>t.uuid),Jo={instances:{}},ni=p.createSlice({name:"documentAttachments",initialState:Jo,extraReducers:t=>t.addCase(M,s=>Object.assign(s,Jo)),reducers:{initializeDocumentAttachments:fe.initialize,addDocumentAttachment:fe.addOne,addDocumentAttachments:fe.addMany,setDocumentAttachment:fe.setOne,setDocumentAttachments:fe.setMany,updateDocumentAttachment:fe.updateOne,updateDocumentAttachments:fe.updateMany,deleteDocumentAttachment:fe.deleteOne,deleteDocumentAttachments:fe.deleteMany}}),{initializeDocumentAttachments:Xo,addDocumentAttachment:Qo,addDocumentAttachments:xo,setDocumentAttachment:eh,setDocumentAttachments:th,updateDocumentAttachment:sh,updateDocumentAttachments:ih,deleteDocumentAttachment:nh,deleteDocumentAttachments:ah}=ni.actions,ch=t=>t.documentAttachmentReducer.instances,ai=p.createSelector([ch],t=>Object.values(t)),dh=t=>s=>s.documentAttachmentReducer.instances[t],rh=T(O([ai,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),QP=T(O([ai,(t,s)=>s],(t,s)=>S(t.filter(({document:e})=>s===e)))),uh=ni.reducer,Te=w(({uuid:t})=>t),lh={instances:{}},ci=p.createSlice({name:"documents",initialState:lh,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>{Object.assign(s,lh)}),reducers:{initializeDocuments:Te.initialize,addDocument:Te.addOne,addDocuments:Te.addMany,setDocument:Te.setOne,setDocuments:Te.setMany,updateDocument:Te.updateOne,updateDocuments:Te.updateMany,deleteDocument:Te.deleteOne,deleteDocuments:Te.deleteMany}}),{initializeDocuments:oh,addDocument:hh,addDocuments:mh,setDocument:yh,setDocuments:ph,updateDocument:Ah,updateDocuments:fh,deleteDocument:Th,deleteDocuments:Sh}=ci.actions,Ih=ci.reducer,di=t=>t.documentsReducer.instances,_t=p.createSelector([di],t=>Object.values(t)),Oh=t=>s=>s.documentsReducer.instances[t],Ph=T(O([_t,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),xP=T(O([_t,(t,s)=>s],(t,s)=>t.filter(e=>e.project===s))),eF=T(O([_t,(t,s)=>s],(t,s)=>t.filter(e=>e.organization===s))),Fh=T(O([di,(t,s)=>s],(t,s)=>{if(!t[s])return S([]);const a=ua(s,Object.values(t)).all().map(({model:c})=>c);return S(a)})),Se=w(t=>t.uuid),gh={instances:{}},ri=p.createSlice({name:"emailDomains",initialState:gh,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,gh)),reducers:{initializeEmailDomains:Se.initialize,addEmailDomain:Se.addOne,addEmailDomains:Se.addMany,setEmailDomain:Se.setOne,setEmailDomains:Se.setMany,updateEmailDomain:Se.updateOne,updateEmailDomains:Se.updateMany,deleteEmailDomain:Se.deleteOne,deleteEmailDomains:Se.deleteMany}}),{initializeEmailDomains:bh,addEmailDomain:_h,addEmailDomains:Mh,setEmailDomain:Rh,setEmailDomains:wh,updateEmailDomain:Eh,updateEmailDomains:vh,deleteEmailDomain:Vh,deleteEmailDomains:zh}=ri.actions,Bh=t=>t.emailDomainsReducer.instances,ui=p.createSelector([Bh],t=>Object.values(t)),jh=t=>s=>s.emailDomainsReducer.instances[t],qh=T(O([ui,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),tF=T(O([ui,(t,s)=>s],(t,s)=>S(t.filter(e=>e.organization===s)))),Dh=ri.reducer,Ch={s3Urls:{}},$h=1e3*60*60,sF=$h*24*7,li=p.createSlice({name:"file",initialState:Ch,extraReducers:t=>t.addCase(M,s=>Object.assign(s,Ch)),reducers:{setUploadUrl:(t,s)=>{const{url:e,fields:n,sha1:a}=s.payload,c=new Date,r=new Date(c.getTime()+sF);t.s3Urls[a]={url:e,fields:n,exp:r.getTime()}}}}),{setUploadUrl:Uh}=li.actions,kh=t=>s=>{const e=s.fileReducer.s3Urls[t];if(!e)return;const n=new Date().getTime();if(!((e.exp??n)-n<$h))return e},Lh=li.reducer,Ie=w(t=>t.uuid),Nh={instances:{}},oi=p.createSlice({name:"formIdentifiers",initialState:Nh,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,Nh)),reducers:{initializeFormIdentifiers:Ie.initialize,addFormIdentifier:Ie.addOne,addFormIdentifiers:Ie.addMany,setFormIdentifier:Ie.setOne,setFormIdentifiers:Ie.setMany,updateFormIdentifier:Ie.updateOne,updateFormIdentifiers:Ie.updateMany,deleteFormIdentifier:Ie.deleteOne,deleteFormIdentifiers:Ie.deleteMany}}),{initializeFormIdentifiers:Gh,addFormIdentifier:Hh,addFormIdentifiers:Wh,setFormIdentifier:Kh,setFormIdentifiers:Yh,updateFormIdentifier:Zh,updateFormIdentifiers:Jh,deleteFormIdentifier:Xh,deleteFormIdentifiers:Qh}=oi.actions,xh=t=>t.formIdentifierReducer.instances,hi=p.createSelector([xh],t=>Object.values(t)),em=t=>s=>s.formIdentifierReducer.instances[t],tm=T(O([hi,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),iF=T(O([hi,(t,s)=>s],(t,s)=>S(t.filter(e=>e.form===s)))),sm=oi.reducer,Oe=w(t=>t.uuid),im={instances:{}},mi=p.createSlice({name:"formIdentifierValues",initialState:im,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,im)),reducers:{initializeFormIdentifierValues:Oe.initialize,addFormIdentifierValue:Oe.addOne,addFormIdentifierValues:Oe.addMany,setFormIdentifierValue:Oe.setOne,setFormIdentifierValues:Oe.setMany,updateFormIdentifierValue:Oe.updateOne,updateFormIdentifierValues:Oe.updateMany,deleteFormIdentifierValue:Oe.deleteOne,deleteFormIdentifierValues:Oe.deleteMany}}),{initializeFormIdentifierValues:nm,addFormIdentifierValue:am,addFormIdentifierValues:cm,setFormIdentifierValue:dm,setFormIdentifierValues:rm,updateFormIdentifierValue:um,updateFormIdentifierValues:lm,deleteFormIdentifierValue:om,deleteFormIdentifierValues:hm}=mi.actions,mm=t=>t.formIdentifierValueReducer.instances,Mt=p.createSelector([mm],t=>Object.values(t)),ym=t=>s=>s.formIdentifierValueReducer.instances[t],pm=T(O([Mt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),nF=T(O([Mt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.form_submission===s)))),aF=T(O([Mt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.form_identifier===s)))),Am=mi.reducer,Pe=w(t=>t.uuid),fm={instances:{}},yi=p.createSlice({name:"formRevisionAttachments",initialState:fm,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,fm)),reducers:{initializeFormRevisionAttachments:Pe.initialize,addFormRevisionAttachment:Pe.addOne,addFormRevisionAttachments:Pe.addMany,setFormRevisionAttachment:Pe.setOne,setFormRevisionAttachments:Pe.setMany,updateFormRevisionAttachment:Pe.updateOne,updateFormRevisionAttachments:Pe.updateMany,deleteFormRevisionAttachment:Pe.deleteOne,deleteFormRevisionAttachments:Pe.deleteMany}}),{initializeFormRevisionAttachments:Tm,addFormRevisionAttachment:Sm,addFormRevisionAttachments:Im,setFormRevisionAttachment:Om,setFormRevisionAttachments:Pm,updateFormRevisionAttachment:Fm,updateFormRevisionAttachments:gm,deleteFormRevisionAttachment:bm,deleteFormRevisionAttachments:_m}=yi.actions,Rt=t=>t.formRevisionAttachmentReducer.instances,Mm=p.createSelector([Rt],t=>Object.values(t)),Rm=T(p.createSelector([Rt,(t,s)=>s],(t,s)=>t[s])),wm=T(O([Mm,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),cF=T(O([Rt,(t,s)=>s],(t,s)=>S(Object.values(t).filter(e=>e.form_revision===s)))),Em=yi.reducer,Fe=w(t=>t.uuid),vm={instances:{}},pi=p.createSlice({name:"formRevisions",initialState:vm,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,vm)),reducers:{initializeFormRevisions:Fe.initialize,addFormRevision:Fe.addOne,addFormRevisions:Fe.addMany,setFormRevision:Fe.setOne,setFormRevisions:Fe.setMany,updateFormRevision:Fe.updateOne,updateFormRevisions:Fe.updateMany,deleteFormRevision:Fe.deleteOne,deleteFormRevisions:Fe.deleteMany}}),{initializeFormRevisions:Vm,addFormRevision:Ai,addFormRevisions:fi,setFormRevision:zm,setFormRevisions:Bm,updateFormRevision:jm,updateFormRevisions:qm,deleteFormRevision:Ti,deleteFormRevisions:Si}=pi.actions,Ii=t=>t.formRevisionReducer.instances,wt=p.createSelector([Ii],t=>Object.values(t)),Dm=t=>s=>s.formRevisionReducer.instances[t],Cm=T(O([wt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),dF=T(p.createSelector([wt,(t,s)=>s],(t,s)=>t.filter(e=>e.form===s).sort((e,n)=>e.submitted_at>n.submitted_at?-1:1)[0])),$m=T(O([wt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.form===s)))),Um=pi.reducer,ge=w(t=>t.uuid),km={instances:{}},Oi=p.createSlice({name:"forms",initialState:km,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,km)),reducers:{initializeForms:ge.initialize,addForm:ge.addOne,addForms:ge.addMany,setForm:ge.setOne,setForms:ge.setMany,updateForm:ge.updateOne,updateForms:ge.updateMany,deleteForm:ge.deleteOne,deleteForms:ge.deleteMany}}),{initializeForms:Lm,addForm:Nm,addForms:Gm,setForm:Hm,setForms:Wm,updateForm:Km,updateForms:Ym,deleteForm:Zm,deleteForms:Jm}=Oi.actions,Xm=Oi.reducer,Qm=t=>t.formReducer.instances,Pi=p.createSelector([Qm],t=>Object.values(t)),xm=t=>s=>s.formReducer.instances[t],ey=T(O([Pi,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),rF=T(O([Pi,(t,s)=>s],(t,s)=>S(t.filter(e=>e.organization===s)))),be=w(t=>t.uuid),ty={instances:{}},Fi=p.createSlice({name:"formSubmissionAttachments",initialState:ty,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,ty)),reducers:{initializeFormSubmissionAttachments:be.initialize,addFormSubmissionAttachment:be.addOne,addFormSubmissionAttachments:be.addMany,setFormSubmissionAttachment:be.setOne,setFormSubmissionAttachments:be.setMany,updateFormSubmissionAttachment:be.updateOne,updateFormSubmissionAttachments:be.updateMany,deleteFormSubmissionAttachment:be.deleteOne,deleteFormSubmissionAttachments:be.deleteMany}}),{initializeFormSubmissionAttachments:sy,addFormSubmissionAttachment:iy,addFormSubmissionAttachments:gi,setFormSubmissionAttachment:ny,setFormSubmissionAttachments:ay,updateFormSubmissionAttachment:cy,updateFormSubmissionAttachments:dy,deleteFormSubmissionAttachment:ry,deleteFormSubmissionAttachments:bi}=Fi.actions,_i=t=>t.formSubmissionAttachmentReducer.instances,Mi=p.createSelector([_i],t=>Object.values(t)),uy=T(p.createSelector([_i,(t,s)=>s],(t,s)=>t[s])),Ri=T(O([Mi,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(n=>e.has(n.uuid)))})),ly=Ri,oy=T(O([Mi,(t,s)=>s],(t,s)=>S(t.filter(e=>e.form_submission===s)))),hy=Fi.reducer,_e=w(t=>t.uuid),my={instances:{}},wi=p.createSlice({name:"formSubmissions",initialState:my,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,my)),reducers:{initializeFormSubmissions:_e.initialize,setFormSubmission:_e.setOne,setFormSubmissions:_e.setMany,addFormSubmission:_e.addOne,addFormSubmissions:_e.addMany,updateFormSubmission:_e.updateOne,updateFormSubmissions:_e.updateMany,deleteFormSubmission:_e.deleteOne,deleteFormSubmissions:_e.deleteMany}}),{initializeFormSubmissions:yy,setFormSubmission:py,setFormSubmissions:Ay,addFormSubmission:fy,addFormSubmissions:Ei,updateFormSubmission:Ty,updateFormSubmissions:Sy,deleteFormSubmission:Iy,deleteFormSubmissions:vi}=wi.actions,Vi=t=>t.formSubmissionReducer.instances,Oy=p.createSelector([Vi],t=>Object.values(t)),Py=t=>s=>s.formSubmissionReducer.instances[t],Fy=T(O([Oy,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),gy=T(O([Vi,Ii,(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))})),by=wi.reducer,Me=w(t=>t.uuid),_y={instances:{}},zi=p.createSlice({name:"geoImages",initialState:_y,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,_y)),reducers:{initializeGeoImages:Me.initialize,setGeoImage:Me.setOne,setGeoImages:Me.setMany,addGeoImage:Me.addOne,addGeoImages:Me.addMany,updateGeoImage:Me.updateOne,updateGeoImages:Me.updateMany,deleteGeoImage:Me.deleteOne,deleteGeoImages:Me.deleteMany}}),{initializeGeoImages:My,setGeoImage:Ry,setGeoImages:wy,addGeoImage:Ey,addGeoImages:vy,updateGeoImage:Vy,updateGeoImages:zy,deleteGeoImage:By,deleteGeoImages:jy}=zi.actions,qy=t=>t.geoImageReducer.instances,Bi=p.createSelector([qy],t=>Object.values(t)),Dy=t=>s=>s.geoImageReducer.instances[t],Cy=T(O([Bi,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),uF=T(O([Bi,(t,s)=>s],(t,s)=>S(t.filter(e=>e.project===s)))),$y=zi.reducer,Re=w(t=>t.uuid),Uy={instances:{}},ji=p.createSlice({name:"issueAssociations",initialState:Uy,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,Uy)),reducers:{initializeIssueAssociations:Re.initialize,addIssueAssociation:Re.addOne,addIssueAssociations:Re.addMany,setIssueAssociation:Re.setOne,setIssueAssociations:Re.setMany,updateIssueAssociation:Re.updateOne,updateIssueAssociations:Re.updateMany,deleteIssueAssociation:Re.deleteOne,deleteIssueAssociations:Re.deleteMany}}),{initializeIssueAssociations:ky,setIssueAssociations:Ly,setIssueAssociation:Ny,updateIssueAssociation:Gy,updateIssueAssociations:Hy,addIssueAssociation:Wy,addIssueAssociations:Et,deleteIssueAssociation:Ky,deleteIssueAssociations:vt}=ji.actions,ht=t=>t.issueAssociationReducer.instances,Yy=p.createSelector([ht],t=>Object.values(t)),Zy=t=>s=>s.issueAssociationReducer.instances[t],Jy=T(O([Yy,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),Xy=T(O([ht,(t,s)=>s],(t,s)=>S(Object.values(t).filter(e=>e.associated_issue===s)))),Qy=T(O([ht,(t,s)=>s],(t,s)=>S(Object.values(t).filter(e=>e.issue===s)))),xy=T(O([ht,(t,s)=>s],(t,s)=>S(Object.values(t).filter(e=>e.asset===s)))),ep=ji.reducer,we=w(t=>t.uuid),tp={instances:{}},qi=p.createSlice({name:"issueAttachments",initialState:tp,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,tp)),reducers:{initializeIssueAttachments:we.initialize,addIssueAttachment:we.addOne,addIssueAttachments:we.addMany,setIssueAttachment:we.setOne,setIssueAttachments:we.setMany,updateIssueAttachment:we.updateOne,updateIssueAttachments:we.updateMany,deleteIssueAttachment:we.deleteOne,deleteIssueAttachments:we.deleteMany}}),{initializeIssueAttachments:sp,addIssueAttachment:ip,addIssueAttachments:Di,setIssueAttachment:np,setIssueAttachments:ap,updateIssueAttachment:cp,updateIssueAttachments:dp,deleteIssueAttachment:rp,deleteIssueAttachments:Ci}=qi.actions,up=t=>t.issueAttachmentReducer.instances,$i=p.createSelector([up],t=>Object.values(t)),lp=T(O([$i,(t,s)=>s],(t,s)=>S(t.filter(({issue:e})=>s===e)))),op=t=>s=>s.issueAttachmentReducer.instances[t],hp=T(O([$i,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),mp=qi.reducer,Ee=w(t=>t.uuid),yp={instances:{}},Ui=p.createSlice({name:"issueCommentAttachments",initialState:yp,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,yp)),reducers:{initializeIssueCommentAttachments:Ee.initialize,addIssueCommentAttachment:Ee.addOne,addIssueCommentAttachments:Ee.addMany,setIssueCommentAttachment:Ee.setOne,setIssueCommentAttachments:Ee.setMany,updateIssueCommentAttachment:Ee.updateOne,updateIssueCommentAttachments:Ee.updateMany,deleteIssueCommentAttachment:Ee.deleteOne,deleteIssueCommentAttachments:Ee.deleteMany}}),{initializeIssueCommentAttachments:pp,addIssueCommentAttachment:Ap,addIssueCommentAttachments:fp,setIssueCommentAttachment:Tp,setIssueCommentAttachments:Sp,updateIssueCommentAttachment:Ip,updateIssueCommentAttachments:Op,deleteIssueCommentAttachment:Pp,deleteIssueCommentAttachments:Fp}=Ui.actions,gp=t=>t.issueCommentAttachmentReducer.instances,ki=p.createSelector([gp],t=>Object.values(t)),bp=t=>s=>s.issueCommentAttachmentReducer.instances[t],_p=T(O([ki,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),lF=T(O([ki,(t,s)=>s],(t,s)=>S(t.filter(({issue_comment:e})=>s===e)))),Mp=Ui.reducer,ve=w(t=>t.uuid),Rp={instances:{}},Li=p.createSlice({name:"issueComments",initialState:Rp,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,Rp)),reducers:{initializeIssueComments:ve.initialize,addIssueComment:ve.addOne,addIssueComments:ve.addMany,setIssueComment:ve.setOne,setIssueComments:ve.setMany,updateIssueComment:ve.updateOne,updateIssueComments:ve.updateMany,deleteIssueComment:ve.deleteOne,deleteIssueComments:ve.deleteMany}}),{initializeIssueComments:wp,addIssueComment:Ep,addIssueComments:vp,setIssueComment:Vp,setIssueComments:zp,updateIssueComment:Bp,updateIssueComments:jp,deleteIssueComment:qp,deleteIssueComments:Dp}=Li.actions,Ni=t=>t.issueCommentReducer.instances,Cp=t=>s=>s.issueCommentReducer.instances[t],$p=T(O([Ni,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(Object.values(t).filter(({uuid:n})=>e.has(n)))})),oF=T(O([Ni,(t,s)=>s],(t,s)=>S(Object.values(t).filter(e=>e.issue===s)))),Up=Li.reducer,Ve=w(t=>t.uuid),kp={instances:{}},Gi=p.createSlice({name:"issues",initialState:kp,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,kp)),reducers:{initializeIssues:Ve.initialize,addIssue:Ve.addOne,addIssues:Ve.addMany,setIssue:Ve.setOne,setIssues:Ve.setMany,updateIssue:Ve.updateOne,updateIssues:Ve.updateMany,deleteIssue:Ve.deleteOne,deleteIssues:Ve.deleteMany}}),{initializeIssues:Lp,addIssue:Np,addIssues:Hi,setIssue:Gp,setIssues:Hp,updateIssue:Wp,updateIssues:Kp,deleteIssue:Yp,deleteIssues:Wi}=Gi.actions,Zp=t=>t.issueReducer.instances,Vt=p.createSelector([Zp],t=>Object.values(t)),Jp=t=>s=>s.issueReducer.instances[t],Xp=T(O([Vt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),hF=T(O([Vt,(t,s)=>s],(t,s)=>t.filter(e=>e.project===s))),Qp=T(O([Vt,(t,s)=>s],(t,s)=>t.filter(e=>e.issue_type===s))),xp=Gi.reducer,ze=w(t=>t.uuid),eA={instances:{}},Ki=p.createSlice({name:"issueTypeAttachments",initialState:eA,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,eA)),reducers:{initializeIssueTypeAttachments:ze.initialize,addIssueTypeAttachment:ze.addOne,addIssueTypeAttachments:ze.addMany,setIssueTypeAttachment:ze.setOne,setIssueTypeAttachments:ze.setMany,updateIssueTypeAttachment:ze.updateOne,updateIssueTypeAttachments:ze.updateMany,deleteIssueTypeAttachment:ze.deleteOne,deleteIssueTypeAttachments:ze.deleteMany}}),{initializeIssueTypeAttachments:tA,addIssueTypeAttachment:sA,addIssueTypeAttachments:iA,setIssueTypeAttachment:nA,setIssueTypeAttachments:aA,updateIssueTypeAttachment:cA,updateIssueTypeAttachments:dA,deleteIssueTypeAttachment:rA,deleteIssueTypeAttachments:uA}=Ki.actions,lA=t=>t.issueTypeAttachmentReducer.instances,Yi=p.createSelector([lA],t=>Object.values(t)),oA=t=>s=>s.issueTypeAttachmentReducer.instances[t],hA=T(O([Yi,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),mF=T(O([Yi,(t,s)=>s],(t,s)=>S(t.filter(({issue_type:e})=>s===e)))),mA=Ki.reducer,Be=w(t=>t.uuid),yA={instances:{}},Zi=p.createSlice({name:"issueTypeFieldsAttachments",initialState:yA,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,yA)),reducers:{initializeIssueTypeFieldsAttachments:Be.initialize,addIssueTypeFieldsAttachment:Be.addOne,addIssueTypeFieldsAttachments:Be.addMany,setIssueTypeFieldsAttachment:Be.setOne,setIssueTypeFieldsAttachments:Be.setMany,updateIssueTypeFieldsAttachment:Be.updateOne,updateIssueTypeFieldsAttachments:Be.updateMany,deleteIssueTypeFieldsAttachment:Be.deleteOne,deleteIssueTypeFieldsAttachments:Be.deleteMany}}),{initializeIssueTypeFieldsAttachments:pA,addIssueTypeFieldsAttachment:AA,addIssueTypeFieldsAttachments:fA,setIssueTypeFieldsAttachment:TA,setIssueTypeFieldsAttachments:SA,updateIssueTypeFieldsAttachment:IA,updateIssueTypeFieldsAttachments:OA,deleteIssueTypeFieldsAttachment:PA,deleteIssueTypeFieldsAttachments:FA}=Zi.actions,gA=t=>t.issueTypeFieldsAttachmentReducer.instances,Ji=p.createSelector([gA],t=>Object.values(t)),yF=T(O([Ji,(t,s)=>s],(t,s)=>S(t.filter(e=>e.fields_revision===s)))),bA=t=>s=>s.issueTypeFieldsAttachmentReducer.instances[t],_A=T(O([Ji,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),MA=Zi.reducer,je=w(t=>t.uuid),RA={instances:{}},Xi=p.createSlice({name:"issueTypeFieldValues",initialState:RA,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,RA)),reducers:{initializeIssueTypeFieldValues:je.initialize,addIssueTypeFieldValues:je.addOne,addIssueTypeFieldValuesMany:je.addMany,setIssueTypeFieldValues:je.setOne,setIssueTypeFieldValuesMany:je.setMany,updateIssueTypeFieldValues:je.updateOne,updateIssueTypeFieldValuesMany:je.updateMany,deleteIssueTypeFieldValues:je.deleteOne,deleteIssueTypeFieldValuesMany:je.deleteMany}}),{initializeIssueTypeFieldValues:wA,addIssueTypeFieldValues:EA,addIssueTypeFieldValuesMany:vA,setIssueTypeFieldValues:VA,setIssueTypeFieldValuesMany:zA,updateIssueTypeFieldValues:BA,updateIssueTypeFieldValuesMany:jA,deleteIssueTypeFieldValues:qA,deleteIssueTypeFieldValuesMany:DA}=Xi.actions,CA=t=>t.issueTypeFieldValuesReducer.instances,zt=p.createSelector([CA],t=>Object.values(t)),pF=T(O([zt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.issue===s)))),$A=t=>s=>s.issueTypeFieldValuesReducer.instances[t],UA=T(O([zt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),kA=Xi.reducer,qe=w(t=>t.uuid),LA={instances:{}},Qi=p.createSlice({name:"issueTypeFields",initialState:LA,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,LA)),reducers:{initializeIssueTypeFields:qe.initialize,addIssueTypeFields:qe.addOne,addIssueTypeFieldsMany:qe.addMany,setIssueTypeFields:qe.setOne,setIssueTypeFieldsMany:qe.setMany,updateIssueTypeFields:qe.updateOne,updateIssueTypeFieldsMany:qe.updateMany,deleteIssueTypeFields:qe.deleteOne,deleteIssueTypeFieldsMany:qe.deleteMany}}),{initializeIssueTypeFields:NA,addIssueTypeFields:GA,addIssueTypeFieldsMany:HA,setIssueTypeFields:WA,setIssueTypeFieldsMany:KA,updateIssueTypeFields:YA,updateIssueTypeFieldsMany:ZA,deleteIssueTypeFields:JA,deleteIssueTypeFieldsMany:XA}=Qi.actions,QA=t=>t.issueTypeFieldsReducer.instances,mt=p.createSelector([QA],t=>Object.values(t)),AF=T(O([mt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.issue_type===s)))),fF=T(p.createSelector([mt,(t,s)=>s],(t,s)=>t.filter(e=>e.issue_type===s).sort((e,n)=>e.submitted_at>n.submitted_at?-1:1)[0])),TF=T(O([mt,zt,(t,s)=>s],(t,s,e)=>{const n=new Set(t.filter(a=>a.issue_type===e).map(a=>a.uuid));return S(s.filter(a=>n.has(a.fields_revision)))})),xA=t=>s=>s.issueTypeFieldsReducer.instances[t],ef=T(O([mt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),tf=Qi.reducer,De=w(t=>t.uuid),sf={instances:{}},xi=p.createSlice({name:"issueTypeFieldValuesAttachments",initialState:sf,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,sf)),reducers:{initializeIssueTypeFieldValuesAttachments:De.initialize,addIssueTypeFieldValuesAttachment:De.addOne,addIssueTypeFieldValuesAttachments:De.addMany,setIssueTypeFieldValuesAttachment:De.setOne,setIssueTypeFieldValuesAttachments:De.setMany,updateIssueTypeFieldValuesAttachment:De.updateOne,updateIssueTypeFieldValuesAttachments:De.updateMany,deleteIssueTypeFieldValuesAttachment:De.deleteOne,deleteIssueTypeFieldValuesAttachments:De.deleteMany}}),{initializeIssueTypeFieldValuesAttachments:nf,addIssueTypeFieldValuesAttachment:af,addIssueTypeFieldValuesAttachments:en,setIssueTypeFieldValuesAttachment:cf,setIssueTypeFieldValuesAttachments:df,updateIssueTypeFieldValuesAttachment:rf,updateIssueTypeFieldValuesAttachments:uf,deleteIssueTypeFieldValuesAttachment:lf,deleteIssueTypeFieldValuesAttachments:tn}=xi.actions,of=t=>t.issueTypeFieldValuesAttachmentReducer.instances,sn=p.createSelector([of],t=>Object.values(t)),hf=t=>s=>s.issueTypeFieldValuesAttachmentReducer.instances[t],mf=T(O([sn,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),yf=T(O([sn,(t,s)=>s],(t,s)=>S(t.filter(e=>e.field_values===s)))),pf=xi.reducer,Ce=w(t=>t.uuid),Af={instances:{}},nn=p.createSlice({name:"issueTypeIdentifiers",initialState:Af,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,Af)),reducers:{initializeIssueTypeIdentifiers:Ce.initialize,addIssueTypeIdentifier:Ce.addOne,addIssueTypeIdentifiers:Ce.addMany,setIssueTypeIdentifier:Ce.setOne,setIssueTypeIdentifiers:Ce.setMany,updateIssueTypeIdentifier:Ce.updateOne,updateIssueTypeIdentifiers:Ce.updateMany,deleteIssueTypeIdentifier:Ce.deleteOne,deleteIssueTypeIdentifiers:Ce.deleteMany}}),{initializeIssueTypeIdentifiers:ff,addIssueTypeIdentifier:Tf,addIssueTypeIdentifiers:Sf,setIssueTypeIdentifier:If,setIssueTypeIdentifiers:Of,updateIssueTypeIdentifier:Pf,updateIssueTypeIdentifiers:Ff,deleteIssueTypeIdentifier:gf,deleteIssueTypeIdentifiers:bf}=nn.actions,_f=t=>t.issueTypeIdentifierReducer.instances,an=p.createSelector([_f],t=>Object.values(t)),Mf=t=>s=>s.issueTypeIdentifierReducer.instances[t],Rf=T(O([an,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),SF=T(O([an,(t,s)=>s],(t,s)=>S(t.filter(e=>e.issue_type===s)))),wf=nn.reducer,$e=w(t=>t.uuid),Ef={instances:{}},cn=p.createSlice({name:"issueTypeIdentifierValues",initialState:Ef,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,Ef)),reducers:{initializeIssueTypeIdentifierValues:$e.initialize,addIssueTypeIdentifierValue:$e.addOne,addIssueTypeIdentifierValues:$e.addMany,setIssueTypeIdentifierValue:$e.setOne,setIssueTypeIdentifierValues:$e.setMany,updateIssueTypeIdentifierValue:$e.updateOne,updateIssueTypeIdentifierValues:$e.updateMany,deleteIssueTypeIdentifierValue:$e.deleteOne,deleteIssueTypeIdentifierValues:$e.deleteMany}}),{initializeIssueTypeIdentifierValues:vf,addIssueTypeIdentifierValue:Vf,addIssueTypeIdentifierValues:zf,setIssueTypeIdentifierValue:Bf,setIssueTypeIdentifierValues:jf,updateIssueTypeIdentifierValue:qf,updateIssueTypeIdentifierValues:Df,deleteIssueTypeIdentifierValue:Cf,deleteIssueTypeIdentifierValues:$f}=cn.actions,Uf=t=>t.issueTypeIdentifierValueReducer.instances,Bt=p.createSelector([Uf],t=>Object.values(t)),kf=t=>s=>s.issueTypeIdentifierValueReducer.instances[t],Lf=T(O([Bt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),IF=T(O([Bt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.issue===s)))),OF=T(O([Bt,(t,s)=>s],(t,s)=>S(t.filter(e=>e.issue_type_identifier===s)))),Nf=cn.reducer,Ue=w(t=>t.uuid),Gf={instances:{}},dn=p.createSlice({name:"issueTypes",initialState:Gf,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,Gf)),reducers:{initializeIssueTypes:Ue.initialize,addIssueType:Ue.addOne,addIssueTypes:Ue.addMany,setIssueType:Ue.setOne,setIssueTypes:Ue.setMany,updateIssueType:Ue.updateOne,updateIssueTypes:Ue.updateMany,deleteIssueType:Ue.deleteOne,deleteIssueTypes:Ue.deleteMany}}),{initializeIssueTypes:Hf,addIssueType:Wf,addIssueTypes:Kf,setIssueType:Yf,setIssueTypes:Zf,updateIssueType:Jf,updateIssueTypes:Xf,deleteIssueType:Qf,deleteIssueTypes:xf}=dn.actions,eT=t=>t.issueTypeReducer.instances,rn=p.createSelector(eT,t=>Object.values(t)),tT=t=>s=>s.issueTypeReducer.instances[t],sT=T(O([rn,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),PF=T(O([rn,(t,s)=>s],(t,s)=>S(t.filter(e=>e.organization===s)))),iT=dn.reducer,ke=w(t=>t.uuid),nT={instances:{}},un=p.createSlice({name:"issueTypeStatuses",initialState:nT,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,nT)),reducers:{initializeIssueTypeStatuses:ke.initialize,addIssueTypeStatus:ke.addOne,addIssueTypeStatuses:ke.addMany,setIssueTypeStatus:ke.setOne,setIssueTypeStatuses:ke.setMany,updateIssueTypeStatus:ke.updateOne,updateIssueTypeStatuses:ke.updateMany,deleteIssueTypeStatus:ke.deleteOne,deleteIssueTypeStatuses:ke.deleteMany}}),{initializeIssueTypeStatuses:aT,addIssueTypeStatus:cT,addIssueTypeStatuses:dT,setIssueTypeStatus:rT,setIssueTypeStatuses:uT,updateIssueTypeStatus:lT,updateIssueTypeStatuses:oT,deleteIssueTypeStatus:hT,deleteIssueTypeStatuses:mT}=un.actions,yT=t=>t.issueTypeStatusReducer.instances,ln=p.createSelector([yT],t=>S(Object.values(t).toSorted(da))),on=t=>s=>s.issueTypeStatusReducer.instances[t],pT=T(O([ln,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),FF=T(O([ln,(t,s)=>s],(t,s)=>S(t.filter(e=>e.issue_type===s)))),AT=un.reducer,Le=w(t=>t.uuid),fT={instances:{}},hn=p.createSlice({name:"issueUpdates",initialState:fT,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,fT)),reducers:{initializeIssueUpdates:Le.initialize,addIssueUpdate:Le.addOne,addIssueUpdates:Le.addMany,setIssueUpdate:Le.setOne,setIssueUpdates:Le.setMany,updateIssueUpdate:Le.updateOne,updateIssueUpdates:Le.updateMany,deleteIssueUpdate:Le.deleteOne,deleteIssueUpdates:Le.deleteMany}}),{initializeIssueUpdates:TT,addIssueUpdate:mn,addIssueUpdates:yn,setIssueUpdate:ST,setIssueUpdates:IT,updateIssueUpdate:OT,updateIssueUpdates:PT,deleteIssueUpdate:pn,deleteIssueUpdates:An}=hn.actions,fn=t=>t.issueUpdateReducer.instances,Tn=p.createSelector([fn],t=>Object.values(t)),FT=T(p.createSelector([fn,(t,s)=>s],(t,s)=>t[s])),gT=T(O([Tn,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),bT=T(O([Tn,(t,s)=>s],(t,s)=>S(t.filter(e=>e.issue===s)))),_T=hn.reducer,Ne=w(t=>t.id),MT={instances:{},currentUser:null},Sn=p.createSlice({name:"users",initialState:MT,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,MT)),reducers:{initializeUsers:Ne.initialize,setUsers:Ne.setMany,setUser:Ne.setOne,addUsers:Ne.addMany,addUser:Ne.addOne,updateUsers:Ne.updateMany,updateUser:Ne.updateOne,deleteUser:Ne.deleteOne,deleteUsers:Ne.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:RT,setUsers:wT,setUser:ET,addUsers:vT,addUser:In,updateUsers:VT,updateUser:zT,deleteUser:On,deleteUsers:BT,setCurrentUser:gF,setProfilePicture:bF}=Sn.actions,jT=Sn.reducer,qT=t=>t.userReducer.currentUser,Pn=t=>t.userReducer.instances,jt=p.createSelector([Pn],t=>Object.values(t)),qt=t=>s=>s.userReducer.instances[t],DT=T(O([jt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({id:n})=>e.has(n)))})),Ge=w(t=>t.uuid),CT={instances:{}},Fn=p.createSlice({name:"organizationAccess",initialState:CT,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,CT)),reducers:{initializeOrganizationAccesses:Ge.initialize,addOrganizationAccess:Ge.addOne,addOrganizationAccesses:Ge.addMany,setOrganizationAccess:Ge.setOne,setOrganizationAccesses:Ge.setMany,updateOrganizationAccess:Ge.updateOne,updateOrganizationAccesses:Ge.updateMany,deleteOrganizationAccess:Ge.deleteOne,deleteOrganizationAccesses:Ge.deleteMany}}),{initializeOrganizationAccesses:$T,addOrganizationAccess:UT,addOrganizationAccesses:kT,setOrganizationAccess:LT,setOrganizationAccesses:NT,updateOrganizationAccess:GT,updateOrganizationAccesses:HT,deleteOrganizationAccess:WT,deleteOrganizationAccesses:KT}=Fn.actions,YT=Fn.reducer,Dt=t=>t.organizationAccessReducer.instances,ZT=t=>s=>s.organizationAccessReducer.instances[t],JT=T(O([Dt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(Object.values(t).filter(({uuid:n})=>e.has(n)))})),_F=p.createSelector([qT,Dt],(t,s)=>Object.values(s).find(n=>n.user===(t==null?void 0:t.id))??null),XT=p.createSelector([Dt],t=>{const s={};for(const e of Object.values(t))s[e.user]=e;return At(s)}),MF=T(O([Pn,XT,(t,s)=>s],(t,s,e)=>S(Object.values(t).filter(n=>{const a=s[n.id];return!!a&&a.organization===e})))),He=w(t=>t.uuid),QT={instances:{}},gn=p.createSlice({name:"organizations",initialState:QT,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,QT)),reducers:{initializeOrganizations:He.initialize,setOrganizations:He.setMany,setOrganization:He.setOne,addOrganizations:He.addMany,addOrganization:He.addOne,updateOrganizations:He.updateMany,updateOrganization:He.updateOne,deleteOrganization:He.deleteOne,deleteOrganizations:He.deleteMany}}),{initializeOrganizations:xT,setOrganizations:eS,setOrganization:tS,addOrganizations:sS,addOrganization:iS,updateOrganizations:nS,updateOrganization:aS,deleteOrganization:cS,deleteOrganizations:dS}=gn.actions,rS=t=>t.organizationReducer.instances,uS=p.createSelector([rS],t=>Object.values(t)),lS=t=>s=>s.organizationReducer.instances[t],oS=T(O([uS,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),hS=gn.reducer,mS=(t,s,e)=>{const n=t.uuid?t:{...t,uuid:et.v4()};return{payload:n,type:"",meta:{offline:{effect:{timestamp:new Date().toISOString(),request:n,BASE_URL:s,serviceName:e}}}}},yS={deletedRequests:[],latestRetryTime:0},bn=p.createSlice({name:"outbox",initialState:yS,extraReducers:t=>t.addCase(M,s=>Object.assign(s,yS)),reducers:{enqueueRequest:{reducer:(t,s)=>t,prepare:t=>{console.debug("Preparing to enqueue request",t);const{BASE_URL:s,serviceName:e,...n}=t;return mS(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}}}),RF=t=>t.outboxReducer.deletedRequests,wF=t=>t.outboxReducer.latestRetryTime,{enqueueRequest:pS,markForDeletion:EF,markAsDeleted:AS,_setLatestRetryTime:fS}=bn.actions,TS=bn.reducer,We=w(t=>t.uuid),SS={instances:{}},_n=p.createSlice({name:"projectAccess",initialState:SS,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,SS)),reducers:{initializeProjectAccesses:We.initialize,addProjectAccess:We.addOne,addProjectAccesses:We.addMany,setProjectAccess:We.setOne,setProjectAccesses:We.setMany,updateProjectAccess:We.updateOne,updateProjectAccesses:We.updateMany,deleteProjectAccess:We.deleteOne,deleteProjectAccesses:We.deleteMany}}),{initializeProjectAccesses:IS,addProjectAccess:OS,addProjectAccesses:PS,setProjectAccess:FS,setProjectAccesses:gS,updateProjectAccess:bS,updateProjectAccesses:_S,deleteProjectAccess:MS,deleteProjectAccesses:RS}=_n.actions,wS=_n.reducer,Mn=t=>t.projectAccessReducer.instances,yt=p.createSelector(Mn,t=>Object.values(t)),ES=t=>s=>s.projectAccessReducer.instances[t],vS=T(O([yt,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),vF=T(O([Mn,(t,s)=>s],(t,s)=>S(Object.values(t).filter(e=>e.project===s)))),VF=T(p.createSelector([yt,(t,s)=>s],(t,s)=>{const e={};for(const n of t.filter(a=>a.project===s))e[n.user]=n;return e})),zF=T(O([jt,yt,(t,s)=>s],(t,s,e)=>{const n=new Set(s.filter(a=>a.project===e).map(a=>a.user));return S(t.filter(a=>n.has(a.id)))})),Ke=w(t=>t.uuid),VS={instances:{}},Rn=p.createSlice({name:"projectAttachments",initialState:VS,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,VS)),reducers:{initializeProjectAttachments:Ke.initialize,addProjectAttachment:Ke.addOne,addProjectAttachments:Ke.addMany,setProjectAttachment:Ke.setOne,setProjectAttachments:Ke.setMany,updateProjectAttachment:Ke.updateOne,updateProjectAttachments:Ke.updateMany,deleteProjectAttachment:Ke.deleteOne,deleteProjectAttachments:Ke.deleteMany}}),{initializeProjectAttachments:zS,addProjectAttachment:BS,addProjectAttachments:jS,setProjectAttachment:qS,setProjectAttachments:DS,updateProjectAttachment:CS,updateProjectAttachments:$S,deleteProjectAttachment:US,deleteProjectAttachments:kS}=Rn.actions,LS=t=>t.projectAttachmentReducer.instances,wn=p.createSelector([LS],t=>Object.values(t)),NS=t=>s=>s.projectAttachmentReducer.instances[t],GS=T(O([wn,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),BF=T(O([wn,(t,s)=>s],(t,s)=>S(t.filter(({project:e})=>s===e)))),HS=Rn.reducer,Ye=w(t=>t.uuid),WS={instances:{},activeProjectFileId:null,isImportingProjectFile:!1},En=p.createSlice({name:"projectFiles",initialState:WS,extraReducers:t=>t.addMatcher(p.isAnyOf(M,$,E),s=>Object.assign(s,WS)),reducers:{initializeProjectFiles:Ye.initialize,setProjectFile:Ye.setOne,setProjectFiles:Ye.setMany,addProjectFile:Ye.addOne,addProjectFiles:Ye.addMany,updateProjectFile:Ye.updateOne,updateProjectFiles:Ye.updateMany,deleteProjectFile:Ye.deleteOne,deleteProjectFiles:Ye.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:KS,setProjectFile:YS,setProjectFiles:ZS,addProjectFile:JS,addProjectFiles:XS,updateProjectFile:QS,updateProjectFiles:xS,deleteProjectFile:eI,deleteProjectFiles:tI,setIsImportingProjectFile:sI,setActiveProjectFileId:iI,saveActiveProjectFileBounds:nI}=En.actions,aI=t=>t.projectFileReducer.instances,cI=p.createSelector([aI],t=>S(Object.values(t).sort((s,e)=>s.z_index-e.z_index))),dI=t=>s=>s.projectFileReducer.instances[t],rI=T(O([cI,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),jF=t=>t.projectFileReducer.activeProjectFileId,qF=t=>t.projectFileReducer.isImportingProjectFile,uI=En.reducer,Ze=w(t=>t.uuid),lI={instances:{}},vn=p.createSlice({name:"projects",initialState:lI,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,lI)),reducers:{initializeProjects:Ze.initialize,setProjects:Ze.setMany,setProject:Ze.setOne,addProjects:Ze.addMany,addProject:Ze.addOne,updateProjects:Ze.updateMany,updateProject:Ze.updateOne,deleteProject:Ze.deleteOne,deleteProjects:Ze.deleteMany}}),{initializeProjects:oI,setProjects:hI,setProject:mI,addProjects:yI,addProject:pI,updateProjects:AI,updateProject:fI,deleteProject:TI,deleteProjects:SI}=vn.actions,II=vn.reducer,OI=t=>t.projectReducer.instances,Ct=p.createSelector([OI],t=>Object.values(t)),PI=t=>s=>s.projectReducer.instances[t],FI=T(O([Ct,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),DF=T(O([Ct,yt,(t,s)=>s],(t,s,e)=>{const n=new Set(s.filter(a=>a.user===e).map(a=>a.project));return S(t.filter(a=>n.has(a.uuid)))})),CF=T(O([Ct,(t,s)=>s],(t,s)=>S(t.filter(e=>e.organization===s)))),$F={isRehydrated:!1},Vn=p.createSlice({name:"rehydrated",initialState:$F,reducers:{setRehydrated:(t,s)=>{t.isRehydrated=s.payload}}}),{setRehydrated:UF}=Vn.actions,kF=t=>t.rehydratedReducer.isRehydrated,gI=Vn.reducer,Je=w(t=>t.uuid),bI={instances:{}},zn=p.createSlice({name:"teamMemberships",initialState:bI,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,bI)),reducers:{initializeTeamMemberships:Je.initialize,addTeamMembership:Je.addOne,addTeamMemberships:Je.addMany,setTeamMembership:Je.setOne,setTeamMemberships:Je.setMany,updateTeamMembership:Je.updateOne,updateTeamMemberships:Je.updateMany,deleteTeamMembership:Je.deleteOne,deleteTeamMemberships:Je.deleteMany}}),{initializeTeamMemberships:_I,addTeamMembership:MI,addTeamMemberships:RI,setTeamMembership:wI,setTeamMemberships:EI,updateTeamMembership:vI,updateTeamMemberships:VI,deleteTeamMembership:zI,deleteTeamMemberships:BI}=zn.actions,jI=zn.reducer,qI=t=>t.teamMembershipReducer.instances,$t=p.createSelector([qI],t=>Object.values(t)),DI=t=>s=>s.teamMembershipReducer.instances[t],CI=T(O([$t,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),LF=T(p.createSelector([$t,(t,s)=>s],(t,s)=>{const e={};for(const n of t.filter(a=>a.team===s))e[n.user]=n;return e})),NF=T(O([jt,$t,(t,s)=>s],(t,s,e)=>{const n=new Set(s.filter(a=>a.team===e).map(a=>a.user));return S(t.filter(a=>n.has(a.id)))})),Xe=w(t=>t.uuid),$I={instances:{}},Bn=p.createSlice({name:"teams",initialState:$I,extraReducers:t=>t.addMatcher(p.isAnyOf(M,E),s=>Object.assign(s,$I)),reducers:{initializeTeams:Xe.initialize,addTeam:Xe.addOne,addTeams:Xe.addMany,setTeam:Xe.setOne,setTeams:Xe.setMany,updateTeam:Xe.updateOne,updateTeams:Xe.updateMany,deleteTeam:Xe.deleteOne,deleteTeams:Xe.deleteMany}}),{initializeTeams:UI,addTeam:kI,addTeams:LI,setTeam:NI,setTeams:GI,updateTeam:HI,updateTeams:WI,deleteTeam:KI,deleteTeams:YI}=Bn.actions,ZI=t=>t.teamReducer.instances,jn=p.createSelector([ZI],t=>Object.values(t)),JI=t=>s=>s.teamReducer.instances[t],XI=T(O([jn,(t,s)=>s],(t,s)=>{const e=new Set(s);return S(t.filter(({uuid:n})=>e.has(n)))})),GF=T(O([jn,(t,s)=>s],(t,s)=>S(t.filter(e=>e.organization===s)))),QI=Bn.reducer,HF={version:0},xI=p.createSlice({name:"versioning",initialState:HF,reducers:{}}),eO=xI.reducer,qn={outboxReducer:TS,fileReducer:Lh,authReducer:qo},WF=p.combineReducers(qn),tO={...qn,[ut]:eO,categoryReducer:Zo,assetReducer:Lr,assetAttachmentReducer:Ra,assetStageCompletionReducer:xr,assetStageReducer:yu,assetTypeReducer:So,assetTypeAttachmentReducer:wu,issueReducer:xp,issueAttachmentReducer:mp,issueTypeReducer:iT,issueTypeAttachmentReducer:mA,organizationReducer:hS,projectReducer:II,projectAttachmentReducer:HS,projectAccessReducer:wS,organizationAccessReducer:YT,projectFileReducer:uI,rehydratedReducer:gI,formReducer:Xm,formRevisionReducer:Um,formRevisionAttachmentReducer:Em,formSubmissionAttachmentReducer:hy,formSubmissionReducer:by,formIdentifierReducer:sm,formIdentifierValueReducer:Am,userReducer:jT,emailDomainsReducer:Dh,documentsReducer:Ih,documentAttachmentReducer:uh,teamReducer:QI,agentsReducer:pa,issueCommentReducer:Up,issueCommentAttachmentReducer:Mp,issueUpdateReducer:_T,geoImageReducer:$y,issueAssociationReducer:ep,issueTypeFieldsReducer:tf,issueTypeFieldValuesReducer:kA,issueTypeFieldsAttachmentReducer:MA,issueTypeFieldValuesAttachmentReducer:pf,issueTypeIdentifierReducer:wf,issueTypeIdentifierValueReducer:Nf,issueTypeStatusReducer:AT,assetTypeFieldsReducer:il,assetTypeFieldValuesReducer:El,assetTypeFieldsAttachmentReducer:Nu,assetTypeFieldValuesAttachmentReducer:Al,assetTypeIdentifierReducer:Gl,assetTypeIdentifierValueReducer:no,assetTypeStatusReducer:zo,assetProcedureTypeReducer:md,assetProcedureReducer:Qc,assetProcedureTypeFieldsReducer:mc,assetProcedureTypeFieldValuesReducer:Uc,assetProcedureTypeFieldsAttachmentReducer:xa,assetProcedureTypeFieldValuesAttachmentReducer:bc,assetProcedureTypeAttachmentReducer:$a,assetProcedureStepFieldsAttachmentReducer:Ed,assetProcedureStepFieldsReducer:Nd,assetProcedureStepFieldValuesAttachmentReducer:sr,assetProcedureStepFieldValuesReducer:Ar,assetProcedureStepReducer:Mr,teamMembershipReducer:jI},KF=p.combineReducers(tO),sO=1e4,iO=200,Dn=[400,409,403,404,405,500],N=1e4,nO={};class aO{constructor(s){m(this,"client");m(this,"pageSize",sO);nO[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 cO=()=>uO.length-1,dO=t=>(t[ut]={version:cO()},t),rO=()=>dO({}),YF=t=>(t.outboxReducer&&(t.outboxReducer.deletedRequests=[]),t),ZF=t=>s=>{var e;return s===void 0&&(s={}),((e=s[ut])==null?void 0:e.version)===cO()?s:t(s)},uO=[dO,rO,rO,YF],JF=Object.fromEntries(uO.map((t,s)=>[s,ZF(t)])),XF=t=>{if(t)throw t;const s=rt();s?s.dispatch({type:"rehydrated/setRehydrated",payload:!0}):console.error("Client store not set")},lO=(t,s,e)=>{const n=st();return n?(n.addRequest(s),n.getQueue()):(console.warn("Outbox coordinator not set; cannot enqueue request yet."),[])},oO=(t,s,e)=>{const n=st();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 QF(t,s){if(!s.payload)throw new Error("Received empty payload");return gO(s)}const xF={...Hn,effect:QF,discard:mO,returnPromises:!0,persistCallback:XF,retry:ig,persistOptions:{storage:zO},queue:{...Hn.queue,enqueue:lO,dequeue:oO,peek:(...t)=>sg(...t)}},eg=BO(JF,ut),tg=p.compose(VO.offline(xF),eg);async function hO(t,s,e){if(s.store.getState().outboxReducer.deletedRequests.includes(t.payload.uuid))throw new Error("Request was marked for deletion");const a=nO[t.meta.offline.effect.serviceName];if(!a)throw new Error(`Service ${t.meta.offline.effect.serviceName} not found`);return kn(t.meta.offline.effect.BASE_URL,t.meta.offline.effect.request,s,a,e)}function mO(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 n=
|
|
5
|
-
Action:`,s);const
|
|
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=rt(),c=n.getState().outboxReducer.deletedRequests,r=s.payload.uuid;function l(){n.dispatch(AS(r));const o=st();if(!o)throw new Error("Outbox coordinator not set");o.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 k&&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 k){const o=t.status||((d=t.response)==null?void 0:d.status);if(o||console.warn("Error has no status code:",t),o!==void 0&&Dn.includes(o)){console.warn("Discarding request due to error:",t,`
|
|
5
|
+
Action:`,s);const y=st();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=st();if(!u)throw new Error("Outbox coordinator not set");return u.registerRetry(s.payload.uuid),!1}function sg(t,s,e){var n;return(n=st())==null?void 0:n.peek()}function ig(t,s){return rt().dispatch(fS(new Date().getTime())),Qn}const at="An unknown error occurred",ng=500,yO=["non_field_errors","detail"];function ag(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"?yO.includes(a)?c:`${a}: ${c}`:Array.isArray(c)?yO.includes(a)?c.join(`
|
|
6
6
|
`):c.map(r=>`${a}: ${r}`).join(`
|
|
7
7
|
`):`${a}: ${JSON.stringify(c)}`).join(`
|
|
8
|
-
`)}catch(a){console.error("Failed to extract error message from response body",a)}}else typeof t.body=="string"&&(e=t.body);else t!=null&&t.text?e=t.text:s instanceof Error&&(e=s.message);return!e||e.length>sg?nt:e}class U extends Error{constructor(e){super(nt);y(this,"status");y(this,"response");y(this,"message");y(this,"options");const{response:n,innerError:a}=e;this.message=e.message??ig(n,a)??nt,this.status=(n==null?void 0:n.status)??0,this.response=n,e.discard=e.discard??!1,this.options=e}}function yO(t){function s(e){return typeof e=="object"&&e!==null&&["ok","redirect","clientError","serverError","error"].every(a=>a in e)}if(s(t))return t;if(typeof t=="object"&&t!==null){const e=t;if(s(e.response))return e.response;if(e.response&&s(e.response.response))return e.response.response}}class ng extends nO{constructor(s){super(s)}}class et extends nO{constructor(e,n){super(e);y(this,"auth");this.auth=n}}class ag extends et{async startConversation(s,e){return this.enqueueRequest({description:"Start agent conversation",method:m.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:e},blockers:["prompt"],blocks:["prompt"]}).then(n=>(this.dispatch(oa(n)),n))}async continueConversation(s,e,n){return this.enqueueRequest({description:"Prompt agent",method:m.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:n},blockers:["prompt"],blocks:["prompt"],queryParams:{conversation_id:e}}).then(a=>{this.dispatch(ma(a))})}async fetchDetails(s){return this.enqueueRequest({description:"Get agent conversation",method:m.GET,url:`/agents/conversations/${s}/`,blockers:["conversation"],blocks:["conversation"]}).then(e=>{this.dispatch(ha(e))})}async rate(s,e){return this.enqueueRequest({description:"Rate agent response",method:m.PUT,url:`/agents/responses/${s}/rate/`,payload:{rating:e},blockers:["rate"],blocks:["rate"]})}async list(s,e){return this.performRequest({method:m.GET,url:"/agents/conversations/",...s},e)}async refreshStore(s,e){const n=await this.list({queryParams:{project:s}},e);return this.dispatch(la(n)),n}}function O(t,s,e){const n=`${s}${e?"s":""}`;switch(t){case m.GET:return`Get ${n}`;case m.POST:return`Create ${n}`;case m.PATCH:return`Update ${n}`;case m.PUT:return`Update ${n}`;case m.DELETE:return`Delete ${n}`}}class v extends et{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:m.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:m.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:m.GET,...s},e)}}class Xe extends v{constructor(){super(...arguments);y(this,"pageSize",sO)}async _bulkAdd(e){var f;const{store:n}=this.client,{addMany:a,updateMany:c,deleteMany:r}=this.actions,l=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,u=new Date().toISOString(),d=[],h=[],p={};for(const I of e){const{modelUuid:F,file:P}=I,g=await this.client.files.getFilePayload(P);g.sha1 in p||(p[g.sha1]=g);const b=this.buildModel({file:P,file_sha1:g.sha1,submitted_at:u,created_by:l,modelUuid:F});d.push(b),h.push(this.buildPayload(b,g))}this.dispatch(a(d));const A=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:u,attachments:h,files:Object.values(p)},blocks:d.map(I=>this.getId(I)),blockers:d.map(I=>I.file_sha1)});return A.then(({attachments:I,presigned_urls:F})=>{this.dispatch(c(I)),this.client.files.processPresignedUrls(F)}).catch(()=>{this.dispatch(r(d.map(I=>this.getId(I))))}),[d,A.then(({attachments:I})=>I)]}async _delete(e){const{store:n}=this.client,{addOne:a,deleteOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`Attempting to delete attachment with uuid ${e} that does not exist in the store`);this.dispatch(c(this.getId(l)));const u=this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return u.then(()=>{this.client.files.removeCache(l.file_sha1)}).catch(()=>{this.dispatch(a(l))}),u}}class cg extends Xe{constructor(){super(...arguments);y(this,"name","Asset attachment");y(this,"url","/asset-attachments");y(this,"actions",{addOne:fa,addMany:Xt,setOne:Sa,setMany:Ta,updateOne:Ia,updateMany:Oa,deleteOne:Pa,deleteMany:Qt,initialize:Aa});y(this,"selectors",{selectById:ga,selectByIds:ba})}getId(e){return e.uuid}buildModel(e){return M({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,asset:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,asset:e.asset}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.assetUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{asset__project:e}},n)).flat();return this.dispatch(a(r)),r}}class dg extends Xe{constructor(){super(...arguments);y(this,"name","Asset Procedure Attachment");y(this,"url","/asset-procedure-type-attachments");y(this,"actions",{addOne:Ea,addMany:va,setOne:Va,setMany:za,updateOne:Ba,updateMany:ja,deleteOne:qa,deleteMany:Da,initialize:wa});y(this,"selectors",{selectById:Ua,selectByIds:La})}getId(e){return e.uuid}buildModel(e){return M({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,asset_procedure_type:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,asset_procedure_type:e.asset_procedure_type}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.assetProcedureTypeUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class rg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Type Fields Attachment");y(this,"url","/asset-procedure-type-fields-attachments");y(this,"actions",{addOne:Ha,addMany:Ga,setOne:Wa,setMany:Ka,updateOne:Ya,updateMany:Za,deleteOne:Ja,deleteMany:Xa,initialize:Na});y(this,"selectors",{selectById:ec,selectByIds:tc})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],h=[];for(const f of e){const{fieldsRevisionUuid:I,fieldIdentifier:F,file:P}=f,g=await this.client.files.getFilePayload(P);g.sha1 in u||(u[g.sha1]=g);const b=M({file:URL.createObjectURL(P),file_type:P.type,file_name:P.name,file_sha1:g.sha1,created_by:l,fields_revision:I,submitted_at:r,field_identifier:F});d.push(b);const E={uuid:b.uuid,file_name:P.name,field_identifier:F,file_extension:g.extension,file_sha1:g.sha1,fields_revision:I};h.push(E)}this.dispatch(n(d));const p=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(f=>f.fields_revision),blocks:d.map(f=>f.uuid)});return p.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,p.then(({attachments:f})=>f)]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class ug extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Type Fields");y(this,"url","/asset-procedure-type-fields");y(this,"actions",{addOne:nc,addMany:ac,setOne:cc,setMany:dc,updateOne:rc,updateMany:uc,deleteOne:lc,deleteMany:oc,initialize:ic});y(this,"selectors",{selectById:yc,selectByIds:pc})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_procedure_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(r(d.uuid)),A}),[d,h]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}function Qe(t,s){const e=[];let n=0;const a=t.length;for(;n<a;)e.push(t.slice(n,n+=s));return e}class lg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Type Field Values Attachment");y(this,"url","/asset-procedure-type-field-values-attachments");y(this,"actions",{addOne:Sc,addMany:cs,setOne:Tc,setMany:Ic,updateOne:Oc,updateMany:Pc,deleteOne:Fc,deleteMany:ds,initialize:fc});y(this,"selectors",{selectById:_c,selectByIds:Mc})}async bulkAdd(e,n){var f;const{addMany:a,setMany:c,deleteMany:r}=this.actions,l=new Date().toISOString(),u=((f=this.client.store.getState().userReducer.currentUser)==null?void 0:f.id)??null,d=Qe(e,Math.min(n??e.length,Je)),h=[],p=[];for(const I of d){const F={},P=[];for(const g of I){const{fieldValuesUuid:b,fieldIdentifier:E,file:B}=g,z=await this.client.files.getFilePayload(B);z.sha1 in F||(F[z.sha1]=z);const q=M({file:URL.createObjectURL(B),file_type:B.type,file_name:B.name,file_sha1:z.sha1,created_by:u,field_values:b,submitted_at:l,field_identifier:E});h.push(q);const j={uuid:q.uuid,file_name:B.name,file_sha1:z.sha1,file_extension:z.extension,field_identifier:E,field_values:b};P.push(j)}p.push({submitted_at:l,attachments:P,files:Object.values(F)})}this.dispatch(a(h));const A=p.map(I=>this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:I,blockers:I.attachments.map(F=>F.field_values),blocks:I.attachments.map(F=>F.uuid)}));return Promise.all(A).then(I=>{for(const P of I)this.client.files.processPresignedUrls(P.presigned_urls);const F=I.flatMap(P=>P.attachments);this.dispatch(c(F))}).catch(I=>{throw this.dispatch(r(h.map(F=>F.uuid))),I}),[h,A.map(I=>I.then(({attachments:F})=>F))]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:r}=this.selectors,l=n.getState(),u=r(e)(l);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{field_values__asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class og extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Type Field Values");y(this,"url","/asset-procedure-type-field-values");y(this,"actions",{addOne:vc,addMany:Vc,setOne:zc,setMany:Bc,updateOne:jc,updateMany:qc,deleteOne:Dc,deleteMany:Cc,initialize:Ec});y(this,"selectors",{selectById:Lc,selectByIds:kc})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),h=M({...e,created_by:u,submitted_at:d}),p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(h.uuid))}),[h,p]}bulkAdd(e,n){var F;const{values:a,payloads:c}=e,{addMany:r,setMany:l,deleteMany:u}=this.actions,d=new Date().toISOString(),h=((F=this.client.store.getState().userReducer.currentUser)==null?void 0:F.id)??null,p=[],A=Qe(c,Math.min(n??c.length,Je)),f=[];for(const P of A){const g=[];for(const b of P){const E=M({...b,values:b.values,created_by:h,submitted_at:d});p.push(E),g.push({uuid:E.uuid,asset:b.asset,fields_revision:b.fields_revision,asset_procedure:b.asset_procedure,published_at:b.published_at,values:E.values})}f.push({submitted_at:d,values:a,field_values:g})}this.dispatch(r(p));const I=[];for(const P of f){const{field_values:g}=P,b=g.map(({asset:j})=>j),E=g.map(({fields_revision:j})=>j),B=g.map(({asset_procedure:j})=>j),z=g.map(({uuid:j})=>j),q=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:P,blockers:b.concat(E).concat(B),blocks:z});I.push(q)}return Promise.all(I).then(P=>{this.dispatch(l(P.flat()))}).catch(()=>{this.dispatch(u(D(p)))}),[p,I]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`Expected AssetProcedureTypeFieldValues with uuid ${e.uuid} to exist`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[u.fields_revision,u.asset,u.asset_procedure],blocks:[u.uuid]});return d.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected submission with uuid ${e} to exist`);const d=Rc(e)(l);this.dispatch(a(e)),this.dispatch(ds(D(d)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(cs(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 hg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure");y(this,"url","/asset-procedures");y(this,"actions",{addOne:Gc,addMany:os,setOne:Zc,setMany:Jc,updateOne:Wc,updateMany:Kc,deleteOne:Yc,deleteMany:hs,initialize:Hc});y(this,"selectors",{selectById:ed,selectByIds:td})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.asset_procedure_type,e.asset_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected asset procedure with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected asset procedure with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(r)),r}}class mg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Type");y(this,"url","/asset-procedure-types");y(this,"actions",{addOne:nd,addMany:ad,setOne:ld,setMany:od,updateOne:cd,updateMany:dd,deleteOne:rd,deleteMany:ud,initialize:id});y(this,"selectors",{selectById:yd,selectByIds:pd})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected asset procedure type with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected asset procedure type with uuid ${e} to exist`);const d=xc(e)(l);this.dispatch(a(e)),this.dispatch(hs(D(d)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(os(d)),h}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class yg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Step Fields Attachment");y(this,"url","/asset-procedure-step-fields-attachments");y(this,"actions",{addOne:Sd,addMany:Td,setOne:Id,setMany:Od,updateOne:Pd,updateMany:Fd,deleteOne:gd,deleteMany:bd,initialize:fd});y(this,"selectors",{selectById:Md,selectByIds:Rd})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],h=[];for(const f of e){const{fieldsRevisionUuid:I,fieldIdentifier:F,file:P}=f,g=await this.client.files.getFilePayload(P);g.sha1 in u||(u[g.sha1]=g);const b=M({file:URL.createObjectURL(P),file_type:P.type,file_name:P.name,file_sha1:g.sha1,created_by:l,fields_revision:I,submitted_at:r,field_identifier:F});d.push(b);const E={uuid:b.uuid,file_name:P.name,field_identifier:F,file_extension:g.extension,file_sha1:g.sha1,fields_revision:I};h.push(E)}this.dispatch(n(d));const p=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(f=>f.fields_revision),blocks:d.map(f=>f.uuid)});return p.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,p.then(({attachments:f})=>f)]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__asset_procedure_step__organization:e}},n);return this.dispatch(a(c)),c}}class pg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Step Fields");y(this,"url","/asset-procedure-step-fields");y(this,"actions",{addOne:Vd,addMany:zd,setOne:Bd,setMany:jd,updateOne:qd,updateMany:Dd,deleteOne:Cd,deleteMany:$d,initialize:vd});y(this,"selectors",{selectById:Ud,selectByIds:Ld})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_procedure_step],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(r(d.uuid)),A}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,c=n.getState().assetProcedureStepFieldsReducer.instances[e.uuid];if(!c)throw new Error(`AssetProcedureStepFields with uuid ${e.uuid} not found`);const r={...c,...e};this.dispatch(a(r));const l=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${c.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return l.then(u=>{this.dispatch(a(u))}).catch(u=>{throw this.dispatch(a(c)),u}),[r,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,r=n.getState().assetProcedureStepFieldsReducer.instances[e];if(!r)throw new Error(`AssetProcedureStepFields with uuid ${e} not found`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(l){throw this.dispatch(c(r)),l}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_step__asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class Ag extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Step Field Values Attachment");y(this,"url","/asset-procedure-step-field-values-attachments");y(this,"actions",{addOne:Gd,addMany:Is,setOne:Wd,setMany:Kd,updateOne:Yd,updateMany:Zd,deleteOne:Jd,deleteMany:Os,initialize:Hd});y(this,"selectors",{selectById:Qd,selectByIds:xd})}async bulkAdd(e,n){var f;const{addMany:a,setMany:c,deleteMany:r}=this.actions,l=new Date().toISOString(),u=((f=this.client.store.getState().userReducer.currentUser)==null?void 0:f.id)??null,d=Qe(e,Math.min(n??e.length,Je)),h=[],p=[];for(const I of d){const F={},P=[];for(const g of I){const{fieldValuesUuid:b,fieldIdentifier:E,file:B}=g,z=await this.client.files.getFilePayload(B);z.sha1 in F||(F[z.sha1]=z);const q=M({file:URL.createObjectURL(B),file_type:B.type,file_name:B.name,file_sha1:z.sha1,created_by:u,field_values:b,submitted_at:l,field_identifier:E});h.push(q);const j={uuid:q.uuid,file_name:B.name,file_sha1:z.sha1,file_extension:z.extension,field_identifier:E,field_values:b};P.push(j)}p.push({submitted_at:l,attachments:P,files:Object.values(F)})}this.dispatch(a(h));const A=p.map(I=>this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:I,blockers:I.attachments.map(F=>F.field_values),blocks:I.attachments.map(F=>F.uuid)}));return Promise.all(A).then(I=>{for(const P of I)this.client.files.processPresignedUrls(P.presigned_urls);const F=I.flatMap(P=>P.attachments);this.dispatch(c(F))}).catch(I=>{throw this.dispatch(r(h.map(F=>F.uuid))),I}),[h,A.map(I=>I.then(({attachments:F})=>F))]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:r}=this.selectors,l=n.getState(),u=r(e)(l);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{field_values__asset_procedure__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class fg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Step Field Values");y(this,"url","/asset-procedure-step-field-values");y(this,"actions",{addOne:nr,addMany:ar,setOne:cr,setMany:dr,updateOne:rr,updateMany:ur,deleteOne:lr,deleteMany:or,initialize:ir});y(this,"selectors",{selectById:mr,selectByIds:yr})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),h=M({...e,created_by:u,submitted_at:d}),p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(h.uuid))}),[h,p]}bulkAdd(e,n){var F;const{payloads:a,values:c}=e,{addMany:r,setMany:l,deleteMany:u}=this.actions,d=new Date().toISOString(),h=((F=this.client.store.getState().userReducer.currentUser)==null?void 0:F.id)??null,p=[],A=Qe(a,Math.min(n??a.length,Je)),f=[];for(const P of A){const g=[];for(const b of P){const E=M({...b,values:b.values,created_by:h,submitted_at:d});p.push(E),g.push({uuid:E.uuid,asset:b.asset,fields_revision:b.fields_revision,asset_procedure:b.asset_procedure,asset_procedure_step:b.asset_procedure_step,published_at:b.published_at,values:E.values})}f.push({submitted_at:d,values:c,field_values:g})}this.dispatch(r(p));const I=[];for(const P of f){const{field_values:g}=P,b=g.map(({asset:j})=>j),E=g.map(({fields_revision:j})=>j),B=g.map(({asset_procedure:j})=>j),z=g.map(({uuid:j})=>j),q=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:P,blockers:b.concat(E).concat(B),blocks:z});I.push(q)}return Promise.all(I).then(P=>{this.dispatch(l(P.flat()))}).catch(()=>{this.dispatch(u(D(p)))}),[p,I]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`Expected AssetProcedureStepFieldValues with uuid ${e.uuid} to exist`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[u.fields_revision,u.asset,u.asset_procedure],blocks:[u.uuid]});return d.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected submission with uuid ${e} to exist`);const d=er(e)(l);this.dispatch(a(e)),this.dispatch(Os(D(d)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(Is(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 Sg extends v{constructor(){super(...arguments);y(this,"name","Asset Procedure Step");y(this,"url","/asset-procedure-steps");y(this,"actions",{addOne:Ir,addMany:Or,setOne:Sr,setMany:Tr,updateOne:Pr,updateMany:Fr,deleteOne:gr,deleteMany:br,initialize:fr});y(this,"selectors",{selectById:Mr,selectByIds:Rr})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_procedure_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`No asset procedure step with uuid ${e.uuid} found in the store`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${r.uuid}/`,payload:{name:e.name,description:e.description,priority:e.order,color:e.color},blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteMany:a,addMany:c,addOne:r,deleteOne:l}=this.actions,{selectById:u}=this.selectors,d=n.getState(),h=u(e)(d);if(!h)throw new Error(`No asset procedure step with uuid ${e} found in the store`);const p=wr(e)(d);this.dispatch(l(e)),this.dispatch(a(D(p)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(A){throw this.dispatch(r(h)),this.dispatch(c(p)),A}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class Tg extends v{constructor(){super(...arguments);y(this,"url","/assets");y(this,"name","Asset");y(this,"actions",{addOne:Vr,addMany:Ms,setOne:qr,setMany:Dr,updateOne:zr,updateMany:Br,deleteOne:jr,deleteMany:Rs,initialize:vr});y(this,"selectors",{selectById:$r,selectByIds:Ur})}add(e){var p;const{store:n}=this.client,{addOne:a,updateOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`No asset with uuid ${e.uuid} found in the store`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{addOne:a,deleteOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`No asset with uuid ${e} found in the store`);const d=_a(e)(l),h=Qy(e)(l);this.dispatch(c(e)),this.dispatch(Qt(D(d))),this.dispatch(Et(D(h)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(a(u)),this.dispatch(Xt(d)),this.dispatch(wt(h)),p}}bulkAdd(e,n){const{addMany:a}=this.actions,c=new Date().toISOString(),r=xe.v4(),l=Qe(e,n).map(h=>{const p=h.map(A=>M(A));return{batchId:xe.v4(),payload:{transaction_id:r,submitted_at:c,assets:p}}}),u=[];let d=null;for(const h of l){const{batchId:p,payload:A}=h,f=A.assets.map(({uuid:E})=>E),I=A.assets.map(({asset_type:E})=>E),F=A.assets.map(({project:E})=>E),P=I.concat(F);d&&P.push(d);const g=f;g.push(p);const b=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:A,blockers:P,blocks:g});d=h.batchId,u.push(b)}return Promise.all(u).then(h=>{const p=h.flat();this.dispatch(a(p))}),u}bulkUpdate(e,n){const{store:a}=this.client,{updateMany:c}=this.actions,{selectByIds:r}=this.selectors,l=D(e).toSorted(At);if(l.length!==e.length)throw new Error("payloads contains duplicate uuids.");const u=r(l)(a.getState()).toSorted(Kt);if(l.length!=u.length)throw new Error(`Attempting to bulk update ${l.length-u.length} assets that dont exist in the store`);const d=[];for(let f=0;f<l.length;f++)d.push({...u[f],...e[f]});this.dispatch(c(d));const h=Qe(e,Math.min(n??e.length,Je)),p=[];let A=null;for(const f of h){const I=xe.v4(),F=D(f),P=f.map(({status:b})=>b).filter(Boolean),g=this.enqueueRequest({description:O(m.PATCH,this.name,!0),method:m.PATCH,url:`${this.url}/bulk/`,payload:{payloads:f},blockers:F.concat(P).concat(A?[A]:[]),blocks:F.concat([I])});p.push(g),A=I}return Promise.all(p).then(f=>{this.dispatch(c(f.flat()))}).catch(()=>{this.dispatch(c(u))}),[d,p]}async bulkDelete(e){const{store:n}=this.client,{addMany:a,deleteMany:c}=this.actions,{selectByIds:r}=this.selectors,l=n.getState(),u=r(e)(l);this.dispatch(c(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(a(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(r)),r}}class Ig extends v{constructor(){super(...arguments);y(this,"name","Asset Stage Completion");y(this,"url","/asset-stage-completions");y(this,"actions",{addOne:Hr,addMany:Gr,setOne:Wr,setMany:Kr,updateOne:Yr,updateMany:Zr,deleteOne:Jr,deleteMany:Xr,initialize:Nr});y(this,"selectors",{selectById:tu,selectByIds:su})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.asset,e.asset_stage],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`Expected asset stage completion with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}bulkAdd(e){var f;const{store:n}=this.client,{addMany:a,setMany:c,deleteMany:r}=this.actions,l=new Date().toISOString(),u=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,d=e.map(I=>M(I)),h=d.map(I=>({...I,created_by:u,submitted_at:l})),p=h.map(({uuid:I})=>I);this.dispatch(a(h));const A=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:l,completions:d},blockers:[...e.map(I=>I.asset_procedure),...e.map(I=>I.asset_stage),...e.map(I=>I.asset)],blocks:p});return A.then(I=>{this.dispatch(c(I))}).catch(()=>{this.dispatch(r(p))}),[h,A]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:r}=this.selectors,l=r(e)(n.getState());this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{asset_procedure__project:e}},n)).flat();return this.dispatch(a(r)),r}}class Og extends v{constructor(){super(...arguments);y(this,"name","Asset Stage");y(this,"url","/asset-stages");y(this,"actions",{addOne:du,addMany:ru,setOne:au,setMany:cu,updateOne:uu,updateMany:lu,deleteOne:ou,deleteMany:hu,initialize:nu});y(this,"selectors",{selectById:yu,selectByIds:pu})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_procedure_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`No asset stage with uuid ${e.uuid} found in the store`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${r.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`No asset stage with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class Pg extends Xe{constructor(){super(...arguments);y(this,"name","Asset Type Attachment");y(this,"url","/asset-type-attachments");y(this,"actions",{addOne:Su,addMany:qs,setOne:Tu,setMany:Iu,updateOne:Ou,updateMany:Pu,deleteOne:Fu,deleteMany:Ds,initialize:fu});y(this,"selectors",{selectById:bu,selectByIds:_u})}getId(e){return e.uuid}buildModel(e){return M({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,asset_type:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,asset_type:e.asset_type}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.assetTypeUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class Fg extends v{constructor(){super(...arguments);y(this,"name","Asset Type Fields Attachment");y(this,"url","/asset-type-fields-attachments");y(this,"actions",{addOne:vu,addMany:Vu,setOne:zu,setMany:Bu,updateOne:ju,updateMany:qu,deleteOne:Du,deleteMany:Cu,initialize:Eu});y(this,"selectors",{selectById:Uu,selectByIds:Lu})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],h=[];for(const f of e){const{fieldsRevisionUuid:I,fieldIdentifier:F,file:P}=f,g=await this.client.files.getFilePayload(P);g.sha1 in u||(u[g.sha1]=g);const b=M({file:URL.createObjectURL(P),file_type:P.type,file_name:P.name,file_sha1:g.sha1,created_by:l,fields_revision:I,submitted_at:r,field_identifier:F});d.push(b);const E={uuid:b.uuid,file_name:P.name,field_identifier:F,file_extension:g.extension,file_sha1:g.sha1,fields_revision:I};h.push(E)}this.dispatch(n(d));const p=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(f=>f.fields_revision),blocks:d.map(f=>f.uuid)});return p.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,p.then(({attachments:f})=>f)]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class gg extends v{constructor(){super(...arguments);y(this,"name","Asset Type Fields");y(this,"url","/asset-type-fields");y(this,"actions",{addOne:Gu,addMany:Wu,setOne:Ku,setMany:Yu,updateOne:Zu,updateMany:Ju,deleteOne:Xu,deleteMany:Qu,initialize:Hu});y(this,"selectors",{selectById:el,selectByIds:tl})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(r(d.uuid)),A}),[d,h]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class bg extends v{constructor(){super(...arguments);y(this,"name","Asset Type Field Values Attachment");y(this,"url","/asset-type-field-values-attachments");y(this,"actions",{addOne:al,addMany:Ns,setOne:cl,setMany:dl,updateOne:rl,updateMany:ul,deleteOne:ll,deleteMany:Hs,initialize:nl});y(this,"selectors",{selectById:hl,selectByIds:ml})}async bulkAdd(e,n){var f;const{addMany:a,setMany:c,deleteMany:r}=this.actions,l=new Date().toISOString(),u=((f=this.client.store.getState().userReducer.currentUser)==null?void 0:f.id)??null,d=Qe(e,Math.min(n??e.length,Je)),h=[],p=[];for(const I of d){const F={},P=[];for(const g of I){const{fieldValuesUuid:b,fieldIdentifier:E,file:B}=g,z=await this.client.files.getFilePayload(B);z.sha1 in F||(F[z.sha1]=z);const q=M({file:URL.createObjectURL(B),file_type:B.type,file_name:B.name,file_sha1:z.sha1,created_by:u,field_values:b,submitted_at:l,field_identifier:E});h.push(q);const j={uuid:q.uuid,file_name:B.name,file_sha1:z.sha1,file_extension:z.extension,field_identifier:E,field_values:b};P.push(j)}p.push({submitted_at:l,attachments:P,files:Object.values(F)})}this.dispatch(a(h));const A=p.map(I=>this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:I,blockers:I.attachments.map(F=>F.field_values),blocks:I.attachments.map(F=>F.uuid)}));return Promise.all(A).then(I=>{for(const P of I)this.client.files.processPresignedUrls(P.presigned_urls);const F=I.flatMap(P=>P.attachments);this.dispatch(c(F))}).catch(I=>{throw this.dispatch(r(h.map(F=>F.uuid))),I}),[h,A.map(I=>I.then(({attachments:F})=>F))]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:r}=this.selectors,l=n.getState(),u=r(e)(l);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{field_values__asset__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class _g extends v{constructor(){super(...arguments);y(this,"name","Asset Type Field Values");y(this,"url","/asset-type-field-values");y(this,"actions",{addOne:Sl,addMany:Tl,setOne:Il,setMany:Ol,updateOne:Pl,updateMany:Fl,deleteOne:gl,deleteMany:bl,initialize:fl});y(this,"selectors",{selectById:Ml,selectByIds:Rl})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),h=M({...e,created_by:u,submitted_at:d}),p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[e.asset,e.fields_revision],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(h.uuid))}),[h,p]}bulkAdd(e,n){var I;const{payloads:a,values:c}=e,{addMany:r,setMany:l,deleteMany:u}=this.actions,d=new Date().toISOString(),h=[],p=Qe(a,Math.min(n??a.length,Je)),A=[];for(const F of p){const P=[];for(const g of F){const b=M({...g,values:g.values,created_by:((I=this.client.store.getState().userReducer.currentUser)==null?void 0:I.id)??null,submitted_at:d});h.push(b),P.push({uuid:b.uuid,asset:g.asset,fields_revision:g.fields_revision,published_at:g.published_at,values:b.values})}A.push({submitted_at:d,values:c,field_values:P})}this.dispatch(r(h));const f=[];for(const F of A){const{field_values:P}=F,g=P.map(({asset:z})=>z),b=P.map(({fields_revision:z})=>z),E=P.map(({uuid:z})=>z),B=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:F,blockers:g.concat(b),blocks:E});f.push(B)}return Promise.all(f).then(F=>{this.dispatch(l(F.flat()))}).catch(()=>{this.dispatch(u(D(h)))}),[h,f]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`Expected AssetTypeFieldValues with uuid ${e.uuid} to exist`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[u.uuid,u.fields_revision,u.asset],blocks:[u.uuid]});return d.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected submission with uuid ${e} to exist`);const d=yl(e)(l);this.dispatch(a(e)),this.dispatch(Hs(D(d)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(Ns(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 Mg extends v{constructor(){super(...arguments);y(this,"name","Asset Type Identifier");y(this,"url","/asset-type-identifiers");y(this,"actions",{addOne:Vl,addMany:zl,setOne:Bl,setMany:jl,updateOne:ql,updateMany:Dl,deleteOne:Cl,deleteMany:$l,initialize:vl});y(this,"selectors",{selectById:Ll,selectByIds:kl})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.asset_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected asset type identifier with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected asset type identifier with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class Rg extends v{constructor(){super(...arguments);y(this,"name","Asset Type Identifier Value");y(this,"url","/asset-type-identifier-values");y(this,"actions",{addOne:Wl,addMany:Kl,setOne:Yl,setMany:Zl,updateOne:Jl,updateMany:Xl,deleteOne:Ql,deleteMany:xl,initialize:Gl});y(this,"selectors",{selectById:to,selectByIds:so})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.asset,e.asset_type_identifier],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected asset type identifier value with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected asset type identifier value with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{asset__project:e}},n)).flat();return this.dispatch(a(r)),r}}class wg extends v{constructor(){super(...arguments);y(this,"name","Asset Type");y(this,"url","/asset-types");y(this,"actions",{addOne:uo,addMany:lo,setOne:co,setMany:ro,updateOne:oo,updateMany:ho,deleteOne:mo,deleteMany:yo,initialize:ao});y(this,"selectors",{selectById:Ao,selectByIds:fo})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected asset type with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected asset type with uuid ${e} to exist`);const d=Es(e)(l),h=Mu(e)(l);this.dispatch(a(e)),this.dispatch(Rs(D(d))),this.dispatch(Ds(D(h)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(c(u)),this.dispatch(Ms(d)),this.dispatch(qs(h)),p}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Eg extends v{constructor(){super(...arguments);y(this,"name","Asset Type Status");y(this,"url","/asset-type-statuses");y(this,"actions",{addOne:Oo,addMany:Po,setOne:Fo,setMany:go,updateOne:bo,updateMany:_o,deleteOne:Mo,deleteMany:Ro,initialize:Io});y(this,"selectors",{selectById:Eo,selectByIds:vo})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.asset_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),r=a(e.uuid)(c);if(!r)throw new Error(`Expected an existing asset type status with uuid ${e.uuid}`);const l={...r,...e};this.dispatch(n(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`No asset type status with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class vg extends v{constructor(){super(...arguments);y(this,"name","Category");y(this,"url","/categories");y(this,"actions",{addOne:Co,addMany:$o,setOne:Uo,setMany:Lo,updateOne:ko,updateMany:No,deleteOne:Ho,deleteMany:Go,initialize:Do});y(this,"selectors",{selectById:si,selectByIds:Ko})}add(e){var p;const{store:n}=this.client,{addOne:a,updateOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.project],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{updateOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),r=a(e.uuid)(c);if(!r)throw new Error(`Expected an existing category with uuid ${e.uuid}`);const l={...r,...e};this.dispatch(n(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`No category with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${l.uuid}/`,blockers:[l.uuid],blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{project__organization:e}},n);return this.dispatch(a(c)),c}}class Vg extends Xe{constructor(){super(...arguments);y(this,"name","Document Attachment");y(this,"url","/document-attachments");y(this,"actions",{addOne:Xo,addMany:Qo,setOne:xo,setMany:eh,updateOne:th,updateMany:sh,deleteOne:ih,deleteMany:nh,initialize:Jo});y(this,"selectors",{selectById:ch,selectByIds:dh})}getId(e){return e.uuid}buildModel(e){return M({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,document:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,document:e.document}}async bulkAdd(e){var I;const{store:n}=this.client,{addMany:a,updateMany:c,deleteMany:r}=this.actions,l=((I=n.getState().userReducer.currentUser)==null?void 0:I.id)??null,u=new Date().toISOString(),d=[],h=[],p={},A={};for(const F of e){const{documentUuid:P,file:g}=F,b=await this.client.files.getFilePayload(g);b.sha1 in p||(p[b.sha1]=b,A[b.sha1]=[]);const E=this.buildModel({file:g,file_sha1:b.sha1,submitted_at:u,created_by:l,modelUuid:P});d.push(E),h.push(this.buildPayload(E,b)),A[b.sha1].push(E.uuid)}this.dispatch(a(d));const f=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:u,attachments:h,files:Object.values(p)},blocks:d.map(F=>F.uuid),blockers:d.map(F=>F.file_sha1)});return f.then(({attachments:F,presigned_urls:P})=>{this.dispatch(c(F));const g=this.client.files.processPresignedUrls(P);for(const[b,E]of Object.entries(g))E.then(()=>{const B=A[b];for(const z of B)this.makeReadable(z)})}).catch(()=>{this.dispatch(r(d.map(F=>F.uuid)))}),[d,f.then(({attachments:F})=>F)]}async delete(e){return this._delete(e)}makeReadable(e){this.enqueueRequest({description:"Add attachment to AI assistant",method:m.PATCH,url:`${this.url}/${e}/`,payload:{readable_to_assistant:!0},blockers:["index-document-attachment",e],blocks:["index-document-attachment"]})}async refreshStore(e,n){const{initialize:a}=this.actions,c=this.list({queryParams:{document__project__organization:e}},n),r=this.list({queryParams:{document__organization:e}},n),u=(await Promise.all([c,r])).flat();return this.dispatch(a(u)),u}}class zg extends v{constructor(){super(...arguments);y(this,"name","Document");y(this,"url","/documents");y(this,"actions",{addOne:oh,addMany:hh,setOne:mh,setMany:yh,updateOne:ph,updateMany:Ah,deleteOne:fh,deleteMany:Sh,initialize:lh});y(this,"selectors",{selectById:Ih,selectByIds:Oh})}add(e){var p;const{store:n}=this.client,{addOne:a,deleteOne:c,updateOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:d.parent_document?[d.parent_document]:[],blocks:[d.uuid]});return h.then(A=>{this.dispatch(r(A))}).catch(()=>{this.dispatch(c(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`attempting to update a document with uuid ${e.uuid} that does not exist in store.documents`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c,addMany:r,deleteMany:l}=this.actions,{selectById:u}=this.selectors,d=n.getState(),h=u(e)(d);if(!h)throw new Error(`attempting to delete a document with uuid ${e} that does not exist in store.documents`);const p=Ph(e)(d);this.dispatch(a(e)),this.dispatch(l(D(p)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(A){throw this.dispatch(c(h)),this.dispatch(r(p)),A}}async refreshStore(e,n){const{initialize:a}=this.actions,c=this.list({queryParams:{project__organization:e}},n),r=this.list({queryParams:{organization:e}},n),u=(await Promise.all([c,r])).flat();return this.dispatch(a(u)),u}}class at extends et{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:m.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:m.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:m.GET,...s},e)}}class Bg extends at{constructor(){super(...arguments);y(this,"name","Email Domains");y(this,"url","/organization-email-domains");y(this,"actions",{addOne:bh,addMany:_h,setOne:Mh,setMany:Rh,updateOne:wh,updateMany:Eh,deleteOne:vh,deleteMany:Vh,initialize:gh});y(this,"selectors",{selectById:Bh,selectByIds:jh})}async add(e,n){return this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:{email:n,organization:e},blockers:[e,"create-org"],blocks:[]})}async delete(e){const{deleteOne:n,addOne:a}=this.actions;this.dispatch(n(e.uuid));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e.uuid}/`,blockers:[e.domain],blocks:[]})}catch(c){throw this.dispatch(a(e)),c}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class jg extends et{async getVerificationCode(s){return this.enqueueRequest({description:"Get verification code",method:m.GET,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}validateVerificationCode(s,e=void 0){return this.enqueueRequest({description:"Validate verification code",method:m.POST,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,payload:e,blockers:[],blocks:[]})}}const $t={},Dn=new Set;let Ut=0,Cn=0,$n=0;const qg=20;class Dg extends et{constructor(){super(...arguments);y(this,"host");y(this,"_dbPromise",VO.openDB("fileCache",1,{upgrade(e){e.createObjectStore("files")}}))}async renewUploadUrl(e){const n=await this.fetchCache(e);if(!n)throw new Error(`File with sha1 ${e} not found in cache`);const a=await Wt(n,e),c=await this.enqueueRequest({description:"Get S3 URL",method:m.GET,url:"/authentication/files/presigned-upload-url/",queryParams:{sha1:await it(n),file_type:n.type,extension:n.name.split(".").pop(),size:n.size.toString()},blockers:[],blocks:[`s3-${a}`]});return"url"in c&&this.dispatch($h({sha1:e,...c})),c}async addCache(e,n){if(Dn.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),Ut++):(await a.put("files",e,n),Cn++),Dn.add(n),$n++,$n%qg===0&&console.debug(`File cache summary: ${Ut} hits and ${Cn} misses, ${Ut/(Ut+Cn)*100}% hit rate over ${$n} calls to addCache.`)}async removeCache(e){await(await this._dbPromise).delete("files",e),Dn.delete(e)}async fetchCache(e){return(await this._dbPromise).get("files",e)}async getOrRenewUploadUrl(e){const n=this.client.store.getState();return Uh(e)(n)??await this.renewUploadUrl(e)}async uploadFileToS3(e){const n=await this.fetchCache(e);if(!n)throw new Error(`File with sha1 ${e} not found in cache`);const a=await Wt(n,e),c={file_name:n.name,file_sha1:e,file:a},r=await this.getOrRenewUploadUrl(e);if("warning"in r){if(r.warning==="already_uploaded")return[c,Promise.resolve(void 0)];throw new Error(r.warning)}const l=r.url,u=this.enqueueRequest({url:l,description:"Upload file",method:m.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:e,blockers:[`s3-${a}`],blocks:[e],s3url:r});return[c,u]}async fetchFileFromUrl(e,n,a){const c=e.split("?")[0]??e,r=await this.fetchCache(n);if(r){if(!r.name)throw new Error("Cached file unexpectedly has no name.");return r}if(e.startsWith("blob:")){const h=await ea(e),p=new File([h],a??n,{type:h.type});return await this.addCache(p,n),p}let l=$t[c],u=!0;l?u=!1:(l=new Promise(h=>{this.enqueueRequest({description:"Download file",method:m.GET,url:e,isExternalUrl:!0,isResponseBlob:!0,isAuthNeeded:!1,blockers:[n],blocks:[n]}).then(p=>{const A=new File([p],a??n,{type:p.type});h(A)})}),$t[c]=l);let d;try{d=await l}catch(h){throw u&&h instanceof U&&delete $t[c],h}if(u){const h=await it(d);if(h!==n){const f=`The hash of the file returned from the server (${h}) does not match the
|
|
8
|
+
`)}catch(a){console.error("Failed to extract error message from response body",a)}}else typeof t.body=="string"&&(e=t.body);else t!=null&&t.text?e=t.text:s instanceof Error&&(e=s.message);return!e||e.length>ng?at:e}class k extends Error{constructor(e){super(at);m(this,"status");m(this,"response");m(this,"message");m(this,"options");const{response:n,innerError:a}=e;this.message=e.message??ag(n,a)??at,this.status=(n==null?void 0:n.status)??0,this.response=n,e.discard=e.discard??!1,this.options=e}}function pO(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 cg extends aO{constructor(s){super(s)}}class tt extends aO{constructor(e,n){super(e);m(this,"auth");this.auth=n}}class dg extends tt{async startConversation(s,e){return this.enqueueRequest({description:"Start agent conversation",method:h.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:e},blockers:["prompt"],blocks:["prompt"]}).then(n=>(this.dispatch(ha(n)),n))}async continueConversation(s,e,n){return this.enqueueRequest({description:"Prompt agent",method:h.POST,url:"/agents/prompt/",payload:{prompt:s,active_project:n},blockers:["prompt"],blocks:["prompt"],queryParams:{conversation_id:e}}).then(a=>{this.dispatch(ya(a))})}async fetchDetails(s){return this.enqueueRequest({description:"Get agent conversation",method:h.GET,url:`/agents/conversations/${s}/`,blockers:["conversation"],blocks:["conversation"]}).then(e=>{this.dispatch(ma(e))})}async rate(s,e){return this.enqueueRequest({description:"Rate agent response",method:h.PUT,url:`/agents/responses/${s}/rate/`,payload:{rating:e},blockers:["rate"],blocks:["rate"]})}async list(s,e){return this.performRequest({method:h.GET,url:"/agents/conversations/",...s},e)}async refreshStore(s,e){const n=await this.list({queryParams:{project:s}},e);return this.dispatch(oa(n)),n}}function P(t,s,e){const n=`${s}${e?"s":""}`;switch(t){case h.GET:return`Get ${n}`;case h.POST:return`Create ${n}`;case h.PATCH:return`Update ${n}`;case h.PUT:return`Update ${n}`;case h.DELETE:return`Delete ${n}`}}class V extends tt{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:h.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:h.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:h.GET,...s},e)}}class Qe extends V{constructor(){super(...arguments);m(this,"pageSize",iO)}async _bulkAdd(e){var f;const{store:n}=this.client,{addMany:a,updateMany:c,deleteMany:r}=this.actions,l=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,u=new Date().toISOString(),d=[],o=[],y={};for(const I of e){const{modelUuid:g,file:F}=I,b=await this.client.files.getFilePayload(F);b.sha1 in y||(y[b.sha1]=b);const _=this.buildModel({file:F,file_sha1:b.sha1,submitted_at:u,created_by:l,modelUuid:g});d.push(_),o.push(this.buildPayload(_,b))}this.dispatch(a(d));const A=this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:u,attachments:o,files:Object.values(y)},blocks:d.map(I=>this.getId(I)),blockers:d.map(I=>I.file_sha1)});return A.then(({attachments:I,presigned_urls:g})=>{this.dispatch(c(I)),this.client.files.processPresignedUrls(g)}).catch(()=>{this.dispatch(r(d.map(I=>this.getId(I))))}),[d,A.then(({attachments:I})=>I)]}async _delete(e){const{store:n}=this.client,{addOne:a,deleteOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`Attempting to delete attachment with uuid ${e} that does not exist in the store`);this.dispatch(c(this.getId(l)));const u=this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.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 rg extends Qe{constructor(){super(...arguments);m(this,"name","Asset attachment");m(this,"url","/asset-attachments");m(this,"actions",{addOne:Ta,addMany:Qt,setOne:Sa,setMany:Ia,updateOne:Oa,updateMany:Pa,deleteOne:Fa,deleteMany:xt,initialize:fa});m(this,"selectors",{selectById:ba,selectByIds:_a})}getId(e){return e.uuid}buildModel(e){return R({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 ug extends Qe{constructor(){super(...arguments);m(this,"name","Asset Procedure Attachment");m(this,"url","/asset-procedure-type-attachments");m(this,"actions",{addOne:va,addMany:Va,setOne:za,setMany:Ba,updateOne:ja,updateMany:qa,deleteOne:Da,deleteMany:Ca,initialize:Ea});m(this,"selectors",{selectById:ka,selectByIds:La})}getId(e){return e.uuid}buildModel(e){return R({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 lg extends V{constructor(){super(...arguments);m(this,"name","Asset Procedure Type Fields Attachment");m(this,"url","/asset-procedure-type-fields-attachments");m(this,"actions",{addOne:Ha,addMany:Wa,setOne:Ka,setMany:Ya,updateOne:Za,updateMany:Ja,deleteOne:Xa,deleteMany:Qa,initialize:Ga});m(this,"selectors",{selectById:tc,selectByIds:sc})}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=[],o=[];for(const f of e){const{fieldsRevisionUuid:I,fieldIdentifier:g,file:F}=f,b=await this.client.files.getFilePayload(F);b.sha1 in u||(u[b.sha1]=b);const _=R({file:URL.createObjectURL(F),file_type:F.type,file_name:F.name,file_sha1:b.sha1,created_by:l,fields_revision:I,submitted_at:r,field_identifier:g});d.push(_);const v={uuid:_.uuid,file_name:F.name,field_identifier:g,file_extension:b.extension,file_sha1:b.sha1,fields_revision:I};o.push(v)}this.dispatch(n(d));const y=this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:o,files:Object.values(u)},blockers:d.map(f=>f.fields_revision),blocks:d.map(f=>f.uuid)});return y.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,y.then(({attachments:f})=>f)]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class og extends V{constructor(){super(...arguments);m(this,"name","Asset Procedure Type Fields");m(this,"url","/asset-procedure-type-fields");m(this,"actions",{addOne:ac,addMany:cc,setOne:dc,setMany:rc,updateOne:uc,updateMany:lc,deleteOne:oc,deleteMany:hc,initialize:nc});m(this,"selectors",{selectById:pc,selectByIds:Ac})}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=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[d.asset_procedure_type],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(r(d.uuid)),A}),[d,o]}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 xe(t,s){const e=[];let n=0;const a=t.length;for(;n<a;)e.push(t.slice(n,n+=s));return e}class hg extends V{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:Sc,addMany:ds,setOne:Ic,setMany:Oc,updateOne:Pc,updateMany:Fc,deleteOne:gc,deleteMany:rs,initialize:Tc});m(this,"selectors",{selectById:Mc,selectByIds:Rc})}async bulkAdd(e,n){var f;const{addMany:a,setMany:c,deleteMany:r}=this.actions,l=new Date().toISOString(),u=((f=this.client.store.getState().userReducer.currentUser)==null?void 0:f.id)??null,d=xe(e,Math.min(n??e.length,N)),o=[],y=[];for(const I of d){const g={},F=[];for(const b of I){const{fieldValuesUuid:_,fieldIdentifier:v,file:j}=b,B=await this.client.files.getFilePayload(j);B.sha1 in g||(g[B.sha1]=B);const D=R({file:URL.createObjectURL(j),file_type:j.type,file_name:j.name,file_sha1:B.sha1,created_by:u,field_values:_,submitted_at:l,field_identifier:v});o.push(D);const q={uuid:D.uuid,file_name:j.name,file_sha1:B.sha1,file_extension:B.extension,field_identifier:v,field_values:_};F.push(q)}y.push({submitted_at:l,attachments:F,files:Object.values(g)})}this.dispatch(a(o));const A=y.map(I=>this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:I,blockers:I.attachments.map(g=>g.field_values),blocks:I.attachments.map(g=>g.uuid)}));return Promise.all(A).then(I=>{for(const F of I)this.client.files.processPresignedUrls(F.presigned_urls);const g=I.flatMap(F=>F.attachments);this.dispatch(c(g))}).catch(I=>{throw this.dispatch(r(o.map(g=>g.uuid))),I}),[o,A.map(I=>I.then(({attachments:g})=>g))]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:r}=this.selectors,l=n.getState(),u=r(e)(l);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!0),method:h.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 mg extends V{constructor(){super(...arguments);m(this,"name","Asset Procedure Type Field Values");m(this,"url","/asset-procedure-type-field-values");m(this,"actions",{addOne:Vc,addMany:zc,setOne:Bc,setMany:jc,updateOne:qc,updateMany:Dc,deleteOne:Cc,deleteMany:$c,initialize:vc});m(this,"selectors",{selectById:Lc,selectByIds:Nc})}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(),o=R({...e,created_by:u,submitted_at:d}),y=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(o),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[o.uuid]});return this.dispatch(a(o)),y.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(o.uuid))}),[o,y]}bulkAdd(e,n){var g;const{values:a,payloads:c}=e,{addMany:r,setMany:l,deleteMany:u}=this.actions,d=new Date().toISOString(),o=((g=this.client.store.getState().userReducer.currentUser)==null?void 0:g.id)??null,y=[],A=xe(c,Math.min(n??c.length,N)),f=[];for(const F of A){const b=[];for(const _ of F){const v=R({..._,values:_.values,created_by:o,submitted_at:d});y.push(v),b.push({uuid:v.uuid,asset:_.asset,fields_revision:_.fields_revision,asset_procedure:_.asset_procedure,published_at:_.published_at,values:v.values})}f.push({submitted_at:d,values:a,field_values:b})}this.dispatch(r(y));const I=[];for(const F of f){const{field_values:b}=F,_=b.map(({asset:q})=>q),v=b.map(({fields_revision:q})=>q),j=b.map(({asset_procedure:q})=>q),B=b.map(({uuid:q})=>q),D=this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:F,blockers:_.concat(v).concat(j),blocks:B});I.push(D)}return Promise.all(I).then(F=>{this.dispatch(l(F.flat()))}).catch(()=>{this.dispatch(u(C(y)))}),[y,I]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`Expected AssetProcedureTypeFieldValues with uuid ${e.uuid} to exist`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[u.fields_revision,u.asset,u.asset_procedure],blocks:[u.uuid]});return d.then(o=>{this.dispatch(a(o))}).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=wc(e)(l);this.dispatch(a(e)),this.dispatch(rs(C(d)));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(c(u)),this.dispatch(ds(d)),o}}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 yg extends V{constructor(){super(...arguments);m(this,"name","Asset Procedure");m(this,"url","/asset-procedures");m(this,"actions",{addOne:Wc,addMany:hs,setOne:Jc,setMany:Xc,updateOne:Kc,updateMany:Yc,deleteOne:Zc,deleteMany:ms,initialize:Hc});m(this,"selectors",{selectById:td,selectByIds:sd})}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=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[e.asset_procedure_type,e.asset_type],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}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:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected asset procedure with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.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 pg extends V{constructor(){super(...arguments);m(this,"name","Asset Procedure Type");m(this,"url","/asset-procedure-types");m(this,"actions",{addOne:ad,addMany:cd,setOne:od,setMany:hd,updateOne:dd,updateMany:rd,deleteOne:ud,deleteMany:ld,initialize:nd});m(this,"selectors",{selectById:pd,selectByIds:Ad})}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=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}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:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected asset procedure type with uuid ${e} to exist`);const d=ed(e)(l);this.dispatch(a(e)),this.dispatch(ms(C(d)));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(c(u)),this.dispatch(hs(d)),o}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Ag extends V{constructor(){super(...arguments);m(this,"name","Asset Procedure Step Fields Attachment");m(this,"url","/asset-procedure-step-fields-attachments");m(this,"actions",{addOne:Sd,addMany:Id,setOne:Od,setMany:Pd,updateOne:Fd,updateMany:gd,deleteOne:bd,deleteMany:_d,initialize:Td});m(this,"selectors",{selectById:Rd,selectByIds:wd})}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=[],o=[];for(const f of e){const{fieldsRevisionUuid:I,fieldIdentifier:g,file:F}=f,b=await this.client.files.getFilePayload(F);b.sha1 in u||(u[b.sha1]=b);const _=R({file:URL.createObjectURL(F),file_type:F.type,file_name:F.name,file_sha1:b.sha1,created_by:l,fields_revision:I,submitted_at:r,field_identifier:g});d.push(_);const v={uuid:_.uuid,file_name:F.name,field_identifier:g,file_extension:b.extension,file_sha1:b.sha1,fields_revision:I};o.push(v)}this.dispatch(n(d));const y=this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:o,files:Object.values(u)},blockers:d.map(f=>f.fields_revision),blocks:d.map(f=>f.uuid)});return y.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,y.then(({attachments:f})=>f)]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__asset_procedure_step__organization:e}},n);return this.dispatch(a(c)),c}}class fg extends V{constructor(){super(...arguments);m(this,"name","Asset Procedure Step Fields");m(this,"url","/asset-procedure-step-fields");m(this,"actions",{addOne:zd,addMany:Bd,setOne:jd,setMany:qd,updateOne:Dd,updateMany:Cd,deleteOne:$d,deleteMany:Ud,initialize:Vd});m(this,"selectors",{selectById:kd,selectByIds:Ld})}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=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[d.asset_procedure_step],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(r(d.uuid)),A}),[d,o]}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:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${c.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return l.then(u=>{this.dispatch(a(u))}).catch(u=>{throw this.dispatch(a(c)),u}),[r,l]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,r=n.getState().assetProcedureStepFieldsReducer.instances[e];if(!r)throw new Error(`AssetProcedureStepFields with uuid ${e} not found`);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(l){throw this.dispatch(c(r)),l}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_step__asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class Tg extends V{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:Wd,addMany:Os,setOne:Kd,setMany:Yd,updateOne:Zd,updateMany:Jd,deleteOne:Xd,deleteMany:Ps,initialize:Hd});m(this,"selectors",{selectById:xd,selectByIds:er})}async bulkAdd(e,n){var f;const{addMany:a,setMany:c,deleteMany:r}=this.actions,l=new Date().toISOString(),u=((f=this.client.store.getState().userReducer.currentUser)==null?void 0:f.id)??null,d=xe(e,Math.min(n??e.length,N)),o=[],y=[];for(const I of d){const g={},F=[];for(const b of I){const{fieldValuesUuid:_,fieldIdentifier:v,file:j}=b,B=await this.client.files.getFilePayload(j);B.sha1 in g||(g[B.sha1]=B);const D=R({file:URL.createObjectURL(j),file_type:j.type,file_name:j.name,file_sha1:B.sha1,created_by:u,field_values:_,submitted_at:l,field_identifier:v});o.push(D);const q={uuid:D.uuid,file_name:j.name,file_sha1:B.sha1,file_extension:B.extension,field_identifier:v,field_values:_};F.push(q)}y.push({submitted_at:l,attachments:F,files:Object.values(g)})}this.dispatch(a(o));const A=y.map(I=>this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:I,blockers:I.attachments.map(g=>g.field_values),blocks:I.attachments.map(g=>g.uuid)}));return Promise.all(A).then(I=>{for(const F of I)this.client.files.processPresignedUrls(F.presigned_urls);const g=I.flatMap(F=>F.attachments);this.dispatch(c(g))}).catch(I=>{throw this.dispatch(r(o.map(g=>g.uuid))),I}),[o,A.map(I=>I.then(({attachments:g})=>g))]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:r}=this.selectors,l=n.getState(),u=r(e)(l);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!0),method:h.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 Sg extends V{constructor(){super(...arguments);m(this,"name","Asset Procedure Step Field Values");m(this,"url","/asset-procedure-step-field-values");m(this,"actions",{addOne:ar,addMany:cr,setOne:dr,setMany:rr,updateOne:ur,updateMany:lr,deleteOne:or,deleteMany:hr,initialize:nr});m(this,"selectors",{selectById:yr,selectByIds:pr})}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(),o=R({...e,created_by:u,submitted_at:d}),y=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(o),blockers:[e.asset,e.fields_revision,e.asset_procedure],blocks:[o.uuid]});return this.dispatch(a(o)),y.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(o.uuid))}),[o,y]}bulkAdd(e,n){var g;const{payloads:a,values:c}=e,{addMany:r,setMany:l,deleteMany:u}=this.actions,d=new Date().toISOString(),o=((g=this.client.store.getState().userReducer.currentUser)==null?void 0:g.id)??null,y=[],A=xe(a,Math.min(n??a.length,N)),f=[];for(const F of A){const b=[];for(const _ of F){const v=R({..._,values:_.values,created_by:o,submitted_at:d});y.push(v),b.push({uuid:v.uuid,asset:_.asset,fields_revision:_.fields_revision,asset_procedure:_.asset_procedure,asset_procedure_step:_.asset_procedure_step,published_at:_.published_at,values:v.values})}f.push({submitted_at:d,values:c,field_values:b})}this.dispatch(r(y));const I=[];for(const F of f){const{field_values:b}=F,_=b.map(({asset:q})=>q),v=b.map(({fields_revision:q})=>q),j=b.map(({asset_procedure:q})=>q),B=b.map(({uuid:q})=>q),D=this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:F,blockers:_.concat(v).concat(j),blocks:B});I.push(D)}return Promise.all(I).then(F=>{this.dispatch(l(F.flat()))}).catch(()=>{this.dispatch(u(C(y)))}),[y,I]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`Expected AssetProcedureStepFieldValues with uuid ${e.uuid} to exist`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[u.fields_revision,u.asset,u.asset_procedure],blocks:[u.uuid]});return d.then(o=>{this.dispatch(a(o))}).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=tr(e)(l);this.dispatch(a(e)),this.dispatch(Ps(C(d)));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(c(u)),this.dispatch(Os(d)),o}}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 Ig extends V{constructor(){super(...arguments);m(this,"name","Asset Procedure Step");m(this,"url","/asset-procedure-steps");m(this,"actions",{addOne:Or,addMany:Pr,setOne:Sr,setMany:Ir,updateOne:Fr,updateMany:gr,deleteOne:br,deleteMany:_r,initialize:Tr});m(this,"selectors",{selectById:Rr,selectByIds:wr})}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=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[d.asset_procedure_type],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}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:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${r.uuid}/`,payload:{name:e.name,description:e.description,priority:e.order,color:e.color},blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteMany:a,addMany:c,addOne:r,deleteOne:l}=this.actions,{selectById:u}=this.selectors,d=n.getState(),o=u(e)(d);if(!o)throw new Error(`No asset procedure step with uuid ${e} found in the store`);const y=Er(e)(d);this.dispatch(l(e)),this.dispatch(a(C(y)));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(A){throw this.dispatch(r(o)),this.dispatch(c(y)),A}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_procedure_type__organization:e}},n);return this.dispatch(a(c)),c}}class Og extends V{constructor(){super(...arguments);m(this,"url","/assets");m(this,"name","Asset");m(this,"actions",{addOne:zr,addMany:Rs,setOne:Dr,setMany:Cr,updateOne:Br,updateMany:jr,deleteOne:qr,deleteMany:ws,initialize:Vr});m(this,"selectors",{selectById:Ur,selectByIds:kr})}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=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[d.asset_type],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}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:P(h.PATCH,this.name,!1),method:h.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=Ma(e)(l),o=xy(e)(l);this.dispatch(c(e)),this.dispatch(xt(C(d))),this.dispatch(vt(C(o)));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(y){throw this.dispatch(a(u)),this.dispatch(Qt(d)),this.dispatch(Et(o)),y}}bulkAdd(e,n){const{addMany:a}=this.actions,c=new Date().toISOString(),r=et.v4(),l=xe(e,Math.min(n??e.length,N)).map(o=>{const y=o.map(A=>R(A));return{batchId:et.v4(),payload:{transaction_id:r,submitted_at:c,assets:y}}}),u=[];let d=null;for(const o of l){const{batchId:y,payload:A}=o,f=A.assets.map(({uuid:v})=>v),I=A.assets.map(({asset_type:v})=>v),g=A.assets.map(({project:v})=>v),F=I.concat(g);d&&F.push(d);const b=f;b.push(y);const _=this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:A,blockers:F,blocks:b});d=o.batchId,u.push(_)}return Promise.all(u).then(o=>{const y=o.flat();this.dispatch(a(y))}),u}bulkUpdate(e,n){const{store:a}=this.client,{updateMany:c}=this.actions,{selectByIds:r}=this.selectors,l=C(e).toSorted(ft);if(l.length!==e.length)throw new Error("payloads contains duplicate uuids.");const u=r(l)(a.getState()).toSorted(Yt);if(l.length!=u.length)throw new Error(`Attempting to bulk update ${l.length-u.length} assets that dont exist in the store`);const d=[];for(let f=0;f<l.length;f++)d.push({...u[f],...e[f]});this.dispatch(c(d));const o=xe(e,Math.min(n??e.length,N)),y=[];let A=null;for(const f of o){const I=et.v4(),g=C(f),F=f.map(({status:_})=>_).filter(Boolean),b=this.enqueueRequest({description:P(h.PATCH,this.name,!0),method:h.PATCH,url:`${this.url}/bulk/`,payload:{payloads:f},blockers:g.concat(F).concat(A?[A]:[]),blocks:g.concat([I])});y.push(b),A=I}return Promise.all(y).then(f=>{this.dispatch(c(f.flat()))}).catch(()=>{this.dispatch(c(u))}),[d,y]}async bulkDelete(e){const{store:n}=this.client,{addMany:a,deleteMany:c}=this.actions,{selectByIds:r}=this.selectors,l=n.getState(),u=r(e)(l);this.dispatch(c(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!0),method:h.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 V{constructor(){super(...arguments);m(this,"name","Asset Stage Completion");m(this,"url","/asset-stage-completions");m(this,"actions",{addOne:Hr,addMany:Wr,setOne:Kr,setMany:Yr,updateOne:Zr,updateMany:Jr,deleteOne:Xr,deleteMany:Qr,initialize:Gr});m(this,"selectors",{selectById:su,selectByIds:iu})}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=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[e.asset,e.asset_stage],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`Expected asset stage completion with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}bulkAdd(e){var f;const{store:n}=this.client,{addMany:a,setMany:c,deleteMany:r}=this.actions,l=new Date().toISOString(),u=((f=n.getState().userReducer.currentUser)==null?void 0:f.id)??null,d=e.map(I=>R(I)),o=d.map(I=>({...I,created_by:u,submitted_at:l})),y=o.map(({uuid:I})=>I);this.dispatch(a(o));const A=this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:l,completions:d},blockers:[...e.map(I=>I.asset_procedure),...e.map(I=>I.asset_stage),...e.map(I=>I.asset)],blocks:y});return A.then(I=>{this.dispatch(c(I))}).catch(()=>{this.dispatch(r(y))}),[o,A]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:r}=this.selectors,l=r(e)(n.getState());this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!0),method:h.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{asset_procedure__project:e}},n)).flat();return this.dispatch(a(r)),r}}class Fg extends V{constructor(){super(...arguments);m(this,"name","Asset Stage");m(this,"url","/asset-stages");m(this,"actions",{addOne:ru,addMany:uu,setOne:cu,setMany:du,updateOne:lu,updateMany:ou,deleteOne:hu,deleteMany:mu,initialize:au});m(this,"selectors",{selectById:pu,selectByIds:Au})}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=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[d.asset_procedure_type],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}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:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${r.uuid}/`,payload:e,blockers:[r.uuid],blocks:[r.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`No asset stage with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.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 gg extends Qe{constructor(){super(...arguments);m(this,"name","Asset Type Attachment");m(this,"url","/asset-type-attachments");m(this,"actions",{addOne:Su,addMany:Ds,setOne:Iu,setMany:Ou,updateOne:Pu,updateMany:Fu,deleteOne:gu,deleteMany:Cs,initialize:Tu});m(this,"selectors",{selectById:_u,selectByIds:Mu})}getId(e){return e.uuid}buildModel(e){return R({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 bg extends V{constructor(){super(...arguments);m(this,"name","Asset Type Fields Attachment");m(this,"url","/asset-type-fields-attachments");m(this,"actions",{addOne:Vu,addMany:zu,setOne:Bu,setMany:ju,updateOne:qu,updateMany:Du,deleteOne:Cu,deleteMany:$u,initialize:vu});m(this,"selectors",{selectById:ku,selectByIds:Lu})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],o=[];for(const f of e){const{fieldsRevisionUuid:I,fieldIdentifier:g,file:F}=f,b=await this.client.files.getFilePayload(F);b.sha1 in u||(u[b.sha1]=b);const _=R({file:URL.createObjectURL(F),file_type:F.type,file_name:F.name,file_sha1:b.sha1,created_by:l,fields_revision:I,submitted_at:r,field_identifier:g});d.push(_);const v={uuid:_.uuid,file_name:F.name,field_identifier:g,file_extension:b.extension,file_sha1:b.sha1,fields_revision:I};o.push(v)}this.dispatch(n(d));const y=this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:o,files:Object.values(u)},blockers:d.map(f=>f.fields_revision),blocks:d.map(f=>f.uuid)});return y.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,y.then(({attachments:f})=>f)]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class _g extends V{constructor(){super(...arguments);m(this,"name","Asset Type Fields");m(this,"url","/asset-type-fields");m(this,"actions",{addOne:Wu,addMany:Ku,setOne:Yu,setMany:Zu,updateOne:Ju,updateMany:Xu,deleteOne:Qu,deleteMany:xu,initialize:Hu});m(this,"selectors",{selectById:tl,selectByIds:sl})}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=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[d.asset_type],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(r(d.uuid)),A}),[d,o]}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 Mg extends V{constructor(){super(...arguments);m(this,"name","Asset Type Field Values Attachment");m(this,"url","/asset-type-field-values-attachments");m(this,"actions",{addOne:cl,addMany:Gs,setOne:dl,setMany:rl,updateOne:ul,updateMany:ll,deleteOne:ol,deleteMany:Hs,initialize:al});m(this,"selectors",{selectById:ml,selectByIds:yl})}async bulkAdd(e,n){var f;const{addMany:a,setMany:c,deleteMany:r}=this.actions,l=new Date().toISOString(),u=((f=this.client.store.getState().userReducer.currentUser)==null?void 0:f.id)??null,d=xe(e,Math.min(n??e.length,N)),o=[],y=[];for(const I of d){const g={},F=[];for(const b of I){const{fieldValuesUuid:_,fieldIdentifier:v,file:j}=b,B=await this.client.files.getFilePayload(j);B.sha1 in g||(g[B.sha1]=B);const D=R({file:URL.createObjectURL(j),file_type:j.type,file_name:j.name,file_sha1:B.sha1,created_by:u,field_values:_,submitted_at:l,field_identifier:v});o.push(D);const q={uuid:D.uuid,file_name:j.name,file_sha1:B.sha1,file_extension:B.extension,field_identifier:v,field_values:_};F.push(q)}y.push({submitted_at:l,attachments:F,files:Object.values(g)})}this.dispatch(a(o));const A=y.map(I=>this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:I,blockers:I.attachments.map(g=>g.field_values),blocks:I.attachments.map(g=>g.uuid)}));return Promise.all(A).then(I=>{for(const F of I)this.client.files.processPresignedUrls(F.presigned_urls);const g=I.flatMap(F=>F.attachments);this.dispatch(c(g))}).catch(I=>{throw this.dispatch(r(o.map(g=>g.uuid))),I}),[o,A.map(I=>I.then(({attachments:g})=>g))]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:r}=this.selectors,l=n.getState(),u=r(e)(l);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!0),method:h.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 Rg extends V{constructor(){super(...arguments);m(this,"name","Asset Type Field Values");m(this,"url","/asset-type-field-values");m(this,"actions",{addOne:Sl,addMany:Il,setOne:Ol,setMany:Pl,updateOne:Fl,updateMany:gl,deleteOne:bl,deleteMany:_l,initialize:Tl});m(this,"selectors",{selectById:Rl,selectByIds:wl})}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(),o=R({...e,created_by:u,submitted_at:d}),y=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(o),blockers:[e.asset,e.fields_revision],blocks:[o.uuid]});return this.dispatch(a(o)),y.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(o.uuid))}),[o,y]}bulkAdd(e,n){var I;const{payloads:a,values:c}=e,{addMany:r,setMany:l,deleteMany:u}=this.actions,d=new Date().toISOString(),o=[],y=xe(a,Math.min(n??a.length,N)),A=[];for(const g of y){const F=[];for(const b of g){const _=R({...b,values:b.values,created_by:((I=this.client.store.getState().userReducer.currentUser)==null?void 0:I.id)??null,submitted_at:d});o.push(_),F.push({uuid:_.uuid,asset:b.asset,fields_revision:b.fields_revision,published_at:b.published_at,values:_.values})}A.push({submitted_at:d,values:c,field_values:F})}this.dispatch(r(o));const f=[];for(const g of A){const{field_values:F}=g,b=F.map(({asset:B})=>B),_=F.map(({fields_revision:B})=>B),v=F.map(({uuid:B})=>B),j=this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:g,blockers:b.concat(_),blocks:v});f.push(j)}return Promise.all(f).then(g=>{this.dispatch(l(g.flat()))}).catch(()=>{this.dispatch(u(C(o)))}),[o,f]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`Expected AssetTypeFieldValues with uuid ${e.uuid} to exist`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[u.uuid,u.fields_revision,u.asset],blocks:[u.uuid]});return d.then(o=>{this.dispatch(a(o))}).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=pl(e)(l);this.dispatch(a(e)),this.dispatch(Hs(C(d)));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(c(u)),this.dispatch(Gs(d)),o}}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 wg extends V{constructor(){super(...arguments);m(this,"name","Asset Type Identifier");m(this,"url","/asset-type-identifiers");m(this,"actions",{addOne:zl,addMany:Bl,setOne:jl,setMany:ql,updateOne:Dl,updateMany:Cl,deleteOne:$l,deleteMany:Ul,initialize:Vl});m(this,"selectors",{selectById:Ll,selectByIds:Nl})}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=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[d.asset_type],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}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:P(h.PATCH,this.name,!1),method:h.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:P(h.DELETE,this.name,!1),method:h.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 Eg extends V{constructor(){super(...arguments);m(this,"name","Asset Type Identifier Value");m(this,"url","/asset-type-identifier-values");m(this,"actions",{addOne:Kl,addMany:Yl,setOne:Zl,setMany:Jl,updateOne:Xl,updateMany:Ql,deleteOne:xl,deleteMany:eo,initialize:Wl});m(this,"selectors",{selectById:so,selectByIds:io})}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=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[e.asset,e.asset_type_identifier],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}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:P(h.PATCH,this.name,!1),method:h.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:P(h.DELETE,this.name,!1),method:h.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 vg extends V{constructor(){super(...arguments);m(this,"name","Asset Type");m(this,"url","/asset-types");m(this,"actions",{addOne:lo,addMany:oo,setOne:ro,setMany:uo,updateOne:ho,updateMany:mo,deleteOne:yo,deleteMany:po,initialize:co});m(this,"selectors",{selectById:fo,selectByIds:To})}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=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}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:P(h.PATCH,this.name,!1),method:h.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=vs(e)(l),o=Ru(e)(l);this.dispatch(a(e)),this.dispatch(ws(C(d))),this.dispatch(Cs(C(o)));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(y){throw this.dispatch(c(u)),this.dispatch(Rs(d)),this.dispatch(Ds(o)),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 Vg extends V{constructor(){super(...arguments);m(this,"name","Asset Type Status");m(this,"url","/asset-type-statuses");m(this,"actions",{addOne:Po,addMany:Fo,setOne:go,setMany:bo,updateOne:_o,updateMany:Mo,deleteOne:Ro,deleteMany:wo,initialize:Oo});m(this,"selectors",{selectById:vo,selectByIds:Vo})}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=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[e.asset_type],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}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:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`No asset type status with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{asset_type__organization:e}},n);return this.dispatch(a(c)),c}}class zg extends V{constructor(){super(...arguments);m(this,"name","Category");m(this,"url","/categories");m(this,"actions",{addOne:$o,addMany:Uo,setOne:ko,setMany:Lo,updateOne:No,updateMany:Go,deleteOne:Ho,deleteMany:Wo,initialize:Co});m(this,"selectors",{selectById:ii,selectByIds:Yo})}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=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[e.project],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}update(e){const{updateOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),r=a(e.uuid)(c);if(!r)throw new Error(`Expected an existing category with uuid ${e.uuid}`);const l={...r,...e};this.dispatch(n(l));const u=this.enqueueRequest({description:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`No category with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${l.uuid}/`,blockers:[l.uuid],blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{project__organization:e}},n);return this.dispatch(a(c)),c}}class Bg extends Qe{constructor(){super(...arguments);m(this,"name","Document Attachment");m(this,"url","/document-attachments");m(this,"actions",{addOne:Qo,addMany:xo,setOne:eh,setMany:th,updateOne:sh,updateMany:ih,deleteOne:nh,deleteMany:ah,initialize:Xo});m(this,"selectors",{selectById:dh,selectByIds:rh})}getId(e){return e.uuid}buildModel(e){return R({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,document:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,document:e.document}}async bulkAdd(e){var I;const{store:n}=this.client,{addMany:a,updateMany:c,deleteMany:r}=this.actions,l=((I=n.getState().userReducer.currentUser)==null?void 0:I.id)??null,u=new Date().toISOString(),d=[],o=[],y={},A={};for(const g of e){const{documentUuid:F,file:b}=g,_=await this.client.files.getFilePayload(b);_.sha1 in y||(y[_.sha1]=_,A[_.sha1]=[]);const v=this.buildModel({file:b,file_sha1:_.sha1,submitted_at:u,created_by:l,modelUuid:F});d.push(v),o.push(this.buildPayload(v,_)),A[_.sha1].push(v.uuid)}this.dispatch(a(d));const f=this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:u,attachments:o,files:Object.values(y)},blocks:d.map(g=>g.uuid),blockers:d.map(g=>g.file_sha1)});return f.then(({attachments:g,presigned_urls:F})=>{this.dispatch(c(g));const b=this.client.files.processPresignedUrls(F);for(const[_,v]of Object.entries(b))v.then(()=>{const j=A[_];for(const B of j)this.makeReadable(B)})}).catch(()=>{this.dispatch(r(d.map(g=>g.uuid)))}),[d,f.then(({attachments:g})=>g)]}async delete(e){return this._delete(e)}makeReadable(e){this.enqueueRequest({description:"Add attachment to AI assistant",method:h.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 jg extends V{constructor(){super(...arguments);m(this,"name","Document");m(this,"url","/documents");m(this,"actions",{addOne:hh,addMany:mh,setOne:yh,setMany:ph,updateOne:Ah,updateMany:fh,deleteOne:Th,deleteMany:Sh,initialize:oh});m(this,"selectors",{selectById:Oh,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=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:d.parent_document?[d.parent_document]:[],blocks:[d.uuid]});return o.then(A=>{this.dispatch(r(A))}).catch(()=>{this.dispatch(c(d.uuid))}),[d,o]}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:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c,addMany:r,deleteMany:l}=this.actions,{selectById:u}=this.selectors,d=n.getState(),o=u(e)(d);if(!o)throw new Error(`attempting to delete a document with uuid ${e} that does not exist in store.documents`);const y=Fh(e)(d);this.dispatch(a(e)),this.dispatch(l(C(y)));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(A){throw this.dispatch(c(o)),this.dispatch(r(y)),A}}async refreshStore(e,n){const{initialize:a}=this.actions,c=this.list({queryParams:{project__organization:e}},n),r=this.list({queryParams:{organization:e}},n),u=(await Promise.all([c,r])).flat();return this.dispatch(a(u)),u}}class ct extends tt{async get(s,e){return this.performRequest({url:`${this.url}/${s}/`,method:h.GET},e)}async list(s,e){return this.performRequest({url:`${this.url}/`,method:h.GET,...s},e)}async listPaginated(s,e){return this.performPagination({url:`${this.url}/`,method:h.GET,...s},e)}}class qg extends ct{constructor(){super(...arguments);m(this,"name","Email Domains");m(this,"url","/organization-email-domains");m(this,"actions",{addOne:_h,addMany:Mh,setOne:Rh,setMany:wh,updateOne:Eh,updateMany:vh,deleteOne:Vh,deleteMany:zh,initialize:bh});m(this,"selectors",{selectById:jh,selectByIds:qh})}async add(e,n){return this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:{email:n,organization:e},blockers:[e,"create-org"],blocks:[]})}async delete(e){const{deleteOne:n,addOne:a}=this.actions;this.dispatch(n(e.uuid));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.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 Dg extends tt{async getVerificationCode(s){return this.enqueueRequest({description:"Get verification code",method:h.GET,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}validateVerificationCode(s,e=void 0){return this.enqueueRequest({description:"Validate verification code",method:h.POST,url:`/verification/email-verification/${s}/`,isAuthNeeded:!1,payload:e,blockers:[],blocks:[]})}}const Ut={},Cn=new Set;let kt=0,$n=0,Un=0;const Cg=20;class $g extends tt{constructor(){super(...arguments);m(this,"host");m(this,"_dbPromise",jO.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:h.GET,url:"/authentication/files/presigned-upload-url/",queryParams:{sha1:await nt(n),file_type:n.type,extension:n.name.split(".").pop(),size:n.size.toString()},blockers:[],blocks:[`s3-${a}`]});return"url"in c&&this.dispatch(Uh({sha1:e,...c})),c}async addCache(e,n){if(Cn.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),kt++):(await a.put("files",e,n),$n++),Cn.add(n),Un++,Un%Cg===0&&console.debug(`File cache summary: ${kt} hits and ${$n} misses, ${kt/(kt+$n)*100}% hit rate over ${Un} calls to addCache.`)}async removeCache(e){await(await this._dbPromise).delete("files",e),Cn.delete(e)}async fetchCache(e){return(await this._dbPromise).get("files",e)}async getOrRenewUploadUrl(e){const n=this.client.store.getState();return kh(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:h.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 o=await ta(e),y=new File([o],a??n,{type:o.type});return await this.addCache(y,n),y}let l=Ut[c],u=!0;l?u=!1:(l=new Promise(o=>{this.enqueueRequest({description:"Download file",method:h.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});o(A)})}),Ut[c]=l);let d;try{d=await l}catch(o){throw u&&o instanceof k&&delete Ut[c],o}if(u){const o=await nt(d);if(o!==n){const f=`The hash of the file returned from the server (${o}) does not match the
|
|
9
9
|
expected hash (${n}). This can happen if you're using a local development server and the
|
|
10
10
|
isExternalUrl flag in the request details is set to true, because instead of requesting the local
|
|
11
11
|
REST API, you will be requesting localhost:80 (where this app runs), resulting in a transformed blob
|
|
12
12
|
(with an uuid attached) being returned. Alternatively, you may be running with
|
|
13
13
|
import.meta.env.PROD, which will result in some file requests being treated as
|
|
14
|
-
external URLs and therefore not prepended with VITE_API_URL.`;throw new Error(f)}const p=d.type.split("/")[1];if(!p)throw new Error("File has no extension");const A=a??h+"."+p;if(d=xn(d,A),!d.name)throw new Error("Failed to set file's name");await this.addCache(d,h),$t[c]=new Promise(f=>{f(d)})}return d}processPresignedUrls(e){const n={};for(const[a,c]of Object.entries(e))n[a]=this.enqueueRequest({url:c.url,description:"Upload file to S3",method:m.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:a,blockers:[`s3-${c.fields.key}`],blocks:[a],s3url:c});return n}async getFilePayload(e){const n=await it(e),a={sha1:n,file_type:e.type,extension:e.name.split(".").pop(),size:e.size};return await this.client.files.addCache(e,n),a}}class Cg extends v{constructor(){super(...arguments);y(this,"name","Form Identifier");y(this,"url","/form-identifiers");y(this,"actions",{addOne:Hh,addMany:Gh,setOne:Wh,setMany:Kh,updateOne:Yh,updateMany:Zh,deleteOne:Jh,deleteMany:Xh,initialize:Nh});y(this,"selectors",{selectById:xh,selectByIds:em})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.form],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected form identifier with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected form identifier with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{form__organization:e}},n);return this.dispatch(a(c)),c}}class $g extends v{constructor(){super(...arguments);y(this,"name","Form Identifier Value");y(this,"url","/form-identifier-values");y(this,"actions",{addOne:nm,addMany:am,setOne:cm,setMany:dm,updateOne:rm,updateMany:um,deleteOne:lm,deleteMany:om,initialize:im});y(this,"selectors",{selectById:mm,selectByIds:ym})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.form_submission,e.form_identifier],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected form identifier value with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected form identifier value with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{form_submission__form_revision__form__organization:e}},n)).flat();return this.dispatch(a(r)),r}}class Ug extends v{constructor(){super(...arguments);y(this,"name","Form Revision Attachment");y(this,"url","/form-revision-attachments");y(this,"actions",{addOne:Sm,addMany:Tm,setOne:Im,setMany:Om,updateOne:Pm,updateMany:Fm,deleteOne:gm,deleteMany:bm,initialize:fm});y(this,"selectors",{selectById:Mm,selectByIds:Rm})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],h=[];for(const f of e){const{revisionUuid:I,fieldIdentifier:F,file:P}=f,g=await this.client.files.getFilePayload(P);g.sha1 in u||(u[g.sha1]=g);const b=M({file:URL.createObjectURL(P),file_type:P.type,file_name:P.name,file_sha1:g.sha1,created_by:l,form_revision:I,submitted_at:r,field_identifier:F});d.push(b);const E={uuid:b.uuid,file_name:P.name,field_identifier:F,file_extension:g.extension,file_sha1:g.sha1,form_revision:I};h.push(E)}this.dispatch(n(d));const p=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(f=>f.form_revision),blocks:d.map(f=>f.uuid)});return p.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,p.then(({attachments:f})=>f)]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{form_revision__form__organization:e}},n);return this.dispatch(a(c)),c}}class Lg extends v{constructor(){super(...arguments);y(this,"name","Form Revision");y(this,"url","/form-revisions");y(this,"actions",{addOne:pi,addMany:Ai,setOne:Vm,setMany:zm,updateOne:Bm,updateMany:jm,deleteOne:fi,deleteMany:Si,initialize:vm});y(this,"selectors",{selectById:qm,selectByIds:Dm})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),h=M({...e,created_by:u,submitted_at:d});this.dispatch(a(h));const p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[e.form],blocks:[h.uuid]});return p.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(h.uuid))}),[h,p]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{form__organization:e}},n);return this.dispatch(a(c)),c}}class kg extends v{constructor(){super(...arguments);y(this,"name","Form");y(this,"url","/forms");y(this,"actions",{addOne:km,addMany:Nm,setOne:Hm,setMany:Gm,updateOne:Wm,updateMany:Km,deleteOne:Ym,deleteMany:Zm,initialize:Lm});y(this,"selectors",{selectById:Qm,selectByIds:xm})}add(e,n){var A;const{store:a}=this.client,{addOne:c,deleteOne:r}=this.actions,l=new Date().toISOString(),u=((A=a.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=M({...e,submitted_at:l,created_by:u}),h=M({...n,form:d.uuid,submitted_at:l,created_by:u});this.dispatch(c(d)),this.dispatch(pi(h));const p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:{...V(d),initial_revision:{uuid:h.uuid,submitted_at:h.submitted_at,title:h.title,description:h.description,fields:h.fields}},blockers:[],blocks:[d.uuid,h.uuid]});return p.catch(f=>{throw this.dispatch(r(d.uuid)),this.dispatch(fi(h.uuid)),f}),[d,h,p]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error("Expected form to exist");const d=Fy(e)(l),h=Cm(e)(l);this.dispatch(a(e)),this.dispatch(Ei(D(d))),this.dispatch(Si(D(h)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(p){throw this.dispatch(c(u)),this.dispatch(Ai(h)),this.dispatch(wi(d)),p}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Ng extends v{constructor(){super(...arguments);y(this,"name","Form Submission Attachment");y(this,"url","/form-submission-attachments");y(this,"actions",{addOne:sy,addMany:Fi,setOne:iy,setMany:ny,updateOne:ay,updateMany:cy,deleteOne:dy,deleteMany:gi,initialize:ty});y(this,"selectors",{selectById:ry,selectByIds:uy})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],h=[];for(const f of e){const{submissionUuid:I,fieldIdentifier:F,file:P}=f,g=await this.client.files.getFilePayload(P);g.sha1 in u||(u[g.sha1]=g);const b=M({file:URL.createObjectURL(P),file_type:P.type,file_name:P.name,file_sha1:g.sha1,created_by:l,form_submission:I,submitted_at:r,field_identifier:F});d.push(b);const E={uuid:b.uuid,file_name:P.name,file_sha1:g.sha1,file_extension:g.extension,field_identifier:F,form_submission:I};h.push(E)}this.dispatch(n(d));const p=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(f=>f.form_submission),blocks:d.map(f=>f.uuid)});return p.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(f=>{throw this.dispatch(c(d.map(I=>I.uuid))),f}),[d,p.then(({attachments:f})=>f)]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,r=n.getState(),l=Mi(e)(r);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{form_submission__form_revision__form__organization:e}},n)).flat();return this.dispatch(a(r)),r}}class Hg extends v{constructor(){super(...arguments);y(this,"name","Form Submission");y(this,"url","/form-submissions");y(this,"actions",{addOne:Ay,addMany:wi,setOne:yy,setMany:py,updateOne:fy,updateMany:Sy,deleteOne:Ty,deleteMany:Ei,initialize:my});y(this,"selectors",{selectById:Oy,selectByIds:Py})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),h=M({...e,created_by:u,submitted_at:d}),p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[e.form_revision],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(h.uuid))}),[h,p]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`Expected submission with uuid ${e.uuid} to exist`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${u.uuid}/`,payload:e,blockers:[u.uuid],blocks:[u.uuid]});return d.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected submission with uuid ${e} to exist`);const d=ly(e)(l);this.dispatch(a(e)),this.dispatch(gi(D(d)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(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 Gg extends v{constructor(){super(...arguments);y(this,"name","Geo Image");y(this,"url","/geo-images");y(this,"actions",{addOne:wy,addMany:Ey,setOne:My,setMany:Ry,updateOne:vy,updateMany:Vy,deleteOne:zy,deleteMany:By,initialize:_y});y(this,"selectors",{selectById:qy,selectByIds:Dy})}async add(e){var F;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,{file:l,...u}=e,d=new Date().toISOString(),h=((F=n.getState().userReducer.currentUser)==null?void 0:F.id)??null,p=u.project,A=await this.client.files.getFilePayload(l),f=M({...u,file_name:l.name,file_sha1:A.sha1,file_type:l.type,file:URL.createObjectURL(l),submitted_at:d,created_by:h});this.dispatch(a(f));const I=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:{uuid:f.uuid,submitted_at:d,title:f.title,description:f.description,geo_marker:f.geo_marker,canvas_marker:f.canvas_marker,sha1:f.file_sha1,project:f.project,file_name:f.file_name,direction:f.direction,original_date:f.original_date,file:A},blocks:[p],blockers:[p]});return I.then(P=>{this.client.files.processPresignedUrls(P.presigned_urls),this.dispatch(c(P.geo_image))}).catch(()=>{this.dispatch(r(f.uuid))}),[f,I.then(P=>P.geo_image)]}async bulkAdd(e,n){var F;const{store:a}=this.client,{addMany:c,setMany:r,deleteMany:l}=this.actions,u=new Date().toISOString(),d=((F=a.getState().userReducer.currentUser)==null?void 0:F.id)??null,h=[],p=[],A=[],f={};for(const P of e){const{file:g,...b}=P,E=await this.client.files.getFilePayload(g);E.sha1 in f||(f[E.sha1]=E);const B=M({...b,file_name:g.name,file_sha1:E.sha1,file_type:g.type,file:URL.createObjectURL(g),submitted_at:u,created_by:d,project:n});h.push(B),p.push(B.uuid),A.push({uuid:B.uuid,sha1:B.file_sha1,file_name:B.file_name,title:B.title,description:B.description,geo_marker:B.geo_marker,canvas_marker:B.canvas_marker,direction:B.direction,original_date:B.original_date})}this.dispatch(c(h));const I=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:u,project:n,geo_images:A,files:Object.values(f)},blocks:[n],blockers:p});return I.then(P=>{this.client.files.processPresignedUrls(P.presigned_urls),this.dispatch(r(P.geo_images))}).catch(()=>{this.dispatch(l(p))}),[h,I.then(P=>P.geo_images)]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`Map image with uuid ${e.uuid} does not exist in the store`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return d.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Map image with uuid ${e} does not exist in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blocks:[e],blockers:[e]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.listPaginated({queryParams:{project:e}},n),r=c.flat();return this.dispatch(a(r)),c}}class Wg extends v{constructor(){super(...arguments);y(this,"name","Issue Association");y(this,"url","/issue-associations");y(this,"actions",{addOne:Gy,addMany:wt,setOne:ky,setMany:Ly,updateOne:Ny,updateMany:Hy,deleteOne:Wy,deleteMany:Et,initialize:Uy});y(this,"selectors",{selectById:Yy,selectByIds:Zy})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=new Date().toISOString(),u=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,d=M({...e,submitted_at:l,created_by:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.associated_issue,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{associated_issue__project:e}},n)).flat();return this.dispatch(a(r)),r}}class Kg extends Xe{constructor(){super(...arguments);y(this,"name","Issue Attachment");y(this,"url","/issue-attachments");y(this,"actions",{addOne:sp,addMany:qi,setOne:ip,setMany:np,updateOne:ap,updateMany:cp,deleteOne:dp,deleteMany:Di,initialize:tp});y(this,"selectors",{selectById:lp,selectByIds:op})}getId(e){return e.uuid}buildModel(e){return M({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,issue:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,issue:e.issue}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.issueUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(r)),r}}class Yg extends Xe{constructor(){super(...arguments);y(this,"name","Issue Comment Attachment");y(this,"url","/issue-comment-attachments");y(this,"actions",{addOne:pp,addMany:Ap,setOne:fp,setMany:Sp,updateOne:Tp,updateMany:Ip,deleteOne:Op,deleteMany:Pp,initialize:yp});y(this,"selectors",{selectById:gp,selectByIds:bp})}getId(e){return e.uuid}buildModel(e){return M({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,issue_comment:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,issue_comment:e.issue_comment}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.issueCommentUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{issue_comment__issue__project:e}},n)).flat();return this.dispatch(a(r)),r}}class Zg extends v{constructor(){super(...arguments);y(this,"name","Issue Comment");y(this,"url","/issue-comments");y(this,"actions",{addOne:wp,addMany:Ep,setOne:vp,setMany:Vp,updateOne:zp,updateMany:Bp,deleteOne:jp,deleteMany:qp,initialize:Rp});y(this,"selectors",{selectById:Dp,selectByIds:Cp})}add(e){const{store:n}=this.client,{addOne:a,updateOne:c,deleteOne:r}=this.actions,l=M({...e,author:n.getState().userReducer.currentUser.id,submitted_at:new Date().toISOString()});this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(l),blockers:[e.issue],blocks:[l.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(()=>{this.dispatch(r(l.uuid))}),[l,u]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{setMany:a}=this.actions,r=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(r)),r}}class Jg extends v{constructor(){super(...arguments);y(this,"name","Issue");y(this,"url","/issues");y(this,"actions",{addOne:kp,addMany:Hi,setOne:Np,setMany:Hp,updateOne:Gp,updateMany:Wp,deleteOne:Kp,deleteMany:Gi,initialize:Lp});y(this,"selectors",{selectById:Zp,selectByIds:Jp})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=n.getState(),u=new Date().toISOString(),d=((A=l.userReducer.currentUser)==null?void 0:A.id)??null,h=M({...e,submitted_at:u,created_by:d});this.dispatch(a(h));const p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[h.project,h.issue_type,...h.category?[h.category]:[]],blocks:[h.uuid]});return p.then(f=>{this.dispatch(c(f))}).catch(f=>{throw this.dispatch(r(h.uuid)),f}),[h,p]}update(e){var p;const{updateOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),r=a(e.uuid)(c);if(!r)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const l={...r,...e};this.dispatch(n(l));const u={};for(const A of[$.TITLE,$.DESCRIPTION,$.STATUS,$.CATEGORY,$.PRIORITY,$.ASSIGNED_TO,$.DUE_DATE])if(A in e&&e[A]!==r[A])switch(A){case $.PRIORITY:u[A]=e[A];break;case $.DUE_DATE:u[A]=e[A];break;case $.DESCRIPTION:u[A]=e[A];break;case $.TITLE:u[A]=e[A];break;case $.STATUS:{const f=e[A],I=ln(f)(c);if(!I)throw new Error(`Trying to update issue type status with ${f} which does not exist in store`);u[A]={name:I.name,color:I.color,uuid:I.uuid};break}case $.CATEGORY:{const f=e[A];if(f===null)u[A]=null;else{const I=si(f)(c);if(!I)throw new Error(`Trying to update category with ${f} which does not exist in store.`);u[A]={name:I.name,color:I.color,uuid:I.uuid}}break}case $.ASSIGNED_TO:{const f=e[A];if(f===null)u[A]=null;else{const I=jt(f)(c);if(!I)throw new Error(`Trying to update assigned to with ${f} which does not exist in store.`);u[A]={full_name:I.username,id:I.id}}break}}const d=M({created_by:((p=c.userReducer.currentUser)==null?void 0:p.id)??null,submitted_at:new Date().toISOString(),issue:r.uuid,changes:u});this.dispatch(hn(d));const h=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return h.then(A=>{this.dispatch(n(A))}).catch(()=>{this.dispatch(n(r)),this.dispatch(yn(d.uuid))}),[l,h]}bulkUpdate(e,n){const{store:a}=this.client,{updateMany:c}=this.actions,{selectByIds:r}=this.selectors,l=D(e).toSorted(At);if(l.length!==e.length)throw new Error("payloads contains duplicate uuids.");const u=r(l)(a.getState()).toSorted(Kt);if(l.length!=u.length)throw new Error(`Attempting to bulk update ${l.length-u.length} issues that dont exist in the store`);const d=[];for(let f=0;f<l.length;f++)d.push({...u[f],...e[f]});this.dispatch(c(d));const h=Qe(e,Math.min(n??e.length,Je)),p=[];let A=null;for(const f of h){const I=xe.v4(),F=D(f),P=f.map(({status:E})=>E).filter(Boolean),g=f.map(({category:E})=>E).filter(Boolean),b=this.enqueueRequest({description:O(m.PATCH,this.name,!0),method:m.PATCH,url:`${this.url}/bulk/`,payload:{payloads:f},blockers:F.concat(P).concat(g).concat(A?[A]:[]),blocks:F.concat([I])});p.push(b),A=I}return Promise.all(p).then(f=>{this.dispatch(c(f.flat()))}).catch(()=>{this.dispatch(c(u))}),[d,p]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`No issue with uuid ${e} found in the store`);const d=up(e)(l),h=gS(e)(l),p={};for(const f of Jy(e)(l))p[f.uuid]=f;for(const f of Xy(e)(l))p[f.uuid]=f;const A=Object.values(p);this.dispatch(a(e)),this.dispatch(Di(D(d))),this.dispatch(pn(D(h))),this.dispatch(Et(D(A)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(f){throw this.dispatch(c(u)),this.dispatch(qi(d)),this.dispatch(mn(h)),this.dispatch(wt(A)),f}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(r)),r}}class Xg extends Xe{constructor(){super(...arguments);y(this,"name","Issue Type Attachment");y(this,"url","/issue-type-attachments");y(this,"actions",{addOne:tA,addMany:sA,setOne:iA,setMany:nA,updateOne:aA,updateMany:cA,deleteOne:dA,deleteMany:rA,initialize:eA});y(this,"selectors",{selectById:lA,selectByIds:oA})}getId(e){return e.uuid}buildModel(e){return M({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,issue_type:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,issue_type:e.issue_type}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.issueTypeUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class Qg extends v{constructor(){super(...arguments);y(this,"name","Issue Type Fields Attachment");y(this,"url","/issue-type-fields-attachments");y(this,"actions",{addOne:pA,addMany:AA,setOne:fA,setMany:SA,updateOne:TA,updateMany:IA,deleteOne:OA,deleteMany:PA,initialize:yA});y(this,"selectors",{selectById:gA,selectByIds:bA})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],h=[];for(const f of e){const{fieldsRevisionUuid:I,fieldIdentifier:F,file:P}=f,g=await this.client.files.getFilePayload(P);g.sha1 in u||(u[g.sha1]=g);const b=M({file:URL.createObjectURL(P),file_type:P.type,file_name:P.name,file_sha1:g.sha1,created_by:l,fields_revision:I,submitted_at:r,field_identifier:F});d.push(b);const E={uuid:b.uuid,file_name:P.name,file_extension:g.extension,field_identifier:F,file_sha1:g.sha1,fields_revision:I};h.push(E)}this.dispatch(n(d));const p=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(f=>f.fields_revision),blocks:d.map(f=>f.uuid)});return p.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,p.then(({attachments:f})=>f)]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class xg extends v{constructor(){super(...arguments);y(this,"name","Issue Type Fields");y(this,"url","/issue-type-fields");y(this,"actions",{addOne:NA,addMany:HA,setOne:GA,setMany:WA,updateOne:KA,updateMany:YA,deleteOne:ZA,deleteMany:JA,initialize:kA});y(this,"selectors",{selectById:QA,selectByIds:xA})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.issue_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(r(d.uuid)),A}),[d,h]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class eb extends v{constructor(){super(...arguments);y(this,"name","Issue Type Field Values Attachment");y(this,"url","/issue-type-field-values-attachments");y(this,"actions",{addOne:nf,addMany:xi,setOne:af,setMany:cf,updateOne:df,updateMany:rf,deleteOne:uf,deleteMany:en,initialize:sf});y(this,"selectors",{selectById:of,selectByIds:hf})}async bulkAdd(e){var A;const{addMany:n,setMany:a,deleteMany:c}=this.actions,r=new Date().toISOString(),l=((A=this.client.store.getState().userReducer.currentUser)==null?void 0:A.id)??null,u={},d=[],h=[];for(const f of e){const{fieldValuesUuid:I,fieldIdentifier:F,file:P}=f,g=await this.client.files.getFilePayload(P);g.sha1 in u||(u[g.sha1]=g);const b=M({file:URL.createObjectURL(P),file_type:P.type,file_name:P.name,file_sha1:g.sha1,created_by:l,field_values:I,submitted_at:r,field_identifier:F});d.push(b);const E={uuid:b.uuid,file_name:P.name,file_sha1:g.sha1,file_extension:g.extension,field_identifier:F,field_values:I};h.push(E)}this.dispatch(n(d));const p=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:h,files:Object.values(u)},blockers:d.map(f=>f.field_values),blocks:d.map(f=>f.uuid)});return p.then(({presigned_urls:f,attachments:I})=>{this.client.files.processPresignedUrls(f),this.dispatch(a(I))}).catch(f=>{throw this.dispatch(c(d.map(I=>I.uuid))),f}),[d,p.then(({attachments:f})=>f)]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:r}=this.selectors,l=n.getState(),u=r(e)(l);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!0),method:m.DELETE,url:`${this.url}/bulk/`,payload:{uuids:e},blockers:e,blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{field_values__issue__project:e,latest:!0}},n)).flat();return this.dispatch(a(r)),r}}class tb extends v{constructor(){super(...arguments);y(this,"name","Issue Type Field Values");y(this,"url","/issue-type-field-values");y(this,"actions",{addOne:wA,addMany:EA,setOne:vA,setMany:VA,updateOne:zA,updateMany:BA,deleteOne:jA,deleteMany:qA,initialize:RA});y(this,"selectors",{selectById:CA,selectByIds:$A})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),h=M({...e,created_by:u,submitted_at:d}),p=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[e.issue,e.fields_revision],blocks:[h.uuid]});return this.dispatch(a(h)),p.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(h.uuid))}),[h,p]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`Expected IssueTypeFieldValues with uuid ${e.uuid} to exist`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[u.uuid,u.fields_revision,u.issue],blocks:[u.uuid]});return d.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected submission with uuid ${e} to exist`);const d=mf(e)(l);this.dispatch(a(e)),this.dispatch(en(D(d)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(xi(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 sb extends v{constructor(){super(...arguments);y(this,"name","Issue Type Identifier");y(this,"url","/issue-type-identifiers");y(this,"actions",{addOne:ff,addMany:Sf,setOne:Tf,setMany:If,updateOne:Of,updateMany:Pf,deleteOne:Ff,deleteMany:gf,initialize:Af});y(this,"selectors",{selectById:_f,selectByIds:Mf})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[d.issue_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected issue type identifier with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected issue type identifier with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class ib extends v{constructor(){super(...arguments);y(this,"name","Issue Type Identifier Value");y(this,"url","/issue-type-identifier-values");y(this,"actions",{addOne:vf,addMany:Vf,setOne:zf,setMany:Bf,updateOne:jf,updateMany:qf,deleteOne:Df,deleteMany:Cf,initialize:Ef});y(this,"selectors",{selectById:Uf,selectByIds:Lf})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.issue,e.issue_type_identifier],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected issue type identifier value with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected issue type identifier value with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(r)),r}}class nb extends v{constructor(){super(...arguments);y(this,"name","Issue Type");y(this,"url","/issue-types");y(this,"actions",{addOne:Gf,addMany:Wf,setOne:Kf,setMany:Yf,updateOne:Zf,updateMany:Jf,deleteOne:Xf,deleteMany:Qf,initialize:Hf});y(this,"selectors",{selectById:eS,selectByIds:tS})}add(e){var A;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,u=((A=n.getState().userReducer.currentUser)==null?void 0:A.id)??null,d=new Date().toISOString(),h=M({...e,submitted_at:d,created_by:u});this.dispatch(a(h));const p=this.enqueueRequest({method:m.POST,url:`${this.url}/`,payload:V(h),blockers:[],blocks:[h.uuid]});return p.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(h.uuid))}),[h,p]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=n.getState(),l=c(e.uuid)(r);if(!l)throw new Error(`IssueType with uuid ${e.uuid} does not exist in the store.`);const u={...l,...e};this.dispatch(a(u));const d=this.enqueueRequest({method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(h=>{this.dispatch(a(h))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const d=Xp(e)(l);this.dispatch(a(e)),this.dispatch(Gi(D(d)));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(Hi(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 ab extends v{constructor(){super(...arguments);y(this,"name","Issue Type Status");y(this,"url","/issue-type-statuses");y(this,"actions",{addOne:aS,addMany:cS,setOne:dS,setMany:rS,updateOne:uS,updateMany:lS,deleteOne:oS,deleteMany:hS,initialize:nS});y(this,"selectors",{selectById:ln,selectByIds:yS})}add(e){var p;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=((p=n.getState().userReducer.currentUser)==null?void 0:p.id)??null,u=new Date().toISOString(),d=M({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const h=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(d),blockers:[e.issue_type],blocks:[d.uuid]});return h.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,h]}update(e){const{setOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),r=a(e.uuid)(c);if(!r)throw new Error(`Expected an existing issue type status with uuid ${e.uuid}`);const l={...r,...e};this.dispatch(n(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`No issue type status with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class cb extends v{constructor(){super(...arguments);y(this,"name","Issue Update");y(this,"url","/issue-updates");y(this,"actions",{addOne:hn,addMany:mn,setOne:SS,setMany:TS,updateOne:IS,updateMany:OS,deleteOne:yn,deleteMany:pn,initialize:fS});y(this,"selectors",{selectById:PS,selectByIds:FS})}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(r)),r}}const db=1800;function rb(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 ub extends ng{constructor(){super(...arguments);y(this,"_getRenewedTokens",async e=>{const n=this.performRequest({method:m.POST,url:this.refreshTokensUrl,payload:{refresh:e},isAuthNeeded:!1,checkAuth:!1});let a;try{a=await n}catch(c){console.error("Could not renew tokens; clearing auth",c),this.clearAuth();return}if(!a.access)throw new Error("Missing access token");return{accessToken:a.access,refreshToken:a.refresh??this.getRefreshToken()}})}clearAuth(){console.debug(this.constructor.name,"clearing auth;"),this.dispatch(Bo(!1)),this.clearTokens(),this.dispatch(_()),this.dispatch(_())}async renewTokens(){const e=this.getRefreshToken();if(!e)throw new Error("No refresh token found");console.debug(this.constructor.name,"renewing tokens");try{const n=await this._getRenewedTokens(e);if(!n)return;console.log("Got renewed tokens"),this.setTokens(n)}catch(n){throw console.error("Could not renew tokens; clearing auth",n),this.clearAuth(),n}}tokenIsExpiringSoon(){const e=this.getAccessToken();if(!e)return!1;const n=Date.now()/1e3;let a;try{a=zO(e).exp??n}catch{a=n}return a-n<db}getAuthHeader(){return`Bearer ${this.getAccessToken()}`}async prepareAuth(){if(this.tokenIsExpiringSoon()){console.debug(this.constructor.name,"preparing auth");try{await this.renewTokens()}catch(e){return e instanceof U&&this.clearAuth(),e instanceof Error?Promise.reject(e):Promise.reject(new Error((e??nt).toString()))}}}async handleUnauthorized(e,n){const a=this.client.store.getState();if(e.url.endsWith("/token/refresh/"))throw a.authReducer.isLoggedIn&&console.warn("No signed-in user to sign out."),this.clearAuth(),new U({message:"You have been signed out due to inactivity.",response:n,discard:!0});if(a.authReducer.isLoggedIn)await this.renewTokens();else throw console.debug("Forbidden; user is not logged in."),new U({message:"Incorrect username or password.",response:n,discard:!0})}async initAuth(e){const n=xe.v4();return console.debug(this.constructor.name,"Initiating auth"),this.performRequest({uuid:n,method:m.POST,url:this.initTokensUrl,payload:e,isAuthNeeded:!1,checkAuth:!1}).then(a=>{this.setTokens(rb(a))})}}class lb extends at{constructor(){super(...arguments);y(this,"name","Organization Access");y(this,"url","/organization-accesses");y(this,"actions",{addOne:$S,addMany:US,setOne:LS,setMany:kS,updateOne:NS,updateMany:HS,deleteOne:GS,deleteMany:WS,initialize:CS});y(this,"selectors",{selectById:YS,selectByIds:ZS})}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState()),l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(d=>{throw this.dispatch(a(r)),d}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l),d=jt(u.user)(l);this.dispatch(a(u.uuid)),this.dispatch(In(u.user));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${u.uuid}/`,blockers:[u.uuid],blocks:[]})}catch(h){throw this.dispatch(c(u)),this.dispatch(Tn(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 ob extends at{constructor(){super(...arguments);y(this,"name","Organization");y(this,"url","/organizations");y(this,"actions",{addOne:sT,addMany:tT,setOne:eT,setMany:xS,updateOne:nT,updateMany:iT,deleteOne:aT,deleteMany:cT,initialize:QS});y(this,"selectors",{selectById:uT,selectByIds:lT})}async add(e){const{addOne:n}=this.actions,a=await this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:e,blockers:[],blocks:[]});return this.dispatch(n(a)),a}async update(e){const{setOne:n}=this.actions,a=await this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return this.dispatch(n(a)),a}async invite(e,n){return this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/${e}/invite/${n}/`,blockers:[],blocks:[]})}async refreshStore(e){const{initialize:n}=this.actions,a=await this.list({},e);return this.dispatch(n(a)),a}}class hb extends v{constructor(){super(...arguments);y(this,"name","Project Access");y(this,"url","/project-accesses");y(this,"actions",{addOne:IT,addMany:OT,setOne:PT,setMany:FT,updateOne:gT,updateMany:bT,deleteOne:_T,deleteMany:MT,initialize:TT});y(this,"selectors",{selectById:wT,selectByIds:ET})}add(e){var d;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=M({...e,created_by:((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null});this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(l),blockers:[l.organization_access,l.project],blocks:[l.uuid]});return u.then(h=>{this.dispatch(c(h))}).catch(h=>{throw this.dispatch(r(l.uuid)),h}),[l,u]}bulkAdd(e){var h;const{store:n}=this.client,{addMany:a,deleteMany:c,updateMany:r}=this.actions,l=((h=n.getState().userReducer.currentUser)==null?void 0:h.id)??null,u=e.map(p=>M({...p,created_by:l}));this.dispatch(a(u));const d=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{project_accesses:u.map(p=>V(p))},blockers:u.flatMap(p=>[p.project,p.organization_access]),blocks:u.map(p=>p.uuid)});return d.then(p=>{this.dispatch(r(p))}).catch(p=>{throw this.dispatch(c(u.map(A=>A.uuid))),p}),[u,d]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState()),l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[]});return u.then(d=>{this.dispatch(a(d))}).catch(d=>{throw this.dispatch(a(r)),d}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{project__organization:e}},n);return this.dispatch(a(c)),c}}class mb extends Xe{constructor(){super(...arguments);y(this,"name","Project Attachment");y(this,"url","/project-attachments");y(this,"actions",{addOne:zT,addMany:BT,setOne:jT,setMany:qT,updateOne:DT,updateMany:CT,deleteOne:$T,deleteMany:UT,initialize:VT});y(this,"selectors",{selectById:kT,selectByIds:NT})}getId(e){return e.uuid}buildModel(e){return M({file:URL.createObjectURL(e.file),file_sha1:e.file_sha1,created_by:e.created_by,file_name:e.file.name,file_type:e.file.type,submitted_at:e.submitted_at,project:e.modelUuid})}buildPayload(e,n){return{uuid:e.uuid,file_name:e.file_name,file_sha1:e.file_sha1,file_extension:n.extension,project:e.project}}async bulkAdd(e){return this._bulkAdd(e.map(n=>({modelUuid:n.projectUuid,file:n.file})))}async delete(e){return this._delete(e)}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{project__organization:e}},n);return this.dispatch(a(c)),c}}class yb extends v{constructor(){super(...arguments);y(this,"name","Project File");y(this,"url","/project-files");y(this,"actions",{addOne:ZT,addMany:JT,setOne:KT,setMany:YT,updateOne:XT,updateMany:QT,deleteOne:xT,deleteMany:eI,initialize:WT});y(this,"selectors",{selectById:cI,selectByIds:dI})}async saveExisting(e){const{setOne:n}=this.actions;if(!e.uuid)throw new Error("You can only use this method to save existing project files. The one provided has no uuid.");const a={...e};delete a.file;const c=this.enqueueRequest({method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:a,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(n(r))}),c}saveActive(){const{store:e}=this.client,{setOne:n}=this.actions,a=e.getState(),c=a.projectFileReducer.activeProjectFileId;if(!c)throw new Error("No active project file");const r=a.projectFileReducer.instances[c];if(!r)throw new Error("No active project file");if(!r.bounds&&!r.canvas_bounds)throw new Error("Project file must either have bounds or canvas_bounds set");let l;if(typeof r.file=="string"&&!r.file.startsWith("blob:")){const h={...r};delete h.file,l={method:m.PATCH,url:`${this.url}/${c}/`,payload:h,blockers:[c],blocks:[c]}}else l=new Promise((h,p)=>{this.client.files.uploadFileToS3(r.file_sha1).then(([A])=>{h({method:m.POST,url:`${this.url}/`,payload:{...r,...A},blockers:[c],blocks:[c]})}).catch(p)});const d=Promise.resolve(l).then(h=>this.enqueueRequest(h));return d.then(h=>{this.dispatch(n(h))}),this.dispatch(iI),this.dispatch(sI(null)),this.dispatch(tI(!1)),[r,d]}async delete(e){const{store:n}=this.client,{addOne:a,deleteOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`Expected project file with uuid ${e} to exist in the store.`);this.dispatch(c(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(a(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(r)),r}}class pb extends at{constructor(){super(...arguments);y(this,"name","Project");y(this,"url","/projects");y(this,"actions",{addOne:yI,addMany:mI,setOne:hI,setMany:oI,updateOne:AI,updateMany:pI,deleteOne:fI,deleteMany:SI,initialize:lI});y(this,"selectors",{selectById:OI,selectByIds:PI})}async add(e){const{addOne:n}=this.actions,a=await this.performRequest({method:m.POST,url:`${this.url}/`,payload:V(e)});return this.dispatch(n(a)),a}async update(e){const{updateOne:n}=this.actions,a=await this.performRequest({method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:V(e)});return this.dispatch(n(a)),a}async delete(e){const{deleteOne:n}=this.actions,a=await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return this.dispatch(n(e)),a}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Ab extends v{constructor(){super(...arguments);y(this,"name","Team Membership");y(this,"url","/team-memberships");y(this,"actions",{addOne:_I,addMany:MI,setOne:RI,setMany:wI,updateOne:EI,updateMany:vI,deleteOne:VI,deleteMany:zI,initialize:bI});y(this,"selectors",{selectById:qI,selectByIds:DI})}add(e){var d;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=M({...e,created_by:((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null});this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(l),blockers:[e.team],blocks:[l.uuid]});return u.then(h=>{this.dispatch(c(h))}).catch(()=>{this.dispatch(r(l.uuid))}),[l,u]}bulkAdd(e){var h;const{store:n}=this.client,{addMany:a,setMany:c,deleteMany:r}=this.actions,l=((h=n.getState().userReducer.currentUser)==null?void 0:h.id)??null,u=e.map(p=>M({...p,created_by:l}));this.dispatch(a(u));const d=this.enqueueRequest({description:O(m.POST,this.name,!0),method:m.POST,url:`${this.url}/bulk/`,payload:{team_memberships:u.map(p=>V(p))},blockers:u.map(p=>p.team),blocks:u.map(p=>p.uuid)});return d.then(p=>{this.dispatch(c(p))}).catch(()=>{this.dispatch(r(u.map(p=>p.uuid)))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected team membership with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{team__organization:e}},n);return this.dispatch(a(c)),c}}class fb extends v{constructor(){super(...arguments);y(this,"name","Team");y(this,"url","/teams");y(this,"actions",{addOne:UI,addMany:LI,setOne:kI,setMany:NI,updateOne:HI,updateMany:GI,deleteOne:WI,deleteMany:KI,initialize:$I});y(this,"selectors",{selectById:ZI,selectByIds:JI})}add(e){var d;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=M({...e,submitted_at:new Date().toISOString(),created_by:((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null});this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.POST,this.name,!1),method:m.POST,url:`${this.url}/`,payload:V(l),blockers:[],blocks:[l.uuid]});return u.then(h=>{this.dispatch(c(h))}).catch(()=>{this.dispatch(r(l.uuid))}),[l,u]}update(e){const{store:n}=this.client,{setOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Expected team with uuid ${e.uuid} to exist`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:O(m.PATCH,this.name,!1),method:m.PATCH,url:`${this.url}/${e.uuid}/`,payload:V(e),blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(a(e));try{return await this.enqueueRequest({description:O(m.DELETE,this.name,!1),method:m.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[e]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class Sb extends at{constructor(){super(...arguments);y(this,"name","User");y(this,"url","/user");y(this,"actions",{addOne:Tn,addMany:ES,setOne:wS,setMany:RS,updateOne:VS,updateMany:vS,deleteOne:In,deleteMany:zS,initialize:MS});y(this,"selectors",{selectById:jt,selectByIds:qS})}async list(e,n){const{organizationUuid:a,...c}=e,r=a?`/organizations/${a}${this.url}s/`:`/${this.url}`;return this.performRequest({method:m.GET,url:r,...c},n)}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({organizationUuid:e},n);return this.dispatch(a(c)),c}}async function Un(t,s,e,n,a){const c=n instanceof et;c&&s.checkAuth!==!1&&await n.auth.prepareAuth();const r={queryParams:"",isAuthNeeded:!0},{s3url:l,payload:u,headers:d,method:h,queryParams:p,attachmentHash:A,isExternalUrl:f,isAuthNeeded:I,isResponseBlob:F}={...r,...s};let P=s.url;const g=A?await e.files.fetchCache(A):void 0;if(A&&!g)throw new Error(`Cannot upload file ${A} because it's not cached.`);!f&&!P.startsWith("http")&&(!P.startsWith("/")&&!P.startsWith("blob:")&&(P="/"+P),P=t+P);const b=q=>{if(A){if(!l)throw new Error(`No S3 URL for file ${A}`);if("warning"in l)throw new Error(`S3 URL warning for file ${A}`);if(!g)throw new Error(`No file for file ${A}`);const j=l.fields["x-amz-checksum-sha1"];if(!j)throw new Error(`No checksum for file ${A}`);return q.set("x-amz-checksum-sha1",j).field({...u,...l.fields}).attach("file",g)}return q.send(u)},B={[m.GET]:()=>F?st.get(P.toString()).responseType("blob"):st.get(P.toString()),[m.POST]:()=>{const q=st.post(P.toString());return b(q)},[m.PATCH]:()=>{const q=st.patch(P.toString());return b(q)},[m.PUT]:()=>{const q=st.put(P.toString());return b(q)},[m.DELETE]:()=>{const q=st.delete(P.toString());return b(q)}}[h];let z=B();if(a==null||a.addEventListener("abort",()=>{console.debug("aborting request:",s),z.abort()}),I&&c){const q=n.auth.getAuthHeader();z=z.set("Authorization",q)}d&&(z=z.set(d));try{return await z.query(p)}catch(q){const j=yO(q),_O=j==null?void 0:j.status;if(c&&_O===401)return await n.auth.handleUnauthorized(z,j),z.query(p);throw new U({response:j,innerError:q,discard:qn.includes(_O)})}}class Tb{constructor(s){y(this,"store");this.store=s}_performRequest(s,e,n,a){const c=new kt,r={...e,uuid:e.uuid??xe.v4()};return Un(s,r,this,n,a).then(l=>{c.resolve(l.body)}).catch(l=>{l instanceof Error?c.reject(l):c.reject(new Error((l??nt).toString()))}),c}async performRequest(s,e,n,a){return this._performRequest(s,e,n,a).then(c=>{if(c instanceof U)throw c;return c})}async enqueueRequest(s,e,n){return this._enqueueRequest(s,e,n).then(a=>{if(a instanceof U)throw a;return a})}_enqueueRequest(s,e,n){const a=new kt,c={...s,BASE_URL:e,serviceName:n},r=this.store.dispatch(yT(c)),l=d=>{if(d)a.resolve(d.body);else{const h=new U({message:"Could not get a response from the server.",response:d,discard:!0});a.reject(h)}},u=d=>{d instanceof U?d.options.discard=!0:(console.error("Received an unexpected error while processing a request:",d,`
|
|
15
|
-
Converting error to APIError and discarding.`),d=new U({message:"An error occurred while processing the request.",innerError:d,discard:!0})),a.reject(d)};return r.then(l,u),a}async performPagination(s,e,n,a,c){const r={...e,queryParams:{...e.queryParams,paginate:!0,limit:n}},{method:l}=r,u=[];let d=await this.performRequest(s,r,a,c);for(u.push(d.results);d.next;)d=await this.performRequest(s,{url:d.next,method:l},a,c),u.push(d.results);return u}}class ct{constructor(){y(this,"graph");y(this,"requestAttemptCounter");this.graph=new BO.DepGraph,this.requestAttemptCounter={}}static _fromOutbox(s){const e=new ct;for(let n=0;n<s.length;n++){const a=s[n];if(!a){console.error("Outbox item was undefined");continue}e.sneakRequest(a);for(let c=0;c<n;c++){const r=s[c];if(!r){console.error("Previous outbox item was undefined");continue}r.payload.uuid!==a.payload.uuid&&r.payload.blocks.some(l=>a.payload.blockers.includes(l))&&ct._addDependency(a.payload.uuid,r.payload.uuid,e.graph)}}return e}_addDependency(s,e){ct._addDependency(s,e,this.graph)}static _addDependency(s,e,n){if(s===e)throw new Error(`Tried to add dependency from node to itself: ${s}`);if(!n.hasNode(s))throw new Error(`Tried to add dependency from non-existent node: ${s} (to node: ${e})`);if(!n.hasNode(e))throw new Error(`Tried to add dependency to non-existent node: ${e} (from node: ${s})`);n.addDependency(s,e)}addRequest(s){if(this.graph.addNode(s.payload.uuid,s),!(s.payload.blockers.length===0||this.graph.size()===1))for(const e of this.graph.overallOrder()){if(e===s.payload.uuid)continue;const n=this.graph.getNodeData(e);s.payload.blockers.some(a=>n.payload.blocks.includes(a))&&this._addDependency(s.payload.uuid,e)}}insertRequest(s){this.graph.addNode(s.payload.uuid,s);for(const e of this.graph.overallOrder()){if(e===s.payload.uuid)continue;this.graph.getNodeData(e).payload.blockers.some(a=>s.payload.blocks.includes(a))&&this._addDependency(e,s.payload.uuid)}}sneakRequest(s){this.graph.addNode(s.payload.uuid,s)}_getNextNode(){const s=this.graph.overallOrder(!0);let e=1/0,n;for(const a of s){const c=this.requestAttemptCounter[a]||0;c<e&&(e=c,n=a)}return n}peek(){const s=this._getNextNode();if(s)return this.graph.getNodeData(s)}remove(s){this.graph.removeNode(s),delete this.requestAttemptCounter[s]}pop(){const s=this.peek();return s&&this.graph.removeNode(s.payload.uuid),s}getQueue(){const s=this.graph.overallOrder().map(n=>this.graph.getNodeData(n)),e=this._getNextNode();if(e){const n=this.graph.getNodeData(e),a=s.findIndex(c=>c.payload.uuid===n.payload.uuid);a!==-1&&(s.splice(a,1),s.unshift(n))}return s}getReady(){let s=this.graph.overallOrder(!0).map(e=>this.graph.getNodeData(e));return s=s.sort((e,n)=>e.meta.offline.effect.timestamp.localeCompare(n.meta.offline.effect.timestamp)),s=s.sort((e,n)=>{const a=this.requestAttemptCounter[e.payload.uuid]||0,c=this.requestAttemptCounter[n.payload.uuid]||0;return a-c}),s}registerRetry(s){this.requestAttemptCounter[s]=(this.requestAttemptCounter[s]||0)+1}}let pO;function AO(t){pO=t}function dt(){return pO}let fO;function SO(t){fO=t}function TO(){return fO}let Ln=null;function tt(){const t=dt();if(!t)return console.warn("Client store not set; cannot get outbox coordinator yet."),null;if(Ln)return Ln;const s=t.getState().offline.outbox,e=ct._fromOutbox(s);return Ln=e,e}const Ib=(t,s)=>{const e=new s(t);return SO(e),AO(t),e};class Ob{constructor(s){y(this,"_all");y(this,"_previous");this._all=[s],this._previous=s,this.then=this.then.bind(this),this.compile=this.compile.bind(this)}then(s){return this._previous&&(this._previous.next=s),this._all.push(s),this._previous=s,{then:this.then,compile:this.compile}}compile(){return this._all}}class kn{constructor(){y(this,"next");this.next=null}then(s){return new Ob(this).then(s)}async run(s){if(this.next)return this.next.run(s);{if(console.debug("Middleware finished. Performing request:",s),!dt())throw new Error("Client store not set");const n=TO();if(!n)throw new Error("Client SDK not set");return oO(s,n)}}}class IO extends kn{async run(s){return super.run(s)}}class OO extends kn{async run(s){return super.run(s)}}const PO=new IO().then(new OO).compile();function FO(t){var s;return(s=PO[0])==null?void 0:s.run(t)}var gO=(t=>(t[t.USER_REGISTRATION=0]="USER_REGISTRATION",t[t.APPLICATION_INVITE=2]="APPLICATION_INVITE",t[t.PROJECT_INVITE=4]="PROJECT_INVITE",t[t.ORGANIZATION_INVITE=6]="ORGANIZATION_INVITE",t[t.ADD_EMAIL_DOMAIN=8]="ADD_EMAIL_DOMAIN",t[t.RESET_PASSWORD=10]="RESET_PASSWORD",t))(gO||{});i.ALL_MIDDLEWARE=PO,i.APIError=U,i.ATTACHMENT_MODEL_DEFAULT_PAGE_SIZE=sO,i.AgentService=ag,i.AssetAttachmentService=cg,i.AssetProcedureService=hg,i.AssetProcedureStepFieldValuesAttachmentService=Ag,i.AssetProcedureStepFieldValuesService=fg,i.AssetProcedureStepFieldsAttachmentService=yg,i.AssetProcedureStepFieldsService=pg,i.AssetProcedureStepService=Sg,i.AssetProcedureTypeAttachmentService=dg,i.AssetProcedureTypeFieldValuesAttachmentService=lg,i.AssetProcedureTypeFieldValuesService=og,i.AssetProcedureTypeFieldsAttachmentService=rg,i.AssetProcedureTypeFieldsService=ug,i.AssetProcedureTypeService=mg,i.AssetService=Tg,i.AssetStageCompletionService=Ig,i.AssetStageService=Og,i.AssetStatusType=Yn,i.AssetTypeAttachmentService=Pg,i.AssetTypeFieldValuesAttachmentService=bg,i.AssetTypeFieldValuesService=_g,i.AssetTypeFieldsAttachmentService=Fg,i.AssetTypeFieldsService=gg,i.AssetTypeIdentifierService=Mg,i.AssetTypeIdentifierValueService=Rg,i.AssetTypeService=wg,i.AssetTypeStatusService=Eg,i.AttachmentModel=Zn,i.BaseApiService=et,i.BaseModelApiService=at,i.BaseOfflineAttachmentModelService=Xe,i.BaseOfflineModelApiService=v,i.BaseSDK=Tb,i.COMMON_AUTO_FIELDS=sa,i.CategoryService=vg,i.DEFAULT_ISSUE_PRIORITY=jO,i.DEFAULT_PAGE_SIZE=tO,i.DISCARD_HTTP_STATUSES=qn,i.DeferredPromise=kt,i.DocumentAttachmentService=Vg,i.DocumentService=zg,i.EMPTY_ARRAY=Gn,i.EMPTY_OBJECT=Wn,i.EmailDomainsService=Bg,i.EmailVerificationService=jg,i.FileService=Dg,i.FormIdentifierService=Cg,i.FormIdentifierValueService=$g,i.FormRevisionAttachmentService=Ug,i.FormRevisionService=Lg,i.FormService=kg,i.FormSubmissionAttachmentService=Ng,i.FormSubmissionService=Hg,i.GeoImageService=Gg,i.HttpMethod=m,i.IssueAssociationService=Wg,i.IssueAttachmentService=Kg,i.IssueCommentAttachmentService=Yg,i.IssueCommentService=Zg,i.IssuePriority=Lt,i.IssueService=Jg,i.IssueStatusType=Jn,i.IssueTypeAttachmentService=Xg,i.IssueTypeFieldValuesAttachmentService=eb,i.IssueTypeFieldValuesService=tb,i.IssueTypeFieldsAttachmentService=Qg,i.IssueTypeFieldsService=xg,i.IssueTypeIdentifierService=sb,i.IssueTypeIdentifierValueService=ib,i.IssueTypeService=nb,i.IssueTypeStatusService=ab,i.IssueUpdateChange=$,i.IssueUpdateService=cb,i.JWTService=ub,i.MAX_SERVICE_BATCH_SIZE=Je,i.OUTBOX_RETRY_DELAY=Xn,i.OfflineAnalyticsMiddleware=IO,i.OfflineMiddleware=kn,i.OrganizationAccessLevel=Kn,i.OrganizationAccessService=lb,i.OrganizationService=ob,i.OutboxCoordinator=ct,i.ProjectAccessService=hb,i.ProjectAttachmentService=mb,i.ProjectFileService=yb,i.ProjectService=pb,i.RESET_ORGANIZATION_STATE=w,i.RESET_PROJECT_STATE=C,i.RESET_STATE=_,i.RateLimitingMiddleware=OO,i.SelectorBuilder=GF,i.TeamMembershipService=Ab,i.TeamService=fb,i.UNKNOWN_ERROR_MESSAGE=nt,i.UserService=Sb,i.VERSION_REDUCER_KEY=rt,i.VerificationCodeType=gO,i._setLatestRetryTime=AT,i.addAsset=Vr,i.addAssetAttachment=fa,i.addAssetAttachments=Xt,i.addAssetProcedure=Gc,i.addAssetProcedureStep=Ir,i.addAssetProcedureStepFieldValues=nr,i.addAssetProcedureStepFieldValuesAttachment=Gd,i.addAssetProcedureStepFieldValuesAttachments=Is,i.addAssetProcedureStepFieldValuesMany=ar,i.addAssetProcedureStepFields=Vd,i.addAssetProcedureStepFieldsAttachment=Sd,i.addAssetProcedureStepFieldsAttachments=Td,i.addAssetProcedureStepFieldsMany=zd,i.addAssetProcedureSteps=Or,i.addAssetProcedureType=nd,i.addAssetProcedureTypeAttachment=Ea,i.addAssetProcedureTypeAttachments=va,i.addAssetProcedureTypeFieldValues=vc,i.addAssetProcedureTypeFieldValuesAttachment=Sc,i.addAssetProcedureTypeFieldValuesAttachments=cs,i.addAssetProcedureTypeFieldValuesMany=Vc,i.addAssetProcedureTypeFields=nc,i.addAssetProcedureTypeFieldsAttachment=Ha,i.addAssetProcedureTypeFieldsAttachments=Ga,i.addAssetProcedureTypeFieldsMany=ac,i.addAssetProcedureTypes=ad,i.addAssetProcedures=os,i.addAssetStage=du,i.addAssetStageCompletion=Hr,i.addAssetStageCompletions=Gr,i.addAssetStages=ru,i.addAssetType=uo,i.addAssetTypeAttachment=Su,i.addAssetTypeAttachments=qs,i.addAssetTypeFieldValues=Sl,i.addAssetTypeFieldValuesAttachment=al,i.addAssetTypeFieldValuesAttachments=Ns,i.addAssetTypeFieldValuesMany=Tl,i.addAssetTypeFields=Gu,i.addAssetTypeFieldsAttachment=vu,i.addAssetTypeFieldsAttachments=Vu,i.addAssetTypeFieldsMany=Wu,i.addAssetTypeIdentifier=Vl,i.addAssetTypeIdentifierValue=Wl,i.addAssetTypeIdentifierValues=Kl,i.addAssetTypeIdentifiers=zl,i.addAssetTypeStatus=Oo,i.addAssetTypeStatuses=Po,i.addAssetTypes=lo,i.addAssets=Ms,i.addCategories=$o,i.addCategory=Co,i.addConversation=oa,i.addConversations=cP,i.addDocument=oh,i.addDocumentAttachment=Xo,i.addDocumentAttachments=Qo,i.addDocuments=hh,i.addEmailDomain=bh,i.addEmailDomains=_h,i.addForm=km,i.addFormIdentifier=Hh,i.addFormIdentifierValue=nm,i.addFormIdentifierValues=am,i.addFormIdentifiers=Gh,i.addFormRevision=pi,i.addFormRevisionAttachment=Sm,i.addFormRevisionAttachments=Tm,i.addFormRevisions=Ai,i.addFormSubmission=Ay,i.addFormSubmissionAttachment=sy,i.addFormSubmissionAttachments=Fi,i.addFormSubmissions=wi,i.addForms=Nm,i.addGeoImage=wy,i.addGeoImages=Ey,i.addIssue=kp,i.addIssueAssociation=Gy,i.addIssueAssociations=wt,i.addIssueAttachment=sp,i.addIssueAttachments=qi,i.addIssueComment=wp,i.addIssueCommentAttachment=pp,i.addIssueCommentAttachments=Ap,i.addIssueComments=Ep,i.addIssueType=Gf,i.addIssueTypeAttachment=tA,i.addIssueTypeAttachments=sA,i.addIssueTypeFieldValues=wA,i.addIssueTypeFieldValuesAttachment=nf,i.addIssueTypeFieldValuesAttachments=xi,i.addIssueTypeFieldValuesMany=EA,i.addIssueTypeFields=NA,i.addIssueTypeFieldsAttachment=pA,i.addIssueTypeFieldsAttachments=AA,i.addIssueTypeFieldsMany=HA,i.addIssueTypeIdentifier=ff,i.addIssueTypeIdentifierValue=vf,i.addIssueTypeIdentifierValues=Vf,i.addIssueTypeIdentifiers=Sf,i.addIssueTypeStatus=aS,i.addIssueTypeStatuses=cS,i.addIssueTypes=Wf,i.addIssueUpdate=hn,i.addIssueUpdates=mn,i.addIssues=Hi,i.addOrganization=sT,i.addOrganizationAccess=$S,i.addOrganizationAccesses=US,i.addOrganizations=tT,i.addProject=yI,i.addProjectAccess=IT,i.addProjectAccesses=OT,i.addProjectAttachment=zT,i.addProjectAttachments=BT,i.addProjectFile=ZT,i.addProjectFiles=JT,i.addProjects=mI,i.addTeam=UI,i.addTeamMembership=_I,i.addTeamMemberships=MI,i.addTeams=LI,i.addUser=Tn,i.addUsers=ES,i.agentsReducer=ya,i.agentsSlice=Yt,i.areArraysEqual=CO,i.assetAttachmentReducer=Ma,i.assetAttachmentSlice=Jt,i.assetProcedureReducer=Xc,i.assetProcedureSlice=ls,i.assetProcedureStepFieldValuesAttachmentReducer=tr,i.assetProcedureStepFieldValuesAttachmentSlice=Ts,i.assetProcedureStepFieldValuesReducer=pr,i.assetProcedureStepFieldValuesSlice=Fs,i.assetProcedureStepFieldsAttachmentReducer=wd,i.assetProcedureStepFieldsAttachmentSlice=ps,i.assetProcedureStepFieldsReducer=kd,i.assetProcedureStepFieldsSlice=fs,i.assetProcedureStepReducer=_r,i.assetProcedureStepSlice=gs,i.assetProcedureTypeAttachmentReducer=Ca,i.assetProcedureTypeAttachmentSlice=es,i.assetProcedureTypeFieldValuesAttachmentReducer=gc,i.assetProcedureTypeFieldValuesAttachmentSlice=as,i.assetProcedureTypeFieldValuesReducer=$c,i.assetProcedureTypeFieldValuesSlice=us,i.assetProcedureTypeFieldsAttachmentReducer=Qa,i.assetProcedureTypeFieldsAttachmentSlice=ss,i.assetProcedureTypeFieldsReducer=hc,i.assetProcedureTypeFieldsSlice=ns,i.assetProcedureTypeReducer=hd,i.assetProcedureTypeSlice=ms,i.assetReducer=Lr,i.assetSlice=_s,i.assetStageCompletionReducer=Qr,i.assetStageCompletionSlice=vs,i.assetStageReducer=mu,i.assetStageSlice=Vs,i.assetTypeAttachmentReducer=Ru,i.assetTypeAttachmentSlice=js,i.assetTypeFieldValuesAttachmentReducer=pl,i.assetTypeFieldValuesAttachmentSlice=ks,i.assetTypeFieldValuesReducer=wl,i.assetTypeFieldValuesSlice=Ws,i.assetTypeFieldsAttachmentReducer=ku,i.assetTypeFieldsAttachmentSlice=$s,i.assetTypeFieldsReducer=sl,i.assetTypeFieldsSlice=Ls,i.assetTypeIdentifierReducer=Nl,i.assetTypeIdentifierSlice=Ks,i.assetTypeIdentifierValueReducer=io,i.assetTypeIdentifierValueSlice=Zs,i.assetTypeReducer=So,i.assetTypeSlice=Js,i.assetTypeStatusReducer=Vo,i.assetTypeStatusSlice=Qs,i.assetTypeStatusSortFn=aa,i.authReducer=jo,i.authSlice=gt,i.baseReducer=kF,i.baseReducers=jn,i.blobToBase64=KO,i.categoryReducer=Yo,i.categorySlice=ei,i.clearTokens=HP,i.constructUploadedFilePayloads=WO,i.createModelAdapter=R,i.createOfflineAction=hT,i.createPayload=V,i.createSelectionAdapter=qO,i.deleteAsset=jr,i.deleteAssetAttachment=Pa,i.deleteAssetAttachments=Qt,i.deleteAssetProcedure=Yc,i.deleteAssetProcedureStep=gr,i.deleteAssetProcedureStepFieldValues=lr,i.deleteAssetProcedureStepFieldValuesAttachment=Jd,i.deleteAssetProcedureStepFieldValuesAttachments=Os,i.deleteAssetProcedureStepFieldValuesMany=or,i.deleteAssetProcedureStepFields=Cd,i.deleteAssetProcedureStepFieldsAttachment=gd,i.deleteAssetProcedureStepFieldsAttachments=bd,i.deleteAssetProcedureStepFieldsMany=$d,i.deleteAssetProcedureSteps=br,i.deleteAssetProcedureType=rd,i.deleteAssetProcedureTypeAttachment=qa,i.deleteAssetProcedureTypeAttachments=Da,i.deleteAssetProcedureTypeFieldValues=Dc,i.deleteAssetProcedureTypeFieldValuesAttachment=Fc,i.deleteAssetProcedureTypeFieldValuesAttachments=ds,i.deleteAssetProcedureTypeFieldValuesMany=Cc,i.deleteAssetProcedureTypeFields=lc,i.deleteAssetProcedureTypeFieldsAttachment=Ja,i.deleteAssetProcedureTypeFieldsAttachments=Xa,i.deleteAssetProcedureTypeFieldsMany=oc,i.deleteAssetProcedureTypes=ud,i.deleteAssetProcedures=hs,i.deleteAssetStage=ou,i.deleteAssetStageCompletion=Jr,i.deleteAssetStageCompletions=Xr,i.deleteAssetStages=hu,i.deleteAssetType=mo,i.deleteAssetTypeAttachment=Fu,i.deleteAssetTypeAttachments=Ds,i.deleteAssetTypeFieldValues=gl,i.deleteAssetTypeFieldValuesAttachment=ll,i.deleteAssetTypeFieldValuesAttachments=Hs,i.deleteAssetTypeFieldValuesMany=bl,i.deleteAssetTypeFields=Xu,i.deleteAssetTypeFieldsAttachment=Du,i.deleteAssetTypeFieldsAttachments=Cu,i.deleteAssetTypeFieldsMany=Qu,i.deleteAssetTypeIdentifier=Cl,i.deleteAssetTypeIdentifierValue=Ql,i.deleteAssetTypeIdentifierValues=xl,i.deleteAssetTypeIdentifiers=$l,i.deleteAssetTypeStatus=Mo,i.deleteAssetTypeStatuses=Ro,i.deleteAssetTypes=yo,i.deleteAssets=Rs,i.deleteCategories=Go,i.deleteCategory=Ho,i.deleteConversation=uP,i.deleteConversations=lP,i.deleteDocument=fh,i.deleteDocumentAttachment=ih,i.deleteDocumentAttachments=nh,i.deleteDocuments=Sh,i.deleteEmailDomain=vh,i.deleteEmailDomains=Vh,i.deleteForm=Ym,i.deleteFormIdentifier=Jh,i.deleteFormIdentifierValue=lm,i.deleteFormIdentifierValues=om,i.deleteFormIdentifiers=Xh,i.deleteFormRevision=fi,i.deleteFormRevisionAttachment=gm,i.deleteFormRevisionAttachments=bm,i.deleteFormRevisions=Si,i.deleteFormSubmission=Ty,i.deleteFormSubmissionAttachment=dy,i.deleteFormSubmissionAttachments=gi,i.deleteFormSubmissions=Ei,i.deleteForms=Zm,i.deleteGeoImage=zy,i.deleteGeoImages=By,i.deleteIssue=Kp,i.deleteIssueAssociation=Wy,i.deleteIssueAssociations=Et,i.deleteIssueAttachment=dp,i.deleteIssueAttachments=Di,i.deleteIssueComment=jp,i.deleteIssueCommentAttachment=Op,i.deleteIssueCommentAttachments=Pp,i.deleteIssueComments=qp,i.deleteIssueType=Xf,i.deleteIssueTypeAttachment=dA,i.deleteIssueTypeAttachments=rA,i.deleteIssueTypeFieldValues=jA,i.deleteIssueTypeFieldValuesAttachment=uf,i.deleteIssueTypeFieldValuesAttachments=en,i.deleteIssueTypeFieldValuesMany=qA,i.deleteIssueTypeFields=ZA,i.deleteIssueTypeFieldsAttachment=OA,i.deleteIssueTypeFieldsAttachments=PA,i.deleteIssueTypeFieldsMany=JA,i.deleteIssueTypeIdentifier=Ff,i.deleteIssueTypeIdentifierValue=Df,i.deleteIssueTypeIdentifierValues=Cf,i.deleteIssueTypeIdentifiers=gf,i.deleteIssueTypeStatus=oS,i.deleteIssueTypeStatuses=hS,i.deleteIssueTypes=Qf,i.deleteIssueUpdate=yn,i.deleteIssueUpdates=pn,i.deleteIssues=Gi,i.deleteOrganization=aT,i.deleteOrganizationAccess=GS,i.deleteOrganizationAccesses=WS,i.deleteOrganizations=cT,i.deleteProject=fI,i.deleteProjectAccess=_T,i.deleteProjectAccesses=MT,i.deleteProjectAttachment=$T,i.deleteProjectAttachments=UT,i.deleteProjectFile=xT,i.deleteProjectFiles=eI,i.deleteProjects=SI,i.deleteTeam=WI,i.deleteTeamMembership=VI,i.deleteTeamMemberships=zI,i.deleteTeams=KI,i.deleteUser=In,i.deleteUsers=zS,i.dequeue=lO,i.discard=hO,i.documentAttachmentReducer=rh,i.documentAttachmentSlice=ii,i.documentSlice=ai,i.documentsReducer=Th,i.downloadFile=YO,i.downloadInMemoryFile=GO,i.emailDomainsReducer=qh,i.emailDomainsSlice=di,i.emailRegex=iP,i.enqueue=uO,i.enqueueRequest=yT,i.extractResponseFromError=yO,i.fallbackToEmptyArray=T,i.fallbackToEmptyObject=pt,i.fileReducer=Lh,i.fileSlice=ui,i.fileToBlob=ea,i.formIdentifierReducer=tm,i.formIdentifierSlice=li,i.formIdentifierValueReducer=pm,i.formIdentifierValueSlice=hi,i.formReducer=Jm,i.formRevisionAttachmentReducer=wm,i.formRevisionAttachmentSlice=mi,i.formRevisionReducer=$m,i.formRevisionsSlice=yi,i.formSlice=Ii,i.formSubmissionAttachmentReducer=oy,i.formSubmissionAttachmentSlice=Pi,i.formSubmissionReducer=gy,i.formSubmissionSlice=Ri,i.geoImageReducer=Cy,i.geoImageSlice=Vi,i.getAssetProcedureStepSubTree=na,i.getAssetProcedureStepTrees=nP,i.getClientSDK=TO,i.getClientStore=dt,i.getDocumentSubTree=ra,i.getDocumentTrees=aP,i.getFileIdentifier=HO,i.getFileS3Key=Wt,i.getLocalDateString=Qn,i.getLocalRelativeDateString=kO,i.getOutboxCoordinator=tt,i.getRenamedFile=xn,i.getRequestDescription=O,i.hashFile=it,i.initSDK=Ib,i.initializeAssetAttachments=Aa,i.initializeAssetProcedureStepFieldValues=ir,i.initializeAssetProcedureStepFieldValuesAttachments=Hd,i.initializeAssetProcedureStepFields=vd,i.initializeAssetProcedureStepFieldsAttachments=fd,i.initializeAssetProcedureSteps=fr,i.initializeAssetProcedureTypeAttachments=wa,i.initializeAssetProcedureTypeFieldValues=Ec,i.initializeAssetProcedureTypeFieldValuesAttachments=fc,i.initializeAssetProcedureTypeFields=ic,i.initializeAssetProcedureTypeFieldsAttachments=Na,i.initializeAssetProcedureTypes=id,i.initializeAssetProcedures=Hc,i.initializeAssetStageCompletions=Nr,i.initializeAssetStages=nu,i.initializeAssetTypeAttachments=fu,i.initializeAssetTypeFieldValues=fl,i.initializeAssetTypeFieldValuesAttachments=nl,i.initializeAssetTypeFields=Hu,i.initializeAssetTypeFieldsAttachments=Eu,i.initializeAssetTypeIdentifierValues=Gl,i.initializeAssetTypeIdentifiers=vl,i.initializeAssetTypeStatuses=Io,i.initializeAssetTypes=ao,i.initializeAssets=vr,i.initializeCategories=Do,i.initializeConversations=la,i.initializeDocumentAttachments=Jo,i.initializeDocuments=lh,i.initializeEmailDomains=gh,i.initializeFormIdentifierValues=im,i.initializeFormIdentifiers=Nh,i.initializeFormRevisionAttachments=fm,i.initializeFormRevisions=vm,i.initializeFormSubmissionAttachments=ty,i.initializeFormSubmissions=my,i.initializeForms=Lm,i.initializeGeoImages=_y,i.initializeIssueAssociations=Uy,i.initializeIssueAttachments=tp,i.initializeIssueCommentAttachments=yp,i.initializeIssueComments=Rp,i.initializeIssueTypeAttachments=eA,i.initializeIssueTypeFieldValues=RA,i.initializeIssueTypeFieldValuesAttachments=sf,i.initializeIssueTypeFields=kA,i.initializeIssueTypeFieldsAttachments=yA,i.initializeIssueTypeIdentifierValues=Ef,i.initializeIssueTypeIdentifiers=Af,i.initializeIssueTypeStatuses=nS,i.initializeIssueTypes=Hf,i.initializeIssueUpdates=fS,i.initializeIssues=Lp,i.initializeOrganizationAccesses=CS,i.initializeOrganizations=QS,i.initializeProjectAccesses=TT,i.initializeProjectAttachments=VT,i.initializeProjectFiles=WT,i.initializeProjects=lI,i.initializeTeamMemberships=bI,i.initializeTeams=$I,i.initializeUsers=MS,i.isToday=LO,i.issueAssociationReducer=xy,i.issueAssociationSlice=Bi,i.issueAttachmentReducer=hp,i.issueAttachmentSlice=ji,i.issueCommentAttachmentReducer=_p,i.issueCommentAttachmentSlice=$i,i.issueCommentReducer=$p,i.issueCommentSlice=Li,i.issueReducer=Qp,i.issueSlice=Ni,i.issueTypeAttachmentReducer=hA,i.issueTypeAttachmentSlice=Wi,i.issueTypeFieldValuesAttachmentReducer=yf,i.issueTypeFieldValuesAttachmentSlice=Qi,i.issueTypeFieldValuesReducer=UA,i.issueTypeFieldValuesSlice=Ji,i.issueTypeFieldsAttachmentReducer=_A,i.issueTypeFieldsAttachmentSlice=Yi,i.issueTypeFieldsReducer=ef,i.issueTypeFieldsSlice=Xi,i.issueTypeIdentifierReducer=Rf,i.issueTypeIdentifierSlice=sn,i.issueTypeIdentifierValueReducer=kf,i.issueTypeIdentifierValueSlice=an,i.issueTypeReducer=sS,i.issueTypeSlice=cn,i.issueTypeStatusReducer=pS,i.issueTypeStatusSlice=rn,i.issueTypeStatusSortFn=ca,i.issueUpdateReducer=bS,i.issueUpdateSlice=on,i.logOnlyOnce=ZO,i.markAsDeleted=pT,i.markForDeletion=_F,i.memoize=Ht,i.onlyUniqueHashes=sP,i.onlyUniqueOfflineIds=tP,i.organizationAccessReducer=KS,i.organizationAccessSlice=Pn,i.organizationReducer=oT,i.organizationSlice=Fn,i.outboxReducer=fT,i.outboxSlice=gn,i.overmapEnhancer=xF,i.overmapReducer=NF,i.overmapReducers=eO,i.performRequest=Un,i.performRequestFromAction=oO,i.projectAccessReducer=RT,i.projectAccessSlice=bn,i.projectAttachmentReducer=HT,i.projectAttachmentSlice=Mn,i.projectFileReducer=rI,i.projectFileSlice=wn,i.projectReducer=TI,i.projectSlice=En,i.rehydratedReducer=FI,i.rehydratedSlice=vn,i.restructureCreateSelectorWithArgs=S,i.runMiddleware=FO,i.saveActiveProjectFileBounds=iI,i.selectAccessToken=GP,i.selectAccessesByUserOfProject=RF,i.selectAccessibleProjects=zF,i.selectActiveOrganizationAccess=PF,i.selectActiveProjectFileId=vF,i.selectAllDocumentAttachments=ni,i.selectAllProjectAttachments=Rn,i.selectAssetAttachmentById=ga,i.selectAssetAttachmentMapping=Fa,i.selectAssetAttachments=xt,i.selectAssetAttachmentsByIds=ba,i.selectAssetById=$r,i.selectAssetProcedureById=ed,i.selectAssetProcedureStepById=Mr,i.selectAssetProcedureStepFieldValues=ut,i.selectAssetProcedureStepFieldValuesAttachmentById=Qd,i.selectAssetProcedureStepFieldValuesAttachments=Ps,i.selectAssetProcedureStepFieldValuesAttachmentsByIds=xd,i.selectAssetProcedureStepFieldValuesAttachmentsMapping=Xd,i.selectAssetProcedureStepFieldValuesById=mr,i.selectAssetProcedureStepFieldValuesByIds=yr,i.selectAssetProcedureStepFieldValuesMapping=hr,i.selectAssetProcedureStepFieldValuesOfAsset=bP,i.selectAssetProcedureStepFieldValuesOfAssetProcedure=_P,i.selectAssetProcedureStepFieldValuesOfAssetProcedureStep=MP,i.selectAssetProcedureStepFields=It,i.selectAssetProcedureStepFieldsAttachmentById=Md,i.selectAssetProcedureStepFieldsAttachments=As,i.selectAssetProcedureStepFieldsAttachmentsByIds=Rd,i.selectAssetProcedureStepFieldsAttachmentsMapping=_d,i.selectAssetProcedureStepFieldsById=Ud,i.selectAssetProcedureStepFieldsByIds=Ld,i.selectAssetProcedureStepFieldsMapping=Ss,i.selectAssetProcedureStepFieldsOfAssetProcedureStep=PP,i.selectAssetProcedureStepMapping=Ot,i.selectAssetProcedureSteps=bs,i.selectAssetProcedureStepsByIds=Rr,i.selectAssetProcedureStepsMappingOfAssetProcedureType=RP,i.selectAssetProcedureStepsOfAssetProcedureType=wP,i.selectAssetProcedureTypeAttachmentById=Ua,i.selectAssetProcedureTypeAttachmentMapping=$a,i.selectAssetProcedureTypeAttachments=ts,i.selectAssetProcedureTypeAttachmentsByIds=La,i.selectAssetProcedureTypeById=yd,i.selectAssetProcedureTypeFieldValues=St,i.selectAssetProcedureTypeFieldValuesAttachmentById=_c,i.selectAssetProcedureTypeFieldValuesAttachments=rs,i.selectAssetProcedureTypeFieldValuesAttachmentsByIds=Mc,i.selectAssetProcedureTypeFieldValuesAttachmentsMapping=bc,i.selectAssetProcedureTypeFieldValuesById=Lc,i.selectAssetProcedureTypeFieldValuesByIds=kc,i.selectAssetProcedureTypeFieldValuesMapping=Uc,i.selectAssetProcedureTypeFieldValuesOfAsset=fP,i.selectAssetProcedureTypeFields=ft,i.selectAssetProcedureTypeFieldsAttachmentById=ec,i.selectAssetProcedureTypeFieldsAttachments=is,i.selectAssetProcedureTypeFieldsAttachmentsByIds=tc,i.selectAssetProcedureTypeFieldsAttachmentsMapping=xa,i.selectAssetProcedureTypeFieldsById=yc,i.selectAssetProcedureTypeFieldsByIds=pc,i.selectAssetProcedureTypeFieldsMapping=mc,i.selectAssetProcedureTypeFieldsOfAssetProcedureType=pP,i.selectAssetProcedureTypes=ys,i.selectAssetProcedureTypesByIds=pd,i.selectAssetProcedureTypesMapping=md,i.selectAssetProcedureTypesOfOrganization=IP,i.selectAssetProcedures=Tt,i.selectAssetProceduresByIds=td,i.selectAssetProceduresMapping=Qc,i.selectAssetProceduresOfAssetProcedureType=xc,i.selectAssetProceduresOfAssetType=TP,i.selectAssetStageById=yu,i.selectAssetStageCompletionById=tu,i.selectAssetStageCompletionMapping=xr,i.selectAssetStageCompletions=eu,i.selectAssetStageCompletionsByIds=su,i.selectAssetStages=Bs,i.selectAssetStagesByIds=pu,i.selectAssetStagesMappingOfAssetProcedureType=vP,i.selectAssetStagesOfAssetProcedureType=VP,i.selectAssetTypeAttachmentById=bu,i.selectAssetTypeAttachmentMapping=gu,i.selectAssetTypeAttachments=Cs,i.selectAssetTypeAttachmentsByIds=_u,i.selectAssetTypeById=Ao,i.selectAssetTypeFieldValues=Pt,i.selectAssetTypeFieldValuesAttachmentById=hl,i.selectAssetTypeFieldValuesAttachments=Gs,i.selectAssetTypeFieldValuesAttachmentsByIds=ml,i.selectAssetTypeFieldValuesAttachmentsMapping=ol,i.selectAssetTypeFieldValuesById=Ml,i.selectAssetTypeFieldValuesByIds=Rl,i.selectAssetTypeFieldValuesMapping=_l,i.selectAssetTypeFieldValuesOfAsset=qP,i.selectAssetTypeFields=lt,i.selectAssetTypeFieldsAttachmentById=Uu,i.selectAssetTypeFieldsAttachments=Us,i.selectAssetTypeFieldsAttachmentsByIds=Lu,i.selectAssetTypeFieldsAttachmentsMapping=$u,i.selectAssetTypeFieldsById=el,i.selectAssetTypeFieldsByIds=tl,i.selectAssetTypeFieldsMapping=xu,i.selectAssetTypeFieldsOfAssetType=BP,i.selectAssetTypeIdentifierById=Ll,i.selectAssetTypeIdentifierMapping=Ul,i.selectAssetTypeIdentifierValueById=to,i.selectAssetTypeIdentifierValueMapping=eo,i.selectAssetTypeIdentifierValues=Ft,i.selectAssetTypeIdentifierValuesByIds=so,i.selectAssetTypeIdentifierValuesOfAsset=$P,i.selectAssetTypeIdentifierValuesOfIdentifier=UP,i.selectAssetTypeIdentifiers=Ys,i.selectAssetTypeIdentifiersByIds=kl,i.selectAssetTypeIdentifiersOfAssetType=CP,i.selectAssetTypeStatusById=Eo,i.selectAssetTypeStatusMapping=wo,i.selectAssetTypeStatuses=xs,i.selectAssetTypeStatusesByIds=vo,i.selectAssetTypeStatusesOfAssetType=kP,i.selectAssetTypeValuesOfAssetType=DP,i.selectAssetTypes=Xs,i.selectAssetTypesByIds=fo,i.selectAssetTypesMapping=po,i.selectAssetTypesOfOrganization=LP,i.selectAssets=ws,i.selectAssetsByIds=Ur,i.selectAssetsMapping=Cr,i.selectAssetsOfAssetType=Es,i.selectAttachmentsOfAsset=_a,i.selectAttachmentsOfAssetProcedureStepFieldValues=er,i.selectAttachmentsOfAssetProcedureStepFields=OP,i.selectAttachmentsOfAssetProcedureType=mP,i.selectAttachmentsOfAssetProcedureTypeFieldValues=Rc,i.selectAttachmentsOfAssetProcedureTypeFields=yP,i.selectAttachmentsOfAssetType=Mu,i.selectAttachmentsOfAssetTypeFieldValues=yl,i.selectAttachmentsOfAssetTypeFields=zP,i.selectAttachmentsOfDocument=YP,i.selectAttachmentsOfFormRevision=sF,i.selectAttachmentsOfFormSubmission=ly,i.selectAttachmentsOfIssue=up,i.selectAttachmentsOfIssueComment=cF,i.selectAttachmentsOfIssueType=uF,i.selectAttachmentsOfIssueTypeFieldValues=mf,i.selectAttachmentsOfIssueTypeFields=lF,i.selectAttachmentsOfProject=EF,i.selectCategories=ti,i.selectCategoriesByIds=Ko,i.selectCategoriesOfProject=KP,i.selectCategoryById=si,i.selectCategoryMapping=Wo,i.selectCommentsOfIssue=dF,i.selectConversation=hP,i.selectConversationMapping=Zt,i.selectConversations=oP,i.selectCurrentUser=jS,i.selectDeletedRequests=gF,i.selectDescendantsOfAssetProcedureStep=wr,i.selectDescendantsOfDocument=Ph,i.selectDocumentAttachmentById=ch,i.selectDocumentAttachmentMapping=ah,i.selectDocumentAttachmentsByIds=dh,i.selectDocumentById=Ih,i.selectDocuments=bt,i.selectDocumentsByIds=Oh,i.selectDocumentsMapping=ci,i.selectEmailDomainById=Bh,i.selectEmailDomains=ri,i.selectEmailDomainsAsMapping=zh,i.selectEmailDomainsByIds=jh,i.selectEmailDomainsOfOrganization=XP,i.selectFieldValuesOfAssetProcedure=SP,i.selectFormById=Qm,i.selectFormIdentifierById=xh,i.selectFormIdentifierMapping=Qh,i.selectFormIdentifierValueById=mm,i.selectFormIdentifierValueMapping=hm,i.selectFormIdentifierValues=_t,i.selectFormIdentifierValuesByIds=ym,i.selectFormIdentifierValuesOfFormSubmission=eF,i.selectFormIdentifierValuesOfIdentifier=tF,i.selectFormIdentifiers=oi,i.selectFormIdentifiersByIds=em,i.selectFormIdentifiersOfForm=xP,i.selectFormMapping=Xm,i.selectFormRevisionAttachmentById=Mm,i.selectFormRevisionAttachments=_m,i.selectFormRevisionAttachmentsByIds=Rm,i.selectFormRevisionAttachmentsMapping=Mt,i.selectFormRevisionById=qm,i.selectFormRevisionMapping=Ti,i.selectFormRevisions=Rt,i.selectFormRevisionsByIds=Dm,i.selectFormRevisionsOfForm=Cm,i.selectFormSubmissionAttachemntsByIds=Mi,i.selectFormSubmissionAttachmentById=ry,i.selectFormSubmissionAttachments=_i,i.selectFormSubmissionAttachmentsByIds=uy,i.selectFormSubmissionAttachmentsMapping=bi,i.selectFormSubmissionById=Oy,i.selectFormSubmissions=Iy,i.selectFormSubmissionsByIds=Py,i.selectFormSubmissionsMapping=vi,i.selectFormSubmissionsOfForm=Fy,i.selectForms=Oi,i.selectFormsByIds=xm,i.selectFormsOfOrganization=nF,i.selectGeoImageById=qy,i.selectGeoImageMapping=jy,i.selectGeoImages=zi,i.selectGeoImagesByIds=Dy,i.selectGeoImagesOfProject=aF,i.selectIsImportingProjectFile=VF,i.selectIsLoggedIn=WP,i.selectIssueAssociationById=Yy,i.selectIssueAssociationMapping=ot,i.selectIssueAssociations=Ky,i.selectIssueAssociationsByIds=Zy,i.selectIssueAssociationsOfAsset=Qy,i.selectIssueAssociationsOfIssue=Xy,i.selectIssueAssociationsToIssue=Jy,i.selectIssueAttachmentById=lp,i.selectIssueAttachmentMapping=rp,i.selectIssueAttachments=Ci,i.selectIssueAttachmentsByIds=op,i.selectIssueById=Zp,i.selectIssueCommentAttachmentById=gp,i.selectIssueCommentAttachmentMapping=Fp,i.selectIssueCommentAttachments=Ui,i.selectIssueCommentAttachmentsByIds=bp,i.selectIssueCommentById=Dp,i.selectIssueCommentMapping=ki,i.selectIssueCommentsByIds=Cp,i.selectIssueMapping=Yp,i.selectIssueTypeAttachmentById=lA,i.selectIssueTypeAttachmentMapping=uA,i.selectIssueTypeAttachments=Ki,i.selectIssueTypeAttachmentsByIds=oA,i.selectIssueTypeById=eS,i.selectIssueTypeFieldValues=Vt,i.selectIssueTypeFieldValuesAttachmentById=of,i.selectIssueTypeFieldValuesAttachments=tn,i.selectIssueTypeFieldValuesAttachmentsByIds=hf,i.selectIssueTypeFieldValuesAttachmentsMapping=lf,i.selectIssueTypeFieldValuesById=CA,i.selectIssueTypeFieldValuesByIds=$A,i.selectIssueTypeFieldValuesMapping=DA,i.selectIssueTypeFieldValuesOfIssue=oF,i.selectIssueTypeFields=ht,i.selectIssueTypeFieldsAttachmentById=gA,i.selectIssueTypeFieldsAttachments=Zi,i.selectIssueTypeFieldsAttachmentsByIds=bA,i.selectIssueTypeFieldsAttachmentsMapping=FA,i.selectIssueTypeFieldsById=QA,i.selectIssueTypeFieldsByIds=xA,i.selectIssueTypeFieldsMapping=XA,i.selectIssueTypeFieldsOfIssueType=hF,i.selectIssueTypeIdentifierById=_f,i.selectIssueTypeIdentifierMapping=bf,i.selectIssueTypeIdentifierValueById=Uf,i.selectIssueTypeIdentifierValueMapping=$f,i.selectIssueTypeIdentifierValues=zt,i.selectIssueTypeIdentifierValuesByIds=Lf,i.selectIssueTypeIdentifierValuesOfIdentifier=fF,i.selectIssueTypeIdentifierValuesOfIssue=AF,i.selectIssueTypeIdentifiers=nn,i.selectIssueTypeIdentifiersByIds=Mf,i.selectIssueTypeIdentifiersOfIssueType=pF,i.selectIssueTypeMapping=xf,i.selectIssueTypeStatusById=ln,i.selectIssueTypeStatusMapping=mS,i.selectIssueTypeStatuses=un,i.selectIssueTypeStatusesByIds=yS,i.selectIssueTypeStatusesOfIssueType=TF,i.selectIssueTypeValuesOfIssueType=yF,i.selectIssueTypes=dn,i.selectIssueTypesByIds=tS,i.selectIssueTypesOfOrganization=SF,i.selectIssueUpdateById=PS,i.selectIssueUpdateMapping=An,i.selectIssueUpdates=fn,i.selectIssueUpdatesByIds=FS,i.selectIssueUpdatesOfIssue=gS,i.selectIssues=vt,i.selectIssuesByIds=Jp,i.selectIssuesOfIssueType=Xp,i.selectIssuesOfProject=rF,i.selectLatestAssetProcedureStepFieldsOfAssetProcedureStep=FP,i.selectLatestAssetProcedureTypeFieldsOfAssetProcedureType=AP,i.selectLatestAssetTypeFieldsOfAssetType=jP,i.selectLatestFieldsByAssetProcedureStep=gP,i.selectLatestFormRevisionOfForm=iF,i.selectLatestIssueTypeFieldsOfIssueType=mF,i.selectLatestRetryTime=bF,i.selectMembershipsByUserOfTeam=CF,i.selectNumberOfAssetsOfAssetType=EP,i.selectOrganizationAccessById=YS,i.selectOrganizationAccessMapping=qt,i.selectOrganizationAccessUserMapping=JS,i.selectOrganizationAccessesByIds=ZS,i.selectOrganizationById=uT,i.selectOrganizationDocuments=JP,i.selectOrganizations=rT,i.selectOrganizationsByIds=lT,i.selectOrganizationsMapping=dT,i.selectProjectAccessById=wT,i.selectProjectAccessMapping=_n,i.selectProjectAccesses=mt,i.selectProjectAccessesByIds=ET,i.selectProjectAccessesOfProject=MF,i.selectProjectAttachmentById=kT,i.selectProjectAttachmentMapping=LT,i.selectProjectAttachmentsByIds=NT,i.selectProjectById=OI,i.selectProjectDocuments=ZP,i.selectProjectFileById=cI,i.selectProjectFileMapping=nI,i.selectProjectFiles=aI,i.selectProjectFilesByIds=dI,i.selectProjectMapping=II,i.selectProjects=Dt,i.selectProjectsByIds=PI,i.selectProjectsOfOrganization=BF,i.selectRehydrated=DF,i.selectStageMapping=zs,i.selectTeamById=ZI,i.selectTeamMembershipById=qI,i.selectTeamMemberships=Ct,i.selectTeamMembershipsByIds=DI,i.selectTeamMembershipsMapping=jI,i.selectTeams=Bn,i.selectTeamsByIds=JI,i.selectTeamsMapping=YI,i.selectTeamsOfOrganization=UF,i.selectUploadUrl=Uh,i.selectUserById=jt,i.selectUsers=Bt,i.selectUsersByIds=qS,i.selectUsersMapping=On,i.selectUsersOfOrganization=FF,i.selectUsersOfProject=wF,i.selectUsersOfTeam=$F,i.setActiveProjectFileId=sI,i.setAsset=qr,i.setAssetAttachment=Sa,i.setAssetAttachments=Ta,i.setAssetProcedure=Zc,i.setAssetProcedureStep=Sr,i.setAssetProcedureStepFieldValues=cr,i.setAssetProcedureStepFieldValuesAttachment=Wd,i.setAssetProcedureStepFieldValuesAttachments=Kd,i.setAssetProcedureStepFieldValuesMany=dr,i.setAssetProcedureStepFields=Bd,i.setAssetProcedureStepFieldsAttachment=Id,i.setAssetProcedureStepFieldsAttachments=Od,i.setAssetProcedureStepFieldsMany=jd,i.setAssetProcedureSteps=Tr,i.setAssetProcedureType=ld,i.setAssetProcedureTypeAttachment=Va,i.setAssetProcedureTypeAttachments=za,i.setAssetProcedureTypeFieldValues=zc,i.setAssetProcedureTypeFieldValuesAttachment=Tc,i.setAssetProcedureTypeFieldValuesAttachments=Ic,i.setAssetProcedureTypeFieldValuesMany=Bc,i.setAssetProcedureTypeFields=cc,i.setAssetProcedureTypeFieldsAttachment=Wa,i.setAssetProcedureTypeFieldsAttachments=Ka,i.setAssetProcedureTypeFieldsMany=dc,i.setAssetProcedureTypes=od,i.setAssetProcedures=Jc,i.setAssetStage=au,i.setAssetStageCompletion=Wr,i.setAssetStageCompletions=Kr,i.setAssetStages=cu,i.setAssetType=co,i.setAssetTypeAttachment=Tu,i.setAssetTypeAttachments=Iu,i.setAssetTypeFieldValues=Il,i.setAssetTypeFieldValuesAttachment=cl,i.setAssetTypeFieldValuesAttachments=dl,i.setAssetTypeFieldValuesMany=Ol,i.setAssetTypeFields=Ku,i.setAssetTypeFieldsAttachment=zu,i.setAssetTypeFieldsAttachments=Bu,i.setAssetTypeFieldsMany=Yu,i.setAssetTypeIdentifier=Bl,i.setAssetTypeIdentifierValue=Yl,i.setAssetTypeIdentifierValues=Zl,i.setAssetTypeIdentifiers=jl,i.setAssetTypeStatus=Fo,i.setAssetTypeStatuses=go,i.setAssetTypes=ro,i.setAssets=Dr,i.setCategories=Lo,i.setCategory=Uo,i.setClientSDK=SO,i.setClientStore=AO,i.setConversation=ha,i.setConversations=dP,i.setCurrentUser=IF,i.setDocument=mh,i.setDocumentAttachment=xo,i.setDocumentAttachments=eh,i.setDocuments=yh,i.setEmailDomain=Mh,i.setEmailDomains=Rh,i.setForm=Hm,i.setFormIdentifier=Wh,i.setFormIdentifierValue=cm,i.setFormIdentifierValues=dm,i.setFormIdentifiers=Kh,i.setFormRevision=Vm,i.setFormRevisionAttachment=Im,i.setFormRevisionAttachments=Om,i.setFormRevisions=zm,i.setFormSubmission=yy,i.setFormSubmissionAttachment=iy,i.setFormSubmissionAttachments=ny,i.setFormSubmissions=py,i.setForms=Gm,i.setGeoImage=My,i.setGeoImages=Ry,i.setIsImportingProjectFile=tI,i.setIssue=Np,i.setIssueAssociation=ky,i.setIssueAssociations=Ly,i.setIssueAttachment=ip,i.setIssueAttachments=np,i.setIssueComment=vp,i.setIssueCommentAttachment=fp,i.setIssueCommentAttachments=Sp,i.setIssueComments=Vp,i.setIssueType=Kf,i.setIssueTypeAttachment=iA,i.setIssueTypeAttachments=nA,i.setIssueTypeFieldValues=vA,i.setIssueTypeFieldValuesAttachment=af,i.setIssueTypeFieldValuesAttachments=cf,i.setIssueTypeFieldValuesMany=VA,i.setIssueTypeFields=GA,i.setIssueTypeFieldsAttachment=fA,i.setIssueTypeFieldsAttachments=SA,i.setIssueTypeFieldsMany=WA,i.setIssueTypeIdentifier=Tf,i.setIssueTypeIdentifierValue=zf,i.setIssueTypeIdentifierValues=Bf,i.setIssueTypeIdentifiers=If,i.setIssueTypeStatus=dS,i.setIssueTypeStatuses=rS,i.setIssueTypes=Yf,i.setIssueUpdate=SS,i.setIssueUpdates=TS,i.setIssues=Hp,i.setLoggedIn=Bo,i.setOrganization=eT,i.setOrganizationAccess=LS,i.setOrganizationAccesses=kS,i.setOrganizations=xS,i.setProfilePicture=OF,i.setProject=hI,i.setProjectAccess=PT,i.setProjectAccesses=FT,i.setProjectAttachment=jT,i.setProjectAttachments=qT,i.setProjectFile=KT,i.setProjectFiles=YT,i.setProjects=oI,i.setRehydrated=qF,i.setTeam=kI,i.setTeamMembership=RI,i.setTeamMemberships=wI,i.setTeams=NI,i.setTokens=NP,i.setUploadUrl=$h,i.setUser=wS,i.setUsers=RS,i.shallowEqual=DO,i.slugify=xO,i.spacesToDashesLower=QO,i.teamMembershipReducer=BI,i.teamMembershipSlice=Vn,i.teamReducer=XI,i.teamSlice=zn,i.toFileNameSafeString=XO,i.toUuidArray=D,i.toUuidIdRecord=JO,i.truncate=eP,i.updateAsset=zr,i.updateAssetAttachment=Ia,i.updateAssetAttachments=Oa,i.updateAssetProcedure=Wc,i.updateAssetProcedureStep=Pr,i.updateAssetProcedureStepFieldValues=rr,i.updateAssetProcedureStepFieldValuesAttachment=Yd,i.updateAssetProcedureStepFieldValuesAttachments=Zd,i.updateAssetProcedureStepFieldValuesMany=ur,i.updateAssetProcedureStepFields=qd,i.updateAssetProcedureStepFieldsAttachment=Pd,i.updateAssetProcedureStepFieldsAttachments=Fd,i.updateAssetProcedureStepFieldsMany=Dd,i.updateAssetProcedureSteps=Fr,i.updateAssetProcedureType=cd,i.updateAssetProcedureTypeAttachment=Ba,i.updateAssetProcedureTypeAttachments=ja,i.updateAssetProcedureTypeFieldValues=jc,i.updateAssetProcedureTypeFieldValuesAttachment=Oc,i.updateAssetProcedureTypeFieldValuesAttachments=Pc,i.updateAssetProcedureTypeFieldValuesMany=qc,i.updateAssetProcedureTypeFields=rc,i.updateAssetProcedureTypeFieldsAttachment=Ya,i.updateAssetProcedureTypeFieldsAttachments=Za,i.updateAssetProcedureTypeFieldsMany=uc,i.updateAssetProcedureTypes=dd,i.updateAssetProcedures=Kc,i.updateAssetStage=uu,i.updateAssetStageCompletion=Yr,i.updateAssetStageCompletions=Zr,i.updateAssetStages=lu,i.updateAssetType=oo,i.updateAssetTypeAttachment=Ou,i.updateAssetTypeAttachments=Pu,i.updateAssetTypeFieldValues=Pl,i.updateAssetTypeFieldValuesAttachment=rl,i.updateAssetTypeFieldValuesAttachments=ul,i.updateAssetTypeFieldValuesMany=Fl,i.updateAssetTypeFields=Zu,i.updateAssetTypeFieldsAttachment=ju,i.updateAssetTypeFieldsAttachments=qu,i.updateAssetTypeFieldsMany=Ju,i.updateAssetTypeIdentifier=ql,i.updateAssetTypeIdentifierValue=Jl,i.updateAssetTypeIdentifierValues=Xl,i.updateAssetTypeIdentifiers=Dl,i.updateAssetTypeStatus=bo,i.updateAssetTypeStatuses=_o,i.updateAssetTypes=ho,i.updateAssets=Br,i.updateCategories=No,i.updateCategory=ko,i.updateConversation=ma,i.updateConversations=rP,i.updateDocument=ph,i.updateDocumentAttachment=th,i.updateDocumentAttachments=sh,i.updateDocuments=Ah,i.updateEmailDomain=wh,i.updateEmailDomains=Eh,i.updateForm=Wm,i.updateFormIdentifier=Yh,i.updateFormIdentifierValue=rm,i.updateFormIdentifierValues=um,i.updateFormIdentifiers=Zh,i.updateFormRevision=Bm,i.updateFormRevisionAttachment=Pm,i.updateFormRevisionAttachments=Fm,i.updateFormRevisions=jm,i.updateFormSubmission=fy,i.updateFormSubmissionAttachment=ay,i.updateFormSubmissionAttachments=cy,i.updateFormSubmissions=Sy,i.updateForms=Km,i.updateGeoImage=vy,i.updateGeoImages=Vy,i.updateIssue=Gp,i.updateIssueAssociation=Ny,i.updateIssueAssociations=Hy,i.updateIssueAttachment=ap,i.updateIssueAttachments=cp,i.updateIssueComment=zp,i.updateIssueCommentAttachment=Tp,i.updateIssueCommentAttachments=Ip,i.updateIssueComments=Bp,i.updateIssueType=Zf,i.updateIssueTypeAttachment=aA,i.updateIssueTypeAttachments=cA,i.updateIssueTypeFieldValues=zA,i.updateIssueTypeFieldValuesAttachment=df,i.updateIssueTypeFieldValuesAttachments=rf,i.updateIssueTypeFieldValuesMany=BA,i.updateIssueTypeFields=KA,i.updateIssueTypeFieldsAttachment=TA,i.updateIssueTypeFieldsAttachments=IA,i.updateIssueTypeFieldsMany=YA,i.updateIssueTypeIdentifier=Of,i.updateIssueTypeIdentifierValue=jf,i.updateIssueTypeIdentifierValues=qf,i.updateIssueTypeIdentifiers=Pf,i.updateIssueTypeStatus=uS,i.updateIssueTypeStatuses=lS,i.updateIssueTypes=Jf,i.updateIssueUpdate=IS,i.updateIssueUpdates=OS,i.updateIssues=Wp,i.updateOrganization=nT,i.updateOrganizationAccess=NS,i.updateOrganizationAccesses=HS,i.updateOrganizations=iT,i.updateProject=AI,i.updateProjectAccess=gT,i.updateProjectAccesses=bT,i.updateProjectAttachment=DT,i.updateProjectAttachments=CT,i.updateProjectFile=XT,i.updateProjectFiles=QT,i.updateProjects=pI,i.updateTeam=HI,i.updateTeamMembership=EI,i.updateTeamMemberships=vI,i.updateTeams=GI,i.updateUser=VS,i.updateUsers=vS,i.useSelectorBuilder=HF,i.userReducer=BS,i.userSlice=Sn,i.uuidObj=M,i.uuidObjSortFn=Kt,i.uuidSortFn=At,i.versioningReducer=xI,i.versioningSlice=QI,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
|
|
14
|
+
external URLs and therefore not prepended with VITE_API_URL.`;throw new Error(f)}const y=d.type.split("/")[1];if(!y)throw new Error("File has no extension");const A=a??o+"."+y;if(d=ea(d,A),!d.name)throw new Error("Failed to set file's name");await this.addCache(d,o),Ut[c]=new Promise(f=>{f(d)})}return d}processPresignedUrls(e){const n={};for(const[a,c]of Object.entries(e))n[a]=this.enqueueRequest({url:c.url,description:"Upload file to S3",method:h.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:a,blockers:[`s3-${c.fields.key}`],blocks:[a],s3url:c});return n}async getFilePayload(e){const n=await nt(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 Ug extends V{constructor(){super(...arguments);m(this,"name","Form Identifier");m(this,"url","/form-identifiers");m(this,"actions",{addOne:Hh,addMany:Wh,setOne:Kh,setMany:Yh,updateOne:Zh,updateMany:Jh,deleteOne:Xh,deleteMany:Qh,initialize:Gh});m(this,"selectors",{selectById:em,selectByIds:tm})}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=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[d.form],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}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:P(h.PATCH,this.name,!1),method:h.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:P(h.DELETE,this.name,!1),method:h.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 kg extends V{constructor(){super(...arguments);m(this,"name","Form Identifier Value");m(this,"url","/form-identifier-values");m(this,"actions",{addOne:am,addMany:cm,setOne:dm,setMany:rm,updateOne:um,updateMany:lm,deleteOne:om,deleteMany:hm,initialize:nm});m(this,"selectors",{selectById:ym,selectByIds:pm})}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=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[e.form_submission,e.form_identifier],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}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:P(h.PATCH,this.name,!1),method:h.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:P(h.DELETE,this.name,!1),method:h.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 Lg extends V{constructor(){super(...arguments);m(this,"name","Form Revision Attachment");m(this,"url","/form-revision-attachments");m(this,"actions",{addOne:Sm,addMany:Im,setOne:Om,setMany:Pm,updateOne:Fm,updateMany:gm,deleteOne:bm,deleteMany:_m,initialize:Tm});m(this,"selectors",{selectById:Rm,selectByIds:wm})}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=[],o=[];for(const f of e){const{revisionUuid:I,fieldIdentifier:g,file:F}=f,b=await this.client.files.getFilePayload(F);b.sha1 in u||(u[b.sha1]=b);const _=R({file:URL.createObjectURL(F),file_type:F.type,file_name:F.name,file_sha1:b.sha1,created_by:l,form_revision:I,submitted_at:r,field_identifier:g});d.push(_);const v={uuid:_.uuid,file_name:F.name,field_identifier:g,file_extension:b.extension,file_sha1:b.sha1,form_revision:I};o.push(v)}this.dispatch(n(d));const y=this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:o,files:Object.values(u)},blockers:d.map(f=>f.form_revision),blocks:d.map(f=>f.uuid)});return y.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,y.then(({attachments:f})=>f)]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{form_revision__form__organization:e}},n);return this.dispatch(a(c)),c}}class Ng extends V{constructor(){super(...arguments);m(this,"name","Form Revision");m(this,"url","/form-revisions");m(this,"actions",{addOne:Ai,addMany:fi,setOne:zm,setMany:Bm,updateOne:jm,updateMany:qm,deleteOne:Ti,deleteMany:Si,initialize:Vm});m(this,"selectors",{selectById:Dm,selectByIds:Cm})}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(),o=R({...e,created_by:u,submitted_at:d});this.dispatch(a(o));const y=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(o),blockers:[e.form],blocks:[o.uuid]});return y.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(o.uuid))}),[o,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 Gg extends V{constructor(){super(...arguments);m(this,"name","Form");m(this,"url","/forms");m(this,"actions",{addOne:Nm,addMany:Gm,setOne:Hm,setMany:Wm,updateOne:Km,updateMany:Ym,deleteOne:Zm,deleteMany:Jm,initialize:Lm});m(this,"selectors",{selectById:xm,selectByIds:ey})}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=R({...e,submitted_at:l,created_by:u}),o=R({...n,form:d.uuid,submitted_at:l,created_by:u});this.dispatch(c(d)),this.dispatch(Ai(o));const y=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:{...z(d),initial_revision:{uuid:o.uuid,submitted_at:o.submitted_at,title:o.title,description:o.description,fields:o.fields}},blockers:[],blocks:[d.uuid,o.uuid]});return y.catch(f=>{throw this.dispatch(r(d.uuid)),this.dispatch(Ti(o.uuid)),f}),[d,o,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=gy(e)(l),o=$m(e)(l);this.dispatch(a(e)),this.dispatch(vi(C(d))),this.dispatch(Si(C(o)));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(y){throw this.dispatch(c(u)),this.dispatch(fi(o)),this.dispatch(Ei(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 Hg extends V{constructor(){super(...arguments);m(this,"name","Form Submission Attachment");m(this,"url","/form-submission-attachments");m(this,"actions",{addOne:iy,addMany:gi,setOne:ny,setMany:ay,updateOne:cy,updateMany:dy,deleteOne:ry,deleteMany:bi,initialize:sy});m(this,"selectors",{selectById:uy,selectByIds:ly})}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=[],o=[];for(const f of e){const{submissionUuid:I,fieldIdentifier:g,file:F}=f,b=await this.client.files.getFilePayload(F);b.sha1 in u||(u[b.sha1]=b);const _=R({file:URL.createObjectURL(F),file_type:F.type,file_name:F.name,file_sha1:b.sha1,created_by:l,form_submission:I,submitted_at:r,field_identifier:g});d.push(_);const v={uuid:_.uuid,file_name:F.name,file_sha1:b.sha1,file_extension:b.extension,field_identifier:g,form_submission:I};o.push(v)}this.dispatch(n(d));const y=this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:o,files:Object.values(u)},blockers:d.map(f=>f.form_submission),blocks:d.map(f=>f.uuid)});return y.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(f=>{throw this.dispatch(c(d.map(I=>I.uuid))),f}),[d,y.then(({attachments:f})=>f)]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,r=n.getState(),l=Ri(e)(r);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!0),method:h.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 Wg extends V{constructor(){super(...arguments);m(this,"name","Form Submission");m(this,"url","/form-submissions");m(this,"actions",{addOne:fy,addMany:Ei,setOne:py,setMany:Ay,updateOne:Ty,updateMany:Sy,deleteOne:Iy,deleteMany:vi,initialize:yy});m(this,"selectors",{selectById:Py,selectByIds:Fy})}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(),o=R({...e,created_by:u,submitted_at:d}),y=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(o),blockers:[e.form_revision],blocks:[o.uuid]});return this.dispatch(a(o)),y.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(o.uuid))}),[o,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:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${u.uuid}/`,payload:e,blockers:[u.uuid],blocks:[u.uuid]});return d.then(o=>{this.dispatch(a(o))}).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=oy(e)(l);this.dispatch(a(e)),this.dispatch(bi(C(d)));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(c(u)),this.dispatch(gi(d)),o}}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 Kg extends V{constructor(){super(...arguments);m(this,"name","Geo Image");m(this,"url","/geo-images");m(this,"actions",{addOne:Ey,addMany:vy,setOne:Ry,setMany:wy,updateOne:Vy,updateMany:zy,deleteOne:By,deleteMany:jy,initialize:My});m(this,"selectors",{selectById:Dy,selectByIds:Cy})}async add(e){var g;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,{file:l,...u}=e,d=new Date().toISOString(),o=((g=n.getState().userReducer.currentUser)==null?void 0:g.id)??null,y=u.project,A=await this.client.files.getFilePayload(l),f=R({...u,file_name:l.name,file_sha1:A.sha1,file_type:l.type,file:URL.createObjectURL(l),submitted_at:d,created_by:o});this.dispatch(a(f));const I=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:{uuid:f.uuid,submitted_at:d,title:f.title,description:f.description,geo_marker:f.geo_marker,canvas_marker:f.canvas_marker,sha1:f.file_sha1,project:f.project,file_name:f.file_name,direction:f.direction,original_date:f.original_date,file:A},blocks:[y],blockers:[y]});return I.then(F=>{this.client.files.processPresignedUrls(F.presigned_urls),this.dispatch(c(F.geo_image))}).catch(()=>{this.dispatch(r(f.uuid))}),[f,I.then(F=>F.geo_image)]}async bulkAdd(e,n){var g;const{store:a}=this.client,{addMany:c,setMany:r,deleteMany:l}=this.actions,u=new Date().toISOString(),d=((g=a.getState().userReducer.currentUser)==null?void 0:g.id)??null,o=[],y=[],A=[],f={};for(const F of e){const{file:b,..._}=F,v=await this.client.files.getFilePayload(b);v.sha1 in f||(f[v.sha1]=v);const j=R({..._,file_name:b.name,file_sha1:v.sha1,file_type:b.type,file:URL.createObjectURL(b),submitted_at:u,created_by:d,project:n});o.push(j),y.push(j.uuid),A.push({uuid:j.uuid,sha1:j.file_sha1,file_name:j.file_name,title:j.title,description:j.description,geo_marker:j.geo_marker,canvas_marker:j.canvas_marker,direction:j.direction,original_date:j.original_date})}this.dispatch(c(o));const I=this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:u,project:n,geo_images:A,files:Object.values(f)},blocks:[n],blockers:y});return I.then(F=>{this.client.files.processPresignedUrls(F.presigned_urls),this.dispatch(r(F.geo_images))}).catch(()=>{this.dispatch(l(y))}),[o,I.then(F=>F.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:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return d.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`Map image with uuid ${e} does not exist in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blocks:[e],blockers:[e]})}catch(d){throw this.dispatch(c(u)),d}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.listPaginated({queryParams:{project:e}},n),r=c.flat();return this.dispatch(a(r)),c}}class Yg extends V{constructor(){super(...arguments);m(this,"name","Issue Association");m(this,"url","/issue-associations");m(this,"actions",{addOne:Wy,addMany:Et,setOne:Ny,setMany:Ly,updateOne:Gy,updateMany:Hy,deleteOne:Ky,deleteMany:vt,initialize:ky});m(this,"selectors",{selectById:Zy,selectByIds:Jy})}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=R({...e,submitted_at:l,created_by:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[e.associated_issue,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{associated_issue__project:e}},n)).flat();return this.dispatch(a(r)),r}}class Zg extends Qe{constructor(){super(...arguments);m(this,"name","Issue Attachment");m(this,"url","/issue-attachments");m(this,"actions",{addOne:ip,addMany:Di,setOne:np,setMany:ap,updateOne:cp,updateMany:dp,deleteOne:rp,deleteMany:Ci,initialize:sp});m(this,"selectors",{selectById:op,selectByIds:hp})}getId(e){return e.uuid}buildModel(e){return R({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 Jg extends Qe{constructor(){super(...arguments);m(this,"name","Issue Comment Attachment");m(this,"url","/issue-comment-attachments");m(this,"actions",{addOne:Ap,addMany:fp,setOne:Tp,setMany:Sp,updateOne:Ip,updateMany:Op,deleteOne:Pp,deleteMany:Fp,initialize:pp});m(this,"selectors",{selectById:bp,selectByIds:_p})}getId(e){return e.uuid}buildModel(e){return R({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 Xg extends V{constructor(){super(...arguments);m(this,"name","Issue Comment");m(this,"url","/issue-comments");m(this,"actions",{addOne:Ep,addMany:vp,setOne:Vp,setMany:zp,updateOne:Bp,updateMany:jp,deleteOne:qp,deleteMany:Dp,initialize:wp});m(this,"selectors",{selectById:Cp,selectByIds:$p})}add(e){const{store:n}=this.client,{addOne:a,updateOne:c,deleteOne:r}=this.actions,l=R({...e,author:n.getState().userReducer.currentUser.id,submitted_at:new Date().toISOString()});this.dispatch(a(l));const u=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(l),blockers:[e.issue],blocks:[l.uuid]});return u.then(d=>{this.dispatch(c(d))}).catch(()=>{this.dispatch(r(l.uuid))}),[l,u]}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState());if(!r)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(()=>{this.dispatch(a(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{setMany:a}=this.actions,r=(await this.listPaginated({queryParams:{issue__project:e}},n)).flat();return this.dispatch(a(r)),r}}class Qg extends V{constructor(){super(...arguments);m(this,"name","Issue");m(this,"url","/issues");m(this,"actions",{addOne:Np,addMany:Hi,setOne:Gp,setMany:Hp,updateOne:Wp,updateMany:Kp,deleteOne:Yp,deleteMany:Wi,initialize:Lp});m(this,"selectors",{selectById:Jp,selectByIds:Xp})}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,o=R({...e,submitted_at:u,created_by:d});this.dispatch(a(o));const y=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(o),blockers:[o.project,o.issue_type,...o.category?[o.category]:[]],blocks:[o.uuid]});return y.then(f=>{this.dispatch(c(f))}).catch(f=>{throw this.dispatch(r(o.uuid)),f}),[o,y]}update(e){var y;const{updateOne:n}=this.actions,{selectById:a}=this.selectors,c=this.client.store.getState(),r=a(e.uuid)(c);if(!r)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const l={...r,...e};this.dispatch(n(l));const u={};for(const A of[U.TITLE,U.DESCRIPTION,U.STATUS,U.CATEGORY,U.PRIORITY,U.ASSIGNED_TO,U.DUE_DATE])if(A in e&&e[A]!==r[A])switch(A){case U.PRIORITY:u[A]=e[A];break;case U.DUE_DATE:u[A]=e[A];break;case U.DESCRIPTION:u[A]=e[A];break;case U.TITLE:u[A]=e[A];break;case U.STATUS:{const f=e[A],I=on(f)(c);if(!I)throw new Error(`Trying to update issue type status with ${f} which does not exist in store`);u[A]={name:I.name,color:I.color,uuid:I.uuid};break}case U.CATEGORY:{const f=e[A];if(f===null)u[A]=null;else{const I=ii(f)(c);if(!I)throw new Error(`Trying to update category with ${f} which does not exist in store.`);u[A]={name:I.name,color:I.color,uuid:I.uuid}}break}case U.ASSIGNED_TO:{const f=e[A];if(f===null)u[A]=null;else{const I=qt(f)(c);if(!I)throw new Error(`Trying to update assigned to with ${f} which does not exist in store.`);u[A]={full_name:I.username,id:I.id}}break}}const d=R({created_by:((y=c.userReducer.currentUser)==null?void 0:y.id)??null,submitted_at:new Date().toISOString(),issue:r.uuid,changes:u});this.dispatch(mn(d));const o=this.enqueueRequest({description:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return o.then(A=>{this.dispatch(n(A))}).catch(()=>{this.dispatch(n(r)),this.dispatch(pn(d.uuid))}),[l,o]}bulkUpdate(e,n){const{store:a}=this.client,{updateMany:c}=this.actions,{selectByIds:r}=this.selectors,l=C(e).toSorted(ft);if(l.length!==e.length)throw new Error("payloads contains duplicate uuids.");const u=r(l)(a.getState()).toSorted(Yt);if(l.length!=u.length)throw new Error(`Attempting to bulk update ${l.length-u.length} issues that dont exist in the store`);const d=[];for(let f=0;f<l.length;f++)d.push({...u[f],...e[f]});this.dispatch(c(d));const o=xe(e,Math.min(n??e.length,N)),y=[];let A=null;for(const f of o){const I=et.v4(),g=C(f),F=f.map(({status:v})=>v).filter(Boolean),b=f.map(({category:v})=>v).filter(Boolean),_=this.enqueueRequest({description:P(h.PATCH,this.name,!0),method:h.PATCH,url:`${this.url}/bulk/`,payload:{payloads:f},blockers:g.concat(F).concat(b).concat(A?[A]:[]),blocks:g.concat([I])});y.push(_),A=I}return Promise.all(y).then(f=>{this.dispatch(c(f.flat()))}).catch(()=>{this.dispatch(c(u))}),[d,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(`No issue with uuid ${e} found in the store`);const d=lp(e)(l),o=bT(e)(l),y={};for(const f of Xy(e)(l))y[f.uuid]=f;for(const f of Qy(e)(l))y[f.uuid]=f;const A=Object.values(y);this.dispatch(a(e)),this.dispatch(Ci(C(d))),this.dispatch(An(C(o))),this.dispatch(vt(C(A)));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(f){throw this.dispatch(c(u)),this.dispatch(Di(d)),this.dispatch(yn(o)),this.dispatch(Et(A)),f}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(r)),r}}class xg extends Qe{constructor(){super(...arguments);m(this,"name","Issue Type Attachment");m(this,"url","/issue-type-attachments");m(this,"actions",{addOne:sA,addMany:iA,setOne:nA,setMany:aA,updateOne:cA,updateMany:dA,deleteOne:rA,deleteMany:uA,initialize:tA});m(this,"selectors",{selectById:oA,selectByIds:hA})}getId(e){return e.uuid}buildModel(e){return R({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 eb extends V{constructor(){super(...arguments);m(this,"name","Issue Type Fields Attachment");m(this,"url","/issue-type-fields-attachments");m(this,"actions",{addOne:AA,addMany:fA,setOne:TA,setMany:SA,updateOne:IA,updateMany:OA,deleteOne:PA,deleteMany:FA,initialize:pA});m(this,"selectors",{selectById:bA,selectByIds:_A})}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=[],o=[];for(const f of e){const{fieldsRevisionUuid:I,fieldIdentifier:g,file:F}=f,b=await this.client.files.getFilePayload(F);b.sha1 in u||(u[b.sha1]=b);const _=R({file:URL.createObjectURL(F),file_type:F.type,file_name:F.name,file_sha1:b.sha1,created_by:l,fields_revision:I,submitted_at:r,field_identifier:g});d.push(_);const v={uuid:_.uuid,file_name:F.name,file_extension:b.extension,field_identifier:g,file_sha1:b.sha1,fields_revision:I};o.push(v)}this.dispatch(n(d));const y=this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:o,files:Object.values(u)},blockers:d.map(f=>f.fields_revision),blocks:d.map(f=>f.uuid)});return y.then(f=>{this.client.files.processPresignedUrls(f.presigned_urls),this.dispatch(a(f.attachments))}).catch(()=>{this.dispatch(c(d.map(f=>f.uuid)))}),[d,y.then(({attachments:f})=>f)]}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{fields_revision__issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class tb extends V{constructor(){super(...arguments);m(this,"name","Issue Type Fields");m(this,"url","/issue-type-fields");m(this,"actions",{addOne:GA,addMany:HA,setOne:WA,setMany:KA,updateOne:YA,updateMany:ZA,deleteOne:JA,deleteMany:XA,initialize:NA});m(this,"selectors",{selectById:xA,selectByIds:ef})}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=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[d.issue_type],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(A=>{throw this.dispatch(r(d.uuid)),A}),[d,o]}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 sb extends V{constructor(){super(...arguments);m(this,"name","Issue Type Field Values Attachment");m(this,"url","/issue-type-field-values-attachments");m(this,"actions",{addOne:af,addMany:en,setOne:cf,setMany:df,updateOne:rf,updateMany:uf,deleteOne:lf,deleteMany:tn,initialize:nf});m(this,"selectors",{selectById:hf,selectByIds:mf})}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=[],o=[];for(const f of e){const{fieldValuesUuid:I,fieldIdentifier:g,file:F}=f,b=await this.client.files.getFilePayload(F);b.sha1 in u||(u[b.sha1]=b);const _=R({file:URL.createObjectURL(F),file_type:F.type,file_name:F.name,file_sha1:b.sha1,created_by:l,field_values:I,submitted_at:r,field_identifier:g});d.push(_);const v={uuid:_.uuid,file_name:F.name,file_sha1:b.sha1,file_extension:b.extension,field_identifier:g,field_values:I};o.push(v)}this.dispatch(n(d));const y=this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.POST,url:`${this.url}/bulk/`,payload:{submitted_at:r,attachments:o,files:Object.values(u)},blockers:d.map(f=>f.field_values),blocks:d.map(f=>f.uuid)});return y.then(({presigned_urls:f,attachments:I})=>{this.client.files.processPresignedUrls(f),this.dispatch(a(I))}).catch(f=>{throw this.dispatch(c(d.map(I=>I.uuid))),f}),[d,y.then(({attachments:f})=>f)]}async bulkDelete(e){const{store:n}=this.client,{deleteMany:a,addMany:c}=this.actions,{selectByIds:r}=this.selectors,l=n.getState(),u=r(e)(l);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!0),method:h.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 ib extends V{constructor(){super(...arguments);m(this,"name","Issue Type Field Values");m(this,"url","/issue-type-field-values");m(this,"actions",{addOne:EA,addMany:vA,setOne:VA,setMany:zA,updateOne:BA,updateMany:jA,deleteOne:qA,deleteMany:DA,initialize:wA});m(this,"selectors",{selectById:$A,selectByIds:UA})}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(),o=R({...e,created_by:u,submitted_at:d}),y=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(o),blockers:[e.issue,e.fields_revision],blocks:[o.uuid]});return this.dispatch(a(o)),y.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(o.uuid))}),[o,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:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[u.uuid,u.fields_revision,u.issue],blocks:[u.uuid]});return d.then(o=>{this.dispatch(a(o))}).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=yf(e)(l);this.dispatch(a(e)),this.dispatch(tn(C(d)));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(c(u)),this.dispatch(en(d)),o}}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 nb extends V{constructor(){super(...arguments);m(this,"name","Issue Type Identifier");m(this,"url","/issue-type-identifiers");m(this,"actions",{addOne:Tf,addMany:Sf,setOne:If,setMany:Of,updateOne:Pf,updateMany:Ff,deleteOne:gf,deleteMany:bf,initialize:ff});m(this,"selectors",{selectById:Mf,selectByIds:Rf})}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=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[d.issue_type],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}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:P(h.PATCH,this.name,!1),method:h.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:P(h.DELETE,this.name,!1),method:h.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 ab extends V{constructor(){super(...arguments);m(this,"name","Issue Type Identifier Value");m(this,"url","/issue-type-identifier-values");m(this,"actions",{addOne:Vf,addMany:zf,setOne:Bf,setMany:jf,updateOne:qf,updateMany:Df,deleteOne:Cf,deleteMany:$f,initialize:vf});m(this,"selectors",{selectById:kf,selectByIds:Lf})}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=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[e.issue,e.issue_type_identifier],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}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:P(h.PATCH,this.name,!1),method:h.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:P(h.DELETE,this.name,!1),method:h.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 cb extends V{constructor(){super(...arguments);m(this,"name","Issue Type");m(this,"url","/issue-types");m(this,"actions",{addOne:Wf,addMany:Kf,setOne:Yf,setMany:Zf,updateOne:Jf,updateMany:Xf,deleteOne:Qf,deleteMany:xf,initialize:Hf});m(this,"selectors",{selectById:tT,selectByIds:sT})}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(),o=R({...e,submitted_at:d,created_by:u});this.dispatch(a(o));const y=this.enqueueRequest({method:h.POST,url:`${this.url}/`,payload:z(o),blockers:[],blocks:[o.uuid]});return y.then(f=>{this.dispatch(c(f))}).catch(()=>{this.dispatch(r(o.uuid))}),[o,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:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return d.then(o=>{this.dispatch(a(o))}).catch(()=>{this.dispatch(a(l))}),[u,d]}async delete(e){const{store:n}=this.client,{deleteOne:a,setOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l);if(!u)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const d=Qp(e)(l);this.dispatch(a(e)),this.dispatch(Wi(C(d)));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(o){throw this.dispatch(c(u)),this.dispatch(Hi(d)),o}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{organization:e}},n);return this.dispatch(a(c)),c}}class db extends V{constructor(){super(...arguments);m(this,"name","Issue Type Status");m(this,"url","/issue-type-statuses");m(this,"actions",{addOne:cT,addMany:dT,setOne:rT,setMany:uT,updateOne:lT,updateMany:oT,deleteOne:hT,deleteMany:mT,initialize:aT});m(this,"selectors",{selectById:on,selectByIds:pT})}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=R({...e,created_by:l,submitted_at:u});this.dispatch(a(d));const o=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(d),blockers:[e.issue_type],blocks:[d.uuid]});return o.then(A=>{this.dispatch(c(A))}).catch(()=>{this.dispatch(r(d.uuid))}),[d,o]}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:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(n(d))}).catch(()=>{this.dispatch(n(r))}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`No issue type status with uuid ${e} found in the store`);this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(c(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,c=await this.list({queryParams:{issue_type__organization:e}},n);return this.dispatch(a(c)),c}}class rb extends V{constructor(){super(...arguments);m(this,"name","Issue Update");m(this,"url","/issue-updates");m(this,"actions",{addOne:mn,addMany:yn,setOne:ST,setMany:IT,updateOne:OT,updateMany:PT,deleteOne:pn,deleteMany:An,initialize:TT});m(this,"selectors",{selectById:FT,selectByIds:gT})}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 ub=1800;function lb(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 ob extends cg{constructor(){super(...arguments);m(this,"_getRenewedTokens",async e=>{const n=this.performRequest({method:h.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(jo(!1)),this.clearTokens(),this.dispatch(M()),this.dispatch(M())}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=qO(e).exp??n}catch{a=n}return a-n<ub}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 k&&this.clearAuth(),e instanceof Error?Promise.reject(e):Promise.reject(new Error((e??at).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 k({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 k({message:"Incorrect username or password.",response:n,discard:!0})}async initAuth(e){const n=et.v4();return console.debug(this.constructor.name,"Initiating auth"),this.performRequest({uuid:n,method:h.POST,url:this.initTokensUrl,payload:e,isAuthNeeded:!1,checkAuth:!1}).then(a=>{this.setTokens(lb(a))})}}class hb extends ct{constructor(){super(...arguments);m(this,"name","Organization Access");m(this,"url","/organization-accesses");m(this,"actions",{addOne:UT,addMany:kT,setOne:LT,setMany:NT,updateOne:GT,updateMany:HT,deleteOne:WT,deleteMany:KT,initialize:$T});m(this,"selectors",{selectById:ZT,selectByIds:JT})}update(e){const{store:n}=this.client,{updateOne:a}=this.actions,{selectById:c}=this.selectors,r=c(e.uuid)(n.getState()),l={...r,...e};this.dispatch(a(l));const u=this.enqueueRequest({description:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.then(d=>{this.dispatch(a(d))}).catch(d=>{throw this.dispatch(a(r)),d}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=n.getState(),u=r(e)(l),d=qt(u.user)(l);this.dispatch(a(u.uuid)),this.dispatch(On(u.user));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${u.uuid}/`,blockers:[u.uuid],blocks:[]})}catch(o){throw this.dispatch(c(u)),this.dispatch(In(d)),o}}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 ct{constructor(){super(...arguments);m(this,"name","Organization");m(this,"url","/organizations");m(this,"actions",{addOne:iS,addMany:sS,setOne:tS,setMany:eS,updateOne:aS,updateMany:nS,deleteOne:cS,deleteMany:dS,initialize:xT});m(this,"selectors",{selectById:lS,selectByIds:oS})}async add(e){const{addOne:n}=this.actions,a=await this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.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:P(h.PATCH,this.name,!1),method:h.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:P(h.POST,this.name,!1),method:h.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 yb extends V{constructor(){super(...arguments);m(this,"name","Project Access");m(this,"url","/project-accesses");m(this,"actions",{addOne:OS,addMany:PS,setOne:FS,setMany:gS,updateOne:bS,updateMany:_S,deleteOne:MS,deleteMany:RS,initialize:IS});m(this,"selectors",{selectById:ES,selectByIds:vS})}add(e){var d;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=R({...e,created_by:((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null});this.dispatch(a(l));const u=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(l),blockers:[l.organization_access,l.project],blocks:[l.uuid]});return u.then(o=>{this.dispatch(c(o))}).catch(o=>{throw this.dispatch(r(l.uuid)),o}),[l,u]}bulkAdd(e){var o;const{store:n}=this.client,{addMany:a,deleteMany:c,updateMany:r}=this.actions,l=((o=n.getState().userReducer.currentUser)==null?void 0:o.id)??null,u=e.map(y=>R({...y,created_by:l}));this.dispatch(a(u));const d=this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.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:P(h.PATCH,this.name,!1),method:h.PATCH,url:`${this.url}/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[]});return u.then(d=>{this.dispatch(a(d))}).catch(d=>{throw this.dispatch(a(r)),d}),[l,u]}async delete(e){const{store:n}=this.client,{deleteOne:a,addOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());this.dispatch(a(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.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 pb extends Qe{constructor(){super(...arguments);m(this,"name","Project Attachment");m(this,"url","/project-attachments");m(this,"actions",{addOne:BS,addMany:jS,setOne:qS,setMany:DS,updateOne:CS,updateMany:$S,deleteOne:US,deleteMany:kS,initialize:zS});m(this,"selectors",{selectById:NS,selectByIds:GS})}getId(e){return e.uuid}buildModel(e){return R({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 Ab extends V{constructor(){super(...arguments);m(this,"name","Project File");m(this,"url","/project-files");m(this,"actions",{addOne:JS,addMany:XS,setOne:YS,setMany:ZS,updateOne:QS,updateMany:xS,deleteOne:eI,deleteMany:tI,initialize:KS});m(this,"selectors",{selectById:dI,selectByIds:rI})}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:h.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 o={...r};delete o.file,l={method:h.PATCH,url:`${this.url}/${c}/`,payload:o,blockers:[c],blocks:[c]}}else l=new Promise((o,y)=>{this.client.files.uploadFileToS3(r.file_sha1).then(([A])=>{o({method:h.POST,url:`${this.url}/`,payload:{...r,...A},blockers:[c],blocks:[c]})}).catch(y)});const d=Promise.resolve(l).then(o=>this.enqueueRequest(o));return d.then(o=>{this.dispatch(n(o))}),this.dispatch(nI),this.dispatch(iI(null)),this.dispatch(sI(!1)),[r,d]}async delete(e){const{store:n}=this.client,{addOne:a,deleteOne:c}=this.actions,{selectById:r}=this.selectors,l=r(e)(n.getState());if(!l)throw new Error(`Expected project file with uuid ${e} to exist in the store.`);this.dispatch(c(e));try{return await this.enqueueRequest({description:P(h.DELETE,this.name,!1),method:h.DELETE,url:`${this.url}/${e}`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(a(l)),u}}async refreshStore(e,n){const{initialize:a}=this.actions,r=(await this.listPaginated({queryParams:{project:e}},n)).flat();return this.dispatch(a(r)),r}}class fb extends ct{constructor(){super(...arguments);m(this,"name","Project");m(this,"url","/projects");m(this,"actions",{addOne:pI,addMany:yI,setOne:mI,setMany:hI,updateOne:fI,updateMany:AI,deleteOne:TI,deleteMany:SI,initialize:oI});m(this,"selectors",{selectById:PI,selectByIds:FI})}async add(e){const{addOne:n}=this.actions,a=await this.performRequest({method:h.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:h.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:P(h.DELETE,this.name,!1),method:h.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 Tb extends V{constructor(){super(...arguments);m(this,"name","Team Membership");m(this,"url","/team-memberships");m(this,"actions",{addOne:MI,addMany:RI,setOne:wI,setMany:EI,updateOne:vI,updateMany:VI,deleteOne:zI,deleteMany:BI,initialize:_I});m(this,"selectors",{selectById:DI,selectByIds:CI})}add(e){var d;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=R({...e,created_by:((d=n.getState().userReducer.currentUser)==null?void 0:d.id)??null});this.dispatch(a(l));const u=this.enqueueRequest({description:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(l),blockers:[e.team],blocks:[l.uuid]});return u.then(o=>{this.dispatch(c(o))}).catch(()=>{this.dispatch(r(l.uuid))}),[l,u]}bulkAdd(e){var o;const{store:n}=this.client,{addMany:a,setMany:c,deleteMany:r}=this.actions,l=((o=n.getState().userReducer.currentUser)==null?void 0:o.id)??null,u=e.map(y=>R({...y,created_by:l}));this.dispatch(a(u));const d=this.enqueueRequest({description:P(h.POST,this.name,!0),method:h.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:P(h.DELETE,this.name,!1),method:h.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 Sb extends V{constructor(){super(...arguments);m(this,"name","Team");m(this,"url","/teams");m(this,"actions",{addOne:kI,addMany:LI,setOne:NI,setMany:GI,updateOne:HI,updateMany:WI,deleteOne:KI,deleteMany:YI,initialize:UI});m(this,"selectors",{selectById:JI,selectByIds:XI})}add(e){var d;const{store:n}=this.client,{addOne:a,setOne:c,deleteOne:r}=this.actions,l=R({...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:P(h.POST,this.name,!1),method:h.POST,url:`${this.url}/`,payload:z(l),blockers:[],blocks:[l.uuid]});return u.then(o=>{this.dispatch(c(o))}).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:P(h.PATCH,this.name,!1),method:h.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:P(h.DELETE,this.name,!1),method:h.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 Ib extends ct{constructor(){super(...arguments);m(this,"name","User");m(this,"url","/user");m(this,"actions",{addOne:In,addMany:vT,setOne:ET,setMany:wT,updateOne:zT,updateMany:VT,deleteOne:On,deleteMany:BT,initialize:RT});m(this,"selectors",{selectById:qt,selectByIds:DT})}async list(e,n){const{organizationUuid:a,...c}=e,r=a?`/organizations/${a}${this.url}s/`:`/${this.url}`;return this.performRequest({method:h.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 kn(t,s,e,n,a){const c=n instanceof tt;c&&s.checkAuth!==!1&&await n.auth.prepareAuth();const r={queryParams:"",isAuthNeeded:!0},{s3url:l,payload:u,headers:d,method:o,queryParams:y,attachmentHash:A,isExternalUrl:f,isAuthNeeded:I,isResponseBlob:g}={...r,...s};let F=s.url;const b=A?await e.files.fetchCache(A):void 0;if(A&&!b)throw new Error(`Cannot upload file ${A} because it's not cached.`);!f&&!F.startsWith("http")&&(!F.startsWith("/")&&!F.startsWith("blob:")&&(F="/"+F),F=t+F);const _=D=>{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(!b)throw new Error(`No file for file ${A}`);const q=l.fields["x-amz-checksum-sha1"];if(!q)throw new Error(`No checksum for file ${A}`);return D.set("x-amz-checksum-sha1",q).field({...u,...l.fields}).attach("file",b)}return D.send(u)},j={[h.GET]:()=>g?it.get(F.toString()).responseType("blob"):it.get(F.toString()),[h.POST]:()=>{const D=it.post(F.toString());return _(D)},[h.PATCH]:()=>{const D=it.patch(F.toString());return _(D)},[h.PUT]:()=>{const D=it.put(F.toString());return _(D)},[h.DELETE]:()=>{const D=it.delete(F.toString());return _(D)}}[o];let B=j();if(a==null||a.addEventListener("abort",()=>{console.debug("aborting request:",s),B.abort()}),I&&c){const D=n.auth.getAuthHeader();B=B.set("Authorization",D)}d&&(B=B.set(d));try{return await B.query(y)}catch(D){const q=pO(D),MO=q==null?void 0:q.status;if(c&&MO===401)return await n.auth.handleUnauthorized(B,q),B.query(y);throw new k({response:q,innerError:D,discard:Dn.includes(MO)})}}class Ob{constructor(s){m(this,"store");this.store=s}_performRequest(s,e,n,a){const c=new Nt,r={...e,uuid:e.uuid??et.v4()};return kn(s,r,this,n,a).then(l=>{c.resolve(l.body)}).catch(l=>{l instanceof Error?c.reject(l):c.reject(new Error((l??at).toString()))}),c}async performRequest(s,e,n,a){return this._performRequest(s,e,n,a).then(c=>{if(c instanceof k)throw c;return c})}async enqueueRequest(s,e,n){return this._enqueueRequest(s,e,n).then(a=>{if(a instanceof k)throw a;return a})}_enqueueRequest(s,e,n){const a=new Nt,c={...s,BASE_URL:e,serviceName:n},r=this.store.dispatch(pS(c)),l=d=>{if(d)a.resolve(d.body);else{const o=new k({message:"Could not get a response from the server.",response:d,discard:!0});a.reject(o)}},u=d=>{d instanceof k?d.options.discard=!0:(console.error("Received an unexpected error while processing a request:",d,`
|
|
15
|
+
Converting error to APIError and discarding.`),d=new k({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 dt{constructor(){m(this,"graph");m(this,"requestAttemptCounter");this.graph=new DO.DepGraph,this.requestAttemptCounter={}}static _fromOutbox(s){const e=new dt;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))&&dt._addDependency(a.payload.uuid,r.payload.uuid,e.graph)}}return e}_addDependency(s,e){dt._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 AO;function fO(t){AO=t}function rt(){return AO}let TO;function SO(t){TO=t}function IO(){return TO}let Ln=null;function st(){const t=rt();if(!t)return console.warn("Client store not set; cannot get outbox coordinator yet."),null;if(Ln)return Ln;const s=t.getState().offline.outbox,e=dt._fromOutbox(s);return Ln=e,e}const Pb=(t,s)=>{const e=new s(t);return SO(e),fO(t),e};class Fb{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 Nn{constructor(){m(this,"next");this.next=null}then(s){return new Fb(this).then(s)}async run(s){if(this.next)return this.next.run(s);{if(console.debug("Middleware finished. Performing request:",s),!rt())throw new Error("Client store not set");const n=IO();if(!n)throw new Error("Client SDK not set");return hO(s,n)}}}class OO extends Nn{async run(s){return super.run(s)}}class PO extends Nn{async run(s){return super.run(s)}}const FO=new OO().then(new PO).compile();function gO(t){var s;return(s=FO[0])==null?void 0:s.run(t)}var bO=(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))(bO||{});i.ALL_MIDDLEWARE=FO,i.APIError=k,i.ATTACHMENT_MODEL_DEFAULT_PAGE_SIZE=iO,i.AgentService=dg,i.AssetAttachmentService=rg,i.AssetProcedureService=yg,i.AssetProcedureStepFieldValuesAttachmentService=Tg,i.AssetProcedureStepFieldValuesService=Sg,i.AssetProcedureStepFieldsAttachmentService=Ag,i.AssetProcedureStepFieldsService=fg,i.AssetProcedureStepService=Ig,i.AssetProcedureTypeAttachmentService=ug,i.AssetProcedureTypeFieldValuesAttachmentService=hg,i.AssetProcedureTypeFieldValuesService=mg,i.AssetProcedureTypeFieldsAttachmentService=lg,i.AssetProcedureTypeFieldsService=og,i.AssetProcedureTypeService=pg,i.AssetService=Og,i.AssetStageCompletionService=Pg,i.AssetStageService=Fg,i.AssetStatusType=Zn,i.AssetTypeAttachmentService=gg,i.AssetTypeFieldValuesAttachmentService=Mg,i.AssetTypeFieldValuesService=Rg,i.AssetTypeFieldsAttachmentService=bg,i.AssetTypeFieldsService=_g,i.AssetTypeIdentifierService=wg,i.AssetTypeIdentifierValueService=Eg,i.AssetTypeService=vg,i.AssetTypeStatusService=Vg,i.AttachmentModel=Jn,i.BaseApiService=tt,i.BaseModelApiService=ct,i.BaseOfflineAttachmentModelService=Qe,i.BaseOfflineModelApiService=V,i.BaseSDK=Ob,i.COMMON_AUTO_FIELDS=ia,i.CategoryService=zg,i.DEFAULT_ISSUE_PRIORITY=CO,i.DEFAULT_PAGE_SIZE=sO,i.DISCARD_HTTP_STATUSES=Dn,i.DeferredPromise=Nt,i.DocumentAttachmentService=Bg,i.DocumentService=jg,i.EMPTY_ARRAY=Wn,i.EMPTY_OBJECT=Kn,i.EmailDomainsService=qg,i.EmailVerificationService=Dg,i.FileService=$g,i.FormIdentifierService=Ug,i.FormIdentifierValueService=kg,i.FormRevisionAttachmentService=Lg,i.FormRevisionService=Ng,i.FormService=Gg,i.FormSubmissionAttachmentService=Hg,i.FormSubmissionService=Wg,i.GeoImageService=Kg,i.HttpMethod=h,i.IssueAssociationService=Yg,i.IssueAttachmentService=Zg,i.IssueCommentAttachmentService=Jg,i.IssueCommentService=Xg,i.IssuePriority=Lt,i.IssueService=Qg,i.IssueStatusType=Xn,i.IssueTypeAttachmentService=xg,i.IssueTypeFieldValuesAttachmentService=sb,i.IssueTypeFieldValuesService=ib,i.IssueTypeFieldsAttachmentService=eb,i.IssueTypeFieldsService=tb,i.IssueTypeIdentifierService=nb,i.IssueTypeIdentifierValueService=ab,i.IssueTypeService=cb,i.IssueTypeStatusService=db,i.IssueUpdateChange=U,i.IssueUpdateService=rb,i.JWTService=ob,i.MAX_SERVICE_BATCH_SIZE=N,i.OUTBOX_RETRY_DELAY=Qn,i.OfflineAnalyticsMiddleware=OO,i.OfflineMiddleware=Nn,i.OrganizationAccessLevel=Yn,i.OrganizationAccessService=hb,i.OrganizationService=mb,i.OutboxCoordinator=dt,i.ProjectAccessService=yb,i.ProjectAttachmentService=pb,i.ProjectFileService=Ab,i.ProjectService=fb,i.RESET_ORGANIZATION_STATE=E,i.RESET_PROJECT_STATE=$,i.RESET_STATE=M,i.RateLimitingMiddleware=PO,i.SelectorBuilder=rP,i.TeamMembershipService=Tb,i.TeamService=Sb,i.UNKNOWN_ERROR_MESSAGE=at,i.UserService=Ib,i.VERSION_REDUCER_KEY=ut,i.VerificationCodeType=bO,i._setLatestRetryTime=fS,i.addAsset=zr,i.addAssetAttachment=Ta,i.addAssetAttachments=Qt,i.addAssetProcedure=Wc,i.addAssetProcedureStep=Or,i.addAssetProcedureStepFieldValues=ar,i.addAssetProcedureStepFieldValuesAttachment=Wd,i.addAssetProcedureStepFieldValuesAttachments=Os,i.addAssetProcedureStepFieldValuesMany=cr,i.addAssetProcedureStepFields=zd,i.addAssetProcedureStepFieldsAttachment=Sd,i.addAssetProcedureStepFieldsAttachments=Id,i.addAssetProcedureStepFieldsMany=Bd,i.addAssetProcedureSteps=Pr,i.addAssetProcedureType=ad,i.addAssetProcedureTypeAttachment=va,i.addAssetProcedureTypeAttachments=Va,i.addAssetProcedureTypeFieldValues=Vc,i.addAssetProcedureTypeFieldValuesAttachment=Sc,i.addAssetProcedureTypeFieldValuesAttachments=ds,i.addAssetProcedureTypeFieldValuesMany=zc,i.addAssetProcedureTypeFields=ac,i.addAssetProcedureTypeFieldsAttachment=Ha,i.addAssetProcedureTypeFieldsAttachments=Wa,i.addAssetProcedureTypeFieldsMany=cc,i.addAssetProcedureTypes=cd,i.addAssetProcedures=hs,i.addAssetStage=ru,i.addAssetStageCompletion=Hr,i.addAssetStageCompletions=Wr,i.addAssetStages=uu,i.addAssetType=lo,i.addAssetTypeAttachment=Su,i.addAssetTypeAttachments=Ds,i.addAssetTypeFieldValues=Sl,i.addAssetTypeFieldValuesAttachment=cl,i.addAssetTypeFieldValuesAttachments=Gs,i.addAssetTypeFieldValuesMany=Il,i.addAssetTypeFields=Wu,i.addAssetTypeFieldsAttachment=Vu,i.addAssetTypeFieldsAttachments=zu,i.addAssetTypeFieldsMany=Ku,i.addAssetTypeIdentifier=zl,i.addAssetTypeIdentifierValue=Kl,i.addAssetTypeIdentifierValues=Yl,i.addAssetTypeIdentifiers=Bl,i.addAssetTypeStatus=Po,i.addAssetTypeStatuses=Fo,i.addAssetTypes=oo,i.addAssets=Rs,i.addCategories=Uo,i.addCategory=$o,i.addConversation=ha,i.addConversations=lP,i.addDocument=hh,i.addDocumentAttachment=Qo,i.addDocumentAttachments=xo,i.addDocuments=mh,i.addEmailDomain=_h,i.addEmailDomains=Mh,i.addForm=Nm,i.addFormIdentifier=Hh,i.addFormIdentifierValue=am,i.addFormIdentifierValues=cm,i.addFormIdentifiers=Wh,i.addFormRevision=Ai,i.addFormRevisionAttachment=Sm,i.addFormRevisionAttachments=Im,i.addFormRevisions=fi,i.addFormSubmission=fy,i.addFormSubmissionAttachment=iy,i.addFormSubmissionAttachments=gi,i.addFormSubmissions=Ei,i.addForms=Gm,i.addGeoImage=Ey,i.addGeoImages=vy,i.addIssue=Np,i.addIssueAssociation=Wy,i.addIssueAssociations=Et,i.addIssueAttachment=ip,i.addIssueAttachments=Di,i.addIssueComment=Ep,i.addIssueCommentAttachment=Ap,i.addIssueCommentAttachments=fp,i.addIssueComments=vp,i.addIssueType=Wf,i.addIssueTypeAttachment=sA,i.addIssueTypeAttachments=iA,i.addIssueTypeFieldValues=EA,i.addIssueTypeFieldValuesAttachment=af,i.addIssueTypeFieldValuesAttachments=en,i.addIssueTypeFieldValuesMany=vA,i.addIssueTypeFields=GA,i.addIssueTypeFieldsAttachment=AA,i.addIssueTypeFieldsAttachments=fA,i.addIssueTypeFieldsMany=HA,i.addIssueTypeIdentifier=Tf,i.addIssueTypeIdentifierValue=Vf,i.addIssueTypeIdentifierValues=zf,i.addIssueTypeIdentifiers=Sf,i.addIssueTypeStatus=cT,i.addIssueTypeStatuses=dT,i.addIssueTypes=Kf,i.addIssueUpdate=mn,i.addIssueUpdates=yn,i.addIssues=Hi,i.addOrganization=iS,i.addOrganizationAccess=UT,i.addOrganizationAccesses=kT,i.addOrganizations=sS,i.addProject=pI,i.addProjectAccess=OS,i.addProjectAccesses=PS,i.addProjectAttachment=BS,i.addProjectAttachments=jS,i.addProjectFile=JS,i.addProjectFiles=XS,i.addProjects=yI,i.addTeam=kI,i.addTeamMembership=MI,i.addTeamMemberships=RI,i.addTeams=LI,i.addUser=In,i.addUsers=vT,i.agentsReducer=pa,i.agentsSlice=Zt,i.areArraysEqual=LO,i.assetAttachmentReducer=Ra,i.assetAttachmentSlice=Xt,i.assetProcedureReducer=Qc,i.assetProcedureSlice=os,i.assetProcedureStepFieldValuesAttachmentReducer=sr,i.assetProcedureStepFieldValuesAttachmentSlice=Is,i.assetProcedureStepFieldValuesReducer=Ar,i.assetProcedureStepFieldValuesSlice=gs,i.assetProcedureStepFieldsAttachmentReducer=Ed,i.assetProcedureStepFieldsAttachmentSlice=As,i.assetProcedureStepFieldsReducer=Nd,i.assetProcedureStepFieldsSlice=Ts,i.assetProcedureStepReducer=Mr,i.assetProcedureStepSlice=bs,i.assetProcedureTypeAttachmentReducer=$a,i.assetProcedureTypeAttachmentSlice=ts,i.assetProcedureTypeFieldValuesAttachmentReducer=bc,i.assetProcedureTypeFieldValuesAttachmentSlice=cs,i.assetProcedureTypeFieldValuesReducer=Uc,i.assetProcedureTypeFieldValuesSlice=ls,i.assetProcedureTypeFieldsAttachmentReducer=xa,i.assetProcedureTypeFieldsAttachmentSlice=is,i.assetProcedureTypeFieldsReducer=mc,i.assetProcedureTypeFieldsSlice=as,i.assetProcedureTypeReducer=md,i.assetProcedureTypeSlice=ys,i.assetReducer=Lr,i.assetSlice=Ms,i.assetStageCompletionReducer=xr,i.assetStageCompletionSlice=Vs,i.assetStageReducer=yu,i.assetStageSlice=zs,i.assetTypeAttachmentReducer=wu,i.assetTypeAttachmentSlice=qs,i.assetTypeFieldValuesAttachmentReducer=Al,i.assetTypeFieldValuesAttachmentSlice=Ns,i.assetTypeFieldValuesReducer=El,i.assetTypeFieldValuesSlice=Ks,i.assetTypeFieldsAttachmentReducer=Nu,i.assetTypeFieldsAttachmentSlice=Us,i.assetTypeFieldsReducer=il,i.assetTypeFieldsSlice=Ls,i.assetTypeIdentifierReducer=Gl,i.assetTypeIdentifierSlice=Ys,i.assetTypeIdentifierValueReducer=no,i.assetTypeIdentifierValueSlice=Js,i.assetTypeReducer=So,i.assetTypeSlice=Xs,i.assetTypeStatusReducer=zo,i.assetTypeStatusSlice=xs,i.assetTypeStatusSortFn=ca,i.authReducer=qo,i.authSlice=bt,i.baseReducer=WF,i.baseReducers=qn,i.blobToBase64=XO,i.categoryReducer=Zo,i.categorySlice=ti,i.clearTokens=YP,i.constructUploadedFilePayloads=JO,i.createDeepEqualSelector=uP,i.createModelAdapter=w,i.createOfflineAction=mS,i.createPayload=z,i.createSelectionAdapter=$O,i.createShallowEqualSelector=O,i.deleteAsset=qr,i.deleteAssetAttachment=Fa,i.deleteAssetAttachments=xt,i.deleteAssetProcedure=Zc,i.deleteAssetProcedureStep=br,i.deleteAssetProcedureStepFieldValues=or,i.deleteAssetProcedureStepFieldValuesAttachment=Xd,i.deleteAssetProcedureStepFieldValuesAttachments=Ps,i.deleteAssetProcedureStepFieldValuesMany=hr,i.deleteAssetProcedureStepFields=$d,i.deleteAssetProcedureStepFieldsAttachment=bd,i.deleteAssetProcedureStepFieldsAttachments=_d,i.deleteAssetProcedureStepFieldsMany=Ud,i.deleteAssetProcedureSteps=_r,i.deleteAssetProcedureType=ud,i.deleteAssetProcedureTypeAttachment=Da,i.deleteAssetProcedureTypeAttachments=Ca,i.deleteAssetProcedureTypeFieldValues=Cc,i.deleteAssetProcedureTypeFieldValuesAttachment=gc,i.deleteAssetProcedureTypeFieldValuesAttachments=rs,i.deleteAssetProcedureTypeFieldValuesMany=$c,i.deleteAssetProcedureTypeFields=oc,i.deleteAssetProcedureTypeFieldsAttachment=Xa,i.deleteAssetProcedureTypeFieldsAttachments=Qa,i.deleteAssetProcedureTypeFieldsMany=hc,i.deleteAssetProcedureTypes=ld,i.deleteAssetProcedures=ms,i.deleteAssetStage=hu,i.deleteAssetStageCompletion=Xr,i.deleteAssetStageCompletions=Qr,i.deleteAssetStages=mu,i.deleteAssetType=yo,i.deleteAssetTypeAttachment=gu,i.deleteAssetTypeAttachments=Cs,i.deleteAssetTypeFieldValues=bl,i.deleteAssetTypeFieldValuesAttachment=ol,i.deleteAssetTypeFieldValuesAttachments=Hs,i.deleteAssetTypeFieldValuesMany=_l,i.deleteAssetTypeFields=Qu,i.deleteAssetTypeFieldsAttachment=Cu,i.deleteAssetTypeFieldsAttachments=$u,i.deleteAssetTypeFieldsMany=xu,i.deleteAssetTypeIdentifier=$l,i.deleteAssetTypeIdentifierValue=xl,i.deleteAssetTypeIdentifierValues=eo,i.deleteAssetTypeIdentifiers=Ul,i.deleteAssetTypeStatus=Ro,i.deleteAssetTypeStatuses=wo,i.deleteAssetTypes=po,i.deleteAssets=ws,i.deleteCategories=Wo,i.deleteCategory=Ho,i.deleteConversation=mP,i.deleteConversations=yP,i.deleteDocument=Th,i.deleteDocumentAttachment=nh,i.deleteDocumentAttachments=ah,i.deleteDocuments=Sh,i.deleteEmailDomain=Vh,i.deleteEmailDomains=zh,i.deleteForm=Zm,i.deleteFormIdentifier=Xh,i.deleteFormIdentifierValue=om,i.deleteFormIdentifierValues=hm,i.deleteFormIdentifiers=Qh,i.deleteFormRevision=Ti,i.deleteFormRevisionAttachment=bm,i.deleteFormRevisionAttachments=_m,i.deleteFormRevisions=Si,i.deleteFormSubmission=Iy,i.deleteFormSubmissionAttachment=ry,i.deleteFormSubmissionAttachments=bi,i.deleteFormSubmissions=vi,i.deleteForms=Jm,i.deleteGeoImage=By,i.deleteGeoImages=jy,i.deleteIssue=Yp,i.deleteIssueAssociation=Ky,i.deleteIssueAssociations=vt,i.deleteIssueAttachment=rp,i.deleteIssueAttachments=Ci,i.deleteIssueComment=qp,i.deleteIssueCommentAttachment=Pp,i.deleteIssueCommentAttachments=Fp,i.deleteIssueComments=Dp,i.deleteIssueType=Qf,i.deleteIssueTypeAttachment=rA,i.deleteIssueTypeAttachments=uA,i.deleteIssueTypeFieldValues=qA,i.deleteIssueTypeFieldValuesAttachment=lf,i.deleteIssueTypeFieldValuesAttachments=tn,i.deleteIssueTypeFieldValuesMany=DA,i.deleteIssueTypeFields=JA,i.deleteIssueTypeFieldsAttachment=PA,i.deleteIssueTypeFieldsAttachments=FA,i.deleteIssueTypeFieldsMany=XA,i.deleteIssueTypeIdentifier=gf,i.deleteIssueTypeIdentifierValue=Cf,i.deleteIssueTypeIdentifierValues=$f,i.deleteIssueTypeIdentifiers=bf,i.deleteIssueTypeStatus=hT,i.deleteIssueTypeStatuses=mT,i.deleteIssueTypes=xf,i.deleteIssueUpdate=pn,i.deleteIssueUpdates=An,i.deleteIssues=Wi,i.deleteOrganization=cS,i.deleteOrganizationAccess=WT,i.deleteOrganizationAccesses=KT,i.deleteOrganizations=dS,i.deleteProject=TI,i.deleteProjectAccess=MS,i.deleteProjectAccesses=RS,i.deleteProjectAttachment=US,i.deleteProjectAttachments=kS,i.deleteProjectFile=eI,i.deleteProjectFiles=tI,i.deleteProjects=SI,i.deleteTeam=KI,i.deleteTeamMembership=zI,i.deleteTeamMemberships=BI,i.deleteTeams=YI,i.deleteUser=On,i.deleteUsers=BT,i.dequeue=oO,i.discard=mO,i.documentAttachmentReducer=uh,i.documentAttachmentSlice=ni,i.documentSlice=ci,i.documentsReducer=Ih,i.downloadFile=QO,i.downloadInMemoryFile=ZO,i.emailDomainsReducer=Dh,i.emailDomainsSlice=ri,i.emailRegex=aP,i.enqueue=lO,i.enqueueRequest=pS,i.extractResponseFromError=pO,i.fallbackToEmptyArray=S,i.fallbackToEmptyObject=At,i.fileReducer=Lh,i.fileSlice=li,i.fileToBlob=ta,i.formIdentifierReducer=sm,i.formIdentifierSlice=oi,i.formIdentifierValueReducer=Am,i.formIdentifierValueSlice=mi,i.formReducer=Xm,i.formRevisionAttachmentReducer=Em,i.formRevisionAttachmentSlice=yi,i.formRevisionReducer=Um,i.formRevisionsSlice=pi,i.formSlice=Oi,i.formSubmissionAttachmentReducer=hy,i.formSubmissionAttachmentSlice=Fi,i.formSubmissionReducer=by,i.formSubmissionSlice=wi,i.geoImageReducer=$y,i.geoImageSlice=zi,i.getAssetProcedureStepSubTree=aa,i.getAssetProcedureStepTrees=cP,i.getClientSDK=IO,i.getClientStore=rt,i.getDocumentSubTree=ua,i.getDocumentTrees=dP,i.getFileIdentifier=YO,i.getFileS3Key=Kt,i.getLocalDateString=xn,i.getLocalRelativeDateString=WO,i.getOutboxCoordinator=st,i.getRenamedFile=ea,i.getRequestDescription=P,i.hashFile=nt,i.initSDK=Pb,i.initializeAssetAttachments=fa,i.initializeAssetProcedureStepFieldValues=nr,i.initializeAssetProcedureStepFieldValuesAttachments=Hd,i.initializeAssetProcedureStepFields=Vd,i.initializeAssetProcedureStepFieldsAttachments=Td,i.initializeAssetProcedureSteps=Tr,i.initializeAssetProcedureTypeAttachments=Ea,i.initializeAssetProcedureTypeFieldValues=vc,i.initializeAssetProcedureTypeFieldValuesAttachments=Tc,i.initializeAssetProcedureTypeFields=nc,i.initializeAssetProcedureTypeFieldsAttachments=Ga,i.initializeAssetProcedureTypes=nd,i.initializeAssetProcedures=Hc,i.initializeAssetStageCompletions=Gr,i.initializeAssetStages=au,i.initializeAssetTypeAttachments=Tu,i.initializeAssetTypeFieldValues=Tl,i.initializeAssetTypeFieldValuesAttachments=al,i.initializeAssetTypeFields=Hu,i.initializeAssetTypeFieldsAttachments=vu,i.initializeAssetTypeIdentifierValues=Wl,i.initializeAssetTypeIdentifiers=Vl,i.initializeAssetTypeStatuses=Oo,i.initializeAssetTypes=co,i.initializeAssets=Vr,i.initializeCategories=Co,i.initializeConversations=oa,i.initializeDocumentAttachments=Xo,i.initializeDocuments=oh,i.initializeEmailDomains=bh,i.initializeFormIdentifierValues=nm,i.initializeFormIdentifiers=Gh,i.initializeFormRevisionAttachments=Tm,i.initializeFormRevisions=Vm,i.initializeFormSubmissionAttachments=sy,i.initializeFormSubmissions=yy,i.initializeForms=Lm,i.initializeGeoImages=My,i.initializeIssueAssociations=ky,i.initializeIssueAttachments=sp,i.initializeIssueCommentAttachments=pp,i.initializeIssueComments=wp,i.initializeIssueTypeAttachments=tA,i.initializeIssueTypeFieldValues=wA,i.initializeIssueTypeFieldValuesAttachments=nf,i.initializeIssueTypeFields=NA,i.initializeIssueTypeFieldsAttachments=pA,i.initializeIssueTypeIdentifierValues=vf,i.initializeIssueTypeIdentifiers=ff,i.initializeIssueTypeStatuses=aT,i.initializeIssueTypes=Hf,i.initializeIssueUpdates=TT,i.initializeIssues=Lp,i.initializeOrganizationAccesses=$T,i.initializeOrganizations=xT,i.initializeProjectAccesses=IS,i.initializeProjectAttachments=zS,i.initializeProjectFiles=KS,i.initializeProjects=oI,i.initializeTeamMemberships=_I,i.initializeTeams=UI,i.initializeUsers=RT,i.isToday=HO,i.issueAssociationReducer=ep,i.issueAssociationSlice=ji,i.issueAttachmentReducer=mp,i.issueAttachmentSlice=qi,i.issueCommentAttachmentReducer=Mp,i.issueCommentAttachmentSlice=Ui,i.issueCommentReducer=Up,i.issueCommentSlice=Li,i.issueReducer=xp,i.issueSlice=Gi,i.issueTypeAttachmentReducer=mA,i.issueTypeAttachmentSlice=Ki,i.issueTypeFieldValuesAttachmentReducer=pf,i.issueTypeFieldValuesAttachmentSlice=xi,i.issueTypeFieldValuesReducer=kA,i.issueTypeFieldValuesSlice=Xi,i.issueTypeFieldsAttachmentReducer=MA,i.issueTypeFieldsAttachmentSlice=Zi,i.issueTypeFieldsReducer=tf,i.issueTypeFieldsSlice=Qi,i.issueTypeIdentifierReducer=wf,i.issueTypeIdentifierSlice=nn,i.issueTypeIdentifierValueReducer=Nf,i.issueTypeIdentifierValueSlice=cn,i.issueTypeReducer=iT,i.issueTypeSlice=dn,i.issueTypeStatusReducer=AT,i.issueTypeStatusSlice=un,i.issueTypeStatusSortFn=da,i.issueUpdateReducer=_T,i.issueUpdateSlice=hn,i.logOnlyOnce=xO,i.markAsDeleted=AS,i.markForDeletion=EF,i.memoize=Ht,i.organizationAccessReducer=YT,i.organizationAccessSlice=Fn,i.organizationReducer=hS,i.organizationSlice=gn,i.outboxReducer=TS,i.outboxSlice=bn,i.overmapEnhancer=tg,i.overmapReducer=KF,i.overmapReducers=tO,i.performRequest=kn,i.performRequestFromAction=hO,i.projectAccessReducer=wS,i.projectAccessSlice=_n,i.projectAttachmentReducer=HS,i.projectAttachmentSlice=Rn,i.projectFileReducer=uI,i.projectFileSlice=En,i.projectReducer=II,i.projectSlice=vn,i.rehydratedReducer=gI,i.rehydratedSlice=Vn,i.restructureCreateSelectorWithArgs=T,i.runMiddleware=gO,i.saveActiveProjectFileBounds=nI,i.selectAccessToken=ZP,i.selectAccessesByUserOfProject=VF,i.selectAccessibleProjects=DF,i.selectActiveOrganizationAccess=_F,i.selectActiveProjectFileId=jF,i.selectAllDocumentAttachments=ai,i.selectAssetAttachmentById=ba,i.selectAssetAttachmentMapping=ga,i.selectAssetAttachments=es,i.selectAssetAttachmentsByIds=_a,i.selectAssetById=Ur,i.selectAssetProcedureById=td,i.selectAssetProcedureStepById=Rr,i.selectAssetProcedureStepFieldValues=lt,i.selectAssetProcedureStepFieldValuesAttachmentById=xd,i.selectAssetProcedureStepFieldValuesAttachments=Fs,i.selectAssetProcedureStepFieldValuesAttachmentsByIds=er,i.selectAssetProcedureStepFieldValuesAttachmentsMapping=Qd,i.selectAssetProcedureStepFieldValuesById=yr,i.selectAssetProcedureStepFieldValuesByIds=pr,i.selectAssetProcedureStepFieldValuesMapping=mr,i.selectAssetProcedureStepFieldValuesOfAsset=wP,i.selectAssetProcedureStepFieldValuesOfAssetProcedure=EP,i.selectAssetProcedureStepFieldValuesOfAssetProcedureStep=vP,i.selectAssetProcedureStepFields=Ot,i.selectAssetProcedureStepFieldsAttachmentById=Rd,i.selectAssetProcedureStepFieldsAttachments=fs,i.selectAssetProcedureStepFieldsAttachmentsByIds=wd,i.selectAssetProcedureStepFieldsAttachmentsMapping=Md,i.selectAssetProcedureStepFieldsById=kd,i.selectAssetProcedureStepFieldsByIds=Ld,i.selectAssetProcedureStepFieldsMapping=Ss,i.selectAssetProcedureStepFieldsOfAssetProcedureStep=_P,i.selectAssetProcedureStepMapping=Pt,i.selectAssetProcedureSteps=_s,i.selectAssetProcedureStepsByIds=wr,i.selectAssetProcedureStepsMappingOfAssetProcedureType=VP,i.selectAssetProcedureStepsOfAssetProcedureType=zP,i.selectAssetProcedureTypeAttachmentById=ka,i.selectAssetProcedureTypeAttachmentMapping=Ua,i.selectAssetProcedureTypeAttachments=ss,i.selectAssetProcedureTypeAttachmentsByIds=La,i.selectAssetProcedureTypeById=pd,i.selectAssetProcedureTypeFieldValues=St,i.selectAssetProcedureTypeFieldValuesAttachmentById=Mc,i.selectAssetProcedureTypeFieldValuesAttachments=us,i.selectAssetProcedureTypeFieldValuesAttachmentsByIds=Rc,i.selectAssetProcedureTypeFieldValuesAttachmentsMapping=_c,i.selectAssetProcedureTypeFieldValuesById=Lc,i.selectAssetProcedureTypeFieldValuesByIds=Nc,i.selectAssetProcedureTypeFieldValuesMapping=kc,i.selectAssetProcedureTypeFieldValuesOfAsset=OP,i.selectAssetProcedureTypeFields=Tt,i.selectAssetProcedureTypeFieldsAttachmentById=tc,i.selectAssetProcedureTypeFieldsAttachments=ns,i.selectAssetProcedureTypeFieldsAttachmentsByIds=sc,i.selectAssetProcedureTypeFieldsAttachmentsMapping=ec,i.selectAssetProcedureTypeFieldsById=pc,i.selectAssetProcedureTypeFieldsByIds=Ac,i.selectAssetProcedureTypeFieldsMapping=yc,i.selectAssetProcedureTypeFieldsOfAssetProcedureType=SP,i.selectAssetProcedureTypes=ps,i.selectAssetProcedureTypesByIds=Ad,i.selectAssetProcedureTypesMapping=yd,i.selectAssetProcedureTypesOfOrganization=gP,i.selectAssetProcedures=It,i.selectAssetProceduresByIds=sd,i.selectAssetProceduresMapping=xc,i.selectAssetProceduresOfAssetProcedureType=ed,i.selectAssetProceduresOfAssetType=FP,i.selectAssetStageById=pu,i.selectAssetStageCompletionById=su,i.selectAssetStageCompletionMapping=eu,i.selectAssetStageCompletions=tu,i.selectAssetStageCompletionsByIds=iu,i.selectAssetStages=js,i.selectAssetStagesByIds=Au,i.selectAssetStagesMappingOfAssetProcedureType=jP,i.selectAssetStagesOfAssetProcedureType=qP,i.selectAssetTypeAttachmentById=_u,i.selectAssetTypeAttachmentMapping=bu,i.selectAssetTypeAttachments=$s,i.selectAssetTypeAttachmentsByIds=Mu,i.selectAssetTypeById=fo,i.selectAssetTypeFieldValues=Ft,i.selectAssetTypeFieldValuesAttachmentById=ml,i.selectAssetTypeFieldValuesAttachments=Ws,i.selectAssetTypeFieldValuesAttachmentsByIds=yl,i.selectAssetTypeFieldValuesAttachmentsMapping=hl,i.selectAssetTypeFieldValuesById=Rl,i.selectAssetTypeFieldValuesByIds=wl,i.selectAssetTypeFieldValuesMapping=Ml,i.selectAssetTypeFieldValuesOfAsset=UP,i.selectAssetTypeFields=ot,i.selectAssetTypeFieldsAttachmentById=ku,i.selectAssetTypeFieldsAttachments=ks,i.selectAssetTypeFieldsAttachmentsByIds=Lu,i.selectAssetTypeFieldsAttachmentsMapping=Uu,i.selectAssetTypeFieldsById=tl,i.selectAssetTypeFieldsByIds=sl,i.selectAssetTypeFieldsMapping=el,i.selectAssetTypeFieldsOfAssetType=CP,i.selectAssetTypeIdentifierById=Ll,i.selectAssetTypeIdentifierMapping=kl,i.selectAssetTypeIdentifierValueById=so,i.selectAssetTypeIdentifierValueMapping=to,i.selectAssetTypeIdentifierValues=gt,i.selectAssetTypeIdentifierValuesByIds=io,i.selectAssetTypeIdentifierValuesOfAsset=NP,i.selectAssetTypeIdentifierValuesOfIdentifier=GP,i.selectAssetTypeIdentifiers=Zs,i.selectAssetTypeIdentifiersByIds=Nl,i.selectAssetTypeIdentifiersOfAssetType=LP,i.selectAssetTypeStatusById=vo,i.selectAssetTypeStatusMapping=Eo,i.selectAssetTypeStatuses=ei,i.selectAssetTypeStatusesByIds=Vo,i.selectAssetTypeStatusesOfAssetType=WP,i.selectAssetTypeValuesOfAssetType=kP,i.selectAssetTypes=Qs,i.selectAssetTypesByIds=To,i.selectAssetTypesMapping=Ao,i.selectAssetTypesOfOrganization=HP,i.selectAssets=Es,i.selectAssetsByIds=kr,i.selectAssetsMapping=$r,i.selectAssetsOfAssetType=vs,i.selectAttachmentsOfAsset=Ma,i.selectAttachmentsOfAssetProcedureStepFieldValues=tr,i.selectAttachmentsOfAssetProcedureStepFields=bP,i.selectAttachmentsOfAssetProcedureType=fP,i.selectAttachmentsOfAssetProcedureTypeFieldValues=wc,i.selectAttachmentsOfAssetProcedureTypeFields=TP,i.selectAttachmentsOfAssetType=Ru,i.selectAttachmentsOfAssetTypeFieldValues=pl,i.selectAttachmentsOfAssetTypeFields=DP,i.selectAttachmentsOfDocument=QP,i.selectAttachmentsOfFormRevision=cF,i.selectAttachmentsOfFormSubmission=oy,i.selectAttachmentsOfIssue=lp,i.selectAttachmentsOfIssueComment=lF,i.selectAttachmentsOfIssueType=mF,i.selectAttachmentsOfIssueTypeFieldValues=yf,i.selectAttachmentsOfIssueTypeFields=yF,i.selectAttachmentsOfProject=BF,i.selectCategories=si,i.selectCategoriesByIds=Yo,i.selectCategoriesOfProject=XP,i.selectCategoryById=ii,i.selectCategoryMapping=Ko,i.selectCommentsOfIssue=oF,i.selectConversation=AP,i.selectConversationMapping=Jt,i.selectConversations=pP,i.selectCurrentUser=qT,i.selectDeletedRequests=RF,i.selectDescendantsOfAssetProcedureStep=Er,i.selectDescendantsOfDocument=Fh,i.selectDocumentAttachmentById=dh,i.selectDocumentAttachmentMapping=ch,i.selectDocumentAttachmentsByIds=rh,i.selectDocumentById=Oh,i.selectDocuments=_t,i.selectDocumentsByIds=Ph,i.selectDocumentsMapping=di,i.selectEmailDomainById=jh,i.selectEmailDomains=ui,i.selectEmailDomainsAsMapping=Bh,i.selectEmailDomainsByIds=qh,i.selectEmailDomainsOfOrganization=tF,i.selectFieldValuesOfAssetProcedure=PP,i.selectFormById=xm,i.selectFormIdentifierById=em,i.selectFormIdentifierMapping=xh,i.selectFormIdentifierValueById=ym,i.selectFormIdentifierValueMapping=mm,i.selectFormIdentifierValues=Mt,i.selectFormIdentifierValuesByIds=pm,i.selectFormIdentifierValuesOfFormSubmission=nF,i.selectFormIdentifierValuesOfIdentifier=aF,i.selectFormIdentifiers=hi,i.selectFormIdentifiersByIds=tm,i.selectFormIdentifiersOfForm=iF,i.selectFormMapping=Qm,i.selectFormRevisionAttachmentById=Rm,i.selectFormRevisionAttachments=Mm,i.selectFormRevisionAttachmentsByIds=wm,i.selectFormRevisionAttachmentsMapping=Rt,i.selectFormRevisionById=Dm,i.selectFormRevisionMapping=Ii,i.selectFormRevisions=wt,i.selectFormRevisionsByIds=Cm,i.selectFormRevisionsOfForm=$m,i.selectFormSubmissionAttachemntsByIds=Ri,i.selectFormSubmissionAttachmentById=uy,i.selectFormSubmissionAttachments=Mi,i.selectFormSubmissionAttachmentsByIds=ly,i.selectFormSubmissionAttachmentsMapping=_i,i.selectFormSubmissionById=Py,i.selectFormSubmissions=Oy,i.selectFormSubmissionsByIds=Fy,i.selectFormSubmissionsMapping=Vi,i.selectFormSubmissionsOfForm=gy,i.selectForms=Pi,i.selectFormsByIds=ey,i.selectFormsOfOrganization=rF,i.selectGeoImageById=Dy,i.selectGeoImageMapping=qy,i.selectGeoImages=Bi,i.selectGeoImagesByIds=Cy,i.selectGeoImagesOfProject=uF,i.selectIsImportingProjectFile=qF,i.selectIsLoggedIn=JP,i.selectIssueAssociationById=Zy,i.selectIssueAssociationMapping=ht,i.selectIssueAssociations=Yy,i.selectIssueAssociationsByIds=Jy,i.selectIssueAssociationsOfAsset=xy,i.selectIssueAssociationsOfIssue=Qy,i.selectIssueAssociationsToIssue=Xy,i.selectIssueAttachmentById=op,i.selectIssueAttachmentMapping=up,i.selectIssueAttachments=$i,i.selectIssueAttachmentsByIds=hp,i.selectIssueById=Jp,i.selectIssueCommentAttachmentById=bp,i.selectIssueCommentAttachmentMapping=gp,i.selectIssueCommentAttachments=ki,i.selectIssueCommentAttachmentsByIds=_p,i.selectIssueCommentById=Cp,i.selectIssueCommentMapping=Ni,i.selectIssueCommentsByIds=$p,i.selectIssueMapping=Zp,i.selectIssueTypeAttachmentById=oA,i.selectIssueTypeAttachmentMapping=lA,i.selectIssueTypeAttachments=Yi,i.selectIssueTypeAttachmentsByIds=hA,i.selectIssueTypeById=tT,i.selectIssueTypeFieldValues=zt,i.selectIssueTypeFieldValuesAttachmentById=hf,i.selectIssueTypeFieldValuesAttachments=sn,i.selectIssueTypeFieldValuesAttachmentsByIds=mf,i.selectIssueTypeFieldValuesAttachmentsMapping=of,i.selectIssueTypeFieldValuesById=$A,i.selectIssueTypeFieldValuesByIds=UA,i.selectIssueTypeFieldValuesMapping=CA,i.selectIssueTypeFieldValuesOfIssue=pF,i.selectIssueTypeFields=mt,i.selectIssueTypeFieldsAttachmentById=bA,i.selectIssueTypeFieldsAttachments=Ji,i.selectIssueTypeFieldsAttachmentsByIds=_A,i.selectIssueTypeFieldsAttachmentsMapping=gA,i.selectIssueTypeFieldsById=xA,i.selectIssueTypeFieldsByIds=ef,i.selectIssueTypeFieldsMapping=QA,i.selectIssueTypeFieldsOfIssueType=AF,i.selectIssueTypeIdentifierById=Mf,i.selectIssueTypeIdentifierMapping=_f,i.selectIssueTypeIdentifierValueById=kf,i.selectIssueTypeIdentifierValueMapping=Uf,i.selectIssueTypeIdentifierValues=Bt,i.selectIssueTypeIdentifierValuesByIds=Lf,i.selectIssueTypeIdentifierValuesOfIdentifier=OF,i.selectIssueTypeIdentifierValuesOfIssue=IF,i.selectIssueTypeIdentifiers=an,i.selectIssueTypeIdentifiersByIds=Rf,i.selectIssueTypeIdentifiersOfIssueType=SF,i.selectIssueTypeMapping=eT,i.selectIssueTypeStatusById=on,i.selectIssueTypeStatusMapping=yT,i.selectIssueTypeStatuses=ln,i.selectIssueTypeStatusesByIds=pT,i.selectIssueTypeStatusesOfIssueType=FF,i.selectIssueTypeValuesOfIssueType=TF,i.selectIssueTypes=rn,i.selectIssueTypesByIds=sT,i.selectIssueTypesOfOrganization=PF,i.selectIssueUpdateById=FT,i.selectIssueUpdateMapping=fn,i.selectIssueUpdates=Tn,i.selectIssueUpdatesByIds=gT,i.selectIssueUpdatesOfIssue=bT,i.selectIssues=Vt,i.selectIssuesByIds=Xp,i.selectIssuesOfIssueType=Qp,i.selectIssuesOfProject=hF,i.selectLatestAssetProcedureStepFieldsOfAssetProcedureStep=MP,i.selectLatestAssetProcedureTypeFieldsOfAssetProcedureType=IP,i.selectLatestAssetTypeFieldsOfAssetType=$P,i.selectLatestFieldsByAssetProcedureStep=RP,i.selectLatestFormRevisionOfForm=dF,i.selectLatestIssueTypeFieldsOfIssueType=fF,i.selectLatestRetryTime=wF,i.selectMembershipsByUserOfTeam=LF,i.selectNumberOfAssetsOfAssetType=BP,i.selectOrganizationAccessById=ZT,i.selectOrganizationAccessMapping=Dt,i.selectOrganizationAccessUserMapping=XT,i.selectOrganizationAccessesByIds=JT,i.selectOrganizationById=lS,i.selectOrganizationDocuments=eF,i.selectOrganizations=uS,i.selectOrganizationsByIds=oS,i.selectOrganizationsMapping=rS,i.selectProjectAccessById=ES,i.selectProjectAccessMapping=Mn,i.selectProjectAccesses=yt,i.selectProjectAccessesByIds=vS,i.selectProjectAccessesOfProject=vF,i.selectProjectAttachmentById=NS,i.selectProjectAttachmentMapping=LS,i.selectProjectAttachments=wn,i.selectProjectAttachmentsByIds=GS,i.selectProjectById=PI,i.selectProjectDocuments=xP,i.selectProjectFileById=dI,i.selectProjectFileMapping=aI,i.selectProjectFiles=cI,i.selectProjectFilesByIds=rI,i.selectProjectMapping=OI,i.selectProjects=Ct,i.selectProjectsByIds=FI,i.selectProjectsOfOrganization=CF,i.selectRehydrated=kF,i.selectStageMapping=Bs,i.selectTeamById=JI,i.selectTeamMembershipById=DI,i.selectTeamMemberships=$t,i.selectTeamMembershipsByIds=CI,i.selectTeamMembershipsMapping=qI,i.selectTeams=jn,i.selectTeamsByIds=XI,i.selectTeamsMapping=ZI,i.selectTeamsOfOrganization=GF,i.selectUploadUrl=kh,i.selectUserById=qt,i.selectUsers=jt,i.selectUsersByIds=DT,i.selectUsersMapping=Pn,i.selectUsersOfOrganization=MF,i.selectUsersOfProject=zF,i.selectUsersOfTeam=NF,i.setActiveProjectFileId=iI,i.setAsset=Dr,i.setAssetAttachment=Sa,i.setAssetAttachments=Ia,i.setAssetProcedure=Jc,i.setAssetProcedureStep=Sr,i.setAssetProcedureStepFieldValues=dr,i.setAssetProcedureStepFieldValuesAttachment=Kd,i.setAssetProcedureStepFieldValuesAttachments=Yd,i.setAssetProcedureStepFieldValuesMany=rr,i.setAssetProcedureStepFields=jd,i.setAssetProcedureStepFieldsAttachment=Od,i.setAssetProcedureStepFieldsAttachments=Pd,i.setAssetProcedureStepFieldsMany=qd,i.setAssetProcedureSteps=Ir,i.setAssetProcedureType=od,i.setAssetProcedureTypeAttachment=za,i.setAssetProcedureTypeAttachments=Ba,i.setAssetProcedureTypeFieldValues=Bc,i.setAssetProcedureTypeFieldValuesAttachment=Ic,i.setAssetProcedureTypeFieldValuesAttachments=Oc,i.setAssetProcedureTypeFieldValuesMany=jc,i.setAssetProcedureTypeFields=dc,i.setAssetProcedureTypeFieldsAttachment=Ka,i.setAssetProcedureTypeFieldsAttachments=Ya,i.setAssetProcedureTypeFieldsMany=rc,i.setAssetProcedureTypes=hd,i.setAssetProcedures=Xc,i.setAssetStage=cu,i.setAssetStageCompletion=Kr,i.setAssetStageCompletions=Yr,i.setAssetStages=du,i.setAssetType=ro,i.setAssetTypeAttachment=Iu,i.setAssetTypeAttachments=Ou,i.setAssetTypeFieldValues=Ol,i.setAssetTypeFieldValuesAttachment=dl,i.setAssetTypeFieldValuesAttachments=rl,i.setAssetTypeFieldValuesMany=Pl,i.setAssetTypeFields=Yu,i.setAssetTypeFieldsAttachment=Bu,i.setAssetTypeFieldsAttachments=ju,i.setAssetTypeFieldsMany=Zu,i.setAssetTypeIdentifier=jl,i.setAssetTypeIdentifierValue=Zl,i.setAssetTypeIdentifierValues=Jl,i.setAssetTypeIdentifiers=ql,i.setAssetTypeStatus=go,i.setAssetTypeStatuses=bo,i.setAssetTypes=uo,i.setAssets=Cr,i.setCategories=Lo,i.setCategory=ko,i.setClientSDK=SO,i.setClientStore=fO,i.setConversation=ma,i.setConversations=oP,i.setCurrentUser=gF,i.setDocument=yh,i.setDocumentAttachment=eh,i.setDocumentAttachments=th,i.setDocuments=ph,i.setEmailDomain=Rh,i.setEmailDomains=wh,i.setForm=Hm,i.setFormIdentifier=Kh,i.setFormIdentifierValue=dm,i.setFormIdentifierValues=rm,i.setFormIdentifiers=Yh,i.setFormRevision=zm,i.setFormRevisionAttachment=Om,i.setFormRevisionAttachments=Pm,i.setFormRevisions=Bm,i.setFormSubmission=py,i.setFormSubmissionAttachment=ny,i.setFormSubmissionAttachments=ay,i.setFormSubmissions=Ay,i.setForms=Wm,i.setGeoImage=Ry,i.setGeoImages=wy,i.setIsImportingProjectFile=sI,i.setIssue=Gp,i.setIssueAssociation=Ny,i.setIssueAssociations=Ly,i.setIssueAttachment=np,i.setIssueAttachments=ap,i.setIssueComment=Vp,i.setIssueCommentAttachment=Tp,i.setIssueCommentAttachments=Sp,i.setIssueComments=zp,i.setIssueType=Yf,i.setIssueTypeAttachment=nA,i.setIssueTypeAttachments=aA,i.setIssueTypeFieldValues=VA,i.setIssueTypeFieldValuesAttachment=cf,i.setIssueTypeFieldValuesAttachments=df,i.setIssueTypeFieldValuesMany=zA,i.setIssueTypeFields=WA,i.setIssueTypeFieldsAttachment=TA,i.setIssueTypeFieldsAttachments=SA,i.setIssueTypeFieldsMany=KA,i.setIssueTypeIdentifier=If,i.setIssueTypeIdentifierValue=Bf,i.setIssueTypeIdentifierValues=jf,i.setIssueTypeIdentifiers=Of,i.setIssueTypeStatus=rT,i.setIssueTypeStatuses=uT,i.setIssueTypes=Zf,i.setIssueUpdate=ST,i.setIssueUpdates=IT,i.setIssues=Hp,i.setLoggedIn=jo,i.setOrganization=tS,i.setOrganizationAccess=LT,i.setOrganizationAccesses=NT,i.setOrganizations=eS,i.setProfilePicture=bF,i.setProject=mI,i.setProjectAccess=FS,i.setProjectAccesses=gS,i.setProjectAttachment=qS,i.setProjectAttachments=DS,i.setProjectFile=YS,i.setProjectFiles=ZS,i.setProjects=hI,i.setRehydrated=UF,i.setTeam=NI,i.setTeamMembership=wI,i.setTeamMemberships=EI,i.setTeams=GI,i.setTokens=KP,i.setUploadUrl=Uh,i.setUser=ET,i.setUsers=wT,i.shallowEqual=kO,i.slugify=iP,i.spacesToDashesLower=sP,i.teamMembershipReducer=jI,i.teamMembershipSlice=zn,i.teamReducer=QI,i.teamSlice=Bn,i.toFileNameSafeString=tP,i.toUuidArray=C,i.toUuidIdRecord=eP,i.truncate=nP,i.updateAsset=Br,i.updateAssetAttachment=Oa,i.updateAssetAttachments=Pa,i.updateAssetProcedure=Kc,i.updateAssetProcedureStep=Fr,i.updateAssetProcedureStepFieldValues=ur,i.updateAssetProcedureStepFieldValuesAttachment=Zd,i.updateAssetProcedureStepFieldValuesAttachments=Jd,i.updateAssetProcedureStepFieldValuesMany=lr,i.updateAssetProcedureStepFields=Dd,i.updateAssetProcedureStepFieldsAttachment=Fd,i.updateAssetProcedureStepFieldsAttachments=gd,i.updateAssetProcedureStepFieldsMany=Cd,i.updateAssetProcedureSteps=gr,i.updateAssetProcedureType=dd,i.updateAssetProcedureTypeAttachment=ja,i.updateAssetProcedureTypeAttachments=qa,i.updateAssetProcedureTypeFieldValues=qc,i.updateAssetProcedureTypeFieldValuesAttachment=Pc,i.updateAssetProcedureTypeFieldValuesAttachments=Fc,i.updateAssetProcedureTypeFieldValuesMany=Dc,i.updateAssetProcedureTypeFields=uc,i.updateAssetProcedureTypeFieldsAttachment=Za,i.updateAssetProcedureTypeFieldsAttachments=Ja,i.updateAssetProcedureTypeFieldsMany=lc,i.updateAssetProcedureTypes=rd,i.updateAssetProcedures=Yc,i.updateAssetStage=lu,i.updateAssetStageCompletion=Zr,i.updateAssetStageCompletions=Jr,i.updateAssetStages=ou,i.updateAssetType=ho,i.updateAssetTypeAttachment=Pu,i.updateAssetTypeAttachments=Fu,i.updateAssetTypeFieldValues=Fl,i.updateAssetTypeFieldValuesAttachment=ul,i.updateAssetTypeFieldValuesAttachments=ll,i.updateAssetTypeFieldValuesMany=gl,i.updateAssetTypeFields=Ju,i.updateAssetTypeFieldsAttachment=qu,i.updateAssetTypeFieldsAttachments=Du,i.updateAssetTypeFieldsMany=Xu,i.updateAssetTypeIdentifier=Dl,i.updateAssetTypeIdentifierValue=Xl,i.updateAssetTypeIdentifierValues=Ql,i.updateAssetTypeIdentifiers=Cl,i.updateAssetTypeStatus=_o,i.updateAssetTypeStatuses=Mo,i.updateAssetTypes=mo,i.updateAssets=jr,i.updateCategories=Go,i.updateCategory=No,i.updateConversation=ya,i.updateConversations=hP,i.updateDocument=Ah,i.updateDocumentAttachment=sh,i.updateDocumentAttachments=ih,i.updateDocuments=fh,i.updateEmailDomain=Eh,i.updateEmailDomains=vh,i.updateForm=Km,i.updateFormIdentifier=Zh,i.updateFormIdentifierValue=um,i.updateFormIdentifierValues=lm,i.updateFormIdentifiers=Jh,i.updateFormRevision=jm,i.updateFormRevisionAttachment=Fm,i.updateFormRevisionAttachments=gm,i.updateFormRevisions=qm,i.updateFormSubmission=Ty,i.updateFormSubmissionAttachment=cy,i.updateFormSubmissionAttachments=dy,i.updateFormSubmissions=Sy,i.updateForms=Ym,i.updateGeoImage=Vy,i.updateGeoImages=zy,i.updateIssue=Wp,i.updateIssueAssociation=Gy,i.updateIssueAssociations=Hy,i.updateIssueAttachment=cp,i.updateIssueAttachments=dp,i.updateIssueComment=Bp,i.updateIssueCommentAttachment=Ip,i.updateIssueCommentAttachments=Op,i.updateIssueComments=jp,i.updateIssueType=Jf,i.updateIssueTypeAttachment=cA,i.updateIssueTypeAttachments=dA,i.updateIssueTypeFieldValues=BA,i.updateIssueTypeFieldValuesAttachment=rf,i.updateIssueTypeFieldValuesAttachments=uf,i.updateIssueTypeFieldValuesMany=jA,i.updateIssueTypeFields=YA,i.updateIssueTypeFieldsAttachment=IA,i.updateIssueTypeFieldsAttachments=OA,i.updateIssueTypeFieldsMany=ZA,i.updateIssueTypeIdentifier=Pf,i.updateIssueTypeIdentifierValue=qf,i.updateIssueTypeIdentifierValues=Df,i.updateIssueTypeIdentifiers=Ff,i.updateIssueTypeStatus=lT,i.updateIssueTypeStatuses=oT,i.updateIssueTypes=Xf,i.updateIssueUpdate=OT,i.updateIssueUpdates=PT,i.updateIssues=Kp,i.updateOrganization=aS,i.updateOrganizationAccess=GT,i.updateOrganizationAccesses=HT,i.updateOrganizations=nS,i.updateProject=fI,i.updateProjectAccess=bS,i.updateProjectAccesses=_S,i.updateProjectAttachment=CS,i.updateProjectAttachments=$S,i.updateProjectFile=QS,i.updateProjectFiles=xS,i.updateProjects=AI,i.updateTeam=HI,i.updateTeamMembership=vI,i.updateTeamMemberships=VI,i.updateTeams=WI,i.updateUser=zT,i.updateUsers=VT,i.useSelectorBuilder=UO,i.userReducer=jT,i.userSlice=Sn,i.uuidObj=R,i.uuidObjSortFn=Yt,i.uuidSortFn=ft,i.versioningReducer=eO,i.versioningSlice=xI,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
|