@overmap-ai/core 1.0.78-bulk-project-access.2 → 1.0.78-bulk-update.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants/defaults.d.ts +1 -2
- package/dist/enums/asset.d.ts +8 -0
- package/dist/enums/index.d.ts +1 -0
- package/dist/enums/issue.d.ts +7 -5
- package/dist/overmap-core.js +8855 -7503
- package/dist/overmap-core.umd.cjs +11 -11
- package/dist/sdk/base.d.ts +6 -2
- package/dist/sdk/constants.d.ts +4 -5
- package/dist/sdk/errors.d.ts +5 -0
- package/dist/sdk/index.d.ts +5 -1
- package/dist/sdk/middleware/OfflineAnalyticsMiddleware.d.ts +6 -0
- package/dist/sdk/middleware/OfflineMiddleware.d.ts +13 -0
- package/dist/sdk/middleware/RateLimitingMiddleware.d.ts +6 -0
- package/dist/sdk/middleware/constants.d.ts +1 -0
- package/dist/sdk/middleware/index.d.ts +5 -0
- package/dist/sdk/middleware/utils.d.ts +2 -0
- package/dist/sdk/outbox/globals.d.ts +2 -0
- package/dist/sdk/{classes → outbox}/index.d.ts +1 -0
- package/dist/sdk/performRequest.d.ts +6 -0
- package/dist/sdk/services/AgentService.d.ts +2 -1
- package/dist/sdk/services/AssetAttachmentService.d.ts +25 -27
- package/dist/sdk/services/AssetProcedureService.d.ts +23 -6
- package/dist/sdk/services/AssetProcedureStepFieldValuesAttachmentService.d.ts +20 -3
- package/dist/sdk/services/AssetProcedureStepFieldValuesService.d.ts +22 -12
- package/dist/sdk/services/AssetProcedureStepFieldsAttachmentService.d.ts +20 -3
- package/dist/sdk/services/AssetProcedureStepFieldsService.d.ts +21 -4
- package/dist/sdk/services/AssetProcedureStepService.d.ts +21 -4
- package/dist/sdk/services/AssetProcedureTypeAttachmentService.d.ts +39 -0
- package/dist/sdk/services/AssetProcedureTypeFieldValuesAttachmentService.d.ts +33 -0
- package/dist/sdk/services/AssetProcedureTypeFieldValuesService.d.ts +33 -0
- package/dist/sdk/services/AssetProcedureTypeFieldsAttachmentService.d.ts +30 -0
- package/dist/sdk/services/AssetProcedureTypeFieldsService.d.ts +26 -0
- package/dist/sdk/services/AssetProcedureTypeService.d.ts +28 -0
- package/dist/sdk/services/AssetService.d.ts +23 -5
- package/dist/sdk/services/AssetStageCompletionService.d.ts +21 -4
- package/dist/sdk/services/AssetStageService.d.ts +21 -4
- package/dist/sdk/services/AssetTypeAttachmentService.d.ts +25 -26
- package/dist/sdk/services/AssetTypeFieldValuesAttachmentService.d.ts +20 -3
- package/dist/sdk/services/AssetTypeFieldValuesService.d.ts +22 -10
- package/dist/sdk/services/AssetTypeFieldsAttachmentService.d.ts +21 -4
- package/dist/sdk/services/AssetTypeFieldsService.d.ts +20 -3
- package/dist/sdk/services/AssetTypeIdentifierService.d.ts +21 -4
- package/dist/sdk/services/AssetTypeIdentifierValueService.d.ts +21 -4
- package/dist/sdk/services/AssetTypeService.d.ts +21 -4
- package/dist/sdk/services/AssetTypeStatusService.d.ts +28 -0
- package/dist/sdk/services/BaseModelApiService.d.ts +27 -0
- package/dist/sdk/services/BaseOfflineAttachmentModelService.d.ts +23 -0
- package/dist/sdk/services/BaseOfflineModelApiService.d.ts +27 -0
- package/dist/sdk/services/BaseService.d.ts +5 -3
- package/dist/sdk/services/CategoryService.d.ts +22 -5
- package/dist/sdk/services/DocumentAttachmentService.d.ts +25 -26
- package/dist/sdk/services/DocumentService.d.ts +22 -5
- package/dist/sdk/services/EmailDomainsService.d.ts +21 -4
- package/dist/sdk/services/FileService.d.ts +5 -1
- package/dist/sdk/services/FormIdentifierService.d.ts +21 -4
- package/dist/sdk/services/FormIdentifierValueService.d.ts +22 -5
- package/dist/sdk/services/FormRevisionAttachmentService.d.ts +20 -3
- package/dist/sdk/services/FormRevisionService.d.ts +20 -3
- package/dist/sdk/services/FormService.d.ts +20 -3
- package/dist/sdk/services/FormSubmissionAttachmentService.d.ts +22 -5
- package/dist/sdk/services/FormSubmissionService.d.ts +22 -5
- package/dist/sdk/services/GeoImageService.d.ts +23 -6
- package/dist/sdk/services/IssueAssociationService.d.ts +21 -4
- package/dist/sdk/services/IssueAttachmentService.d.ts +25 -27
- package/dist/sdk/services/IssueCommentAttachmentService.d.ts +25 -27
- package/dist/sdk/services/IssueCommentService.d.ts +22 -5
- package/dist/sdk/services/IssueService.d.ts +23 -5
- package/dist/sdk/services/IssueTypeAttachmentService.d.ts +25 -27
- package/dist/sdk/services/IssueTypeFieldValuesAttachmentService.d.ts +20 -3
- package/dist/sdk/services/IssueTypeFieldValuesService.d.ts +21 -4
- package/dist/sdk/services/IssueTypeFieldsAttachmentService.d.ts +20 -3
- package/dist/sdk/services/IssueTypeFieldsService.d.ts +21 -4
- package/dist/sdk/services/IssueTypeIdentifierService.d.ts +21 -4
- package/dist/sdk/services/IssueTypeIdentifierValueService.d.ts +21 -4
- package/dist/sdk/services/IssueTypeService.d.ts +21 -4
- package/dist/sdk/services/IssueTypeStatusService.d.ts +28 -0
- package/dist/sdk/services/IssueUpdateService.d.ts +20 -3
- package/dist/sdk/services/JWTAuthService.d.ts +1 -1
- package/dist/sdk/services/OrganizationAccessService.d.ts +21 -4
- package/dist/sdk/services/OrganizationService.d.ts +20 -3
- package/dist/sdk/services/ProjectAccessService.d.ts +23 -6
- package/dist/sdk/services/ProjectAttachmentService.d.ts +25 -26
- package/dist/sdk/services/ProjectFileService.d.ts +20 -3
- package/dist/sdk/services/ProjectService.d.ts +22 -5
- package/dist/sdk/services/TeamMembershipService.d.ts +20 -3
- package/dist/sdk/services/TeamService.d.ts +21 -4
- package/dist/sdk/services/UserService.d.ts +24 -3
- package/dist/sdk/services/index.d.ts +11 -6
- package/dist/sdk/typings.d.ts +15 -58
- package/dist/sdk/utils.d.ts +2 -0
- package/dist/store/adapters/modelAdapter.d.ts +13 -14
- package/dist/store/adapters/typings.d.ts +19 -0
- package/dist/store/reducers.d.ts +24 -18
- package/dist/store/slices/agentsSlice.d.ts +10 -37
- package/dist/store/slices/assetAttachmentSlice.d.ts +11 -37
- package/dist/store/slices/assetProcedureSlice.d.ts +104 -40
- package/dist/store/slices/assetProcedureStepFieldValuesAttachmentSlice.d.ts +18 -43
- package/dist/store/slices/assetProcedureStepFieldValuesSlice.d.ts +21 -45
- package/dist/store/slices/assetProcedureStepFieldsAttachmentSlice.d.ts +19 -43
- package/dist/store/slices/assetProcedureStepFieldsSlice.d.ts +27 -49
- package/dist/store/slices/assetProcedureStepSlice.d.ts +22 -46
- package/dist/store/slices/assetProcedureTypeAttachmentSlice.d.ts +22 -0
- package/dist/store/slices/assetProcedureTypeFieldValuesAttachmentSlice.d.ts +112 -0
- package/dist/store/slices/assetProcedureTypeFieldValuesSlice.d.ts +113 -0
- package/dist/store/slices/assetProcedureTypeFieldsAttachmentSlice.d.ts +112 -0
- package/dist/store/slices/assetProcedureTypeFieldsSlice.d.ts +23 -0
- package/dist/store/slices/assetProcedureTypeSlice.d.ts +22 -0
- package/dist/store/slices/assetSlice.d.ts +18 -43
- package/dist/store/slices/assetStageCompletionSlice.d.ts +18 -43
- package/dist/store/slices/assetStageSlice.d.ts +21 -46
- package/dist/store/slices/assetTypeAttachmentSlice.d.ts +11 -37
- package/dist/store/slices/assetTypeFieldValuesAttachmentSlice.d.ts +18 -43
- package/dist/store/slices/assetTypeFieldValuesSlice.d.ts +19 -43
- package/dist/store/slices/assetTypeFieldsAttachmentSlice.d.ts +19 -43
- package/dist/store/slices/assetTypeFieldsSlice.d.ts +19 -43
- package/dist/store/slices/assetTypeIdentifierSlice.d.ts +11 -37
- package/dist/store/slices/assetTypeIdentifierValueSlice.d.ts +11 -37
- package/dist/store/slices/assetTypeSlice.d.ts +10 -37
- package/dist/store/slices/{assetProcedureInstanceSlice.d.ts → assetTypeStatusSlice.d.ts} +34 -60
- package/dist/store/slices/categorySlice.d.ts +18 -43
- package/dist/store/slices/documentAttachmentSlice.d.ts +11 -37
- package/dist/store/slices/documentSlice.d.ts +15 -22
- package/dist/store/slices/emailDomainsSlice.d.ts +20 -43
- package/dist/store/slices/formIdentifierSlice.d.ts +11 -37
- package/dist/store/slices/formIdentifierValueSlice.d.ts +11 -37
- package/dist/store/slices/formRevisionAttachmentSlice.d.ts +103 -37
- package/dist/store/slices/formRevisionSlice.d.ts +19 -43
- package/dist/store/slices/formSlice.d.ts +19 -43
- package/dist/store/slices/formSubmissionAttachmentSlice.d.ts +12 -37
- package/dist/store/slices/formSubmissionSlice.d.ts +12 -40
- package/dist/store/slices/geoImageSlice.d.ts +19 -43
- package/dist/store/slices/index.d.ts +8 -6
- package/dist/store/slices/issueAssociationSlice.d.ts +19 -43
- package/dist/store/slices/issueAttachmentSlice.d.ts +11 -37
- package/dist/store/slices/issueCommentAttachmentSlice.d.ts +11 -37
- package/dist/store/slices/issueCommentSlice.d.ts +11 -37
- package/dist/store/slices/issueSlice.d.ts +10 -37
- package/dist/store/slices/issueTypeAttachmentSlice.d.ts +11 -37
- package/dist/store/slices/issueTypeFieldValuesAttachmentSlice.d.ts +18 -43
- package/dist/store/slices/issueTypeFieldValuesSlice.d.ts +19 -43
- package/dist/store/slices/issueTypeFieldsAttachmentSlice.d.ts +19 -43
- package/dist/store/slices/issueTypeFieldsSlice.d.ts +19 -43
- package/dist/store/slices/issueTypeIdentifierSlice.d.ts +11 -37
- package/dist/store/slices/issueTypeIdentifierValueSlice.d.ts +11 -37
- package/dist/store/slices/issueTypeSlice.d.ts +12 -43
- package/dist/store/slices/{assetProcedureFieldValuesSlice.d.ts → issueTypeStatusSlice.d.ts} +34 -59
- package/dist/store/slices/issueUpdateSlice.d.ts +12 -37
- package/dist/store/slices/organizationAccessSlice.d.ts +11 -37
- package/dist/store/slices/organizationSlice.d.ts +19 -43
- package/dist/store/slices/outboxSlice.d.ts +6 -7
- package/dist/store/slices/projectAccessSlice.d.ts +11 -37
- package/dist/store/slices/projectAttachmentSlice.d.ts +11 -37
- package/dist/store/slices/projectFileSlice.d.ts +20 -45
- package/dist/store/slices/projectSlice.d.ts +19 -43
- package/dist/store/slices/teamMembershipSlice.d.ts +11 -37
- package/dist/store/slices/teamSlice.d.ts +11 -38
- package/dist/store/slices/userSlice.d.ts +18 -43
- package/dist/store/store.d.ts +4 -14
- package/dist/store/typings.d.ts +18 -1
- package/dist/typings/files.d.ts +15 -14
- package/dist/typings/index.d.ts +0 -3
- package/dist/typings/models/agents.d.ts +2 -1
- package/dist/typings/models/assets.d.ts +72 -50
- package/dist/typings/models/base.d.ts +9 -9
- package/dist/typings/models/categories.d.ts +5 -6
- package/dist/typings/models/documents.d.ts +6 -3
- package/dist/typings/models/emailDomain.d.ts +2 -1
- package/dist/typings/models/emailVerification.d.ts +7 -5
- package/dist/typings/models/fields.d.ts +7 -7
- package/dist/typings/models/forms.d.ts +7 -9
- package/dist/typings/models/geoImages.d.ts +7 -7
- package/dist/typings/models/index.d.ts +0 -1
- package/dist/typings/models/issues.d.ts +57 -34
- package/dist/typings/models/organizations.d.ts +1 -1
- package/dist/typings/models/projects.d.ts +5 -2
- package/dist/typings/models/teams.d.ts +2 -3
- package/dist/typings/models/users.d.ts +4 -2
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/models/assets.d.ts +5 -0
- package/dist/utils/models/documents.d.ts +4 -0
- package/dist/utils/models/index.d.ts +3 -0
- package/dist/utils/models/issues.d.ts +2 -0
- package/dist/utils/uuid.d.ts +7 -0
- package/package.json +33 -47
- package/dist/sdk/services/AssetProcedureAttachmentService.d.ts +0 -40
- package/dist/sdk/services/AssetProcedureFieldValuesAttachmentService.d.ts +0 -16
- package/dist/sdk/services/AssetProcedureFieldValuesService.d.ts +0 -22
- package/dist/sdk/services/AssetProcedureFieldsAttachmentService.d.ts +0 -13
- package/dist/sdk/services/AssetProcedureFieldsService.d.ts +0 -9
- package/dist/sdk/services/AssetProcedureInstanceService.d.ts +0 -11
- package/dist/sdk/services/BaseAttachmentService.d.ts +0 -38
- package/dist/sdk/services/BaseUploadService.d.ts +0 -10
- package/dist/store/slices/assetProcedureAttachmentSlice.d.ts +0 -48
- package/dist/store/slices/assetProcedureFieldValuesAttachmentSlice.d.ts +0 -137
- package/dist/store/slices/assetProcedureFieldsAttachmentSlice.d.ts +0 -136
- package/dist/store/slices/assetProcedureFieldsSlice.d.ts +0 -49
- package/dist/typings/colors.d.ts +0 -8
- package/dist/typings/json.d.ts +0 -6
- package/dist/typings/memoization.d.ts +0 -1
- package/dist/typings/models/attachments.d.ts +0 -31
- package/dist/typings/models/store.d.ts +0 -0
- package/dist/typings/search.d.ts +0 -23
- package/dist/utils/offline.d.ts +0 -13
- /package/dist/sdk/{classes → outbox}/OutboxCoordinator.d.ts +0 -0
- /package/dist/sdk/{classes → outbox}/OutboxCoordinator.spec.d.ts +0 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
(function(s,U){typeof exports=="object"&&typeof module<"u"?U(exports,require("@redux-offline/redux-offline/lib/types"),require("@reduxjs/toolkit"),require("superagent"),require("uuid"),require("file-saver"),require("react"),require("@redux-offline/redux-offline"),require("@redux-offline/redux-offline/lib/defaults"),require("buffer"),require("localforage"),require("redux-persist-migrate"),require("@overmap-ai/forms"),require("idb"),require("jwt-decode"),require("dependency-graph"),require("@tiptap/core")):typeof define=="function"&&define.amd?define(["exports","@redux-offline/redux-offline/lib/types","@reduxjs/toolkit","superagent","uuid","file-saver","react","@redux-offline/redux-offline","@redux-offline/redux-offline/lib/defaults","buffer","localforage","redux-persist-migrate","@overmap-ai/forms","idb","jwt-decode","dependency-graph","@tiptap/core"],U):(s=typeof globalThis<"u"?globalThis:s||self,U(s["overmap-core"]={},null,s.toolkit,s.request,s.uuid,s.fileSaver,s.react,s.reduxOffline,s.offlineConfig,null,s.localforage,s.createMigration,null,s.idb,s.jwtDecode,s.dependencyGraph))})(this,function(s,U,d,Ze,Je,Mp,Ep,Vp,sc,RF,jp,qp,vF,zp,Up,Dp){"use strict";var OF=Object.defineProperty;var _F=(s,U,d)=>U in s?OF(s,U,{enumerable:!0,configurable:!0,writable:!0,value:d}):s[U]=d;var S=(s,U,d)=>_F(s,typeof U!="symbol"?U+"":U,d);var wp;const ic=Object.freeze([]),ac=Object.freeze({});var nc=(t=>(t[t.GUEST=0]="GUEST",t[t.BASIC=2]="BASIC",t[t.ADMIN=4]="ADMIN",t))(nc||{}),l=(t=>(t.GET="GET",t.POST="POST",t.PATCH="PATCH",t.PUT="PUT",t.DELETE="DELETE",t))(l||{}),cc=(t=>(t.Issue="issue",t.Asset="asset",t.AssetType="asset_type",t.Project="project",t.Document="document",t))(cc||{}),es=(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))(es||{}),ts=(t=>(t[t.BACKLOG=0]="BACKLOG",t[t.SELECTED=2]="SELECTED",t[t.DONE=4]="DONE",t))(ts||{}),V=(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))(V||{});const Cp=ts.BACKLOG,kp=es.MEDIUM,rc=6e4;function P(t){return{addOne:(p,A)=>{const f=t(A.payload);p.instances[f]=A.payload},addMany:(p,A)=>{for(const f of A.payload){const T=t(f);p.instances[T]=f}},setOne:(p,A)=>{const f=t(A.payload);p.instances[f]=A.payload},setMany:(p,A)=>{for(const f of A.payload){const T=t(f);p.instances[T]=f}},updateOne:(p,A)=>{const f=t(A.payload);p.instances[f]=A.payload},updateMany:(p,A)=>{for(const f of A.payload){const T=t(f);p.instances[T]=f}},deleteOne:(p,A)=>{delete p.instances[A.payload]},deleteMany:(p,A)=>{for(const f of A.payload)delete p.instances[f]},initialize:(p,A)=>{p.instances={};const f=new Set;for(const T of A.payload){const F=t(T);f.add(F),p.instances[F]=T}f.size!==A.payload.length&&console.warn("duplicate ids detected when initializing model instances.")},getInitialState:p=>({...p,instances:{}})}}function Bp(){return{initializeSelection:(m,o)=>{m.selection=Array.from(new Set(o.payload))},selectOne:(m,o)=>{new Set(m.selection).has(o.payload)||m.selection.push(o.payload)},selectMany:(m,o)=>{const h=new Set(m.selection);for(const p of o.payload)h.has(p)||h.add(p);m.selection=Array.from(h)},unselectOne:(m,o)=>{const h=new Set(m.selection);h.has(o.payload)&&(h.delete(o.payload),m.selection=Array.from(h))},unselectMany:(m,o)=>{const h=new Set(m.selection);for(const p of o.payload)h.has(p)&&h.delete(p);m.selection=Array.from(h)},toggleOne:(m,o)=>{const h=new Set(m.selection);h.has(o.payload)?h.delete(o.payload):h.add(o.payload),m.selection=Array.from(h)},toggleMany:(m,o)=>{const h=new Set(m.selection);for(const p of o.payload)h.has(p)?h.delete(p):h.add(p);m.selection=Array.from(h)},getInitialState:m=>({...m,selection:[]})}}const tt="versioning",g=d.createAction("RESET"),M=d.createAction("RESET_PROJECT_STATE"),O=d.createAction("RESET_ORGANIZATION_STATE");wp=Symbol.toStringTag;class dc{constructor(){S(this,wp,"Promise");S(this,"_promise");S(this,"_resolve");S(this,"_reject");S(this,"_state","pending");this._resolve=null,this._reject=null,this._promise=new Promise((e,i)=>{this._resolve=e,this._reject=i})}get state(){return this._state}then(e,i){return this._promise.then(e,i)}catch(e){return this._promise.catch(e)}resolve(e){if(!this._resolve)throw new Error("No resolve callback");this._resolve(e),this._state="fulfilled"}reject(e){if(!this._reject)throw e;this._reject(e),this._state="rejected"}finally(e){throw new Error("`finally` not implemented")}}let ss=!1;["true","1"].includes("".toLowerCase())&&(ss=!0);function $p(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;const i=Object.keys(t),a=Object.keys(e),n=i.length;if(n!==a.length)return!1;for(let c=0;c<n;c++){const r=i[c];if(!Object.prototype.hasOwnProperty.call(e,r)||t[r]!==e[r])return!1}return!0}function is(t){const e={};return function(){const i=Array.prototype.slice.call(arguments);return i in e?(ss&&console.debug(`Memoization debug: Using memorized return value for ${t.toString()}(`,i,")"),e[i]):(ss&&console.debug(`Memoization debug: Cache miss! Memoizing ${t.toString()}(`,i,")"),e[i]=t.apply(this,i))}}function Gp(t,e){if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!==e[i])return!1;return!0}const I=t=>t.length===0?ic:t,Pt=t=>Object.keys(t).length===0?ac:t,uc=is(t=>{if(!t)return"";const e=new Date(t),i=e.getFullYear()===as.getFullYear(),a={day:"numeric",month:"short"};return i||(a.year="numeric"),e.toLocaleDateString([],a)}),Lp=new Intl.RelativeTimeFormat([],{style:"long",numeric:"auto"}),Np=1e3*86400,as=new Date,Hp=t=>new Date(t).toDateString()===as.toDateString(),Wp=is((t,e,i)=>{const a=Math.round((new Date(t).getTime()-as.getTime())/Np);return a<e||a>i?uc(t):Lp.format(a,"days")});function Yp(t){return new Uint8Array(t).reduce((i,a)=>i+a.toString(16).padStart(2,"0"),"")}const ns=async(t,e)=>{e||(e=await Xe(t));let i=t.type;if(i.includes("/")&&(i=i.split("/")[1]),!i)throw new Error(`Could not extract file type from ${t.type}`);return`${e}.${i}`};function Xe(t){return new Promise((e,i)=>{const a=new FileReader;a.onload=()=>{const n=a.result;if(!n){i(new Error("FileReader did not return a valid ArrayBuffer."));return}crypto.subtle.digest("SHA-1",n).then(c=>{const r=Yp(c);e(r)})},a.readAsArrayBuffer(t)})}function Kp(t){if(!t.name||!t.type||!t.size){const e="File has no name, type, and/or size";throw new Error(e)}return`${t.name}&${t.type}${t.size}`}function oc(t,e){return new File([t],e,{type:t.type})}function Zp(t,e){const i=document.createElement("a");i.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(e)),i.setAttribute("download",t),i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i)}const Jp=async t=>{const e={};for(const i of t){const a=await Xe(i);e[a]={sha1:a,extension:i.name.split(".").pop()||"",file_type:i.type,size:i.size}}return Object.values(e)},lc=async t=>(await fetch(t)).blob(),Xp=t=>new Promise((e,i)=>{const a=new FileReader;a.onloadend=()=>{var n;e(((n=a.result)==null?void 0:n.toString())||"")},a.readAsDataURL(t)});function Qp(t){const e=new Blob([t]);Mp.saveAs(e,t.name)}const hc={};function xp(t,e,i,...a){const n=hc[t];let c=!1;n?n[e]||(n[e]=!0,c=!0):(hc[t]={[e]:!0},c=!0),c&&console[i](...a)}const mc=["created_at","updated_at","index","revision"];function b(t){return{...t,uuid:Je.v4()}}function pc(t){const e={};for(const i of t)e[i.uuid]=i;return e}function eA(t,e=void 0,i=255){let a=t.replace(/[^a-z0-9_\-.]/gi,"_").replace(/_{2,}/g,"_");if(!e){const c=t.split(".");c.length>1&&(e=c[c.length-1])}e&&!e.startsWith(".")&&(e="."+e);const n=e?e.length:0;return a.length+n>i&&(a=a.slice(0,i-n)+(e||"")),a}function tA(t){return t.toLowerCase().replace(" ","-")}function sA(t,e=!1){return t.normalize("NFKD").toLowerCase().replace(/[^\w\s-]/g,"").trim().replace(/[-\s]+/g,e?"_":"-")}function iA(t,e){if(t.length<=e)return t;const i=t.slice(0,e-1);return i.slice(0,i.lastIndexOf(" "))+"…"}const y=t=>e=>i=>t(i,e);function Ac(t,e,i){return i.findIndex(a=>a.uuid===t.uuid)===e}function aA(t,e,i){return i.findIndex(a=>a.file_sha1===t.file_sha1)===e}const nA=/^.+@.+\..+$/;function v(t){const e={...t};for(const i of[...mc,"created_by"])i in e&&delete e[i];return e}const k=P(t=>t.uuid),fc=k.getInitialState({}),cs=d.createSlice({name:"agents",initialState:fc,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,fc)),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:yc,addConversation:Sc,addConversations:cA,setConversation:Ic,setConversations:rA,updateConversation:Tc,updateConversations:dA,deleteConversation:uA,deleteConversations:oA}=cs.actions,rs=t=>t.agentsReducer.instances,lA=d.createSelector([rs],t=>Object.values(t)),hA=y(d.createSelector([rs,(t,e)=>e],(t,e)=>t[e])),gc=cs.reducer,B=P(t=>t.uuid),bc=B.getInitialState({}),ds=d.createSlice({name:"assetAttachments",initialState:bc,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,bc)),reducers:{initializeAssetAttachments:B.initialize,addAssetAttachment:B.addOne,addAssetAttachments:B.addMany,setAssetAttachment:B.setOne,setAssetAttachments:B.setMany,updateAssetAttachment:B.updateOne,updateAssetAttachments:B.updateMany,deleteAssetAttachment:B.deleteOne,deleteAssetAttachments:B.deleteMany}}),{initializeAssetAttachments:us,addAssetAttachment:mA,addAssetAttachments:os,setAssetAttachment:Fc,setAssetAttachments:pA,updateAssetAttachment:AA,updateAssetAttachments:Pc,deleteAssetAttachment:Oc,deleteAssetAttachments:ls}=ds.actions,_c=t=>t.assetAttachmentReducer.instances,Rc=d.createSelector([_c],t=>Object.values(t)),vc=t=>e=>e.assetAttachmentReducer.instances[t],wc=y(d.createSelector([Rc,(t,e)=>e],(t,e)=>I(t.filter(({asset:i})=>e===i)))),Mc=ds.reducer,$=P(t=>t.uuid),Ec=$.getInitialState({}),hs=d.createSlice({name:"assetProcedureAttachments",initialState:Ec,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Ec)),reducers:{initializeAssetProcedureAttachments:$.initialize,addAssetProcedureAttachment:$.addOne,addAssetProcedureAttachments:$.addMany,setAssetProcedureAttachment:$.setOne,setAssetProcedureAttachments:$.setMany,updateAssetProcedureAttachment:$.updateOne,updateAssetProcedureAttachments:$.updateMany,deleteAssetProcedureAttachment:$.deleteOne,deleteAssetProcedureAttachments:$.deleteMany}}),{initializeAssetProcedureAttachments:Vc,addAssetProcedureAttachment:fA,addAssetProcedureAttachments:jc,setAssetProcedureAttachment:qc,setAssetProcedureAttachments:yA,updateAssetProcedureAttachment:SA,updateAssetProcedureAttachments:zc,deleteAssetProcedureAttachment:Uc,deleteAssetProcedureAttachments:Dc}=hs.actions,Cc=hs.reducer,kc=t=>t.assetProcedureAttachmentReducer.instances,Bc=d.createSelector([kc],t=>Object.values(t)),$c=t=>e=>e.assetProcedureAttachmentReducer.instances[t],IA=y(d.createSelector([Bc,(t,e)=>e],(t,e)=>I(t.filter(({asset_procedure:i})=>e===i)))),G=P(t=>t.uuid),Gc=G.getInitialState({}),ms=d.createSlice({name:"assetProcedureFieldsAttachments",initialState:Gc,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Gc)),reducers:{initializeAssetProcedureFieldsAttachments:G.initialize,addAssetProcedureFieldsAttachment:G.addOne,addAssetProcedureFieldsAttachments:G.addMany,setAssetProcedureFieldsAttachment:G.setOne,setAssetProcedureFieldsAttachments:G.setMany,updateAssetProcedureFieldsAttachment:G.updateOne,updateAssetProcedureFieldsAttachments:G.updateMany,deleteAssetProcedureFieldsAttachment:G.deleteOne,deleteAssetProcedureFieldsAttachments:G.deleteMany}}),{initializeAssetProcedureFieldsAttachments:Lc,addAssetProcedureFieldsAttachment:TA,addAssetProcedureFieldsAttachments:Nc,setAssetProcedureFieldsAttachment:gA,setAssetProcedureFieldsAttachments:bA,updateAssetProcedureFieldsAttachment:FA,updateAssetProcedureFieldsAttachments:Hc,deleteAssetProcedureFieldsAttachment:PA,deleteAssetProcedureFieldsAttachments:Wc}=ms.actions,Yc=t=>t.assetProcedureFieldsAttachmentReducer.instances,Kc=d.createSelector([Yc],t=>Object.values(t)),OA=y(d.createSelector([Kc,(t,e)=>e],(t,e)=>I(t.filter(i=>i.fields_revision===e)))),_A=t=>e=>e.assetProcedureFieldsAttachmentReducer.instances[t],Zc=ms.reducer,L=P(t=>t.uuid),Jc=L.getInitialState({}),ps=d.createSlice({name:"assetProcedureFields",initialState:Jc,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Jc)),reducers:{initializeAssetProcedureFields:L.initialize,addAssetProcedureFields:L.addOne,addAssetProcedureFieldsMany:L.addMany,setAssetProcedureFields:L.setOne,setAssetProcedureFieldsMany:L.setMany,updateAssetProcedureFields:L.updateOne,updateAssetProcedureFieldsMany:L.updateMany,deleteAssetProcedureFields:L.deleteOne,deleteAssetProcedureFieldsMany:L.deleteMany}}),{initializeAssetProcedureFields:Xc,addAssetProcedureFields:Qc,addAssetProcedureFieldsMany:RA,setAssetProcedureFields:vA,setAssetProcedureFieldsMany:wA,updateAssetProcedureFields:xc,updateAssetProcedureFieldsMany:MA,deleteAssetProcedureFields:er,deleteAssetProcedureFieldsMany:EA}=ps.actions,tr=t=>t.assetProcedureFieldsReducer.instances,As=d.createSelector([tr],t=>Object.values(t)),VA=y(d.createSelector([As,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_procedure===e)))),jA=y(d.createSelector([As,(t,e)=>e],(t,e)=>t.filter(i=>i.asset_procedure===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),qA=t=>e=>e.assetProcedureFieldsReducer.instances[t],sr=ps.reducer,N=P(t=>t.uuid),ir=N.getInitialState({}),fs=d.createSlice({name:"assetProcedureFieldValuesAttachments",initialState:ir,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,ir)),reducers:{initializeAssetProcedureFieldValuesAttachments:N.initialize,addAssetProcedureFieldValuesAttachment:N.addOne,addAssetProcedureFieldValuesAttachments:N.addMany,setAssetProcedureFieldValuesAttachment:N.setOne,setAssetProcedureFieldValuesAttachments:N.setMany,updateAssetProcedureFieldValuesAttachment:N.updateOne,updateAssetProcedureFieldValuesAttachments:N.updateMany,deleteAssetProcedureFieldValuesAttachment:N.deleteOne,deleteAssetProcedureFieldValuesAttachments:N.deleteMany}}),{initializeAssetProcedureFieldValuesAttachments:ar,addAssetProcedureFieldValuesAttachment:zA,addAssetProcedureFieldValuesAttachments:Ot,setAssetProcedureFieldValuesAttachment:UA,setAssetProcedureFieldValuesAttachments:DA,updateAssetProcedureFieldValuesAttachment:CA,updateAssetProcedureFieldValuesAttachments:nr,deleteAssetProcedureFieldValuesAttachment:kA,deleteAssetProcedureFieldValuesAttachments:_t}=fs.actions,ys=t=>t.assetProcedureFieldValuesAttachmentReducer.instances,cr=d.createSelector([ys],t=>Object.values(t)),BA=t=>e=>e.assetProcedureFieldValuesAttachmentReducer.instances[t],rr=y(d.createSelector([ys,(t,e)=>e],(t,e)=>{const i=new Set(e);return I(Object.values(t).filter(a=>i.has(a.uuid)))})),dr=y(d.createSelector([cr,(t,e)=>e],(t,e)=>I(t.filter(i=>i.field_values===e)))),ur=fs.reducer,H=P(t=>t.uuid),or=H.getInitialState({}),Ss=d.createSlice({name:"assetProcedureFieldValues",initialState:or,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,or)),reducers:{initializeAssetProcedureFieldValues:H.initialize,addAssetProcedureFieldValues:H.addOne,addAssetProcedureFieldValuesMany:H.addMany,setAssetProcedureFieldValues:H.setOne,setAssetProcedureFieldValuesMany:H.setMany,updateAssetProcedureFieldValues:H.updateOne,updateAssetProcedureFieldValuesMany:H.updateMany,deleteAssetProcedureFieldValues:H.deleteOne,deleteAssetProcedureFieldValuesMany:H.deleteMany}}),{initializeAssetProcedureFieldValues:lr,addAssetProcedureFieldValues:Is,addAssetProcedureFieldValuesMany:hr,setAssetProcedureFieldValues:$A,setAssetProcedureFieldValuesMany:GA,updateAssetProcedureFieldValues:st,updateAssetProcedureFieldValuesMany:mr,deleteAssetProcedureFieldValues:Ts,deleteAssetProcedureFieldValuesMany:pr}=Ss.actions,Ar=Ss.reducer,fr=t=>t.assetProcedureFieldValuesReducer.instances,gs=d.createSelector([fr],t=>Object.values(t)),LA=y(d.createSelector([gs,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset===e)))),NA=y(d.createSelector([gs,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_procedure_instance===e)))),bs=t=>e=>e.assetProcedureFieldValuesReducer.instances[t],W=P(t=>t.uuid),yr=W.getInitialState({}),Fs=d.createSlice({name:"assetProcedureInstances",initialState:yr,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,yr)),reducers:{initializeAssetProcedureInstances:W.initialize,addAssetProcedureInstance:W.addOne,addAssetProcedureInstances:W.addMany,setAssetProcedureInstance:W.setOne,setAssetProcedureInstances:W.setMany,updateAssetProcedureInstance:W.updateOne,updateAssetProcedureInstances:W.updateMany,deleteAssetProcedureInstance:W.deleteOne,deleteAssetProcedureInstances:W.deleteMany}}),{initializeAssetProcedureInstances:Sr,addAssetProcedureInstance:Ps,addAssetProcedureInstances:Ir,updateAssetProcedureInstance:it,updateAssetProcedureInstances:HA,deleteAssetProcedureInstance:Os,deleteAssetProcedureInstances:Tr,setAssetProcedureInstance:WA,setAssetProcedureInstances:YA}=Fs.actions,gr=Fs.reducer,_s=t=>t.assetProcedureInstanceReducer.instances,Rs=d.createSelector([_s],t=>Object.values(t)),br=y(d.createSelector([Rs,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_procedure===e)))),KA=y(d.createSelector([Rs,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_type===e)))),vs=t=>e=>e.assetProcedureInstanceReducer.instances[t],ZA=y(d.createSelector([_s,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n&&i.push(n)}return I(i)})),Y=P(t=>t.uuid),Fr=Y.getInitialState({}),ws=d.createSlice({name:"assetProcedures",initialState:Fr,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Fr)),reducers:{initializeAssetProcedures:Y.initialize,addAssetProcedure:Y.addOne,addAssetProcedures:Y.addMany,setAssetProcedure:Y.setOne,setAssetProcedures:Y.setMany,updateAssetProcedure:Y.updateOne,updateAssetProcedures:Y.updateMany,deleteAssetProcedure:Y.deleteOne,deleteAssetProcedures:Y.deleteMany}}),{initializeAssetProcedures:Pr,addAssetProcedure:Ms,addAssetProcedures:JA,updateAssetProcedure:at,updateAssetProcedures:XA,deleteAssetProcedure:Es,deleteAssetProcedures:QA,setAssetProcedure:xA,setAssetProcedures:ef}=ws.actions,Or=ws.reducer,Vs=t=>t.assetProcedureReducer.instances,_r=d.createSelector([Vs],t=>Object.values(t)),js=t=>e=>e.assetProcedureReducer.instances[t],tf=y(d.createSelector([Vs,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n&&i.push(n)}return I(i)})),sf=y(d.createSelector([_r,(t,e)=>e],(t,e)=>I(t.filter(i=>i.organization===e)))),K=P(t=>t.uuid),Rr=K.getInitialState({}),qs=d.createSlice({name:"assetProcedureStepFieldsAttachments",initialState:Rr,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Rr)),reducers:{initializeAssetProcedureStepFieldsAttachments:K.initialize,addAssetProcedureStepFieldsAttachment:K.addOne,addAssetProcedureStepFieldsAttachments:K.addMany,setAssetProcedureStepFieldsAttachment:K.setOne,setAssetProcedureStepFieldsAttachments:K.setMany,updateAssetProcedureStepFieldsAttachment:K.updateOne,updateAssetProcedureStepFieldsAttachments:K.updateMany,deleteAssetProcedureStepFieldsAttachment:K.deleteOne,deleteAssetProcedureStepFieldsAttachments:K.deleteMany}}),{initializeAssetProcedureStepFieldsAttachments:vr,addAssetProcedureStepFieldsAttachment:af,addAssetProcedureStepFieldsAttachments:wr,setAssetProcedureStepFieldsAttachment:nf,setAssetProcedureStepFieldsAttachments:cf,updateAssetProcedureStepFieldsAttachment:rf,updateAssetProcedureStepFieldsAttachments:Mr,deleteAssetProcedureStepFieldsAttachment:df,deleteAssetProcedureStepFieldsAttachments:Er}=qs.actions,Vr=t=>t.assetProcedureStepFieldsAttachmentReducer.instances,jr=d.createSelector([Vr],t=>Object.values(t)),uf=y(d.createSelector([jr,(t,e)=>e],(t,e)=>I(t.filter(i=>i.fields_revision===e)))),of=t=>e=>e.assetProcedureStepFieldsAttachmentReducer.instances[t],qr=qs.reducer,Z=P(t=>t.uuid),zr=Z.getInitialState({}),zs=d.createSlice({name:"assetProcedureStepFields",initialState:zr,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,zr)),reducers:{initializeAssetProcedureStepFields:Z.initialize,addAssetProcedureStepFields:Z.addOne,addAssetProcedureStepFieldsMany:Z.addMany,setAssetProcedureStepFields:Z.setOne,setAssetProcedureStepFieldsMany:Z.setMany,updateAssetProcedureStepFields:Z.updateOne,updateAssetProcedureStepFieldsMany:Z.updateMany,deleteAssetProcedureStepFields:Z.deleteOne,deleteAssetProcedureStepFieldsMany:Z.deleteMany}}),{initializeAssetProcedureStepFields:Ur,addAssetProcedureStepFields:Us,addAssetProcedureStepFieldsMany:lf,setAssetProcedureStepFields:hf,setAssetProcedureStepFieldsMany:mf,updateAssetProcedureStepFields:nt,updateAssetProcedureStepFieldsMany:pf,deleteAssetProcedureStepFields:Ds,deleteAssetProcedureStepFieldsMany:Af}=zs.actions,Cs=t=>t.assetProcedureStepFieldsReducer.instances,ks=d.createSelector([Cs],t=>Object.values(t)),ff=y(d.createSelector([ks,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_procedure_step===e)))),yf=y(d.createSelector([ks,(t,e)=>e],(t,e)=>t.filter(i=>i.asset_procedure_step===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),Sf=d.createSelector([Cs],t=>{const e={};for(const i of Object.values(t)){const a=e[i.asset_procedure_step];(!a||a.submitted_at<i.submitted_at)&&(e[i.asset_procedure_step]=i)}return e}),If=t=>e=>e.assetProcedureStepFieldsReducer.instances[t],Dr=zs.reducer,J=P(t=>t.uuid),Cr=J.getInitialState({}),Bs=d.createSlice({name:"assetProcedureStepFieldValuesAttachments",initialState:Cr,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,Cr)),reducers:{initializeAssetProcedureStepFieldValuesAttachments:J.initialize,addAssetProcedureStepFieldValuesAttachment:J.addOne,addAssetProcedureStepFieldValuesAttachments:J.addMany,setAssetProcedureStepFieldValuesAttachment:J.setOne,setAssetProcedureStepFieldValuesAttachments:J.setMany,updateAssetProcedureStepFieldValuesAttachment:J.updateOne,updateAssetProcedureStepFieldValuesAttachments:J.updateMany,deleteAssetProcedureStepFieldValuesAttachment:J.deleteOne,deleteAssetProcedureStepFieldValuesAttachments:J.deleteMany}}),{initializeAssetProcedureStepFieldValuesAttachments:kr,addAssetProcedureStepFieldValuesAttachment:Tf,addAssetProcedureStepFieldValuesAttachments:Rt,setAssetProcedureStepFieldValuesAttachment:gf,setAssetProcedureStepFieldValuesAttachments:bf,updateAssetProcedureStepFieldValuesAttachment:Ff,updateAssetProcedureStepFieldValuesAttachments:Br,deleteAssetProcedureStepFieldValuesAttachment:Pf,deleteAssetProcedureStepFieldValuesAttachments:vt}=Bs.actions,$s=t=>t.assetProcedureStepFieldValuesAttachmentReducer.instances,$r=d.createSelector([$s],t=>Object.values(t)),Of=t=>e=>e.assetProcedureStepFieldValuesAttachmentReducer.instances[t],Gr=y(d.createSelector([$s,(t,e)=>e],(t,e)=>{const i=new Set(e);return I(Object.values(t).filter(a=>i.has(a.uuid)))})),Lr=y(d.createSelector([$r,(t,e)=>e],(t,e)=>I(t.filter(i=>i.field_values===e)))),Nr=Bs.reducer,X=P(t=>t.uuid),Hr=X.getInitialState({}),Gs=d.createSlice({name:"assetProcedureStepFieldValues",initialState:Hr,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,Hr)),reducers:{initializeAssetProcedureStepFieldValues:X.initialize,addAssetProcedureStepFieldValues:X.addOne,addAssetProcedureStepFieldValuesMany:X.addMany,setAssetProcedureStepFieldValues:X.setOne,setAssetProcedureStepFieldValuesMany:X.setMany,updateAssetProcedureStepFieldValues:X.updateOne,updateAssetProcedureStepFieldValuesMany:X.updateMany,deleteAssetProcedureStepFieldValues:X.deleteOne,deleteAssetProcedureStepFieldValuesMany:X.deleteMany}}),{initializeAssetProcedureStepFieldValues:Wr,addAssetProcedureStepFieldValues:Ls,addAssetProcedureStepFieldValuesMany:Yr,setAssetProcedureStepFieldValues:_f,setAssetProcedureStepFieldValuesMany:Rf,updateAssetProcedureStepFieldValues:ct,updateAssetProcedureStepFieldValuesMany:Kr,deleteAssetProcedureStepFieldValues:Ns,deleteAssetProcedureStepFieldValuesMany:Zr}=Gs.actions,Jr=t=>t.assetProcedureStepFieldValuesReducer.instances,wt=d.createSelector([Jr],t=>Object.values(t)),vf=y(d.createSelector([wt,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset===e)))),wf=y(d.createSelector([wt,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_procedure_instance===e)))),Mf=y(d.createSelector([wt,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_procedure_step===e)))),Hs=t=>e=>e.assetProcedureStepFieldValuesReducer.instances[t],Xr=Gs.reducer,Q=P(t=>t.uuid),Qr=Q.getInitialState({}),Ws=d.createSlice({name:"assetProcedureSteps",initialState:Qr,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Qr)),reducers:{initializeAssetProcedureSteps:Q.initialize,setAssetProcedureStep:Q.setOne,setAssetProcedureSteps:Q.setMany,addAssetProcedureStep:Q.addOne,addAssetProcedureSteps:Q.addMany,updateAssetProcedureStep:Q.updateOne,updateAssetProcedureSteps:Q.updateMany,deleteAssetProcedureStep:Q.deleteOne,deleteAssetProcedureSteps:Q.deleteMany}}),{initializeAssetProcedureSteps:xr,setAssetProcedureStep:ed,setAssetProcedureSteps:Ef,addAssetProcedureStep:Ys,addAssetProcedureSteps:Vf,updateAssetProcedureStep:Mt,updateAssetProcedureSteps:jf,deleteAssetProcedureStep:Ks,deleteAssetProcedureSteps:qf}=Ws.actions,td=Ws.reducer,Et=t=>t.assetProcedureStepReducer.instances,Zs=t=>e=>e.assetProcedureStepReducer.instances[t],sd=d.createSelector([Et],t=>Object.values(t)),zf=y(d.createSelector([Et,(t,e)=>e],(t,e)=>{const i={};for(const[a,n]of Object.entries(t))n.asset_procedure===e&&(i[a]=n);return Pt(i)})),Uf=y(d.createSelector([sd,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_procedure===e)))),Df=y(d.createSelector([Et,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectAssetProcedureStepsByIds: No step exists with the id",a)}return I(i)})),x=P(t=>t.uuid),id=x.getInitialState({}),Js=d.createSlice({name:"assets",initialState:id,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,id)),reducers:{initializeAssets:x.initialize,addAsset:x.addOne,addAssets:x.addMany,setAsset:x.setOne,setAssets:x.setMany,updateAsset:x.updateOne,updateAssets:x.updateMany,deleteAsset:x.deleteOne,deleteAssets:x.deleteMany}}),{initializeAssets:ad,addAsset:Xs,addAssets:Vt,updateAsset:rt,updateAssets:Cf,deleteAsset:Qs,deleteAssets:xs,setAsset:kf,setAssets:Bf}=Js.actions,ei=t=>t.assetReducer.instances,nd=d.createSelector([ei],t=>I(Object.values(t))),ti=y(d.createSelector([nd,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_type===e)))),si=t=>e=>e.assetReducer.instances[t],cd=y(d.createSelector([ei,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n&&i.push(n)}return I(i)})),$f=t=>e=>ti(t)(e).length,rd=Js.reducer,ee=P(t=>t.uuid),dd=ee.getInitialState({}),ii=d.createSlice({name:"assetStageCompletions",initialState:dd,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,dd)),reducers:{initializeAssetStageCompletions:ee.initialize,addAssetStageCompletion:ee.addOne,addAssetStageCompletions:ee.addMany,setAssetStageCompletion:ee.setOne,setAssetStageCompletions:ee.setMany,updateAssetStageCompletion:ee.updateOne,updateAssetStageCompletions:ee.updateMany,deleteAssetStageCompletion:ee.deleteOne,deleteAssetStageCompletions:ee.deleteMany}}),{initializeAssetStageCompletions:ud,addAssetStageCompletion:ai,addAssetStageCompletions:ni,setAssetStageCompletion:Gf,setAssetStageCompletions:Lf,updateAssetStageCompletion:od,updateAssetStageCompletions:ld,deleteAssetStageCompletion:ci,deleteAssetStageCompletions:ri}=ii.actions,hd=ii.reducer,di=t=>t.assetStageCompletionReducer.instances,Nf=d.createSelector([di],t=>Object.values(t)),md=t=>e=>e.assetStageCompletionReducer.instances[t],pd=y(d.createSelector([di,(t,e)=>e],(t,e)=>{const i=new Set(e);return I(Object.values(t).filter(a=>i.has(a.uuid)))})),te=P(t=>t.uuid),Ad=te.getInitialState({}),ui=d.createSlice({name:"assetStages",initialState:Ad,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Ad)),reducers:{initializeAssetStages:te.initialize,setAssetStage:te.setOne,setAssetStages:te.setMany,addAssetStage:te.addOne,addAssetStages:te.addMany,updateAssetStage:te.updateOne,updateAssetStages:te.updateMany,deleteAssetStage:te.deleteOne,deleteAssetStages:te.deleteMany}}),{initializeAssetStages:fd,setAssetStage:yd,setAssetStages:Hf,addAssetStage:oi,addAssetStages:Wf,updateAssetStage:jt,updateAssetStages:Yf,deleteAssetStage:li,deleteAssetStages:Kf}=ui.actions,Sd=ui.reducer,qt=t=>t.assetStageReducer.instances,hi=t=>e=>e.assetStageReducer.instances[t],Id=d.createSelector([qt],t=>Object.values(t)),Zf=y(d.createSelector([qt,(t,e)=>e],(t,e)=>{const i={};for(const[a,n]of Object.entries(t))n.asset_procedure===e&&(i[a]=n);return Pt(i)})),Jf=y(d.createSelector([Id,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_procedure===e)))),Xf=y(d.createSelector([qt,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectStagesFromStageIds: No stage exists with the id",a)}return I(i)})),se=P(t=>t.uuid),Td=se.getInitialState({}),mi=d.createSlice({name:"assetTypeAttachments",initialState:Td,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Td)),reducers:{initializeAssetTypeAttachments:se.initialize,addAssetTypeAttachment:se.addOne,addAssetTypeAttachments:se.addMany,setAssetTypeAttachment:se.setOne,setAssetTypeAttachments:se.setMany,updateAssetTypeAttachment:se.updateOne,updateAssetTypeAttachments:se.updateMany,deleteAssetTypeAttachment:se.deleteOne,deleteAssetTypeAttachments:se.deleteMany}}),{initializeAssetTypeAttachments:gd,addAssetTypeAttachment:Qf,addAssetTypeAttachments:pi,setAssetTypeAttachment:bd,setAssetTypeAttachments:xf,updateAssetTypeAttachment:ey,updateAssetTypeAttachments:Fd,deleteAssetTypeAttachment:Pd,deleteAssetTypeAttachments:Ai}=mi.actions,Od=t=>t.assetTypeAttachmentReducer.instances,_d=d.createSelector([Od],t=>Object.values(t)),Rd=t=>e=>e.assetTypeAttachmentReducer.instances[t],vd=y(d.createSelector([_d,(t,e)=>e],(t,e)=>I(t.filter(({asset_type:i})=>e===i)))),wd=mi.reducer,ie=P(t=>t.uuid),Md=ie.getInitialState({}),fi=d.createSlice({name:"assetTypeFieldsAttachments",initialState:Md,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Md)),reducers:{initializeAssetTypeFieldsAttachments:ie.initialize,addAssetTypeFieldsAttachment:ie.addOne,addAssetTypeFieldsAttachments:ie.addMany,setAssetTypeFieldsAttachment:ie.setOne,setAssetTypeFieldsAttachments:ie.setMany,updateAssetTypeFieldsAttachment:ie.updateOne,updateAssetTypeFieldsAttachments:ie.updateMany,deleteAssetTypeFieldsAttachment:ie.deleteOne,deleteAssetTypeFieldsAttachments:ie.deleteMany}}),{initializeAssetTypeFieldsAttachments:Ed,addAssetTypeFieldsAttachment:ty,addAssetTypeFieldsAttachments:Vd,setAssetTypeFieldsAttachment:sy,setAssetTypeFieldsAttachments:iy,updateAssetTypeFieldsAttachment:ay,updateAssetTypeFieldsAttachments:jd,deleteAssetTypeFieldsAttachment:ny,deleteAssetTypeFieldsAttachments:qd}=fi.actions,zd=t=>t.assetTypeFieldsAttachmentReducer.instances,Ud=d.createSelector([zd],t=>Object.values(t)),cy=y(d.createSelector([Ud,(t,e)=>e],(t,e)=>I(t.filter(i=>i.fields_revision===e)))),ry=t=>e=>e.assetTypeFieldsAttachmentReducer.instances[t],Dd=fi.reducer,ae=P(t=>t.uuid),Cd=ae.getInitialState({}),yi=d.createSlice({name:"assetTypeFields",initialState:Cd,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Cd)),reducers:{initializeAssetTypeFields:ae.initialize,addAssetTypeFields:ae.addOne,addAssetTypeFieldsMany:ae.addMany,setAssetTypeFields:ae.setOne,setAssetTypeFieldsMany:ae.setMany,updateAssetTypeFields:ae.updateOne,updateAssetTypeFieldsMany:ae.updateMany,deleteAssetTypeFields:ae.deleteOne,deleteAssetTypeFieldsMany:ae.deleteMany}}),{initializeAssetTypeFields:kd,addAssetTypeFields:Bd,addAssetTypeFieldsMany:dy,setAssetTypeFields:uy,setAssetTypeFieldsMany:oy,updateAssetTypeFields:$d,updateAssetTypeFieldsMany:ly,deleteAssetTypeFields:Gd,deleteAssetTypeFieldsMany:hy}=yi.actions,Ld=t=>t.assetTypeFieldsReducer.instances,zt=d.createSelector([Ld],t=>Object.values(t)),my=y(d.createSelector([zt,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_type===e)))),py=y(d.createSelector([zt,(t,e)=>e],(t,e)=>t.filter(i=>i.asset_type===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),Ay=t=>e=>e.assetTypeFieldsReducer.instances[t],Nd=yi.reducer,ne=P(t=>t.uuid),Hd=ne.getInitialState({}),Si=d.createSlice({name:"assetTypeFieldValuesAttachments",initialState:Hd,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,Hd)),reducers:{initializeAssetTypeFieldValuesAttachments:ne.initialize,addAssetTypeFieldValuesAttachment:ne.addOne,addAssetTypeFieldValuesAttachments:ne.addMany,setAssetTypeFieldValuesAttachment:ne.setOne,setAssetTypeFieldValuesAttachments:ne.setMany,updateAssetTypeFieldValuesAttachment:ne.updateOne,updateAssetTypeFieldValuesAttachments:ne.updateMany,deleteAssetTypeFieldValuesAttachment:ne.deleteOne,deleteAssetTypeFieldValuesAttachments:ne.deleteMany}}),{initializeAssetTypeFieldValuesAttachments:Wd,addAssetTypeFieldValuesAttachment:fy,addAssetTypeFieldValuesAttachments:Ut,setAssetTypeFieldValuesAttachment:yy,setAssetTypeFieldValuesAttachments:Sy,updateAssetTypeFieldValuesAttachment:Iy,updateAssetTypeFieldValuesAttachments:Yd,deleteAssetTypeFieldValuesAttachment:Ty,deleteAssetTypeFieldValuesAttachments:Dt}=Si.actions,Ii=t=>t.assetTypeFieldValuesAttachmentReducer.instances,Kd=d.createSelector([Ii],t=>Object.values(t)),gy=t=>e=>e.assetTypeFieldValuesAttachmentReducer.instances[t],Zd=y(d.createSelector([Ii,(t,e)=>e],(t,e)=>{const i=new Set(e);return I(Object.values(t).filter(a=>i.has(a.uuid)))})),Jd=y(d.createSelector([Kd,(t,e)=>e],(t,e)=>I(t.filter(i=>i.field_values===e)))),Xd=Si.reducer,ce=P(t=>t.uuid),Qd=ce.getInitialState({}),Ti=d.createSlice({name:"assetTypeFieldValues",initialState:Qd,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,Qd)),reducers:{initializeAssetTypeFieldValues:ce.initialize,addAssetTypeFieldValues:ce.addOne,addAssetTypeFieldValuesMany:ce.addMany,setAssetTypeFieldValues:ce.setOne,setAssetTypeFieldValuesMany:ce.setMany,updateAssetTypeFieldValues:ce.updateOne,updateAssetTypeFieldValuesMany:ce.updateMany,deleteAssetTypeFieldValues:ce.deleteOne,deleteAssetTypeFieldValuesMany:ce.deleteMany}}),{initializeAssetTypeFieldValues:xd,addAssetTypeFieldValues:gi,addAssetTypeFieldValuesMany:eu,setAssetTypeFieldValues:by,setAssetTypeFieldValuesMany:Fy,updateAssetTypeFieldValues:dt,updateAssetTypeFieldValuesMany:tu,deleteAssetTypeFieldValues:bi,deleteAssetTypeFieldValuesMany:su}=Ti.actions,iu=t=>t.assetTypeFieldValuesReducer.instances,Fi=d.createSelector([iu],t=>Object.values(t)),Py=y(d.createSelector([Fi,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset===e)))),Oy=y(d.createSelector([zt,Fi,(t,e)=>e],(t,e,i)=>{const a=new Set(t.filter(n=>n.asset_type===i).map(n=>n.uuid));return I(e.filter(n=>a.has(n.fields_revision)))})),Pi=t=>e=>e.assetTypeFieldValuesReducer.instances[t],au=Ti.reducer,re=P(t=>t.uuid),nu=re.getInitialState({}),Oi=d.createSlice({name:"assetTypeIdentifiers",initialState:nu,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,nu)),reducers:{initializeAssetTypeIdentifiers:re.initialize,addAssetTypeIdentifier:re.addOne,addAssetTypeIdentifiers:re.addMany,setAssetTypeIdentifier:re.setOne,setAssetTypeIdentifiers:re.setMany,updateAssetTypeIdentifier:re.updateOne,updateAssetTypeIdentifiers:re.updateMany,deleteAssetTypeIdentifier:re.deleteOne,deleteAssetTypeIdentifiers:re.deleteMany}}),{initializeAssetTypeIdentifiers:cu,addAssetTypeIdentifier:_i,addAssetTypeIdentifiers:_y,setAssetTypeIdentifier:Ry,setAssetTypeIdentifiers:vy,updateAssetTypeIdentifier:ut,updateAssetTypeIdentifiers:wy,deleteAssetTypeIdentifier:Ri,deleteAssetTypeIdentifiers:My}=Oi.actions,ru=t=>t.assetTypeIdentifierReducer.instances,du=d.createSelector([ru],t=>Object.values(t)),vi=t=>e=>e.assetTypeIdentifierReducer.instances[t],Ey=y(d.createSelector([du,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_type===e)))),uu=Oi.reducer,de=P(t=>t.uuid),ou=de.getInitialState({}),wi=d.createSlice({name:"assetTypeIdentifierValues",initialState:ou,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,ou)),reducers:{initializeAssetTypeIdentifierValues:de.initialize,addAssetTypeIdentifierValue:de.addOne,addAssetTypeIdentifierValues:de.addMany,setAssetTypeIdentifierValue:de.setOne,setAssetTypeIdentifierValues:de.setMany,updateAssetTypeIdentifierValue:de.updateOne,updateAssetTypeIdentifierValues:de.updateMany,deleteAssetTypeIdentifierValue:de.deleteOne,deleteAssetTypeIdentifierValues:de.deleteMany}}),{initializeAssetTypeIdentifierValues:lu,addAssetTypeIdentifierValue:Mi,addAssetTypeIdentifierValues:Vy,setAssetTypeIdentifierValue:jy,setAssetTypeIdentifierValues:qy,updateAssetTypeIdentifierValue:ot,updateAssetTypeIdentifierValues:zy,deleteAssetTypeIdentifierValue:Ei,deleteAssetTypeIdentifierValues:Uy}=wi.actions,hu=t=>t.assetTypeIdentifierValueReducer.instances,Vi=d.createSelector([hu],t=>Object.values(t)),ji=t=>e=>e.assetTypeIdentifierValueReducer.instances[t],Dy=y(d.createSelector([Vi,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset===e)))),Cy=y(d.createSelector([Vi,(t,e)=>e],(t,e)=>I(t.filter(i=>i.asset_type_identifier===e)))),mu=wi.reducer,ue=P(t=>t.uuid),pu=ue.getInitialState({}),qi=d.createSlice({name:"assetTypes",initialState:pu,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,pu)),reducers:{initializeAssetTypes:ue.initialize,setAssetType:ue.setOne,setAssetTypes:ue.setMany,addAssetType:ue.addOne,addAssetTypes:ue.addMany,updateAssetType:ue.updateOne,updateAssetTypes:ue.updateMany,deleteAssetType:ue.deleteOne,deleteAssetTypes:ue.deleteMany}}),{initializeAssetTypes:Au,setAssetType:ky,setAssetTypes:By,addAssetType:zi,addAssetTypes:$y,updateAssetType:lt,updateAssetTypes:Gy,deleteAssetType:Ui,deleteAssetTypes:Ly}=qi.actions,Di=t=>t.assetTypeReducer.instances,fu=d.createSelector([Di],t=>Object.values(t)),Ci=t=>e=>e.assetTypeReducer.instances[t],Ny=y(d.createSelector([Di,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectAssetTypesByIds: No assetType exists with the id",a)}return I(i)})),Hy=y(d.createSelector([fu,(t,e)=>e],(t,e)=>I(t.filter(i=>i.organization===e)))),yu=qi.reducer,Su={accessToken:"",refreshToken:"",isLoggedIn:!1},Ct=d.createSlice({name:"auth",initialState:Su,extraReducers:t=>t.addCase(g,e=>Object.assign(e,Su)),reducers:{setTokens:(t,e)=>{t.accessToken=e.payload.accessToken,t.refreshToken=e.payload.refreshToken},clearTokens:t=>{t.accessToken="",t.refreshToken=""},setLoggedIn:(t,e)=>{e.payload||Ct.caseReducers.clearTokens(t),t.isLoggedIn=e.payload}}}),{setTokens:Wy,clearTokens:Yy,setLoggedIn:Iu}=Ct.actions,Ky=t=>t.authReducer.accessToken,Zy=t=>t.authReducer.isLoggedIn,Tu=Ct.reducer,oe=P(t=>t.uuid),gu=oe.getInitialState({}),ki=d.createSlice({name:"categories",initialState:gu,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,gu)),reducers:{initializeCategories:oe.initialize,addCategory:oe.addOne,addCategories:oe.addMany,setCategory:oe.setOne,setCategories:oe.setMany,updateCategory:oe.updateOne,updateCategories:oe.updateMany,deleteCategory:oe.deleteOne,deleteCategories:oe.deleteMany}}),{initializeCategories:bu,addCategory:Bi,addCategories:Jy,setCategory:Xy,setCategories:Qy,updateCategory:Fu,updateCategories:xy,deleteCategory:Pu,deleteCategories:eS}=ki.actions,$i=t=>t.categoryReducer.instances,Ou=d.createSelector([$i],t=>Object.values(t)),Gi=t=>e=>e.categoryReducer.instances[t],tS=y(d.createSelector([$i,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectCategoryByIds: No category exists with the id",a)}return I(i)})),sS=y(d.createSelector([Ou,(t,e)=>e],(t,e)=>I(t.filter(i=>i.project===e)))),_u=ki.reducer,le=P(t=>t.uuid),Ru=le.getInitialState({}),Li=d.createSlice({name:"documentAttachments",initialState:Ru,extraReducers:t=>t.addCase(g,e=>Object.assign(e,Ru)),reducers:{initializeDocumentAttachments:le.initialize,addDocumentAttachment:le.addOne,addDocumentAttachments:le.addMany,setDocumentAttachment:le.setOne,setDocumentAttachments:le.setMany,updateDocumentAttachment:le.updateOne,updateDocumentAttachments:le.updateMany,deleteDocumentAttachment:le.deleteOne,deleteDocumentAttachments:le.deleteMany}}),{initializeDocumentAttachments:vu,addDocumentAttachment:iS,addDocumentAttachments:wu,setDocumentAttachment:Mu,setDocumentAttachments:aS,updateDocumentAttachment:nS,updateDocumentAttachments:Eu,deleteDocumentAttachment:Vu,deleteDocumentAttachments:ju}=Li.actions,qu=t=>t.documentAttachmentReducer.instances,zu=d.createSelector([qu],t=>Object.values(t)),Uu=t=>e=>e.documentAttachmentReducer.instances[t],cS=y(d.createSelector([zu,(t,e)=>e],(t,e)=>I(t.filter(({document:i})=>e===i)))),Du=Li.reducer,Cu={documents:{}},Ni=d.createSlice({name:"documents",initialState:Cu,extraReducers:t=>t.addCase(g,e=>{Object.assign(e,Cu)}),reducers:{setDocuments:(t,e)=>{if(e.payload.filter(Ac).length!==e.payload.length)throw new Error("Tried to use setIssues reducer with duplicate ID's");t.documents=pc(e.payload)},addDocuments:(t,e)=>{for(const i of e.payload)if(i.uuid in t.documents)throw new Error(`attempting to add a document with uuid ${i.uuid} which already exists in state.documents.`);for(const i of e.payload){if(i.parent_document&&t.documents[i.parent_document]){const a=t.documents[i.parent_document];t.documents[i.parent_document]={...a,children_documents:[...a.children_documents,i.uuid]}}t.documents[i.uuid]=i}},updateDocuments:(t,e)=>{for(const i of e.payload)if(!(i.uuid in t.documents))throw new Error(`attempting to update a document with uuid ${i.uuid} which doesn't exists in state.documents.`);for(const i of e.payload){const a=t.documents[i.uuid];if(i.organization!==void 0&&i.organization!==a.organization)throw new Error("organization cannot be updated");if(i.project!==void 0&&i.project!==a.project)throw new Error("project cannot be updated");t.documents[i.uuid]={...a,...i}}},removeDocuments:(t,e)=>{for(const i of e.payload)if(!(i in t.documents))throw new Error(`attempting to delete a document with uuid ${i} which doesn't exists in state.documents.`);for(const i of e.payload){const a=t.documents[i];if(a.parent_document&&t.documents[a.parent_document]){const n=t.documents[a.parent_document];t.documents[a.parent_document]={...n,children_documents:n.children_documents.filter(c=>c!==a.uuid)}}delete t.documents[i]}}}}),{setDocuments:ku,addDocuments:Bu,updateDocuments:Qe,removeDocuments:Hi}=Ni.actions,kt=t=>t.documentsReducer.documents,Wi=d.createSelector([kt],t=>Object.values(t)),$u=t=>e=>e.documentsReducer.documents[t],rS=y(d.createSelector([kt,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectDocumentByIds: No document exists with the id",a)}return I(i)})),dS=y(d.createSelector([Wi,(t,e)=>e],(t,e)=>t.filter(i=>i.project===e))),uS=y(d.createSelector([Wi,(t,e)=>e],(t,e)=>t.filter(i=>i.organization===e))),Gu=Ni.reducer,he=P(t=>t.uuid),Lu=he.getInitialState({}),Yi=d.createSlice({name:"emailDomains",initialState:Lu,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Lu)),reducers:{initializeEmailDomains:he.initialize,addEmailDomain:he.addOne,addEmailDomains:he.addMany,setEmailDomain:he.setOne,setEmailDomains:he.setMany,updateEmailDomain:he.updateOne,updateEmailDomains:he.updateMany,deleteEmailDomain:he.deleteOne,deleteEmailDomains:he.deleteMany}}),{initializeEmailDomains:Nu,addEmailDomain:Hu,addEmailDomains:oS,setEmailDomain:lS,setEmailDomains:hS,updateEmailDomain:mS,updateEmailDomains:pS,deleteEmailDomain:Wu,deleteEmailDomains:AS}=Yi.actions,Yu=t=>t.emailDomainsReducer.instances,Ku=d.createSelector([Yu],t=>Object.values(t)),fS=y(d.createSelector([Ku,(t,e)=>e],(t,e)=>I(t.filter(i=>i.organization===e)))),Zu=Yi.reducer,Ju={s3Urls:{}},Xu=1e3*60*60,yS=Xu*24*7,Ki=d.createSlice({name:"file",initialState:Ju,extraReducers:t=>t.addCase(g,e=>Object.assign(e,Ju)),reducers:{setUploadUrl:(t,e)=>{const{url:i,fields:a,sha1:n}=e.payload,c=new Date,r=new Date(c.getTime()+yS);t.s3Urls[n]={url:i,fields:a,exp:r.getTime()}}}}),{setUploadUrl:Qu}=Ki.actions,xu=t=>e=>{const i=e.fileReducer.s3Urls[t];if(!i)return;const a=new Date().getTime();if(!((i.exp??a)-a<Xu))return i},eo=Ki.reducer,me=P(t=>t.uuid),to=me.getInitialState({}),Zi=d.createSlice({name:"formIdentifiers",initialState:to,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,to)),reducers:{initializeFormIdentifiers:me.initialize,addFormIdentifier:me.addOne,addFormIdentifiers:me.addMany,setFormIdentifier:me.setOne,setFormIdentifiers:me.setMany,updateFormIdentifier:me.updateOne,updateFormIdentifiers:me.updateMany,deleteFormIdentifier:me.deleteOne,deleteFormIdentifiers:me.deleteMany}}),{initializeFormIdentifiers:so,addFormIdentifier:Ji,addFormIdentifiers:SS,setFormIdentifier:IS,setFormIdentifiers:TS,updateFormIdentifier:ht,updateFormIdentifiers:gS,deleteFormIdentifier:Xi,deleteFormIdentifiers:bS}=Zi.actions,io=t=>t.formIdentifierReducer.instances,ao=d.createSelector([io],t=>Object.values(t)),Qi=t=>e=>e.formIdentifierReducer.instances[t],FS=y(d.createSelector([ao,(t,e)=>e],(t,e)=>I(t.filter(i=>i.form===e)))),no=Zi.reducer,pe=P(t=>t.uuid),co=pe.getInitialState({}),xi=d.createSlice({name:"formIdentifierValues",initialState:co,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,co)),reducers:{initializeFormIdentifierValues:pe.initialize,addFormIdentifierValue:pe.addOne,addFormIdentifierValues:pe.addMany,setFormIdentifierValue:pe.setOne,setFormIdentifierValues:pe.setMany,updateFormIdentifierValue:pe.updateOne,updateFormIdentifierValues:pe.updateMany,deleteFormIdentifierValue:pe.deleteOne,deleteFormIdentifierValues:pe.deleteMany}}),{initializeFormIdentifierValues:ro,addFormIdentifierValue:ea,addFormIdentifierValues:PS,setFormIdentifierValue:OS,setFormIdentifierValues:_S,updateFormIdentifierValue:mt,updateFormIdentifierValues:RS,deleteFormIdentifierValue:ta,deleteFormIdentifierValues:vS}=xi.actions,uo=t=>t.formIdentifierValueReducer.instances,sa=d.createSelector([uo],t=>Object.values(t)),ia=t=>e=>e.formIdentifierValueReducer.instances[t],wS=y(d.createSelector([sa,(t,e)=>e],(t,e)=>I(t.filter(i=>i.form_submission===e)))),MS=y(d.createSelector([sa,(t,e)=>e],(t,e)=>I(t.filter(i=>i.form_identifier===e)))),oo=xi.reducer,Ae=P(t=>t.uuid),lo=Ae.getInitialState({}),aa=d.createSlice({name:"formRevisionAttachments",initialState:lo,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,lo)),reducers:{initializeFormRevisionAttachments:Ae.initialize,addFormRevisionAttachment:Ae.addOne,addFormRevisionAttachments:Ae.addMany,setFormRevisionAttachment:Ae.setOne,setFormRevisionAttachments:Ae.setMany,updateFormRevisionAttachment:Ae.updateOne,updateFormRevisionAttachments:Ae.updateMany,deleteFormRevisionAttachment:Ae.deleteOne,deleteFormRevisionAttachments:Ae.deleteMany}}),{initializeFormRevisionAttachments:ho,addFormRevisionAttachment:ES,addFormRevisionAttachments:mo,setFormRevisionAttachment:VS,setFormRevisionAttachments:jS,updateFormRevisionAttachment:qS,updateFormRevisionAttachments:po,deleteFormRevisionAttachment:zS,deleteFormRevisionAttachments:Ao}=aa.actions,fo=t=>t.formRevisionAttachmentReducer.instances,US=y(d.createSelector([fo,(t,e)=>e],(t,e)=>I(Object.values(t).filter(i=>i.form_revision===e)))),yo=aa.reducer,fe=P(t=>t.uuid),So=fe.getInitialState({}),na=d.createSlice({name:"formRevisions",initialState:So,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,So)),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:Io,addFormRevision:ca,addFormRevisions:To,setFormRevision:go,setFormRevisions:DS,updateFormRevision:CS,updateFormRevisions:kS,deleteFormRevision:ra,deleteFormRevisions:bo}=na.actions,da=t=>t.formRevisionReducer.instances,ua=d.createSelector([da],t=>Object.values(t)),BS=t=>e=>e.formRevisionReducer.instances[t],$S=y(d.createSelector([ua,(t,e)=>e],(t,e)=>t.filter(i=>i.form===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),Fo=y(d.createSelector([ua,(t,e)=>e],(t,e)=>I(t.filter(i=>i.form===e)))),Po=na.reducer,ye=P(t=>t.uuid),Oo=ye.getInitialState({}),oa=d.createSlice({name:"forms",initialState:Oo,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Oo)),reducers:{initializeForms:ye.initialize,addForm:ye.addOne,addForms:ye.addMany,setForm:ye.setOne,setForms:ye.setMany,updateForm:ye.updateOne,updateForms:ye.updateMany,deleteForm:ye.deleteOne,deleteForms:ye.deleteMany}}),{initializeForms:_o,addForm:la,addForms:GS,setForm:LS,setForms:NS,updateForm:HS,updateForms:WS,deleteForm:ha,deleteForms:YS}=oa.actions,Ro=oa.reducer,vo=t=>t.formReducer.instances,wo=d.createSelector([vo],t=>Object.values(t)),Mo=t=>e=>e.formReducer.instances[t],KS=y(d.createSelector([wo,(t,e)=>e],(t,e)=>I(t.filter(i=>i.organization===e)))),Se=P(t=>t.uuid),Eo=Se.getInitialState({}),ma=d.createSlice({name:"formSubmissionAttachments",initialState:Eo,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,Eo)),reducers:{initializeFormSubmissionAttachments:Se.initialize,addFormSubmissionAttachment:Se.addOne,addFormSubmissionAttachments:Se.addMany,setFormSubmissionAttachment:Se.setOne,setFormSubmissionAttachments:Se.setMany,updateFormSubmissionAttachment:Se.updateOne,updateFormSubmissionAttachments:Se.updateMany,deleteFormSubmissionAttachment:Se.deleteOne,deleteFormSubmissionAttachments:Se.deleteMany}}),{initializeFormSubmissionAttachments:Vo,addFormSubmissionAttachment:ZS,addFormSubmissionAttachments:Bt,setFormSubmissionAttachment:JS,setFormSubmissionAttachments:XS,updateFormSubmissionAttachment:QS,updateFormSubmissionAttachments:jo,deleteFormSubmissionAttachment:xS,deleteFormSubmissionAttachments:$t}=ma.actions,qo=t=>t.formSubmissionAttachmentReducer.instances,pa=d.createSelector([qo],t=>Object.values(t)),zo=y(d.createSelector([pa,(t,e)=>e],(t,e)=>{const i=new Set(e);return I(t.filter(a=>i.has(a.uuid)))})),Uo=y(d.createSelector([pa,(t,e)=>e],(t,e)=>I(t.filter(i=>i.form_submission===e)))),Do=ma.reducer,Ie=P(t=>t.uuid),Co=Ie.getInitialState({}),Aa=d.createSlice({name:"formSubmissions",initialState:Co,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,Co)),reducers:{initializeFormSubmissions:Ie.initialize,setFormSubmission:Ie.setOne,setFormSubmissions:Ie.setMany,addFormSubmission:Ie.addOne,addFormSubmissions:Ie.addMany,updateFormSubmission:Ie.updateOne,updateFormSubmissions:Ie.updateMany,deleteFormSubmission:Ie.deleteOne,deleteFormSubmissions:Ie.deleteMany}}),{initializeFormSubmissions:ko,setFormSubmission:Gt,setFormSubmissions:eI,addFormSubmission:fa,addFormSubmissions:Lt,updateFormSubmission:Bo,updateFormSubmissions:tI,deleteFormSubmission:ya,deleteFormSubmissions:Nt}=Aa.actions,Sa=t=>t.formSubmissionReducer.instances,Ia=d.createSelector([Sa],t=>Object.values(t)),Ta=t=>e=>e.formSubmissionReducer.instances[t],$o=y(d.createSelector([Sa,da,(t,e)=>e],(t,e,i)=>{const a=new Set;for(const n of Object.values(e))n.form===i&&a.add(n.uuid);return Object.values(t).filter(n=>a.has(n.form_revision))})),Go=y(d.createSelector([Ia,(t,e)=>e],(t,e)=>Object.values(t).filter(i=>i.issue===e))),Lo=y(d.createSelector([Ia,(t,e)=>e],(t,e)=>t.filter(i=>i.asset===e))),No=Aa.reducer,Te=P(t=>t.uuid),Ho=Te.getInitialState({}),ga=d.createSlice({name:"geoImages",initialState:Ho,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,Ho)),reducers:{initializeGeoImages:Te.initialize,setGeoImage:Te.setOne,setGeoImages:Te.setMany,addGeoImage:Te.addOne,addGeoImages:Te.addMany,updateGeoImage:Te.updateOne,updateGeoImages:Te.updateMany,deleteGeoImage:Te.deleteOne,deleteGeoImages:Te.deleteMany}}),{initializeGeoImages:Wo,setGeoImage:pt,setGeoImages:Yo,addGeoImage:Ko,addGeoImages:Zo,updateGeoImage:Jo,updateGeoImages:sI,deleteGeoImage:ba,deleteGeoImages:Xo}=ga.actions,Qo=t=>t.geoImageReducer.instances,xo=d.createSelector([Qo],t=>Object.values(t)),Fa=t=>e=>e.geoImageReducer.instances[t],iI=y(d.createSelector([xo,(t,e)=>e],(t,e)=>I(t.filter(i=>i.project===e)))),el=ga.reducer,ge=P(t=>t.uuid),tl=ge.getInitialState({}),Pa=d.createSlice({name:"issueAssociations",initialState:tl,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,tl)),reducers:{initializeIssueAssociations:ge.initialize,addIssueAssociation:ge.addOne,addIssueAssociations:ge.addMany,setIssueAssociation:ge.setOne,setIssueAssociations:ge.setMany,updateIssueAssociation:ge.updateOne,updateIssueAssociations:ge.updateMany,deleteIssueAssociation:ge.deleteOne,deleteIssueAssociations:ge.deleteMany}}),{initializeIssueAssociations:sl,setIssueAssociations:aI,setIssueAssociation:nI,updateIssueAssociation:il,updateIssueAssociations:cI,addIssueAssociation:Oa,addIssueAssociations:_a,deleteIssueAssociation:Ra,deleteIssueAssociations:va}=Pa.actions,At=t=>t.issueAssociationReducer.instances,rI=d.createSelector([At],t=>Object.values(t)),al=t=>e=>e.issueAssociationReducer.instances[t],nl=y(d.createSelector([At,(t,e)=>e],(t,e)=>I(Object.values(t).filter(i=>i.associated_issue===e)))),cl=y(d.createSelector([At,(t,e)=>e],(t,e)=>I(Object.values(t).filter(i=>i.issue===e)))),rl=y(d.createSelector([At,(t,e)=>e],(t,e)=>I(Object.values(t).filter(i=>i.asset===e)))),dl=Pa.reducer,be=P(t=>t.uuid),ul=be.getInitialState({}),wa=d.createSlice({name:"issueAttachments",initialState:ul,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,ul)),reducers:{initializeIssueAttachments:be.initialize,addIssueAttachment:be.addOne,addIssueAttachments:be.addMany,setIssueAttachment:be.setOne,setIssueAttachments:be.setMany,updateIssueAttachment:be.updateOne,updateIssueAttachments:be.updateMany,deleteIssueAttachment:be.deleteOne,deleteIssueAttachments:be.deleteMany}}),{initializeIssueAttachments:Ma,addIssueAttachment:dI,addIssueAttachments:Ea,setIssueAttachment:ol,setIssueAttachments:uI,updateIssueAttachment:oI,updateIssueAttachments:ll,deleteIssueAttachment:hl,deleteIssueAttachments:Va}=wa.actions,ml=t=>t.issueAttachmentReducer.instances,pl=d.createSelector([ml],t=>Object.values(t)),Al=y(d.createSelector([pl,(t,e)=>e],(t,e)=>I(t.filter(({issue:i})=>e===i)))),fl=t=>e=>e.issueAttachmentReducer.instances[t],yl=wa.reducer,Fe=P(t=>t.uuid),Sl=Fe.getInitialState({}),ja=d.createSlice({name:"issueCommentAttachments",initialState:Sl,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,Sl)),reducers:{initializeIssueCommentAttachments:Fe.initialize,addIssueCommentAttachment:Fe.addOne,addIssueCommentAttachments:Fe.addMany,setIssueCommentAttachment:Fe.setOne,setIssueCommentAttachments:Fe.setMany,updateIssueCommentAttachment:Fe.updateOne,updateIssueCommentAttachments:Fe.updateMany,deleteIssueCommentAttachment:Fe.deleteOne,deleteIssueCommentAttachments:Fe.deleteMany}}),{initializeIssueCommentAttachments:qa,addIssueCommentAttachment:lI,addIssueCommentAttachments:Il,setIssueCommentAttachment:Tl,setIssueCommentAttachments:hI,updateIssueCommentAttachment:mI,updateIssueCommentAttachments:gl,deleteIssueCommentAttachment:bl,deleteIssueCommentAttachments:Fl}=ja.actions,Pl=t=>t.issueCommentAttachmentReducer.instances,Ol=d.createSelector([Pl],t=>Object.values(t)),_l=t=>e=>e.issueCommentAttachmentReducer.instances[t],pI=y(d.createSelector([Ol,(t,e)=>e],(t,e)=>I(t.filter(({issue_comment:i})=>e===i)))),Rl=ja.reducer,Pe=P(t=>t.uuid),vl=Pe.getInitialState({}),za=d.createSlice({name:"issueComments",initialState:vl,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,vl)),reducers:{initializeIssueComments:Pe.initialize,addIssueComment:Pe.addOne,addIssueComments:Pe.addMany,setIssueComment:Pe.setOne,setIssueComments:Pe.setMany,updateIssueComment:Pe.updateOne,updateIssueComments:Pe.updateMany,deleteIssueComment:Pe.deleteOne,deleteIssueComments:Pe.deleteMany}}),{initializeIssueComments:AI,addIssueComment:Ua,addIssueComments:fI,setIssueComment:Da,setIssueComments:wl,updateIssueComment:yI,updateIssueComments:SI,deleteIssueComment:Ca,deleteIssueComments:II}=za.actions,Ml=t=>t.issueCommentReducer.instances,ka=t=>e=>e.issueCommentReducer.instances[t],TI=y(d.createSelector([Ml,(t,e)=>e],(t,e)=>I(Object.values(t).filter(i=>i.issue===e)))),El=za.reducer,Oe=P(t=>t.uuid),Vl=Oe.getInitialState({}),Ba=d.createSlice({name:"issues",initialState:Vl,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,Vl)),reducers:{initializeIssues:Oe.initialize,addIssue:Oe.addOne,addIssues:Oe.addMany,setIssue:Oe.setOne,setIssues:Oe.setMany,updateIssue:Oe.updateOne,updateIssues:Oe.updateMany,deleteIssue:Oe.deleteOne,deleteIssues:Oe.deleteMany}}),{initializeIssues:jl,addIssue:$a,addIssues:ql,setIssue:gI,setIssues:bI,updateIssue:Ht,updateIssues:FI,deleteIssue:Ga,deleteIssues:zl}=Ba.actions,La=t=>t.issueReducer.instances,Na=d.createSelector([La],t=>Object.values(t)),Ha=t=>e=>e.issueReducer.instances[t],PI=y(d.createSelector([La,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectIssuesByIds: No issue exists with the id",a)}return I(i)})),OI=y(d.createSelector([Na,(t,e)=>e],(t,e)=>t.filter(i=>i.project===e))),Ul=y(d.createSelector([Na,(t,e)=>e],(t,e)=>t.filter(i=>i.issue_type===e))),Dl=Ba.reducer,_e=P(t=>t.uuid),Cl=_e.getInitialState({}),Wa=d.createSlice({name:"issueTypeAttachments",initialState:Cl,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Cl)),reducers:{initializeIssueTypeAttachments:_e.initialize,addIssueTypeAttachment:_e.addOne,addIssueTypeAttachments:_e.addMany,setIssueTypeAttachment:_e.setOne,setIssueTypeAttachments:_e.setMany,updateIssueTypeAttachment:_e.updateOne,updateIssueTypeAttachments:_e.updateMany,deleteIssueTypeAttachment:_e.deleteOne,deleteIssueTypeAttachments:_e.deleteMany}}),{initializeIssueTypeAttachments:Ya,addIssueTypeAttachment:_I,addIssueTypeAttachments:kl,setIssueTypeAttachment:Bl,setIssueTypeAttachments:RI,updateIssueTypeAttachment:vI,updateIssueTypeAttachments:$l,deleteIssueTypeAttachment:Gl,deleteIssueTypeAttachments:Ll}=Wa.actions,Nl=t=>t.issueTypeAttachmentReducer.instances,Hl=d.createSelector([Nl],t=>Object.values(t)),Wl=t=>e=>e.issueTypeAttachmentReducer.instances[t],wI=y(d.createSelector([Hl,(t,e)=>e],(t,e)=>I(t.filter(({issue_type:i})=>e===i)))),Yl=Wa.reducer,Re=P(t=>t.uuid),Kl=Re.getInitialState({}),Ka=d.createSlice({name:"issueTypeFieldsAttachments",initialState:Kl,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Kl)),reducers:{initializeIssueTypeFieldsAttachments:Re.initialize,addIssueTypeFieldsAttachment:Re.addOne,addIssueTypeFieldsAttachments:Re.addMany,setIssueTypeFieldsAttachment:Re.setOne,setIssueTypeFieldsAttachments:Re.setMany,updateIssueTypeFieldsAttachment:Re.updateOne,updateIssueTypeFieldsAttachments:Re.updateMany,deleteIssueTypeFieldsAttachment:Re.deleteOne,deleteIssueTypeFieldsAttachments:Re.deleteMany}}),{initializeIssueTypeFieldsAttachments:Zl,addIssueTypeFieldsAttachment:MI,addIssueTypeFieldsAttachments:Jl,setIssueTypeFieldsAttachment:EI,setIssueTypeFieldsAttachments:VI,updateIssueTypeFieldsAttachment:jI,updateIssueTypeFieldsAttachments:Xl,deleteIssueTypeFieldsAttachment:qI,deleteIssueTypeFieldsAttachments:Ql}=Ka.actions,xl=t=>t.issueTypeFieldsAttachmentReducer.instances,eh=d.createSelector([xl],t=>Object.values(t)),zI=y(d.createSelector([eh,(t,e)=>e],(t,e)=>I(t.filter(i=>i.fields_revision===e)))),UI=t=>e=>e.issueTypeFieldsAttachmentReducer.instances[t],th=Ka.reducer,ve=P(t=>t.uuid),sh=ve.getInitialState({}),Za=d.createSlice({name:"issueTypeFieldValues",initialState:sh,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,sh)),reducers:{initializeIssueTypeFieldValues:ve.initialize,addIssueTypeFieldValues:ve.addOne,addIssueTypeFieldValuesMany:ve.addMany,setIssueTypeFieldValues:ve.setOne,setIssueTypeFieldValuesMany:ve.setMany,updateIssueTypeFieldValues:ve.updateOne,updateIssueTypeFieldValuesMany:ve.updateMany,deleteIssueTypeFieldValues:ve.deleteOne,deleteIssueTypeFieldValuesMany:ve.deleteMany}}),{initializeIssueTypeFieldValues:ih,addIssueTypeFieldValues:Ja,addIssueTypeFieldValuesMany:DI,setIssueTypeFieldValues:CI,setIssueTypeFieldValuesMany:kI,updateIssueTypeFieldValues:ft,updateIssueTypeFieldValuesMany:BI,deleteIssueTypeFieldValues:Xa,deleteIssueTypeFieldValuesMany:$I}=Za.actions,ah=t=>t.issueTypeFieldValuesReducer.instances,Qa=d.createSelector([ah],t=>Object.values(t)),GI=y(d.createSelector([Qa,(t,e)=>e],(t,e)=>I(t.filter(i=>i.issue===e)))),xa=t=>e=>e.issueTypeFieldValuesReducer.instances[t],nh=Za.reducer,we=P(t=>t.uuid),ch=we.getInitialState({}),en=d.createSlice({name:"issueTypeFields",initialState:ch,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,ch)),reducers:{initializeIssueTypeFields:we.initialize,addIssueTypeFields:we.addOne,addIssueTypeFieldsMany:we.addMany,setIssueTypeFields:we.setOne,setIssueTypeFieldsMany:we.setMany,updateIssueTypeFields:we.updateOne,updateIssueTypeFieldsMany:we.updateMany,deleteIssueTypeFields:we.deleteOne,deleteIssueTypeFieldsMany:we.deleteMany}}),{initializeIssueTypeFields:rh,addIssueTypeFields:dh,addIssueTypeFieldsMany:LI,setIssueTypeFields:NI,setIssueTypeFieldsMany:HI,updateIssueTypeFields:uh,updateIssueTypeFieldsMany:WI,deleteIssueTypeFields:oh,deleteIssueTypeFieldsMany:YI}=en.actions,lh=t=>t.issueTypeFieldsReducer.instances,Wt=d.createSelector([lh],t=>Object.values(t)),KI=y(d.createSelector([Wt,(t,e)=>e],(t,e)=>I(t.filter(i=>i.issue_type===e)))),ZI=y(d.createSelector([Wt,(t,e)=>e],(t,e)=>t.filter(i=>i.issue_type===e).sort((i,a)=>i.submitted_at>a.submitted_at?-1:1)[0])),JI=y(d.createSelector([Wt,Qa,(t,e)=>e],(t,e,i)=>{const a=new Set(t.filter(n=>n.issue_type===i).map(n=>n.uuid));return I(e.filter(n=>a.has(n.fields_revision)))})),XI=t=>e=>e.issueTypeFieldsReducer.instances[t],hh=en.reducer,Me=P(t=>t.uuid),mh=Me.getInitialState({}),tn=d.createSlice({name:"issueTypeFieldValuesAttachments",initialState:mh,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,mh)),reducers:{initializeIssueTypeFieldValuesAttachments:Me.initialize,addIssueTypeFieldValuesAttachment:Me.addOne,addIssueTypeFieldValuesAttachments:Me.addMany,setIssueTypeFieldValuesAttachment:Me.setOne,setIssueTypeFieldValuesAttachments:Me.setMany,updateIssueTypeFieldValuesAttachment:Me.updateOne,updateIssueTypeFieldValuesAttachments:Me.updateMany,deleteIssueTypeFieldValuesAttachment:Me.deleteOne,deleteIssueTypeFieldValuesAttachments:Me.deleteMany}}),{initializeIssueTypeFieldValuesAttachments:ph,addIssueTypeFieldValuesAttachment:QI,addIssueTypeFieldValuesAttachments:Yt,setIssueTypeFieldValuesAttachment:xI,setIssueTypeFieldValuesAttachments:eT,updateIssueTypeFieldValuesAttachment:tT,updateIssueTypeFieldValuesAttachments:Ah,deleteIssueTypeFieldValuesAttachment:sT,deleteIssueTypeFieldValuesAttachments:Kt}=tn.actions,fh=t=>t.issueTypeFieldValuesAttachmentReducer.instances,sn=d.createSelector([fh],t=>Object.values(t)),iT=t=>e=>e.issueTypeFieldValuesAttachmentReducer.instances[t],yh=y(d.createSelector([sn,(t,e)=>e],(t,e)=>{const i=new Set(e);return I(t.filter(a=>i.has(a.uuid)))})),Sh=y(d.createSelector([sn,(t,e)=>e],(t,e)=>I(t.filter(i=>i.field_values===e)))),Ih=tn.reducer,Ee=P(t=>t.uuid),Th=Ee.getInitialState({}),an=d.createSlice({name:"issueTypeIdentifiers",initialState:Th,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Th)),reducers:{initializeIssueTypeIdentifiers:Ee.initialize,addIssueTypeIdentifier:Ee.addOne,addIssueTypeIdentifiers:Ee.addMany,setIssueTypeIdentifier:Ee.setOne,setIssueTypeIdentifiers:Ee.setMany,updateIssueTypeIdentifier:Ee.updateOne,updateIssueTypeIdentifiers:Ee.updateMany,deleteIssueTypeIdentifier:Ee.deleteOne,deleteIssueTypeIdentifiers:Ee.deleteMany}}),{initializeIssueTypeIdentifiers:gh,addIssueTypeIdentifier:nn,addIssueTypeIdentifiers:aT,setIssueTypeIdentifier:nT,setIssueTypeIdentifiers:cT,updateIssueTypeIdentifier:yt,updateIssueTypeIdentifiers:rT,deleteIssueTypeIdentifier:cn,deleteIssueTypeIdentifiers:dT}=an.actions,bh=t=>t.issueTypeIdentifierReducer.instances,Fh=d.createSelector([bh],t=>Object.values(t)),rn=t=>e=>e.issueTypeIdentifierReducer.instances[t],uT=y(d.createSelector([Fh,(t,e)=>e],(t,e)=>I(t.filter(i=>i.issue_type===e)))),Ph=an.reducer,Ve=P(t=>t.uuid),Oh=Ve.getInitialState({}),dn=d.createSlice({name:"issueTypeIdentifierValues",initialState:Oh,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,Oh)),reducers:{initializeIssueTypeIdentifierValues:Ve.initialize,addIssueTypeIdentifierValue:Ve.addOne,addIssueTypeIdentifierValues:Ve.addMany,setIssueTypeIdentifierValue:Ve.setOne,setIssueTypeIdentifierValues:Ve.setMany,updateIssueTypeIdentifierValue:Ve.updateOne,updateIssueTypeIdentifierValues:Ve.updateMany,deleteIssueTypeIdentifierValue:Ve.deleteOne,deleteIssueTypeIdentifierValues:Ve.deleteMany}}),{initializeIssueTypeIdentifierValues:_h,addIssueTypeIdentifierValue:un,addIssueTypeIdentifierValues:oT,setIssueTypeIdentifierValue:lT,setIssueTypeIdentifierValues:hT,updateIssueTypeIdentifierValue:St,updateIssueTypeIdentifierValues:mT,deleteIssueTypeIdentifierValue:on,deleteIssueTypeIdentifierValues:pT}=dn.actions,Rh=t=>t.issueTypeIdentifierValueReducer.instances,ln=d.createSelector([Rh],t=>Object.values(t)),hn=t=>e=>e.issueTypeIdentifierValueReducer.instances[t],AT=y(d.createSelector([ln,(t,e)=>e],(t,e)=>I(t.filter(i=>i.issue===e)))),fT=y(d.createSelector([ln,(t,e)=>e],(t,e)=>I(t.filter(i=>i.issue_type_identifier===e)))),vh=dn.reducer,C=P(t=>t.uuid),wh=C.getInitialState({}),mn=d.createSlice({name:"issueTypes",initialState:wh,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,wh)),reducers:{initializeIssueTypes:C.initialize,addIssueType:C.addOne,addIssueTypes:C.addMany,setIssueType:C.setOne,setIssueTypes:C.setMany,updateIssueType:C.updateOne,updateIssueTypes:C.updateMany,deleteIssueType:C.deleteOne,deleteIssueTypes:C.deleteMany,removeIssueType:C.deleteOne}}),{initializeIssueTypes:Mh,addIssueType:Eh,addIssueTypes:yT,setIssueType:It,setIssueTypes:ST,updateIssueType:Vh,updateIssueTypes:IT,deleteIssueType:TT,deleteIssueTypes:gT,removeIssueType:pn}=mn.actions,An=t=>t.issueTypeReducer.instances,jh=d.createSelector(An,t=>Object.values(t)),fn=t=>e=>e.issueTypeReducer.instances[t],bT=y(d.createSelector([An,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectIssueTypesByIds: No issue type exists with the id",a)}return i})),FT=y(d.createSelector([jh,(t,e)=>e],(t,e)=>I(t.filter(i=>i.organization===e)))),qh=mn.reducer,je=P(t=>t.uuid),zh=je.getInitialState({}),yn=d.createSlice({name:"issueUpdates",initialState:zh,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,zh)),reducers:{initializeIssueUpdates:je.initialize,addIssueUpdate:je.addOne,addIssueUpdates:je.addMany,setIssueUpdate:je.setOne,setIssueUpdates:je.setMany,updateIssueUpdate:je.updateOne,updateIssueUpdates:je.updateMany,deleteIssueUpdate:je.deleteOne,deleteIssueUpdates:je.deleteMany}}),{initializeIssueUpdates:Uh,addIssueUpdate:Dh,addIssueUpdates:Ch,setIssueUpdate:PT,setIssueUpdates:OT,updateIssueUpdate:_T,updateIssueUpdates:RT,deleteIssueUpdate:kh,deleteIssueUpdates:Bh}=yn.actions,$h=t=>t.issueUpdateReducer.instances,Gh=d.createSelector([$h],t=>Object.values(t)),Lh=y(d.createSelector([Gh,(t,e)=>e],(t,e)=>I(t.filter(i=>i.issue===e)))),Nh=yn.reducer,qe=P(t=>t.id),Hh=qe.getInitialState({currentUser:null}),Sn=d.createSlice({name:"users",initialState:Hh,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Hh)),reducers:{initializeUsers:qe.initialize,setUsers:qe.setMany,setUser:qe.setOne,addUsers:qe.addMany,addUser:qe.addOne,updateUsers:qe.updateMany,updateUser:qe.updateOne,deleteUser:qe.deleteOne,deleteUsers:qe.deleteMany,setCurrentUser:(t,e)=>{t.currentUser=e.payload},setProfilePicture:(t,e)=>{if(!t.currentUser)return;t.currentUser.profile.file=e.payload.file??null,t.currentUser.profile.file_sha1=e.payload.file_sha1??null;const i=t.instances[t.currentUser.id];if(!i)throw new Error("Unable to find current user in users slice");i.profile.file=e.payload.file??null,i.profile.file_sha1=e.payload.file_sha1??null}}}),{initializeUsers:Wh,setUsers:vT,setUser:wT,addUsers:MT,addUser:Yh,updateUsers:ET,updateUser:VT,deleteUser:Kh,deleteUsers:jT,setCurrentUser:qT,setProfilePicture:zT}=Sn.actions,Zh=Sn.reducer,Jh=t=>t.userReducer.currentUser,Zt=t=>t.userReducer.instances,In=d.createSelector([Zt],t=>Object.values(t)),Xh=t=>e=>e.userReducer.instances[t],UT=y(d.createSelector([Zt,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectUsersByIds: No user exists with the id",a)}return I(i)})),ze=P(t=>t.uuid),Qh=ze.getInitialState({}),Tn=d.createSlice({name:"organizationAccess",initialState:Qh,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Qh)),reducers:{initializeOrganizationAccesses:ze.initialize,addOrganizationAccess:ze.addOne,addOrganizationAccesses:ze.addMany,setOrganizationAccess:ze.setOne,setOrganizationAccesses:ze.setMany,updateOrganizationAccess:ze.updateOne,updateOrganizationAccesses:ze.updateMany,deleteOrganizationAccess:ze.deleteOne,deleteOrganizationAccesses:ze.deleteMany}}),{initializeOrganizationAccesses:xh,addOrganizationAccess:em,addOrganizationAccesses:DT,setOrganizationAccess:CT,setOrganizationAccesses:kT,updateOrganizationAccess:Jt,updateOrganizationAccesses:BT,deleteOrganizationAccess:tm,deleteOrganizationAccesses:$T}=Tn.actions,sm=Tn.reducer,gn=t=>t.organizationAccessReducer.instances,bn=t=>e=>e.organizationAccessReducer.instances[t],GT=d.createSelector([Jh,gn],(t,e)=>Object.values(e).find(a=>a.user===(t==null?void 0:t.id))??null),im=d.createSelector([gn],t=>{const e={};for(const i of Object.values(t))e[i.user]=i;return Pt(e)}),LT=y(d.createSelector([Zt,im,(t,e)=>e],(t,e,i)=>I(Object.values(t).filter(a=>{const n=e[a.id];return!!n&&n.organization===i})))),Ue=P(t=>t.uuid),am=Ue.getInitialState({}),Fn=d.createSlice({name:"organizations",initialState:am,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,am)),reducers:{initializeOrganizations:Ue.initialize,setOrganizations:Ue.setMany,setOrganization:Ue.setOne,addOrganizations:Ue.addMany,addOrganization:Ue.addOne,updateOrganizations:Ue.updateMany,updateOrganization:Ue.updateOne,deleteOrganization:Ue.deleteOne,deleteOrganizations:Ue.deleteMany}}),{initializeOrganizations:nm,setOrganizations:NT,setOrganization:HT,addOrganizations:WT,addOrganization:cm,updateOrganizations:YT,updateOrganization:rm,deleteOrganization:KT,deleteOrganizations:ZT}=Fn.actions,dm=t=>t.organizationReducer.instances,JT=d.createSelector([dm],t=>Object.values(t)),XT=t=>e=>e.organizationReducer.instances[t],um=Fn.reducer,om=(t,e,i)=>{const a=t.uuid?t:{...t,uuid:Je.v4()};return{payload:a,type:"",meta:{offline:{effect:{timestamp:new Date().toISOString(),request:a,BASE_URL:e,serviceName:i}}}}},lm={deletedRequests:[],latestRetryTime:0},Pn=d.createSlice({name:"outbox",initialState:lm,extraReducers:t=>t.addCase(g,e=>Object.assign(e,lm)),reducers:{enqueueRequest:{reducer:(t,e)=>t,prepare:t=>{console.debug("Preparing to enqueue request",t);const{BASE_URL:e,serviceName:i,...a}=t;return om(a,e,i)}},markForDeletion(t,e){t.deletedRequests.push(e.payload)},markAsDeleted(t,e){const i=t.deletedRequests.indexOf(e.payload);i!==-1&&t.deletedRequests.splice(i,1)},_setLatestRetryTime:(t,e)=>{t.latestRetryTime=e.payload}}}),QT=t=>t.outboxReducer.deletedRequests,xT=t=>t.outboxReducer.latestRetryTime,{enqueueRequest:hm,markForDeletion:eg,markAsDeleted:mm,_setLatestRetryTime:pm}=Pn.actions,Am=Pn.reducer,De=P(t=>t.uuid),fm=De.getInitialState({}),On=d.createSlice({name:"projectAccess",initialState:fm,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,fm)),reducers:{initializeProjectAccesses:De.initialize,addProjectAccess:De.addOne,addProjectAccesses:De.addMany,setProjectAccess:De.setOne,setProjectAccesses:De.setMany,updateProjectAccess:De.updateOne,updateProjectAccesses:De.updateMany,deleteProjectAccess:De.deleteOne,deleteProjectAccesses:De.deleteMany}}),{initializeProjectAccesses:ym,addProjectAccess:_n,addProjectAccesses:Rn,setProjectAccess:tg,setProjectAccesses:sg,updateProjectAccess:Tt,updateProjectAccesses:Sm,deleteProjectAccess:vn,deleteProjectAccesses:wn}=On.actions,Im=On.reducer,Mn=t=>t.projectAccessReducer.instances,Xt=d.createSelector(Mn,t=>Object.values(t)),En=t=>e=>e.projectAccessReducer.instances[t],Tm=y(d.createSelector([Mn,(t,e)=>e],(t,e)=>I(Object.values(t).filter(i=>i.project===e)))),ig=y(d.createSelector([Xt,(t,e)=>e],(t,e)=>{const i={};for(const a of t.filter(n=>n.project===e))i[a.user]=a;return i})),ag=y(d.createSelector([In,Xt,(t,e)=>e],(t,e,i)=>{const a=new Set(e.filter(n=>n.project===i).map(n=>n.user));return I(t.filter(n=>a.has(n.id)))})),Ce=P(t=>t.uuid),gm=Ce.getInitialState({}),Vn=d.createSlice({name:"projectAttachments",initialState:gm,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,gm)),reducers:{initializeProjectAttachments:Ce.initialize,addProjectAttachment:Ce.addOne,addProjectAttachments:Ce.addMany,setProjectAttachment:Ce.setOne,setProjectAttachments:Ce.setMany,updateProjectAttachment:Ce.updateOne,updateProjectAttachments:Ce.updateMany,deleteProjectAttachment:Ce.deleteOne,deleteProjectAttachments:Ce.deleteMany}}),{initializeProjectAttachments:bm,addProjectAttachment:ng,addProjectAttachments:Fm,setProjectAttachment:Pm,setProjectAttachments:Om,updateProjectAttachment:cg,updateProjectAttachments:_m,deleteProjectAttachment:Rm,deleteProjectAttachments:jn}=Vn.actions,vm=t=>t.projectAttachmentReducer.instances,wm=d.createSelector([vm],t=>Object.values(t)),Mm=t=>e=>e.projectAttachmentReducer.instances[t],Em=y(d.createSelector([wm,(t,e)=>e],(t,e)=>I(t.filter(({project:i})=>e===i)))),Vm=Vn.reducer,ke=P(t=>t.uuid),jm=ke.getInitialState({activeProjectFileId:null,isImportingProjectFile:!1}),qn=d.createSlice({name:"projectFiles",initialState:jm,extraReducers:t=>t.addMatcher(d.isAnyOf(g,M,O),e=>Object.assign(e,jm)),reducers:{initializeProjectFiles:ke.initialize,setProjectFile:ke.setOne,setProjectFiles:ke.setMany,addProjectFile:ke.addOne,addProjectFiles:ke.addMany,updateProjectFile:ke.updateOne,updateProjectFiles:ke.updateMany,deleteProjectFile:ke.deleteOne,deleteProjectFiles:ke.deleteMany,setIsImportingProjectFile:(t,e)=>{t.isImportingProjectFile=e.payload},saveActiveProjectFileBounds:(t,e)=>{const i=t.activeProjectFileId;if(!i)throw new Error("Tried to save bounds for active project file, but no active project file was set.");if(!t.instances[i])throw new Error(`Tried to save bounds for active project file, but project file with ID ${i}
|
|
2
|
-
doesn't exist.`);t.instances[i].bounds=e.payload},setActiveProjectFileId:(t,e)=>{t.activeProjectFileId=e.payload},resetProjectFileObjectUrls:(t,...e)=>{for(const i in t.instances)delete t.instances[i].objectURL}}}),{initializeProjectFiles:qm,setProjectFile:rg,setProjectFiles:dg,addProjectFile:ug,addProjectFiles:zm,updateProjectFile:zn,updateProjectFiles:og,deleteProjectFile:Um,deleteProjectFiles:Dm,setIsImportingProjectFile:Cm,setActiveProjectFileId:km,saveActiveProjectFileBounds:Bm,resetProjectFileObjectUrls:lg}=qn.actions,$m=t=>t.projectFileReducer.instances,Gm=d.createSelector([$m],t=>I(Object.values(t).sort((e,i)=>e.z_index-i.z_index))),hg=t=>e=>e.projectFileReducer.instances[t],mg=t=>t.projectFileReducer.activeProjectFileId,pg=t=>t.projectFileReducer.isImportingProjectFile,Lm=qn.reducer,Be=P(t=>t.uuid),Nm=Be.getInitialState({}),Un=d.createSlice({name:"projects",initialState:Nm,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Nm)),reducers:{initializeProjects:Be.initialize,setProjects:Be.setMany,setProject:Be.setOne,addProjects:Be.addMany,addProject:Be.addOne,updateProjects:Be.updateMany,updateProject:Be.updateOne,deleteProject:Be.deleteOne,deleteProjects:Be.deleteMany}}),{initializeProjects:Hm,setProjects:Ag,setProject:fg,addProjects:yg,addProject:Dn,updateProjects:Sg,updateProject:Wm,deleteProject:Cn,deleteProjects:Ig}=Un.actions,Ym=Un.reducer,Km=t=>t.projectReducer.instances,kn=d.createSelector([Km],t=>I(Object.values(t))),Zm=t=>e=>e.projectReducer.instances[t],Tg=y(d.createSelector([kn,Xt,(t,e)=>e],(t,e,i)=>{const a=new Set(e.filter(n=>n.user===i).map(n=>n.project));return I(t.filter(n=>a.has(n.uuid)))})),gg=y(d.createSelector([kn,(t,e)=>e],(t,e)=>I(t.filter(i=>i.organization===e)))),bg={isRehydrated:!1},Bn=d.createSlice({name:"rehydrated",initialState:bg,reducers:{setRehydrated:(t,e)=>{t.isRehydrated=e.payload}}}),{setRehydrated:Fg}=Bn.actions,Pg=t=>t.rehydratedReducer.isRehydrated,Jm=Bn.reducer,$e=P(t=>t.uuid),Xm=$e.getInitialState({}),$n=d.createSlice({name:"teamMemberships",initialState:Xm,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,Xm)),reducers:{initializeTeamMemberships:$e.initialize,addTeamMembership:$e.addOne,addTeamMemberships:$e.addMany,setTeamMembership:$e.setOne,setTeamMemberships:$e.setMany,updateTeamMembership:$e.updateOne,updateTeamMemberships:$e.updateMany,deleteTeamMembership:$e.deleteOne,deleteTeamMemberships:$e.deleteMany}}),{initializeTeamMemberships:Qm,addTeamMembership:xm,addTeamMemberships:ep,setTeamMembership:Gn,setTeamMemberships:tp,updateTeamMembership:Og,updateTeamMemberships:_g,deleteTeamMembership:Ln,deleteTeamMemberships:sp}=$n.actions,ip=$n.reducer,ap=t=>t.teamMembershipReducer.instances,Nn=d.createSelector([ap],t=>Object.values(t)),np=t=>e=>e.teamMembershipReducer.instances[t],Rg=y(d.createSelector([Nn,(t,e)=>e],(t,e)=>{const i={};for(const a of t.filter(n=>n.team===e))i[a.user]=a;return i})),vg=y(d.createSelector([In,Nn,(t,e)=>e],(t,e,i)=>{const a=new Set(e.filter(n=>n.team===i).map(n=>n.user));return I(t.filter(n=>a.has(n.id)))})),Ge=P(t=>t.uuid),cp=Ge.getInitialState({}),Hn=d.createSlice({name:"teams",initialState:cp,extraReducers:t=>t.addMatcher(d.isAnyOf(g,O),e=>Object.assign(e,cp)),reducers:{initializeTeams:Ge.initialize,addTeam:Ge.addOne,addTeams:Ge.addMany,setTeam:Ge.setOne,setTeams:Ge.setMany,updateTeam:Ge.updateOne,updateTeams:Ge.updateMany,deleteTeam:Ge.deleteOne,deleteTeams:Ge.deleteMany}}),{initializeTeams:rp,addTeam:dp,addTeams:wg,setTeam:gt,setTeams:Mg,updateTeam:up,updateTeams:Eg,deleteTeam:Wn,deleteTeams:Vg}=Hn.actions,Yn=t=>t.teamReducer.instances,op=d.createSelector([Yn],t=>Object.values(t)),Kn=t=>e=>e.teamReducer.instances[t],jg=y(d.createSelector([Yn,(t,e)=>e],(t,e)=>{const i=[];for(const a of e){const n=t[a];n?i.push(n):console.warn("selectTeamsByIds: No team exists with the id",a)}return I(i)})),qg=y(d.createSelector([op,(t,e)=>e],(t,e)=>I(t.filter(i=>i.organization===e)))),lp=Hn.reducer,zg={version:0},hp=d.createSlice({name:"versioning",initialState:zg,reducers:{}}),mp=hp.reducer,Zn={outboxReducer:Am,fileReducer:eo,authReducer:Tu},Ug=d.combineReducers(Zn),pp={...Zn,[tt]:mp,categoryReducer:_u,assetReducer:rd,assetAttachmentReducer:Mc,assetStageCompletionReducer:hd,assetStageReducer:Sd,assetTypeReducer:yu,assetTypeAttachmentReducer:wd,issueReducer:Dl,issueAttachmentReducer:yl,issueTypeReducer:qh,issueTypeAttachmentReducer:Yl,organizationReducer:um,projectReducer:Ym,projectAttachmentReducer:Vm,projectAccessReducer:Im,organizationAccessReducer:sm,projectFileReducer:Lm,rehydratedReducer:Jm,formReducer:Ro,formRevisionReducer:Po,formRevisionAttachmentReducer:yo,formSubmissionAttachmentReducer:Do,formSubmissionReducer:No,formIdentifierReducer:no,formIdentifierValueReducer:oo,userReducer:Zh,emailDomainsReducer:Zu,documentsReducer:Gu,documentAttachmentReducer:Du,teamReducer:lp,agentsReducer:gc,issueCommentReducer:El,issueCommentAttachmentReducer:Rl,issueUpdateReducer:Nh,geoImageReducer:el,issueAssociationReducer:dl,issueTypeFieldsReducer:hh,issueTypeFieldValuesReducer:nh,issueTypeFieldsAttachmentReducer:th,issueTypeFieldValuesAttachmentReducer:Ih,issueTypeIdentifierReducer:Ph,issueTypeIdentifierValueReducer:vh,assetTypeFieldsReducer:Nd,assetTypeFieldValuesReducer:au,assetTypeFieldsAttachmentReducer:Dd,assetTypeFieldValuesAttachmentReducer:Xd,assetTypeIdentifierReducer:uu,assetTypeIdentifierValueReducer:mu,assetProcedureReducer:Or,assetProcedureInstanceReducer:gr,assetProcedureFieldsReducer:sr,assetProcedureFieldValuesReducer:Ar,assetProcedureFieldsAttachmentReducer:Zc,assetProcedureFieldValuesAttachmentReducer:ur,assetProcedureAttachmentReducer:Cc,assetProcedureStepFieldsAttachmentReducer:qr,assetProcedureStepFieldsReducer:Dr,assetProcedureStepFieldValuesAttachmentReducer:Nr,assetProcedureStepFieldValuesReducer:Xr,assetProcedureStepReducer:td,teamMembershipReducer:ip},Dg=d.combineReducers(pp);function Cg(t,e){return Ep.useMemo(t,e)}class kg{constructor(e){S(this,"operations",[]);S(this,"getData");this.getData=e}performOperations(e){let i=e;for(const a of this.operations)i=a(i);return i}filter(e,i){return this.operations.push(a=>a.filter(n=>n[e]===i)),this}exclude(e,i){return this.operations.push(a=>a.filter(n=>n[e]!==i)),this}orderBy(e){return this.operations.push(i=>[...i].sort((a,n)=>a[e]<=n[e]?1:-1)),this}reverse(){return this.operations.push(e=>[...e].reverse()),this}all(){return this.operations.push(e=>e),this}get(e,i){return d.createSelector([this.getData],a=>this.performOperations(a).find(n=>n[e]===i))}count(){return d.createSelector([this.getData],e=>this.performOperations(e).length)}first(){return d.createSelector([this.getData],e=>this.performOperations(e)[0])}last(){return d.createSelector([this.getData],e=>{const i=this.performOperations(e);return i[i.length-1]})}exists(){return d.createSelector([this.getData],e=>this.performOperations(e).length>0)}toSelector(){return d.createSelector([this.getData],e=>I(this.performOperations(e)))}}let Ap;function Bg(t){Ap=t}function bt(){return Ap}let fp;function $g(t){fp=t}function Gg(){return fp}const yp={};class Sp{constructor(e){S(this,"client");yp[this.constructor.name]=this,this.client=e}async enqueueRequest(e,i){return this.client.enqueueRequest(e,this.host,this.constructor.name,i)}async performPagination(e,i,a){const n=[];let c=await this.client.enqueueRequest(e,this.host,this.constructor.name,a);for(n.push(c.results);c.next;)c=await this.client.enqueueRequest(i(c.next),this.host,this.constructor.name,a),n.push(c.results);return n}dispatch(e){this.client.store.dispatch(e)}}const Ip=()=>bp.length-1,Tp=t=>(t[tt]={version:Ip()},t),gp=()=>Tp({}),Lg=t=>(t.outboxReducer&&(t.outboxReducer.deletedRequests=[]),t),Ng=t=>e=>{var i;return e===void 0&&(e={}),((i=e[tt])==null?void 0:i.version)===Ip()?e:t(e)},bp=[Tp,gp,gp,Lg],Hg=Object.fromEntries(bp.map((t,e)=>[e,Ng(t)]));let Jn=null;function Ye(){const t=bt();if(!t)return console.warn("Client store not set; cannot get outbox coordinator yet."),null;if(Jn)return Jn;const e=t.getState().offline.outbox,i=et._fromOutbox(e);return Jn=i,i}const Wg=t=>{if(t)throw t;const e=bt();e?e.dispatch({type:"rehydrated/setRehydrated",payload:!0}):console.error("Client store not set")},Fp=(t,e,i)=>{const a=Ye();return a?(a.addRequest(e),a.getQueue()):(console.warn("Outbox coordinator not set; cannot enqueue request yet."),[])},Pp=(t,e,i)=>{const a=Ye();if(!a)return console.warn("Outbox coordinator not set; cannot dequeue request yet."),[];const c=e.meta.offlineAction.payload.uuid;return a.remove(c),a.getQueue()};async function Yg(t,e){if(!e.payload)throw new Error("Received empty payload");return sb(e)}const Kg={...sc,effect:Yg,discard:Qn,returnPromises:!0,persistCallback:Wg,retry:ab,persistOptions:{storage:jp},queue:{...sc.queue,enqueue:Fp,dequeue:Pp,peek:(...t)=>ib(...t)}},Zg=qp(Hg,tt),Jg=d.compose(Vp.offline(Kg),Zg);function Xg(t){function e(i){return typeof i=="object"&&i!==null&&["ok","redirect","clientError","serverError","error"].every(n=>n in i)}if(e(t))return t;if(typeof t=="object"&&t!==null){const i=t;if(e(i.response))return i.response;if(i.response&&e(i.response.response))return i.response.response}}async function Xn(t,e,i){const a=yp[t.meta.offline.effect.serviceName];if(!a)throw new Error(`Service ${t.meta.offline.effect.serviceName} not found`);const n=a instanceof R;if(e.store.getState().outboxReducer.deletedRequests.includes(t.payload.uuid))throw new Error("Request was marked for deletion");n&&t.payload.checkAuth!==!1&&await a.auth.prepareAuth();const r={queryParams:"",isAuthNeeded:!0},u=t.meta.offline.effect,{payload:m,headers:o,method:h,queryParams:p,attachmentHash:A,isExternalUrl:f,isAuthNeeded:T,isResponseBlob:F}={...r,...u.request},_=u.request;let w=_.url;const z=A?await e.files.fetchCache(A):void 0;if(A&&!z)throw new Error(`Cannot upload file ${A} because it's not cached.`);!f&&!w.startsWith("http")&&(!w.startsWith("/")&&!w.startsWith("blob:")&&(w="/"+w),w=t.meta.offline.effect.BASE_URL+w);const Le=q=>{if(A){const Ne=_.s3url;if(!Ne)throw new Error(`No S3 URL for file ${A}`);if("warning"in Ne)throw new Error(`S3 URL warning for file ${A}`);if(!z)throw new Error(`No file for file ${A}`);const Ft=Ne.fields["x-amz-checksum-sha1"];if(!Ft)throw new Error(`No checksum for file ${A}`);return q.set("x-amz-checksum-sha1",Ft).field({...m,...Ne.fields}).attach("file",z)}return q.send(m)},PF={[l.GET]:()=>F?Ze.get(w.toString()).responseType("blob"):Ze.get(w.toString()),[l.POST]:()=>{const q=Ze.post(w.toString());return Le(q)},[l.PATCH]:()=>{const q=Ze.patch(w.toString());return Le(q)},[l.PUT]:()=>{const q=Ze.put(w.toString());return Le(q)},[l.DELETE]:()=>{const q=Ze.delete(w.toString());return Le(q)}}[h];let We=PF();if(i==null||i.addEventListener("abort",()=>{console.debug("aborting request:",_),We.abort()}),T&&n){const q=a.auth.getAuthHeader();We=We.set("Authorization",q)}o&&(We=We.set(o));try{return await We.query(p)}catch(q){const Ne=Xg(q),Ft=Ne==null?void 0:Ne.status;if(n&&Ft===401)return await a.auth.handleUnauthorized(We,Ne),We.query(p);throw new D({response:Ne,innerError:q,discard:_p.includes(Ft)})}}class Qg{constructor(e){S(this,"_all");S(this,"_previous");this._all=[e],this._previous=e,this.then=this.then.bind(this),this.compile=this.compile.bind(this)}then(e){return this._previous&&(this._previous.next=e),this._all.push(e),this._previous=e,{then:this.then,compile:this.compile}}compile(){return this._all}}class Op{constructor(){S(this,"next");this.next=null}then(e){return new Qg(this).then(e)}async run(e){if(this.next)return this.next.run(e);{if(console.debug("Middleware finished. Performing request:",e),!bt())throw new Error("Client store not set");const a=Gg();if(!a)throw new Error("Client SDK not set");return Xn(e,a)}}}class xg extends Op{async run(e){return super.run(e)}}class eb extends Op{async run(e){return super.run(e)}}const tb=new xg().then(new eb).compile();function sb(t){var e;return(e=tb[0])==null?void 0:e.run(t)}const _p=[400,409,403,404,405,500];function Qn(t,e,i=0){var o;if(console.debug("Considering discarding request due to error:",t,`(${typeof t})`,`
|
|
3
|
-
Action:`,
|
|
4
|
-
Retries:`,
|
|
5
|
-
Action:`,
|
|
6
|
-
`):c.map(r=>`${
|
|
7
|
-
`):`${
|
|
8
|
-
`)}catch(n){console.error("Failed to extract error message from response body",n)}}else typeof t.body=="string"&&(i=t.body);else t!=null&&t.text?i=t.text:e instanceof Error&&(i=e.message);return!i||i.length>nb?xe:i}class D extends Error{constructor(i){super(xe);S(this,"status");S(this,"response");S(this,"message");S(this,"options");const{response:a,innerError:n}=i;this.message=i.message??cb(a,n)??xe,this.status=(a==null?void 0:a.status)??0,this.response=a,i.discard=i.discard??!1,this.options=i}}class rb extends Sp{constructor(e){super(e)}}class R extends Sp{constructor(i,a){super(i);S(this,"auth");this.auth=a}}class db extends R{async startConversation(e,i){return this.enqueueRequest({description:"Start agent conversation",method:l.POST,url:"/agents/prompt/",payload:{prompt:e,active_project:i},blockers:["prompt"],blocks:["prompt"]}).then(a=>(this.dispatch(Sc(a)),a))}async continueConversation(e,i,a){return this.enqueueRequest({description:"Prompt agent",method:l.POST,url:"/agents/prompt/",payload:{prompt:e,active_project:a},blockers:["prompt"],blocks:["prompt"],queryParams:{conversation_id:i}}).then(n=>{this.dispatch(Tc(n))})}async fetchDetails(e){return this.enqueueRequest({description:"Get agent conversation",method:l.GET,url:`/agents/conversations/${e}/`,blockers:["conversation"],blocks:["conversation"]}).then(i=>{this.dispatch(Ic(i))})}async rate(e,i){return this.enqueueRequest({description:"Rate agent response",method:l.PUT,url:`/agents/responses/${e}/rate/`,payload:{rating:i},blockers:["rate"],blocks:["rate"]})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get agent conversation history",method:l.GET,url:"/agents/conversations/",queryParams:{project:e},blockers:["agent-conversations"],blocks:["agent-conversations"]},i);return this.dispatch(yc(a)),a}}const ub=5e4,E=1e3,ob="limit";class j extends R{getNumberOfAttachmentsWithSha1(e){const{issueAttachmentReducer:i,assetAttachmentReducer:a,assetTypeAttachmentReducer:n,documentAttachmentReducer:c,projectAttachmentReducer:r,formRevisionAttachmentReducer:u,formSubmissionAttachmentReducer:m,geoImageReducer:o,assetTypeFieldsAttachmentReducer:h,assetTypeFieldValuesAttachmentReducer:p,issueTypeFieldsAttachmentReducer:A,issueTypeFieldValuesAttachmentReducer:f}=this.client.store.getState();return[].concat(Object.values(i.instances),Object.values(a.instances),Object.values(n.instances),Object.values(c.instances),Object.values(r.instances),Object.values(u.instances),Object.values(m.instances),Object.values(o.instances),Object.values(h.instances),Object.values(p.instances),Object.values(A.instances),Object.values(f.instances)).filter(F=>F.file_sha1===e).length}processPresignedUrls(e){const i={};for(const[a,n]of Object.entries(e))i[a]=this.enqueueRequest({url:n.url,description:"Upload file to S3",method:l.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:a,blockers:[`s3-${n.fields.key}`],blocks:[a],s3url:n});return i}async getFilePayload(e){const i=await Xe(e),a={sha1:i,file_type:e.type,extension:e.name.split(".").pop(),size:e.size};return await this.client.files.addCache(e,i),a}}class He extends j{async _bulkAdd(e){var o;const{store:i}=this.client,a=(o=i.getState().userReducer.currentUser)==null?void 0:o.id,n=new Date().toISOString(),c=[],r=[],u={};for(const h of e){const{modelUuid:p,file:A}=h,f=await this.getFilePayload(A);f.sha1 in u||(u[f.sha1]=f);const T=this.buildOfflineAttachment({file:A,file_sha1:f.sha1,submitted_at:n,created_by:a,description:"",modelUuid:p});c.push(T),r.push(this.buildAttachmentPayload({uuid:T.uuid,file_name:T.file_name,file_sha1:T.file_sha1,file_extension:f.extension,description:T.description,modelUuid:p}))}this.dispatch(this.addAttachments(c));const m=this.enqueueRequest({description:`Add ${this.name}`,method:l.POST,url:`${this.url}/bulk/`,payload:{submitted_at:n,attachments:r,files:Object.values(u)},blocks:c.map(h=>h.uuid),blockers:c.map(h=>h.file_sha1)});return m.then(({attachments:h,presigned_urls:p})=>{this.dispatch(this.updateAttachments(h)),this.processPresignedUrls(p)}).catch(()=>{this.dispatch(this.removeAttachments(c.map(h=>h.uuid)))}),[c,m.then(({attachments:h})=>h)]}async _delete(e){const{store:i}=this.client,a=this.selectAttachment(e)(i.getState());if(!a)throw new Error(`Attempting to delete attachment with uuid ${e} that does not exist in the store`);this.dispatch(this.removeAttachment(a.uuid));const n=this.enqueueRequest({description:`Delete ${this.name}`,method:l.DELETE,url:`${this.url}/${e}/`,blockers:[e],blocks:[]});return n.then(()=>{this.getNumberOfAttachmentsWithSha1(a.file_sha1)===0&&this.client.files.removeCache(a.file_sha1)}).catch(()=>{this.dispatch(this.setAttachment(a))}),n}}class lb extends He{constructor(){super(...arguments);S(this,"name","Asset Attachment");S(this,"url","/asset-attachments");S(this,"initializeAttachments",us);S(this,"addAttachments",os);S(this,"updateAttachments",Pc);S(this,"removeAttachments",ls);S(this,"removeAttachment",Oc);S(this,"setAttachment",Fc);S(this,"selectAttachment",vc)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,asset:i.modelUuid})}buildAttachmentPayload(i){return{...i,asset:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.assetUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const c=(await this.performPagination({immediate:!0,description:"Get asset attachments",method:l.GET,url:`${this.url}/`,queryParams:{limit:E,paginate:!0,asset__project:i},blocks:[],blockers:[]},r=>({immediate:!0,description:"Get asset attachments",method:l.GET,url:r,blockers:[],blocks:[]}),a)).flat();return this.dispatch(us(c)),c}}class hb extends He{constructor(){super(...arguments);S(this,"name","Asset Procedure Attachment");S(this,"url","/asset-procedure-attachments");S(this,"addAttachments",jc);S(this,"updateAttachments",zc);S(this,"removeAttachments",Dc);S(this,"removeAttachment",Uc);S(this,"setAttachment",qc);S(this,"selectAttachment",$c)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,asset_procedure:i.modelUuid})}buildAttachmentPayload(i){return{...i,asset_procedure:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.assetProcedureUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=await this.enqueueRequest({immediate:!0,description:"Get asset procedure attachments",method:l.GET,url:`${this.url}/`,queryParams:{asset_procedure__organization:i},blocks:[],blockers:[]},a);return this.dispatch(Vc(n)),n}}class mb extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const o of e){const{fieldsRevisionUuid:h,fieldIdentifier:p,file:A}=o,f=await this.getFilePayload(A);f.sha1 in n||(n[f.sha1]=f);const T=b({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,fields_revision:h,submitted_at:i,field_identifier:p});c.push(T);const F={uuid:T.uuid,file_name:A.name,field_identifier:p,file_extension:f.extension,file_sha1:f.sha1,fields_revision:h};r.push(F)}this.dispatch(Nc(c));const u=this.enqueueRequest({description:"Add asset procedure fields attachments",method:l.POST,url:"/asset-procedure-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(o=>o.fields_revision),blocks:c.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(Hc(o.attachments))}).catch(()=>{this.dispatch(Wc(c.map(o=>o.uuid)))}),[c,u.then(({attachments:o})=>o)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset procedure fields attachments",method:l.GET,url:"/asset-procedure-fields-attachments/",queryParams:{fields_revision__asset_procedure__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Lc(a)),a}}class pb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(Qc(c));const r=this.enqueueRequest({description:"Add Asset Procedure Fields",method:l.POST,url:"/asset-procedure-fields/",payload:v(c),blockers:[c.asset_procedure],blocks:[c.uuid]});return r.then(m=>{this.dispatch(xc(m))}).catch(m=>{throw this.dispatch(er(c.uuid)),m}),[c,r]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get Asset Procedure Fields",method:l.GET,url:"/asset-procedure-fields/",queryParams:{asset_procedure__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Xc(a)),a}}function Ke(t,e){const i=[];let a=0;const n=t.length;for(;a<n;)i.push(t.slice(a,a+=e));return i}class Ab extends j{async bulkAdd(e,i){var o;const a=new Date().toISOString(),n=(o=this.client.store.getState().userReducer.currentUser)==null?void 0:o.id,c=Ke(e,i??e.length),r=[],u=[];for(const h of c){const p={},A=[];for(const f of h){const{fieldValuesUuid:T,fieldIdentifier:F,file:_}=f,w=await this.getFilePayload(_);w.sha1 in p||(p[w.sha1]=w);const z=b({file:URL.createObjectURL(_),file_type:_.type,file_name:_.name,file_sha1:w.sha1,created_by:n,field_values:T,submitted_at:a,field_identifier:F});r.push(z);const Le={uuid:z.uuid,file_name:_.name,file_sha1:w.sha1,file_extension:w.extension,field_identifier:F,field_values:T};A.push(Le)}u.push({submitted_at:a,attachments:A,files:Object.values(p)})}this.dispatch(Ot(r));const m=u.map(h=>this.enqueueRequest({description:"Add asset procedure field values attachments",method:l.POST,url:"/asset-procedure-field-values-attachments/bulk/",payload:h,blockers:h.attachments.map(p=>p.field_values),blocks:h.attachments.map(p=>p.uuid)}));return Promise.all(m).then(h=>{for(const A of h)this.processPresignedUrls(A.presigned_urls);const p=h.flatMap(A=>A.attachments);this.dispatch(nr(p))}).catch(h=>{throw this.dispatch(_t(r.map(p=>p.uuid))),h}),[r,m.map(h=>h.then(({attachments:p})=>p))]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=rr(e)(a);this.dispatch(_t(e));try{await this.enqueueRequest({description:"Delete asset procedure field values attachments",method:l.DELETE,url:"/asset-procedure-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(Ot(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset procedure field values attachments",method:l.GET,url:"/asset-procedure-field-values-attachments/",queryParams:{limit:E,paginate:!0,field_values__asset_procedure_instance__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset procedure field values attachments",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(ar(n)),n}}class fb extends R{add(e){var r;const{store:i}=this.client,a=i.getState(),n=b({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add asset procedure field values",method:l.POST,url:"/asset-procedure-field-values/",payload:v(n),blockers:[e.asset,e.fields_revision,e.asset_procedure_instance],blocks:[n.uuid]});return this.dispatch(Is(n)),c.then(u=>(this.dispatch(st(u)),u)).catch(()=>{this.dispatch(Ts(n.uuid))}),[n,c]}bulkAdd(e,i){var m;const a=new Date().toISOString(),n=[],c=Ke(e.payloads,i??e.payloads.length),r=[];for(const o of c){const h=[];for(const p of o){const A=b({...p,values:p.values,created_by:(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,submitted_at:a});n.push(A),h.push({uuid:A.uuid,asset:p.asset,fields_revision:p.fields_revision,asset_procedure_instance:p.asset_procedure_instance,published_at:p.published_at,values:A.values})}r.push({submitted_at:a,values:e.values,field_values:h})}this.dispatch(hr(n));const u=[];for(const o of r){const h=o.field_values.map(F=>F.asset),p=o.field_values.map(F=>F.fields_revision),A=o.field_values.map(F=>F.asset_procedure_instance),f=o.field_values.map(F=>F.uuid),T=this.enqueueRequest({description:"Bulk add asset procedure field values",method:l.POST,url:"/asset-procedure-field-values/bulk/",payload:o,blockers:[...h,...p,...A],blocks:f});u.push(T)}return Promise.all(u).then(o=>{this.dispatch(mr(o.flat()))}).catch(()=>{this.dispatch(pr(n.map(o=>o.uuid)))}),[n,u]}update(e){const{store:i}=this.client,a=i.getState(),n=bs(e.uuid)(a);if(!n)throw new Error(`Expected AssetProcedureFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(st(c));const r=this.enqueueRequest({description:"Update asset procedure field values",method:l.PATCH,url:`/asset-procedure-field-values/${e.uuid}/`,payload:e,blockers:[c.fields_revision,c.asset,c.asset_procedure_instance],blocks:[c.uuid]});return r.then(u=>{this.dispatch(st(u))}).catch(()=>{this.dispatch(st(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=bs(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=dr(e)(a);this.dispatch(Ts(e)),this.dispatch(_t(c.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset procedure field values",method:l.DELETE,url:`/asset-procedure-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(Is(n)),this.dispatch(Ot(c)),r}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset procedure field values",method:l.GET,url:"/asset-procedure-field-values/",queryParams:{limit:E,paginate:!0,asset_procedure_instance__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset procedure field values",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(lr(n)),n}}class yb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(Ps(c));const r=this.enqueueRequest({description:"Create asset procedure instance",method:l.POST,url:"/asset-procedure-instances/",payload:v(c),blockers:[e.asset_procedure,e.asset_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(it(m))}).catch(()=>{this.dispatch(Os(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=vs(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset procedure instance with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(it(n));const c=this.enqueueRequest({description:"Update asset procedure instance",method:l.PATCH,url:`/asset-procedure-instances/${e.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(it(r))}).catch(()=>{this.dispatch(it(a))}),[n,c]}async remove(e){const{store:i}=this.client,a=i.getState(),n=vs(e)(a);if(!n)throw new Error(`Expected asset procedure instance with uuid ${e} to exist`);return this.dispatch(Os(e)),this.enqueueRequest({description:"Delete asset procedure instance",method:l.DELETE,url:`/asset-procedure-instances/${e}/`,blockers:[e],blocks:[]}).catch(c=>{throw this.dispatch(Ps(n)),c})}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset procedure instances",method:l.GET,url:"/asset-procedure-instances/",queryParams:{limit:E,paginate:!0,project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset procedure instances",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Sr(n)),n}}class Sb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(Ms(c));const r=this.enqueueRequest({description:"Create asset procedure",method:l.POST,url:"/asset-procedures/",payload:v(c),blockers:[],blocks:[c.uuid]});return r.then(m=>{this.dispatch(at(m))}).catch(()=>{this.dispatch(Es(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=js(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset procedure with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(at(n));const c=this.enqueueRequest({description:"Update asset procedure",method:l.PATCH,url:`/asset-procedures/${e.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(at(r))}).catch(()=>{this.dispatch(at(a))}),[n,c]}async remove(e){const{store:i}=this.client,a=i.getState(),n=js(e)(a);if(!n)throw new Error(`Expected asset procedure with uuid ${e} to exist`);const c=br(e)(a);return this.dispatch(Es(e)),this.dispatch(Tr(c.map(r=>r.uuid))),this.enqueueRequest({description:"Delete asset procedure",method:l.DELETE,url:`/asset-procedures/${e}/`,blockers:[e],blocks:[]}).catch(r=>{throw this.dispatch(Ms(n)),this.dispatch(Ir(c)),r})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset procedures",method:l.GET,url:"/asset-procedures/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(Pr(a)),a}}class Ib extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const o of e){const{fieldsRevisionUuid:h,fieldIdentifier:p,file:A}=o,f=await this.getFilePayload(A);f.sha1 in n||(n[f.sha1]=f);const T=b({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,fields_revision:h,submitted_at:i,field_identifier:p});c.push(T);const F={uuid:T.uuid,file_name:A.name,field_identifier:p,file_extension:f.extension,file_sha1:f.sha1,fields_revision:h};r.push(F)}this.dispatch(wr(c));const u=this.enqueueRequest({description:"Add asset procedure step fields attachments",method:l.POST,url:"/asset-procedure-step-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(o=>o.fields_revision),blocks:c.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(Mr(o.attachments))}).catch(()=>{this.dispatch(Er(c.map(o=>o.uuid)))}),[c,u.then(({attachments:o})=>o)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset procedure step fields attachments",method:l.GET,url:"/asset-procedure-step-fields-attachments/",queryParams:{fields_revision__asset_procedure_step__organization:e},blockers:[],blocks:[]},i);return this.dispatch(vr(a)),a}}class Tb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(Us(c));const r=this.enqueueRequest({description:"Add Asset Procedure Step Fields",method:l.POST,url:"/asset-procedure-step-fields/",payload:v(c),blockers:[c.asset_procedure_step],blocks:[c.uuid]});return r.then(m=>{this.dispatch(nt(m))}).catch(m=>{throw this.dispatch(Ds(c.uuid)),m}),[c,r]}update(e){const{store:i}=this.client,a=i.getState().assetProcedureStepFieldsReducer.instances[e.uuid];if(!a)throw new Error(`AssetProcedureStepFields with uuid ${e.uuid} not found`);const n={...a,...e};this.dispatch(nt(n));const c=this.enqueueRequest({description:"Update Asset Procedure Step Fields",method:l.PATCH,url:`/asset-procedure-step-fields/${a.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(nt(r))}).catch(r=>{throw this.dispatch(nt(a)),r}),[n,c]}delete(e){const{store:i}=this.client,a=i.getState().assetProcedureStepFieldsReducer.instances[e];if(!a)throw new Error(`AssetProcedureStepFields with uuid ${e} not found`);this.dispatch(Ds(e));const n=this.enqueueRequest({description:"Delete Asset Procedure Step Fields",method:l.DELETE,url:`/asset-procedure-step-fields/${e}/`,blockers:[e],blocks:[e]});return n.catch(c=>{throw this.dispatch(Us(a)),c}),n}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get Asset Procedure Step Fields",method:l.GET,url:"/asset-procedure-step-fields/",queryParams:{asset_procedure_step__asset_procedure__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Ur(a)),a}}class gb extends j{async bulkAdd(e,i){var o;const a=new Date().toISOString(),n=(o=this.client.store.getState().userReducer.currentUser)==null?void 0:o.id,c=Ke(e,i??e.length),r=[],u=[];for(const h of c){const p={},A=[];for(const f of h){const{fieldValuesUuid:T,fieldIdentifier:F,file:_}=f,w=await this.getFilePayload(_);w.sha1 in p||(p[w.sha1]=w);const z=b({file:URL.createObjectURL(_),file_type:_.type,file_name:_.name,file_sha1:w.sha1,created_by:n,field_values:T,submitted_at:a,field_identifier:F});r.push(z);const Le={uuid:z.uuid,file_name:_.name,file_sha1:w.sha1,file_extension:w.extension,field_identifier:F,field_values:T};A.push(Le)}u.push({submitted_at:a,attachments:A,files:Object.values(p)})}this.dispatch(Rt(r));const m=u.map(h=>this.enqueueRequest({description:"Add asset procedure step field values attachments",method:l.POST,url:"/asset-procedure-step-field-values-attachments/bulk/",payload:h,blockers:h.attachments.map(p=>p.field_values),blocks:h.attachments.map(p=>p.uuid)}));return Promise.all(m).then(h=>{for(const A of h)this.processPresignedUrls(A.presigned_urls);const p=h.flatMap(A=>A.attachments);this.dispatch(Br(p))}).catch(h=>{throw this.dispatch(vt(r.map(p=>p.uuid))),h}),[r,m.map(h=>h.then(({attachments:p})=>p))]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=Gr(e)(a);this.dispatch(vt(e));try{await this.enqueueRequest({description:"Delete asset procedure step field values attachments",method:l.DELETE,url:"/asset-procedure-step-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(Rt(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset procedure step field values attachments",method:l.GET,url:"/asset-procedure-step-field-values-attachments/",queryParams:{limit:E,paginate:!0,field_values__asset_procedure_instance__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset procedure step field values attachments",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(kr(n)),n}}class bb extends R{add(e){var r;const{store:i}=this.client,a=i.getState(),n=b({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add asset procedure step field values",method:l.POST,url:"/asset-procedure-step-field-values/",payload:v(n),blockers:[e.asset,e.fields_revision,e.asset_procedure_instance],blocks:[n.uuid]});return this.dispatch(Ls(n)),c.then(u=>(this.dispatch(ct(u)),u)).catch(()=>{this.dispatch(Ns(n.uuid))}),[n,c]}bulkAdd(e,i){var m;const a=new Date().toISOString(),n=[],c=Ke(e.payloads,i??e.payloads.length),r=[];for(const o of c){const h=[];for(const p of o){const A=b({...p,values:p.values,created_by:(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,submitted_at:a});n.push(A),h.push({uuid:A.uuid,asset:p.asset,fields_revision:p.fields_revision,asset_procedure_instance:p.asset_procedure_instance,asset_procedure_step:p.asset_procedure_step,published_at:p.published_at,values:A.values})}r.push({submitted_at:a,values:e.values,field_values:h})}this.dispatch(Yr(n));const u=[];for(const o of r){const h=o.field_values.map(F=>F.asset),p=o.field_values.map(F=>F.fields_revision),A=o.field_values.map(F=>F.asset_procedure_instance),f=o.field_values.map(F=>F.uuid),T=this.enqueueRequest({description:"Bulk add asset procedure step field values",method:l.POST,url:"/asset-procedure-step-field-values/bulk/",payload:o,blockers:[...h,...p,...A],blocks:f});u.push(T)}return Promise.all(u).then(o=>{this.dispatch(Kr(o.flat()))}).catch(()=>{this.dispatch(Zr(n.map(o=>o.uuid)))}),[n,u]}update(e){const{store:i}=this.client,a=i.getState(),n=Hs(e.uuid)(a);if(!n)throw new Error(`Expected AssetProcedureStepFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(ct(c));const r=this.enqueueRequest({description:"Update asset procedure step field values",method:l.PATCH,url:`/asset-procedure-step-field-values/${e.uuid}/`,payload:e,blockers:[c.fields_revision,c.asset,c.asset_procedure_instance],blocks:[c.uuid]});return r.then(u=>{this.dispatch(ct(u))}).catch(()=>{this.dispatch(ct(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Hs(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=Lr(e)(a);this.dispatch(Ns(e)),this.dispatch(vt(c.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset procedure step field values",method:l.DELETE,url:`/asset-procedure-step-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(Ls(n)),this.dispatch(Rt(c)),r}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset procedure step field values",method:l.GET,url:"/asset-procedure-step-field-values/",queryParams:{limit:E,paginate:!0,asset_procedure_instance__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset procedure step field values",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Wr(n)),n}}class Fb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(Ys(c));const r=this.enqueueRequest({description:"Create asset procedure step",method:l.POST,url:"/asset-procedure-steps/",payload:v(c),blockers:[c.asset_procedure],blocks:[c.uuid]});return r.then(m=>{this.dispatch(Mt(m))}).catch(()=>{this.dispatch(Ks(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=Zs(e.uuid)(i.getState());if(!a)throw new Error(`No asset procedure step with uuid ${e.uuid} found in the store`);const n={...a,...e};this.dispatch(Mt(n));const c=this.enqueueRequest({description:"Update asset procedure step",method:l.PATCH,url:`/asset-procedure-steps/${a.uuid}/`,payload:{name:e.name,description:e.description,priority:e.order,color:e.color},blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(Mt(r))}).catch(()=>{this.dispatch(ed(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Zs(e)(a);if(!n)throw new Error(`No asset procedure step with uuid ${e} found in the store`);return this.dispatch(Ks(e)),this.enqueueRequest({description:"Delete asset stage",method:l.DELETE,url:`/asset-stages/${e}/`,blockers:[e],blocks:[]}).catch(c=>{throw this.dispatch(Ys(n)),c})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset procedure steps",method:l.GET,url:"/asset-procedure-steps/",queryParams:{asset_procedure__organization:e},blockers:[],blocks:[]},i);return this.dispatch(xr(a)),a}}class Pb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(Xs(c));const r=this.enqueueRequest({description:"Create asset",method:l.POST,url:"/assets/",payload:v(c),blockers:[c.asset_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(rt(m))}).catch(()=>{this.dispatch(Qs(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=si(e.uuid)(i.getState());if(!a)throw new Error(`No asset with uuid ${e.uuid} found in the store`);const n={...a,...e};this.dispatch(rt(n));const c=this.enqueueRequest({description:"Edit asset",method:l.PATCH,url:`/assets/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(rt(r))}).catch(()=>{this.dispatch(rt(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=si(e)(a);if(!n)throw new Error(`No asset with uuid ${e} found in the store`);const c=wc(e)(a),r=Lo(e)(a),u=rl(e)(a);if(this.dispatch(Qs(e)),c.length>0){const m=c.map(({uuid:o})=>o);this.dispatch(ls(m))}if(r.length>0){const m=r.map(({uuid:o})=>o);this.dispatch(Nt(m))}if(u.length>0){const m=u.map(({uuid:o})=>o);this.dispatch(va(m))}return this.enqueueRequest({description:"Delete asset",method:l.DELETE,url:`/assets/${e}/`,blockers:[e],blocks:[]}).catch(m=>{throw this.dispatch(Xs(n)),this.dispatch(os(c)),this.dispatch(Lt(r)),this.dispatch(_a(u)),m})}bulkAdd(e,i,a,n){const c=new Date().toISOString(),r=Je.v4(),u=Ke(e,n).map(h=>{const p=h.map(A=>b(A));return{batchId:Je.v4(),payload:{transaction_id:r,submitted_at:c,asset_type:i,project:a,assets:p}}}),m=[];let o=null;for(const h of u){const{batchId:p,payload:A}=h,f=A.assets.map(w=>w.uuid),T=[i];o&&T.push(o);const F=f;F.push(p);const _=this.enqueueRequest({description:"Batch create assets",method:l.POST,url:"/assets/bulk/",payload:A,blockers:T,blocks:F});o=h.batchId,m.push(_)}return Promise.all(m).then(h=>{const p=h.flat();this.dispatch(Vt(p))}),m}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=cd(e)(a);this.dispatch(xs(e));try{await this.enqueueRequest({description:"Bulk delete assets",method:l.DELETE,url:"/assets/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(Vt(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get assets",method:l.GET,url:"/assets/",queryParams:{limit:E,paginate:!0,project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get assets",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(ad(n)),n}}class Ob extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(ai(c));const r=this.enqueueRequest({description:"Add asset stage completion",method:l.POST,url:"/asset-stage-completions/",payload:v(c),blockers:[e.asset,e.stage],blocks:[c.uuid]});return r.then(m=>{this.dispatch(od(m))}).catch(()=>{this.dispatch(ci(c.uuid))}),[c,r]}delete(e){const{store:i}=this.client,a=md(e)(i.getState());if(!a)throw new Error(`Expected asset stage completion with uuid ${e} to exist`);this.dispatch(ci(e));const n=this.enqueueRequest({description:"Delete asset stage completion",method:l.DELETE,url:`/asset-stage-completions/${e}/`,blockers:[e],blocks:[]});return n.catch(()=>{this.dispatch(ai(a))}),n}bulkAdd(e){var o;const{store:i}=this.client,a=new Date().toISOString(),n=(o=i.getState().userReducer.currentUser)==null?void 0:o.id,c=e.map(h=>b(h)),r=c.map(h=>({...h,created_by:n,submitted_at:a})),u=r.map(({uuid:h})=>h);this.dispatch(ni(r));const m=this.enqueueRequest({description:"Bulk create asset stage completions",method:l.POST,url:"/asset-stage-completions/bulk/",payload:{submitted_at:a,completions:c},blockers:[...e.map(h=>h.asset_procedure_instance),...e.map(h=>h.stage),...e.map(h=>h.asset)],blocks:u});return m.then(h=>{this.dispatch(ld(h))}).catch(()=>{this.dispatch(ri(u))}),[r,m]}bulkDelete(e){const{store:i}=this.client,a=pd(e)(i.getState());this.dispatch(ri(e));const n=this.enqueueRequest({description:"Deleting asset stage completions",method:l.DELETE,url:"/asset-stage-completions/bulk/",payload:{uuids:e},blockers:e,blocks:[]});return n.catch(()=>{this.dispatch(ni(a))}),n}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset stage completions",method:l.GET,url:"/asset-stage-completions/",queryParams:{limit:E,paginate:!0,asset_procedure_instance__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset stage completions",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(ud(n)),n}}class _b extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(oi(c));const r=this.enqueueRequest({description:"Create asset",method:l.POST,url:"/asset-stages/",payload:v(c),blockers:[c.asset_procedure],blocks:[c.uuid]});return r.then(m=>{this.dispatch(jt(m))}).catch(()=>{this.dispatch(li(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=hi(e.uuid)(i.getState());if(!a)throw new Error(`No asset stage with uuid ${e.uuid} found in the store`);const n={...a,...e};this.dispatch(jt(n));const c=this.enqueueRequest({description:"Update asset stage",method:l.PATCH,url:`/asset-stages/${a.uuid}/`,payload:e,blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(jt(r))}).catch(()=>{this.dispatch(yd(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=hi(e)(a);if(!n)throw new Error(`No asset stage with uuid ${e} found in the store`);return this.dispatch(li(e)),this.enqueueRequest({description:"Delete asset stage",method:l.DELETE,url:`/asset-stages/${e}/`,blockers:[e],blocks:[]}).catch(c=>{throw this.dispatch(oi(n)),c})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset stages",method:l.GET,url:"/asset-stages/",queryParams:{asset_procedure__organization:e},blockers:[],blocks:[]},i);return this.dispatch(fd(a)),a}}class Rb extends He{constructor(){super(...arguments);S(this,"name","Asset Type Attachment");S(this,"url","/asset-type-attachments");S(this,"addAttachments",pi);S(this,"updateAttachments",Fd);S(this,"removeAttachments",Ai);S(this,"removeAttachment",Pd);S(this,"setAttachment",bd);S(this,"selectAttachment",Rd)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,asset_type:i.modelUuid})}buildAttachmentPayload(i){return{...i,asset_type:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.assetTypeUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=await this.enqueueRequest({immediate:!0,description:"Get asset type attachments",method:l.GET,url:`${this.url}/`,queryParams:{asset_type__organization:i},blocks:[],blockers:[]},a);return this.dispatch(gd(n)),n}}class vb extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const o of e){const{fieldsRevisionUuid:h,fieldIdentifier:p,file:A}=o,f=await this.getFilePayload(A);f.sha1 in n||(n[f.sha1]=f);const T=b({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,fields_revision:h,submitted_at:i,field_identifier:p});c.push(T);const F={uuid:T.uuid,file_name:A.name,field_identifier:p,file_extension:f.extension,file_sha1:f.sha1,fields_revision:h};r.push(F)}this.dispatch(Vd(c));const u=this.enqueueRequest({description:"Add asset type fields attachments",method:l.POST,url:"/asset-type-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(o=>o.fields_revision),blocks:c.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(jd(o.attachments))}).catch(()=>{this.dispatch(qd(c.map(o=>o.uuid)))}),[c,u.then(({attachments:o})=>o)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset type fields attachments",method:l.GET,url:"/asset-type-fields-attachments/",queryParams:{fields_revision__asset_type__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(Ed(a)),a}}class wb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(Bd(c));const r=this.enqueueRequest({description:"Add Asset Type Fields",method:l.POST,url:"/asset-type-fields/",payload:v(c),blockers:[c.asset_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch($d(m))}).catch(m=>{throw this.dispatch(Gd(c.uuid)),m}),[c,r]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get Asset Type Fields",method:l.GET,url:"/asset-type-fields/",queryParams:{asset_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(kd(a)),a}}class Mb extends j{async bulkAdd(e,i){var o;const a=new Date().toISOString(),n=(o=this.client.store.getState().userReducer.currentUser)==null?void 0:o.id,c=Ke(e,i??e.length),r=[],u=[];for(const h of c){const p={},A=[];for(const f of h){const{fieldValuesUuid:T,fieldIdentifier:F,file:_}=f,w=await this.getFilePayload(_);w.sha1 in p||(p[w.sha1]=w);const z=b({file:URL.createObjectURL(_),file_type:_.type,file_name:_.name,file_sha1:w.sha1,created_by:n,field_values:T,submitted_at:a,field_identifier:F});r.push(z);const Le={uuid:z.uuid,file_name:_.name,file_sha1:w.sha1,file_extension:w.extension,field_identifier:F,field_values:T};A.push(Le)}u.push({submitted_at:a,attachments:A,files:Object.values(p)})}this.dispatch(Ut(r));const m=u.map(h=>this.enqueueRequest({description:"Add asset type field values attachments",method:l.POST,url:"/asset-type-field-values-attachments/bulk/",payload:h,blockers:h.attachments.map(p=>p.field_values),blocks:h.attachments.map(p=>p.uuid)}));return Promise.all(m).then(h=>{for(const A of h)this.processPresignedUrls(A.presigned_urls);const p=h.flatMap(A=>A.attachments);this.dispatch(Yd(p))}).catch(h=>{throw this.dispatch(Dt(r.map(p=>p.uuid))),h}),[r,m.map(h=>h.then(({attachments:p})=>p))]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=Zd(e)(a);this.dispatch(Dt(e));try{await this.enqueueRequest({description:"Delete asset type field values attachments",method:l.DELETE,url:"/asset-type-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(Ut(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset type field values attachments",method:l.GET,url:"/asset-type-field-values-attachments/",queryParams:{limit:E,paginate:!0,field_values__asset__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset type field values attachments",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Wd(n)),n}}class Eb extends R{add(e){var r;const{store:i}=this.client,a=i.getState(),n=b({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add asset type field values",method:l.POST,url:"/asset-type-field-values/",payload:v(n),blockers:[e.asset,e.fields_revision],blocks:[n.uuid]});return this.dispatch(gi(n)),c.then(u=>(this.dispatch(dt(u)),u)).catch(()=>{this.dispatch(bi(n.uuid))}),[n,c]}bulkAdd(e,i){var m;const a=new Date().toISOString(),n=[],c=Ke(e.payloads,i??e.payloads.length),r=[];for(const o of c){const h=[];for(const p of o){const A=b({...p,values:p.values,created_by:(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,submitted_at:a});n.push(A),h.push({uuid:A.uuid,asset:p.asset,fields_revision:p.fields_revision,published_at:p.published_at,values:A.values})}r.push({submitted_at:a,values:e.values,field_values:h})}this.dispatch(eu(n));const u=[];for(const o of r){const h=o.field_values.map(T=>T.asset),p=o.field_values.map(T=>T.fields_revision),A=o.field_values.map(T=>T.uuid),f=this.enqueueRequest({description:"Bulk add asset type field values",method:l.POST,url:"/asset-type-field-values/bulk/",payload:o,blockers:[...h,...p],blocks:A});u.push(f)}return Promise.all(u).then(o=>{this.dispatch(tu(o.flat()))}).catch(()=>{this.dispatch(su(n.map(o=>o.uuid)))}),[n,u]}update(e){const{store:i}=this.client,a=i.getState(),n=Pi(e.uuid)(a);if(!n)throw new Error(`Expected AssetTypeFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(dt(c));const r=this.enqueueRequest({description:"Delete asset type field values",method:l.PATCH,url:`/asset-type-field-values/${e.uuid}/`,payload:e,blockers:[c.uuid,c.fields_revision,c.asset],blocks:[c.uuid]});return r.then(u=>{this.dispatch(dt(u))}).catch(()=>{this.dispatch(dt(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Pi(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=Jd(e)(a);this.dispatch(bi(e)),this.dispatch(Dt(c.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete asset type field values",method:l.DELETE,url:`/asset-type-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(gi(n)),this.dispatch(Ut(c)),r}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset type field values",method:l.GET,url:"/asset-type-field-values/",queryParams:{limit:E,paginate:!0,asset__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset type field values",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(xd(n)),n}}class Vb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(_i(c));const r=this.enqueueRequest({description:"Create asset type identifier",method:l.POST,url:"/asset-type-identifiers/",payload:v(c),blockers:[c.asset_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(ut(m))}).catch(()=>{this.dispatch(Ri(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=vi(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset type identifier with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(ut(n));const c=this.enqueueRequest({description:"Update asset type identifier",method:l.PATCH,url:`/asset-type-identifiers/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(ut(r))}).catch(()=>{this.dispatch(ut(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=vi(e)(a);if(!n)throw new Error(`Expected asset type identifier with uuid ${e} to exist`);this.dispatch(Ri(e));try{return await this.enqueueRequest({description:"Delete asset type identifier",method:l.DELETE,url:`/asset-type-identifiers/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(_i(n)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({description:"Get asset type identifiers",method:l.GET,url:"/asset-type-identifiers/",queryParams:{asset_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(cu(a)),a}}class jb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(Mi(c));const r=this.enqueueRequest({description:"Create asset type identifier value",method:l.POST,url:"/asset-type-identifier-values/",payload:v(c),blockers:[e.asset,e.asset_type_identifier],blocks:[c.uuid]});return r.then(m=>{this.dispatch(ot(m))}).catch(()=>{this.dispatch(Ei(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=ji(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset type identifier value with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(ot(n));const c=this.enqueueRequest({description:"Update asset type identifier value",method:l.PATCH,url:`/asset-type-identifier-values/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(ot(r))}).catch(()=>{this.dispatch(ot(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=ji(e)(a);if(!n)throw new Error(`Expected asset type identifier value with uuid ${e} to exist`);this.dispatch(Ei(e));try{return await this.enqueueRequest({description:"Delete asset type identifier value",method:l.DELETE,url:`/asset-type-identifier-values/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(Mi(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get asset type identifier values",method:l.GET,url:"/asset-type-identifier-values/",queryParams:{limit:E,paginate:!0,asset__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get asset type identifier values",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(lu(n)),n}}class qb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(zi(c));const r=this.enqueueRequest({description:"Create asset type",method:l.POST,url:"/asset-types/",payload:v(c),blockers:[],blocks:[c.uuid]});return r.then(m=>{this.dispatch(lt(m))}).catch(()=>{this.dispatch(Ui(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=Ci(e.uuid)(i.getState());if(!a)throw new Error(`Expected asset type with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(lt(n));const c=this.enqueueRequest({description:"Update asset type",method:l.PATCH,url:`/asset-types/${e.uuid}/`,payload:{icon:e.icon,color:e.color,name:e.name,description:e.description},blockers:[a.uuid],blocks:[a.uuid]});return c.then(r=>{this.dispatch(lt(r))}).catch(()=>{this.dispatch(lt(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Ci(e)(a);if(!n)throw new Error(`Expected asset type with uuid ${e} to exist`);const c=ti(e)(a),r=vd(e)(a);return this.dispatch(Ui(e)),this.dispatch(xs(c.map(u=>u.uuid))),this.dispatch(Ai(r.map(({uuid:u})=>u))),this.enqueueRequest({description:"Delete asset type",method:l.DELETE,url:`/asset-types/${e}/`,blockers:[e],blocks:[]}).catch(u=>{throw this.dispatch(zi(n)),this.dispatch(Vt(c)),this.dispatch(pi(r)),u})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get asset types",method:l.GET,url:"/asset-types/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(Au(a)),a}}class zb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(Bi(c));const r=this.enqueueRequest({description:"Create Category",method:l.POST,url:"/categories/",payload:v(c),blockers:[e.project],blocks:[c.uuid]});return[c,r]}update(e){const i=this.client.store.getState(),a=Gi(e.uuid)(i);if(!a)throw new Error(`Expected an existing category with uuid ${e.uuid}`);const n={...a,...e};this.dispatch(Fu(n));const c=this.enqueueRequest({description:"Edit Category",method:l.PATCH,url:`/categories/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return[n,c]}remove(e){const{store:i}=this.client,a=Gi(e)(i.getState());if(!a)throw new Error(`No category with uuid ${e} found in the store`);this.dispatch(Pu(e));const n=this.enqueueRequest({description:"Delete Category",method:l.DELETE,url:`/categories/${a.uuid}/`,blockers:[a.uuid],blocks:[]});return n.catch(()=>{this.dispatch(Bi(a))}),n}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get categories",method:l.GET,url:"/categories/",queryParams:{project__organization:e},blocks:[],blockers:[]},i);return this.dispatch(bu(a)),a}}class Ub extends He{constructor(){super(...arguments);S(this,"name","Document Attachment");S(this,"url","/document-attachments");S(this,"addAttachments",wu);S(this,"updateAttachments",Eu);S(this,"removeAttachments",ju);S(this,"removeAttachment",Vu);S(this,"setAttachment",Mu);S(this,"selectAttachment",Uu)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,document:i.modelUuid})}buildAttachmentPayload(i){return{...i,document:i.modelUuid}}async bulkAdd(i){var p;const{store:a}=this.client,n=(p=a.getState().userReducer.currentUser)==null?void 0:p.id,c=new Date().toISOString(),r=[],u=[],m={},o={};for(const A of i){const{documentUuid:f,file:T}=A,F=await this.getFilePayload(T);F.sha1 in m||(m[F.sha1]=F,o[F.sha1]=[]);const _=this.buildOfflineAttachment({file:T,file_sha1:F.sha1,submitted_at:c,created_by:n,description:"",modelUuid:f});r.push(_),u.push({uuid:_.uuid,file_name:_.file_name,file_sha1:_.file_sha1,file_extension:F.extension,description:_.description,document:f}),o[F.sha1].push(_.uuid)}this.dispatch(this.addAttachments(r));const h=this.enqueueRequest({description:"Attach files to document",method:l.POST,url:"/document-attachments/bulk/",payload:{submitted_at:c,attachments:u,files:Object.values(m)},blocks:r.map(A=>A.uuid),blockers:r.map(A=>A.file_sha1)});return h.then(({attachments:A,presigned_urls:f})=>{this.dispatch(this.updateAttachments(A));const T=this.processPresignedUrls(f);for(const[F,_]of Object.entries(T))_.then(()=>{const w=o[F];for(const z of w)this.makeReadable(z)})}).catch(()=>{this.dispatch(this.removeAttachments(r.map(A=>A.uuid)))}),[r,h.then(({attachments:A})=>A)]}async delete(i){return this._delete(i)}makeReadable(i){this.enqueueRequest({description:"Add attachment to AI assistant",method:l.PATCH,url:`/document-attachments/${i}/`,payload:{readable_to_assistant:!0},blockers:["index-document-attachment",i],blocks:["index-document-attachment"]})}async refreshStore(i,a){const n=await this.enqueueRequest({immediate:!0,description:"Get document attachments",method:l.GET,url:"/document-attachments/",queryParams:{document__project__organization:i},blocks:[],blockers:[]},a),c=await this.enqueueRequest({immediate:!0,description:"Get document attachments",method:l.GET,url:"/document-attachments/",queryParams:{document__organization:i},blocks:[],blockers:[]},a),r=[...n,...c];return this.dispatch(vu(r)),r}}class Db extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(Bu([c]));const r=this.enqueueRequest({description:"Create Document",method:l.POST,url:"/documents/",payload:v(c),queryParams:{parent_document:c.parent_document??void 0},blockers:c.parent_document?[c.parent_document]:[],blocks:[c.uuid]});return r.catch(()=>{this.dispatch(Hi([c.uuid]))}),[c,r]}update(e){const{store:i}=this.client,a=i.getState().documentsReducer.documents[e.uuid];if(!a)throw new Error(`attempting to update a document with uuid ${e.uuid} that does not exist in store.documents`);const n={...a,...e};this.dispatch(Qe([n]));const c=this.enqueueRequest({description:"Update Document",method:l.PATCH,url:`/documents/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.catch(()=>{Qe([a])}),[n,c]}delete(e){const{store:i}=this.client,a=kt(i.getState()),n=$u(e)(i.getState());if(!n)throw new Error(`attempting to delete a document with uuid ${e} that does not exist in store.documents`);const c=n.parent_document?a[n.parent_document]:void 0;this.dispatch(Hi([e]));const r=this.enqueueRequest({description:"Delete Document",method:l.DELETE,url:`/documents/${e}/`,blockers:[e],blocks:[]});return r.then(u=>{this.dispatch(Qe(u))}).catch(()=>{this.dispatch(Qe([n])),c&&this.dispatch(Qe([c]))}),r}async refreshStore(e,i){const a=this.enqueueRequest({immediate:!0,description:"Get project documents",method:l.GET,url:"/documents/",queryParams:{project__organization:e},blockers:[],blocks:[]},i),n=this.enqueueRequest({immediate:!0,description:"Get organization documents",method:l.GET,url:"/documents/",queryParams:{organization:e},blockers:[],blocks:[]},i),c=[...await a,...await n];return this.dispatch(ku(c)),c}}class Cb extends R{async add(e,i){return this.enqueueRequest({description:"Add email domain to organization",method:l.POST,url:"/organization-email-domains/",payload:{email:i,organization:e},blockers:[e,"create-org"],blocks:[]})}async remove(e){return this.dispatch(Wu(e.uuid)),this.enqueueRequest({description:"Remove email domain from organization",method:l.DELETE,url:`/organization-email-domains/${e.uuid}/`,blockers:[e.domain],blocks:[]}).catch(i=>{throw this.dispatch(Hu(e)),i})}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch email domains for organization",method:l.GET,url:"/organization-email-domains/",queryParams:{organization:e},blockers:[e],blocks:[]},i);return this.dispatch(Nu(a)),a}}class kb extends R{async getVerificationCode(e){return this.enqueueRequest({description:"Get verification code",method:l.GET,url:`/verification/email-verification/${e}/`,isAuthNeeded:!1,blockers:[],blocks:[]})}validateVerificationCode(e,i=void 0){return this.enqueueRequest({description:"Validate verification code",method:l.POST,url:`/verification/email-verification/${e}/`,isAuthNeeded:!1,payload:i,blockers:[],blocks:[]})}}const Qt={},xn=new Set;let xt=0,ec=0,tc=0;const Bb=20;class $b extends R{constructor(){super(...arguments);S(this,"host");S(this,"_dbPromise",zp.openDB("fileCache",1,{upgrade(i){i.createObjectStore("files")}}))}async renewUploadUrl(i){const a=await this.fetchCache(i);if(!a)throw new Error(`File with sha1 ${i} not found in cache`);const n=await ns(a,i),c=await this.enqueueRequest({description:"Get S3 URL",method:l.GET,url:"/authentication/files/presigned-upload-url/",queryParams:{sha1:await Xe(a),file_type:a.type,extension:a.name.split(".").pop(),size:a.size.toString()},blockers:[],blocks:[`s3-${n}`]});return"url"in c&&this.dispatch(Qu({sha1:i,...c})),c}async addCache(i,a){if(xn.has(a))return;if(!i.type){const r=i.name.split("."),u=r[r.length-1];i=new File([i],i.name,{type:u})}if(!i.name||!i.size||!i.type)throw new Error("Cannot add files to cache that do not have a name, size and type.");const n=await this._dbPromise;!!await n.get("files",a)?(console.error("File already cached (this is unexpected at this point):",i.name,a),xt++):(await n.put("files",i,a),ec++),xn.add(a),tc++,tc%Bb===0&&console.debug(`File cache summary: ${xt} hits and ${ec} misses, ${xt/(xt+ec)*100}% hit rate over ${tc} calls to addCache.`)}async removeCache(i){await(await this._dbPromise).delete("files",i),xn.delete(i)}async fetchCache(i){return(await this._dbPromise).get("files",i)}async getOrRenewUploadUrl(i){const a=this.client.store.getState();return xu(i)(a)??await this.renewUploadUrl(i)}async uploadFileToS3(i){const a=await this.fetchCache(i);if(!a)throw new Error(`File with sha1 ${i} not found in cache`);const n=await ns(a,i),c={file_name:a.name,file_sha1:i,file:n},r=await this.getOrRenewUploadUrl(i);if("warning"in r){if(r.warning==="already_uploaded")return[c,Promise.resolve(void 0).then()];throw new Error(r.warning)}const u=r.url,m=this.enqueueRequest({url:u,description:"Upload file",method:l.POST,isExternalUrl:!0,isAuthNeeded:!1,attachmentHash:i,blockers:[`s3-${n}`],blocks:[i],s3url:r});return[c,m]}async fetchFileFromUrl(i,a,n){const c=i.split("?")[0]??i,r=await this.fetchCache(a);if(r){if(!r.name)throw new Error("Cached file unexpectedly has no name.");return r}if(i.startsWith("blob:")){const h=await lc(i),p=new File([h],n??a,{type:h.type});return await this.addCache(p,a),p}let u=Qt[c],m=!0;u?m=!1:(u=new Promise(h=>{this.enqueueRequest({description:"Download file",method:l.GET,url:i,isExternalUrl:!0,isResponseBlob:!0,isAuthNeeded:!1,blockers:[a],blocks:[a]}).then(p=>{const A=new File([p],n??a,{type:p.type});h(A)})}),Qt[c]=u);let o;try{o=await u}catch(h){throw m&&h instanceof D&&delete Qt[c],h}if(m){const h=await Xe(o);if(h!==a){const f=`The hash of the file returned from the server (${h}) does not match the
|
|
9
|
-
expected hash (${
|
|
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)},N=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:N.initialize,addConversation:N.addOne,addConversations:N.addMany,setConversation:N.setOne,setConversations:N.setMany,updateConversation:N.updateOne,updateConversations:N.updateMany,deleteConversation:N.deleteOne,deleteConversations:N.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,H=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: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: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,G=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:G.initialize,addAssetProcedureTypeAttachment:G.addOne,addAssetProcedureTypeAttachments:G.addMany,setAssetProcedureTypeAttachment:G.setOne,setAssetProcedureTypeAttachments:G.setMany,updateAssetProcedureTypeAttachment:G.updateOne,updateAssetProcedureTypeAttachments:G.updateMany,deleteAssetProcedureTypeAttachment:G.deleteOne,deleteAssetProcedureTypeAttachments:G.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)))),W=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:W.initialize,addAssetProcedureTypeFieldsAttachment:W.addOne,addAssetProcedureTypeFieldsAttachments:W.addMany,setAssetProcedureTypeFieldsAttachment:W.setOne,setAssetProcedureTypeFieldsAttachments:W.setMany,updateAssetProcedureTypeFieldsAttachment:W.updateOne,updateAssetProcedureTypeFieldsAttachments:W.updateMany,deleteAssetProcedureTypeFieldsAttachment:W.deleteOne,deleteAssetProcedureTypeFieldsAttachments:W.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)))})),K=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:K.initialize,addAssetProcedureTypeFields:K.addOne,addAssetProcedureTypeFieldsMany:K.addMany,setAssetProcedureTypeFields:K.setOne,setAssetProcedureTypeFieldsMany:K.setMany,updateAssetProcedureTypeFields:K.updateOne,updateAssetProcedureTypeFieldsMany:K.updateMany,deleteAssetProcedureTypeFields:K.deleteOne,deleteAssetProcedureTypeFieldsMany:K.deleteMany}}),{initializeAssetProcedureTypeFields: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)))})),Y=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:Y.initialize,addAssetProcedureTypeFieldValuesAttachment:Y.addOne,addAssetProcedureTypeFieldValuesAttachments:Y.addMany,setAssetProcedureTypeFieldValuesAttachment:Y.setOne,setAssetProcedureTypeFieldValuesAttachments:Y.setMany,updateAssetProcedureTypeFieldValuesAttachment:Y.updateOne,updateAssetProcedureTypeFieldValuesAttachments:Y.updateMany,deleteAssetProcedureTypeFieldValuesAttachment:Y.deleteOne,deleteAssetProcedureTypeFieldValuesAttachments:Y.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)))),Z=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:Z.initialize,addAssetProcedureTypeFieldValues:Z.addOne,addAssetProcedureTypeFieldValuesMany:Z.addMany,setAssetProcedureTypeFieldValues:Z.setOne,setAssetProcedureTypeFieldValuesMany:Z.setMany,updateAssetProcedureTypeFieldValues:Z.updateOne,updateAssetProcedureTypeFieldValuesMany:Z.updateMany,deleteAssetProcedureTypeFieldValues:Z.deleteOne,deleteAssetProcedureTypeFieldValuesMany:Z.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)))})),J=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:J.initialize,addAssetProcedure:J.addOne,addAssetProcedures:J.addMany,setAssetProcedure:J.setOne,setAssetProcedures:J.setMany,updateAssetProcedure:J.updateOne,updateAssetProcedures:J.updateMany,deleteAssetProcedure:J.deleteOne,deleteAssetProcedures:J.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)))})),X=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:X.initialize,addAssetProcedureType:X.addOne,addAssetProcedureTypes:X.addMany,setAssetProcedureType:X.setOne,setAssetProcedureTypes:X.setMany,updateAssetProcedureType:X.updateOne,updateAssetProcedureTypes:X.updateMany,deleteAssetProcedureType:X.deleteOne,deleteAssetProcedureTypes:X.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)))),Q=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:Q.initialize,addAssetProcedureStepFieldsAttachment:Q.addOne,addAssetProcedureStepFieldsAttachments:Q.addMany,setAssetProcedureStepFieldsAttachment:Q.setOne,setAssetProcedureStepFieldsAttachments:Q.setMany,updateAssetProcedureStepFieldsAttachment:Q.updateOne,updateAssetProcedureStepFieldsAttachments:Q.updateMany,deleteAssetProcedureStepFieldsAttachment:Q.deleteOne,deleteAssetProcedureStepFieldsAttachments:Q.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,x=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:x.initialize,addAssetProcedureStepFields:x.addOne,addAssetProcedureStepFieldsMany:x.addMany,setAssetProcedureStepFields:x.setOne,setAssetProcedureStepFieldsMany:x.setMany,updateAssetProcedureStepFields:x.updateOne,updateAssetProcedureStepFieldsMany:x.updateMany,deleteAssetProcedureStepFields:x.deleteOne,deleteAssetProcedureStepFieldsMany:x.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,ee=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:ee.initialize,addAssetProcedureStepFieldValuesAttachment:ee.addOne,addAssetProcedureStepFieldValuesAttachments:ee.addMany,setAssetProcedureStepFieldValuesAttachment:ee.setOne,setAssetProcedureStepFieldValuesAttachments:ee.setMany,updateAssetProcedureStepFieldValuesAttachment:ee.updateOne,updateAssetProcedureStepFieldValuesAttachments:ee.updateMany,deleteAssetProcedureStepFieldValuesAttachment:ee.deleteOne,deleteAssetProcedureStepFieldValuesAttachments:ee.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,te=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:te.initialize,addAssetProcedureStepFieldValues:te.addOne,addAssetProcedureStepFieldValuesMany:te.addMany,setAssetProcedureStepFieldValues:te.setOne,setAssetProcedureStepFieldValuesMany:te.setMany,updateAssetProcedureStepFieldValues:te.updateOne,updateAssetProcedureStepFieldValuesMany:te.updateMany,deleteAssetProcedureStepFieldValues:te.deleteOne,deleteAssetProcedureStepFieldValuesMany:te.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,se=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:se.initialize,setAssetProcedureStep:se.setOne,setAssetProcedureSteps:se.setMany,addAssetProcedureStep:se.addOne,addAssetProcedureSteps:se.addMany,updateAssetProcedureStep:se.updateOne,updateAssetProcedureSteps:se.updateMany,deleteAssetProcedureStep:se.deleteOne,deleteAssetProcedureSteps:se.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)})),ie=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:ie.initialize,addAsset:ie.addOne,addAssets:ie.addMany,setAsset:ie.setOne,setAssets:ie.setMany,updateAsset:ie.updateOne,updateAssets:ie.updateMany,deleteAsset:ie.deleteOne,deleteAssets:ie.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,ne=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:ne.initialize,addAssetStageCompletion:ne.addOne,addAssetStageCompletions:ne.addMany,setAssetStageCompletion:ne.setOne,setAssetStageCompletions:ne.setMany,updateAssetStageCompletion:ne.updateOne,updateAssetStageCompletions:ne.updateMany,deleteAssetStageCompletion:ne.deleteOne,deleteAssetStageCompletions:ne.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)))})),ae=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:ae.initialize,setAssetStage:ae.setOne,setAssetStages:ae.setMany,addAssetStage:ae.addOne,addAssetStages:ae.addMany,updateAssetStage:ae.updateOne,updateAssetStages:ae.updateMany,deleteAssetStage:ae.deleteOne,deleteAssetStages:ae.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)))})),ce=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:ce.initialize,addAssetTypeAttachment:ce.addOne,addAssetTypeAttachments:ce.addMany,setAssetTypeAttachment:ce.setOne,setAssetTypeAttachments:ce.setMany,updateAssetTypeAttachment:ce.updateOne,updateAssetTypeAttachments:ce.updateMany,deleteAssetTypeAttachment:ce.deleteOne,deleteAssetTypeAttachments:ce.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,de=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:de.initialize,addAssetTypeFieldsAttachment:de.addOne,addAssetTypeFieldsAttachments:de.addMany,setAssetTypeFieldsAttachment:de.setOne,setAssetTypeFieldsAttachments:de.setMany,updateAssetTypeFieldsAttachment:de.updateOne,updateAssetTypeFieldsAttachments:de.updateMany,deleteAssetTypeFieldsAttachment:de.deleteOne,deleteAssetTypeFieldsAttachments:de.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,re=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:re.initialize,addAssetTypeFields:re.addOne,addAssetTypeFieldsMany:re.addMany,setAssetTypeFields:re.setOne,setAssetTypeFieldsMany:re.setMany,updateAssetTypeFields:re.updateOne,updateAssetTypeFieldsMany:re.updateMany,deleteAssetTypeFields:re.deleteOne,deleteAssetTypeFieldsMany:re.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,ue=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:ue.initialize,addAssetTypeFieldValuesAttachment:ue.addOne,addAssetTypeFieldValuesAttachments:ue.addMany,setAssetTypeFieldValuesAttachment:ue.setOne,setAssetTypeFieldValuesAttachments:ue.setMany,updateAssetTypeFieldValuesAttachment:ue.updateOne,updateAssetTypeFieldValuesAttachments:ue.updateMany,deleteAssetTypeFieldValuesAttachment:ue.deleteOne,deleteAssetTypeFieldValuesAttachments:ue.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,le=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:le.initialize,addAssetTypeFieldValues:le.addOne,addAssetTypeFieldValuesMany:le.addMany,setAssetTypeFieldValues:le.setOne,setAssetTypeFieldValuesMany:le.setMany,updateAssetTypeFieldValues:le.updateOne,updateAssetTypeFieldValuesMany:le.updateMany,deleteAssetTypeFieldValues:le.deleteOne,deleteAssetTypeFieldValuesMany:le.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,oe=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:oe.initialize,addAssetTypeIdentifier:oe.addOne,addAssetTypeIdentifiers:oe.addMany,setAssetTypeIdentifier:oe.setOne,setAssetTypeIdentifiers:oe.setMany,updateAssetTypeIdentifier:oe.updateOne,updateAssetTypeIdentifiers:oe.updateMany,deleteAssetTypeIdentifier:oe.deleteOne,deleteAssetTypeIdentifiers:oe.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,he=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:he.initialize,addAssetTypeIdentifierValue:he.addOne,addAssetTypeIdentifierValues:he.addMany,setAssetTypeIdentifierValue:he.setOne,setAssetTypeIdentifierValues:he.setMany,updateAssetTypeIdentifierValue:he.updateOne,updateAssetTypeIdentifierValues:he.updateMany,deleteAssetTypeIdentifierValue:he.deleteOne,deleteAssetTypeIdentifierValues:he.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,me=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:me.initialize,setAssetType:me.setOne,setAssetTypes:me.setMany,addAssetType:me.addOne,addAssetTypes:me.addMany,updateAssetType:me.updateOne,updateAssetTypes:me.updateMany,deleteAssetType:me.deleteOne,deleteAssetTypes:me.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,ye=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:ye.initialize,addAssetTypeStatus:ye.addOne,addAssetTypeStatuses:ye.addMany,setAssetTypeStatus:ye.setOne,setAssetTypeStatuses:ye.setMany,updateAssetTypeStatus:ye.updateOne,updateAssetTypeStatuses:ye.updateMany,deleteAssetTypeStatus:ye.deleteOne,deleteAssetTypeStatuses:ye.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,pe=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:pe.initialize,addCategory:pe.addOne,addCategories:pe.addMany,setCategory:pe.setOne,setCategories:pe.setMany,updateCategory:pe.updateOne,updateCategories:pe.updateMany,deleteCategory:pe.deleteOne,deleteCategories:pe.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,Ae=R(t=>t.uuid),Zo={instances:{}},ii=o.createSlice({name:"documentAttachments",initialState:Zo,extraReducers:t=>t.addCase(_,s=>Object.assign(s,Zo)),reducers:{initializeDocumentAttachments:Ae.initialize,addDocumentAttachment:Ae.addOne,addDocumentAttachments:Ae.addMany,setDocumentAttachment:Ae.setOne,setDocumentAttachments:Ae.setMany,updateDocumentAttachment:Ae.updateOne,updateDocumentAttachments:Ae.updateMany,deleteDocumentAttachment:Ae.deleteOne,deleteDocumentAttachments:Ae.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,fe=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:fe.initialize,addDocument:fe.addOne,addDocuments:fe.addMany,setDocument:fe.setOne,setDocuments:fe.setMany,updateDocument:fe.updateOne,updateDocuments:fe.updateMany,deleteDocument:fe.deleteOne,deleteDocuments:fe.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)})),Se=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: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: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,Te=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:Te.initialize,addFormIdentifier:Te.addOne,addFormIdentifiers:Te.addMany,setFormIdentifier:Te.setOne,setFormIdentifiers:Te.setMany,updateFormIdentifier:Te.updateOne,updateFormIdentifiers:Te.updateMany,deleteFormIdentifier:Te.deleteOne,deleteFormIdentifiers:Te.deleteMany}}),{initializeFormIdentifiers: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,Ie=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:Ie.initialize,addFormIdentifierValue:Ie.addOne,addFormIdentifierValues:Ie.addMany,setFormIdentifierValue:Ie.setOne,setFormIdentifierValues:Ie.setMany,updateFormIdentifierValue:Ie.updateOne,updateFormIdentifierValues:Ie.updateMany,deleteFormIdentifierValue:Ie.deleteOne,deleteFormIdentifierValues:Ie.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,Oe=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:Oe.initialize,addFormRevisionAttachment:Oe.addOne,addFormRevisionAttachments:Oe.addMany,setFormRevisionAttachment:Oe.setOne,setFormRevisionAttachments:Oe.setMany,updateFormRevisionAttachment:Oe.updateOne,updateFormRevisionAttachments:Oe.updateMany,deleteFormRevisionAttachment:Oe.deleteOne,deleteFormRevisionAttachments:Oe.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,Pe=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:Pe.initialize,addFormRevision:Pe.addOne,addFormRevisions:Pe.addMany,setFormRevision:Pe.setOne,setFormRevisions:Pe.setMany,updateFormRevision:Pe.updateOne,updateFormRevisions:Pe.updateMany,deleteFormRevision:Pe.deleteOne,deleteFormRevisions:Pe.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,Fe=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:Fe.initialize,addForm:Fe.addOne,addForms:Fe.addMany,setForm:Fe.setOne,setForms:Fe.setMany,updateForm:Fe.updateOne,updateForms:Fe.updateMany,deleteForm:Fe.deleteOne,deleteForms:Fe.deleteMany}}),{initializeForms: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)))),ge=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:ge.initialize,addFormSubmissionAttachment:ge.addOne,addFormSubmissionAttachments:ge.addMany,setFormSubmissionAttachment:ge.setOne,setFormSubmissionAttachments:ge.setMany,updateFormSubmissionAttachment:ge.updateOne,updateFormSubmissionAttachments:ge.updateMany,deleteFormSubmissionAttachment:ge.deleteOne,deleteFormSubmissionAttachments:ge.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,be=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:be.initialize,setFormSubmission:be.setOne,setFormSubmissions:be.setMany,addFormSubmission:be.addOne,addFormSubmissions:be.addMany,updateFormSubmission:be.updateOne,updateFormSubmissions:be.updateMany,deleteFormSubmission:be.deleteOne,deleteFormSubmissions:be.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,_e=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:_e.initialize,setGeoImage:_e.setOne,setGeoImages:_e.setMany,addGeoImage:_e.addOne,addGeoImages:_e.addMany,updateGeoImage:_e.updateOne,updateGeoImages:_e.updateMany,deleteGeoImage:_e.deleteOne,deleteGeoImages:_e.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,Me=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:Me.initialize,addIssueAssociation:Me.addOne,addIssueAssociations:Me.addMany,setIssueAssociation:Me.setOne,setIssueAssociations:Me.setMany,updateIssueAssociation:Me.updateOne,updateIssueAssociations:Me.updateMany,deleteIssueAssociation:Me.deleteOne,deleteIssueAssociations:Me.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,Re=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:Re.initialize,addIssueAttachment:Re.addOne,addIssueAttachments:Re.addMany,setIssueAttachment:Re.setOne,setIssueAttachments:Re.setMany,updateIssueAttachment:Re.updateOne,updateIssueAttachments:Re.updateMany,deleteIssueAttachment:Re.deleteOne,deleteIssueAttachments:Re.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,we=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:we.initialize,addIssueCommentAttachment:we.addOne,addIssueCommentAttachments:we.addMany,setIssueCommentAttachment:we.setOne,setIssueCommentAttachments:we.setMany,updateIssueCommentAttachment:we.updateOne,updateIssueCommentAttachments:we.updateMany,deleteIssueCommentAttachment:we.deleteOne,deleteIssueCommentAttachments:we.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,Ee=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:Ee.initialize,addIssueComment:Ee.addOne,addIssueComments:Ee.addMany,setIssueComment:Ee.setOne,setIssueComments:Ee.setMany,updateIssueComment:Ee.updateOne,updateIssueComments:Ee.updateMany,deleteIssueComment:Ee.deleteOne,deleteIssueComments:Ee.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,ve=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: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: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,ze=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:ze.initialize,addIssueTypeFieldsAttachment:ze.addOne,addIssueTypeFieldsAttachments:ze.addMany,setIssueTypeFieldsAttachment:ze.setOne,setIssueTypeFieldsAttachments:ze.setMany,updateIssueTypeFieldsAttachment:ze.updateOne,updateIssueTypeFieldsAttachments:ze.updateMany,deleteIssueTypeFieldsAttachment:ze.deleteOne,deleteIssueTypeFieldsAttachments:ze.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,Be=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:Be.initialize,addIssueTypeFieldValues:Be.addOne,addIssueTypeFieldValuesMany:Be.addMany,setIssueTypeFieldValues:Be.setOne,setIssueTypeFieldValuesMany:Be.setMany,updateIssueTypeFieldValues:Be.updateOne,updateIssueTypeFieldValuesMany:Be.updateMany,deleteIssueTypeFieldValues:Be.deleteOne,deleteIssueTypeFieldValuesMany:Be.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,je=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:je.initialize,addIssueTypeFields:je.addOne,addIssueTypeFieldsMany:je.addMany,setIssueTypeFields:je.setOne,setIssueTypeFieldsMany:je.setMany,updateIssueTypeFields:je.updateOne,updateIssueTypeFieldsMany:je.updateMany,deleteIssueTypeFields:je.deleteOne,deleteIssueTypeFieldsMany:je.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,qe=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:qe.initialize,addIssueTypeFieldValuesAttachment:qe.addOne,addIssueTypeFieldValuesAttachments:qe.addMany,setIssueTypeFieldValuesAttachment:qe.setOne,setIssueTypeFieldValuesAttachments:qe.setMany,updateIssueTypeFieldValuesAttachment:qe.updateOne,updateIssueTypeFieldValuesAttachments:qe.updateMany,deleteIssueTypeFieldValuesAttachment:qe.deleteOne,deleteIssueTypeFieldValuesAttachments:qe.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,De=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:De.initialize,addIssueTypeIdentifier:De.addOne,addIssueTypeIdentifiers:De.addMany,setIssueTypeIdentifier:De.setOne,setIssueTypeIdentifiers:De.setMany,updateIssueTypeIdentifier:De.updateOne,updateIssueTypeIdentifiers:De.updateMany,deleteIssueTypeIdentifier:De.deleteOne,deleteIssueTypeIdentifiers:De.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,Ce=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:Ce.initialize,addIssueTypeIdentifierValue:Ce.addOne,addIssueTypeIdentifierValues:Ce.addMany,setIssueTypeIdentifierValue:Ce.setOne,setIssueTypeIdentifierValues:Ce.setMany,updateIssueTypeIdentifierValue:Ce.updateOne,updateIssueTypeIdentifierValues:Ce.updateMany,deleteIssueTypeIdentifierValue:Ce.deleteOne,deleteIssueTypeIdentifierValues:Ce.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,$e=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:$e.initialize,addIssueType:$e.addOne,addIssueTypes:$e.addMany,setIssueType:$e.setOne,setIssueTypes:$e.setMany,updateIssueType:$e.updateOne,updateIssueTypes:$e.updateMany,deleteIssueType:$e.deleteOne,deleteIssueTypes:$e.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,Ue=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:Ue.initialize,addIssueTypeStatus:Ue.addOne,addIssueTypeStatuses:Ue.addMany,setIssueTypeStatus:Ue.setOne,setIssueTypeStatuses:Ue.setMany,updateIssueTypeStatus:Ue.updateOne,updateIssueTypeStatuses:Ue.updateMany,deleteIssueTypeStatus:Ue.deleteOne,deleteIssueTypeStatuses:Ue.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,Le=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: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: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,ke=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:ke.initialize,setUsers:ke.setMany,setUser:ke.setOne,addUsers:ke.addMany,addUser:ke.addOne,updateUsers:ke.updateMany,updateUser:ke.updateOne,deleteUser:ke.deleteOne,deleteUsers:ke.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)))})),Ne=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:Ne.initialize,addOrganizationAccess:Ne.addOne,addOrganizationAccesses:Ne.addMany,setOrganizationAccess:Ne.setOne,setOrganizationAccesses:Ne.setMany,updateOrganizationAccess:Ne.updateOne,updateOrganizationAccesses:Ne.updateMany,deleteOrganizationAccess:Ne.deleteOne,deleteOrganizationAccesses:Ne.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})))),He=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: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: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,Ge=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:Ge.initialize,addProjectAccess:Ge.addOne,addProjectAccesses:Ge.addMany,setProjectAccess:Ge.setOne,setProjectAccesses:Ge.setMany,updateProjectAccess:Ge.updateOne,updateProjectAccesses:Ge.updateMany,deleteProjectAccess:Ge.deleteOne,deleteProjectAccesses:Ge.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)))})),We=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:We.initialize,addProjectAttachment:We.addOne,addProjectAttachments:We.addMany,setProjectAttachment:We.setOne,setProjectAttachments:We.setMany,updateProjectAttachment:We.updateOne,updateProjectAttachments:We.updateMany,deleteProjectAttachment:We.deleteOne,deleteProjectAttachments:We.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,Ke=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:Ke.initialize,setProjectFile:Ke.setOne,setProjectFiles:Ke.setMany,addProjectFile:Ke.addOne,addProjectFiles:Ke.addMany,updateProjectFile:Ke.updateOne,updateProjectFiles:Ke.updateMany,deleteProjectFile:Ke.deleteOne,deleteProjectFiles:Ke.deleteMany,setIsImportingProjectFile:(t,s)=>{t.isImportingProjectFile=s.payload},saveActiveProjectFileBounds:(t,s)=>{const e=t.activeProjectFileId;if(!e)throw new Error("Tried to save bounds for active project file, but no active project file was set.");if(!t.instances[e])throw new Error(`Tried to save bounds for active project file, but project file with ID ${e}
|
|
2
|
+
doesn't exist.`);t.instances[e].bounds=s.payload},setActiveProjectFileId:(t,s)=>{t.activeProjectFileId=s.payload}}}),{initializeProjectFiles:WT,setProjectFile:KT,setProjectFiles:YT,addProjectFile:ZT,addProjectFiles:JT,updateProjectFile:XT,updateProjectFiles:QT,deleteProjectFile:xT,deleteProjectFiles:eI,setIsImportingProjectFile:tI,setActiveProjectFileId:sI,saveActiveProjectFileBounds:iI}=wn.actions,nI=t=>t.projectFileReducer.instances,aI=o.createSelector([nI],t=>T(Object.values(t).sort((s,e)=>s.z_index-e.z_index))),cI=t=>s=>s.projectFileReducer.instances[t],dI=S(o.createSelector([aI,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),vF=t=>t.projectFileReducer.activeProjectFileId,VF=t=>t.projectFileReducer.isImportingProjectFile,rI=wn.reducer,Ye=R(t=>t.uuid),uI={instances:{}},En=o.createSlice({name:"projects",initialState:uI,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,uI)),reducers:{initializeProjects:Ye.initialize,setProjects:Ye.setMany,setProject:Ye.setOne,addProjects:Ye.addMany,addProject:Ye.addOne,updateProjects:Ye.updateMany,updateProject:Ye.updateOne,deleteProject:Ye.deleteOne,deleteProjects:Ye.deleteMany}}),{initializeProjects:lI,setProjects:oI,setProject:hI,addProjects:mI,addProject:yI,updateProjects:pI,updateProject:AI,deleteProject:fI,deleteProjects:SI}=En.actions,TI=En.reducer,II=t=>t.projectReducer.instances,Dt=o.createSelector([II],t=>T(Object.values(t))),OI=t=>s=>s.projectReducer.instances[t],PI=S(o.createSelector([Dt,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),zF=S(o.createSelector([Dt,mt,(t,s)=>s],(t,s,e)=>{const n=new Set(s.filter(a=>a.user===e).map(a=>a.project));return T(t.filter(a=>n.has(a.uuid)))})),BF=S(o.createSelector([Dt,(t,s)=>s],(t,s)=>T(t.filter(e=>e.organization===s)))),jF={isRehydrated:!1},vn=o.createSlice({name:"rehydrated",initialState:jF,reducers:{setRehydrated:(t,s)=>{t.isRehydrated=s.payload}}}),{setRehydrated:qF}=vn.actions,DF=t=>t.rehydratedReducer.isRehydrated,FI=vn.reducer,Ze=R(t=>t.uuid),gI={instances:{}},Vn=o.createSlice({name:"teamMemberships",initialState:gI,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,gI)),reducers:{initializeTeamMemberships:Ze.initialize,addTeamMembership:Ze.addOne,addTeamMemberships:Ze.addMany,setTeamMembership:Ze.setOne,setTeamMemberships:Ze.setMany,updateTeamMembership:Ze.updateOne,updateTeamMemberships:Ze.updateMany,deleteTeamMembership:Ze.deleteOne,deleteTeamMemberships:Ze.deleteMany}}),{initializeTeamMemberships:bI,addTeamMembership:_I,addTeamMemberships:MI,setTeamMembership:RI,setTeamMemberships:wI,updateTeamMembership:EI,updateTeamMemberships:vI,deleteTeamMembership:VI,deleteTeamMemberships:zI}=Vn.actions,BI=Vn.reducer,jI=t=>t.teamMembershipReducer.instances,Ct=o.createSelector([jI],t=>Object.values(t)),qI=t=>s=>s.teamMembershipReducer.instances[t],DI=S(o.createSelector([Ct,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),CF=S(o.createSelector([Ct,(t,s)=>s],(t,s)=>{const e={};for(const n of t.filter(a=>a.team===s))e[n.user]=n;return e})),$F=S(o.createSelector([Bt,Ct,(t,s)=>s],(t,s,e)=>{const n=new Set(s.filter(a=>a.team===e).map(a=>a.user));return T(t.filter(a=>n.has(a.id)))})),Je=R(t=>t.uuid),CI={instances:{}},zn=o.createSlice({name:"teams",initialState:CI,extraReducers:t=>t.addMatcher(o.isAnyOf(_,w),s=>Object.assign(s,CI)),reducers:{initializeTeams:Je.initialize,addTeam:Je.addOne,addTeams:Je.addMany,setTeam:Je.setOne,setTeams:Je.setMany,updateTeam:Je.updateOne,updateTeams:Je.updateMany,deleteTeam:Je.deleteOne,deleteTeams:Je.deleteMany}}),{initializeTeams:$I,addTeam:UI,addTeams:LI,setTeam:kI,setTeams:NI,updateTeam:HI,updateTeams:GI,deleteTeam:WI,deleteTeams:KI}=zn.actions,YI=t=>t.teamReducer.instances,Bn=o.createSelector([YI],t=>Object.values(t)),ZI=t=>s=>s.teamReducer.instances[t],JI=S(o.createSelector([Bn,(t,s)=>s],(t,s)=>{const e=new Set(s);return T(t.filter(({uuid:n})=>e.has(n)))})),UF=S(o.createSelector([Bn,(t,s)=>s],(t,s)=>T(t.filter(e=>e.organization===s)))),XI=zn.reducer,LF={version:0},QI=o.createSlice({name:"versioning",initialState:LF,reducers:{}}),xI=QI.reducer,jn={outboxReducer:fT,fileReducer:Lh,authReducer:jo},kF=o.combineReducers(jn),eO={...jn,[rt]:xI,categoryReducer:Yo,assetReducer:Lr,assetAttachmentReducer:Ma,assetStageCompletionReducer:Qr,assetStageReducer:mu,assetTypeReducer:So,assetTypeAttachmentReducer:Ru,issueReducer:Qp,issueAttachmentReducer:hp,issueTypeReducer:sS,issueTypeAttachmentReducer:hA,organizationReducer:oT,projectReducer:TI,projectAttachmentReducer:HT,projectAccessReducer:RT,organizationAccessReducer:KS,projectFileReducer:rI,rehydratedReducer:FI,formReducer:Jm,formRevisionReducer:$m,formRevisionAttachmentReducer:wm,formSubmissionAttachmentReducer:oy,formSubmissionReducer:gy,formIdentifierReducer:tm,formIdentifierValueReducer:pm,userReducer:BS,emailDomainsReducer:qh,documentsReducer:Th,documentAttachmentReducer:rh,teamReducer:XI,agentsReducer:ya,issueCommentReducer:$p,issueCommentAttachmentReducer:_p,issueUpdateReducer:bS,geoImageReducer:Cy,issueAssociationReducer:xy,issueTypeFieldsReducer:ef,issueTypeFieldValuesReducer:UA,issueTypeFieldsAttachmentReducer:_A,issueTypeFieldValuesAttachmentReducer:yf,issueTypeIdentifierReducer:Rf,issueTypeIdentifierValueReducer:kf,issueTypeStatusReducer:pS,assetTypeFieldsReducer:sl,assetTypeFieldValuesReducer:wl,assetTypeFieldsAttachmentReducer:ku,assetTypeFieldValuesAttachmentReducer:pl,assetTypeIdentifierReducer:Nl,assetTypeIdentifierValueReducer:io,assetTypeStatusReducer:Vo,assetProcedureTypeReducer:hd,assetProcedureReducer:Xc,assetProcedureTypeFieldsReducer:hc,assetProcedureTypeFieldValuesReducer:$c,assetProcedureTypeFieldsAttachmentReducer:Qa,assetProcedureTypeFieldValuesAttachmentReducer:gc,assetProcedureTypeAttachmentReducer:Ca,assetProcedureStepFieldsAttachmentReducer:wd,assetProcedureStepFieldsReducer:kd,assetProcedureStepFieldValuesAttachmentReducer:tr,assetProcedureStepFieldValuesReducer:pr,assetProcedureStepReducer:_r,teamMembershipReducer:BI},NF=o.combineReducers(eO);function HF(t,s){return RO.useMemo(t,s)}class GF{constructor(s){y(this,"operations",[]);y(this,"getData");this.getData=s}performOperations(s){let e=s;for(const n of this.operations)e=n(e);return e}filter(s,e){return this.operations.push(n=>n.filter(a=>a[s]===e)),this}exclude(s,e){return this.operations.push(n=>n.filter(a=>a[s]!==e)),this}orderBy(s){return this.operations.push(e=>[...e].sort((n,a)=>n[s]<=a[s]?1:-1)),this}reverse(){return this.operations.push(s=>[...s].reverse()),this}all(){return this.operations.push(s=>s),this}get(s,e){return o.createSelector([this.getData],n=>this.performOperations(n).find(a=>a[s]===e))}count(){return o.createSelector([this.getData],s=>this.performOperations(s).length)}first(){return o.createSelector([this.getData],s=>this.performOperations(s)[0])}last(){return o.createSelector([this.getData],s=>{const e=this.performOperations(s);return e[e.length-1]})}exists(){return o.createSelector([this.getData],s=>this.performOperations(s).length>0)}toSelector(){return o.createSelector([this.getData],s=>T(this.performOperations(s)))}}const tO=1e4,sO=200,qn=[400,409,403,404,405,500],k=1e4,iO={};class nO{constructor(s){y(this,"client");y(this,"pageSize",tO);iO[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 aO=()=>rO.length-1,cO=t=>(t[rt]={version:aO()},t),dO=()=>cO({}),WF=t=>(t.outboxReducer&&(t.outboxReducer.deletedRequests=[]),t),KF=t=>s=>{var e;return s===void 0&&(s={}),((e=s[rt])==null?void 0:e.version)===aO()?s:t(s)},rO=[cO,dO,dO,WF],YF=Object.fromEntries(rO.map((t,s)=>[s,KF(t)])),ZF=t=>{if(t)throw t;const s=dt();s?s.dispatch({type:"rehydrated/setRehydrated",payload:!0}):console.error("Client store not set")},uO=(t,s,e)=>{const n=tt();return n?(n.addRequest(s),n.getQueue()):(console.warn("Outbox coordinator not set; cannot enqueue request yet."),[])},lO=(t,s,e)=>{const n=tt();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 JF(t,s){if(!s.payload)throw new Error("Received empty payload");return FO(s)}const XF={...Hn,effect:JF,discard:hO,returnPromises:!0,persistCallback:ZF,retry:tg,persistOptions:{storage:EO},queue:{...Hn.queue,enqueue:uO,dequeue:lO,peek:(...t)=>eg(...t)}},QF=vO(YF,rt),xF=o.compose(wO.offline(XF),QF);async function oO(t,s,e){if(s.store.getState().outboxReducer.deletedRequests.includes(t.payload.uuid))throw new Error("Request was marked for deletion");const a=iO[t.meta.offline.effect.serviceName];if(!a)throw new Error(`Service ${t.meta.offline.effect.serviceName} not found`);return Un(t.meta.offline.effect.BASE_URL,t.meta.offline.effect.request,s,a,e)}function hO(t,s,e=0){var d;if(console.debug("Considering discarding request due to error:",t,`(${typeof t})`,`
|
|
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=dt(),c=n.getState().outboxReducer.deletedRequests,r=s.payload.uuid;function l(){n.dispatch(pT(r));const h=tt();if(!h)throw new Error("Outbox coordinator not set");h.remove(s.payload.uuid);const p=s.meta.offline.rollback;throw p&&(console.warn("Rolling back request due to SDK error:",s),n.dispatch(p)),t}if(t instanceof U&&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 U){const h=t.status||((d=t.response)==null?void 0:d.status);if(h||console.warn("Error has no status code:",t),h!==void 0&&qn.includes(h)){console.warn("Discarding request due to error:",t,`
|
|
5
|
+
Action:`,s);const p=tt();if(!p)throw new Error("Outbox coordinator not set");p.remove(s.payload.uuid),t.options.discard=!0,l()}}console.debug("Registering a retry for request:",s.payload.uuid);const u=tt();if(!u)throw new Error("Outbox coordinator not set");return u.registerRetry(s.payload.uuid),!1}function eg(t,s,e){var n;return(n=tt())==null?void 0:n.peek()}function tg(t,s){return dt().dispatch(AT(new Date().getTime())),Xn}const nt="An unknown error occurred",sg=500,mO=["non_field_errors","detail"];function ig(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"?mO.includes(a)?c:`${a}: ${c}`:Array.isArray(c)?mO.includes(a)?c.join(`
|
|
6
|
+
`):c.map(r=>`${a}: ${r}`).join(`
|
|
7
|
+
`):`${a}: ${JSON.stringify(c)}`).join(`
|
|
8
|
+
`)}catch(a){console.error("Failed to extract error message from response body",a)}}else typeof t.body=="string"&&(e=t.body);else t!=null&&t.text?e=t.text:s instanceof Error&&(e=s.message);return!e||e.length>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,k)),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,k)),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,k)),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,k)),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,Math.min(n??e.length,k)).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,k)),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,k)),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,k)),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
|
|
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=o.type.split("/")[1];if(!p)throw new Error("File has no extension");const A=n??h+"."+p;if(o=oc(o,A),!o.name)throw new Error("Failed to set file's name");await this.addCache(o,h),Qt[c]=new Promise(f=>{f(o)})}return o}}class Gb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(Ji(c));const r=this.enqueueRequest({description:"Create form identifier",method:l.POST,url:"/form-identifiers/",payload:v(c),blockers:[c.form],blocks:[c.uuid]});return r.then(m=>{this.dispatch(ht(m))}).catch(()=>{this.dispatch(Xi(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=Qi(e.uuid)(i.getState());if(!a)throw new Error(`Expected form identifier with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(ht(n));const c=this.enqueueRequest({description:"Update form identifier",method:l.PATCH,url:`/form-identifiers/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(ht(r))}).catch(()=>{this.dispatch(ht(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Qi(e)(a);if(!n)throw new Error(`Expected form identifier with uuid ${e} to exist`);this.dispatch(Xi(e));try{return await this.enqueueRequest({description:"Delete form identifier",method:l.DELETE,url:`/form-identifiers/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(Ji(n)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({description:"Get form identifiers",method:l.GET,url:"/form-identifiers/",queryParams:{form__organization:e},blockers:[],blocks:[]},i);return this.dispatch(so(a)),a}}class Lb extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(ea(c));const r=this.enqueueRequest({description:"Create form identifier value",method:l.POST,url:"/form-identifier-values/",payload:v(c),blockers:[e.form_submission,e.form_identifier],blocks:[c.uuid]});return r.then(m=>{this.dispatch(mt(m))}).catch(()=>{this.dispatch(ta(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=ia(e.uuid)(i.getState());if(!a)throw new Error(`Expected form identifier value with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(mt(n));const c=this.enqueueRequest({description:"Update form identifier value",method:l.PATCH,url:`/form-identifier-values/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(mt(r))}).catch(()=>{this.dispatch(mt(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=ia(e)(a);if(!n)throw new Error(`Expected form identifier value with uuid ${e} to exist`);this.dispatch(ta(e));try{return await this.enqueueRequest({description:"Delete form identifier value",method:l.DELETE,url:`/form-identifier-values/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(ea(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get form identifier values",method:l.GET,url:"/form-identifier-values/",queryParams:{limit:E,paginate:!0,form_submission__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get form identifier values",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(ro(n)),n}}class Nb extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const o of e){const{revisionUuid:h,fieldIdentifier:p,file:A}=o,f=await this.getFilePayload(A);f.sha1 in n||(n[f.sha1]=f);const T=b({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,form_revision:h,submitted_at:i,field_identifier:p});c.push(T);const F={uuid:T.uuid,file_name:A.name,field_identifier:p,file_extension:f.extension,file_sha1:f.sha1,form_revision:h};r.push(F)}this.dispatch(mo(c));const u=this.enqueueRequest({description:"Attach files to form revision",method:l.POST,url:"/form-revision-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(o=>o.form_revision),blocks:c.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(po(o.attachments))}).catch(()=>{this.dispatch(Ao(c.map(o=>o.uuid)))}),[c,u.then(({attachments:o})=>o)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch organization form revision attachments",method:l.GET,url:"/form-revision-attachments/",queryParams:{form_revision__form__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(ho(a)),a}}class Hb extends j{add(e){var u;const{store:i}=this.client,n=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,c=b({...e,created_by:n,submitted_at:new Date().toISOString()});this.dispatch(ca(c));const r=this.enqueueRequest({description:"Create form revision",method:l.POST,url:"/form-revisions/",payload:v(c),blockers:[e.form],blocks:[c.uuid]});return r.then(m=>{this.dispatch(go(m))}).catch(()=>{this.dispatch(ra(c.uuid))}),[c,r]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get organization form revisions",method:l.GET,url:"/form-revisions/",queryParams:{form__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(Io(a)),a}}class Wb extends j{add(e,i){var o;const{store:a}=this.client,n=new Date().toISOString(),c=(o=a.getState().userReducer.currentUser)==null?void 0:o.id,r=b({...e,submitted_at:n,created_by:c}),u=b({...i,form:r.uuid,submitted_at:n,created_by:c});this.dispatch(la(r)),this.dispatch(ca(u));const m=this.enqueueRequest({description:"Create form",method:l.POST,url:"/forms/",payload:{...v(r),initial_revision:{uuid:u.uuid,submitted_at:u.submitted_at,title:u.title,description:u.description,fields:u.fields}},blockers:[],blocks:[r.uuid,u.uuid]});return m.catch(h=>{throw this.dispatch(ha(r.uuid)),this.dispatch(ra(u.uuid)),h}),[r,u,m]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Mo(e)(a);if(!n)throw new Error("Expected form to exist");const c=$o(e)(a);c.length>0&&this.dispatch(Nt(c.map(({uuid:u})=>u)));const r=Fo(e)(a);r.length>0&&this.dispatch(bo(r.map(({uuid:u})=>u))),this.dispatch(ha(e));try{return await this.enqueueRequest({description:"Delete form",method:l.DELETE,url:`/forms/${e}/`,blockers:[e],blocks:[]})}catch(u){throw this.dispatch(la(n)),r.length>0&&this.dispatch(To(r)),c.length>0&&this.dispatch(Lt(c)),u}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch organization forms",method:l.GET,url:"/forms/",queryParams:{organization:e},blockers:[e],blocks:[]},i);return this.dispatch(_o(a)),a}}class Yb extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const o of e){const{submissionUuid:h,fieldIdentifier:p,file:A}=o,f=await this.getFilePayload(A);f.sha1 in n||(n[f.sha1]=f);const T=b({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,form_submission:h,submitted_at:i,field_identifier:p});c.push(T);const F={uuid:T.uuid,file_name:A.name,file_sha1:f.sha1,file_extension:f.extension,field_identifier:p,form_submission:h};r.push(F)}this.dispatch(Bt(c));const u=this.enqueueRequest({description:"Attach files to form submission",method:l.POST,url:"/form-submission-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(o=>o.form_submission),blocks:c.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(jo(o.attachments))}).catch(o=>{throw this.dispatch($t(c.map(h=>h.uuid))),o}),[c,u.then(({attachments:o})=>o)]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=zo(e)(a);this.dispatch($t(e));try{await this.enqueueRequest({description:"Delete form submission attachments",method:l.DELETE,url:"/form-submission-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(Bt(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get form submission attachments",method:l.GET,url:"/form-submission-attachments/",queryParams:{limit:E,paginate:!0,form_submission__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get form submission attachments",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Vo(n)),n}}class Kb extends j{add(e){var r;const{store:i}=this.client,a=i.getState(),n=b({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add form submission",method:l.POST,url:"/form-submissions/",payload:v(n),blockers:[e.form_revision,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[n.uuid]});return this.dispatch(fa(n)),c.then(u=>(this.dispatch(Gt(u)),u)).catch(()=>{this.dispatch(ya(n.uuid))}),[n,c]}update(e){const{store:i}=this.client,a=i.getState(),n=Ta(e.uuid)(a);if(!n)throw new Error(`Expected submission with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(Bo(c));const r=this.enqueueRequest({description:"Delete user form submissions",method:l.PATCH,url:`/form-submissions/${c.uuid}/`,payload:e,blockers:[c.uuid],blocks:[c.uuid]});return r.then(u=>{this.dispatch(Gt(u))}).catch(()=>{this.dispatch(Gt(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Ta(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=Uo(e)(a);this.dispatch(ya(e)),this.dispatch($t(c.map(r=>r.uuid)));try{return await this.enqueueRequest({description:"Delete user form submissions",method:l.DELETE,url:`/form-submissions/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(fa(n)),this.dispatch(Bt(c)),r}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Fetch form submissions",method:l.GET,url:"/form-submissions/",queryParams:{limit:E,paginate:!0,project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Fetch form submissions",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(ko(n)),n}}class Zb extends j{async add(e){var p;const{store:i}=this.client,{file:a,...n}=e,c=new Date().toISOString(),r=(p=i.getState().userReducer.currentUser)==null?void 0:p.id,u=n.project,m=await this.getFilePayload(a),o=b({...n,file_name:a.name,file_sha1:m.sha1,file:URL.createObjectURL(a),submitted_at:c,created_by:r});this.dispatch(Ko(o));const h=this.enqueueRequest({description:"Add geo image",method:l.POST,url:"/geo-images/",payload:{uuid:o.uuid,submitted_at:c,title:o.title,description:o.description,geo_marker:o.geo_marker,canvas_marker:o.canvas_marker,sha1:o.file_sha1,project:o.project,file_name:o.file_name,direction:o.direction,original_date:o.original_date,file:m},blocks:[u],blockers:[u]});return h.then(A=>{this.processPresignedUrls(A.presigned_urls),this.dispatch(pt(A.geo_image))}).catch(()=>{this.dispatch(ba(o.uuid))}),[o,h.then(A=>A.geo_image)]}async bulkAdd(e,i){var p;const{store:a}=this.client,n=new Date().toISOString(),c=(p=a.getState().userReducer.currentUser)==null?void 0:p.id,r=[],u=[],m=[],o={};for(const A of e){const{file:f,...T}=A,F=await this.getFilePayload(f);F.sha1 in o||(o[F.sha1]=F);const _=b({...T,file_name:f.name,file_sha1:F.sha1,file:URL.createObjectURL(f),submitted_at:n,created_by:c,project:i});r.push(_),u.push(_.uuid),m.push({uuid:_.uuid,sha1:_.file_sha1,file_name:_.file_name,title:_.title,description:_.description,geo_marker:_.geo_marker,canvas_marker:_.canvas_marker,direction:_.direction,original_date:_.original_date})}this.dispatch(Zo(r));const h=this.enqueueRequest({description:"Bulk add geo images",method:l.POST,url:"/geo-images/bulk/",payload:{submitted_at:n,project:i,geo_images:m,files:Object.values(o)},blocks:[i],blockers:u});return h.then(A=>{this.processPresignedUrls(A.presigned_urls),this.dispatch(Yo(A.geo_images))}).catch(()=>{this.dispatch(Xo(u))}),[r,h.then(A=>A.geo_images)]}update(e){const{store:i}=this.client,a=i.getState(),n=Fa(e.uuid)(a);if(!n)throw new Error(`Map image with uuid ${e.uuid} does not exist in the store`);const c={...n,...e};this.dispatch(Jo(c));const r=this.enqueueRequest({description:"Update geo image",method:l.PATCH,url:`/geo-images/${e.uuid}/`,payload:e,blocks:[e.uuid],blockers:[e.uuid]});return r.then(u=>{this.dispatch(pt(u))}).catch(()=>{this.dispatch(pt(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Fa(e)(a);if(!n)throw new Error(`Map image with uuid ${e} does not exist in the store`);this.dispatch(ba(e));const c=this.enqueueRequest({description:"Delete geo image",method:l.DELETE,url:`/geo-images/${e}/`,blocks:[e],blockers:[e]});return c.catch(()=>{this.dispatch(pt(n))}),c}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get geo images",method:l.GET,url:"/geo-images/",queryParams:{project:e},blocks:[e],blockers:[]},i);return this.dispatch(Wo(a)),a}}class Jb extends R{add(e){var u;const{store:i}=this.client,a=new Date().toISOString(),n=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,c=b({...e,submitted_at:a,created_by:n});this.dispatch(Oa(c));const r=this.enqueueRequest({description:"Add issue association",method:l.POST,url:"/issue-associations/",payload:v(c),blockers:[e.associated_issue,...e.issue?[e.issue]:[],...e.asset?[e.asset]:[]],blocks:[c.uuid]});return r.then(m=>{this.dispatch(il(m))}).catch(()=>{this.dispatch(Ra(c.uuid))}),[c,r]}async delete(e){const{store:i}=this.client,a=al(e)(i.getState());if(!a)throw new Error(`Issue association with uuid ${e} not found in store.`);this.dispatch(Ra(e));const n=this.enqueueRequest({description:"Delete issue association",method:l.DELETE,url:`/issue-associations/${e}/`,blockers:[e],blocks:[]});return n.catch(()=>{this.dispatch(Oa(a))}),n}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Fetch issue associations",method:l.GET,url:"/issue-associations/",queryParams:{limit:E,paginate:!0,associated_issue__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Fetch issue associations",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(sl(n)),n}}class Xb extends He{constructor(){super(...arguments);S(this,"name","Issue Attachment");S(this,"url","/issue-attachments");S(this,"initializeAttachments",Ma);S(this,"addAttachments",Ea);S(this,"updateAttachments",ll);S(this,"removeAttachments",Va);S(this,"removeAttachment",hl);S(this,"setAttachment",ol);S(this,"selectAttachment",fl)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,issue:i.modelUuid})}buildAttachmentPayload(i){return{...i,issue:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.issueUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const c=(await this.performPagination({immediate:!0,description:"Get issue attachments",method:l.GET,url:`${this.url}/`,queryParams:{limit:E,paginate:!0,issue__project:i},blocks:[],blockers:[]},r=>({immediate:!0,description:"Get issue attachments",method:l.GET,url:r,blockers:[],blocks:[]}),a)).flat();return this.dispatch(Ma(c)),c}}class Qb extends He{constructor(){super(...arguments);S(this,"name","Issue Comment Attachment");S(this,"url","/issue-comment-attachments");S(this,"initializeAttachments",qa);S(this,"addAttachments",Il);S(this,"updateAttachments",gl);S(this,"removeAttachments",Fl);S(this,"removeAttachment",bl);S(this,"setAttachment",Tl);S(this,"selectAttachment",_l)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,issue_comment:i.modelUuid})}buildAttachmentPayload(i){return{...i,issue_comment:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.issueCommentUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const c=(await this.performPagination({immediate:!0,description:"Get issue comment attachments",method:l.GET,url:`${this.url}/`,queryParams:{limit:E,paginate:!0,issue_comment__issue__project:i},blocks:[],blockers:[]},r=>({immediate:!0,description:"Get issue comment attachments",method:l.GET,url:r,blockers:[],blocks:[]}),a)).flat();return this.dispatch(qa(c)),c}}class xb extends R{add(e){var c;const{store:i}=this.client,a=b({...e,author:(c=i.getState().userReducer.currentUser)==null?void 0:c.id,submitted_at:new Date().toISOString()});this.dispatch(Ua(a));const n=this.enqueueRequest({description:"Add issue comment",method:l.POST,url:"/issue-comments/",payload:v(a),blockers:[e.issue],blocks:[a.uuid]});return n.catch(()=>{this.dispatch(Ca(a.uuid))}),[a,n]}update(e){const{store:i}=this.client,a=ka(e.uuid)(i.getState());if(!a)throw new Error(`Comment with uuid ${e.uuid} not found in store`);const n={...a,...e};this.dispatch(Da(n));const c=this.enqueueRequest({description:"Edit issue comment",method:l.PATCH,url:`/issue-comments/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.catch(()=>{this.dispatch(Da(a))}),[n,c]}remove(e){const{store:i}=this.client,a=ka(e)(i.getState());if(!a)throw new Error(`Comment with uuid ${e} not found in store`);this.dispatch(Ca(e));const n=this.enqueueRequest({description:"Delete comment",method:l.DELETE,url:`/issue-comments/${e}/`,blockers:[e],blocks:[]});return n.catch(()=>{this.dispatch(Ua(a))}),n}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get comments",method:l.GET,url:"/issue-comments/",queryParams:{issue__project:e},blockers:[],blocks:[]},i);return this.dispatch(wl(a)),a}}class eF extends R{add(e){var m;const{store:i}=this.client,a=i.getState(),n=new Date().toISOString(),c=(m=a.userReducer.currentUser)==null?void 0:m.id,r=b({...e,submitted_at:n,created_by:c});this.dispatch($a(r));const u=this.enqueueRequest({description:"Create issue",method:l.POST,url:"/issues/",payload:v(r),blockers:[r.project,r.issue_type,...r.category?[r.category]:[]],blocks:[r.uuid]});return u.then(o=>{this.dispatch(Ht(o))}).catch(o=>{throw this.dispatch(Ga(r.uuid)),o}),[r,u]}update(e){var m;const i=this.client.store.getState(),a=Ha(e.uuid)(i);if(!a)throw new Error(`Attempting to update an issue with uuid ${e.uuid} that doesn't exist in the store`);const n={...a,...e};this.dispatch(Ht(n));const c={};for(const o of[V.TITLE,V.DESCRIPTION,V.STATUS,V.CATEGORY,V.PRIORITY,V.ASSIGNED_TO,V.DUE_DATE])if(o in e&&e[o]!==a[o])switch(o){case V.PRIORITY:case V.STATUS:{const h=e[o];c[o]=h!==void 0?Number(h):null;break}case V.DUE_DATE:case V.DESCRIPTION:case V.TITLE:c[o]=e[o]??null;break;case V.CATEGORY:{let h=null;const p=e[o];if(p&&(h=i.categoryReducer.instances[p]??null,!h))throw new Error(`Trying to update issue category to ${p} which does not exist in store`);c[o]=h?{name:h.name,color:h.color,uuid:h.uuid}:null;break}case V.ASSIGNED_TO:{let h=null;const p=e[o];if(p&&(h=i.userReducer.instances[p]??null,!h))throw new Error(`Trying to update issue assigned_to to ${p} which does not exist in store`);c[o]=h?{full_name:h.username,id:h.id}:null;break}}const r=b({created_by:(m=i.userReducer.currentUser)==null?void 0:m.id,submitted_at:new Date().toISOString(),issue:a.uuid,changes:c});this.dispatch(Dh(r));const u=this.enqueueRequest({description:"Edit issue",method:l.PATCH,url:`/issues/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return u.catch(()=>{this.dispatch(Ht(a)),this.dispatch(kh(r.uuid))}),[n,u]}async remove(e){const{store:i}=this.client,a=i.getState(),n=Ha(e)(a);if(!n)throw new Error(`No issue with uuid ${e} found in the store`);const c=Al(e)(a),r=Lh(e)(a),u=Go(e)(a),m={};for(const h of nl(e)(a))m[h.uuid]=h;for(const h of cl(e)(a))m[h.uuid]=h;const o=Object.values(m);this.dispatch(Ga(e)),c.length>0&&this.dispatch(Va(c.map(({uuid:h})=>h))),r.length>0&&this.dispatch(Bh(r.map(({uuid:h})=>h))),u.length>0&&this.dispatch(Nt(u.map(({uuid:h})=>h))),o.length>0&&this.dispatch(va(o.map(({uuid:h})=>h)));try{return await this.enqueueRequest({description:"Delete issue",method:l.DELETE,url:`/issues/${e}/`,blockers:[e],blocks:[]})}catch(h){throw this.dispatch($a(n)),this.dispatch(Ea(c)),this.dispatch(Ch(r)),this.dispatch(Lt(u)),this.dispatch(_a(o)),h}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get issues",method:l.GET,url:"/issues/",queryParams:{limit:E,paginate:!0,project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get issues",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(jl(n)),n}}class tF extends He{constructor(){super(...arguments);S(this,"name","Issue Type Attachment");S(this,"url","/issue-type-attachments");S(this,"initializeAttachments",Ya);S(this,"addAttachments",kl);S(this,"updateAttachments",$l);S(this,"removeAttachments",Ll);S(this,"removeAttachment",Gl);S(this,"setAttachment",Bl);S(this,"selectAttachment",Wl)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,issue_type:i.modelUuid})}buildAttachmentPayload(i){return{...i,issue_type:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.issueTypeUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=await this.enqueueRequest({immediate:!0,description:"Get issue type attachments",method:l.GET,url:`${this.url}/`,queryParams:{issue_type__organization:i},blocks:[],blockers:[]},a);return this.dispatch(Ya(n)),n}}class sF extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const o of e){const{fieldsRevisionUuid:h,fieldIdentifier:p,file:A}=o,f=await this.getFilePayload(A);f.sha1 in n||(n[f.sha1]=f);const T=b({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,fields_revision:h,submitted_at:i,field_identifier:p});c.push(T);const F={uuid:T.uuid,file_name:A.name,file_extension:f.extension,field_identifier:p,file_sha1:f.sha1,fields_revision:h};r.push(F)}this.dispatch(Jl(c));const u=this.enqueueRequest({description:"Add issue type fields attachments",method:l.POST,url:"/issue-type-fields-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(o=>o.fields_revision),blocks:c.map(o=>o.uuid)});return u.then(o=>{this.processPresignedUrls(o.presigned_urls),this.dispatch(Xl(o.attachments))}).catch(()=>{this.dispatch(Ql(c.map(o=>o.uuid)))}),[c,u.then(({attachments:o})=>o)]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"get issue type fields attachments",method:l.GET,url:"/issue-type-fields-attachments/",queryParams:{fields_revision__issue_type__organization:e},blockers:[e],blocks:[]},i);return this.dispatch(Zl(a)),a}}class iF extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(dh(c));const r=this.enqueueRequest({description:"Add Issue Type Fields",method:l.POST,url:"/issue-type-fields/",payload:v(c),blockers:[c.issue_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(uh(m))}).catch(m=>{throw this.dispatch(oh(c.uuid)),m}),[c,r]}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get Issue Type Fields",method:l.GET,url:"/issue-type-fields/",queryParams:{issue_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(rh(a)),a}}class aF extends j{async bulkAdd(e){var m;const i=new Date().toISOString(),a=(m=this.client.store.getState().userReducer.currentUser)==null?void 0:m.id,n={},c=[],r=[];for(const o of e){const{fieldValuesUuid:h,fieldIdentifier:p,file:A}=o,f=await this.getFilePayload(A);f.sha1 in n||(n[f.sha1]=f);const T=b({file:URL.createObjectURL(A),file_type:A.type,file_name:A.name,file_sha1:f.sha1,created_by:a,field_values:h,submitted_at:i,field_identifier:p});c.push(T);const F={uuid:T.uuid,file_name:A.name,file_sha1:f.sha1,file_extension:f.extension,field_identifier:p,field_values:h};r.push(F)}this.dispatch(Yt(c));const u=this.enqueueRequest({description:"Add issue type field values attachments",method:l.POST,url:"/issue-type-field-values-attachments/bulk/",payload:{submitted_at:i,attachments:r,files:Object.values(n)},blockers:c.map(o=>o.field_values),blocks:c.map(o=>o.uuid)});return u.then(({presigned_urls:o,attachments:h})=>{this.processPresignedUrls(o),this.dispatch(Ah(h))}).catch(o=>{throw this.dispatch(Kt(c.map(h=>h.uuid))),o}),[c,u.then(({attachments:o})=>o)]}async bulkDelete(e){const{store:i}=this.client,a=i.getState(),n=yh(e)(a);this.dispatch(Kt(e));try{await this.enqueueRequest({description:"Delete issue type field values attachments",method:l.DELETE,url:"/issue-type-field-values-attachments/bulk/",payload:{uuids:e},blockers:e,blocks:[]})}catch(c){throw this.dispatch(Yt(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get issue type field values attachments",method:l.GET,url:"/issue-type-field-values-attachments/",queryParams:{limit:E,paginate:!0,field_values__issue__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get issue type field values attachments",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(ph(n)),n}}class nF extends R{add(e){var r;const{store:i}=this.client,a=i.getState(),n=b({...e,created_by:(r=a.userReducer.currentUser)==null?void 0:r.id,submitted_at:new Date().toISOString()}),c=this.enqueueRequest({description:"Add issue type field values",method:l.POST,url:"/issue-type-field-values/",payload:v(n),blockers:[e.issue,e.fields_revision],blocks:[n.uuid]});return this.dispatch(Ja(n)),c.then(u=>(this.dispatch(ft(u)),u)).catch(()=>{this.dispatch(Xa(n.uuid))}),[n,c]}update(e){const{store:i}=this.client,a=i.getState(),n=xa(e.uuid)(a);if(!n)throw new Error(`Expected IssueTypeFieldValues with uuid ${e.uuid} to exist`);const c={...n,...e};this.dispatch(ft(c));const r=this.enqueueRequest({description:"Update issue type field values",method:l.PATCH,url:`/issue-type-field-values/${e.uuid}/`,payload:e,blockers:[c.uuid,c.fields_revision,c.issue],blocks:[c.uuid]});return r.then(u=>{this.dispatch(ft(u))}).catch(()=>{this.dispatch(ft(n))}),[c,r]}async delete(e){const{store:i}=this.client,a=i.getState(),n=xa(e)(a);if(!n)throw new Error(`Expected submission with uuid ${e} to exist`);const c=Sh(e)(a);this.dispatch(Xa(e)),this.dispatch(Kt(c.map(r=>r.uuid)));try{await this.enqueueRequest({description:"Delete issue type field values",method:l.DELETE,url:`/issue-type-field-values/${e}/`,blockers:[e],blocks:[]})}catch(r){throw this.dispatch(Ja(n)),this.dispatch(Yt(c)),r}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get issue type field values",method:l.GET,url:"/issue-type-field-values/",queryParams:{limit:E,paginate:!0,issue__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get issue type field values",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(ih(n)),n}}class cF extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(nn(c));const r=this.enqueueRequest({description:"Create issue type identifier",method:l.POST,url:"/issue-type-identifiers/",payload:v(c),blockers:[c.issue_type],blocks:[c.uuid]});return r.then(m=>{this.dispatch(yt(m))}).catch(()=>{this.dispatch(cn(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=rn(e.uuid)(i.getState());if(!a)throw new Error(`Expected issue type identifier with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(yt(n));const c=this.enqueueRequest({description:"Update issue type identifier",method:l.PATCH,url:`/issue-type-identifiers/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(yt(r))}).catch(()=>{this.dispatch(yt(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=rn(e)(a);if(!n)throw new Error(`Expected issue type identifier with uuid ${e} to exist`);this.dispatch(cn(e));try{return await this.enqueueRequest({description:"Delete issue type identifier",method:l.DELETE,url:`/issue-type-identifiers/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(nn(n)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({description:"Get issue type identifiers",method:l.GET,url:"/issue-type-identifiers/",queryParams:{issue_type__organization:e},blockers:[],blocks:[]},i);return this.dispatch(gh(a)),a}}class rF extends R{add(e){var u;const{store:i}=this.client,a=(u=i.getState().userReducer.currentUser)==null?void 0:u.id,n=new Date().toISOString(),c=b({...e,created_by:a,submitted_at:n});this.dispatch(un(c));const r=this.enqueueRequest({description:"Create issue type identifier value",method:l.POST,url:"/issue-type-identifier-values/",payload:v(c),blockers:[e.issue,e.issue_type_identifier],blocks:[c.uuid]});return r.then(m=>{this.dispatch(St(m))}).catch(()=>{this.dispatch(on(c.uuid))}),[c,r]}update(e){const{store:i}=this.client,a=hn(e.uuid)(i.getState());if(!a)throw new Error(`Expected issue type identifier value with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(St(n));const c=this.enqueueRequest({description:"Update issue type identifier value",method:l.PATCH,url:`/issue-type-identifier-values/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(St(r))}).catch(()=>{this.dispatch(St(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=hn(e)(a);if(!n)throw new Error(`Expected issue type identifier value with uuid ${e} to exist`);this.dispatch(on(e));try{return await this.enqueueRequest({description:"Delete issue type identifier value",method:l.DELETE,url:`/issue-type-identifier-values/${e}/`,blockers:[e],blocks:[]})}catch(c){throw this.dispatch(un(n)),c}}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get issue type identifier values",method:l.GET,url:"/issue-type-identifier-values/",queryParams:{limit:E,paginate:!0,issue__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get issue type identifier values",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(_h(n)),n}}class dF extends R{add(e){var r;const{store:i}=this.client,a=i.getState(),n=b({...e,submitted_at:new Date().toISOString(),created_by:(r=a.userReducer.currentUser)==null?void 0:r.id});this.dispatch(Eh(n));const c=this.enqueueRequest({method:l.POST,url:"/issue-types/",payload:v(n),blockers:[],blocks:[n.uuid]});return c.then(u=>{this.dispatch(It(u))}).catch(()=>{this.dispatch(pn(n.uuid))}),[n,c]}update(e){const{store:i}=this.client,a=i.getState(),n=fn(e.uuid)(a);if(!n)throw new Error(`IssueType with uuid ${e.uuid} does not exist in the store.`);const c={...n,...e};this.dispatch(Vh(c));const r=this.enqueueRequest({method:l.PATCH,url:`/issue-types/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return r.then(u=>{this.dispatch(It(u))}).catch(()=>{this.dispatch(It(n))}),[c,r]}delete(e){const{store:i}=this.client,a=i.getState(),n=fn(e)(a);if(!n)throw new Error(`IssueType with uuid ${e} does not exist in the store.`);const c=Ul(e)(a);this.dispatch(pn(e)),this.dispatch(zl(c.map(u=>u.uuid)));const r=this.enqueueRequest({method:l.DELETE,url:`/issue-types/${e}/`,blockers:[e],blocks:[]});return r.catch(()=>{this.dispatch(It(n)),this.dispatch(ql(c))}),r}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,method:l.GET,url:"/issue-types/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(Mh(a)),a}}class uF extends R{async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get issue updates",method:l.GET,url:"/issue-updates/",queryParams:{limit:E,paginate:!0,issue__project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get issue updates",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(Uh(n)),n}}const oF=1800;function lF(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 hF extends rb{constructor(){super(...arguments);S(this,"_getRenewedTokens",async i=>{const a=this.enqueueRequest({description:"Get renewed tokens",method:l.POST,url:this.refreshTokensUrl,payload:{refresh:i},isAuthNeeded:!1,blockers:[],blocks:[],checkAuth:!1,immediate:!0});let n;try{n=await a}catch(c){console.error("Could not renew tokens; clearing auth",c),this.clearAuth();return}if(!n.access)throw new Error("Missing access token");return{accessToken:n.access,refreshToken:n.refresh??this.getRefreshToken()}})}clearAuth(){console.debug(this.constructor.name,"clearing auth;"),this.dispatch(Iu(!1)),this.clearTokens(),this.dispatch(g()),this.dispatch(g())}async renewTokens(){const i=this.getRefreshToken();if(!i)throw new Error("No refresh token found");console.debug(this.constructor.name,"renewing tokens");try{const a=await this._getRenewedTokens(i);if(!a)return;console.log("Got renewed tokens"),this.setTokens(a)}catch(a){throw console.error("Could not renew tokens; clearing auth",a),this.clearAuth(),a}}tokenIsExpiringSoon(){const i=this.getAccessToken();if(!i)return!1;const a=Date.now()/1e3;let n;try{n=Up(i).exp??a}catch{n=a}return n-a<oF}getAuthHeader(){return`Bearer ${this.getAccessToken()}`}async prepareAuth(){if(this.tokenIsExpiringSoon()){console.debug(this.constructor.name,"preparing auth");try{await this.renewTokens()}catch(i){return i instanceof D&&this.clearAuth(),i instanceof Error?Promise.reject(i):Promise.reject(new Error((i??xe).toString()))}}}async handleUnauthorized(i,a){const n=this.client.store.getState();if(i.url.endsWith("/token/refresh/"))throw n.authReducer.isLoggedIn&&console.warn("No signed-in user to sign out."),this.clearAuth(),new D({message:"You have been signed out due to inactivity.",response:a,discard:!0});if(n.authReducer.isLoggedIn)await this.renewTokens();else throw console.debug("Forbidden; user is not logged in."),new D({message:"Incorrect username or password.",response:a,discard:!0})}async initAuth(i){const a=Je.v4();return console.debug(this.constructor.name,"Initiating auth"),this.enqueueRequest({uuid:a,description:"Get token pair",method:l.POST,url:this.initTokensUrl,payload:i,isAuthNeeded:!1,checkAuth:!1,immediate:!0,blockers:[],blocks:[]}).then(n=>{this.setTokens(lF(n))})}}class mF extends R{update(e){const{store:i}=this.client,a=bn(e.uuid)(i.getState()),n={...a,...e};this.dispatch(Jt(n));const c=this.enqueueRequest({description:"Edit organization access",method:l.PATCH,url:`/organization-accesses/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(Jt(r))}).catch(r=>{throw this.dispatch(Jt(a)),r}),[n,c]}async remove(e){const{store:i}=this.client,a=i.getState(),n=bn(e)(a),c=Xh(n.user)(a);this.dispatch(tm(n.uuid)),this.dispatch(Kh(n.user));try{await this.enqueueRequest({description:"Remove organization access",method:l.DELETE,url:`/organization-accesses/${n.uuid}/`,blockers:[n.uuid],blocks:[]})}catch(r){throw this.dispatch(em(n)),this.dispatch(Yh(c)),r}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get organization accesses",method:l.GET,url:"/organization-accesses/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(xh(a)),a}}class pF extends R{async add(e){const i=await this.enqueueRequest({description:"Create organization",method:l.POST,url:"/organizations/",payload:e,blockers:[],blocks:[]});return this.dispatch(cm(i)),i}async update(e){const i=await this.enqueueRequest({description:"Edit organization",method:l.PATCH,url:`/organizations/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[e.uuid]});return this.dispatch(rm(i)),i}async invite(e,i){return this.enqueueRequest({description:"Invite user to organization",method:l.POST,url:`/organizations/${e}/invite/${i}/`,blockers:[],blocks:[]})}async refreshStore(e){const i=await this.enqueueRequest({immediate:!0,description:"Fetch organizations",method:l.GET,url:"/organizations/",blockers:[],blocks:[]},e);return this.dispatch(nm(i)),i}}class AF extends R{add(e){var c;const{store:i}=this.client,a=b({...e,created_by:(c=i.getState().userReducer.currentUser)==null?void 0:c.id});this.dispatch(_n(a));const n=this.enqueueRequest({description:"Add project access",method:l.POST,url:"/project-accesses/",payload:v(a),blockers:[a.organization_access,a.project],blocks:[a.uuid]});return n.then(r=>{this.dispatch(Tt(r))}).catch(r=>{throw this.dispatch(vn(a.uuid)),r}),[a,n]}bulkAdd(e){var r;const{store:i}=this.client,a=(r=i.getState().userReducer.currentUser)==null?void 0:r.id,n=e.map(u=>b({...u,created_by:a}));this.dispatch(Rn(n));const c=this.enqueueRequest({description:"Add project accesses",method:l.POST,url:"/project-accesses/bulk/",payload:{project_accesses:n.map(u=>v(u))},blockers:n.flatMap(u=>[u.project,u.organization_access]),blocks:n.map(u=>u.uuid)});return c.then(u=>{this.dispatch(Sm(u))}).catch(u=>{throw this.dispatch(wn(n.map(m=>m.uuid))),u}),[n,c]}update(e){const{store:i}=this.client,a=En(e.uuid)(i.getState()),n={...a,...e};this.dispatch(Tt(n));const c=this.enqueueRequest({description:"Edit project access",method:l.PATCH,url:`/project-accesses/${e.uuid}/`,payload:e,blockers:[e.uuid],blocks:[]});return c.then(r=>{this.dispatch(Tt(r))}).catch(r=>{throw this.dispatch(Tt(a)),r}),[n,c]}async remove(e){const{store:i}=this.client,a=En(e)(i.getState());this.dispatch(vn(e));try{await this.enqueueRequest({description:"Delete project access",method:l.DELETE,url:`/project-accesses/${e}/`,blockers:[e],blocks:[]})}catch(n){throw this.dispatch(_n(a)),n}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Get project accesses",method:l.GET,url:"/project-accesses/",queryParams:{project__organization:e},blockers:[],blocks:[]},i);return this.dispatch(ym(a)),a}}class fF extends He{constructor(){super(...arguments);S(this,"name","Project Attachment");S(this,"url","/project-attachments");S(this,"addAttachments",Fm);S(this,"updateAttachments",_m);S(this,"removeAttachments",jn);S(this,"removeAttachment",Rm);S(this,"setAttachment",Pm);S(this,"selectAttachment",Mm)}buildOfflineAttachment(i){return b({file:URL.createObjectURL(i.file),file_sha1:i.file_sha1,created_by:i.created_by,file_name:i.file.name,file_type:i.file.type,submitted_at:i.submitted_at,description:i.description,project:i.modelUuid})}buildAttachmentPayload(i){return{...i,project:i.modelUuid}}async bulkAdd(i){return this._bulkAdd(i.map(a=>({modelUuid:a.projectUuid,file:a.file})))}async delete(i){return this._delete(i)}async refreshStore(i,a){const n=await this.enqueueRequest({immediate:!0,description:"Get project attachments",method:l.GET,url:`${this.url}/`,queryParams:{project__organization:i},blockers:[],blocks:[]},a);return this.dispatch(bm(n)),n}}class yF extends R{async saveExisting(e){if(!e.uuid)throw new Error("You can only use this method to save existing project files. The one provided has no uuid.");const i={...e};delete i.file;const a=this.enqueueRequest({method:l.PATCH,url:`/project-files/${e.uuid}/`,payload:i,blockers:[e.uuid],blocks:[e.uuid]});return a.then(n=>{this.dispatch(zn(n))}),a}saveActive(){const{store:e}=this.client,i=e.getState(),a=i.projectFileReducer.activeProjectFileId;if(!a)throw new Error("No active project file");const n=i.projectFileReducer.instances[a];if(!n)throw new Error("No active project file");if(!n.bounds&&!n.canvas_bounds)throw new Error("Project file must either have bounds or canvas_bounds set");let c;if(typeof n.file=="string"&&!n.file.startsWith("blob:")){const m={...n};delete m.file,c={method:l.PATCH,url:`/project-files/${a}/`,payload:m,blockers:[a],blocks:[a]}}else c=new Promise((m,o)=>{this.client.files.uploadFileToS3(n.file_sha1).then(([h])=>{m({method:l.POST,url:`/project-files/${n.project}/`,payload:{...n,...h},blockers:[a],blocks:[a]})}).catch(o)});const u=Promise.resolve(c).then(m=>this.enqueueRequest(m));return u.then(m=>{this.dispatch(zn(m))}),this.dispatch(Bm),this.dispatch(km(null)),this.dispatch(Cm(!1)),[n,u]}delete(e){return this.dispatch(Um(e)),this.enqueueRequest({method:l.DELETE,url:`/project-files/${e}`,blockers:[e],blocks:[]})}async refreshStore(e,i){const n=(await this.performPagination({immediate:!0,description:"Get project files",method:l.GET,url:"/project-files/",queryParams:{limit:E,paginate:!0,project:e},blockers:[],blocks:[]},c=>({immediate:!0,description:"Get project files",method:l.GET,url:c,blockers:[],blocks:[]}),i)).flat();return this.dispatch(qm(n)),n}}class SF extends R{async add(e){const i=await this.enqueueRequest({description:"Create project",method:l.POST,url:"/projects/",payload:v(e),blockers:[],blocks:[]});return this.dispatch(Dn(i)),i}async update(e){if(!e.bounds&&!e.canvas_bounds)throw new Error("Project must either have bounds or canvas_bounds set");return this.dispatch(Wm(e)),await this.enqueueRequest({description:"Update project",method:l.PATCH,url:`/projects/${e.uuid}/`,payload:{name:e.name,bounds:e.bounds},blockers:[e.uuid],blocks:[e.uuid]})}async delete(e){const{store:i}=this.client,a=i.getState(),n=Zm(e)(a);if(!n)throw new Error("Expected project to exist");const c=Gm(a).filter(m=>m.project===e);this.dispatch(Dm(c.map(({uuid:m})=>m)));const r=Em(n.uuid)(a);this.dispatch(jn(r.map(({uuid:m})=>m)));const u=Tm(e)(a);this.dispatch(wn(u.map(({uuid:m})=>m))),this.dispatch(Cn(n.uuid));try{await this.enqueueRequest({description:"Delete project",method:l.DELETE,url:`/projects/${e}/`,blockers:[e],blocks:[]}),this.dispatch(Cn(n.uuid))}catch(m){throw this.dispatch(Dn(n)),this.dispatch(Rn(Object.values(u))),this.dispatch(zm(c)),this.dispatch(Om(r)),m}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch projects",method:l.GET,url:"/projects/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(Hm(a)),a}}class IF extends R{add(e){var c;const{store:i}=this.client,a=b({...e,created_by:(c=i.getState().userReducer.currentUser)==null?void 0:c.id});this.dispatch(xm(a));const n=this.enqueueRequest({description:"Create team membership",method:l.POST,url:"/team-memberships/",payload:v(a),blockers:[e.team],blocks:[a.uuid]});return n.then(r=>{this.dispatch(Gn(r))}).catch(()=>{this.dispatch(Ln(a.uuid))}),[a,n]}bulkAdd(e){var r;const{store:i}=this.client,a=(r=i.getState().userReducer.currentUser)==null?void 0:r.id,n=e.map(u=>b({...u,created_by:a}));this.dispatch(ep(n));const c=this.enqueueRequest({description:"Create team memberships",method:l.POST,url:"/team-memberships/bulk/",payload:{team_memberships:n.map(u=>v(u))},blockers:n.map(u=>u.team),blocks:n.map(u=>u.uuid)});return c.then(u=>{this.dispatch(tp(u))}).catch(()=>{this.dispatch(sp(n.map(u=>u.uuid)))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=np(e)(a);if(!n)throw new Error(`Expected team membership with uuid ${e} to exist`);this.dispatch(Ln(e));try{return await this.enqueueRequest({description:"Delete team membership",method:l.DELETE,url:`/team-memberships/${e}/`,blockers:[e],blocks:[e]})}catch(c){throw this.dispatch(Gn(n)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch team memberships",method:l.GET,url:"/team-memberships/",queryParams:{team__organization:e},blockers:[],blocks:[]},i);return this.dispatch(Qm(a)),a}}class TF extends R{add(e){var c;const{store:i}=this.client,a=b({...e,submitted_at:new Date().toISOString(),created_by:(c=i.getState().userReducer.currentUser)==null?void 0:c.id});this.dispatch(dp(a));const n=this.enqueueRequest({description:"Create team",method:l.POST,url:"/teams/",payload:v(a),blockers:[],blocks:[a.uuid]});return n.then(r=>{this.dispatch(gt(r))}).catch(()=>{this.dispatch(Wn(a.uuid))}),[a,n]}update(e){const{store:i}=this.client,a=Kn(e.uuid)(i.getState());if(!a)throw new Error(`Expected team with uuid ${e.uuid} to exist`);const n={...a,...e};this.dispatch(up(n));const c=this.enqueueRequest({description:"Update team",method:l.PATCH,url:`/teams/${e.uuid}/`,payload:v(e),blockers:[e.uuid],blocks:[e.uuid]});return c.then(r=>{this.dispatch(gt(r))}).catch(()=>{this.dispatch(gt(a))}),[n,c]}async delete(e){const{store:i}=this.client,a=i.getState(),n=Kn(e)(a);if(!n)throw new Error(`Expected team with uuid ${e} to exist`);this.dispatch(Wn(e));try{return await this.enqueueRequest({description:"Delete team",method:l.DELETE,url:`/teams/${e}/`,blockers:[e],blocks:[e]})}catch(c){throw this.dispatch(gt(n)),c}}async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch teams",method:l.GET,url:"/teams/",queryParams:{organization:e},blockers:[],blocks:[]},i);return this.dispatch(rp(a)),a}}class gF extends R{async refreshStore(e,i){const a=await this.enqueueRequest({immediate:!0,description:"Fetch organization users",method:l.GET,url:`/organizations/${e}/users/`,blockers:[],blocks:[]},i);return this.dispatch(Wh(a)),a}}class bF{constructor(e){S(this,"store");this.store=e}async enqueueRequest(e,i,a,n){return this._enqueueRequest(e,i,a,n).then(c=>{if(c instanceof D)throw c;return c})}_enqueueRequest(e,i,a,n){const c=new dc,r={...e,BASE_URL:i,serviceName:a};if(e.immediate){const u={...r,uuid:e.uuid??Je.v4()},m={payload:u,type:"",meta:{offline:{effect:{timestamp:new Date().toISOString(),request:u,BASE_URL:i,serviceName:a}}}};Xn(m,this,n).then(o=>{c.resolve(o.body)}).catch(o=>{Qn(o,m),o instanceof Error?c.reject(o):c.reject(new Error((o??xe).toString()))})}else{const u=this.store.dispatch(hm(r)),m=h=>{if(h)c.resolve(h.body);else{const p=new D({message:"Could not get a response from the server.",response:h,discard:!0});c.reject(p)}},o=h=>{h instanceof D?h.options.discard=!0:(console.error("Received an unexpected error while processing a request:",h,`
|
|
15
|
-
Converting error to APIError and discarding.`),h=new D({message:"An error occurred while processing the request.",innerError:h,discard:!0})),c.reject(h)};u.then(m,o)}return c}}class et{constructor(){S(this,"graph");S(this,"requestAttemptCounter");this.graph=new Dp.DepGraph,this.requestAttemptCounter={}}static _fromOutbox(e){const i=new et;for(let a=0;a<e.length;a++){const n=e[a];if(!n){console.error("Outbox item was undefined");continue}i.sneakRequest(n);for(let c=0;c<a;c++){const r=e[c];if(!r){console.error("Previous outbox item was undefined");continue}r.payload.uuid!==n.payload.uuid&&r.payload.blocks.some(u=>n.payload.blockers.includes(u))&&et._addDependency(n.payload.uuid,r.payload.uuid,i.graph)}}return i}_addDependency(e,i){et._addDependency(e,i,this.graph)}static _addDependency(e,i,a){if(e===i)throw new Error(`Tried to add dependency from node to itself: ${e}`);if(!a.hasNode(e))throw new Error(`Tried to add dependency from non-existent node: ${e} (to node: ${i})`);if(!a.hasNode(i))throw new Error(`Tried to add dependency to non-existent node: ${i} (from node: ${e})`);a.addDependency(e,i)}addRequest(e){if(this.graph.addNode(e.payload.uuid,e),!(e.payload.blockers.length===0||this.graph.size()===1))for(const i of this.graph.overallOrder()){if(i===e.payload.uuid)continue;const a=this.graph.getNodeData(i);e.payload.blockers.some(n=>a.payload.blocks.includes(n))&&this._addDependency(e.payload.uuid,i)}}insertRequest(e){this.graph.addNode(e.payload.uuid,e);for(const i of this.graph.overallOrder()){if(i===e.payload.uuid)continue;this.graph.getNodeData(i).payload.blockers.some(n=>e.payload.blocks.includes(n))&&this._addDependency(i,e.payload.uuid)}}sneakRequest(e){this.graph.addNode(e.payload.uuid,e)}_getNextNode(){const e=this.graph.overallOrder(!0);let i=1/0,a;for(const n of e){const c=this.requestAttemptCounter[n]||0;c<i&&(i=c,a=n)}return a}peek(){const e=this._getNextNode();if(e)return this.graph.getNodeData(e)}remove(e){this.graph.removeNode(e),delete this.requestAttemptCounter[e]}pop(){const e=this.peek();return e&&this.graph.removeNode(e.payload.uuid),e}getQueue(){const e=this.graph.overallOrder().map(a=>this.graph.getNodeData(a)),i=this._getNextNode();if(i){const a=this.graph.getNodeData(i),n=e.findIndex(c=>c.payload.uuid===a.payload.uuid);n!==-1&&(e.splice(n,1),e.unshift(a))}return e}getReady(){let e=this.graph.overallOrder(!0).map(i=>this.graph.getNodeData(i));return e=e.sort((i,a)=>i.meta.offline.effect.timestamp.localeCompare(a.meta.offline.effect.timestamp)),e=e.sort((i,a)=>{const n=this.requestAttemptCounter[i.payload.uuid]||0,c=this.requestAttemptCounter[a.payload.uuid]||0;return n-c}),e}registerRetry(e){this.requestAttemptCounter[e]=(this.requestAttemptCounter[e]||0)+1}}const FF=(t,e)=>{const i=new e(t);return $g(i),Bg(t),i};var vp=(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))(vp||{});s.APIError=D,s.AgentService=db,s.AssetAttachmentService=lb,s.AssetProcedureAttachmentService=hb,s.AssetProcedureFieldValuesAttachmentService=Ab,s.AssetProcedureFieldValuesService=fb,s.AssetProcedureFieldsAttachmentService=mb,s.AssetProcedureFieldsService=pb,s.AssetProcedureInstanceService=yb,s.AssetProcedureService=Sb,s.AssetProcedureStepFieldValuesAttachmentService=gb,s.AssetProcedureStepFieldValuesService=bb,s.AssetProcedureStepFieldsAttachmentService=Ib,s.AssetProcedureStepFieldsService=Tb,s.AssetProcedureStepService=Fb,s.AssetService=Pb,s.AssetStageCompletionService=Ob,s.AssetStageService=_b,s.AssetTypeAttachmentService=Rb,s.AssetTypeFieldValuesAttachmentService=Mb,s.AssetTypeFieldValuesService=Eb,s.AssetTypeFieldsAttachmentService=vb,s.AssetTypeFieldsService=wb,s.AssetTypeIdentifierService=Vb,s.AssetTypeIdentifierValueService=jb,s.AssetTypeService=qb,s.AttachmentModel=cc,s.BaseApiService=R,s.BaseSDK=bF,s.COMMON_AUTO_FIELDS=mc,s.CategoryService=zb,s.DEFAULT_ISSUE_PRIORITY=kp,s.DEFAULT_ISSUE_STATUS=Cp,s.DEFAULT_PAGINATION_PAGE_SIZE=E,s.DeferredPromise=dc,s.DocumentAttachmentService=Ub,s.DocumentService=Db,s.EMPTY_ARRAY=ic,s.EMPTY_OBJECT=ac,s.EmailDomainsService=Cb,s.EmailVerificationService=kb,s.FileService=$b,s.FormIdentifierService=Gb,s.FormIdentifierValueService=Lb,s.FormRevisionAttachmentService=Nb,s.FormRevisionService=Hb,s.FormService=Wb,s.FormSubmissionAttachmentService=Yb,s.FormSubmissionService=Kb,s.GeoImageService=Zb,s.HttpMethod=l,s.IssueAssociationService=Jb,s.IssueAttachmentService=Xb,s.IssueCommentAttachmentService=Qb,s.IssueCommentService=xb,s.IssuePriority=es,s.IssueService=eF,s.IssueStatus=ts,s.IssueTypeAttachmentService=tF,s.IssueTypeFieldValuesAttachmentService=aF,s.IssueTypeFieldValuesService=nF,s.IssueTypeFieldsAttachmentService=sF,s.IssueTypeFieldsService=iF,s.IssueTypeIdentifierService=cF,s.IssueTypeIdentifierValueService=rF,s.IssueTypeService=dF,s.IssueUpdateChange=V,s.IssueUpdateService=uF,s.JWTService=hF,s.OUTBOX_RETRY_DELAY=rc,s.OrganizationAccessLevel=nc,s.OrganizationAccessService=mF,s.OrganizationService=pF,s.OutboxCoordinator=et,s.PAGINATION_MAX_PAGE_SIZE=ub,s.PAGINATION_PAGE_SIZE_QUERY_PARAM=ob,s.ProjectAccessService=AF,s.ProjectAttachmentService=fF,s.ProjectFileService=yF,s.ProjectService=SF,s.RESET_ORGANIZATION_STATE=O,s.RESET_PROJECT_STATE=M,s.RESET_STATE=g,s.SelectorBuilder=kg,s.TeamMembershipService=IF,s.TeamService=TF,s.UNKNOWN_ERROR_MESSAGE=xe,s.UserService=gF,s.VERSION_REDUCER_KEY=tt,s.VerificationCodeType=vp,s._setLatestRetryTime=pm,s.addAsset=Xs,s.addAssetAttachment=mA,s.addAssetAttachments=os,s.addAssetProcedure=Ms,s.addAssetProcedureAttachment=fA,s.addAssetProcedureAttachments=jc,s.addAssetProcedureFieldValues=Is,s.addAssetProcedureFieldValuesAttachment=zA,s.addAssetProcedureFieldValuesAttachments=Ot,s.addAssetProcedureFieldValuesMany=hr,s.addAssetProcedureFields=Qc,s.addAssetProcedureFieldsAttachment=TA,s.addAssetProcedureFieldsAttachments=Nc,s.addAssetProcedureFieldsMany=RA,s.addAssetProcedureInstance=Ps,s.addAssetProcedureInstances=Ir,s.addAssetProcedureStep=Ys,s.addAssetProcedureStepFieldValues=Ls,s.addAssetProcedureStepFieldValuesAttachment=Tf,s.addAssetProcedureStepFieldValuesAttachments=Rt,s.addAssetProcedureStepFieldValuesMany=Yr,s.addAssetProcedureStepFields=Us,s.addAssetProcedureStepFieldsAttachment=af,s.addAssetProcedureStepFieldsAttachments=wr,s.addAssetProcedureStepFieldsMany=lf,s.addAssetProcedureSteps=Vf,s.addAssetProcedures=JA,s.addAssetStage=oi,s.addAssetStageCompletion=ai,s.addAssetStageCompletions=ni,s.addAssetStages=Wf,s.addAssetType=zi,s.addAssetTypeAttachment=Qf,s.addAssetTypeAttachments=pi,s.addAssetTypeFieldValues=gi,s.addAssetTypeFieldValuesAttachment=fy,s.addAssetTypeFieldValuesAttachments=Ut,s.addAssetTypeFieldValuesMany=eu,s.addAssetTypeFields=Bd,s.addAssetTypeFieldsAttachment=ty,s.addAssetTypeFieldsAttachments=Vd,s.addAssetTypeFieldsMany=dy,s.addAssetTypeIdentifier=_i,s.addAssetTypeIdentifierValue=Mi,s.addAssetTypeIdentifierValues=Vy,s.addAssetTypeIdentifiers=_y,s.addAssetTypes=$y,s.addAssets=Vt,s.addCategories=Jy,s.addCategory=Bi,s.addConversation=Sc,s.addConversations=cA,s.addDocumentAttachment=iS,s.addDocumentAttachments=wu,s.addDocuments=Bu,s.addEmailDomain=Hu,s.addEmailDomains=oS,s.addForm=la,s.addFormIdentifier=Ji,s.addFormIdentifierValue=ea,s.addFormIdentifierValues=PS,s.addFormIdentifiers=SS,s.addFormRevision=ca,s.addFormRevisionAttachment=ES,s.addFormRevisionAttachments=mo,s.addFormRevisions=To,s.addFormSubmission=fa,s.addFormSubmissionAttachment=ZS,s.addFormSubmissionAttachments=Bt,s.addFormSubmissions=Lt,s.addForms=GS,s.addGeoImage=Ko,s.addGeoImages=Zo,s.addIssue=$a,s.addIssueAssociation=Oa,s.addIssueAssociations=_a,s.addIssueAttachment=dI,s.addIssueAttachments=Ea,s.addIssueComment=Ua,s.addIssueCommentAttachment=lI,s.addIssueCommentAttachments=Il,s.addIssueComments=fI,s.addIssueType=Eh,s.addIssueTypeAttachment=_I,s.addIssueTypeAttachments=kl,s.addIssueTypeFieldValues=Ja,s.addIssueTypeFieldValuesAttachment=QI,s.addIssueTypeFieldValuesAttachments=Yt,s.addIssueTypeFieldValuesMany=DI,s.addIssueTypeFields=dh,s.addIssueTypeFieldsAttachment=MI,s.addIssueTypeFieldsAttachments=Jl,s.addIssueTypeFieldsMany=LI,s.addIssueTypeIdentifier=nn,s.addIssueTypeIdentifierValue=un,s.addIssueTypeIdentifierValues=oT,s.addIssueTypeIdentifiers=aT,s.addIssueTypes=yT,s.addIssueUpdate=Dh,s.addIssueUpdates=Ch,s.addIssues=ql,s.addOrganization=cm,s.addOrganizationAccess=em,s.addOrganizationAccesses=DT,s.addOrganizations=WT,s.addProject=Dn,s.addProjectAccess=_n,s.addProjectAccesses=Rn,s.addProjectAttachment=ng,s.addProjectAttachments=Fm,s.addProjectFile=ug,s.addProjectFiles=zm,s.addProjects=yg,s.addTeam=dp,s.addTeamMembership=xm,s.addTeamMemberships=ep,s.addTeams=wg,s.addUser=Yh,s.addUsers=MT,s.agentsReducer=gc,s.agentsSlice=cs,s.areArraysEqual=Gp,s.assetAttachmentReducer=Mc,s.assetAttachmentSlice=ds,s.assetProcedureAttachmentReducer=Cc,s.assetProcedureAttachmentSlice=hs,s.assetProcedureFieldValuesAttachmentReducer=ur,s.assetProcedureFieldValuesAttachmentSlice=fs,s.assetProcedureFieldValuesReducer=Ar,s.assetProcedureFieldValuesSlice=Ss,s.assetProcedureFieldsAttachmentReducer=Zc,s.assetProcedureFieldsAttachmentSlice=ms,s.assetProcedureFieldsReducer=sr,s.assetProcedureFieldsSlice=ps,s.assetProcedureInstanceReducer=gr,s.assetProcedureInstanceSlice=Fs,s.assetProcedureReducer=Or,s.assetProcedureSlice=ws,s.assetProcedureStepFieldValuesAttachmentReducer=Nr,s.assetProcedureStepFieldValuesAttachmentSlice=Bs,s.assetProcedureStepFieldValuesReducer=Xr,s.assetProcedureStepFieldValuesSlice=Gs,s.assetProcedureStepFieldsAttachmentReducer=qr,s.assetProcedureStepFieldsAttachmentSlice=qs,s.assetProcedureStepFieldsReducer=Dr,s.assetProcedureStepFieldsSlice=zs,s.assetProcedureStepReducer=td,s.assetProcedureStepSlice=Ws,s.assetReducer=rd,s.assetSlice=Js,s.assetStageCompletionReducer=hd,s.assetStageCompletionSlice=ii,s.assetStageReducer=Sd,s.assetStageSlice=ui,s.assetTypeAttachmentReducer=wd,s.assetTypeAttachmentSlice=mi,s.assetTypeFieldValuesAttachmentReducer=Xd,s.assetTypeFieldValuesAttachmentSlice=Si,s.assetTypeFieldValuesReducer=au,s.assetTypeFieldValuesSlice=Ti,s.assetTypeFieldsAttachmentReducer=Dd,s.assetTypeFieldsAttachmentSlice=fi,s.assetTypeFieldsReducer=Nd,s.assetTypeFieldsSlice=yi,s.assetTypeIdentifierReducer=uu,s.assetTypeIdentifierSlice=Oi,s.assetTypeIdentifierValueReducer=mu,s.assetTypeIdentifierValueSlice=wi,s.assetTypeReducer=yu,s.assetTypeSlice=qi,s.authReducer=Tu,s.authSlice=Ct,s.baseReducer=Ug,s.baseReducers=Zn,s.blobToBase64=Xp,s.categoryReducer=_u,s.categorySlice=ki,s.clearTokens=Yy,s.constructUploadedFilePayloads=Jp,s.createModelAdapter=P,s.createOfflineAction=om,s.createPayload=v,s.createSelectionAdapter=Bp,s.deleteAsset=Qs,s.deleteAssetAttachment=Oc,s.deleteAssetAttachments=ls,s.deleteAssetProcedure=Es,s.deleteAssetProcedureAttachment=Uc,s.deleteAssetProcedureAttachments=Dc,s.deleteAssetProcedureFieldValues=Ts,s.deleteAssetProcedureFieldValuesAttachment=kA,s.deleteAssetProcedureFieldValuesAttachments=_t,s.deleteAssetProcedureFieldValuesMany=pr,s.deleteAssetProcedureFields=er,s.deleteAssetProcedureFieldsAttachment=PA,s.deleteAssetProcedureFieldsAttachments=Wc,s.deleteAssetProcedureFieldsMany=EA,s.deleteAssetProcedureInstance=Os,s.deleteAssetProcedureInstances=Tr,s.deleteAssetProcedureStep=Ks,s.deleteAssetProcedureStepFieldValues=Ns,s.deleteAssetProcedureStepFieldValuesAttachment=Pf,s.deleteAssetProcedureStepFieldValuesAttachments=vt,s.deleteAssetProcedureStepFieldValuesMany=Zr,s.deleteAssetProcedureStepFields=Ds,s.deleteAssetProcedureStepFieldsAttachment=df,s.deleteAssetProcedureStepFieldsAttachments=Er,s.deleteAssetProcedureStepFieldsMany=Af,s.deleteAssetProcedureSteps=qf,s.deleteAssetProcedures=QA,s.deleteAssetStage=li,s.deleteAssetStageCompletion=ci,s.deleteAssetStageCompletions=ri,s.deleteAssetStages=Kf,s.deleteAssetType=Ui,s.deleteAssetTypeAttachment=Pd,s.deleteAssetTypeAttachments=Ai,s.deleteAssetTypeFieldValues=bi,s.deleteAssetTypeFieldValuesAttachment=Ty,s.deleteAssetTypeFieldValuesAttachments=Dt,s.deleteAssetTypeFieldValuesMany=su,s.deleteAssetTypeFields=Gd,s.deleteAssetTypeFieldsAttachment=ny,s.deleteAssetTypeFieldsAttachments=qd,s.deleteAssetTypeFieldsMany=hy,s.deleteAssetTypeIdentifier=Ri,s.deleteAssetTypeIdentifierValue=Ei,s.deleteAssetTypeIdentifierValues=Uy,s.deleteAssetTypeIdentifiers=My,s.deleteAssetTypes=Ly,s.deleteAssets=xs,s.deleteCategories=eS,s.deleteCategory=Pu,s.deleteConversation=uA,s.deleteConversations=oA,s.deleteDocumentAttachment=Vu,s.deleteDocumentAttachments=ju,s.deleteEmailDomain=Wu,s.deleteEmailDomains=AS,s.deleteForm=ha,s.deleteFormIdentifier=Xi,s.deleteFormIdentifierValue=ta,s.deleteFormIdentifierValues=vS,s.deleteFormIdentifiers=bS,s.deleteFormRevision=ra,s.deleteFormRevisionAttachment=zS,s.deleteFormRevisionAttachments=Ao,s.deleteFormRevisions=bo,s.deleteFormSubmission=ya,s.deleteFormSubmissionAttachment=xS,s.deleteFormSubmissionAttachments=$t,s.deleteFormSubmissions=Nt,s.deleteForms=YS,s.deleteGeoImage=ba,s.deleteGeoImages=Xo,s.deleteIssue=Ga,s.deleteIssueAssociation=Ra,s.deleteIssueAssociations=va,s.deleteIssueAttachment=hl,s.deleteIssueAttachments=Va,s.deleteIssueComment=Ca,s.deleteIssueCommentAttachment=bl,s.deleteIssueCommentAttachments=Fl,s.deleteIssueComments=II,s.deleteIssueType=TT,s.deleteIssueTypeAttachment=Gl,s.deleteIssueTypeAttachments=Ll,s.deleteIssueTypeFieldValues=Xa,s.deleteIssueTypeFieldValuesAttachment=sT,s.deleteIssueTypeFieldValuesAttachments=Kt,s.deleteIssueTypeFieldValuesMany=$I,s.deleteIssueTypeFields=oh,s.deleteIssueTypeFieldsAttachment=qI,s.deleteIssueTypeFieldsAttachments=Ql,s.deleteIssueTypeFieldsMany=YI,s.deleteIssueTypeIdentifier=cn,s.deleteIssueTypeIdentifierValue=on,s.deleteIssueTypeIdentifierValues=pT,s.deleteIssueTypeIdentifiers=dT,s.deleteIssueTypes=gT,s.deleteIssueUpdate=kh,s.deleteIssueUpdates=Bh,s.deleteIssues=zl,s.deleteOrganization=KT,s.deleteOrganizationAccess=tm,s.deleteOrganizationAccesses=$T,s.deleteOrganizations=ZT,s.deleteProject=Cn,s.deleteProjectAccess=vn,s.deleteProjectAccesses=wn,s.deleteProjectAttachment=Rm,s.deleteProjectAttachments=jn,s.deleteProjectFile=Um,s.deleteProjectFiles=Dm,s.deleteProjects=Ig,s.deleteTeam=Wn,s.deleteTeamMembership=Ln,s.deleteTeamMemberships=sp,s.deleteTeams=Vg,s.deleteUser=Kh,s.deleteUsers=jT,s.dequeue=Pp,s.discard=Qn,s.documentAttachmentReducer=Du,s.documentAttachmentSlice=Li,s.documentSlice=Ni,s.documentsReducer=Gu,s.downloadFile=Qp,s.downloadInMemoryFile=Zp,s.emailDomainsReducer=Zu,s.emailDomainsSlice=Yi,s.emailRegex=nA,s.enqueue=Fp,s.enqueueRequest=hm,s.fallbackToEmptyArray=I,s.fallbackToEmptyObject=Pt,s.fileReducer=eo,s.fileSlice=Ki,s.fileToBlob=lc,s.formIdentifierReducer=no,s.formIdentifierSlice=Zi,s.formIdentifierValueReducer=oo,s.formIdentifierValueSlice=xi,s.formReducer=Ro,s.formRevisionAttachmentReducer=yo,s.formRevisionAttachmentSlice=aa,s.formRevisionReducer=Po,s.formRevisionsSlice=na,s.formSlice=oa,s.formSubmissionAttachmentReducer=Do,s.formSubmissionAttachmentSlice=ma,s.formSubmissionReducer=No,s.formSubmissionSlice=Aa,s.geoImageReducer=el,s.geoImageSlice=ga,s.getFileIdentifier=Kp,s.getFileS3Key=ns,s.getLocalDateString=uc,s.getLocalRelativeDateString=Wp,s.getOutboxCoordinator=Ye,s.getRenamedFile=oc,s.hashFile=Xe,s.initSDK=FF,s.initializeAssetAttachments=us,s.initializeAssetProcedureAttachments=Vc,s.initializeAssetProcedureFieldValues=lr,s.initializeAssetProcedureFieldValuesAttachments=ar,s.initializeAssetProcedureFields=Xc,s.initializeAssetProcedureFieldsAttachments=Lc,s.initializeAssetProcedureInstances=Sr,s.initializeAssetProcedureStepFieldValues=Wr,s.initializeAssetProcedureStepFieldValuesAttachments=kr,s.initializeAssetProcedureStepFields=Ur,s.initializeAssetProcedureStepFieldsAttachments=vr,s.initializeAssetProcedureSteps=xr,s.initializeAssetProcedures=Pr,s.initializeAssetStageCompletions=ud,s.initializeAssetStages=fd,s.initializeAssetTypeAttachments=gd,s.initializeAssetTypeFieldValues=xd,s.initializeAssetTypeFieldValuesAttachments=Wd,s.initializeAssetTypeFields=kd,s.initializeAssetTypeFieldsAttachments=Ed,s.initializeAssetTypeIdentifierValues=lu,s.initializeAssetTypeIdentifiers=cu,s.initializeAssetTypes=Au,s.initializeAssets=ad,s.initializeCategories=bu,s.initializeConversations=yc,s.initializeDocumentAttachments=vu,s.initializeEmailDomains=Nu,s.initializeFormIdentifierValues=ro,s.initializeFormIdentifiers=so,s.initializeFormRevisionAttachments=ho,s.initializeFormRevisions=Io,s.initializeFormSubmissionAttachments=Vo,s.initializeFormSubmissions=ko,s.initializeForms=_o,s.initializeGeoImages=Wo,s.initializeIssueAssociations=sl,s.initializeIssueAttachments=Ma,s.initializeIssueCommentAttachments=qa,s.initializeIssueComments=AI,s.initializeIssueTypeAttachments=Ya,s.initializeIssueTypeFieldValues=ih,s.initializeIssueTypeFieldValuesAttachments=ph,s.initializeIssueTypeFields=rh,s.initializeIssueTypeFieldsAttachments=Zl,s.initializeIssueTypeIdentifierValues=_h,s.initializeIssueTypeIdentifiers=gh,s.initializeIssueTypes=Mh,s.initializeIssueUpdates=Uh,s.initializeIssues=jl,s.initializeOrganizationAccesses=xh,s.initializeOrganizations=nm,s.initializeProjectAccesses=ym,s.initializeProjectAttachments=bm,s.initializeProjectFiles=qm,s.initializeProjects=Hm,s.initializeTeamMemberships=Qm,s.initializeTeams=rp,s.initializeUsers=Wh,s.isToday=Hp,s.issueAssociationReducer=dl,s.issueAssociationSlice=Pa,s.issueAttachmentReducer=yl,s.issueAttachmentSlice=wa,s.issueCommentAttachmentReducer=Rl,s.issueCommentAttachmentSlice=ja,s.issueCommentReducer=El,s.issueCommentSlice=za,s.issueReducer=Dl,s.issueSlice=Ba,s.issueTypeAttachmentReducer=Yl,s.issueTypeAttachmentSlice=Wa,s.issueTypeFieldValuesAttachmentReducer=Ih,s.issueTypeFieldValuesAttachmentSlice=tn,s.issueTypeFieldValuesReducer=nh,s.issueTypeFieldValuesSlice=Za,s.issueTypeFieldsAttachmentReducer=th,s.issueTypeFieldsAttachmentSlice=Ka,s.issueTypeFieldsReducer=hh,s.issueTypeFieldsSlice=en,s.issueTypeIdentifierReducer=Ph,s.issueTypeIdentifierSlice=an,s.issueTypeIdentifierValueReducer=vh,s.issueTypeIdentifierValueSlice=dn,s.issueTypeReducer=qh,s.issueTypeSlice=mn,s.issueUpdateReducer=Nh,s.issueUpdateSlice=yn,s.logOnlyOnce=xp,s.markAsDeleted=mm,s.markForDeletion=eg,s.memoize=is,s.offline=b,s.onlyUniqueHashes=aA,s.onlyUniqueOfflineIds=Ac,s.organizationAccessReducer=sm,s.organizationAccessSlice=Tn,s.organizationReducer=um,s.organizationSlice=Fn,s.outboxReducer=Am,s.outboxSlice=Pn,s.overmapEnhancer=Jg,s.overmapReducer=Dg,s.overmapReducers=pp,s.performRequest=Xn,s.projectAccessReducer=Im,s.projectAccessSlice=On,s.projectAttachmentReducer=Vm,s.projectAttachmentSlice=Vn,s.projectFileReducer=Lm,s.projectFileSlice=qn,s.projectReducer=Ym,s.projectSlice=Un,s.rehydratedReducer=Jm,s.rehydratedSlice=Bn,s.removeDocuments=Hi,s.removeIssueType=pn,s.resetProjectFileObjectUrls=lg,s.restructureCreateSelectorWithArgs=y,s.saveActiveProjectFileBounds=Bm,s.selectAccessToken=Ky,s.selectAccessesByUserOfProject=ig,s.selectAccessibleProjects=Tg,s.selectActiveOrganizationAccess=GT,s.selectActiveProjectFileId=mg,s.selectAllDocumentAttachments=zu,s.selectAllProjectAttachments=wm,s.selectAssetAttachmentById=vc,s.selectAssetAttachmentMapping=_c,s.selectAssetAttachments=Rc,s.selectAssetById=si,s.selectAssetProcedureAttachmentById=$c,s.selectAssetProcedureAttachmentMapping=kc,s.selectAssetProcedureAttachments=Bc,s.selectAssetProcedureById=js,s.selectAssetProcedureFieldValues=gs,s.selectAssetProcedureFieldValuesAttachmentById=BA,s.selectAssetProcedureFieldValuesAttachments=cr,s.selectAssetProcedureFieldValuesAttachmentsByIds=rr,s.selectAssetProcedureFieldValuesAttachmentsMapping=ys,s.selectAssetProcedureFieldValuesById=bs,s.selectAssetProcedureFieldValuesMapping=fr,s.selectAssetProcedureFieldValuesOfAsset=LA,s.selectAssetProcedureFields=As,s.selectAssetProcedureFieldsAttachmentById=_A,s.selectAssetProcedureFieldsAttachments=Kc,s.selectAssetProcedureFieldsAttachmentsMapping=Yc,s.selectAssetProcedureFieldsById=qA,s.selectAssetProcedureFieldsMapping=tr,s.selectAssetProcedureFieldsOfAssetProcedure=VA,s.selectAssetProcedureInstanceById=vs,s.selectAssetProcedureInstances=Rs,s.selectAssetProcedureInstancesByIds=ZA,s.selectAssetProcedureInstancesMapping=_s,s.selectAssetProcedureInstancesOfAssetProcedure=br,s.selectAssetProcedureInstancesOfAssetType=KA,s.selectAssetProcedureStepById=Zs,s.selectAssetProcedureStepFieldValues=wt,s.selectAssetProcedureStepFieldValuesAttachmentById=Of,s.selectAssetProcedureStepFieldValuesAttachments=$r,s.selectAssetProcedureStepFieldValuesAttachmentsByIds=Gr,s.selectAssetProcedureStepFieldValuesAttachmentsMapping=$s,s.selectAssetProcedureStepFieldValuesById=Hs,s.selectAssetProcedureStepFieldValuesMapping=Jr,s.selectAssetProcedureStepFieldValuesOfAsset=vf,s.selectAssetProcedureStepFieldValuesOfAssetProcedureInstance=wf,s.selectAssetProcedureStepFieldValuesOfAssetProcedureStep=Mf,s.selectAssetProcedureStepFields=ks,s.selectAssetProcedureStepFieldsAttachmentById=of,s.selectAssetProcedureStepFieldsAttachments=jr,s.selectAssetProcedureStepFieldsAttachmentsMapping=Vr,s.selectAssetProcedureStepFieldsById=If,s.selectAssetProcedureStepFieldsMapping=Cs,s.selectAssetProcedureStepFieldsOfAssetProcedureStep=ff,s.selectAssetProcedureStepMapping=Et,s.selectAssetProcedureSteps=sd,s.selectAssetProcedureStepsByIds=Df,s.selectAssetProcedureStepsMappingOfAssetProcedure=zf,s.selectAssetProcedureStepsOfAssetProcedure=Uf,s.selectAssetProcedures=_r,s.selectAssetProceduresByIds=tf,s.selectAssetProceduresMapping=Vs,s.selectAssetProceduresOfOrganization=sf,s.selectAssetStageById=hi,s.selectAssetStageCompletionById=md,s.selectAssetStageCompletionMapping=di,s.selectAssetStageCompletions=Nf,s.selectAssetStageCompletionsByIds=pd,s.selectAssetStages=Id,s.selectAssetStagesByIds=Xf,s.selectAssetStagesMappingOfAssetProcedure=Zf,s.selectAssetStagesOfAssetProcedure=Jf,s.selectAssetTypeAttachmentById=Rd,s.selectAssetTypeAttachmentMapping=Od,s.selectAssetTypeAttachments=_d,s.selectAssetTypeById=Ci,s.selectAssetTypeFieldValues=Fi,s.selectAssetTypeFieldValuesAttachmentById=gy,s.selectAssetTypeFieldValuesAttachments=Kd,s.selectAssetTypeFieldValuesAttachmentsByIds=Zd,s.selectAssetTypeFieldValuesAttachmentsMapping=Ii,s.selectAssetTypeFieldValuesById=Pi,s.selectAssetTypeFieldValuesMapping=iu,s.selectAssetTypeFieldValuesOfAsset=Py,s.selectAssetTypeFields=zt,s.selectAssetTypeFieldsAttachmentById=ry,s.selectAssetTypeFieldsAttachments=Ud,s.selectAssetTypeFieldsAttachmentsMapping=zd,s.selectAssetTypeFieldsById=Ay,s.selectAssetTypeFieldsMapping=Ld,s.selectAssetTypeFieldsOfAssetType=my,s.selectAssetTypeIdentifierById=vi,s.selectAssetTypeIdentifierMapping=ru,s.selectAssetTypeIdentifierValueById=ji,s.selectAssetTypeIdentifierValueMapping=hu,s.selectAssetTypeIdentifierValues=Vi,s.selectAssetTypeIdentifierValuesOfAsset=Dy,s.selectAssetTypeIdentifierValuesOfIdentifier=Cy,s.selectAssetTypeIdentifiers=du,s.selectAssetTypeIdentifiersOfAssetType=Ey,s.selectAssetTypeValuesOfAssetType=Oy,s.selectAssetTypes=fu,s.selectAssetTypesByIds=Ny,s.selectAssetTypesMapping=Di,s.selectAssetTypesOfOrganization=Hy,s.selectAssets=nd,s.selectAssetsByIds=cd,s.selectAssetsMapping=ei,s.selectAssetsOfAssetType=ti,s.selectAttachmentsOfAsset=wc,s.selectAttachmentsOfAssetProcedure=IA,s.selectAttachmentsOfAssetProcedureFieldValues=dr,s.selectAttachmentsOfAssetProcedureFields=OA,s.selectAttachmentsOfAssetProcedureStepFieldValues=Lr,s.selectAttachmentsOfAssetProcedureStepFields=uf,s.selectAttachmentsOfAssetType=vd,s.selectAttachmentsOfAssetTypeFieldValues=Jd,s.selectAttachmentsOfAssetTypeFields=cy,s.selectAttachmentsOfDocument=cS,s.selectAttachmentsOfFormRevision=US,s.selectAttachmentsOfFormSubmission=Uo,s.selectAttachmentsOfIssue=Al,s.selectAttachmentsOfIssueComment=pI,s.selectAttachmentsOfIssueType=wI,s.selectAttachmentsOfIssueTypeFieldValues=Sh,s.selectAttachmentsOfIssueTypeFields=zI,s.selectAttachmentsOfProject=Em,s.selectCategories=Ou,s.selectCategoriesByIds=tS,s.selectCategoriesOfProject=sS,s.selectCategoryById=Gi,s.selectCategoryMapping=$i,s.selectCommentsOfIssue=TI,s.selectConversation=hA,s.selectConversationMapping=rs,s.selectConversations=lA,s.selectCurrentUser=Jh,s.selectDeletedRequests=QT,s.selectDocumentAttachmentById=Uu,s.selectDocumentAttachmentMapping=qu,s.selectDocumentById=$u,s.selectDocuments=Wi,s.selectDocumentsByIds=rS,s.selectDocumentsMapping=kt,s.selectEmailDomains=Ku,s.selectEmailDomainsAsMapping=Yu,s.selectEmailDomainsOfOrganization=fS,s.selectFieldValuesOfAssetProcedureInstance=NA,s.selectFormById=Mo,s.selectFormIdentifierById=Qi,s.selectFormIdentifierMapping=io,s.selectFormIdentifierValueById=ia,s.selectFormIdentifierValueMapping=uo,s.selectFormIdentifierValues=sa,s.selectFormIdentifierValuesOfFormSubmission=wS,s.selectFormIdentifierValuesOfIdentifier=MS,s.selectFormIdentifiers=ao,s.selectFormIdentifiersOfForm=FS,s.selectFormMapping=vo,s.selectFormRevisionAttachmentsMapping=fo,s.selectFormRevisionById=BS,s.selectFormRevisionMapping=da,s.selectFormRevisions=ua,s.selectFormRevisionsOfForm=Fo,s.selectFormSubmissionAttachemntsByIds=zo,s.selectFormSubmissionAttachments=pa,s.selectFormSubmissionAttachmentsMapping=qo,s.selectFormSubmissionById=Ta,s.selectFormSubmissions=Ia,s.selectFormSubmissionsMapping=Sa,s.selectFormSubmissionsOfAsset=Lo,s.selectFormSubmissionsOfForm=$o,s.selectFormSubmissionsOfIssue=Go,s.selectForms=wo,s.selectFormsOfOrganization=KS,s.selectGeoImageById=Fa,s.selectGeoImageMapping=Qo,s.selectGeoImages=xo,s.selectGeoImagesOfProject=iI,s.selectIsImportingProjectFile=pg,s.selectIsLoggedIn=Zy,s.selectIssueAssociationById=al,s.selectIssueAssociationMapping=At,s.selectIssueAssociations=rI,s.selectIssueAssociationsOfAsset=rl,s.selectIssueAssociationsOfIssue=cl,s.selectIssueAssociationsToIssue=nl,s.selectIssueAttachmentById=fl,s.selectIssueAttachmentMapping=ml,s.selectIssueAttachments=pl,s.selectIssueById=Ha,s.selectIssueCommentAttachmentById=_l,s.selectIssueCommentAttachmentMapping=Pl,s.selectIssueCommentAttachments=Ol,s.selectIssueCommentById=ka,s.selectIssueCommentMapping=Ml,s.selectIssueMapping=La,s.selectIssueTypeAttachmentById=Wl,s.selectIssueTypeAttachmentMapping=Nl,s.selectIssueTypeAttachments=Hl,s.selectIssueTypeById=fn,s.selectIssueTypeFieldValues=Qa,s.selectIssueTypeFieldValuesAttachmentById=iT,s.selectIssueTypeFieldValuesAttachments=sn,s.selectIssueTypeFieldValuesAttachmentsByIds=yh,s.selectIssueTypeFieldValuesAttachmentsMapping=fh,s.selectIssueTypeFieldValuesById=xa,s.selectIssueTypeFieldValuesMapping=ah,s.selectIssueTypeFieldValuesOfIssue=GI,s.selectIssueTypeFields=Wt,s.selectIssueTypeFieldsAttachmentById=UI,s.selectIssueTypeFieldsAttachments=eh,s.selectIssueTypeFieldsAttachmentsMapping=xl,s.selectIssueTypeFieldsById=XI,s.selectIssueTypeFieldsMapping=lh,s.selectIssueTypeFieldsOfIssueType=KI,s.selectIssueTypeIdentifierById=rn,s.selectIssueTypeIdentifierMapping=bh,s.selectIssueTypeIdentifierValueById=hn,s.selectIssueTypeIdentifierValueMapping=Rh,s.selectIssueTypeIdentifierValues=ln,s.selectIssueTypeIdentifierValuesOfIdentifier=fT,s.selectIssueTypeIdentifierValuesOfIssue=AT,s.selectIssueTypeIdentifiers=Fh,s.selectIssueTypeIdentifiersOfIssueType=uT,s.selectIssueTypeMapping=An,s.selectIssueTypeValuesOfIssueType=JI,s.selectIssueTypes=jh,s.selectIssueTypesByIds=bT,s.selectIssueTypesOfOrganization=FT,s.selectIssueUpdateMapping=$h,s.selectIssueUpdates=Gh,s.selectIssueUpdatesOfIssue=Lh,s.selectIssues=Na,s.selectIssuesByIds=PI,s.selectIssuesOfIssueType=Ul,s.selectIssuesOfProject=OI,s.selectLatestAssetProcedureFieldsOfAssetProcedure=jA,s.selectLatestAssetProcedureStepFieldsOfAssetProcedureStep=yf,s.selectLatestAssetTypeFieldsOfAssetType=py,s.selectLatestFieldsByAssetProcedureStep=Sf,s.selectLatestFormRevisionOfForm=$S,s.selectLatestIssueTypeFieldsOfIssueType=ZI,s.selectLatestRetryTime=xT,s.selectMembershipsByUserOfTeam=Rg,s.selectNumberOfAssetsOfAssetType=$f,s.selectOrganizationAccessById=bn,s.selectOrganizationAccessMapping=gn,s.selectOrganizationAccessUserMapping=im,s.selectOrganizationById=XT,s.selectOrganizationDocuments=uS,s.selectOrganizations=JT,s.selectOrganizationsMapping=dm,s.selectProjectAccessById=En,s.selectProjectAccessMapping=Mn,s.selectProjectAccesses=Xt,s.selectProjectAccessesOfProject=Tm,s.selectProjectAttachmentById=Mm,s.selectProjectAttachmentMapping=vm,s.selectProjectById=Zm,s.selectProjectDocuments=dS,s.selectProjectFileById=hg,s.selectProjectFileMapping=$m,s.selectProjectFiles=Gm,s.selectProjectMapping=Km,s.selectProjects=kn,s.selectProjectsOfOrganization=gg,s.selectRehydrated=Pg,s.selectStageMapping=qt,s.selectTeamById=Kn,s.selectTeamMembershipById=np,s.selectTeamMemberships=Nn,s.selectTeamMembershipsMapping=ap,s.selectTeams=op,s.selectTeamsByIds=jg,s.selectTeamsMapping=Yn,s.selectTeamsOfOrganization=qg,s.selectUploadUrl=xu,s.selectUserById=Xh,s.selectUsers=In,s.selectUsersByIds=UT,s.selectUsersMapping=Zt,s.selectUsersOfOrganization=LT,s.selectUsersOfProject=ag,s.selectUsersOfTeam=vg,s.setActiveProjectFileId=km,s.setAsset=kf,s.setAssetAttachment=Fc,s.setAssetAttachments=pA,s.setAssetProcedure=xA,s.setAssetProcedureAttachment=qc,s.setAssetProcedureAttachments=yA,s.setAssetProcedureFieldValues=$A,s.setAssetProcedureFieldValuesAttachment=UA,s.setAssetProcedureFieldValuesAttachments=DA,s.setAssetProcedureFieldValuesMany=GA,s.setAssetProcedureFields=vA,s.setAssetProcedureFieldsAttachment=gA,s.setAssetProcedureFieldsAttachments=bA,s.setAssetProcedureFieldsMany=wA,s.setAssetProcedureInstance=WA,s.setAssetProcedureInstances=YA,s.setAssetProcedureStep=ed,s.setAssetProcedureStepFieldValues=_f,s.setAssetProcedureStepFieldValuesAttachment=gf,s.setAssetProcedureStepFieldValuesAttachments=bf,s.setAssetProcedureStepFieldValuesMany=Rf,s.setAssetProcedureStepFields=hf,s.setAssetProcedureStepFieldsAttachment=nf,s.setAssetProcedureStepFieldsAttachments=cf,s.setAssetProcedureStepFieldsMany=mf,s.setAssetProcedureSteps=Ef,s.setAssetProcedures=ef,s.setAssetStage=yd,s.setAssetStageCompletion=Gf,s.setAssetStageCompletions=Lf,s.setAssetStages=Hf,s.setAssetType=ky,s.setAssetTypeAttachment=bd,s.setAssetTypeAttachments=xf,s.setAssetTypeFieldValues=by,s.setAssetTypeFieldValuesAttachment=yy,s.setAssetTypeFieldValuesAttachments=Sy,s.setAssetTypeFieldValuesMany=Fy,s.setAssetTypeFields=uy,s.setAssetTypeFieldsAttachment=sy,s.setAssetTypeFieldsAttachments=iy,s.setAssetTypeFieldsMany=oy,s.setAssetTypeIdentifier=Ry,s.setAssetTypeIdentifierValue=jy,s.setAssetTypeIdentifierValues=qy,s.setAssetTypeIdentifiers=vy,s.setAssetTypes=By,s.setAssets=Bf,s.setCategories=Qy,s.setCategory=Xy,s.setConversation=Ic,s.setConversations=rA,s.setCurrentUser=qT,s.setDocumentAttachment=Mu,s.setDocumentAttachments=aS,s.setDocuments=ku,s.setEmailDomain=lS,s.setEmailDomains=hS,s.setForm=LS,s.setFormIdentifier=IS,s.setFormIdentifierValue=OS,s.setFormIdentifierValues=_S,s.setFormIdentifiers=TS,s.setFormRevision=go,s.setFormRevisionAttachment=VS,s.setFormRevisionAttachments=jS,s.setFormRevisions=DS,s.setFormSubmission=Gt,s.setFormSubmissionAttachment=JS,s.setFormSubmissionAttachments=XS,s.setFormSubmissions=eI,s.setForms=NS,s.setGeoImage=pt,s.setGeoImages=Yo,s.setIsImportingProjectFile=Cm,s.setIssue=gI,s.setIssueAssociation=nI,s.setIssueAssociations=aI,s.setIssueAttachment=ol,s.setIssueAttachments=uI,s.setIssueComment=Da,s.setIssueCommentAttachment=Tl,s.setIssueCommentAttachments=hI,s.setIssueComments=wl,s.setIssueType=It,s.setIssueTypeAttachment=Bl,s.setIssueTypeAttachments=RI,s.setIssueTypeFieldValues=CI,s.setIssueTypeFieldValuesAttachment=xI,s.setIssueTypeFieldValuesAttachments=eT,s.setIssueTypeFieldValuesMany=kI,s.setIssueTypeFields=NI,s.setIssueTypeFieldsAttachment=EI,s.setIssueTypeFieldsAttachments=VI,s.setIssueTypeFieldsMany=HI,s.setIssueTypeIdentifier=nT,s.setIssueTypeIdentifierValue=lT,s.setIssueTypeIdentifierValues=hT,s.setIssueTypeIdentifiers=cT,s.setIssueTypes=ST,s.setIssueUpdate=PT,s.setIssueUpdates=OT,s.setIssues=bI,s.setLoggedIn=Iu,s.setOrganization=HT,s.setOrganizationAccess=CT,s.setOrganizationAccesses=kT,s.setOrganizations=NT,s.setProfilePicture=zT,s.setProject=fg,s.setProjectAccess=tg,s.setProjectAccesses=sg,s.setProjectAttachment=Pm,s.setProjectAttachments=Om,s.setProjectFile=rg,s.setProjectFiles=dg,s.setProjects=Ag,s.setRehydrated=Fg,s.setTeam=gt,s.setTeamMembership=Gn,s.setTeamMemberships=tp,s.setTeams=Mg,s.setTokens=Wy,s.setUploadUrl=Qu,s.setUser=wT,s.setUsers=vT,s.shallowEqual=$p,s.slugify=sA,s.spacesToDashesLower=tA,s.teamMembershipReducer=ip,s.teamMembershipSlice=$n,s.teamReducer=lp,s.teamSlice=Hn,s.toFileNameSafeString=eA,s.toOfflineIdRecord=pc,s.truncate=iA,s.updateAsset=rt,s.updateAssetAttachment=AA,s.updateAssetAttachments=Pc,s.updateAssetProcedure=at,s.updateAssetProcedureAttachment=SA,s.updateAssetProcedureAttachments=zc,s.updateAssetProcedureFieldValues=st,s.updateAssetProcedureFieldValuesAttachment=CA,s.updateAssetProcedureFieldValuesAttachments=nr,s.updateAssetProcedureFieldValuesMany=mr,s.updateAssetProcedureFields=xc,s.updateAssetProcedureFieldsAttachment=FA,s.updateAssetProcedureFieldsAttachments=Hc,s.updateAssetProcedureFieldsMany=MA,s.updateAssetProcedureInstance=it,s.updateAssetProcedureInstances=HA,s.updateAssetProcedureStep=Mt,s.updateAssetProcedureStepFieldValues=ct,s.updateAssetProcedureStepFieldValuesAttachment=Ff,s.updateAssetProcedureStepFieldValuesAttachments=Br,s.updateAssetProcedureStepFieldValuesMany=Kr,s.updateAssetProcedureStepFields=nt,s.updateAssetProcedureStepFieldsAttachment=rf,s.updateAssetProcedureStepFieldsAttachments=Mr,s.updateAssetProcedureStepFieldsMany=pf,s.updateAssetProcedureSteps=jf,s.updateAssetProcedures=XA,s.updateAssetStage=jt,s.updateAssetStageCompletion=od,s.updateAssetStageCompletions=ld,s.updateAssetStages=Yf,s.updateAssetType=lt,s.updateAssetTypeAttachment=ey,s.updateAssetTypeAttachments=Fd,s.updateAssetTypeFieldValues=dt,s.updateAssetTypeFieldValuesAttachment=Iy,s.updateAssetTypeFieldValuesAttachments=Yd,s.updateAssetTypeFieldValuesMany=tu,s.updateAssetTypeFields=$d,s.updateAssetTypeFieldsAttachment=ay,s.updateAssetTypeFieldsAttachments=jd,s.updateAssetTypeFieldsMany=ly,s.updateAssetTypeIdentifier=ut,s.updateAssetTypeIdentifierValue=ot,s.updateAssetTypeIdentifierValues=zy,s.updateAssetTypeIdentifiers=wy,s.updateAssetTypes=Gy,s.updateAssets=Cf,s.updateCategories=xy,s.updateCategory=Fu,s.updateConversation=Tc,s.updateConversations=dA,s.updateDocumentAttachment=nS,s.updateDocumentAttachments=Eu,s.updateDocuments=Qe,s.updateEmailDomain=mS,s.updateEmailDomains=pS,s.updateForm=HS,s.updateFormIdentifier=ht,s.updateFormIdentifierValue=mt,s.updateFormIdentifierValues=RS,s.updateFormIdentifiers=gS,s.updateFormRevision=CS,s.updateFormRevisionAttachment=qS,s.updateFormRevisionAttachments=po,s.updateFormRevisions=kS,s.updateFormSubmission=Bo,s.updateFormSubmissionAttachment=QS,s.updateFormSubmissionAttachments=jo,s.updateFormSubmissions=tI,s.updateForms=WS,s.updateGeoImage=Jo,s.updateGeoImages=sI,s.updateIssue=Ht,s.updateIssueAssociation=il,s.updateIssueAssociations=cI,s.updateIssueAttachment=oI,s.updateIssueAttachments=ll,s.updateIssueComment=yI,s.updateIssueCommentAttachment=mI,s.updateIssueCommentAttachments=gl,s.updateIssueComments=SI,s.updateIssueType=Vh,s.updateIssueTypeAttachment=vI,s.updateIssueTypeAttachments=$l,s.updateIssueTypeFieldValues=ft,s.updateIssueTypeFieldValuesAttachment=tT,s.updateIssueTypeFieldValuesAttachments=Ah,s.updateIssueTypeFieldValuesMany=BI,s.updateIssueTypeFields=uh,s.updateIssueTypeFieldsAttachment=jI,s.updateIssueTypeFieldsAttachments=Xl,s.updateIssueTypeFieldsMany=WI,s.updateIssueTypeIdentifier=yt,s.updateIssueTypeIdentifierValue=St,s.updateIssueTypeIdentifierValues=mT,s.updateIssueTypeIdentifiers=rT,s.updateIssueTypes=IT,s.updateIssueUpdate=_T,s.updateIssueUpdates=RT,s.updateIssues=FI,s.updateOrganization=rm,s.updateOrganizationAccess=Jt,s.updateOrganizationAccesses=BT,s.updateOrganizations=YT,s.updateProject=Wm,s.updateProjectAccess=Tt,s.updateProjectAccesses=Sm,s.updateProjectAttachment=cg,s.updateProjectAttachments=_m,s.updateProjectFile=zn,s.updateProjectFiles=og,s.updateProjects=Sg,s.updateTeam=up,s.updateTeamMembership=Og,s.updateTeamMemberships=_g,s.updateTeams=Eg,s.updateUser=VT,s.updateUsers=ET,s.useSelectorBuilder=Cg,s.userReducer=Zh,s.userSlice=Sn,s.versioningReducer=mp,s.versioningSlice=hp,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
|
|
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,k)),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=k,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"})});
|