eehitus-my-task-list-ui 1.0.12 → 1.0.13
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/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/types/components/common/constants/Constants.d.ts +37 -0
- package/dist/types/components/page/detailsearch/tables/DetailSearchProceedings.d.ts +0 -2
- package/dist/types/components/page/detailsearch/tables/detailSearchHelper.d.ts +2 -0
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see index.umd.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@reduxjs/toolkit"),require("react"),require("react-intl"),require("ehr-components"),require("axios"),require("react-redux"),require("moment"),require("reactstrap")):"function"==typeof define&&define.amd?define(["@reduxjs/toolkit","react","react-intl","ehr-components","axios","react-redux","moment","reactstrap"],t):"object"==typeof exports?exports.ehrDocumentUI=t(require("@reduxjs/toolkit"),require("react"),require("react-intl"),require("ehr-components"),require("axios"),require("react-redux"),require("moment"),require("reactstrap")):e.ehrDocumentUI=t(e["@reduxjs/toolkit"],e.react,e["react-intl"],e["ehr-components"],e.axios,e["react-redux"],e.moment,e.reactstrap)}(this,((e,t,n,s,o,i,r,a)=>(()=>{"use strict";var l={20:(e,t,n)=>{var s=n(932),o=Symbol.for("react.element"),i=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function d(e,t,n){var s,i={},d=null,c=null;for(s in void 0!==n&&(d=""+n),void 0!==t.key&&(d=""+t.key),void 0!==t.ref&&(c=t.ref),t)r.call(t,s)&&!l.hasOwnProperty(s)&&(i[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps)void 0===i[s]&&(i[s]=t[s]);return{$$typeof:o,type:e,key:d,ref:c,props:i,_owner:a.current}}t.Fragment=i,t.jsx=d,t.jsxs=d},114:e=>{e.exports=s},130:e=>{e.exports=i},306:t=>{t.exports=e},480:e=>{e.exports=n},558:e=>{e.exports=r},572:e=>{e.exports=a},674:e=>{e.exports=o},848:(e,t,n)=>{e.exports=n(20)},932:e=>{e.exports=t}},d={};function c(e){var t=d[e];if(void 0!==t)return t.exports;var n=d[e]={exports:{}};return l[e](n,n.exports,c),n.exports}c.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return c.d(t,{a:t}),t},c.d=(e,t)=>{for(var n in t)c.o(t,n)&&!c.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},c.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var u={};c.r(u),c.d(u,{DetailSearch:()=>xo,MyAdministrativeProceedings:()=>Tn,MyApprovals:()=>qs,MyDocuments:()=>Es,MyInvolvements:()=>Xs,MyOpinions:()=>$s,MyProceedings:()=>Ws,documentsReducer:()=>x,filterReducer:()=>T,myOperationsReducer:()=>P,proceedingsReducer:()=>U,rootReducer:()=>$});var p=c(306);const h=(0,p.createSlice)({name:"filter",initialState:{classifiers:{},documentTypes:[],institutionUsers:[],institutions:[],usageClassifierTypes:[]},reducers:{classifiersLoaded:(e,t)=>{e.classifiers=t.payload},documentTypesLoaded:(e,t)=>{e.documentTypes=t.payload},institutionUsersLoaded:(e,t)=>{e.institutionUsers=t.payload},institutionsLoaded:(e,t)=>{e.institutions=t.payload},usageClassifierTypesLoaded:(e,t)=>{e.usageClassifierTypes=t.payload}}}),{classifiersLoaded:m,documentTypesLoaded:g,institutionUsersLoaded:S,institutionsLoaded:f,usageClassifierTypesLoaded:I}=h.actions,T=h.reducer;const v=(0,p.createSlice)({name:"documents",initialState:{workingDocuments:[],signingDocuments:[],finishedDocuments:[],allowedDocumentTypesToStart:[]},reducers:{workingDocumentsLoaded:(e,t)=>{e.workingDocuments=t.payload},signingDocumentsLoaded:(e,t)=>{e.signingDocuments=t.payload},finishedDocumentsLoaded:(e,t)=>{e.finishedDocuments=t.payload},deleteDocument(e,t){e.workingDocuments=e.workingDocuments.filter((e=>e.docNr!==t.payload))},allowedDocumentTypesLoaded:(e,t)=>{e.allowedDocumentTypesToStart=t.payload}}}),{workingDocumentsLoaded:E,signingDocumentsLoaded:_,finishedDocumentsLoaded:y,deleteDocument:b,allowedDocumentTypesLoaded:D}=v.actions,x=v.reducer;const M=(0,p.createSlice)({name:"proceedings",initialState:{myProceedings:[],proceedingsToComment:[],incomingDocuments:[]},reducers:{myProceedingsLoaded:(e,t)=>{e.myProceedings=t.payload},proceedingsToCommentLoaded:(e,t)=>{e.proceedingsToComment=t.payload},incomingDocumentsLoaded:(e,t)=>{e.incomingDocuments=t.payload}}}),{myProceedingsLoaded:O,proceedingsToCommentLoaded:N,incomingDocumentsLoaded:A}=M.actions,U=M.reducer;const w=(0,p.createSlice)({name:"myOperations",initialState:{myOperations:[],toCommentOperations:[],operationInvitations:[]},reducers:{myOperationsLoaded:(e,t)=>{e.myOperations=t.payload},toCommentOperationsLoaded:(e,t)=>{e.toCommentOperations=t.payload},operationInvitationsLoaded:(e,t)=>{e.operationInvitations=t.payload}}}),{myOperationsLoaded:j,toCommentOperationsLoaded:C,operationInvitationsLoaded:L}=w.actions,P=w.reducer;const R=(0,p.createSlice)({name:"detailSearch",initialState:{buildings:[],documents:[],proceedings:[]},reducers:{buildingsLoaded:(e,t)=>{e.buildings=t.payload},documentsLoaded:(e,t)=>{e.documents=t.payload},proceedingsLoaded:(e,t)=>{e.proceedings=t.payload}}}),{buildingsLoaded:K,documentsLoaded:k,proceedingsLoaded:F}=R.actions,Y=R.reducer,B={notices:[]},V=(0,p.createSlice)({name:"notification",initialState:B,reducers:{setNotifications:(e,t)=>{e.notices=t.payload},removeNotification:(e,t)=>{const n=e.notices.filter((e=>e.id!==t.payload));e.notices=n},cleanState:e=>B}}),G=(0,p.createSelector)((e=>e.myViewsPage.notifications.notices),(e=>e)),{cleanState:H,setNotifications:J,removeNotification:W}=V.actions,q=V.reducer,$=(0,p.combineReducers)({filter:T,myDocuments:x,myProceedings:U,myOperations:P,detailSearch:Y,notifications:q});var z=c(932),X=c.n(z),Q=c(480),Z=c(114);const ee="SIGNING_DOCUMENTS",te="WORKING_DOCUMENTS",ne="FINISHED_DOCUMENTS",se="INCOMING_DOCUMENTS",oe="MY_APPROVALS",ie="MY_OPINIONS",re="MY_INVOLVEMENTS",ae="MY_OPERATIONS",le="OPERATIONS_TO_COMMENT",de="OPERATION_INVITATIONS",ce="PROCEEDINGS_TO_COMMENT",ue="BUILDINGS_SEARCH";let pe=function(e){return e.DEFAULT="default",e.INFO="info",e.SUCCESS="success",e.WARNING="warning",e.DANGER="danger",e}({});const he="BUILDING",me="PROCEEDING",ge="DOCUMENT",Se="ADMIN_PROCEEDING";let fe=function(e){return e.KOV="KOV",e.MKM="MKM",e.A="A",e.N="N",e.KT="KT",e.JUR="JUR",e.AMAS="AMAS",e.TJA="TJA",e}({});let Ie=function(e){return e.MENTOIMLIIK_AUTO_REG="MENTOIMLIIK_AUTO_REG",e.MENTOIMLIIK_KAASAMINE="MENTOIMLIIK_KAASAMINE",e.MENTOIMLIIK_MASSKAASAMINE="MENTOIMLIIK_MASSKAASAMINE",e.MENTOIMLIIK_YKSIKKAASAMINE="MENTOIMLIIK_YKSIKKAASAMINE",e.MENTOIMLIIK_ARVAMUS="MENTOIMLIIK_ARVAMUS",e.MENTOIMLIIK_VALINE_KOOSK="MENTOIMLIIK_VALINE_KOOSK",e.MENTOIMLIIK_SISENE_KOOSK="MENTOIMLIIK_SISENE_KOOSK",e.MENTOIMLIIK_KOOSK="MENTOIMLIIK_KOOSK",e.MENTOIMLIIK_MARKUS_TAIEND="MENTOIMLIIK_MARKUS_TAIEND",e.MENTOIMLIIK_MEN_MARKUS="MENTOIMLIIK_MEN_MARKUS",e.MENTOIMLIIK_EHIT_KK_RING="MENTOIMLIIK_EHIT_KK_RING",e.MENTOIMLIIK_ADS="MENTOIMLIIK_ADS",e.MENTOIMLIIK_ADS_SAADA="MENTOIMLIIK_ADS_SAADA",e.MENTOIMLIIK_ADS_ESIT="MENTOIMLIIK_ADS_ESIT",e.MENTOIMLIIK_AVALIK="MENTOIMLIIK_AVALIK",e.MENTOIMLIIK_AVALIK_TAGASISIDE="MENTOIMLIIK_AVALIK_TAGASISIDE",e.MENTOIMLIIK_RAHV_KAASAMINE="MENTOIMLIIK_RAHV_KAASAMINE",e.MENTOIMLIIK_KAAS_TAGASISIDE="MENTOIMLIIK_KAAS_TAGASISIDE",e.MENTOIMLIIK_ALLKIRJASTAMINE="MENTOIMLIIK_ALLKIRJASTAMINE",e.MENTOIMLIIK_KMH_PR="MENTOIMLIIK_KMH_PR",e.MENTOIMLIIK_KMH_AR="MENTOIMLIIK_KMH_AR",e}({});const Te="12975",ve="12976",Ee=[Te,ve],_e={[ve]:"12977",[Te]:"12978"},ye={[ve]:"11274",[Te]:"11275"};var be=c(674),De=c.n(be);const xe="https://devkluster.ehr.ee".replace(/\/+$/,"");class Me{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:xe,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:De();this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class Oe extends Error{constructor(e,t){super(t),this.name="RequiredError",this.field=e}}const Ne="https://example.com",Ae=function(e,t,n){if(null==n)throw new Oe(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},Ue=function(e){const t=new URLSearchParams(e.search);for(var n=arguments.length,s=new Array(n>1?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];for(const e of s)for(const n in e)if(Array.isArray(e[n])){t.delete(n);for(const s of e[n])t.append(n,s)}else t.set(n,e[n]);e.search=t.toString()},we=function(e){return e.pathname+e.search+e.hash},je=function(e,t,n,s){return function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;const r={...e.options,url:((null==s?void 0:s.basePath)||i)+e.url};return o.request(r)}},Ce=function(e){const t=function(e){return{getAllDocumentTypes:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/alldocumenttypes",Ne);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ue(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:we(n),options:o}},getBusinessTypesList:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/businesstypelist",Ne);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ue(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:we(n),options:o}},getClassifierByType:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ae("getClassifierByType","classifierType",t);const s="/classifier/{classifierType}".replace("{classifierType}",encodeURIComponent(String(t))),o=new URL(s,Ne);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ue(o,{},n.query);let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:we(o),options:r}},getClassifiersByRelatedType:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ae("getClassifiersByRelatedType","relatedClassifierType",t);const s="/classifier/related-type/{relatedClassifierType}".replace("{relatedClassifierType}",encodeURIComponent(String(t))),o=new URL(s,Ne);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ue(o,{},n.query);let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:we(o),options:r}},getClassifiersByType:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ae("getClassifiersByType","classifierTypesCommaSeparated",t);const s="/classifiers/{classifierTypesCommaSeparated}".replace("{classifierTypesCommaSeparated}",encodeURIComponent(String(t))),o=new URL(s,Ne);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ue(o,{},n.query);let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:we(o),options:r}},getDocumentTypes:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/documenttypes",Ne);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ue(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:we(n),options:o}},getFileTypes:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/filetypes",Ne);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ue(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:we(n),options:o}},getHealth:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/health",Ne);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ue(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:we(n),options:o}},getUsageClassifierTypes:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/classifier/usage",Ne);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ue(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:we(n),options:o}},getUserRolesList:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/userroleslist",Ne);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ue(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:we(n),options:o}}}}(e);return{async getAllDocumentTypes(n){const s=await t.getAllDocumentTypes(n);return je(s,De(),xe,e)},async getBusinessTypesList(n){const s=await t.getBusinessTypesList(n);return je(s,De(),xe,e)},async getClassifierByType(n,s){const o=await t.getClassifierByType(n,s);return je(o,De(),xe,e)},async getClassifiersByRelatedType(n,s){const o=await t.getClassifiersByRelatedType(n,s);return je(o,De(),xe,e)},async getClassifiersByType(n,s){const o=await t.getClassifiersByType(n,s);return je(o,De(),xe,e)},async getDocumentTypes(n){const s=await t.getDocumentTypes(n);return je(s,De(),xe,e)},async getFileTypes(n){const s=await t.getFileTypes(n);return je(s,De(),xe,e)},async getHealth(n){const s=await t.getHealth(n);return je(s,De(),xe,e)},async getUsageClassifierTypes(n){const s=await t.getUsageClassifierTypes(n);return je(s,De(),xe,e)},async getUserRolesList(n){const s=await t.getUserRolesList(n);return je(s,De(),xe,e)}}};class Le extends Me{getAllDocumentTypes(e){return Ce(this.configuration).getAllDocumentTypes(e).then((e=>e(this.axios,this.basePath)))}getBusinessTypesList(e){return Ce(this.configuration).getBusinessTypesList(e).then((e=>e(this.axios,this.basePath)))}getClassifierByType(e,t){return Ce(this.configuration).getClassifierByType(e,t).then((e=>e(this.axios,this.basePath)))}getClassifiersByRelatedType(e,t){return Ce(this.configuration).getClassifiersByRelatedType(e,t).then((e=>e(this.axios,this.basePath)))}getClassifiersByType(e,t){return Ce(this.configuration).getClassifiersByType(e,t).then((e=>e(this.axios,this.basePath)))}getDocumentTypes(e){return Ce(this.configuration).getDocumentTypes(e).then((e=>e(this.axios,this.basePath)))}getFileTypes(e){return Ce(this.configuration).getFileTypes(e).then((e=>e(this.axios,this.basePath)))}getHealth(e){return Ce(this.configuration).getHealth(e).then((e=>e(this.axios,this.basePath)))}getUsageClassifierTypes(e){return Ce(this.configuration).getUsageClassifierTypes(e).then((e=>e(this.axios,this.basePath)))}getUserRolesList(e){return Ce(this.configuration).getUserRolesList(e).then((e=>e(this.axios,this.basePath)))}}class Pe{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}const Re="http://localhost:8080".replace(/\/+$/,"");class Ke{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Re,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:De();this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class ke extends Error{constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const Fe="https://example.com",Ye=function(e,t,n){if(null==n)throw new ke(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function Be(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>Be(e,t,n))):Object.keys(t).forEach((s=>Be(e,t[s],`${n}${""!==n?".":""}${s}`))):e.has(n)?e.append(n,t):e.set(n,t))}const Ve=function(e){const t=new URLSearchParams(e.search);for(var n=arguments.length,s=new Array(n>1?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];Be(t,s),e.search=t.toString()},Ge=function(e,t,n){const s="string"!=typeof e;return(s&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):s)?JSON.stringify(void 0!==e?e:{}):e||""},He=function(e){return e.pathname+e.search+e.hash},Je=function(e,t,n,s){return function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;const r={...e.options,url:((null==s?void 0:s.basePath)||i)+e.url};return o.request(r)}};const We=function(e){const t=function(e){return{getJurKovPersons:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/person/jur/kov",Fe);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ve(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:He(n),options:o}},getJurPersonCoordRelJurs:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ye("getJurPersonCoordRelJurs","personId",t);const s="/person/jur/{personId}/coord".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Fe);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ve(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:He(o),options:r}},getUserPossibleProceedingSupervisorsByEHAKCode:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ye("getUserPossibleProceedingSupervisorsByEHAKCode","eHAKCode",t);const s="/user/possiblesupervisors/{EHAKCode}".replace("{EHAKCode}",encodeURIComponent(String(t))),o=new URL(s,Fe);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ve(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:He(o),options:r}},getUserPossibleProceedingSupervisorsByIdAndEHAKCode:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ye("getUserPossibleProceedingSupervisorsByIdAndEHAKCode","id",t),Ye("getUserPossibleProceedingSupervisorsByIdAndEHAKCode","eHAKCode",n);const o="/user/possiblesupervisors/{id}/{EHAKCode}".replace("{id}",encodeURIComponent(String(t))).replace("{EHAKCode}",encodeURIComponent(String(n))),i=new URL(o,Fe);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};Ve(i,{});let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:He(i),options:a}},getUserPossibleProceedingSupervisorsByJurId:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ye("getUserPossibleProceedingSupervisorsByJurId","personId",t);const s="/user/jur/possiblesupervisors/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Fe);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ve(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:He(o),options:r}}}}(e);return{async getJurKovPersons(n){const s=await t.getJurKovPersons(n);return Je(s,De(),Re,e)},async getJurPersonCoordRelJurs(n,s){const o=await t.getJurPersonCoordRelJurs(n,s);return Je(o,De(),Re,e)},async getUserPossibleProceedingSupervisorsByEHAKCode(n,s){const o=await t.getUserPossibleProceedingSupervisorsByEHAKCode(n,s);return Je(o,De(),Re,e)},async getUserPossibleProceedingSupervisorsByIdAndEHAKCode(n,s,o){const i=await t.getUserPossibleProceedingSupervisorsByIdAndEHAKCode(n,s,o);return Je(i,De(),Re,e)},async getUserPossibleProceedingSupervisorsByJurId(n,s){const o=await t.getUserPossibleProceedingSupervisorsByJurId(n,s);return Je(o,De(),Re,e)}}};class qe extends Ke{getJurKovPersons(e){return We(this.configuration).getJurKovPersons(e).then((e=>e(this.axios,this.basePath)))}getJurPersonCoordRelJurs(e,t){return We(this.configuration).getJurPersonCoordRelJurs(e,t).then((e=>e(this.axios,this.basePath)))}getUserPossibleProceedingSupervisorsByEHAKCode(e,t){return We(this.configuration).getUserPossibleProceedingSupervisorsByEHAKCode(e,t).then((e=>e(this.axios,this.basePath)))}getUserPossibleProceedingSupervisorsByIdAndEHAKCode(e,t,n){return We(this.configuration).getUserPossibleProceedingSupervisorsByIdAndEHAKCode(e,t,n).then((e=>e(this.axios,this.basePath)))}getUserPossibleProceedingSupervisorsByJurId(e,t){return We(this.configuration).getUserPossibleProceedingSupervisorsByJurId(e,t).then((e=>e(this.axios,this.basePath)))}}const $e=function(e){const t=function(e){return{addAllyksusToJurPerson:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/person/jur/addAllyksus",Fe);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Ve(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Ge(t,i,e),{url:He(s),options:i}},addPerson:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/person",Fe);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Ve(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Ge(t,i,e),{url:He(s),options:i}},deletePerson:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ye("deletePerson","personId",t);const s="/person/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Fe);let i;e&&(i=e.baseOptions);const r={method:"DELETE",...i,...n};Ve(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:He(o),options:r}},findKovsAndJurPersonsInTheSameAdministrativeDivision:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Ye("findKovsAndJurPersonsInTheSameAdministrativeDivision","regNameOrCode",t);const i="/person/kovs-and-institutions/{regNameOrCode}".replace("{regNameOrCode}",encodeURIComponent(String(t))),r=new URL(i,Fe);let a;e&&(a=e.baseOptions);const l={method:"PUT",...a,...o},d={},c={};void 0!==n&&(c.searchFromAll=n),d["Content-Type"]="application/json",Ve(r,c);let u=a&&a.headers?a.headers:{};return l.headers={...d,...u,...o.headers},l.data=Ge(s,l,e),{url:He(r),options:l}},findPublicSectorInstitutions:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ye("findPublicSectorInstitutions","regNameOrCode",t);const o="/person/public-sector-institutions/{regNameOrCode}".replace("{regNameOrCode}",encodeURIComponent(String(t))),i=new URL(o,Fe);let r;e&&(r=e.baseOptions);const a={method:"PUT",...r,...s},l={"Content-Type":"application/json"};Ve(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},a.data=Ge(n,a,e),{url:He(i),options:a}},findRolesByDbName:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/person/personroles",Fe);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ve(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:He(n),options:o}},getAllActiveInstitutions:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/person/jur",Fe);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ve(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:He(n),options:o}},getAllClassifierBusinessTypeDtos:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/person/jur/businessTypes",Fe);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ve(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:He(n),options:o}},getJurPerson:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ye("getJurPerson","personId",t);const s="/person/jur/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Fe);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ve(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:He(o),options:r}},getJurPersonAncestors:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ye("getJurPersonAncestors","jurPersonId",t);const s="/person/jur/ancestor/{jurPersonId}".replace("{jurPersonId}",encodeURIComponent(String(t))),o=new URL(s,Fe);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ve(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:He(o),options:r}},getJurPersonSuccessors:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ye("getJurPersonSuccessors","jurPersonId",t);const s="/person/jur/successor/{jurPersonId}".replace("{jurPersonId}",encodeURIComponent(String(t))),o=new URL(s,Fe);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ve(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:He(o),options:r}},getJurPersonsByEhakCode:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ye("getJurPersonsByEhakCode","ehakCode",t);const s="/person/jur/byEhakCode/{ehakCode}".replace("{ehakCode}",encodeURIComponent(String(t))),o=new URL(s,Fe);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ve(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:He(o),options:r}},getPerson:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ye("getPerson","personId",t);const s="/person/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Fe);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ve(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:He(o),options:r}},getPersonDetails:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/person/details",Fe);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ve(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:He(n),options:o}},refreshUpdateArPersonFromAR:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ye("refreshUpdateArPersonFromAR","regCode",t);const s="/person/jur/refresh/{regCode}".replace("{regCode}",encodeURIComponent(String(t))),o=new URL(s,Fe);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ve(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:He(o),options:r}},removeYlemyksusReference:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ye("removeYlemyksusReference","allyksusId",t);const s="/person/jur/removeYlemyksusReference/{allyksusId}".replace("{allyksusId}",encodeURIComponent(String(t))),o=new URL(s,Fe);let i;e&&(i=e.baseOptions);const r={method:"PUT",...i,...n};Ve(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:He(o),options:r}},updatePerson:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ye("updatePerson","personId",t);const o="/person/{personId}".replace("{personId}",encodeURIComponent(String(t))),i=new URL(o,Fe);let r;e&&(r=e.baseOptions);const a={method:"PUT",...r,...s},l={"Content-Type":"application/json"};Ve(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},a.data=Ge(n,a,e),{url:He(i),options:a}}}}(e);return{async addAllyksusToJurPerson(n,s){const o=await t.addAllyksusToJurPerson(n,s);return Je(o,De(),Re,e)},async addPerson(n,s){const o=await t.addPerson(n,s);return Je(o,De(),Re,e)},async deletePerson(n,s){const o=await t.deletePerson(n,s);return Je(o,De(),Re,e)},async findKovsAndJurPersonsInTheSameAdministrativeDivision(n,s,o,i){const r=await t.findKovsAndJurPersonsInTheSameAdministrativeDivision(n,s,o,i);return Je(r,De(),Re,e)},async findPublicSectorInstitutions(n,s,o){const i=await t.findPublicSectorInstitutions(n,s,o);return Je(i,De(),Re,e)},async findRolesByDbName(n){const s=await t.findRolesByDbName(n);return Je(s,De(),Re,e)},async getAllActiveInstitutions(n){const s=await t.getAllActiveInstitutions(n);return Je(s,De(),Re,e)},async getAllClassifierBusinessTypeDtos(n){const s=await t.getAllClassifierBusinessTypeDtos(n);return Je(s,De(),Re,e)},async getJurPerson(n,s){const o=await t.getJurPerson(n,s);return Je(o,De(),Re,e)},async getJurPersonAncestors(n,s){const o=await t.getJurPersonAncestors(n,s);return Je(o,De(),Re,e)},async getJurPersonSuccessors(n,s){const o=await t.getJurPersonSuccessors(n,s);return Je(o,De(),Re,e)},async getJurPersonsByEhakCode(n,s){const o=await t.getJurPersonsByEhakCode(n,s);return Je(o,De(),Re,e)},async getPerson(n,s){const o=await t.getPerson(n,s);return Je(o,De(),Re,e)},async getPersonDetails(n){const s=await t.getPersonDetails(n);return Je(s,De(),Re,e)},async refreshUpdateArPersonFromAR(n,s){const o=await t.refreshUpdateArPersonFromAR(n,s);return Je(o,De(),Re,e)},async removeYlemyksusReference(n,s){const o=await t.removeYlemyksusReference(n,s);return Je(o,De(),Re,e)},async updatePerson(n,s,o){const i=await t.updatePerson(n,s,o);return Je(i,De(),Re,e)}}};class ze extends Ke{addAllyksusToJurPerson(e,t){return $e(this.configuration).addAllyksusToJurPerson(e,t).then((e=>e(this.axios,this.basePath)))}addPerson(e,t){return $e(this.configuration).addPerson(e,t).then((e=>e(this.axios,this.basePath)))}deletePerson(e,t){return $e(this.configuration).deletePerson(e,t).then((e=>e(this.axios,this.basePath)))}findKovsAndJurPersonsInTheSameAdministrativeDivision(e,t,n,s){return $e(this.configuration).findKovsAndJurPersonsInTheSameAdministrativeDivision(e,t,n,s).then((e=>e(this.axios,this.basePath)))}findPublicSectorInstitutions(e,t,n){return $e(this.configuration).findPublicSectorInstitutions(e,t,n).then((e=>e(this.axios,this.basePath)))}findRolesByDbName(e){return $e(this.configuration).findRolesByDbName(e).then((e=>e(this.axios,this.basePath)))}getAllActiveInstitutions(e){return $e(this.configuration).getAllActiveInstitutions(e).then((e=>e(this.axios,this.basePath)))}getAllClassifierBusinessTypeDtos(e){return $e(this.configuration).getAllClassifierBusinessTypeDtos(e).then((e=>e(this.axios,this.basePath)))}getJurPerson(e,t){return $e(this.configuration).getJurPerson(e,t).then((e=>e(this.axios,this.basePath)))}getJurPersonAncestors(e,t){return $e(this.configuration).getJurPersonAncestors(e,t).then((e=>e(this.axios,this.basePath)))}getJurPersonSuccessors(e,t){return $e(this.configuration).getJurPersonSuccessors(e,t).then((e=>e(this.axios,this.basePath)))}getJurPersonsByEhakCode(e,t){return $e(this.configuration).getJurPersonsByEhakCode(e,t).then((e=>e(this.axios,this.basePath)))}getPerson(e,t){return $e(this.configuration).getPerson(e,t).then((e=>e(this.axios,this.basePath)))}getPersonDetails(e){return $e(this.configuration).getPersonDetails(e).then((e=>e(this.axios,this.basePath)))}refreshUpdateArPersonFromAR(e,t){return $e(this.configuration).refreshUpdateArPersonFromAR(e,t).then((e=>e(this.axios,this.basePath)))}removeYlemyksusReference(e,t){return $e(this.configuration).removeYlemyksusReference(e,t).then((e=>e(this.axios,this.basePath)))}updatePerson(e,t,n){return $e(this.configuration).updatePerson(e,t,n).then((e=>e(this.axios,this.basePath)))}}const Xe=function(e){const t=function(e){return{searchPerson:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Ye("searchPerson","input",t);const i=new URL("/search/searchPerson",Fe);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...o},l={};void 0!==t&&(l.input=t),void 0!==n&&(l.xRoad=n),void 0!==s&&(l.isPrivate=s),Ve(i,l);let d=r&&r.headers?r.headers:{};return a.headers={...d,...o.headers},{url:He(i),options:a}}}}(e);return{async searchPerson(n,s,o,i){const r=await t.searchPerson(n,s,o,i);return Je(r,De(),Re,e)}}};class Qe extends Ke{searchPerson(e,t,n,s){return Xe(this.configuration).searchPerson(e,t,n,s).then((e=>e(this.axios,this.basePath)))}}const Ze=function(e){const t=function(e){return{addRoleToUser:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/user/addrole",Fe);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Ve(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Ge(t,i,e),{url:He(s),options:i}},addUser:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/user",Fe);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Ve(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Ge(t,i,e),{url:He(s),options:i}},appointSubstituteUser:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/user-substitution/appoint-substitute",Fe);let o;e&&(o=e.baseOptions);const i={method:"PUT",...o,...n},r={"Content-Type":"application/json"};Ve(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Ge(t,i,e),{url:He(s),options:i}},deleteUser:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ye("deleteUser","userId",t);const s="/user/{userId}".replace("{userId}",encodeURIComponent(String(t))),o=new URL(s,Fe);let i;e&&(i=e.baseOptions);const r={method:"DELETE",...i,...n};Ve(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:He(o),options:r}},deleteUserRole:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ye("deleteUserRole","userRoleRelId",t);const s="/user/role/{userRoleRelId}".replace("{userRoleRelId}",encodeURIComponent(String(t))),o=new URL(s,Fe);let i;e&&(i=e.baseOptions);const r={method:"DELETE",...i,...n};Ve(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:He(o),options:r}},findUsersByRoleId:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ye("findUsersByRoleId","roleId",t);const s="/user/byroleid/{roleId}".replace("{roleId}",encodeURIComponent(String(t))),o=new URL(s,Fe);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ve(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:He(o),options:r}},getAllClassifierUserRoleDtos:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/user/roles/all",Fe);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ve(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:He(n),options:o}},getHealth:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/health",Fe);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ve(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:He(n),options:o}},getJurUsers:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ye("getJurUsers","personId",t);const s="/jur/user/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Fe);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ve(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:He(o),options:r}},getJurUsersWithoutGivenRole:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ye("getJurUsersWithoutGivenRole","personId",t),Ye("getJurUsersWithoutGivenRole","roleId",n);const o="/jur/user/withoutrole/{personId}/{roleId}".replace("{personId}",encodeURIComponent(String(t))).replace("{roleId}",encodeURIComponent(String(n))),i=new URL(o,Fe);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};Ve(i,{});let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:He(i),options:a}},getUser:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ye("getUser","userId",t);const s="/user/{userId}".replace("{userId}",encodeURIComponent(String(t))),o=new URL(s,Fe);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ve(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:He(o),options:r}},getUserPossibleRecipients:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/user/possiblerecipients",Fe);let o;e&&(o=e.baseOptions);const i={method:"GET",...o,...n},r={};void 0!==t&&(r.searchInput=t),Ve(s,r);let a=o&&o.headers?o.headers:{};return i.headers={...a,...n.headers},{url:He(s),options:i}},getUsers:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ye("getUsers","personId",t);const s="/user/usersByPersonId/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Fe);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Ve(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:He(o),options:r}},getUsersJurPerson:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ye("getUsersJurPerson","userId",t);const o="/user/jur/{userId}".replace("{userId}",encodeURIComponent(String(t))),i=new URL(o,Fe);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s},l={};void 0!==n&&(l.valid=n),Ve(i,l);let d=r&&r.headers?r.headers:{};return a.headers={...d,...s.headers},{url:He(i),options:a}},updateUser:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ye("updateUser","userId",t);const o="/user/{userId}".replace("{userId}",encodeURIComponent(String(t))),i=new URL(o,Fe);let r;e&&(r=e.baseOptions);const a={method:"PUT",...r,...s},l={"Content-Type":"application/json"};Ve(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},a.data=Ge(n,a,e),{url:He(i),options:a}},updateUserRole:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ye("updateUserRole","userRoleRelId",t);const o="/user/modifyrole/{userRoleRelId}".replace("{userRoleRelId}",encodeURIComponent(String(t))),i=new URL(o,Fe);let r;e&&(r=e.baseOptions);const a={method:"PUT",...r,...s},l={"Content-Type":"application/json"};Ve(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},a.data=Ge(n,a,e),{url:He(i),options:a}}}}(e);return{async addRoleToUser(n,s){const o=await t.addRoleToUser(n,s);return Je(o,De(),Re,e)},async addUser(n,s){const o=await t.addUser(n,s);return Je(o,De(),Re,e)},async appointSubstituteUser(n,s){const o=await t.appointSubstituteUser(n,s);return Je(o,De(),Re,e)},async deleteUser(n,s){const o=await t.deleteUser(n,s);return Je(o,De(),Re,e)},async deleteUserRole(n,s){const o=await t.deleteUserRole(n,s);return Je(o,De(),Re,e)},async findUsersByRoleId(n,s){const o=await t.findUsersByRoleId(n,s);return Je(o,De(),Re,e)},async getAllClassifierUserRoleDtos(n){const s=await t.getAllClassifierUserRoleDtos(n);return Je(s,De(),Re,e)},async getHealth(n){const s=await t.getHealth(n);return Je(s,De(),Re,e)},async getJurUsers(n,s){const o=await t.getJurUsers(n,s);return Je(o,De(),Re,e)},async getJurUsersWithoutGivenRole(n,s,o){const i=await t.getJurUsersWithoutGivenRole(n,s,o);return Je(i,De(),Re,e)},async getUser(n,s){const o=await t.getUser(n,s);return Je(o,De(),Re,e)},async getUserPossibleRecipients(n,s){const o=await t.getUserPossibleRecipients(n,s);return Je(o,De(),Re,e)},async getUsers(n,s){const o=await t.getUsers(n,s);return Je(o,De(),Re,e)},async getUsersJurPerson(n,s,o){const i=await t.getUsersJurPerson(n,s,o);return Je(i,De(),Re,e)},async updateUser(n,s,o){const i=await t.updateUser(n,s,o);return Je(i,De(),Re,e)},async updateUserRole(n,s,o){const i=await t.updateUserRole(n,s,o);return Je(i,De(),Re,e)}}};class et extends Ke{addRoleToUser(e,t){return Ze(this.configuration).addRoleToUser(e,t).then((e=>e(this.axios,this.basePath)))}addUser(e,t){return Ze(this.configuration).addUser(e,t).then((e=>e(this.axios,this.basePath)))}appointSubstituteUser(e,t){return Ze(this.configuration).appointSubstituteUser(e,t).then((e=>e(this.axios,this.basePath)))}deleteUser(e,t){return Ze(this.configuration).deleteUser(e,t).then((e=>e(this.axios,this.basePath)))}deleteUserRole(e,t){return Ze(this.configuration).deleteUserRole(e,t).then((e=>e(this.axios,this.basePath)))}findUsersByRoleId(e,t){return Ze(this.configuration).findUsersByRoleId(e,t).then((e=>e(this.axios,this.basePath)))}getAllClassifierUserRoleDtos(e){return Ze(this.configuration).getAllClassifierUserRoleDtos(e).then((e=>e(this.axios,this.basePath)))}getHealth(e){return Ze(this.configuration).getHealth(e).then((e=>e(this.axios,this.basePath)))}getJurUsers(e,t){return Ze(this.configuration).getJurUsers(e,t).then((e=>e(this.axios,this.basePath)))}getJurUsersWithoutGivenRole(e,t,n){return Ze(this.configuration).getJurUsersWithoutGivenRole(e,t,n).then((e=>e(this.axios,this.basePath)))}getUser(e,t){return Ze(this.configuration).getUser(e,t).then((e=>e(this.axios,this.basePath)))}getUserPossibleRecipients(e,t){return Ze(this.configuration).getUserPossibleRecipients(e,t).then((e=>e(this.axios,this.basePath)))}getUsers(e,t){return Ze(this.configuration).getUsers(e,t).then((e=>e(this.axios,this.basePath)))}getUsersJurPerson(e,t,n){return Ze(this.configuration).getUsersJurPerson(e,t,n).then((e=>e(this.axios,this.basePath)))}updateUser(e,t,n){return Ze(this.configuration).updateUser(e,t,n).then((e=>e(this.axios,this.basePath)))}updateUserRole(e,t,n){return Ze(this.configuration).updateUserRole(e,t,n).then((e=>e(this.axios,this.basePath)))}}class tt{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}const nt="http://localhost:8080".replace(/\/+$/,"");class st{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:nt,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:De();var s;(this.basePath=t,this.axios=n,e)&&(this.configuration=e,this.basePath=null!==(s=e.basePath)&&void 0!==s?s:t)}}class ot extends Error{constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const it={},rt="https://example.com",at=function(e,t,n){if(null==n)throw new ot(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function lt(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>lt(e,t,n))):Object.keys(t).forEach((s=>lt(e,t[s],`${n}${""!==n?".":""}${s}`))):e.has(n)?e.append(n,t):e.set(n,t))}const dt=function(e){const t=new URLSearchParams(e.search);for(var n=arguments.length,s=new Array(n>1?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];lt(t,s),e.search=t.toString()},ct=function(e,t,n){const s="string"!=typeof e;return(s&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):s)?JSON.stringify(void 0!==e?e:{}):e||""},ut=function(e){return e.pathname+e.search+e.hash},pt=function(e,t,n,s){return function(){var o;let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;const a={...e.options,url:(i.defaults.baseURL?"":null!==(o=null==s?void 0:s.basePath)&&void 0!==o?o:r)+e.url};return i.request(a)}},ht=function(e){const t=function(e){return{findIncomingBaseDocuments:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};at("findIncomingBaseDocuments","documentBaseQueryDto",t);const s=new URL("/documents/incomingdocuments",rt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};dt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=ct(t,i,e),{url:ut(s),options:i}},findWorkingDocuments:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};at("findWorkingDocuments","documentBaseQueryDto",t);const s=new URL("/documents/basedocuments",rt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};dt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=ct(t,i,e),{url:ut(s),options:i}}}}(e);return{async findIncomingBaseDocuments(n,s){var o,i,r;const a=await t.findIncomingBaseDocuments(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=it["BaseMyDocumentsApi.findIncomingBaseDocuments"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>pt(a,De(),nt,e)(t,d||n)},async findWorkingDocuments(n,s){var o,i,r;const a=await t.findWorkingDocuments(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=it["BaseMyDocumentsApi.findWorkingDocuments"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>pt(a,De(),nt,e)(t,d||n)}}};class mt extends st{findIncomingBaseDocuments(e,t){return ht(this.configuration).findIncomingBaseDocuments(e,t).then((e=>e(this.axios,this.basePath)))}findWorkingDocuments(e,t){return ht(this.configuration).findWorkingDocuments(e,t).then((e=>e(this.axios,this.basePath)))}}const gt=function(e){const t=function(e){return{searchDetailBuildings:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};at("searchDetailBuildings","buildingSearchDto",t);const s=new URL("/search/buildings",rt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};dt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=ct(t,i,e),{url:ut(s),options:i}},searchDetailDocuments:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};at("searchDetailDocuments","documentSearchDto",t);const s=new URL("/search/documents",rt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};dt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=ct(t,i,e),{url:ut(s),options:i}},searchDetailProceedings:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};at("searchDetailProceedings","proceedingSearchDto",t);const s=new URL("/search/proceedings",rt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};dt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=ct(t,i,e),{url:ut(s),options:i}}}}(e);return{async searchDetailBuildings(n,s){var o,i,r;const a=await t.searchDetailBuildings(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=it["DetailSearchesApi.searchDetailBuildings"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>pt(a,De(),nt,e)(t,d||n)},async searchDetailDocuments(n,s){var o,i,r;const a=await t.searchDetailDocuments(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=it["DetailSearchesApi.searchDetailDocuments"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>pt(a,De(),nt,e)(t,d||n)},async searchDetailProceedings(n,s){var o,i,r;const a=await t.searchDetailProceedings(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=it["DetailSearchesApi.searchDetailProceedings"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>pt(a,De(),nt,e)(t,d||n)}}};class St extends st{searchDetailBuildings(e,t){return gt(this.configuration).searchDetailBuildings(e,t).then((e=>e(this.axios,this.basePath)))}searchDetailDocuments(e,t){return gt(this.configuration).searchDetailDocuments(e,t).then((e=>e(this.axios,this.basePath)))}searchDetailProceedings(e,t){return gt(this.configuration).searchDetailProceedings(e,t).then((e=>e(this.axios,this.basePath)))}}const ft=function(e){const t=function(e){return{findOperationInvitations:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};at("findOperationInvitations","operationQueryDto",t);const s=new URL("/myoperations/operationinvitations",rt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};dt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=ct(t,i,e),{url:ut(s),options:i}},findOperations:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};at("findOperations","operationQueryDto",t);const s=new URL("/myoperations/myoperations",rt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};dt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=ct(t,i,e),{url:ut(s),options:i}},findOperationsToComment:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};at("findOperationsToComment","operationQueryDto",t);const s=new URL("/myoperations/operationstocomment",rt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};dt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=ct(t,i,e),{url:ut(s),options:i}}}}(e);return{async findOperationInvitations(n,s){var o,i,r;const a=await t.findOperationInvitations(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=it["MyOperationsApi.findOperationInvitations"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>pt(a,De(),nt,e)(t,d||n)},async findOperations(n,s){var o,i,r;const a=await t.findOperations(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=it["MyOperationsApi.findOperations"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>pt(a,De(),nt,e)(t,d||n)},async findOperationsToComment(n,s){var o,i,r;const a=await t.findOperationsToComment(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=it["MyOperationsApi.findOperationsToComment"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>pt(a,De(),nt,e)(t,d||n)}}};class It extends st{findOperationInvitations(e,t){return ft(this.configuration).findOperationInvitations(e,t).then((e=>e(this.axios,this.basePath)))}findOperations(e,t){return ft(this.configuration).findOperations(e,t).then((e=>e(this.axios,this.basePath)))}findOperationsToComment(e,t){return ft(this.configuration).findOperationsToComment(e,t).then((e=>e(this.axios,this.basePath)))}}const Tt=function(e){const t=function(e){return{findAreaProceedings:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};at("findAreaProceedings","proceedingQueryDto",t);const s=new URL("/myproceedings/my-area-proceedings",rt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};dt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=ct(t,i,e),{url:ut(s),options:i}},findProceedings:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};at("findProceedings","myProceedingsRequestDto",t);const s=new URL("/myproceedings/myproceedings",rt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};dt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=ct(t,i,e),{url:ut(s),options:i}}}}(e);return{async findAreaProceedings(n,s){var o,i,r;const a=await t.findAreaProceedings(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=it["MyProceedingsApi.findAreaProceedings"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>pt(a,De(),nt,e)(t,d||n)},async findProceedings(n,s){var o,i,r;const a=await t.findProceedings(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=it["MyProceedingsApi.findProceedings"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>pt(a,De(),nt,e)(t,d||n)}}};class vt extends st{findAreaProceedings(e,t){return Tt(this.configuration).findAreaProceedings(e,t).then((e=>e(this.axios,this.basePath)))}findProceedings(e,t){return Tt(this.configuration).findProceedings(e,t).then((e=>e(this.axios,this.basePath)))}}class Et{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.serverIndex=e.serverIndex,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}const _t="http://localhost:8080".replace(/\/+$/,"");class yt{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:De();this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class bt extends Error{constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const Dt="https://example.com",xt=function(e,t,n){if(null==n)throw new bt(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},Mt=async function(e,t){if(t&&t.accessToken){const n="function"==typeof t.accessToken?await t.accessToken():await t.accessToken;e.Authorization="Bearer "+n}};function Ot(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>Ot(e,t,n))):Object.keys(t).forEach((s=>Ot(e,t[s],`${n}${""!==n?".":""}${s}`))):e.has(n)?e.append(n,t):e.set(n,t))}const Nt=function(e){const t=new URLSearchParams(e.search);for(var n=arguments.length,s=new Array(n>1?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];Ot(t,s),e.search=t.toString()},At=function(e,t,n){const s="string"!=typeof e;return(s&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):s)?JSON.stringify(void 0!==e?e:{}):e||""},Ut=function(e){return e.pathname+e.search+e.hash},wt=function(e,t,n,s){return function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;const r={...e.options,url:((null==s?void 0:s.basePath)||o.defaults.baseURL||i)+e.url};return o.request(r)}};const jt=function(e){const t=function(e){return{addAuthz:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};xt("addAuthz","documentType",t),xt("addAuthz","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/addAuthz".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,Dt);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};Nt(i,{});let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:Ut(i),options:a}},apiVersion:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/version",Dt);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Nt(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Ut(n),options:o}},autoUpdateOwnershipType:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/document/updateOwnershipType",Dt);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Nt(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Ut(n),options:o}},createDoDokuDokuRel:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};xt("createDoDokuDokuRel","documentId",t),xt("createDoDokuDokuRel","addEntityDto",n);const o="/document/{documentId}/createDoDokuDokuRel".replace("{documentId}",encodeURIComponent(String(t))),i=new URL(o,Dt);let r;e&&(r=e.baseOptions);const a={method:"POST",...r,...s},l={};await Mt(l,e),l["Content-Type"]="application/json",Nt(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},a.data=At(n,a,e),{url:Ut(i),options:a}},createDocument:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};xt("createDocument","documentType",t);const o="/document/{documentType}".replace("{documentType}",encodeURIComponent(String(t))),i=new URL(o,Dt);let r;e&&(r=e.baseOptions);const a={method:"POST",...r,...s},l={};await Mt(l,e),l["Content-Type"]="application/json",Nt(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},a.data=At(n,a,e),{url:Ut(i),options:a}},createNewVersion:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};xt("createNewVersion","documentType",t),xt("createNewVersion","applicationNumber",n),xt("createNewVersion","versionDto",s);const i="/document/{documentType}/{applicationNumber}/version/new".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),r=new URL(i,Dt);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...o},d={};await Mt(d,e),d["Content-Type"]="application/json",Nt(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},l.data=At(s,l,e),{url:Ut(r),options:l}},deleteApplicationByNumber:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};xt("deleteApplicationByNumber","documentType",t),xt("deleteApplicationByNumber","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,Dt);let r;e&&(r=e.baseOptions);const a={method:"DELETE",...r,...s},l={};await Mt(l,e),Nt(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},{url:Ut(i),options:a}},endProceedingCircleDocuments:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};xt("endProceedingCircleDocuments","documentType",t),xt("endProceedingCircleDocuments","applicationNumber",n),xt("endProceedingCircleDocuments","proceedingId",s);const i="/document/{documentType}/{applicationNumber}/proceeding/{proceedingId}/endCircle".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))).replace("{proceedingId}",encodeURIComponent(String(s))),r=new URL(i,Dt);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...o},d={};await Mt(d,e),Nt(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},{url:Ut(r),options:l}},getAccessRights:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};xt("getAccessRights","documentType",t),xt("getAccessRights","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/rights".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,Dt);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s},l={};await Mt(l,e),Nt(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},{url:Ut(i),options:a}},getApplicationById:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};xt("getApplicationById","documentId",t);const s="/document/{documentId}".replace("{documentId}",encodeURIComponent(String(t))),o=new URL(s,Dt);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n},a={};await Mt(a,e),Nt(o,{});let l=i&&i.headers?i.headers:{};return r.headers={...a,...l,...n.headers},{url:Ut(o),options:r}},getApplicationByNumber:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};xt("getApplicationByNumber","documentType",t),xt("getApplicationByNumber","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,Dt);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s},l={};await Mt(l,e),Nt(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},{url:Ut(i),options:a}},getApplicationByNumberOld:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};xt("getApplicationByNumberOld","ehrCode",t),xt("getApplicationByNumberOld","applicationNumber",n);const o="/document/old/{ehrCode}/{applicationNumber}".replace("{ehrCode}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,Dt);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s},l={};await Mt(l,e),Nt(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},{url:Ut(i),options:a}},getApplicationByNumberWithVersion:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};xt("getApplicationByNumberWithVersion","documentType",t),xt("getApplicationByNumberWithVersion","applicationNumber",n),xt("getApplicationByNumberWithVersion","version",s);const i="/document/{documentType}/{applicationNumber}/{version}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))).replace("{version}",encodeURIComponent(String(s))),r=new URL(i,Dt);let a;e&&(a=e.baseOptions);const l={method:"GET",...a,...o},d={};await Mt(d,e),Nt(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},{url:Ut(r),options:l}},getApplicationStateFee:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};xt("getApplicationStateFee","documentType",t),xt("getApplicationStateFee","applicationNumber",n),xt("getApplicationStateFee","applicationDto",s);const i="/document/{documentType}/{applicationNumber}/stateFee".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),r=new URL(i,Dt);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...o},d={};await Mt(d,e),d["Content-Type"]="application/json",Nt(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},l.data=At(s,l,e),{url:Ut(r),options:l}},getApplicationStateFeeOfVersion:async function(t,n,s,o){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};xt("getApplicationStateFeeOfVersion","documentType",t),xt("getApplicationStateFeeOfVersion","applicationNumber",n),xt("getApplicationStateFeeOfVersion","version",s),xt("getApplicationStateFeeOfVersion","applicationDto",o);const r="/document/{documentType}/{applicationNumber}/{version}/stateFee".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))).replace("{version}",encodeURIComponent(String(s))),a=new URL(r,Dt);let l;e&&(l=e.baseOptions);const d={method:"POST",...l,...i},c={};await Mt(c,e),c["Content-Type"]="application/json",Nt(a,{});let u=l&&l.headers?l.headers:{};return d.headers={...c,...u,...i.headers},d.data=At(o,d,e),{url:Ut(a),options:d}},getDocumentFileRels:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};xt("getDocumentFileRels","docNr",t);const s=new URL("/document/fileRels",Dt);let o;e&&(o=e.baseOptions);const i={method:"GET",...o,...n},r={},a={};await Mt(r,e),void 0!==t&&(a.docNr=t),Nt(s,a);let l=o&&o.headers?o.headers:{};return i.headers={...r,...l,...n.headers},{url:Ut(s),options:i}},getDotysBasedOnUserRights:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/document/starting_rights",Dt);let o;e&&(o=e.baseOptions);const i={method:"GET",...o,...n},r={};void 0!==t&&(r.ehrCode=t),Nt(s,r);let a=o&&o.headers?o.headers:{};return i.headers={...a,...n.headers},{url:Ut(s),options:i}},getHealth:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/health",Dt);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Nt(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Ut(n),options:o}},getLastStateHistory:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};xt("getLastStateHistory","documentType",t),xt("getLastStateHistory","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/state-history/last".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,Dt);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};Nt(i,{});let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:Ut(i),options:a}},initializeAds:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};xt("initializeAds","documentType",t),xt("initializeAds","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/initAds".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,Dt);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};Nt(i,{});let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:Ut(i),options:a}},mergeInstitutions:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};xt("mergeInstitutions","mergeInstitutionsDTO",t);const s=new URL("/document/merge",Dt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Nt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=At(t,i,e),{url:Ut(s),options:i}},reSubmit:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};xt("reSubmit","documentType",t),xt("reSubmit","applicationNumber",n),xt("reSubmit","proceedingNumber",s);const i="/document/{documentType}/{applicationNumber}/resubmit/{proceedingNumber}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))).replace("{proceedingNumber}",encodeURIComponent(String(s))),r=new URL(i,Dt);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...o},d={};await Mt(d,e),Nt(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},{url:Ut(r),options:l}},recalculatestate:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};xt("recalculatestate","documentType",t),xt("recalculatestate","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/recalculatedetailstate".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,Dt);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};Nt(i,{});let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:Ut(i),options:a}},revertCreateNewVersion:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};xt("revertCreateNewVersion","documentType",t),xt("revertCreateNewVersion","applicationNumber",n),xt("revertCreateNewVersion","versionDto",s);const i="/document/{documentType}/{applicationNumber}/version/revert".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),r=new URL(i,Dt);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...o},d={};await Mt(d,e),d["Content-Type"]="application/json",Nt(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},l.data=At(s,l,e),{url:Ut(r),options:l}},saveAndValidate:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};xt("saveAndValidate","documentType",t),xt("saveAndValidate","applicationNumber",n),xt("saveAndValidate","applicationDto",s);const i="/document/{documentType}/{applicationNumber}/saveAndValidate".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),r=new URL(i,Dt);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...o},d={};await Mt(d,e),d["Content-Type"]="application/json",Nt(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},l.data=At(s,l,e),{url:Ut(r),options:l}},saveApplicationByNumber:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};xt("saveApplicationByNumber","documentType",t),xt("saveApplicationByNumber","applicationNumber",n),xt("saveApplicationByNumber","applicationDto",s);const i="/document/{documentType}/{applicationNumber}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),r=new URL(i,Dt);let a;e&&(a=e.baseOptions);const l={method:"PUT",...a,...o},d={};await Mt(d,e),d["Content-Type"]="application/json",Nt(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},l.data=At(s,l,e),{url:Ut(r),options:l}},setWaterExtractionPointsTestDates:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};xt("setWaterExtractionPointsTestDates","documentType",t),xt("setWaterExtractionPointsTestDates","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/water-extraction-point/set-test-dates".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,Dt);let r;e&&(r=e.baseOptions);const a={method:"PUT",...r,...s},l={};await Mt(l,e),Nt(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},{url:Ut(i),options:a}},setWaterExtractionPointsTestDatesForBuilding:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};xt("setWaterExtractionPointsTestDatesForBuilding","documentType",t),xt("setWaterExtractionPointsTestDatesForBuilding","applicationNumber",n),xt("setWaterExtractionPointsTestDatesForBuilding","ehrCode",s);const i="/document/{documentType}/{applicationNumber}/building/{ehrCode}/water-extraction-point/set-test-dates".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))).replace("{ehrCode}",encodeURIComponent(String(s))),r=new URL(i,Dt);let a;e&&(a=e.baseOptions);const l={method:"PUT",...a,...o},d={};await Mt(d,e),Nt(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},{url:Ut(r),options:l}},submitStraightToRegistry:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};xt("submitStraightToRegistry","documentType",t),xt("submitStraightToRegistry","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/submitToRegistry".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,Dt);let r;e&&(r=e.baseOptions);const a={method:"POST",...r,...s},l={};await Mt(l,e),Nt(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},{url:Ut(i),options:a}},submitToProcessing:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};xt("submitToProcessing","documentType",t),xt("submitToProcessing","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/submitToProcessing".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,Dt);let r;e&&(r=e.baseOptions);const a={method:"PUT",...r,...s},l={};await Mt(l,e),Nt(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},{url:Ut(i),options:a}},submitToSigning:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};xt("submitToSigning","documentType",t),xt("submitToSigning","applicationNumber",n),xt("submitToSigning","applicationDto",s);const i="/document/{documentType}/{applicationNumber}/submitToSigning".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),r=new URL(i,Dt);let a;e&&(a=e.baseOptions);const l={method:"PUT",...a,...o},d={};await Mt(d,e),d["Content-Type"]="application/json",Nt(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},l.data=At(s,l,e),{url:Ut(r),options:l}},submitToSupervisorProcessing:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};xt("submitToSupervisorProcessing","documentType",t),xt("submitToSupervisorProcessing","applicationNumber",n),xt("submitToSupervisorProcessing","supervisorId",s);const i="/document/{documentType}/{applicationNumber}/submitToSupervisor/{supervisorId}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))).replace("{supervisorId}",encodeURIComponent(String(s))),r=new URL(i,Dt);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...o},d={};await Mt(d,e),Nt(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},{url:Ut(r),options:l}},validateSavedDocument:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};xt("validateSavedDocument","documentType",t),xt("validateSavedDocument","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/completeApplicationChecks".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,Dt);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};Nt(i,{});let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:Ut(i),options:a}}}}(e);return{async addAuthz(n,s,o){const i=await t.addAuthz(n,s,o);return wt(i,De(),_t,e)},async apiVersion(n){const s=await t.apiVersion(n);return wt(s,De(),_t,e)},async autoUpdateOwnershipType(n){const s=await t.autoUpdateOwnershipType(n);return wt(s,De(),_t,e)},async createDoDokuDokuRel(n,s,o){const i=await t.createDoDokuDokuRel(n,s,o);return wt(i,De(),_t,e)},async createDocument(n,s,o){const i=await t.createDocument(n,s,o);return wt(i,De(),_t,e)},async createNewVersion(n,s,o,i){const r=await t.createNewVersion(n,s,o,i);return wt(r,De(),_t,e)},async deleteApplicationByNumber(n,s,o){const i=await t.deleteApplicationByNumber(n,s,o);return wt(i,De(),_t,e)},async endProceedingCircleDocuments(n,s,o,i){const r=await t.endProceedingCircleDocuments(n,s,o,i);return wt(r,De(),_t,e)},async getAccessRights(n,s,o){const i=await t.getAccessRights(n,s,o);return wt(i,De(),_t,e)},async getApplicationById(n,s){const o=await t.getApplicationById(n,s);return wt(o,De(),_t,e)},async getApplicationByNumber(n,s,o){const i=await t.getApplicationByNumber(n,s,o);return wt(i,De(),_t,e)},async getApplicationByNumberOld(n,s,o){const i=await t.getApplicationByNumberOld(n,s,o);return wt(i,De(),_t,e)},async getApplicationByNumberWithVersion(n,s,o,i){const r=await t.getApplicationByNumberWithVersion(n,s,o,i);return wt(r,De(),_t,e)},async getApplicationStateFee(n,s,o,i){const r=await t.getApplicationStateFee(n,s,o,i);return wt(r,De(),_t,e)},async getApplicationStateFeeOfVersion(n,s,o,i,r){const a=await t.getApplicationStateFeeOfVersion(n,s,o,i,r);return wt(a,De(),_t,e)},async getDocumentFileRels(n,s){const o=await t.getDocumentFileRels(n,s);return wt(o,De(),_t,e)},async getDotysBasedOnUserRights(n,s){const o=await t.getDotysBasedOnUserRights(n,s);return wt(o,De(),_t,e)},async getHealth(n){const s=await t.getHealth(n);return wt(s,De(),_t,e)},async getLastStateHistory(n,s,o){const i=await t.getLastStateHistory(n,s,o);return wt(i,De(),_t,e)},async initializeAds(n,s,o){const i=await t.initializeAds(n,s,o);return wt(i,De(),_t,e)},async mergeInstitutions(n,s){const o=await t.mergeInstitutions(n,s);return wt(o,De(),_t,e)},async reSubmit(n,s,o,i){const r=await t.reSubmit(n,s,o,i);return wt(r,De(),_t,e)},async recalculatestate(n,s,o){const i=await t.recalculatestate(n,s,o);return wt(i,De(),_t,e)},async revertCreateNewVersion(n,s,o,i){const r=await t.revertCreateNewVersion(n,s,o,i);return wt(r,De(),_t,e)},async saveAndValidate(n,s,o,i){const r=await t.saveAndValidate(n,s,o,i);return wt(r,De(),_t,e)},async saveApplicationByNumber(n,s,o,i){const r=await t.saveApplicationByNumber(n,s,o,i);return wt(r,De(),_t,e)},async setWaterExtractionPointsTestDates(n,s,o){const i=await t.setWaterExtractionPointsTestDates(n,s,o);return wt(i,De(),_t,e)},async setWaterExtractionPointsTestDatesForBuilding(n,s,o,i){const r=await t.setWaterExtractionPointsTestDatesForBuilding(n,s,o,i);return wt(r,De(),_t,e)},async submitStraightToRegistry(n,s,o){const i=await t.submitStraightToRegistry(n,s,o);return wt(i,De(),_t,e)},async submitToProcessing(n,s,o){const i=await t.submitToProcessing(n,s,o);return wt(i,De(),_t,e)},async submitToSigning(n,s,o,i){const r=await t.submitToSigning(n,s,o,i);return wt(r,De(),_t,e)},async submitToSupervisorProcessing(n,s,o,i){const r=await t.submitToSupervisorProcessing(n,s,o,i);return wt(r,De(),_t,e)},async validateSavedDocument(n,s,o){const i=await t.validateSavedDocument(n,s,o);return wt(i,De(),_t,e)}}};class Ct extends yt{addAuthz(e,t,n){return jt(this.configuration).addAuthz(e,t,n).then((e=>e(this.axios,this.basePath)))}apiVersion(e){return jt(this.configuration).apiVersion(e).then((e=>e(this.axios,this.basePath)))}autoUpdateOwnershipType(e){return jt(this.configuration).autoUpdateOwnershipType(e).then((e=>e(this.axios,this.basePath)))}createDoDokuDokuRel(e,t,n){return jt(this.configuration).createDoDokuDokuRel(e,t,n).then((e=>e(this.axios,this.basePath)))}createDocument(e,t,n){return jt(this.configuration).createDocument(e,t,n).then((e=>e(this.axios,this.basePath)))}createNewVersion(e,t,n,s){return jt(this.configuration).createNewVersion(e,t,n,s).then((e=>e(this.axios,this.basePath)))}deleteApplicationByNumber(e,t,n){return jt(this.configuration).deleteApplicationByNumber(e,t,n).then((e=>e(this.axios,this.basePath)))}endProceedingCircleDocuments(e,t,n,s){return jt(this.configuration).endProceedingCircleDocuments(e,t,n,s).then((e=>e(this.axios,this.basePath)))}getAccessRights(e,t,n){return jt(this.configuration).getAccessRights(e,t,n).then((e=>e(this.axios,this.basePath)))}getApplicationById(e,t){return jt(this.configuration).getApplicationById(e,t).then((e=>e(this.axios,this.basePath)))}getApplicationByNumber(e,t,n){return jt(this.configuration).getApplicationByNumber(e,t,n).then((e=>e(this.axios,this.basePath)))}getApplicationByNumberOld(e,t,n){return jt(this.configuration).getApplicationByNumberOld(e,t,n).then((e=>e(this.axios,this.basePath)))}getApplicationByNumberWithVersion(e,t,n,s){return jt(this.configuration).getApplicationByNumberWithVersion(e,t,n,s).then((e=>e(this.axios,this.basePath)))}getApplicationStateFee(e,t,n,s){return jt(this.configuration).getApplicationStateFee(e,t,n,s).then((e=>e(this.axios,this.basePath)))}getApplicationStateFeeOfVersion(e,t,n,s,o){return jt(this.configuration).getApplicationStateFeeOfVersion(e,t,n,s,o).then((e=>e(this.axios,this.basePath)))}getDocumentFileRels(e,t){return jt(this.configuration).getDocumentFileRels(e,t).then((e=>e(this.axios,this.basePath)))}getDotysBasedOnUserRights(e,t){return jt(this.configuration).getDotysBasedOnUserRights(e,t).then((e=>e(this.axios,this.basePath)))}getHealth(e){return jt(this.configuration).getHealth(e).then((e=>e(this.axios,this.basePath)))}getLastStateHistory(e,t,n){return jt(this.configuration).getLastStateHistory(e,t,n).then((e=>e(this.axios,this.basePath)))}initializeAds(e,t,n){return jt(this.configuration).initializeAds(e,t,n).then((e=>e(this.axios,this.basePath)))}mergeInstitutions(e,t){return jt(this.configuration).mergeInstitutions(e,t).then((e=>e(this.axios,this.basePath)))}reSubmit(e,t,n,s){return jt(this.configuration).reSubmit(e,t,n,s).then((e=>e(this.axios,this.basePath)))}recalculatestate(e,t,n){return jt(this.configuration).recalculatestate(e,t,n).then((e=>e(this.axios,this.basePath)))}revertCreateNewVersion(e,t,n,s){return jt(this.configuration).revertCreateNewVersion(e,t,n,s).then((e=>e(this.axios,this.basePath)))}saveAndValidate(e,t,n,s){return jt(this.configuration).saveAndValidate(e,t,n,s).then((e=>e(this.axios,this.basePath)))}saveApplicationByNumber(e,t,n,s){return jt(this.configuration).saveApplicationByNumber(e,t,n,s).then((e=>e(this.axios,this.basePath)))}setWaterExtractionPointsTestDates(e,t,n){return jt(this.configuration).setWaterExtractionPointsTestDates(e,t,n).then((e=>e(this.axios,this.basePath)))}setWaterExtractionPointsTestDatesForBuilding(e,t,n,s){return jt(this.configuration).setWaterExtractionPointsTestDatesForBuilding(e,t,n,s).then((e=>e(this.axios,this.basePath)))}submitStraightToRegistry(e,t,n){return jt(this.configuration).submitStraightToRegistry(e,t,n).then((e=>e(this.axios,this.basePath)))}submitToProcessing(e,t,n){return jt(this.configuration).submitToProcessing(e,t,n).then((e=>e(this.axios,this.basePath)))}submitToSigning(e,t,n,s){return jt(this.configuration).submitToSigning(e,t,n,s).then((e=>e(this.axios,this.basePath)))}submitToSupervisorProcessing(e,t,n,s){return jt(this.configuration).submitToSupervisorProcessing(e,t,n,s).then((e=>e(this.axios,this.basePath)))}validateSavedDocument(e,t,n){return jt(this.configuration).validateSavedDocument(e,t,n).then((e=>e(this.axios,this.basePath)))}}class Lt{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}const Pt="https://devkluster.ehr.ee/api/file-upload-api/v1".replace(/\/+$/,"");class Rt{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Pt,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:De();this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class Kt extends Error{constructor(e,t){super(t),this.name="RequiredError",this.field=e}}const kt="https://example.com",Ft=function(e,t,n){if(null==n)throw new Kt(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},Yt=async function(e,t){if(t&&t.accessToken){const n="function"==typeof t.accessToken?await t.accessToken():await t.accessToken;e.Authorization="Bearer "+n}},Bt=function(e){const t=new URLSearchParams(e.search);for(var n=arguments.length,s=new Array(n>1?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];for(const e of s)for(const n in e)if(Array.isArray(e[n])){t.delete(n);for(const s of e[n])t.append(n,s)}else t.set(n,e[n]);e.search=t.toString()},Vt=function(e,t,n){const s="string"!=typeof e;return(s&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):s)?JSON.stringify(void 0!==e?e:{}):e||""},Gt=function(e){return e.pathname+e.search+e.hash},Ht=function(e,t,n,s){return function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;const r={...e.options,url:((null==s?void 0:s.basePath)||i)+e.url};return o.request(r)}},Jt=function(e){const t=function(e){return{cloneFilesAndCreateRels:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Ft("cloneFilesAndCreateRels","fileIds",t);const i=new URL("/fileClone",kt);let r;e&&(r=e.baseOptions);const a={method:"POST",...r,...o},l={},d={};await Yt(l,e),t&&(d.fileIds=t),void 0!==n&&(d.docNr=n),void 0!==s&&(d.relType=s),Bt(i,d);let c=r&&r.headers?r.headers:{};return a.headers={...l,...c,...o.headers},{url:Gt(i),options:a}},deleteFile:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ft("deleteFile","fileId",t);const s="/file/{fileId}".replace("{fileId}",encodeURIComponent(String(t))),o=new URL(s,kt);let i;e&&(i=e.baseOptions);const r={method:"DELETE",...i,...n},a={};await Yt(a,e),Bt(o,{});let l=i&&i.headers?i.headers:{};return r.headers={...a,...l,...n.headers},{url:Gt(o),options:r}},downloadFile:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ft("downloadFile","fileId",t);const s="/file/{fileId}".replace("{fileId}",encodeURIComponent(String(t))),o=new URL(s,kt);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n},a={};await Yt(a,e),Bt(o,{});let l=i&&i.headers?i.headers:{};return r.headers={...a,...l,...n.headers},{url:Gt(o),options:r}},updateFile:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ft("updateFile","fileId",t);const o="/file/{fileId}".replace("{fileId}",encodeURIComponent(String(t))),i=new URL(o,kt);let r;e&&(r=e.baseOptions);const a={method:"PUT",...r,...s},l={};await Yt(l,e),l["Content-Type"]="application/json",Bt(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},a.data=Vt(n,a,e),{url:Gt(i),options:a}},updateFileInfo:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ft("updateFileInfo","doFail",t);const s=new URL("/file/info",kt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={};await Yt(r,e),r["Content-Type"]="application/json",Bt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Vt(t,i,e),{url:Gt(s),options:i}},uploadFile:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/file",kt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={},a=new(e&&e.formDataCtor||FormData);await Yt(r,e),void 0!==t&&a.append("file",t),r["Content-Type"]="multipart/form-data",Bt(s,{});let l=o&&o.headers?o.headers:{};return i.headers={...r,...l,...n.headers},i.data=a,{url:Gt(s),options:i}},uploadFileWithFileInfo:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const o=new URL("/fileWithInfo",kt);let i;e&&(i=e.baseOptions);const r={method:"POST",...i,...s},a={},l=new(e&&e.formDataCtor||FormData);await Yt(a,e),void 0!==t&&l.append("file",t),void 0!==n&&l.append("fileInfo",new Blob([JSON.stringify(n)],{type:"application/json"})),a["Content-Type"]="multipart/form-data",Bt(o,{});let d=i&&i.headers?i.headers:{};return r.headers={...a,...d,...s.headers},r.data=l,{url:Gt(o),options:r}},uploadFileWithFileInfoAndDocRel:async function(t,n,s,o){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const r=new URL("/fileWithInfoAndDocRel",kt);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...i},d={},c=new(e&&e.formDataCtor||FormData);await Yt(d,e),void 0!==t&&c.append("file",t),void 0!==n&&c.append("fileInfo",new Blob([JSON.stringify(n)],{type:"application/json"})),void 0!==s&&c.append("docNr",s),void 0!==o&&c.append("relType",o),d["Content-Type"]="multipart/form-data",Bt(r,{});let u=a&&a.headers?a.headers:{};return l.headers={...d,...u,...i.headers},l.data=c,{url:Gt(r),options:l}}}}(e);return{async cloneFilesAndCreateRels(n,s,o,i){const r=await t.cloneFilesAndCreateRels(n,s,o,i);return Ht(r,De(),Pt,e)},async deleteFile(n,s){const o=await t.deleteFile(n,s);return Ht(o,De(),Pt,e)},async downloadFile(n,s){const o=await t.downloadFile(n,s);return Ht(o,De(),Pt,e)},async updateFile(n,s,o){const i=await t.updateFile(n,s,o);return Ht(i,De(),Pt,e)},async updateFileInfo(n,s){const o=await t.updateFileInfo(n,s);return Ht(o,De(),Pt,e)},async uploadFile(n,s){const o=await t.uploadFile(n,s);return Ht(o,De(),Pt,e)},async uploadFileWithFileInfo(n,s,o){const i=await t.uploadFileWithFileInfo(n,s,o);return Ht(i,De(),Pt,e)},async uploadFileWithFileInfoAndDocRel(n,s,o,i,r){const a=await t.uploadFileWithFileInfoAndDocRel(n,s,o,i,r);return Ht(a,De(),Pt,e)}}};class Wt extends Rt{cloneFilesAndCreateRels(e,t,n,s){return Jt(this.configuration).cloneFilesAndCreateRels(e,t,n,s).then((e=>e(this.axios,this.basePath)))}deleteFile(e,t){return Jt(this.configuration).deleteFile(e,t).then((e=>e(this.axios,this.basePath)))}downloadFile(e,t){return Jt(this.configuration).downloadFile(e,t).then((e=>e(this.axios,this.basePath)))}updateFile(e,t,n){return Jt(this.configuration).updateFile(e,t,n).then((e=>e(this.axios,this.basePath)))}updateFileInfo(e,t){return Jt(this.configuration).updateFileInfo(e,t).then((e=>e(this.axios,this.basePath)))}uploadFile(e,t){return Jt(this.configuration).uploadFile(e,t).then((e=>e(this.axios,this.basePath)))}uploadFileWithFileInfo(e,t,n){return Jt(this.configuration).uploadFileWithFileInfo(e,t,n).then((e=>e(this.axios,this.basePath)))}uploadFileWithFileInfoAndDocRel(e,t,n,s,o){return Jt(this.configuration).uploadFileWithFileInfoAndDocRel(e,t,n,s,o).then((e=>e(this.axios,this.basePath)))}}class qt{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}const $t="https://devkluster.ehr.ee/api/yld-esi/v1".replace(/\/+$/,"");class zt{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:De();this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class Xt extends Error{constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const Qt="https://example.com",Zt=function(e,t,n){if(null==n)throw new Xt(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function en(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>en(e,t,n))):Object.keys(t).forEach((s=>en(e,t[s],`${n}${""!==n?".":""}${s}`))):e.has(n)?e.append(n,t):e.set(n,t))}const tn=function(e){const t=new URLSearchParams(e.search);for(var n=arguments.length,s=new Array(n>1?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];en(t,s),e.search=t.toString()},nn=function(e){return e.pathname+e.search+e.hash},sn=function(e,t,n,s){return function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;const r={...e.options,url:((null==s?void 0:s.basePath)||o.defaults.baseURL||i)+e.url};return o.request(r)}};const on=function(e){return{esileht:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Zt("esileht","id",t),Zt("esileht","language",n);const o="/public/page/{id}/{language}".replace("{id}",encodeURIComponent(String(t))).replace("{language}",encodeURIComponent(String(n))),i=new URL(o,Qt);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};tn(i,{});let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:nn(i),options:a}},lehed:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/api/pages",Qt);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};tn(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:nn(n),options:o}},lehedId:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/api/pages/dotyid",Qt);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};tn(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:nn(n),options:o}},leht:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Zt("leht","id",t);const s="/api/pages/{id}".replace("{id}",encodeURIComponent(String(t))),o=new URL(s,Qt);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};tn(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:nn(o),options:r}},lehtdSave:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Zt("lehtdSave","esileht",t);const s=new URL("/api/pages",Qt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={};r["Content-Type"]="application/json",tn(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=function(e,t,n){const s="string"!=typeof e;return(s&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):s)?JSON.stringify(void 0!==e?e:{}):e||""}(t,i,e),{url:nn(s),options:i}}}},rn=function(e){const t=on(e);return{async esileht(n,s,o){const i=await t.esileht(n,s,o);return sn(i,De(),$t,e)},async lehed(n){const s=await t.lehed(n);return sn(s,De(),$t,e)},async lehedId(n){const s=await t.lehedId(n);return sn(s,De(),$t,e)},async leht(n,s){const o=await t.leht(n,s);return sn(o,De(),$t,e)},async lehtdSave(n,s){const o=await t.lehtdSave(n,s);return sn(o,De(),$t,e)}}};class an extends zt{esileht(e,t,n){return rn(this.configuration).esileht(e,t,n).then((e=>e(this.axios,this.basePath)))}lehed(e){return rn(this.configuration).lehed(e).then((e=>e(this.axios,this.basePath)))}lehedId(e){return rn(this.configuration).lehedId(e).then((e=>e(this.axios,this.basePath)))}leht(e,t){return rn(this.configuration).leht(e,t).then((e=>e(this.axios,this.basePath)))}lehtdSave(e,t){return rn(this.configuration).lehtdSave(e,t).then((e=>e(this.axios,this.basePath)))}}class ln{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}const dn={myViewsApiEndpoint:window.REACT_APP_MY_VIEWS_API_PATH,classifierApiEndpoint:window.REACT_APP_CLASSIFIER_SERVICE_ENDPOINT,userApiEndpoint:window.REACT_APP_USER_SERVICE_ENDPOINT,documentApiEndpoint:window.REACT_APP_DOCUMENT_SERVICE_ENDPOINT,fileUploadApiEndpoint:window.REACT_APP_FILE_UPLOAD_API_ENDPOINT,frontPageApiEndpoint:window.REACT_APP_YLD_API},cn={proceedingApiService:new vt(new Et({basePath:dn.myViewsApiEndpoint})),classifierApiService:new Le(new Pe({basePath:dn.classifierApiEndpoint})),personApiService:new ze(new tt({basePath:dn.userApiEndpoint})),userApiService:new et(new tt({basePath:dn.userApiEndpoint})),myDocumentBaseApiService:new mt(new Et({basePath:dn.myViewsApiEndpoint})),documentApiService:new Ct(new Lt({basePath:dn.documentApiEndpoint})),fileApiService:new Wt(new qt({basePath:dn.fileUploadApiEndpoint})),frontPageApi:new an(new ln({basePath:dn.frontPageApiEndpoint})),institutionKovEndpointApi:new qe(new tt({basePath:dn.userApiEndpoint}))};var un=c(848);const pn=11272,hn=e=>{var t;let{userInfo:n}=e;const s=(0,Q.useIntl)(),[o,i]=(0,z.useState)(!0),[r,a]=(0,z.useState)(""),[l,d]=(0,z.useState)(""),c=(null===(t=n.activeRole)||void 0===t?void 0:t.businessType)===fe.MKM;(0,z.useEffect)((()=>{c?u():p()}),[]);const u=async()=>{cn.frontPageApi.leht(pn).then((e=>{const t=e.data;t[0].body&&(a(t[0].body),d(t[0].body))}))},p=async()=>{cn.frontPageApi.esileht(pn,"ee").then((e=>{const t=e.data;t.body&&(a(t.body),d(t.body))}))};return(0,un.jsx)(Z.Section,{collapsed:!1,title:"my_admin_proceedings.admin_proceedings_reminder",showSettings:!0,children:(0,un.jsxs)("div",{className:o?"d-flex justify-content-between":"",children:[(0,un.jsx)(Z.RichTextEditor,{placeholder:o?"":s.formatMessage({id:"placeholder.writing"}),onChange:e=>d(e),value:l,readOnly:o,view:o}),c&&o&&(0,un.jsx)(Z.Link,{onClick:()=>i(!1),type:"edit"}),!o&&(0,un.jsxs)("div",{className:"pt-2",children:[(0,un.jsx)(Z.Button,{colourScheme:"light",squared:!0,onClick:()=>{d(r),i(!0)},children:s.formatMessage({id:"button.cancel"})}),(0,un.jsx)(Z.Button,{className:"float-right",colourScheme:"success",squared:!0,onClick:()=>(async()=>{i(!o),a(l),cn.frontPageApi.lehtdSave({id:pn,body:l,language:"ee"})})(),children:s.formatMessage({id:"button.save"})})]})]})})},mn={default:"header-arrow-up-down-icon",des:"header-arrow-down-icon",asc:"header-arrow-up-icon"},gn=e=>(0,un.jsx)(Z.Tooltip,{content:(0,un.jsx)(Z.Text,{raw:e.tooltipText}),placement:"bottom",theme:"dark",children:e.functionCall?(0,un.jsx)(Z.Link,{onClick:t=>{var n;return null===(n=e.functionCall)||void 0===n?void 0:n.call(e,t)},text:e.linkName,href:e.href}):(0,un.jsx)(Z.Link,{text:e.linkName,href:e.href,onClick:t=>{t.preventDefault(),t.stopPropagation();const n=window.open(e.href,"_blank");null==n||n.focus()}})},e.linkName),Sn=e=>{let{proceedings:t,linkGen:n}=e;const s=(0,Q.useIntl)(),o=[{id:"document_type",property:"documentType",size:180,getValue:e=>{var t;return null!==(t=e.documentType)&&void 0!==t?t:""}},{id:"proceeding_nr",property:"proceedingNr",size:130,getValue:e=>{return(t=e).proceedingNr?(0,un.jsx)(gn,{linkName:t.proceedingNr,tooltipText:"detailsearch.tooltip.open_proceeding",functionCall:e=>{n(!0,e,void 0,`administrativeActProceeding/${t.proceedingNr}`)}}):(0,un.jsx)(un.Fragment,{children:"-"});var t}},{id:"doty",property:"document",size:160,getValue:e=>e.document&&null!==e.document?(0,un.jsx)(gn,{linkName:e.document,tooltipText:"detailsearch.tooltip.open_document",functionCall:t=>{n(!0,t,"DOCUMENT",e.document)}}):""},{id:"ehr_code",property:"ehrCode",size:130,getValue:e=>e.ehrCode&&null!==e.ehrCode?e.ehrCode.map(((t,s)=>(0,un.jsxs)(un.Fragment,{children:[(0,un.jsx)(gn,{linkName:t,tooltipText:"detailsearch.tooltip.open_building",functionCall:e=>{n(!0,e,"BUILDING",t)}}),s!==e.ehrCode.length-1?(0,un.jsx)("span",{children:", "}):""]}))):""},{id:"building_address",property:"buildingAddress",size:160,getValue:e=>e.address&&null!==e.address?e.address.map((e=>(0,un.jsx)("div",{children:e}))):""},{id:"proceeding_state",property:"state",size:130,getValue:e=>e.state}];return(0,un.jsx)(Z.TableComponent,{config:{thead:{headers:o.map((e=>({id:e.id,size:e.size,className:"table-header-field text-align-left",label:s.formatMessage({id:"my_admin_proceedings.table.header."+e.id}),tooltip:{text:s.formatMessage({id:"my_admin_proceedings.table.tooltip."+e.id})},propertyName:e.property,sortable:!0,isShown:!0,type:"input",valueFormatter:t=>e.getValue(t)}))),icons:mn,expandableRow:!1,isFilter:!1}},data:t,handleEvent:()=>!0})},fn=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const[n,s]=(0,z.useState)(!1),[o,i]=(0,z.useState)(void 0),[r,a]=(0,z.useState)([]);(0,z.useEffect)((()=>{i(void 0),l()}),[e,t]);const l=async()=>{var n;if((null===(n=e.activeRole)||void 0===n?void 0:n.businessType)===fe.TJA){s(!0);try{var o;const n=t?{institutionId:e.activeRole.businessId}:{userId:e.userId},s=await cn.proceedingApiService.findAreaProceedings(n);a(null!==(o=null==s?void 0:s.data)&&void 0!==o?o:[])}catch(e){i("my_admin_proceedings.proceedings_request.error")}finally{s(!1)}}else a([])};return{loading:n,proceedings:r,error:o}},In=e=>{let{userInfo:t,linkGen:n}=e;const s=(0,Q.useIntl)(),[o,i]=(0,z.useState)(!1),{loading:r,error:a,proceedings:l}=fn(t,o);return(0,un.jsxs)(Z.Section,{collapsed:!1,title:"my_admin_proceedings.my_proceedings",showSettings:!0,children:[a&&(0,un.jsx)(Z.MessageBlock,{dismissible:!1,theme:"danger",children:s.formatMessage({id:a})}),r&&(0,un.jsxs)(Z.Row,{className:"mb-4 justify-content-center",children:[(0,un.jsx)("br",{}),(0,un.jsx)(Z.Loader,{}),(0,un.jsx)("br",{})]}),!r&&!(null==l||!l.length)&&!a&&(0,un.jsx)(Sn,{proceedings:l,linkGen:n}),(0,un.jsx)("div",{className:"d-flex justify-content-start my-2",children:(0,un.jsx)(Z.Checkbox,{name:"checkbox",onChange:e=>i(e),text:s.formatMessage({id:"my_proceedings.view_all_institution_admin_proceedings"}),checked:o})})]})},Tn=e=>{var t;let{userInfo:n,linkGen:s}=e;const o=(0,Q.useIntl)(),i=(null===(t=n.activeRole)||void 0===t?void 0:t.businessType)===fe.TJA;return(0,un.jsxs)("div",{children:[(0,un.jsx)("h2",{children:o.formatMessage({id:"my_admin_proceedings.page_title"})}),i&&(0,un.jsx)("div",{className:"d-flex justify-content-end mt-2",children:(0,un.jsx)(Z.Button,{withPlus:!0,type:"submit",onClick:()=>{s(!0,void 0,"","/administrativeActProceeding")},children:o.formatMessage({id:"my_admin_proceedings.new_proceeding"})})}),(0,un.jsx)(hn,{userInfo:n}),i&&(0,un.jsx)(In,{userInfo:n,linkGen:s})]})};var vn=c(130),En=c(558),_n=c.n(En);function yn(e,t,n){const s=n(e).trim(),o=n(t).trim();return s.toLowerCase()===o.toLowerCase()?0:""===s?1:""===o?-1:s.toLowerCase()>o.toLowerCase()?1:-1}function bn(e,t,n){const s=n(e),o=n(t);return s===o?0:s>o?1:-1}function Dn(e){if("0"===e.done&&"0"===e.all)return 15;if(e.done===e.all)return 9;let t=parseInt(e.done)/parseInt(e.all);return 1===t&&(t+=parseInt(e.all)/1e4),t}function xn(e,t,n){const s=n(e),o=n(t),i=Dn(s),r=Dn(o);return r===i?0:i>r?1:-1}function Mn(e,t,n){const s=n(e),o=n(t);return s===o?0:s>o?1:-1}function On(e,t,n){if(0===e.length)return e;const s={string:yn,number:bn,object:xn,date:Mn}[typeof t(e[0])];return[...e].sort(((e,o)=>s(e,o,t)*n))}const Nn=0,An=1,Un=-1;function wn(e,t){return{column:e,direction:e===t.column?function(e){switch(e){case Nn:return An;case An:return Un;case Un:return An}}(t.direction):An}}const jn=e=>-1===e.sortDirection?(0,un.jsx)("svg",{width:"10",height:"8",viewBox:"0 8 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,un.jsx)("path",{d:"M1.55 6.05L5 2.6L8.45 6.05L9.5 5L5 0.5L0.5 5L1.55 6.05ZM1.55 9.95L5 13.4L8.45 9.95L9.5 11L5 15.5L0.5 11L1.55 9.95Z",fill:"#5D6071"})}):1===e.sortDirection?(0,un.jsx)("svg",{width:"10",height:"8",viewBox:"0 0 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,un.jsx)("path",{d:"M1.55 6.05L5 2.6L8.45 6.05L9.5 5L5 0.5L0.5 5L1.55 6.05ZM1.55 9.95L5 13.4L8.45 9.95L9.5 11L5 15.5L0.5 11L1.55 9.95Z",fill:"#5D6071"})}):(0,un.jsx)("svg",{width:"10",height:"16",viewBox:"0 0 10 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,un.jsx)("path",{d:"M1.55 6.05L5 2.6L8.45 6.05L9.5 5L5 0.5L0.5 5L1.55 6.05ZM1.55 9.95L5 13.4L8.45 9.95L9.5 11L5 15.5L0.5 11L1.55 9.95Z",fill:"#5D6071"})}),Cn=e=>{const[t,n]=(0,z.useState)(!1);return(0,un.jsx)(un.Fragment,{children:e.fileId&&(0,un.jsx)(Z.ControlledPopover,{content:(0,un.jsxs)("div",{style:{width:"250px"},children:[(0,un.jsx)("h4",{children:(0,un.jsx)(Q.FormattedMessage,{id:"download.file"})}),(0,un.jsx)("br",{}),(0,un.jsxs)("div",{className:"d-flex justify-content-between mt-2",children:[(0,un.jsx)(Z.Button,{colourScheme:"light",type:"reset",squared:!0,children:(0,un.jsx)(Q.FormattedMessage,{id:"button.cancel"})}),(0,un.jsx)(Z.Button,{className:"float-right",colourScheme:"success",onClick:()=>{e.fileId&&e.fileApi.downloadFile(e.fileId,{responseType:"blob"}).then((e=>{const s=e.headers["content-disposition"];let o="download";if(s){const e=s.match(/filename\*=UTF-8''(.+?)(;|$)/);e&&e.length>=2&&(o=decodeURIComponent(e[1].replace(/\+/g," ")))}const i=new Blob([e.data],{}),r=document.createElement("a");r.download=o,r.href=URL.createObjectURL(i),r.addEventListener("click",(()=>{setTimeout((()=>URL.revokeObjectURL(r.href)),3e4)})),r.click(),n(!t)})).catch((e=>console.log(e)))},squared:!0,type:"submit",children:(0,un.jsx)(Q.FormattedMessage,{id:"button.download"})})]})]}),open:t,placement:"bottom-end",toggle:()=>n(!t),children:(0,un.jsx)(Z.Icon,{tooltipText:(0,un.jsx)(Q.FormattedMessage,{id:"tooltip.download"}),type:"download"})})})};let Ln=function(e){return e.DO_DOKUSEIS_ESITATUD="DO_DOKUSEIS_ESITATUD",e.DO_DOKUSEIS_KEHTETU="DO_DOKUSEIS_KEHTETU",e.DO_DOKUSEIS_KOOSTAMISEL="DO_DOKUSEIS_KOOSTAMISEL",e.DO_DOKUSEIS_EELNOU_AKTIIVNE="DO_DOKUSEIS_EELNOU_AKTIIVNE",e.DO_DOKUSEIS_ALLKIRJASTAMISEL="DO_DOKUSEIS_ALLKIRJASTAMISEL",e.DO_DOKUSEIS_MENETLUSES="DO_DOKUSEIS_MENETLUSES",e.DO_DOKUSEIS_MUUTMISEL="DO_DOKUSEIS_MUUTMISEL",e.DO_DOKUSEIS_TAIENDAMISEL="DO_DOKUSEIS_TAIENDAMISEL",e.DO_DOKUSEIS_TYHISTATUD="DO_DOKUSEIS_TYHISTATUD",e.DO_DOKUSEIS_VANA_VERSIOON="DO_DOKUSEIS_VANA_VERSIOON",e.DO_DOKUSEIS_LOOBUTUD="DO_DOKUSEIS_LOOBUTUD",e.DO_DOKUSEIS_ALLKIRJASTATUD="DO_DOKUSEIS_ALLKIRJASTATUD",e.DO_DOKUSEIS_MENETLETUD="DO_DOKUSEIS_MENETLETUD",e.DO_DOKUSEIS_LUBATUD="DO_DOKUSEIS_LUBATUD",e.DO_DOKUSEIS_LUB_TEAV="DO_DOKUSEIS_LUB_TEAV",e.DO_DOKUSEIS_KEELDUTUD="DO_DOKUSEIS_KEELDUTUD",e.DO_DOKUSEIS_TEAVITATUD="DO_DOKUSEIS_TEAVITATUD",e.DO_DOKUSEIS_REG_KANTUD="DO_DOKUSEIS_REG_KANTUD",e.DO_DOKUSEIS_ANTUD="DO_DOKUSEIS_ANTUD",e.DO_DOKUSEIS_KEHTIV="DO_DOKUSEIS_KEHTIV",e.DO_DOKUSEIS_TUNNIST_KEHTETUKS="DO_DOKUSEIS_TUNNIST_KEHTETUKS",e.DO_DOKUSEIS_KOOSK_RINGIL="DO_DOKUSEIS_KOOSK_RINGIL",e.DO_DOKUSEIS_EM_KINNITATUD_AKTUAL="DO_DOKUSEIS_EM_KINNITATUD_AKTUAL",e}({});const Pn=[{code:Ln.DO_DOKUSEIS_ESITATUD,value:"Esitatud"},{code:Ln.DO_DOKUSEIS_KOOSTAMISEL,value:"Koostamisel"},{code:Ln.DO_DOKUSEIS_MENETLUSES,value:"Menetluses"},{code:Ln.DO_DOKUSEIS_MUUTMISEL,value:"Muutmisel"},{code:Ln.DO_DOKUSEIS_TAIENDAMISEL,value:"Täiendamisel"}],Rn=[{code:Ln.DO_DOKUSEIS_KEHTETU,value:"Kehtetu"},{code:Ln.DO_DOKUSEIS_REG_KANTUD,value:"Registrisse kantud"},{code:Ln.DO_DOKUSEIS_TYHISTATUD,value:"Tühistatud"},{code:Ln.DO_DOKUSEIS_LOOBUTUD,value:"Tagasi võetud"}];function Kn(e){const t=(e,t)=>({name:e,type:t});switch(Ln[e]){case Ln.DO_DOKUSEIS_ESITATUD:return t("Esitatud",pe.INFO);case Ln.DO_DOKUSEIS_KEHTETU:return t("Kehtetu",pe.DEFAULT);case Ln.DO_DOKUSEIS_KOOSTAMISEL:case Ln.DO_DOKUSEIS_EELNOU_AKTIIVNE:return t("Koostamisel",pe.INFO);case Ln.DO_DOKUSEIS_ALLKIRJASTAMISEL:return t("Allkirjastamisel",pe.INFO);case Ln.DO_DOKUSEIS_MENETLUSES:return t("Menetluses",pe.INFO);case Ln.DO_DOKUSEIS_MUUTMISEL:return t("Muutmisel",pe.INFO);case Ln.DO_DOKUSEIS_TAIENDAMISEL:return t("Täiendamisel",pe.WARNING);case Ln.DO_DOKUSEIS_TYHISTATUD:return t("Tühistatud",pe.DEFAULT);case Ln.DO_DOKUSEIS_VANA_VERSIOON:return t("Vana versioon",pe.DEFAULT);case Ln.DO_DOKUSEIS_LOOBUTUD:return t("Tagasi võetud",pe.DEFAULT);case Ln.DO_DOKUSEIS_ALLKIRJASTATUD:return t("Allkirjastatud",pe.INFO);case Ln.DO_DOKUSEIS_MENETLETUD:return t("Menetletud",pe.SUCCESS);case Ln.DO_DOKUSEIS_LUBATUD:return t("Lubatud/Teavitatud",pe.SUCCESS);case Ln.DO_DOKUSEIS_LUB_TEAV:return t("Lubatud/Teavitatud",pe.WARNING);case Ln.DO_DOKUSEIS_KEELDUTUD:return t("Keelatud/Tagasi lükatud",pe.DANGER);case Ln.DO_DOKUSEIS_TEAVITATUD:return t("Teavitatud",pe.SUCCESS);case Ln.DO_DOKUSEIS_REG_KANTUD:return t("Registrisse kantud",pe.SUCCESS);case Ln.DO_DOKUSEIS_ANTUD:return t("Antud",pe.SUCCESS);case Ln.DO_DOKUSEIS_EM_KINNITATUD_AKTUAL:case Ln.DO_DOKUSEIS_KEHTIV:return t("Kehtiv",pe.SUCCESS);case Ln.DO_DOKUSEIS_TUNNIST_KEHTETUKS:return t("Tunnistatud kehtetuks",pe.DEFAULT);case Ln.DO_DOKUSEIS_KOOSK_RINGIL:return t("Kooskõlastusringil",pe.INFO);default:return t(e,pe.DEFAULT)}}function kn(e){let t=[];e===te?t=Pn:e===ne&&(t=Rn);return function(e){return e.map((e=>({id:e.code+"",label:e.value,level:2,children:[],selectable:!0,value:!1})))}(t.sort(((e,t)=>e.value.localeCompare(t.value))))}function Fn(e,t){if(t.documentTypes.length>0&&(e=e.filter((e=>void 0!==e.doty&&t.documentTypes.includes(e.doty)))),t.ehrCode.length>0&&(e=e.filter((e=>{var n;return null===(n=e.ehrCode)||void 0===n?void 0:n.some((e=>{var n;return null!==(n=e.startsWith(t.ehrCode.trim()))&&void 0!==n&&n}))}))),t.buildingName.length>0&&(e=e.filter((e=>{var n;return null===(n=e.buildingName)||void 0===n?void 0:n.some((e=>{var n,s;return null!==(n=null==e||null===(s=e.toLocaleLowerCase())||void 0===s?void 0:s.includes(t.buildingName.toLocaleLowerCase()))&&void 0!==n&&n}))}))),t.wordInAddress.length>0&&(e=e.filter((e=>{var n,s;return null!==(n=null===(s=e.buildingAddress)||void 0===s?void 0:s.some((e=>null==e?void 0:e.toLocaleLowerCase().includes(t.wordInAddress.trim().toLocaleLowerCase()))))&&void 0!==n&&n}))),t.documentNumber.length>0&&(e=e.filter((e=>{var n,s;return null!==(n=null===(s=e.docNr)||void 0===s?void 0:s.includes(t.documentNumber.trim()))&&void 0!==n&&n}))),t.documentStates.length>0&&(e=e.filter((e=>{return(n=e.stateCode)&&[Ln.DO_DOKUSEIS_MENETLETUD,Ln.DO_DOKUSEIS_LUBATUD,Ln.DO_DOKUSEIS_LUB_TEAV,Ln.DO_DOKUSEIS_KEELDUTUD,Ln.DO_DOKUSEIS_TEAVITATUD,Ln.DO_DOKUSEIS_REG_KANTUD,Ln.DO_DOKUSEIS_ANTUD,Ln.DO_DOKUSEIS_KEHTIV].includes(n)?t.documentStates.includes(Ln.DO_DOKUSEIS_REG_KANTUD):e.stateCode&&t.documentStates.includes(e.stateCode);var n}))),t.institutionUsers.length>0&&(e=e.filter((e=>(void 0!==e.presenter||null!==e.presenter)&&t.institutionUsers.find((t=>{var n;return!0===(null===(n=e.connectedPersonId)||void 0===n?void 0:n.includes(t))}))))),t.proceedingNumber.length>0&&(e=e.filter((e=>{var n,s;return null!==(n=null===(s=e.proceedingNr)||void 0===s?void 0:s.includes(t.proceedingNumber.trim()))&&void 0!==n&&n}))),t.institutions.length>0&&(e=e.filter((e=>void 0!==e.institutionId&&t.institutions.includes(e.institutionId)))),!0===t.proceedingMissing&&(e=e.filter((e=>null===e.proceedingNr||void 0===e.proceedingNr))),t.documentDate.from.length>0&&0===t.documentDate.to.length){const n=new Date(t.documentDate.from).getTime();e=e.filter((e=>new Date(_n()(e.docDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n))}if(t.documentDate.to.length>0&&0===t.documentDate.from.length){const n=new Date(t.documentDate.to).getTime();e=e.filter((e=>new Date(_n()(e.docDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()<=n))}if(t.documentDate.from.length>0&&t.documentDate.to.length>0){const n=new Date(t.documentDate.from).getTime(),s=new Date(t.documentDate.to).getTime();e=e.filter((e=>new Date(_n()(e.docDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n&&new Date(_n()(e.docDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()<=s))}return e}function Yn(e){return null!=e}function Bn(e,t){return Object.keys(e).find((n=>e[n]===Object.values(e).find((e=>e.includes(t)))))}function Vn(e){var t,n,s,o;const[i,r]=(0,z.useState)(!1);function a(){r(!i)}const l=(0,un.jsxs)("div",{children:[(0,un.jsx)("h4",{children:(0,un.jsx)(Q.FormattedMessage,{defaultMessage:"Kas olete kindel, et soovite selle rea kustutada?",id:null!==(t=e.titleText)&&void 0!==t?t:"common.confirmation.modal.header"})}),(0,un.jsx)("p",{children:(0,un.jsx)(Q.FormattedMessage,{defaultMessage:"Kustutatud ridu ei ole võimalik hiljem taastada",id:null!==(n=e.messageText)&&void 0!==n?n:"common.confirmation.modal.description"})}),(0,un.jsxs)("div",{children:[(0,un.jsx)(Z.Button,{colourScheme:"light",squared:!0,type:"reset",children:(0,un.jsx)(Q.FormattedMessage,{defaultMessage:"Loobun",id:"common.confirmation.modal.no"})}),(0,un.jsx)(Z.Button,{className:"float-right",colourScheme:"danger",onClick:()=>(e.onConfirm(),void a()),squared:!0,type:"submit",children:(0,un.jsx)(Q.FormattedMessage,{defaultMessage:"Kustutan",id:"common.confirmation.modal.yes"})})]})]});return(0,un.jsx)(Z.ControlledPopover,{delegateFocusOnOpen:null===(s=e.delegateFocusOnOpen)||void 0===s||s,className:"popover-confirm",content:e.content||l,open:i,placement:"top-end",theme:"danger",toggle:()=>a(),wrapperClassName:null!==(o=e.wrapperClassName)&&void 0!==o?o:"",children:e.children})}function Gn(e){return(0,un.jsx)(Vn,{titleText:e.titleText,messageText:e.messageText,onConfirm:e.onConfirm,children:(0,un.jsx)(Z.Icon,{tooltipText:(0,un.jsx)(Q.FormattedMessage,{id:"tooltip.delete"}),type:"delete"})})}const Hn=e=>{let{linkName:t,functionCall:n,tooltipText:s}=e;return(0,un.jsxs)(un.Fragment,{children:[(0,un.jsx)(Z.Link,{onClick:e=>null==n?void 0:n(e),text:(0,un.jsx)(Z.Text,{raw:t})}),(0,un.jsx)(Z.Info,{tooltipText:s})]})};var Jn,Wn=new Uint8Array(16);function qn(){if(!Jn&&!(Jn="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Jn(Wn)}const $n=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const zn=function(e){return"string"==typeof e&&$n.test(e)};for(var Xn=[],Qn=0;Qn<256;++Qn)Xn.push((Qn+256).toString(16).substr(1));const Zn=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Xn[e[t+0]]+Xn[e[t+1]]+Xn[e[t+2]]+Xn[e[t+3]]+"-"+Xn[e[t+4]]+Xn[e[t+5]]+"-"+Xn[e[t+6]]+Xn[e[t+7]]+"-"+Xn[e[t+8]]+Xn[e[t+9]]+"-"+Xn[e[t+10]]+Xn[e[t+11]]+Xn[e[t+12]]+Xn[e[t+13]]+Xn[e[t+14]]+Xn[e[t+15]]).toLowerCase();if(!zn(n))throw TypeError("Stringified UUID is invalid");return n};const es=function(e,t,n){var s=(e=e||{}).random||(e.rng||qn)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t){n=n||0;for(var o=0;o<16;++o)t[n+o]=s[o];return t}return Zn(s)},ts=e=>{let{notificationStyle:t,header:n,link:s,body:o,onCloseNotification:i,isNotClosable:r,customBody:a}=e;const l=(0,Q.useIntl)(),d=null!=a?a:(0,un.jsxs)("div",{children:[(0,un.jsx)("h3",{className:"alert-heading",children:n}),(0,un.jsx)("p",{className:"alert-body mb-0",children:o}),s&&(0,un.jsx)("div",{className:"mx-2",children:(0,un.jsx)(Z.Link,{onClick:s.onClick,text:l.formatMessage({id:s.text})})})]});return r?(0,un.jsx)("div",{id:"danger-toast",className:`alert ${t}`,children:d}):(0,un.jsxs)("div",{id:"danger-toast",className:`alert alert-toast-box ${t}`,children:[(0,un.jsx)("a",{className:"toast-close icon-close",role:"button","data-toggle":"tooltip","data-tooltip-placement":"bottom","data-tooltip-class":"tooltip-icon","data-tooltip-trigger":"hover focus","data-tooltip-title":"Sulgen","aria-label":"Sulgen","data-animation":"false",onClick:i}),d]})};let ns=function(e){return e.Danger="danger",e.Warning="warning",e.Info="info",e.Success="success",e}({});const ss=()=>{const e=(0,Q.useIntl)(),t=(0,vn.useDispatch)(),n=(0,vn.useSelector)(G),[s,o]=(0,z.useState)();(0,z.useEffect)((()=>{n&&o(n)}),[n]);const i=t=>{if(t)return"string"==typeof t?e.formatMessage({id:t}):t.values?e.formatMessage({id:t.id},{...t.values}):e.formatMessage({id:t.id})};return(0,un.jsx)(un.Fragment,{children:(0,un.jsx)("div",{className:"notification-alert-box",children:(0,un.jsx)("ul",{children:(null==s?void 0:s.length)>0&&s.map((e=>{var n;return(0,un.jsx)("li",{children:e.theme&&(0,un.jsx)(ts,{notificationStyle:"alert-"+e.theme+" show",header:i(null!==(n=e.messageCode)&&void 0!==n?n:e.header),body:e.messageCode?void 0:i(e.body),onCloseNotification:()=>{return n=e.id,void t(W(n));var n},link:e.link})},e.id)}))})})})},os=(0,p.createAsyncThunk)("globalUI/handleNotification",(async(e,t)=>{let{dispatch:n,getState:s}=t;const o=s().myViewsPage.notifications.notices,i=es(),r={...e,id:i};n(J([...o,r])),e.theme!==ns.Danger&&setTimeout((()=>{n(W(i))}),7e3)})),is=(0,p.createAsyncThunk)("document/createDocument",(async(e,t)=>{let{addEntityDto:n,successCallback:s}=e,{dispatch:o}=t;try{const e=await cn.documentApiService.createDocument(n.documentType,n);return s&&s(e.data),o(H()),e.data}catch(e){o(os({header:"request.error.create_document.title",body:"request.error.create_document.message",theme:ns.Danger}))}})),rs=e=>{var t;let{doty:n,documentId:s,linkGen:o,userInfo:i}=e;const r=(0,vn.useDispatch)(),[a,l]=(0,z.useState)(!1),d=(null==i||null===(t=i.activeRole)||void 0===t?void 0:t.businessType)===fe.TJA,c=(e,t)=>{if(!t)return;r(is({addEntityDto:{documentType:t,baseDocumentId:s},successCallback:t=>((e,t)=>{const n=`${e.documentTypeWithYear}/${e.documentNumber}`;e&&o(!0,t,ge,n)})(t,e)}))};return(0,un.jsx)(Z.ControlledPopover,{content:(()=>{const e=n,t=_e[e],s=ye[e];return(0,un.jsxs)("div",{children:[(0,un.jsxs)("ul",{children:[(0,un.jsx)("li",{className:"d-flex justify-content-between",children:(0,un.jsx)(Hn,{linkName:"my_documents.document_table.more_actions.request_document_cancellation",tooltipText:`my_documents.document_table.more_actions.request_document_cancellation.tooltip.${e}`,functionCall:e=>{c(e,s),l(!a)}})}),d&&(0,un.jsx)("li",{className:"d-flex justify-content-between",children:(0,un.jsx)(Hn,{linkName:"my_documents.document_table.more_actions.cancel_document",tooltipText:`my_documents.document_table.more_actions.cancel_document.tooltip.${e}`,functionCall:e=>{c(e,t),l(!a)}})})]}),(0,un.jsx)(Z.Button,{onClick:()=>{l(!1)},squared:!0,colourScheme:"light",children:(0,un.jsx)(Q.FormattedMessage,{id:"button.cancel"})})]})})(),open:a,placement:"bottom-end",toggle:()=>l(!a),children:(0,un.jsx)("div",{className:"pl-2",children:(0,un.jsx)(Z.Icon,{tooltipText:(0,un.jsx)(Q.FormattedMessage,{id:"tooltip.more_actions"}),type:"more"})})})},as=e=>{var t;let{linkGen:n,userInfo:s,documentType:o,onAllUsersChecked:i,isAllUsersChecked:r,filter:a,onDocumentDelete:l,fileApi:d,hidePresenter:c}=e;const u=(0,Q.useIntl)(),[p,h]=(0,z.useState)({offset:0,limit:10}),[m,g]=(0,z.useState)([]),[S,f]=(0,z.useState)({column:0,direction:Nn}),[I,T]=(0,z.useState)(!1),[v,E]=(0,z.useState)(!1),[_,y]=(0,z.useState)(!1),b=(0,vn.useSelector)((e=>e.myViewsPage.myDocuments.workingDocuments)),D=(0,vn.useSelector)((e=>e.myViewsPage.myDocuments.signingDocuments)),x=(0,vn.useSelector)((e=>e.myViewsPage.myDocuments.finishedDocuments)),M=(0,vn.useSelector)((e=>e.myViewsPage.myProceedings.incomingDocuments)),O=(null===(t=s.activeRole)||void 0===t?void 0:t.businessType)!==fe.A;(0,z.useEffect)((()=>{b&&o===te&&(Object.keys(a).length>0?(g(Fn(b,a)),h({offset:0,limit:10})):g(b))}),[b,a]),(0,z.useEffect)((()=>{D&&o===ee&&(Object.keys(a).length>0?(g(Fn(D,a)),h({offset:0,limit:10})):g(D))}),[D,a]),(0,z.useEffect)((()=>{x&&o===ne&&(Object.keys(a).length>0?(g(Fn(x,a)),h({offset:0,limit:10})):g(x))}),[x,a]),(0,z.useEffect)((()=>{M&&o===se&&(Object.keys(a).length>0?(g(Fn(M,a)),h({offset:0,limit:10})):g(M))}),[M,a]);const N=["my_documents.doc_date","my_documents.reg_date","my_documents.doc_nr","my_documents.document_type","my_documents.building_name","my_documents.ehr_code","my_documents.building_address","my_documents.state","my_documents.proceeding_nr"];c||N.push("my_documents.presenter");const A=[e=>Yn(e.docDate)?new Date(_n()(e.docDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>o===se?Yn(e.deadlineDate)?new Date(_n()(e.deadlineDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER:Yn(e.regDate)?new Date(_n()(e.regDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>{var t;return null!==(t=e.docNr)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.documentType)&&void 0!==t?t:""},e=>e.buildingName&&Yn(e.buildingName[0])?e.buildingName[0]:"",e=>e.ehrCode&&Yn(e.ehrCode[0])?e.ehrCode[0]:"",e=>e.buildingAddress&&Yn(e.buildingAddress[0])?e.buildingAddress[0]:"",e=>{var t;return null!==(t=e.state)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.proceedingNr)&&void 0!==t?t:""},e=>e.presenter?e.presenter.join(","):""];const U=e=>{var t;const i=[(0,un.jsx)(Cn,{fileApi:d,fileId:e.generatedFileId,docNr:null!==(t=e.docNr)&&void 0!==t?t:""},e.docId+"download")];return o===te&&e.stateCode===Ln.DO_DOKUSEIS_KOOSTAMISEL?i.push((0,un.jsx)(Gn,{onConfirm:()=>{l(e.docNr)},titleText:"my_documents.delete_document_confirmation.modal.header",messageText:"my_documents.delete_document_confirmation.modal.message"},e.docNr)):o===ne&&e.doty&&Ee.includes(e.doty)&&e.stateCode!==Ln.DO_DOKUSEIS_TYHISTATUD&&i.push((0,un.jsx)(rs,{doty:e.doty,documentId:e.docId,linkGen:n,userInfo:s})),i};return(0,un.jsxs)(Z.Section,{form:!0,children:[m&&(0,un.jsx)(Z.CollapseTable,{content:m.slice(p.offset,p.offset+p.limit).map((e=>{var t,s,i,r,a,l,d;return(0,un.jsx)(Z.CollapseTableRow,{fields:[e.docDate,o===se?_n()(e.deadlineDate,"DD.MM.YYYY").valueOf()<_n()().valueOf()?(0,un.jsx)("div",{className:"red-text",children:null===(t=e.deadlineDate)||void 0===t?void 0:t.toString()}):e.deadlineDate:e.regDate,(0,un.jsx)(Z.Tooltip,{content:(0,un.jsx)(Z.Text,{raw:"my_documents.tooltip.open_document"}),placement:"bottom",theme:"dark",children:(0,un.jsx)(Z.Link,{onClick:t=>{n(!0,t,ge,e.docNr)},text:e.docNr,href:n(!1,void 0,ge,e.docNr)})},e.docNr),e.documentType,e.buildingName?(0,un.jsx)("div",{children:_?(0,un.jsxs)("div",{children:[e.buildingName.map(((e,t)=>(0,un.jsxs)(X().Fragment,{children:[e,";",(0,un.jsx)("br",{})]},t))),e.buildingName.length>5&&(0,un.jsx)(Z.Link,{type:"hide",onClick:e=>{e.preventDefault(),y(!_)},text:(0,un.jsx)(Q.FormattedMessage,{id:"my_documents.link.view_less_building_names"})})]}):1===e.buildingName.length?e.buildingName:(0,un.jsxs)("div",{children:[null===(s=e.buildingName)||void 0===s?void 0:s.slice(0,4).map(((e,t)=>(0,un.jsxs)(X().Fragment,{children:[e,";",(0,un.jsx)("br",{})]},t))),null===(i=e.buildingName)||void 0===i?void 0:i.slice(4,5),e.buildingName.length>5?" ...":"",e.buildingName.length>5&&(0,un.jsx)("div",{className:"pr-3",children:(0,un.jsx)(Z.Link,{type:"show",onClick:e=>{e.preventDefault(),y(!_)},text:(0,un.jsx)(Q.FormattedMessage,{id:"my_documents.link.view_all_building_names"})})})]})}):"",e.ehrCode?(0,un.jsx)("div",{children:v?(0,un.jsxs)("div",{children:[e.ehrCode.map(((e,t)=>(0,un.jsxs)(X().Fragment,{children:[(0,un.jsx)(gn,{linkName:e,tooltipText:"my_documents.tooltip.open_building",functionCall:t=>{n(!0,t,he,e)},href:n(!1,void 0,he,e)}),(0,un.jsx)("br",{})]},t))),e.ehrCode.length>5&&(0,un.jsx)(Z.Link,{type:"hide",onClick:e=>{e.preventDefault(),E(!v)},text:(0,un.jsx)(Q.FormattedMessage,{id:"my_documents.link.view_less_ehrCodes"})})]}):(0,un.jsxs)("div",{children:[null===(r=e.ehrCode)||void 0===r?void 0:r.slice(0,4).map(((e,t)=>(0,un.jsxs)(X().Fragment,{children:[(0,un.jsx)(gn,{linkName:e,tooltipText:"my_documents.tooltip.open_building",functionCall:t=>{n(!0,t,he,e)},href:n(!1,void 0,he,e)}),(0,un.jsx)("br",{})]},t))),null===(a=e.ehrCode)||void 0===a?void 0:a.slice(4,5).map((e=>(0,un.jsx)(gn,{linkName:e,tooltipText:"my_documents.tooltip.open_building",functionCall:t=>{n(!0,t,he,e)},href:n(!1,void 0,he,e)}))),e.ehrCode.length>5?" ...":"",e.ehrCode.length>5&&(0,un.jsx)("div",{className:"pr-3",children:(0,un.jsx)(Z.Link,{type:"show",onClick:e=>{e.preventDefault(),E(!v)},text:(0,un.jsx)(Q.FormattedMessage,{id:"my_documents.link.view_all_ehrCodes"})})})]})}):"",e.buildingAddress?(0,un.jsx)("div",{children:I?(0,un.jsxs)("div",{children:[e.buildingAddress.map(((e,t)=>(0,un.jsxs)(X().Fragment,{children:[e,";",(0,un.jsx)("br",{})]},t))),e.buildingAddress.length>5&&(0,un.jsx)(Z.Link,{type:"hide",onClick:e=>{e.preventDefault(),T(!I)},text:(0,un.jsx)(Q.FormattedMessage,{id:"my_documents.link.view_less_addresses"})})]}):1===e.buildingAddress.length?e.buildingAddress:(0,un.jsxs)("div",{children:[null===(l=e.buildingAddress)||void 0===l?void 0:l.slice(0,4).map(((e,t)=>(0,un.jsxs)(X().Fragment,{children:[e,";",(0,un.jsx)("br",{})]},t))),null===(d=e.buildingAddress)||void 0===d?void 0:d.slice(4,5),e.buildingAddress.length>5?" ...":"",e.buildingAddress.length>5&&(0,un.jsx)("div",{className:"pr-3",children:(0,un.jsx)(Z.Link,{type:"show",onClick:e=>{e.preventDefault(),T(!I)},text:(0,un.jsx)(Q.FormattedMessage,{id:"my_documents.link.view_all_addresses"})})})]})}):"",e.stateCode?(0,un.jsx)(Z.Status,{type:Kn(e.stateCode).type,children:Kn(e.stateCode).name}):"",o===ee?(0,un.jsx)(Z.Tooltip,{content:(0,un.jsx)(Z.Text,{raw:"my_documents.tooltip.open_proceeding"}),placement:"bottom",theme:"dark",children:(0,un.jsx)(Z.Link,{onClick:t=>{n(!0,t,me,e.proceedingNr)},text:e.proceedingNr,href:n(!1,void 0,me,e.proceedingNr)})},e.proceedingNr):e.proceedingNr,e.presenter?e.presenter.map(((t,n)=>(0,un.jsxs)("div",{children:[t,n!==e.presenter.length-1?(0,un.jsx)("span",{children:", "}):""]}))):""],tools:U(e),editable:!0},e.docId)})),headers:function(){const e=[...N];return e[1]="my_documents.deadline",(o===se?e:N).map(((e,t)=>(0,un.jsxs)("div",{children:[(0,un.jsx)("a",{className:"link-gray",style:{paddingRight:"2px"},onClick:()=>{const e=wn(t,S);f(e),e.direction!==Nn&&g(On(m,A[t],e.direction))},children:S.column===t?(0,un.jsx)(jn,{sortDirection:S.direction}):(0,un.jsx)(jn,{sortDirection:Nn})}),u.formatMessage({id:e})]})))}(),paginationEnabled:!0,pager:{offset:p.offset,limit:p.limit,total:m.length},onPaginationReload:h,editable:!0}),(0,un.jsx)(Z.Row,{children:O&&o!==se?(0,un.jsx)(Z.Col,{children:(0,un.jsx)(Z.Checkbox,{name:"checkbox",onChange:e=>i(e),text:(0,un.jsx)(Z.Text,{raw:"my_documents.view_all_institution_documents"}),checked:r})}):(0,un.jsx)(Z.Col,{})})]})};var ls=c(572);function ds(e,t,n,s,o){return s?(0,un.jsx)(Z.FieldWrapper,{labelCol:o,component:(0,un.jsxs)(ls.Row,{className:"w-100 px-0 mx-0",children:[(0,un.jsx)(ls.Col,{md:1,className:"mr-3 pl-0",children:(0,un.jsx)(Z.Checkbox,{"data-testid":"checkbox",info:{content:s,placement:"top-start"},name:"checkbox",text:"",checked:e})}),(0,un.jsx)(ls.Col,{className:"px-0 ",children:(0,un.jsx)(Z.Text,{raw:(0,un.jsx)(Q.FormattedMessage,{id:n})})})]}),label:(0,un.jsx)(Q.FormattedMessage,{id:"label.empty"})}):(0,un.jsx)(Z.FieldWrapper,{labelCol:o,component:(0,un.jsx)(Z.Checkbox,{"data-testid":"checkbox",name:"checkbox",onChange:e=>t(e),text:(0,un.jsx)(Z.Text,{raw:(0,un.jsx)(Q.FormattedMessage,{id:n})}),checked:e}),label:(0,un.jsx)(Q.FormattedMessage,{id:"label.empty"})})}const cs=["110","11002","111","11119","11129","11139","11149","11158","11159","11191","11199","112","11201","11202","11203","11204","11205","11206","11211","11212","11213","11214","11219","11229","11231","11232","11233","11234","11239","11241","11249","11251","11271","11272","11273","11274","11275","11291","11299","113","11301","11302","11303","11304","11305","11306","11311","11312","11313","11314","11318","11319","11328","11329","11331","11332","11333","11334","11338","11339","11341","11348","11349","11351","11359","11371","11381","11391","11399","114","11411","11412","11413","11430","115","11511","11512","11513","11514","11515","11516","11518","11521","11522","11523","11524","11525","11526","11527","11531","11542","11551","11561","11563","11564","11565","11566","11567","11569","11571","11573","11574","11576","11577","11578","11581","11582","11584","11601","118","11802","11811","11821","11831","120","121","12119","12129","12139","12149","12158","12159","12199","122","12211","12212","12213","12214","12219","12229","12231","12232","12233","12234","12239","12241","12249","12251","12271","12291","12299","123","12311","12312","12313","12314","12318","12319","12328","12329","12331","12332","12333","12334","12338","12339","12341","12348","12349","12351","12359","12371","12381","12391","12399","127","12711","12731","12741","12742","12743","12744","12745","12899","129","12902","12911","12912","12921","12922","12931","12932","12942","12972","12973","12971","12974","12975","12976","12977","12978","12994","12999","130","13001","13002","13003","13009","131","13101","900","91511","91561","92731","92741","92743","92744","92745","11583"];function us(e){return function(e){let t={id:"0",label:"00000",parentId:"0",level:1,value:!1,selectable:!1,children:[]};for(let n of e){let e=n.id.toString(),s=t;for(let t=1;t<=n.id;t++)if(s.children){let n=s.children.find((n=>n.id.toString()===e.slice(0,t)));n&&(s=n)}s.children&&s.children.push({id:e+"",parentId:s.id,label:n.name+(null!==n.validTo&&_n()(n.validTo).isBefore(_n()(new Date))?" (kuni "+_n()(n.validTo).format("DD.MM.YYYY")+")":""),level:s.level+1,children:[],selectable:!0,value:!1})}return t.children?t.children:[]}(e.filter((e=>cs.includes(e.id.toString()))).sort(((e,t)=>e.id-t.id)))}function ps(e){return function(e){return e.map((e=>({id:e.id+"",label:e.firstName+" "+e.lastName+" ("+e.personalCode+")",level:2,children:[],selectable:!0,value:!1})))}(e.sort(((e,t)=>e.firstName.localeCompare(t.firstName))))}function hs(e){return function(e){return e.map((e=>({id:e.id+"",label:e.regName,level:2,children:[],selectable:!0,value:!1})))}(e.sort(((e,t)=>e.regName.localeCompare(t.regName))))}function ms(e){var t,n,s,o;return(0,un.jsxs)("div",{className:"d-flex align-items-center",children:[(0,un.jsx)("div",{className:"range--from",style:{flexGrow:1},children:(0,un.jsx)(Z.DatePicker,{disabled:null!==(t=e.disabled)&&void 0!==t&&t,maxLength:e.maxLength,onBlur:(t,n)=>e.onBlur?e.onBlur(t,n):null,onChange:(t,n)=>function(t,n){const s={...e.value};s.from=t,e.onChange(s,n)}(t,n),onFocus:(t,n)=>e.onFocus?e.onFocus(t,n):null,value:null===(n=e.value)||void 0===n?void 0:n.from})}),(0,un.jsx)("span",{className:"px-1",children:"—"}),(0,un.jsx)("div",{className:"range--to",style:{flexGrow:1},children:(0,un.jsx)(Z.DatePicker,{disabled:null!==(s=e.disabled)&&void 0!==s&&s,maxLength:e.maxLength,onBlur:(t,n)=>e.onBlur?e.onBlur(t,n):null,onChange:(t,n)=>function(t,n){const s={...e.value};s.to=t,e.onChange(s,n)}(t,n),onFocus:(t,n)=>e.onFocus?e.onFocus(t,n):null,value:null===(o=e.value)||void 0===o?void 0:o.to})})]})}const gs=e=>{const t=(0,Q.useIntl)(),n=/^[\\s0-9]{0,9}$/,s=/^([\\s0-9]{5}:[\\s0-9]{3}:[\\s0-9]{1,4}|[\\s0-9]{5}:[\\s0-9]{1,3}|[\\s0-9]{1,5})$/,o={documentTypes:[],ehrCode:"",buildingName:"",wordInAddress:"",documentNumber:"",cadastralNumber:"",documentStates:[],institutionUsers:[],proceedingNumber:"",institutions:[],proceedingMissing:!1,documentDate:{from:"",to:""}},[i,r]=(0,z.useState)(o);(0,z.useEffect)((()=>{Object.keys(e.filterState).length>0&&r(e.filterState)}),[e.documentType]);const[a,l]=(0,z.useState)(!0),[d,c]=(0,z.useState)(!0),[u,p]=(0,z.useState)(""),[h,m]=(0,z.useState)([]),[g,S]=(0,z.useState)([]),[f,I]=(0,z.useState)([]),[T,v]=(0,z.useState)(kn(e.documentType)),[E,_]=(0,z.useState)([]),y=(0,vn.useSelector)((e=>e.myViewsPage.filter.documentTypes)),b=(0,vn.useSelector)((e=>e.myViewsPage.filter.institutionUsers)),D=(0,vn.useSelector)((e=>e.myViewsPage.filter.institutions));function x(e){return n.test(e)}function M(e,t){let n;e.selectedData.length>0?(n=void 0!==e.selectedData[0].data?e.selectedData[0].data:e.selectedData,n=n.map((e=>e.id.length<5?e.children.map((e=>e.id)):e.id)).flat()):n=[],i[t]=n,r((e=>({...e})))}function O(e,t){var n;i[t]=e,"ehrCode"===t&&x(e)?l(!0):"cadastralNumber"===t&&(0===(n=e).length||s.test(n))&&c(!0),r((e=>({...e})))}(0,z.useEffect)((()=>{v(kn(e.documentType))}),[e.documentType]),(0,z.useEffect)((()=>{if(y){const e=us(y);m(e)}if(b&&e.isKov){const e=ps(b?[...b]:[]);I(e)}if(D){const e=hs([...D]);S(e)}}),[y,b,D]);return(0,un.jsxs)(Z.Form,{onSubmit:()=>e.onSubmit(i),children:[(0,un.jsxs)(Z.Row,{className:"align-items-start",children:[(0,un.jsxs)(Z.Col,{sm:10,className:"mx-0 px-0",children:[(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)(Z.Multiselect,{name:"multiselect",options:h,onSelect:e=>M(e,"documentTypes"),allSelection:!0,onRemoveItem:e=>M(e,"documentTypes"),value:i.documentTypes,selectedOptions:E}),label:(0,un.jsx)(Q.FormattedMessage,{id:"my_documents.filter.label.document_type"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.document_type",placement:"top-start"}}),(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)(Z.Input,{name:"input",onChange:e=>O(e,"buildingName"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.buildingName}),label:(0,un.jsx)(Q.FormattedMessage,{id:"my_documents.filter.label.building_name"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.building_name",placement:"top-start"}}),(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)(Z.Input,{name:"input",onChange:e=>O(e,"documentNumber"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.documentNumber}),label:(0,un.jsx)(Q.FormattedMessage,{id:"my_documents.filter.label.document_number"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.document_number",placement:"top-start"}}),e.documentType!==se&&e.documentType!==ee&&(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)(Z.Multiselect,{name:"multiselect",options:T,onSelect:e=>M(e,"documentStates"),allSelection:!0,onRemoveItem:e=>M(e,"documentStates"),value:i.documentStates,selectedOptions:E}),label:(0,un.jsx)(Q.FormattedMessage,{id:"my_documents.filter.label.document_state"}),labelCol:{sm:20,md:8,lg:8}}),(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)(Z.Input,{name:"input",onChange:e=>O(e,"proceedingNumber"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.proceedingNumber}),label:(0,un.jsx)(Q.FormattedMessage,{id:"my_documents.filter.label.proceeding_number"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.proceeding_number",placement:"top-start"}}),ds(i.proceedingMissing,(function(e){r((t=>({...t,proceedingMissing:e})))}),"my_documents.filter.label.proceeding_missing","my_documents.filter.tooltip.proceeding_missing"),(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)(ms,{onChange:e=>(e=>{""!==e.from&&!_n()(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!_n()(e.to,"YYYY-MM-DD",!0).isValid()?p(t.formatMessage({id:"filter.invalid_date_format"})):""!==e.from&&""!==e.to&&e.from>e.to?p(t.formatMessage({id:"filter.invalid_date_range"})):p(""),r((t=>({...t,documentDate:e})))})(e),value:i.documentDate}),errorMessage:u.length>0?u:null,label:(0,un.jsx)(Q.FormattedMessage,{id:"my_documents.filter.label.document_date"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.document_date",placement:"top-start"}})]}),(0,un.jsxs)(Z.Col,{sm:10,className:"mx-0 px-0",children:[(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)(Z.Input,{name:"input",onChange:e=>O(e,"ehrCode"),onBlur:e=>l(x(e.trim())),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.ehrCode}),errorMessage:!a&&(0,un.jsx)(Z.Text,{raw:"filter.invalid_building_code"}),label:(0,un.jsx)(Q.FormattedMessage,{id:"my_documents.filter.label.ehrCode"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.ehrCode",placement:"top-start"}}),(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)(Z.Input,{name:"input",onChange:e=>O(e,"wordInAddress"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.wordInAddress}),label:(0,un.jsx)(Q.FormattedMessage,{id:"my_documents.filter.label.word_in_address"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.word_in_address",placement:"top-start"}}),e.documentType!==se&&e.documentType!==ee&&e.isKov&&(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)(Z.Multiselect,{name:"multiselect",options:f,onSelect:e=>M(e,"institutionUsers"),allSelection:!0,onRemoveItem:e=>M(e,"institutionUsers"),value:i.institutionUsers,selectedOptions:E}),label:(0,un.jsx)(Q.FormattedMessage,{id:"my_documents.filter.label.institution_users"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.institution_users",placement:"top-start"}}),e.documentType!==se&&(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)(Z.Multiselect,{name:"multiselect",options:g,onSelect:e=>M(e,"institutions"),allSelection:!0,onRemoveItem:e=>M(e,"institutions"),value:i.institutions,selectedOptions:E}),label:(0,un.jsx)(Q.FormattedMessage,{id:"my_documents.filter.label.institution"}),labelCol:{sm:20,md:8,lg:8}}),e.isKov&&e.documentType===ee&&(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)(Z.Multiselect,{name:"multiselect",options:f,onSelect:e=>M(e,"institutionUsers"),allSelection:!0,onRemoveItem:e=>M(e,"institutionUsers"),value:i.institutionUsers,selectedOptions:E}),label:(0,un.jsx)(Q.FormattedMessage,{id:"my_documents.filter.label.institution_users"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.institution_users",placement:"top-start"}})]})]}),(0,un.jsxs)(Z.Row,{children:[(0,un.jsx)(Z.Col,{children:(0,un.jsx)(Z.Button,{onClick:()=>(_([]),void r(o)),colourScheme:"light",squared:!0,children:(0,un.jsx)(Q.FormattedMessage,{id:"button.epmty_fields"})})}),(0,un.jsx)(Z.Col,{children:(0,un.jsx)(Z.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!(a&&d),squared:!0,children:(0,un.jsx)(Q.FormattedMessage,{id:"button.search"})})})]})]})},Ss=["11566","11567","11569","11576","11577"],fs=e=>{const[t,n]=(0,z.useState)(!1),[s,o]=(0,z.useState)(""),[i,r]=(0,z.useState)(!1),[a,l]=(0,z.useState)([]),d=(0,vn.useSelector)((e=>e.myViewsPage.myDocuments.allowedDocumentTypesToStart)),c=e=>null==e||Number.isNaN(e)||"object"==typeof e&&0===Object.keys(e).length||"string"==typeof e&&0===e.trim().length;(0,z.useEffect)((()=>{if(d){const e=d.filter((e=>!Ss.includes(e.code)));l(e.map((e=>({code:e.code,texts:e.value}))))}}),[d]);return(0,un.jsx)(Z.ControlledPopover,{maxWidth:900,open:t,content:(0,un.jsx)("div",{style:{width:"600px"},children:(0,un.jsxs)(Z.Form,{onSubmit:()=>{r(!0)},children:[(0,un.jsx)("h2",{children:(0,un.jsx)(Q.FormattedMessage,{id:"my_documents.popover.title.composing_new_document"})}),(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)(Z.Select,{filterable:!0,placeholder:"placeholder.choose",name:"role",onChange:e=>o(e),options:a,value:s}),errorMessage:i&&c(s)&&(0,un.jsx)(Z.Text,{raw:"common.select.required"}),label:(0,un.jsx)(Z.Text,{raw:"my_documents.popover.label.new_document_type"}),name:"documentType",info:{content:"my_documents.popover.tooltip.document_type"}}),(0,un.jsxs)("div",{className:"d-flex justify-content-between mt-2",children:[(0,un.jsx)(Z.Button,{colourScheme:"light",onClick:()=>{r(!1),o("")},children:(0,un.jsx)(Q.FormattedMessage,{id:"button.cancel"})}),(0,un.jsx)(Z.Button,{className:"float-right",colourScheme:"success",onClick:t=>{c(s)||(e.linkGen(!0,t,"DOCUMENT","",{doty:s}),n(!1))},children:(0,un.jsx)(Q.FormattedMessage,{id:"my_documents.popover.button.compose_new_document"})})]})]})}),placement:"bottom-end",toggle:()=>{n(!t)},children:(0,un.jsx)(Z.Button,{withPlus:!0,colourScheme:"info",onClick:()=>{n(!t)},children:(0,un.jsx)(Q.FormattedMessage,{id:"my_documents.button.start_new_document"})})})},Is=["11273","11272","11274","11275","11002","11051","11201","11271","11301","11371","11412","11413","11430","11522","11525","11527","11542","11566","11567","11569","11571","11576","11577","11581","11582","11584","11831","12731","12743","12744","12745","12899","12922","12932","12942","12973","12975","12976","12977","12978","12999","11526","11601","11583"],Ts=["11273","11272","11274","11275","11002","11051","11201","11271","11301","11371","11412","11413","11430","11522","11525","11527","11542","11566","11567","11569","11571","11573","11574","11576","11577","11581","11582","11584","11831","12731","12743","12744","12745","12899","12922","12932","12942","12951","12952","12953","12973","12975","12976","12977","12978","12999","11526","11601","11583"],vs=["11273","11272","11582","11525","11271","11201","11301","11371","11002","11581","12271","12371","12921","12931","12995","12996","12902","11802","12999","12922","12932","12942","12899","11526","12972","12973"],Es=e=>{var t,n,s,o,i,r,a;let{linkGen:l,userInfo:d}=e;const c=(0,vn.useDispatch)(),[u,p]=(0,z.useState)({signingDocs:!1,workingDocs:!1,finishedDocs:!1}),[h,m]=(0,z.useState)(!1),[I,T]=(0,z.useState)(!0),[v,x]=(0,z.useState)(!0),[M,O]=(0,z.useState)([]),[N,A]=(0,z.useState)([]),[U,w]=(0,z.useState)([]),[j,C]=(0,z.useState)({}),[L,P]=(0,z.useState)({}),[R,K]=(0,z.useState)({}),k="A"!==(null===(t=d.activeRole)||void 0===t?void 0:t.businessType);const F={userId:null===(n=d.activeRole)||void 0===n?void 0:n.userId,personId:null===(s=d.activeRole)||void 0===s?void 0:s.businessId,dotys:Is,states:[Ln.DO_DOKUSEIS_ESITATUD,Ln.DO_DOKUSEIS_KOOSTAMISEL,Ln.DO_DOKUSEIS_EELNOU_AKTIIVNE,Ln.DO_DOKUSEIS_ALLKIRJASTAMISEL,Ln.DO_DOKUSEIS_MENETLUSES,Ln.DO_DOKUSEIS_TAIENDAMISEL,Ln.DO_DOKUSEIS_MUUTMISEL]},Y={userId:null===(o=d.activeRole)||void 0===o?void 0:o.userId,personId:null===(i=d.activeRole)||void 0===i?void 0:i.businessId,dotys:Ts,states:[Ln.DO_DOKUSEIS_KEHTETU,Ln.DO_DOKUSEIS_TUNNIST_KEHTETUKS,Ln.DO_DOKUSEIS_REG_KANTUD,"DO_DOKUSEIS_TAGASTATUD",Ln.DO_DOKUSEIS_KEELDUTUD,Ln.DO_DOKUSEIS_TYHISTATUD,Ln.DO_DOKUSEIS_LOOBUTUD,Ln.DO_DOKUSEIS_ALLKIRJASTATUD,Ln.DO_DOKUSEIS_MENETLETUD,Ln.DO_DOKUSEIS_LUBATUD,Ln.DO_DOKUSEIS_LUB_TEAV,Ln.DO_DOKUSEIS_TEAVITATUD,Ln.DO_DOKUSEIS_ANTUD,Ln.DO_DOKUSEIS_KEHTIV]},B={userId:null===(r=d.activeRole)||void 0===r?void 0:r.userId,personId:null===(a=d.activeRole)||void 0===a?void 0:a.businessId,roles:["DO_DOKU_ISIK_ROLL_ALLAK"],dotys:vs,states:[Ln.DO_DOKUSEIS_ALLKIRJASTAMISEL]};return(0,z.useEffect)((()=>{var e,t;cn.classifierApiService.getAllDocumentTypes().then((e=>{c(g(e.data))})).catch((e=>{console.log(e)})),cn.institutionKovEndpointApi.getJurKovPersons().then((e=>{c(f(e.data))})).catch((e=>{console.log(e)})),k&&cn.userApiService.getJurUsers(null!==(e=null===(t=d.activeRole)||void 0===t?void 0:t.businessId)&&void 0!==e?e:0).then((e=>{c(S(e.data))})).catch((e=>{console.log(e)})),cn.documentApiService.getDotysBasedOnUserRights().then((e=>{const t=e.data.filter((e=>"12922"!==e.code&&"11412"!==e.code&&"11413"!==e.code&&"12932"!==e.code&&"11430"!==e.code&&"12942"!==e.code));c(D(t))})).catch((e=>{console.log("Following error occured:",e)}))}),[d]),(0,z.useEffect)((()=>{(()=>{const e=F;u.workingDocs&&(e.userId=void 0),T(!0),cn.myDocumentBaseApiService.findWorkingDocuments(e).then((e=>{c(E(e.data)),T(!1),A(e.data)})).catch((e=>{console.log("Following error occured:",e),T(!1)}))})()}),[u.workingDocs,d]),(0,z.useEffect)((()=>{!function(){const e=Y;u.finishedDocs&&(e.userId=void 0),x(!0),cn.myDocumentBaseApiService.findWorkingDocuments(e).then((e=>{c(y(e.data)),x(!1),w(e.data)})).catch((e=>{console.log("Following error occured:",e),x(!1)}))}()}),[u.finishedDocs,d]),(0,z.useEffect)((()=>{!function(){const e=B;u.signingDocs&&(e.userId=void 0),m(!0),cn.myDocumentBaseApiService.findWorkingDocuments(e).then((e=>{c(_(e.data)),m(!1),O(e.data)})).catch((e=>{console.log("Following error occured:",e),m(!1)}))}()}),[u.signingDocs,d]),(0,un.jsxs)("div",{children:[(0,un.jsx)(ss,{}),(0,un.jsx)("div",{className:"d-flex justify-content-end mt-2",children:(0,un.jsx)(fs,{linkGen:l})}),k&&(0,un.jsx)(Z.Section,{collapsed:!1,title:"my_documents.my_documents_to_sign",showSettings:!0,filterContents:(0,un.jsx)(gs,{documentType:ee,filterState:j,onSubmit:e=>C(e),isKov:k}),children:h?(0,un.jsx)(Z.SectionLoader,{}):0===M.length?(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(Z.Text,{raw:"my_documents.signing_documents.no_docs"})}):(0,un.jsx)(as,{linkGen:l,userInfo:d,documentType:ee,onAllUsersChecked:e=>{p({signingDocs:e,workingDocs:u.workingDocs,finishedDocs:u.finishedDocs})},isAllUsersChecked:u.signingDocs,filter:j,fileApi:cn.fileApiService,hidePresenter:!0})}),(0,un.jsx)(Z.Section,{collapsed:!1,title:"my_documents.working_documents",showSettings:!0,filterContents:(0,un.jsx)(gs,{documentType:te,filterState:L,onSubmit:e=>P(e),isKov:k}),children:I?(0,un.jsx)(Z.SectionLoader,{}):0===N.length?(0,un.jsxs)("div",{children:[(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(Z.Text,{raw:"my_documents.working_documents.no_docs"})}),k&&(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(Z.Link,{text:"my_documents.view_all_institution_documents",onClick:()=>{p({signingDocs:u.signingDocs,workingDocs:!0,finishedDocs:u.finishedDocs})}})}),(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(fs,{linkGen:l})})]}):(0,un.jsx)(as,{linkGen:l,userInfo:d,documentType:te,onAllUsersChecked:e=>{p({signingDocs:u.signingDocs,workingDocs:e,finishedDocs:u.finishedDocs})},isAllUsersChecked:u.workingDocs,filter:L,onDocumentDelete:e=>function(e){const t=e.slice(0,e.indexOf("/")),n=e.slice(e.indexOf("/")+1);cn.documentApiService.deleteApplicationByNumber(t,n),c(b(e))}(e),fileApi:cn.fileApiService})}),(0,un.jsx)(Z.Section,{collapsed:!1,title:"my_documents.finished_documents",showSettings:!0,filterContents:(0,un.jsx)(gs,{documentType:ne,filterState:R,onSubmit:e=>K(e),isKov:k}),children:v?(0,un.jsx)(Z.SectionLoader,{}):0===U.length?(0,un.jsxs)("div",{children:[(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(Z.Text,{raw:"my_documents.finished_documents.no_docs"})}),k&&(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(Z.Link,{text:"my_documents.view_all_institution_documents",onClick:()=>{p({signingDocs:u.signingDocs,workingDocs:u.workingDocs,finishedDocs:!0})}})}),(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(fs,{linkGen:l})})]}):(0,un.jsx)(as,{linkGen:l,userInfo:d,documentType:ne,onAllUsersChecked:e=>{p({signingDocs:u.signingDocs,workingDocs:u.workingDocs,finishedDocs:e}),x(!0)},isAllUsersChecked:u.finishedDocs,filter:R,fileApi:cn.fileApiService})})]})},_s={MENSEIS_TAIENDAMISEL:["MENSEIS_TAIENDAMISEL","MENSEIS_ESITATUD_TAPSUST","MENSEIS_MEN_EHITUSL_TAOT_TAPS","MENSEIS_MEN_KASUTUSL_TAOT_TAPS","MENSEIS_MEN_EDASTATUD_MARK_LAHEND"],MENSEIS_ALGATATUD:["MENSEIS_ALGATATUD","MENSEIS_ESITATUD"],MENSEIS_KAIMASOLEV:["MENSEIS_KAIMASOLEV","MENSEIS_MEN","MENSEIS_MEN_KNT_TAOT","MENSEIS_EHITUSTEGEVUS_ALANUD","MENSEIS_EHITUSTEGEVUS_LOPPENUD","MENSEIS_EHITUSTEG_LOPP","MENSEIS_LAMMUTATUD","MENSEIS_MEN_EHITUSL_TAOT","MENSEIS_MEN_KASUTUSL_TAOT","MENSEIS_MEN_LAMMUTUSL_TAOT"],MENSEIS_LOPETATUD:["MENSEIS_LOPETATUD","MENSEIS_MEN_ALLKIRJASTATUD","MENSEIS_MEN_KNT_ANTUD","MENSEIS_MEN_KNT_KEELD","MENSEIS_EHITUSL_KEHTETU","MENSEIS_KASUTUSL_KEHTETU","MENSEIS_KNT_KEHTETU","MENSEIS_MEN_EHITUSL_ANTUD","MENSEIS_MEN_EHITUSL_KEELD","MENSEIS_MEN_KASUTUSL_ANTUD","MENSEIS_MEN_KASUTUSL_KEELD","MENSEIS_MEN_LAMMUTUSL_ANTUD","MENSEIS_MEN_LAMMUTUSL_KEELD","MENSEIS_MEN_PRO_TING_ANTUD","MENSEIS_MEN_TEAVITATUD"],MENSEIS_MUUTMISEL:["MENSEIS_MUUTMISEL","MENSEIS_MEN_TAIENDAB"],MENSEIS_PEATATUD:["MENSEIS_PEATATUD"],MENSEIS_ARHIIVIS:["MENSEIS_ARHIIVIS"]};function ys(e){return Bn(_s,e)}function bs(e){const t=ys(e);return t?function(e){switch(e){case"MENSEIS_TAIENDAMISEL":return{name:"Algdokument täiendamisel",type:"warning"};case"MENSEIS_ALGATATUD":return{name:"Algatatud",type:"info"};case"MENSEIS_KAIMASOLEV":return{name:"Käimasolev",type:"info"};case"MENSEIS_LOPETATUD":return{name:"Lõpetatud",type:"success"};case"MENSEIS_MUUTMISEL":return{name:"Algdokument muutmisel",type:"info"};case"MENSEIS_PEATATUD":return{name:"Peatatud",type:"warning"};case"MENSEIS_ARHIIVIS":return{name:"Arhiivis",type:"default"};default:return{name:e,type:"default"}}}(t):{name:e,type:"default"}}const Ds=[{code:"MENSEIS_TAIENDAMISEL",value:"Algdokument täiendamisel"},{code:"MENSEIS_ALGATATUD",value:"Algatatud"},{code:"MENSEIS_KAIMASOLEV",value:"Käimasolev"},{code:"MENSEIS_LOPETATUD",value:"Lõpetatud"},{code:"MENSEIS_MUUTMISEL",value:"Algdokument muutmisel"},{code:"MENSEIS_PEATATUD",value:"Peatatud"}];function xs(){return Ds.map((e=>({id:e.code+"",label:e.value,level:2,children:[],selectable:!0,value:!1})))}function Ms(e,t){if(console.log("filterService",t),t.documentTypes.length>0&&(e=e.filter((e=>void 0!==e.doty&&t.documentTypes.includes(e.doty)))),t.ehrCode.length>0&&(e=e.filter((e=>{var n;return null===(n=e.ehrCode)||void 0===n?void 0:n.some((e=>{var n;return null!==(n=e.startsWith(t.ehrCode.trim()))&&void 0!==n&&n}))}))),t.buildingName.length>0&&(e=e.filter((e=>{var n;return null===(n=e.buildingName)||void 0===n?void 0:n.some((e=>{var n,s;return null!==(n=null===(s=e.toLocaleLowerCase())||void 0===s?void 0:s.includes(t.buildingName.toLocaleLowerCase()))&&void 0!==n&&n}))}))),t.wordInAddress.length>0&&(e=e.filter((e=>{var n,s;return null!==(n=null===(s=e.address)||void 0===s?void 0:s.some((e=>e.toLocaleLowerCase().includes(t.wordInAddress.trim().toLocaleLowerCase()))))&&void 0!==n&&n}))),t.proceedingNumber.length>0&&(e=e.filter((e=>{var n,s;return null!==(n=null===(s=e.proceedingNr)||void 0===s?void 0:s.includes(t.proceedingNumber.trim()))&&void 0!==n&&n}))),t.proceedingStates.length>0&&(e=e.filter((e=>void 0!==e.stateCode&&t.proceedingStates.includes(ys(e.stateCode))))),t.connectedPerson.length>0&&(e=e.filter((e=>{var n,s;return null!==(n=null===(s=e.supervisor)||void 0===s?void 0:s.startsWith(t.connectedPerson))&&void 0!==n&&n}))),!1===t.showProceedingInArchive&&(e=e.filter((e=>"Ei"===e.archived))),t.supervisors.length>0&&(e=e.filter((e=>void 0!==e.supervisorId&&t.supervisors.includes(e.supervisorId.toString())))),t.proceedingDate.from.length>0&&0===t.proceedingDate.to.length){const n=new Date(t.proceedingDate.from).getTime();e=e.filter((e=>new Date(_n()(e.dateStart,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n))}if(t.proceedingDate.to.length>0&&0===t.proceedingDate.from.length){const n=new Date(t.proceedingDate.to).getTime();e=e.filter((e=>new Date(_n()(e.dateStart,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()<=n))}if(t.proceedingDate.from.length>0&&t.proceedingDate.to.length>0){const n=new Date(t.proceedingDate.from).getTime(),s=new Date(t.proceedingDate.to).getTime();e=e.filter((e=>new Date(_n()(e.dateStart,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n&&new Date(_n()(e.dateStart,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()<=s))}if(t.lastEventDate.length>0){const n=new Date(t.lastEventDate).getTime();e=e.filter((e=>e.lastEventDate&&new Date(_n()(e.lastEventDate).format("YYYY-MM-DD")).getTime()<=n))}return e}function Os(){return Ds.filter((e=>"MENSEIS_TAIENDAMISEL"!==e.code&&"MENSEIS_MUUTMISEL"!==e.code&&"MENSEIS_LOPETATUD"!==e.code&&"MENSEIS_PEATATUD"!==e.code)).map((e=>({id:e.code})))}const Ns=e=>{const t=(0,Q.useIntl)(),[n,s]=(0,z.useState)({offset:0,limit:50}),[o,i]=(0,z.useState)([]),[r,a]=(0,z.useState)({column:5,direction:An}),[l,d]=(0,z.useState)(!1),[c,u]=(0,z.useState)(!1),[p,h]=(0,z.useState)(!1),m=(0,vn.useSelector)((e=>e.myViewsPage.myProceedings.myProceedings)),g=[e=>Yn(e.dateStart)?new Date(_n()(e.dateStart,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>Yn(e.deadline)?new Date(_n()(e.deadline,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>{var t;return null!==(t=e.proceedingNr)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.state)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.proceedingCircleNr)&&void 0!==t?t:""},e=>e.operationsCount?{done:e.operationsCount.split("/")[0],all:e.operationsCount.split("/")[1]}:"",e=>Yn(e.innerCommentDeadline)?new Date(e.innerCommentDeadline).getTime():Number.MAX_SAFE_INTEGER,e=>Yn(e.lastEventDate)?new Date(e.lastEventDate).getTime():Number.MAX_SAFE_INTEGER,e=>{var t;return null!==(t=e.document)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.documentType)&&void 0!==t?t:""},e=>e.buildingName&&e.buildingName[0]?e.buildingName[0]:"",e=>e.ehrCode&&e.ehrCode[0]?e.ehrCode[0]:"",e=>e.address&&e.address[0]?e.address[0]:"",e=>{var t;return null!==(t=e.proceedingName)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.supervisor)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.documentPresenter)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.archived)&&void 0!==t?t:""},e=>e.proceedingLength?e.proceedingLength:Number.MAX_SAFE_INTEGER];(0,z.useEffect)((()=>{if(m){const e=5,t=wn(e,r);t.direction===Nn&&(t.direction=An),a(t),i(On(m,g[e],t.direction))}}),[m]),(0,z.useEffect)((()=>{m&&Object.keys(e.filter).length>0&&(r.direction===Nn?i(Ms(m,e.filter)):i(On(Ms(m,e.filter),g[r.column],r.direction)),s({offset:0,limit:50}))}),[e.filter,m]),(0,z.useEffect)((()=>{r&&r.direction!==Nn&&0!==o.length&&i(On(o,g[r.column],r.direction))}),[r]);const S=["my_proceedings.date_start","my_proceedings.deadline","my_proceedings.proceeding_nr","my_proceedings.state","my_proceedings.proceeding_circle_nr","my_proceedings.operations_count","my_proceedings.inner_comment_deadline","my_proceedings.last_event","my_proceedings.document","my_proceedings.document_type","my_proceedings.building_name","my_proceedings.ehr_code","my_proceedings.address","my_proceedings.proceeding_name","my_proceedings.supervisor","my_proceedings.document_presenter","my_proceedings.archived","my_proceedings.proceeding_length"];return(0,un.jsxs)(Z.Section,{form:!0,children:[o&&(0,un.jsx)(Z.CollapseTable,{content:(t=>t.slice(n.offset,n.offset+n.limit).map((t=>{var n,s,o,i,r,a;let m={addresses:[],ehrCodes:[],buildingNames:[]};return t.address&&(null===(n=t.address)||void 0===n?void 0:n.length)>1&&(m=function(e,t,n){let s={addresses:[],ehrCodes:[],buildingNames:[]};if(e&&e.length>1){let o=[];for(let s=0;s<e.length;s++){let i=e[s].split(",");o.push({county:i[0],city:i[1]?i[1].trimStart():"",other:i[2]?i[2].trimStart()+","+i[3]:"",ehrCode:t?t[s]:"",buildingName:n?n[s]:""})}const i=o.reduce(((e,t)=>{var n;const{county:s}=t;return e[s]=null!==(n=e[s])&&void 0!==n?n:[],e[s].push(t),e}),{});let r=[];o.forEach((e=>{const t=e.county;r.includes(t)||r.push(t)}));let a=[];o.forEach((e=>{const t=e.city;a.includes(t)||a.push(t)})),r.forEach((e=>{const t=i[e].reduce(((e,t)=>{var n;const{city:s}=t;return e[s]=null!==(n=e[s])&&void 0!==n?n:[],e[s].push(t),e}),{});i[e]=t}));let l=[],d=[],c=[];r.forEach((e=>{a.forEach((t=>{let n="";if(i[e][t]){n+=e+", "+t;for(let s=0;s<i[e][t].length;s++){const o=i[e][t][s];n+=", "+o.other,0===s?l.push(n):l.push(o.other),d.push(o.ehrCode),c.push(o.buildingName)}}}))})),s={addresses:l,ehrCodes:d,buildingNames:c}}return s}(t.address,t.ehrCode,t.buildingName)),(0,un.jsx)(Z.CollapseTableRow,{fields:[t.dateStart,_n()(t.deadline,"DD.MM.YYYY").valueOf()<_n()().valueOf()?(0,un.jsx)("div",{className:"red-text",children:null===(s=t.deadline)||void 0===s?void 0:s.toString()}):t.deadline,(0,un.jsx)(Z.Tooltip,{content:(0,un.jsx)(Z.Text,{raw:"my_proceedings.tooltip.open_proceeding"}),placement:"bottom",theme:"dark",children:(0,un.jsx)(Z.Link,{onClick:n=>{e.linkGen(!0,n,"PROCEEDING",t.proceedingNr)},text:t.proceedingNr,href:e.linkGen(!1,void 0,"PROCEEDING",t.proceedingNr)})},t.proceedingNr),t.stateCode?(0,un.jsx)(Z.Status,{type:bs(t.stateCode).type,children:bs(t.stateCode).name}):"",t.proceedingCircleNr,t.operationsCount,t.innerCommentDeadline?_n()(t.innerCommentDeadline).valueOf()<=_n()().valueOf()?(0,un.jsx)("div",{style:{color:"#00b649"},children:_n()(t.innerCommentDeadline).format("DD.MM.YYYY")}):_n()(t.innerCommentDeadline).format("DD.MM.YYYY"):"",t.lastEventDate?_n()(t.lastEventDate).format("DD.MM.YYYY"):"",(0,un.jsx)(gn,{linkName:t.document,tooltipText:"my_proceedings.tooltip.open_document",functionCall:n=>{e.linkGen(!0,n,"DOCUMENT",t.document)}}),t.documentType,t.buildingName&&(null===(o=t.buildingName)||void 0===o?void 0:o.length)>0?(0,un.jsx)("div",{children:p?(0,un.jsxs)("div",{children:[m.buildingNames.map((e=>(0,un.jsxs)(un.Fragment,{children:[e,";",(0,un.jsx)("br",{})]}))),t.buildingName.length>5&&(0,un.jsx)(Z.Link,{type:"hide",onClick:e=>{e.preventDefault(),h(!p)},text:(0,un.jsx)(Q.FormattedMessage,{id:"my_proceedings.link.view_less_building_names"})})]}):1===t.buildingName.length?t.buildingName:(0,un.jsxs)("div",{children:[null===(i=m.buildingNames)||void 0===i?void 0:i.slice(0,4).map((e=>(0,un.jsxs)(un.Fragment,{children:[e,";",(0,un.jsx)("br",{})]}))),null===(r=m.buildingNames)||void 0===r?void 0:r.slice(4,5),t.buildingName.length>5?" ...":"",t.buildingName.length>5&&(0,un.jsx)("div",{className:"pr-3",children:(0,un.jsx)(Z.Link,{type:"show",onClick:e=>{e.preventDefault(),h(!p)},text:(0,un.jsx)(Q.FormattedMessage,{id:"my_proceedings.link.view_all_building_names"})})})]})}):"",t.ehrCode?(0,un.jsx)("div",{children:c?(0,un.jsxs)("div",{children:[m.ehrCodes.map((t=>(0,un.jsxs)(un.Fragment,{children:[(0,un.jsx)(gn,{linkName:t,tooltipText:"my_proceedings.tooltip.open_building",functionCall:n=>{e.linkGen(!0,n,"BUILDING",t)},href:e.linkGen(!1,void 0,"BUILDING",t)}),(0,un.jsx)("br",{})]}))),t.ehrCode.length>5&&(0,un.jsx)(Z.Link,{type:"hide",onClick:e=>{e.preventDefault(),u(!c)},text:(0,un.jsx)(Q.FormattedMessage,{id:"my_proceedings.link.view_less_ehrCodes"})})]}):1===t.ehrCode.length?(0,un.jsx)(gn,{linkName:t.ehrCode[0],tooltipText:"my_proceedings.tooltip.open_building",functionCall:n=>{e.linkGen(!0,n,"BUILDING",t.ehrCode)},href:e.linkGen(!1,void 0,"BUILDING",t.ehrCode)}):(0,un.jsxs)("div",{children:[m.ehrCodes.slice(0,4).map(((t,n)=>(0,un.jsxs)(X().Fragment,{children:[(0,un.jsx)(gn,{linkName:t,tooltipText:"my_proceedings.tooltip.open_building",functionCall:n=>{e.linkGen(!0,n,"BUILDING",t)},href:e.linkGen(!1,void 0,"BUILDING",t)}),(0,un.jsx)("br",{})]},n))),m.ehrCodes.slice(4,5).map((t=>(0,un.jsx)(gn,{linkName:t,tooltipText:"my_proceedings.tooltip.open_building",functionCall:n=>{e.linkGen(!0,n,"BUILDING",t)},href:e.linkGen(!1,void 0,"BUILDING",t)}))),t.ehrCode.length>5?" ...":"",t.ehrCode.length>5&&(0,un.jsx)("div",{className:"pr-3",children:(0,un.jsx)(Z.Link,{type:"show",onClick:e=>{e.preventDefault(),u(!c)},text:(0,un.jsx)(Q.FormattedMessage,{id:"my_proceedings.link.view_all_ehrCodes"})})})]})}):"",t.address?(0,un.jsx)("div",{style:{width:125},children:l?(0,un.jsxs)("div",{children:[m.addresses.map((e=>(0,un.jsxs)(un.Fragment,{children:[e,";",(0,un.jsx)("br",{})]}))),t.address.length>5&&(0,un.jsx)(Z.Link,{type:"hide",onClick:e=>{e.preventDefault(),d(!l)},text:(0,un.jsx)(Q.FormattedMessage,{id:"my_proceedings.link.view_less_addresses"})})]}):1===t.address.length?t.address:(0,un.jsxs)("div",{children:[m.addresses.slice(0,4).map((e=>(0,un.jsxs)(un.Fragment,{children:[e,";",(0,un.jsx)("br",{})]}))),null===(a=m.addresses)||void 0===a?void 0:a.slice(4,5),t.address.length>5?" ...":"",t.address.length>5&&(0,un.jsx)("div",{className:"pr-3",children:(0,un.jsx)(Z.Link,{type:"show",onClick:e=>{e.preventDefault(),d(!l)},text:(0,un.jsx)(Q.FormattedMessage,{id:"my_proceedings.link.view_all_addresses"})})})]})}):"",t.proceedingName,t.supervisor,t.documentPresenter,t.archived,t.proceedingLength]},t.id)})))(o),headers:S.map(((e,n)=>(0,un.jsxs)("div",{children:[(0,un.jsx)("a",{className:"link-gray",style:{paddingRight:"2px"},onClick:()=>{const e=wn(n,r);a(e)},children:r.column===n?(0,un.jsx)(jn,{sortDirection:r.direction}):(0,un.jsx)(jn,{sortDirection:Nn})}),t.formatMessage({id:e})]}))),paginationEnabled:!0,pager:{offset:n.offset,limit:n.limit,total:o.length},onPaginationReload:s}),(0,un.jsx)(un.Fragment,{children:e.isKov?(0,un.jsx)("div",{className:"d-flex justify-content-start",children:(0,un.jsx)(Z.Checkbox,{name:"checkbox",onChange:t=>e.onAllUsersChecked(t),text:(0,un.jsx)(Z.Text,{raw:"my_proceedings.view_all_institution_proceedings"}),checked:e.isAllUsersChecked})}):null})]})},As={documentTypes:[],ehrCode:"",buildingName:"",wordInAddress:"",proceedingNumber:"",cadastralNumber:"",proceedingStates:["MENSEIS_ALGATATUD","MENSEIS_KAIMASOLEV"],connectedPerson:"",showProceedingInArchive:!1,supervisors:[],proceedingDate:{from:"",to:""},lastEventDate:""},Us=e=>{let{onSubmit:t,isKov:n,filterState:s}=e;const o=(0,Q.useIntl)(),i=/^[\\s0-9]{0,9}$/,r=/^([\\s0-9]{5}:[\\s0-9]{3}:[\\s0-9]{1,4}|[\\s0-9]{5}:[\\s0-9]{1,3}|[\\s0-9]{1,5})$/,[a,l]=(0,z.useState)(s),[d,c]=(0,z.useState)(!0),[u,p]=(0,z.useState)(!0),[h,m]=(0,z.useState)(""),[g,S]=(0,z.useState)(""),[f,I]=(0,z.useState)([]),[T,v]=(0,z.useState)([]),[E]=(0,z.useState)(xs()),[_,y]=(0,z.useState)([]),[b,D]=(0,z.useState)(Os()),x=(0,vn.useSelector)((e=>e.myViewsPage.filter.documentTypes)),M=(0,vn.useSelector)((e=>e.myViewsPage.filter.institutionUsers));function O(e){return i.test(e)}function N(e,t){let n;e.selectedData.length>0?(n=void 0!==e.selectedData[0].data?e.selectedData[0].data:e.selectedData,n=n.map((e=>e.id.length<5?e.children.map((e=>e.id)):e.id)).flat()):n=[],D(n.map((e=>({id:e})))),l((e=>({...e,[t]:n})))}function A(e,t){var n;"ehrCode"===t&&O(e)?c(!0):"cadastralNumber"===t&&(0===(n=e).length||r.test(n))&&p(!0),l((n=>({...n,[t]:e})))}(0,z.useEffect)((()=>{if(x){const e=us(x);I(e)}if(M&&n){const e=ps([...M]);v(e)}}),[x,M]);return(0,un.jsxs)(Z.Form,{onSubmit:()=>t(a),children:[(0,un.jsxs)(Z.Row,{className:"align-items-start",children:[(0,un.jsxs)(Z.Col,{sm:10,className:"mx-0 px-0",children:[(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)(Z.Multiselect,{name:"multiselect",options:f,onSelect:e=>N(e,"documentTypes"),allSelection:!0,onRemoveItem:e=>N(e,"documentTypes"),value:a.documentTypes,selectedOptions:_}),label:(0,un.jsx)(Q.FormattedMessage,{id:"my_proceedings.filter.label.document_type"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_proceedings.filter.tooltip.document_type",placement:"top-start"}}),(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)(Z.Input,{name:"input",onChange:e=>A(e,"proceedingNumber"),placeholder:o.formatMessage({id:"placeholder.writing"}),value:a.proceedingNumber}),label:(0,un.jsx)(Q.FormattedMessage,{id:"my_proceedings.filter.label.proceeding_number"}),labelCol:{sm:20,md:8,lg:8}}),(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)(Z.Multiselect,{name:"multiselect",options:E,onSelect:e=>{N(e,"proceedingStates")},allSelection:!0,onRemoveItem:e=>N(e,"proceedingStates"),value:a.proceedingStates,selectedOptions:b}),label:(0,un.jsx)(Q.FormattedMessage,{id:"my_proceedings.filter.label.proceeding_state"}),labelCol:{sm:20,md:8,lg:8}}),ds(a.showProceedingInArchive,(function(e){l((t=>({...t,showProceedingInArchive:e})))}),"my_proceedings.filter.label.show_archived_proceedings"),(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)("div",{className:"daterange_in_form",children:(0,un.jsx)(Z.DateRange,{name:"daterange",onChange:e=>(e=>{""!==e.from&&!_n()(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!_n()(e.to,"YYYY-MM-DD",!0).isValid()?m(o.formatMessage({id:"filter.invalid_date_format"})):""!==e.from&&""!==e.to&&e.from>e.to?m(o.formatMessage({id:"filter.invalid_date_range"})):m(""),l((t=>({...t,proceedingDate:e})))})(e),value:a.proceedingDate})}),errorMessage:h.length>0?h:null,label:(0,un.jsx)(Q.FormattedMessage,{id:"my_proceedings.filter.label.proceeding_date"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_proceedings.filter.tooltip.proceeding_date",placement:"top-start"}}),(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)(Z.DatePicker,{name:"datepicker-field",value:a.lastEventDate,onChange:e=>function(e){""===e||_n()(e,"YYYY-MM-DD",!0).isValid()?S(""):S(o.formatMessage({id:"filter.invalid_date_format"})),l((t=>({...t,lastEventDate:e})))}(e)}),errorMessage:g.length>0?g:null,label:(0,un.jsx)(Q.FormattedMessage,{id:"my_proceedings.filter.label.last_event_date"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_proceedings.filter.tooltip.last_event_date",placement:"top-start"}})]}),(0,un.jsxs)(Z.Col,{sm:10,className:"mx-0 px-0",children:[(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)(Z.Input,{name:"input",onChange:e=>A(e,"ehrCode"),onBlur:e=>c(O(e.trim())),placeholder:o.formatMessage({id:"placeholder.writing"}),value:a.ehrCode}),errorMessage:!d&&(0,un.jsx)(Z.Text,{raw:"filter.invalid_building_code"}),label:(0,un.jsx)(Q.FormattedMessage,{id:"my_proceedings.filter.label.ehrCode"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_proceedings.filter.tooltip.ehrCode",placement:"top-start"}}),(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)(Z.Input,{name:"input",onChange:e=>A(e,"buildingName"),placeholder:o.formatMessage({id:"placeholder.writing"}),value:a.buildingName}),label:(0,un.jsx)(Q.FormattedMessage,{id:"my_proceedings.filter.label.building_name"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_proceedings.filter.tooltip.building_name",placement:"top-start"}}),(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)(Z.Input,{name:"input",onChange:e=>A(e,"wordInAddress"),placeholder:o.formatMessage({id:"placeholder.writing"}),value:a.wordInAddress}),label:(0,un.jsx)(Q.FormattedMessage,{id:"my_proceedings.filter.label.word_in_address"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_proceedings.filter.tooltip.word_in_address",placement:"top-start"}}),(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)(Z.Input,{name:"input",onChange:e=>A(e,"connectedPerson"),placeholder:o.formatMessage({id:"placeholder.writing"}),value:a.connectedPerson}),label:(0,un.jsx)(Q.FormattedMessage,{id:"my_proceedings.filter.label.connected_person"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_proceedings.filter.tooltip.connected_person",placement:"top-start"}}),n&&(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)(Z.Multiselect,{name:"multiselect",options:T,onSelect:e=>N(e,"supervisors"),allSelection:!0,onRemoveItem:e=>N(e,"supervisors"),value:a.supervisors,selectedOptions:_}),label:(0,un.jsx)(Q.FormattedMessage,{id:"my_proceedings.filter.label.supervisor"}),labelCol:{sm:20,md:8,lg:8}})]})]}),(0,un.jsxs)(Z.Row,{children:[(0,un.jsx)(Z.Col,{children:(0,un.jsx)(Z.Button,{onClick:()=>(y([]),l(As),void D(Os())),colourScheme:"light",squared:!0,children:(0,un.jsx)(Q.FormattedMessage,{id:"button.epmty_fields"})})}),(0,un.jsx)(Z.Col,{children:(0,un.jsx)(Z.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!(d&&u),squared:!0,children:(0,un.jsx)(Q.FormattedMessage,{id:"button.search"})})})]})]})},ws={MENTOIMSEIS_OOTEL:["MENTOIMSEIS_OOTEL","MENTOIMSEIS_JATKAMINE"],MENTOIMSEIS_TEOSTAMISEL:["MENTOIMSEIS_TEOSTAMISEL"],MENTOIMSEIS_TYHISTATUD:["MENTOIMSEIS_TYHISTATUD"],MENTOIMSEIS_TEOSTATUD:["MENTOIMSEIS_TEOSTATUD","MENTOIMSEIS_KOOSKOLA","MENTOIMSEIS_KOOSKOLA_MARK","MENTOIMSEIS_VALMIS","MENTOIMSEIS_VANA_VERSIOON","MENTOIMSEIS_ARHIIVIS","MENTOIMSEIS_EDASTATUD"],MENTOIMSEIS_LOOBUTUD:["MENTOIMSEIS_LOOBUTUD","MENTOIMSEIS_KEELDUTUD","MENTOIMSEIS_TAGASI_LYKATUD"],MENTOIMSEIS_TAHTAEG_MOODUNUD:["MENTOIMSEIS_TAHTAEG_MOODUNUD"]};let js=function(e){return e.MENTOIMSEIS_ARHIIVIS="MENTOIMSEIS_ARHIIVIS",e.MENTOIMSEIS_TYISTATUD="MENTOIMSEIS_TYISTATUD",e.MENTOIMSEIS_EDASTATUD="MENTOIMSEIS_EDASTATUD",e.MENTOIMSEIS_TEOSTAMISEL="MENTOIMSEIS_TEOSTAMISEL",e.MENTOIMSEIS_TYHISTATUD="MENTOIMSEIS_TYHISTATUD",e.MENTOIMSEIS_VALMIS="MENTOIMSEIS_VALMIS",e.MENTOIMSEIS_KEELDUTUD="MENTOIMSEIS_KEELDUTUD",e.MENTOIMSEIS_KOOSKOLA="MENTOIMSEIS_KOOSKOLA",e.MENTOIMSEIS_KOOSKOLA_MARK="MENTOIMSEIS_KOOSKOLA_MARK",e.MENTOIMSEIS_OOTEL="MENTOIMSEIS_OOTEL",e.MENTOIMSEIS_TAGASI_LYKATUD="MENTOIMSEIS_TAGASI_LYKATUD",e.MENTOIMSEIS_ADS="MENTOIMSEIS_ADS",e.MENTOIMSEIS_ADS_ESITAMATA="MENTOIMSEIS_ADS_ESITAMATA",e.MENTOIMSEIS_ADS_JOUSTUNUD="MENTOIMSEIS_ADS_JOUSTUNUD",e.MENTOIMSEIS_ADS_KONTROLL="MENTOIMSEIS_ADS_KONTROLL",e.MENTOIMSEIS_ADS_PROBLEEM="MENTOIMSEIS_ADS_PROBLEEM",e.MENTOIMSEIS_ADS_TYHISTATUD="MENTOIMSEIS_ADS_TYHISTATUD",e.MENTOIMSEIS_ADS_TYISTATUD="MENTOIMSEIS_ADS_TYISTATUD",e.MENTOIMSEIS_VANA_VERSIOON="MENTOIMSEIS_VANA_VERSIOON",e.MENTOIMSEIS_LOOBUTUD="MENTOIMSEIS_LOOBUTUD",e.MENTOIMSEIS_TEOSTATUD="MENTOIMSEIS_TEOSTATUD",e.MENTOIMSEIS_TAHTAEG_MOODUNUD="MENTOIMSEIS_TAHTAEG_MOODUNUD",e.MENTOIMSEIS_JATKAMINE="MENTOIMSEIS_JATKAMINE",e}({});function Cs(e){return Bn(ws,e)}const Ls={[js.MENTOIMSEIS_OOTEL]:"info",[js.MENTOIMSEIS_TEOSTAMISEL]:"info",[js.MENTOIMSEIS_TYHISTATUD]:"default",[js.MENTOIMSEIS_TEOSTATUD]:"success",[js.MENTOIMSEIS_LOOBUTUD]:"default",[js.MENTOIMSEIS_TAHTAEG_MOODUNUD]:"default"},Ps={[js.MENTOIMSEIS_OOTEL]:"my_operations.operation.state.idle",[js.MENTOIMSEIS_TEOSTAMISEL]:"my_operations.operation.state.in_process",[js.MENTOIMSEIS_TYHISTATUD]:"my_operations.operation.state.cancelled",[js.MENTOIMSEIS_TEOSTATUD]:"my_operations.operation.state.done",[js.MENTOIMSEIS_LOOBUTUD]:"my_operations.operation.state.abandoned",[js.MENTOIMSEIS_TAHTAEG_MOODUNUD]:"my_operations.operation.state.expired"};function Rs(e,t){return((e,t)=>({state:Object.keys(Ps).includes(e)?t.formatMessage({id:Ps[e]}):e,type:Object.keys(Ls).includes(e)?Ls[e]:"default"}))(Cs(e),t)}const Ks=(e,t)=>({code:e,value:t.formatMessage({id:Ps[e]})});function ks(e,t){let n;return n=e===re?[js.MENTOIMSEIS_OOTEL,js.MENTOIMSEIS_TEOSTAMISEL,js.MENTOIMSEIS_TYHISTATUD,js.MENTOIMSEIS_TEOSTATUD,js.MENTOIMSEIS_LOOBUTUD,js.MENTOIMSEIS_TAHTAEG_MOODUNUD].map((e=>Ks(e,t))):e===de?[js.MENTOIMSEIS_OOTEL,js.MENTOIMSEIS_TEOSTAMISEL,js.MENTOIMSEIS_TYHISTATUD,js.MENTOIMSEIS_LOOBUTUD,js.MENTOIMSEIS_TAHTAEG_MOODUNUD].map((e=>Ks(e,t))):e===ce?[js.MENTOIMSEIS_OOTEL,js.MENTOIMSEIS_TEOSTAMISEL,js.MENTOIMSEIS_TEOSTATUD,js.MENTOIMSEIS_LOOBUTUD].map((e=>Ks(e,t))):[js.MENTOIMSEIS_OOTEL,js.MENTOIMSEIS_TEOSTAMISEL,js.MENTOIMSEIS_TEOSTATUD,js.MENTOIMSEIS_LOOBUTUD,js.MENTOIMSEIS_TAHTAEG_MOODUNUD].map((e=>Ks(e,t))),function(e){return e.map((e=>({id:e.code+"",label:e.value,level:2,children:[],selectable:!0,value:!1})))}(n)}function Fs(){return[{code:"11271",value:"Ehitusluba"},{code:"11201",value:"Ehitusteatis"},{code:"11371",value:"Kasutusluba"},{code:"11301",value:"Kasutusteatis"},{code:"11002",value:"Projekteerimistingimused"},{code:"11051",value:"5G pääsupunkti taotlus"}].map((e=>({id:`${e.code}`,label:e.value,level:2,children:[],selectable:!0,value:!1})))}function Ys(e,t){if(t.documentTypes.length>0&&(e=e.filter((e=>e.doty&&void 0!==e.doty&&t.documentTypes.includes(e.doty)))),t.ehrCode.length>0&&(e=e.filter((e=>{var n;return null===(n=e.ehrCode)||void 0===n?void 0:n.some((e=>{var n;return null!==(n=e.startsWith(t.ehrCode.trim()))&&void 0!==n&&n}))}))),t.institutions.length>0&&(e=e.filter((e=>{var n;return e.supervisorJurId&&void 0!==e.supervisorJurId&&t.institutions.includes(null===(n=e.supervisorJurId)||void 0===n?void 0:n.toString())}))),t.wordInAddress.length>0&&(e=e.filter((e=>{var n,s;return null!==(n=null===(s=e.address)||void 0===s?void 0:s.some((e=>null==e?void 0:e.toLocaleLowerCase().includes(t.wordInAddress.trim().toLocaleLowerCase()))))&&void 0!==n&&n}))),t.proceedingNumber.length>0&&(e=e.filter((e=>{var n,s;return null!==(n=null===(s=e.proceedingNr)||void 0===s?void 0:s.includes(t.proceedingNumber.trim()))&&void 0!==n&&n}))),t.operationStates.length>0&&(e=e.filter((e=>e.stateCode&&void 0!==e.stateCode&&t.operationStates.includes(Cs(e.stateCode))))),t.institutionUsers&&t.institutionUsers.length>0&&(e=e.filter((e=>e.operationExecutorId&&void 0!==e.operationExecutorId&&t.institutionUsers.includes(e.operationExecutorId.toString())))),t.operationDate.from.length>0&&0===t.operationDate.to.length){const n=new Date(t.operationDate.from).getTime();e=e.filter((e=>new Date(_n()(e.invitationDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n))}if(t.operationDate.to.length>0&&0===t.operationDate.from.length){const n=new Date(t.operationDate.to).getTime();e=e.filter((e=>new Date(_n()(e.invitationDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()<=n))}if(t.operationDeadline.from.length>0){const n=new Date(t.operationDeadline.from).getTime();e=e.filter((e=>!e.deadline||new Date(_n()(e.deadline,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n))}if(t.operationDeadline.to.length>0){const n=new Date(t.operationDeadline.to).getTime();e=e.filter((e=>!e.deadline||new Date(_n()(e.deadline,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()<=n))}if(t.operationDate.from.length>0&&t.operationDate.to.length>0){const n=new Date(t.operationDate.from).getTime(),s=new Date(t.operationDate.to).getTime();e=e.filter((e=>new Date(_n()(e.invitationDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n&&new Date(_n()(e.invitationDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()<=s))}return e}function Bs(e){return[{id:js.MENTOIMSEIS_OOTEL},{id:js.MENTOIMSEIS_TEOSTAMISEL},{id:js.MENTOIMSEIS_TEOSTATUD},{id:js.MENTOIMSEIS_LOOBUTUD}].filter((t=>e.includes(t.id)))}let Vs=function(e){return e.Document="DOCUMENT",e.Proceeding="PROCEEDING",e.AdminProceeding="ADMIN_PROCEEDING",e.AdminOperation="ADMIN_OPERATION",e.ProceedingDecision="PROCEEDING_DECISION",e.Operation="OPERATION",e.MyDocuments="MY_DOCUMENTS",e.MyProceedings="MY_PROCEEDINGS",e.MyAdministrativeProceedings="MY_ADMIN_PROCEEDINGS",e.Building="BUILDING",e.NewEnergy="NEW_ENERGY",e.ArchiveBuildingRegistryFile="ARCHIVE_BUILDINGREGISTRYFILE",e.ArchiveBuildingDatasOf2003="ARCHIVE_BUILDINGDATAASOF2003",e.ArchiveBuildingDatasOf2014="ARCHIVE_BUILDINGDATAASOF2014",e.Restriction="RESTRICTION",e.NotFound="404",e}({});const Gs=["11273","11272"],Hs=e=>{const t=(0,Q.useIntl)(),[n,s]=(0,z.useState)({offset:0,limit:10}),[o,i]=(0,z.useState)([]),[r,a]=(0,z.useState)({column:1,direction:Un}),[l,d]=(0,z.useState)(!1),[c,u]=(0,z.useState)(!1),[p,h]=(0,z.useState)(!1),m=(0,vn.useSelector)((e=>e.myViewsPage.myOperations.myOperations)),g=(0,vn.useSelector)((e=>e.myViewsPage.myOperations.toCommentOperations)),S=(0,vn.useSelector)((e=>e.myViewsPage.myOperations.operationInvitations)),f=(0,vn.useSelector)((e=>e.myViewsPage.myProceedings.proceedingsToComment)),I=(0,vn.useSelector)((e=>e.myViewsPage.filter.institutions)),T=(0,vn.useSelector)((e=>e.myViewsPage.filter.documentTypes)),v=[e=>Yn(e.invitationDate)?new Date(_n()(e.invitationDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>Yn(e.deadline)?new Date(_n()(e.deadline,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>{var t;return null!==(t=e.proceedingNr)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.state)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.operationExecutor)&&void 0!==t?t:""},e=>{var t,n;return null!==(t=null===(n=T.find((t=>t.id.toString()===e.doty)))||void 0===n?void 0:n.name)&&void 0!==t?t:""},e=>void 0!==e.buildingName&&null!==e.buildingName&&Yn(e.buildingName[0])?e.buildingName[0]:"",e=>void 0!==e.ehrCode&&null!==e.ehrCode&&Yn(e.ehrCode[0])?e.ehrCode[0]:"",e=>void 0!==e.address&&null!==e.address&&Yn(e.address[0])?e.address[0]:"",e=>{var t,n;return null!==(t=null===(n=I.find((t=>t.id===e.supervisorJurId)))||void 0===n?void 0:n.regName)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.supervisor)&&void 0!==t?t:""}];(0,z.useEffect)((()=>{!m||e.viewType!==ie&&e.viewType!==oe||(i(Ys(m,e.filter)),s({offset:0,limit:10}))}),[m,e.filter]),(0,z.useEffect)((()=>{m&&e.viewType===re&&(i(On(Ys(m,e.filter),v[0],Un)),s({offset:0,limit:10}))}),[m,e.filter]),(0,z.useEffect)((()=>{g&&e.viewType===le&&(r.direction===Nn?i(Ys(g,e.filter)):i(On(Ys(g,e.filter),v[r.column],r.direction)),s({offset:0,limit:10}))}),[g,e.filter]),(0,z.useEffect)((()=>{S&&e.viewType===de&&(i(Ys(S,e.filter)),s({offset:0,limit:10}))}),[S,e.filter]),(0,z.useEffect)((()=>{f&&e.viewType===ce&&(r.direction===Nn?i(Ys(f,e.filter)):i(On(Ys(f,e.filter),v[r.column],r.direction)))}),[f,e.filter]);const E=["my_operations.invitation_date","my_operations.deadline","my_operations.proceeding_nr","my_operations.state","my_operations.operation_executor","my_operations.connected_document_type","my_operations.building_name","my_operations.ehr_code","my_operations.building_address","my_operations.institution","my_operations.supervisor"],_=["my_operations.deadline","my_operations.proceeding_nr","my_operations.state","my_operations.supervisor","my_operations.connected_document_type","my_operations.building_address"],y=[e=>Yn(e.deadline)?new Date(_n()(e.deadline,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>{var t;return null!==(t=e.proceedingNr)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.state)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.supervisor)&&void 0!==t?t:""},e=>{var t,n;return null!==(t=null===(n=T.find((t=>t.id.toString()===e.doty)))||void 0===n?void 0:n.name)&&void 0!==t?t:""},e=>void 0!==e.address&&null!==e.address&&Yn(e.address[0])?e.address[0]:""];const b=t=>{let n=Vs.Operation;return e.viewType===ce?(n=t.doty&&Gs.includes(t.doty)?Vs.AdminProceeding:Vs.Proceeding,e.linkGen(!1,void 0,n,t.proceedingNr)):((t.doty&&Gs.includes(t.doty)||t.typeCode===Ie.MENTOIMLIIK_KAAS_TAGASISIDE)&&(n=Vs.AdminOperation),e.linkGen(!1,void 0,n,t.id))};return(0,un.jsxs)(Z.Section,{form:!0,children:[o&&(0,un.jsx)(Z.CollapseTable,{content:(s=>s.slice(n.offset,n.offset+n.limit).map((n=>{var s,o,i,r,a,m,g,S;const f=[n.invitationDate,_n()(n.deadline,"DD.MM.YYYY").valueOf()<_n()().valueOf()?(0,un.jsx)("div",{className:"red-text",children:n.deadline}):n.deadline,(0,un.jsx)(Z.Tooltip,{content:(0,un.jsx)(Z.Text,{raw:"my_operations.tooltip.open_proceeding"}),placement:"bottom",theme:"dark",children:(0,un.jsx)(Z.Link,{text:n.proceedingNr,href:b(n)})},n.proceedingNr),n.stateCode?(0,un.jsx)(Z.Status,{type:Rs(n.stateCode,t).type,children:Rs(n.stateCode,t).state}):"",n.operationExecutor,n.doty?null===(s=T.find((e=>e.id.toString()===n.doty)))||void 0===s?void 0:s.name:"",n.buildingName?(0,un.jsx)("div",{children:p?(0,un.jsxs)("div",{children:[n.buildingName.map(((e,t)=>(0,un.jsxs)(X().Fragment,{children:[e,";",(0,un.jsx)("br",{})]},t))),n.buildingName.length>5&&(0,un.jsx)(Z.Link,{type:"hide",onClick:e=>{e.preventDefault(),h(!p)},text:(0,un.jsx)(Q.FormattedMessage,{id:"my_operations.link.view_less_building_names"})})]}):1===n.buildingName.length?n.buildingName:(0,un.jsxs)("div",{children:[null===(o=n.buildingName)||void 0===o?void 0:o.slice(0,4).map(((e,t)=>(0,un.jsxs)(X().Fragment,{children:[e,";",(0,un.jsx)("br",{})]},t))),null===(i=n.buildingName)||void 0===i?void 0:i.slice(4,5),n.buildingName.length>5?" ...":"",n.buildingName.length>5&&(0,un.jsx)("div",{className:"pr-3",children:(0,un.jsx)(Z.Link,{type:"show",onClick:e=>{e.preventDefault(),h(!p)},text:(0,un.jsx)(Q.FormattedMessage,{id:"my_operations.link.view_all_building_names"})})})]})}):"",n.ehrCode?(0,un.jsx)("div",{children:c?(0,un.jsxs)("div",{children:[n.ehrCode.map(((t,n)=>(0,un.jsxs)(X().Fragment,{children:[(0,un.jsx)(gn,{linkName:t,tooltipText:"my_operations.tooltip.open_building",functionCall:n=>{e.linkGen(!0,n,"BUILDING",t)},href:e.linkGen(!1,void 0,"BUILDING",t)}),(0,un.jsx)("br",{})]},n))),n.ehrCode.length>5&&(0,un.jsx)(Z.Link,{type:"hide",onClick:e=>{e.preventDefault(),u(!c)},text:(0,un.jsx)(Q.FormattedMessage,{id:"my_operations.link.view_less_ehrCodes"})})]}):(0,un.jsxs)("div",{children:[null===(r=n.ehrCode)||void 0===r?void 0:r.slice(0,4).map(((t,n)=>(0,un.jsxs)(X().Fragment,{children:[(0,un.jsx)(gn,{linkName:t,tooltipText:"my_operations.tooltip.open_building",functionCall:n=>{e.linkGen(!0,n,"BUILDING",t)},href:e.linkGen(!1,void 0,"BUILDING",t)}),(0,un.jsx)("br",{})]},n))),null===(a=n.ehrCode)||void 0===a?void 0:a.slice(4,5).map((t=>(0,un.jsx)(gn,{linkName:t,tooltipText:"my_operations.tooltip.open_building",functionCall:n=>{e.linkGen(!0,n,"BUILDING",t)},href:e.linkGen(!1,void 0,"BUILDING",t)}))),n.ehrCode.length>5?" ...":"",n.ehrCode.length>5&&(0,un.jsx)("div",{className:"pr-3",children:(0,un.jsx)(Z.Link,{type:"show",onClick:e=>{e.preventDefault(),u(!c)},text:(0,un.jsx)(Q.FormattedMessage,{id:"my_operations.link.view_all_ehrCodes"})})})]})}):"",n.address?(0,un.jsx)("div",{children:l?(0,un.jsxs)("div",{children:[n.address.map(((e,t)=>(0,un.jsxs)(X().Fragment,{children:[e,";",(0,un.jsx)("br",{})]},t))),n.address.length>5&&(0,un.jsx)(Z.Link,{type:"hide",onClick:e=>{e.preventDefault(),d(!l)},text:(0,un.jsx)(Q.FormattedMessage,{id:"my_operations.link.view_less_addresses"})})]}):1===n.address.length?n.address:(0,un.jsxs)("div",{children:[null===(m=n.address)||void 0===m?void 0:m.slice(0,4).map(((e,t)=>(0,un.jsxs)(X().Fragment,{children:[e,";",(0,un.jsx)("br",{})]},t))),null===(g=n.address)||void 0===g?void 0:g.slice(4,5),n.address.length>5?" ...":"",n.address.length>5&&(0,un.jsx)("div",{className:"pr-3",children:(0,un.jsx)(Z.Link,{type:"show",onClick:e=>{e.preventDefault(),d(!l)},text:(0,un.jsx)(Q.FormattedMessage,{id:"my_operations.link.view_all_addresses"})})})]})}):"",n.supervisorJurId?null===(S=I.find((e=>e.id===n.supervisorJurId)))||void 0===S?void 0:S.regName:"",n.supervisor],v=[...f];v.splice(4,1);const E=[...f].slice(1,4).concat(f[10]).concat(f[5]).concat(f[8]);return(0,un.jsx)(Z.CollapseTableRow,{fields:e.viewType===re?v:e.viewType===ce?E:f},n.id)})))(o),headers:function(){const n=[...E];n.splice(4,1);const s=e.viewType===re?n:e.viewType===ce?_:E,l=[...v];l.splice(4,1);const d=e.viewType===re?l:e.viewType===ce?y:v;return s.map(((e,n)=>(0,un.jsxs)("div",{children:[(0,un.jsx)("a",{className:"link-gray",style:{paddingRight:"2px"},onClick:()=>{const e=wn(n,r);a(e),e.direction!==Nn&&i(On(o,d[n],e.direction))},children:r.column===n?(0,un.jsx)(jn,{sortDirection:r.direction}):(0,un.jsx)(jn,{sortDirection:Nn})}),t.formatMessage({id:e})]})))}(),paginationEnabled:!0,pager:{offset:n.offset,limit:n.limit,total:o.length},onPaginationReload:s}),(e.viewType===oe||e.viewType===ie)&&(0,un.jsx)("div",{className:"d-flex justify-content-start",children:(0,un.jsx)(Z.Checkbox,{name:"checkbox",onChange:t=>e.onAllUsersChecked(t),text:e.viewType===oe?(0,un.jsx)(Z.Text,{raw:"my_approvals.view_all_institution_approvals"}):(0,un.jsx)(Z.Text,{raw:"my_opinions.view_all_institution_opinions"}),checked:e.isAllUsersChecked})})]})},Js=e=>{var t;const n=(0,Q.useIntl)(),s=/^[\\s0-9]{0,9}$/,o=/^([\\s0-9]{5}:[\\s0-9]{3}:[\\s0-9]{1,4}|[\\s0-9]{5}:[\\s0-9]{1,3}|[\\s0-9]{1,5})$/,i=null!==(t=e.initialFilter)&&void 0!==t?t:{documentTypes:[],ehrCode:"",institutions:[],wordInAddress:"",proceedingNumber:"",cadastralNumber:"",operationStates:[],institutionUsers:[],operationDate:{from:"",to:""},operationDeadline:{from:"",to:""}},r={...i,operationStates:[js.MENTOIMSEIS_TEOSTAMISEL]},a={...i,operationStates:[js.MENTOIMSEIS_OOTEL,js.MENTOIMSEIS_TEOSTAMISEL,js.MENTOIMSEIS_JATKAMINE]},l={...i,operationStates:[js.MENTOIMSEIS_OOTEL]},[d,c]=(0,z.useState)(e.filterState),[u,p]=(0,z.useState)(Bs(d.operationStates)),[h,m]=(0,z.useState)(!0),[g,S]=(0,z.useState)(!0),[f,I]=(0,z.useState)(""),[T,v]=(0,z.useState)(""),E=(0,z.useMemo)((()=>Fs()),[]),[_,y]=(0,z.useState)([]),[b,D]=(0,z.useState)([]),x=(0,z.useMemo)((()=>ks(e.viewType,n)),[e.viewType]),[M,O]=(0,z.useState)([]),N=(0,vn.useSelector)((e=>e.myViewsPage.filter.institutionUsers)),A=(0,vn.useSelector)((e=>e.myViewsPage.filter.institutions));function U(e){return s.test(e)}function w(e,t){let n;e.selectedData.length>0?(n=void 0!==e.selectedData[0].data?e.selectedData[0].data:e.selectedData,n=n.map((e=>e.id.length<5?e.children.map((e=>e.id)):e.id)).flat()):n=[],d[t]=n,c((e=>({...e})))}function j(e,t){var n;d[t]=e,"ehrCode"===t&&U(e)?m(!0):"cadastralNumber"===t&&(0===(n=e).length||o.test(n))&&S(!0),c((e=>({...e})))}(0,z.useEffect)((()=>{if(N){const e=ps(N?[...N]:[]);D(e)}if(A){const e=hs([...A]);y(e)}}),[N,A]);return(0,un.jsxs)(Z.Form,{onSubmit:()=>e.onSubmit(d),children:[(0,un.jsx)(Z.Row,{className:"align-items-start",children:(0,un.jsx)(Z.Col,{sm:10,className:"mx-0 px-0",children:(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)(Z.Multiselect,{name:"multiselect",options:E,onSelect:e=>w(e,"documentTypes"),allSelection:!0,onRemoveItem:e=>w(e,"documentTypes"),value:d.documentTypes,selectedOptions:M}),label:(0,un.jsx)(Q.FormattedMessage,{id:"my_operations.filter.label.document_type"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})})}),(0,un.jsx)(Z.Row,{className:"align-items-start",children:(0,un.jsx)(Z.Col,{sm:10,className:"mx-0 px-0",children:(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)(Z.Input,{name:"input",onChange:e=>j(e,"ehrCode"),onBlur:e=>S(U(e.trim())),placeholder:n.formatMessage({id:"placeholder.writing"}),value:d.ehrCode}),errorMessage:!h&&(0,un.jsx)(Z.Text,{raw:"filter.invalid_building_code"}),label:(0,un.jsx)(Q.FormattedMessage,{id:"my_operations.filter.label.ehrCode"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})})}),(0,un.jsxs)(Z.Row,{className:"align-items-start",children:[(0,un.jsxs)(Z.Col,{sm:10,className:"mx-0 px-0",children:[(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)(Z.Multiselect,{name:"multiselect",options:_,onSelect:e=>w(e,"institutions"),allSelection:!0,onRemoveItem:e=>w(e,"institutions"),value:d.institutions,selectedOptions:M}),label:(0,un.jsx)(Q.FormattedMessage,{id:"my_operations.filter.label.institution"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)(Z.Input,{name:"input",onChange:e=>j(e,"proceedingNumber"),placeholder:n.formatMessage({id:"placeholder.writing"}),value:d.proceedingNumber}),label:(0,un.jsx)(Q.FormattedMessage,{id:"my_operations.filter.label.proceeding_number"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)(Z.Multiselect,{name:"multiselect",options:x,onSelect:e=>w(e,"operationStates"),allSelection:!0,onRemoveItem:e=>w(e,"operationStates"),value:d.operationStates,selectedOptions:u}),label:(0,un.jsx)(Q.FormattedMessage,{id:"my_operations.filter.label.operation_state"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)(ms,{onChange:e=>(e=>{""!==e.from&&!_n()(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!_n()(e.to,"YYYY-MM-DD",!0).isValid()?I(n.formatMessage({id:"filter.invalid_date_format"})):""!==e.from&&""!==e.to&&e.from>e.to?I(n.formatMessage({id:"filter.invalid_date_range"})):I(""),c((t=>({...t,operationDate:e})))})(e),value:d.operationDate}),errorMessage:f.length>0?f:null,label:(0,un.jsx)(Q.FormattedMessage,{id:"my_operations.filter.label.operation_date"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})]}),(0,un.jsxs)(Z.Col,{sm:10,className:"mx-0 px-0",children:[(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)(Z.Input,{name:"input",onChange:e=>j(e,"wordInAddress"),placeholder:n.formatMessage({id:"placeholder.writing"}),value:d.wordInAddress}),label:(0,un.jsx)(Q.FormattedMessage,{id:"my_operations.filter.label.word_in_address"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)(Z.Multiselect,{name:"multiselect",options:b,onSelect:e=>w(e,"institutionUsers"),allSelection:!0,onRemoveItem:e=>w(e,"institutionUsers"),value:d.institutionUsers,selectedOptions:M}),label:(0,un.jsx)(Q.FormattedMessage,{id:"my_operations.filter.label.institution_users"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)(ms,{onChange:e=>(e=>{""!==e.from&&!_n()(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!_n()(e.to,"YYYY-MM-DD",!0).isValid()?v(n.formatMessage({id:"filter.invalid_date_format"})):""!==e.from&&""!==e.to&&e.from>e.to?v(n.formatMessage({id:"filter.invalid_date_range"})):v(""),c((t=>({...t,operationDeadline:e})))})(e),value:d.operationDeadline}),errorMessage:T.length>0?T:null,label:(0,un.jsx)(Q.FormattedMessage,{id:"my_operations.filter.label.operation_deadline"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})]})]}),(0,un.jsxs)(Z.Row,{children:[(0,un.jsx)(Z.Col,{children:(0,un.jsx)(Z.Button,{onClick:()=>function(){let t;switch(O([]),e.viewType){case ae:t=r;break;case le:case ce:t=a;break;case de:t=l;break;default:t=i}c(t),p(Bs(t.operationStates))}(),colourScheme:"light",squared:!0,children:(0,un.jsx)(Q.FormattedMessage,{id:"button.epmty_fields"})})}),(0,un.jsx)(Z.Col,{children:(0,un.jsx)(Z.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!(h&&g),squared:!0,children:(0,un.jsx)(Q.FormattedMessage,{id:"button.search"})})})]})]})},Ws=e=>{var t,n,s,o;let{classifierApiEndpoint:i,fileUploadApiEndpoint:r,linkGen:a,myViewsApiEndpoint:l,userInfo:d,userApiEndpoint:c}=e;const u=(0,vn.useDispatch)(),[p,h]=(0,z.useState)({proceedings:!1}),[m,f]=(0,z.useState)(!0),[I,T]=(0,z.useState)(!0),[v,E]=(0,z.useState)(!0),[_,y]=(0,z.useState)([]),[b,D]=(0,z.useState)([]),[x,M]=(0,z.useState)([]),U=new Le(new Et({basePath:i})),w=new et(new Et({basePath:c})),j=new vt(new Et({basePath:l})),C=new mt(new Et({basePath:l})),L=new It(new Et({basePath:l})),P=new Wt(new qt({basePath:r})),R="A"!==(null===(t=d.activeRole)||void 0===t?void 0:t.businessType);let K=new Date;K.setDate(K.getDate()-7);const k={documentTypes:[],ehrCode:"",institutions:[],wordInAddress:"",proceedingNumber:"",cadastralNumber:"",operationStates:["MENTOIMSEIS_OOTEL","MENTOIMSEIS_TEOSTAMISEL"],institutionUsers:[(null===(n=d.activeRole)||void 0===n?void 0:n.userId)+""],operationDate:{from:"",to:""},operationDeadline:{from:K.toISOString().split("T")[0],to:""}},[F,Y]=(0,z.useState)({documentTypes:[],ehrCode:"",buildingName:"",wordInAddress:"",proceedingNumber:"",cadastralNumber:"",proceedingStates:["MENSEIS_ALGATATUD","MENSEIS_KAIMASOLEV"],connectedPerson:"",showProceedingInArchive:!1,supervisors:[],proceedingDate:{from:"",to:""},lastEventDate:""}),[B,V]=(0,z.useState)(k),[G,H]=(0,z.useState)({});const J={userId:null===(s=d.activeRole)||void 0===s?void 0:s.userId,personId:null===(o=d.activeRole)||void 0===o?void 0:o.businessId,dotys:["11525","11271","11201","11301","11271","11371","11002","11582","11581","12271","12371","11413","11412","11430","11583"],states:[Ln.DO_DOKUSEIS_ESITATUD,Ln.DO_DOKUSEIS_MENETLUSES]};return(0,z.useEffect)((()=>{!function(e){var t,n;const s={userId:e.institutionUsers?Number(e.institutionUsers[0]):null===(t=d.activeRole)||void 0===t?void 0:t.userId,personId:null===(n=d.activeRole)||void 0===n?void 0:n.businessId,states:e.operationStates,type:[Ie.MENTOIMLIIK_MEN_MARKUS]};T(!0),L.findOperationsToComment(s).then((e=>{u(N(e.data)),D(e.data),T(!1)})).catch((e=>{console.log("Following error occured:",e),T(!1)}))}(B)}),[d,B]),(0,z.useEffect)((()=>{(()=>{const e=J;p.proceedings&&(e.userId=void 0),f(!0),j.findProceedings(e).then((e=>{u(O(e.data)),y(e.data),f(!1)})).catch((e=>{console.log("Following error occured:",e),f(!1)}))})()}),[p.proceedings]),(0,z.useEffect)((()=>{!function(){const e=J;e.userId=void 0,E(!0),C.findIncomingBaseDocuments(e).then((e=>{u(A(e.data)),E(!1),M(e.data)})).catch((e=>{console.log("Following error occured:",e),E(!1)}))}()}),[d]),(0,z.useEffect)((()=>{var e,t;U.getAllDocumentTypes().then((e=>{u(g(e.data))})).catch((e=>{console.log(e)})),R&&w.getJurUsers(null!==(e=null===(t=d.activeRole)||void 0===t?void 0:t.businessId)&&void 0!==e?e:0).then((e=>{u(S(e.data))})).catch((e=>{console.log(e)}))}),[d]),(0,un.jsxs)("div",{children:[(0,un.jsx)(Z.Section,{collapsed:!1,title:"my_proceedings.my_proceedings",showSettings:!0,filterContents:(0,un.jsx)(Us,{onSubmit:e=>{Y(e)},isKov:R,filterState:F}),children:m?(0,un.jsx)(Z.SectionLoader,{}):0===_.length?(0,un.jsxs)("div",{children:[(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(Z.Text,{raw:"my_proceedings.no_proceedings"})}),R&&(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(Z.Link,{text:"my_proceedings.view_all_institution_proceedings",onClick:()=>{h({proceedings:!0})}})})]}):(0,un.jsx)(Ns,{linkGen:a,isKov:R,onAllUsersChecked:e=>{h({proceedings:e})},isAllUsersChecked:p.proceedings,filter:F})}),R&&(0,un.jsx)(Z.Section,{collapsed:!1,title:"my_proceedings.section_title.proceedings_to_comment",showSettings:!0,filterContents:(0,un.jsx)(Js,{viewType:ce,initialFilter:k,filterState:B,onSubmit:e=>V(e)}),children:I?(0,un.jsx)(Z.SectionLoader,{}):0===b.length?(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(Z.Text,{raw:"my_proceedings.proceedings_to_comment.no_proceedings"})}):(0,un.jsx)(Hs,{linkGen:a,viewType:ce,filter:B})}),R&&(0,un.jsx)(Z.Section,{collapsed:!1,title:"my_documents.incoming_documents",showSettings:!0,filterContents:(0,un.jsx)(gs,{documentType:se,filterState:G,onSubmit:e=>H(e),isKov:R}),children:v?(0,un.jsx)(Z.SectionLoader,{}):0===x.length?(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(Z.Text,{raw:"my_documents.incoming_documents.no_docs"})}):(0,un.jsx)(as,{linkGen:a,userInfo:d,documentType:se,filter:G,fileApi:P})})]})},qs=e=>{let{classifierApiEndpoint:t,linkGen:n,myViewsApiEndpoint:s,userApiEndpoint:o,userInfo:{activeRole:i}}=e;const r=(0,vn.useDispatch)(),[a,l]=(0,z.useState)(!0),[d,c]=(0,z.useState)(!1),[u,p]=(0,z.useState)(!1),[h,m]=(0,z.useState)(null),[I,T]=(0,z.useState)(null),[v,E]=(0,z.useState)(null),_={documentTypes:[],ehrCode:"",institutions:[],wordInAddress:"",proceedingNumber:"",cadastralNumber:"",operationStates:[],institutionUsers:[],operationDate:{from:"",to:""},operationDeadline:{from:"",to:""}},y={..._,operationStates:[js.MENTOIMSEIS_TEOSTAMISEL]},b={..._,operationStates:[js.MENTOIMSEIS_OOTEL,js.MENTOIMSEIS_TEOSTAMISEL,js.MENTOIMSEIS_JATKAMINE]},D={..._,operationStates:[js.MENTOIMSEIS_OOTEL]},[x,M]=(0,z.useState)(y),[O,N]=(0,z.useState)(b),[A,U]=(0,z.useState)(D),[w,P]=(0,z.useState)(!1),R=new qe(new Et({basePath:o})),K=new et(new Et({basePath:o})),k=new It(new Et({basePath:s})),F=new Le(new Et({basePath:t}));return(0,z.useEffect)((()=>{var e;R.getJurKovPersons().then((e=>{r(f(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)})),K.getJurUsers(null!==(e=null==i?void 0:i.businessId)&&void 0!==e?e:0).then((e=>{r(S(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)})),F.getAllDocumentTypes().then((e=>{r(g(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)}))}),[]),(0,z.useEffect)((()=>{!function(){const e={userId:null==i?void 0:i.userId,personId:null==i?void 0:i.businessId,type:[Ie.MENTOIMLIIK_VALINE_KOOSK],states:ws.MENTOIMSEIS_TEOSTAMISEL.concat(ws.MENTOIMSEIS_TEOSTATUD,ws.MENTOIMSEIS_LOOBUTUD,ws.MENTOIMSEIS_TAHTAEG_MOODUNUD)};w&&(e.userId=void 0),l(!0),k.findOperations(e).then((e=>{r(j(e.data)),m(e.data),l(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),l(!1)}))}()}),[w]),(0,z.useEffect)((()=>{c(!0),k.findOperationsToComment({userId:null==i?void 0:i.userId,type:[Ie.MENTOIMLIIK_VALINE_KOOSK],states:ws.MENTOIMSEIS_TEOSTAMISEL.concat(ws.MENTOIMSEIS_TEOSTATUD,ws.MENTOIMSEIS_LOOBUTUD,ws.MENTOIMSEIS_TAHTAEG_MOODUNUD)}).then((e=>{r(C(e.data)),T(e.data),c(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),c(!1)})),p(!0),k.findOperationInvitations({userId:void 0,personId:null==i?void 0:i.businessId,type:[Ie.MENTOIMLIIK_VALINE_KOOSK],states:ws.MENTOIMSEIS_OOTEL.concat(ws.MENTOIMSEIS_TEOSTAMISEL,ws.MENTOIMSEIS_TYHISTATUD,ws.MENTOIMSEIS_LOOBUTUD,ws.MENTOIMSEIS_TAHTAEG_MOODUNUD)}).then((e=>{r(L(e.data)),E(e.data),p(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),p(!1)}))}),[]),(0,un.jsxs)("div",{children:[(0,un.jsxs)(Z.Section,{collapsed:!1,title:"my_approvals.my_approvals",showSettings:!0,filterContents:(0,un.jsx)(Js,{viewType:ae,filterState:x,onSubmit:e=>M(e)}),children:[a&&(0,un.jsx)(Z.SectionLoader,{}),a||h?(0,un.jsx)(Hs,{linkGen:n,viewType:oe,filter:x,isAllUsersChecked:w,onAllUsersChecked:e=>{P(e)}}):(0,un.jsxs)("div",{children:[(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(Z.Text,{raw:"my_approvals.no_approvals"})}),(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(Z.Link,{text:"my_approvals.view_all_institution_approvals",onClick:()=>{P(!0)}})})]})]}),(0,un.jsxs)(Z.Section,{collapsed:!1,title:"my_approvals.approvals_to_comment",showSettings:!0,filterContents:(0,un.jsx)(Js,{viewType:le,filterState:O,onSubmit:e=>N(e)}),children:[d&&(0,un.jsx)(Z.SectionLoader,{}),d||I?(0,un.jsx)(Hs,{linkGen:n,viewType:le,filter:O}):(0,un.jsx)("div",{children:(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(Z.Text,{raw:"my_approvals.no_approvals_to_comment"})})})]}),(0,un.jsxs)(Z.Section,{collapsed:!1,title:"my_approvals.approval_invitations",showSettings:!0,filterContents:(0,un.jsx)(Js,{viewType:de,filterState:A,onSubmit:e=>U(e)}),children:[u&&(0,un.jsx)(Z.SectionLoader,{}),u||v?(0,un.jsx)(Hs,{linkGen:n,viewType:de,filter:A}):(0,un.jsx)("div",{children:(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(Z.Text,{raw:"my_approvals.no_approval_invitations"})})})]})]})},$s=e=>{let{classifierApiEndpoint:t,linkGen:n,myViewsApiEndpoint:s,userApiEndpoint:o,userInfo:{activeRole:i}}=e;const r=(0,vn.useDispatch)(),[a,l]=(0,z.useState)(!1),[d,c]=(0,z.useState)(!1),[u,p]=(0,z.useState)(!1),[h,m]=(0,z.useState)(null),[I,T]=(0,z.useState)(null),[v,E]=(0,z.useState)(null),_={documentTypes:[],ehrCode:"",institutions:[],wordInAddress:"",proceedingNumber:"",cadastralNumber:"",operationStates:[],institutionUsers:[],operationDate:{from:"",to:""},operationDeadline:{from:"",to:""}},y={..._,operationStates:[js.MENTOIMSEIS_TEOSTAMISEL]},b={..._,operationStates:[js.MENTOIMSEIS_OOTEL,js.MENTOIMSEIS_TEOSTAMISEL,js.MENTOIMSEIS_JATKAMINE]},D={..._,operationStates:[js.MENTOIMSEIS_OOTEL]},[x,M]=(0,z.useState)(y),[O,N]=(0,z.useState)(b),[A,U]=(0,z.useState)(D),[w,P]=(0,z.useState)(!1),R=new qe(new Et({basePath:o})),K=new et(new Et({basePath:o})),k=new It(new Et({basePath:s})),F=new Le(new Et({basePath:t}));return(0,z.useEffect)((()=>{var e;R.getJurKovPersons().then((e=>{r(f(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)})),K.getJurUsers(null!==(e=null==i?void 0:i.businessId)&&void 0!==e?e:0).then((e=>{r(S(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)})),F.getAllDocumentTypes().then((e=>{r(g(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)}))}),[]),(0,z.useEffect)((()=>{!function(){const e=w?null==i?void 0:i.businessId:null==i?void 0:i.userId;l(!0),k.findOperations({personId:w?e:void 0,userId:w?void 0:e,type:[Ie.MENTOIMLIIK_ARVAMUS],states:ws.MENTOIMSEIS_TEOSTAMISEL.concat(ws.MENTOIMSEIS_TEOSTATUD,ws.MENTOIMSEIS_LOOBUTUD,ws.MENTOIMSEIS_TAHTAEG_MOODUNUD)}).then((e=>{r(j(e.data)),m(e.data),l(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),l(!1)}))}()}),[w]),(0,z.useEffect)((()=>{c(!0),k.findOperationsToComment({userId:null==i?void 0:i.userId,type:[Ie.MENTOIMLIIK_ARVAMUS],states:ws.MENTOIMSEIS_TEOSTAMISEL.concat(ws.MENTOIMSEIS_TEOSTATUD,ws.MENTOIMSEIS_LOOBUTUD,ws.MENTOIMSEIS_TAHTAEG_MOODUNUD)}).then((e=>{r(C(e.data)),T(e.data),c(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),c(!1)})),p(!0),k.findOperationInvitations({userId:void 0,personId:null==i?void 0:i.businessId,type:[Ie.MENTOIMLIIK_ARVAMUS],states:ws.MENTOIMSEIS_OOTEL.concat(ws.MENTOIMSEIS_TEOSTAMISEL,ws.MENTOIMSEIS_TYHISTATUD,ws.MENTOIMSEIS_LOOBUTUD,ws.MENTOIMSEIS_TAHTAEG_MOODUNUD)}).then((e=>{r(L(e.data)),E(e.data),p(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),p(!1)}))}),[]),(0,un.jsxs)("div",{children:[(0,un.jsxs)(Z.Section,{collapsed:!1,title:"my_opinions.my_opinions",showSettings:!0,filterContents:(0,un.jsx)(Js,{viewType:ae,filterState:x,onSubmit:e=>M(e)}),children:[a&&(0,un.jsx)(Z.SectionLoader,{}),a||h?(0,un.jsx)(Hs,{linkGen:n,viewType:ie,filter:x,isAllUsersChecked:w,onAllUsersChecked:e=>{P(e)}}):(0,un.jsxs)("div",{children:[(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(Z.Text,{raw:"my_opinions.no_opinions"})}),(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(Z.Link,{text:"my_opinions.view_all_institution_opinions",onClick:()=>{P(!0)}})})]})]}),(0,un.jsxs)(Z.Section,{collapsed:!1,title:"my_opinions.opinions_to_comment",showSettings:!0,filterContents:(0,un.jsx)(Js,{viewType:le,filterState:O,onSubmit:e=>N(e)}),children:[d&&(0,un.jsx)(Z.SectionLoader,{}),d||I?(0,un.jsx)(Hs,{linkGen:n,viewType:le,filter:O}):(0,un.jsx)("div",{children:(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(Z.Text,{raw:"my_opinions.no_opinions_to_comment"})})})]}),(0,un.jsxs)(Z.Section,{collapsed:!1,title:"my_opinions.opinion_invitations",showSettings:!0,filterContents:(0,un.jsx)(Js,{viewType:de,filterState:A,onSubmit:e=>U(e)}),children:[u&&(0,un.jsx)(Z.SectionLoader,{}),u||v?(0,un.jsx)(Hs,{linkGen:n,viewType:de,filter:A}):(0,un.jsx)("div",{children:(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(Z.Text,{raw:"my_opinions.no_opinion_invitations"})})})]})]})},zs=e=>{const t=(0,Q.useIntl)(),n=/^[\\s0-9]{0,9}$/,s=/^([\\s0-9]{5}:[\\s0-9]{3}:[\\s0-9]{1,4}|[\\s0-9]{5}:[\\s0-9]{1,3}|[\\s0-9]{1,5})$/,o={documentTypes:[],ehrCode:"",institutions:[],wordInAddress:"",proceedingNumber:"",cadastralNumber:"",operationStates:[js.MENTOIMSEIS_OOTEL,js.MENTOIMSEIS_TEOSTAMISEL,js.MENTOIMSEIS_TEOSTATUD,js.MENTOIMSEIS_LOOBUTUD],operationDate:{from:"",to:""},operationDeadline:{from:"",to:""}},[i,r]=(0,z.useState)(e.filterState),[a,l]=(0,z.useState)(Bs(i.operationStates)),[d,c]=(0,z.useState)(!0),[u,p]=(0,z.useState)(!0),[h,m]=(0,z.useState)(""),g=(0,z.useMemo)((()=>Fs()),[]),[S,f]=(0,z.useState)([]),I=(0,z.useMemo)((()=>ks(re,t)),[]),[T,v]=(0,z.useState)([]),E=(0,vn.useSelector)((e=>e.myViewsPage.filter.institutions));function _(e){return n.test(e)}function y(e,t){let n;e.selectedData.length>0?(n=void 0!==e.selectedData[0].data?e.selectedData[0].data:e.selectedData,n=n.map((e=>e.id.length<5?e.children.map((e=>e.id)):e.id)).flat()):n=[],i[t]=n,r((e=>({...e})))}function b(e,t){var n;i[t]=e,"ehrCode"===t&&_(e)?c(!0):"cadastralNumber"===t&&(0===(n=e).length||s.test(n))&&p(!0),r((e=>({...e})))}(0,z.useEffect)((()=>{if(E){const e=hs([...E]);f(e)}}),[E]);return(0,un.jsxs)(Z.Form,{onSubmit:()=>e.onSubmit(i),children:[(0,un.jsxs)(Z.Row,{children:[(0,un.jsx)(Z.Col,{children:(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)(Z.Multiselect,{name:"multiselect",options:g,onSelect:e=>y(e,"documentTypes"),allSelection:!0,onRemoveItem:e=>y(e,"documentTypes"),value:i.documentTypes,selectedOptions:T}),label:(0,un.jsx)(Q.FormattedMessage,{id:"my_operations.filter.label.document_type"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,un.jsx)(Z.Col,{})]}),(0,un.jsxs)(Z.Row,{children:[(0,un.jsx)(Z.Col,{children:(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)(Z.Input,{name:"input",onChange:e=>b(e,"ehrCode"),onBlur:e=>c(_(e.trim())),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.ehrCode}),errorMessage:!d&&(0,un.jsx)(Z.Text,{raw:"filter.invalid_building_code"}),label:(0,un.jsx)(Q.FormattedMessage,{id:"my_operations.filter.label.ehrCode"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,un.jsx)(Z.Col,{children:(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)(Z.Input,{name:"input",onChange:e=>b(e,"wordInAddress"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.wordInAddress}),label:(0,un.jsx)(Q.FormattedMessage,{id:"my_operations.filter.label.word_in_address"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})})]}),(0,un.jsxs)(Z.Row,{children:[(0,un.jsx)(Z.Col,{children:(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)(Z.Multiselect,{name:"multiselect",options:S,onSelect:e=>y(e,"institutions"),allSelection:!0,onRemoveItem:e=>y(e,"institutions"),value:i.institutions,selectedOptions:T}),label:(0,un.jsx)(Q.FormattedMessage,{id:"my_operations.filter.label.institution"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,un.jsx)(Z.Col,{})]}),(0,un.jsxs)(Z.Row,{children:[(0,un.jsx)(Z.Col,{children:(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)(Z.Input,{name:"input",onChange:e=>b(e,"proceedingNumber"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.proceedingNumber}),label:(0,un.jsx)(Q.FormattedMessage,{id:"my_operations.filter.label.proceeding_number"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,un.jsx)(Z.Col,{children:(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)(Z.Multiselect,{name:"multiselect",options:I,onSelect:e=>y(e,"operationStates"),allSelection:!0,onRemoveItem:e=>y(e,"operationStates"),value:i.operationStates,selectedOptions:a}),label:(0,un.jsx)(Q.FormattedMessage,{id:"my_involvements.filter.label.involvement_state"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})})]}),(0,un.jsxs)(Z.Row,{children:[(0,un.jsx)(Z.Col,{children:(0,un.jsx)(Z.FieldWrapper,{component:(0,un.jsx)(ms,{onChange:e=>(e=>{""!==e.from&&!_n()(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!_n()(e.to,"YYYY-MM-DD",!0).isValid()?m(t.formatMessage({id:"filter.invalid_date_format"})):""!==e.from&&""!==e.to&&e.from>e.to?m(t.formatMessage({id:"filter.invalid_date_range"})):m(""),r((t=>({...t,operationDate:e})))})(e),value:i.operationDate}),errorMessage:h.length>0?h:null,label:(0,un.jsx)(Q.FormattedMessage,{id:"my_involvements.filter.label.involvement_date"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,un.jsx)(Z.Col,{})]}),(0,un.jsxs)(Z.Row,{children:[(0,un.jsx)(Z.Col,{children:(0,un.jsx)(Z.Button,{onClick:()=>(v([]),r(o),void l(Bs(o.operationStates))),colourScheme:"light",squared:!0,children:(0,un.jsx)(Q.FormattedMessage,{id:"button.epmty_fields"})})}),(0,un.jsx)(Z.Col,{children:(0,un.jsx)(Z.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!(d&&u),squared:!0,children:(0,un.jsx)(Q.FormattedMessage,{id:"button.search"})})})]})]})},Xs=e=>{var t;let{classifierApiEndpoint:n,linkGen:s,myViewsApiEndpoint:o,userInfo:i,userApiEndpoint:r}=e;const a=(0,vn.useDispatch)(),[l,d]=(0,z.useState)(!1),[c,u]=(0,z.useState)([]),p=!(void 0===i||"A"===(null==i||null===(t=i.activeRole)||void 0===t?void 0:t.businessType)),h={documentTypes:[],ehrCode:"",institutions:[],wordInAddress:"",proceedingNumber:"",cadastralNumber:"",operationStates:[js.MENTOIMSEIS_OOTEL,js.MENTOIMSEIS_TEOSTAMISEL,js.MENTOIMSEIS_TEOSTATUD,js.MENTOIMSEIS_LOOBUTUD],operationDate:{from:"",to:""},operationDeadline:{from:"",to:""}},[m,S]=(0,z.useState)(h),I=new qe(new Et({basePath:r})),T=new It(new Et({basePath:o})),v=new Le(new Et({basePath:n}));return(0,z.useEffect)((()=>{var e;I.getJurKovPersons().then((e=>{a(f(e.data))})).catch((e=>{console.log(e)})),v.getAllDocumentTypes().then((e=>{a(g(e.data))})).catch((e=>{console.log(e)})),d(!0),T.findOperations({userId:void 0,personId:p?null===(e=i.activeRole)||void 0===e?void 0:e.businessId:i.personId,type:[Ie.MENTOIMLIIK_KAASAMINE,Ie.MENTOIMLIIK_KAAS_TAGASISIDE],states:[js.MENTOIMSEIS_OOTEL,js.MENTOIMSEIS_TEOSTAMISEL,js.MENTOIMSEIS_TEOSTATUD,js.MENTOIMSEIS_VALMIS,js.MENTOIMSEIS_JATKAMINE,js.MENTOIMSEIS_TYHISTATUD,js.MENTOIMSEIS_LOOBUTUD,js.MENTOIMSEIS_KEELDUTUD,js.MENTOIMSEIS_TAGASI_LYKATUD,js.MENTOIMSEIS_TAHTAEG_MOODUNUD]}).then((e=>{a(j(e.data)),u(e.data),d(!1)})).catch((e=>{console.log("Following error occured:",e),d(!1)}))}),[i]),(0,un.jsx)("div",{children:(0,un.jsx)(Z.Section,{collapsed:!1,title:"my_involvements.my_involvements",showSettings:!0,filterContents:(0,un.jsx)(zs,{filterState:m,onSubmit:e=>S(e)}),children:l?(0,un.jsx)(Z.SectionLoader,{}):0===c.length?(0,un.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,un.jsx)(Z.Text,{raw:"my_involvements.no_involvements"})}):(0,un.jsx)(Hs,{linkGen:s,viewType:re,filter:m})})})};function Qs(e){return e.map((e=>({id:e.code+"",label:e.value,level:2,children:[],selectable:!0,value:!1})))}function Zs(e){let t=Qs([{code:"EHITIS_SEISUND_KAVAN",value:"Kavandatav"},{code:"EHITIS_SEISUND_PYSTI",value:"Püstitamisel"},{code:"EHITIS_SEISUND_OLEMA",value:"Olemas"},{code:"EHITIS_SEISUND_LAMEL",value:"Lammutamisel"},{code:"EHITIS_SEISUND_LAMUT",value:"Lammutatud"},{code:"EHITIS_SEISUND_REATA",value:"Realiseerimata"},{code:"EHITIS_SEISUND_KUSTU",value:"Kustutatud"}]);return e?t:t.slice(0,-1)}const eo=[{code:"EHITIS_OMANDI_LIIK_KINNIS",value:"Kinnisasi"},{code:"EHITIS_OMANDI_LIIK_VALLAS",value:"Vallasasi"},{code:"EHITIS_OMANDI_LIIK_VALLASRO",value:"Reaalosa kui vallasasi"}];function to(){return Qs(eo)}function no(e){let t=[];for(let n of e)t.push(n.id),t.push(...no(n.children?n.children:[]));return t}const so=e=>{const t=(0,Q.useIntl)(),n={buildingLocation:"",buildingName:"",buildingStates:[],firstUseDate:{from:"",to:""},firstUseMissing:!1,buildingType:[],purposeOfUse:[],ownershipType:[],owner:void 0,isPrivatePerson:!1,searchType:ue},s=(0,vn.useSelector)((e=>e.myViewsPage.filter.usageClassifierTypes)),o=(0,vn.useSelector)((e=>e.myViewsPage.detailSearch.buildings)),[i,r]=(0,z.useState)(n),[a,l]=(0,z.useState)([]),[d,c]=(0,z.useState)(Zs(e.isAdminRole)),[u]=(0,z.useState)(Qs([{code:"H",value:"Hoone"},{code:"R",value:"Rajatis"}])),[p]=(0,z.useState)(to()),[h,m]=(0,z.useState)([]),[g,S]=(0,z.useState)({}),[f,I]=(0,z.useState)(""),[T,v]=(0,z.useState)({}),[E,_]=(0,z.useState)(""),[y,b]=(0,z.useState)(!1),[D,x]=(0,z.useState)({code:"",value:""}),M=(0,z.useRef)(),[O,N]=(0,z.useState)({});function A(e,t){let n;n=e.selectedData.length>0?void 0!==e.selectedData[0].data?e.selectedData[0].data.map((e=>e.id)):e.selectedData.map((e=>e.id)).flat():[],i[t]=n,r((e=>({...e})))}function U(e,t){let n;if(e.selectedData.length>0){n=no(void 0===e.selectedData[0].data?e.selectedData:e.selectedData[0].data)}else n=[];i[t]=n,r((e=>({...e})))}function w(e,t){i[t]=e,r((e=>({...e})))}(0,z.useEffect)((()=>{if(s.length>0){const e=function(e){let t={id:"00000",label:"00000",parentId:"0",level:1,value:!1,selectable:!1,children:[]};for(let n of e){const{code:e,name:s,validTo:o}=n;let i=e.replace(/0/g,""),r=i.slice(0,i.length-1),a=t;for(let e=2;e<=r.length;e++)if(a.children){let t=a.children.find((t=>t.id.replace(/0/g,"")===r.slice(0,e)));t&&(a=t)}if(a.children){const t=`${e} ${s}${null!=o&&o.trim()?` (kuni ${o})`:""}`;a.children.push({id:n.id+"",parentId:a.id,label:t,level:a.level+1,children:[],selectable:!0,value:!1})}}return t.children?t.children:[]}([...s].sort(((e,t)=>Number(e.code)-Number(t.code))));m(e)}}),[s]),(0,z.useEffect)((()=>{c(Zs(e.isAdminRole))}),[e.isAdminRole]);const j={sm:20,md:8,lg:8};return(0,un.jsxs)(Z.Form,{onSubmit:()=>function(){if(JSON.stringify(n)===JSON.stringify(i))v({header:"detailsearch.empty_filter_error.header",message:"detailsearch.empty_filter_error.message"});else if(i.firstUseMissing){let t={...i};t.firstUseDate={from:"",to:""},e.onSubmit(t)}else v({header:"",message:""}),e.onSubmit(i)}(),children:[T.header&&T.header.length>0&&T.message&&T.message.length>0&&(0,un.jsx)(Z.MessageBlock,{dismissible:!0,header:(0,un.jsx)(Q.FormattedMessage,{id:T.header}),onDismiss:()=>v({header:"",message:""}),theme:"danger",messages:[(0,un.jsx)(Q.FormattedMessage,{id:T.message})]}),o&&o.length>=500&&(0,un.jsx)(Z.MessageBlock,{dismissible:!0,header:(0,un.jsx)(Q.FormattedMessage,{id:"detailsearch.empty_filter_error.header"}),theme:"warning",messages:[(0,un.jsx)(Q.FormattedMessage,{id:"detailsearch.filter_error_message.more_than_500_results"})]}),(0,un.jsxs)(Z.Row,{className:"align-items-start",children:[(0,un.jsxs)(Z.Col,{xs:20,md:20,lg:10,className:"px-0",children:[(0,un.jsx)(Z.FieldWrapper,{labelCol:j,component:(0,un.jsx)(Z.Input,{name:"input",onChange:e=>w(e,"buildingLocation"),placeholder:t.formatMessage({id:"detailssearch.filter.placeholder.address"}),value:i.buildingLocation}),label:(0,un.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.building_location"}),info:{content:"detailsearch.filter.tooltip.building_location",placement:"top-start"}}),(0,un.jsx)(Z.FieldWrapper,{labelCol:j,component:(0,un.jsx)(Z.Input,{name:"input",onChange:e=>w(e,"buildingName"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.buildingName}),label:(0,un.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.building_name"}),info:{content:"detailsearch.filter.tooltip.building_name",placement:"top-start"}}),(0,un.jsx)(Z.FieldWrapper,{labelCol:j,component:(0,un.jsx)(Z.Multiselect,{name:"multiselect",options:d,onSelect:e=>A(e,"buildingStates"),allSelection:!0,onRemoveItem:e=>A(e,"buildingStates"),value:i.buildingStates,selectedOptions:a}),label:(0,un.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.building_state"}),info:{content:"detailsearch.filter.tooltip.building_state",placement:"top-start"}}),(0,un.jsx)(Z.FieldWrapper,{labelCol:j,component:(0,un.jsx)("div",{className:"daterange_in_form",children:(0,un.jsx)(Z.NumberRangeExtended,{value:{from:i.firstUseDate.from,to:i.firstUseDate.to},onChange:e=>function(e){I(""),v({header:"",message:""});let t=null!==e.from?e.from:"",n=null!==e.to?e.to:"";r((e=>({...e,firstUseDate:{from:t,to:n}})))}(e),onBlur:e=>function(e){let n=Number(e.from),s=Number(e.to);n<0||n>2100||s<0||s>2100?I(t.formatMessage({id:"detailsearch.error_field.year-between"})):null!==e.from&&null!==e.to&&n>s?I(t.formatMessage({id:"detailsearch.error_field.beginning-bigger"})):(I(""),v({header:"",message:""}))}(e),onlyPositive:!0,disabled:i.firstUseMissing})}),errorMessage:f,label:(0,un.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.first_use"}),info:{content:"detailsearch.filter.tooltip.first_use",placement:"top-start"}}),(0,un.jsx)(un.Fragment,{children:ds(i.firstUseMissing,(function(e){r((t=>({...t,firstUseMissing:e})))}),"detailsearch.filter.label.checkbox.first_use_missing","detailsearch.filter.tooltip.checkbox.first_use_missing",j)})]}),(0,un.jsxs)(Z.Col,{xs:20,md:20,lg:10,className:"px-0",children:[(0,un.jsx)(Z.FieldWrapper,{labelCol:j,component:(0,un.jsx)(Z.Multiselect,{name:"multiselect",options:u,onSelect:e=>A(e,"buildingType"),allSelection:!0,onRemoveItem:e=>A(e,"buildingType"),value:i.buildingType,selectedOptions:a}),label:(0,un.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.building_type"}),info:{content:"detailsearch.filter.tooltip.building_type",placement:"top-start"}}),(0,un.jsx)(Z.FieldWrapper,{labelCol:j,component:(0,un.jsx)(Z.Multiselect,{name:"multiselect",options:h,onSelect:e=>U(e,"purposeOfUse"),allSelection:!0,onRemoveItem:e=>U(e,"purposeOfUse"),value:i.purposeOfUse,selectedOptions:a,isSearchExactMatch:!0}),label:(0,un.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.purpose_of_use"}),info:{content:"detailsearch.filter.tooltip.purpose_of_use",placement:"top-start"}}),(0,un.jsx)(Z.FieldWrapper,{labelCol:j,component:(0,un.jsx)(Z.Multiselect,{name:"multiselect",options:p,onSelect:e=>A(e,"ownershipType"),allSelection:!0,onRemoveItem:e=>A(e,"ownershipType"),value:i.ownershipType,selectedOptions:a}),label:(0,un.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.ownershiptype"}),info:{content:"detailsearch.filter.tooltip.ownershiptype",placement:"top-start"}})]}),e.isAdminPlusRole&&(0,un.jsx)(un.Fragment,{children:(0,un.jsxs)(Z.Row,{className:"align-items-start w-100",children:[(0,un.jsx)(Z.Col,{xs:20,md:20,lg:10,className:"px-0",children:(0,un.jsx)(Z.FieldWrapper,{labelCol:j,component:(0,un.jsx)(Z.PersonSearchPageExtended,{person:g,disabled:!1,labelKey:"code",valueKey:"value",onInputChange:e=>{!function(e){_(e)}(e)},updatedFromAR:()=>{},onPersonUpdate:e=>function(e){var t,n,s;if(S(e),e&&e.id&&e.id>0&&N(e),e&&(E===e.idCode||E===(null===(t=e.id)||void 0===t?void 0:t.toString())||E===e.regCode)||e&&D.code===e.regCode)i.owner=null===(s=e.id)||void 0===s?void 0:s.toString(),r((e=>({...e})));else if(e||E.substring(4)!==(null===(n=O.id)||void 0===n?void 0:n.toString()))e||(i.owner=void 0,r((e=>({...e}))));else{var o;i.owner=null===(o=O.id)||void 0===o?void 0:o.toString(),r((e=>({...e})))}}(e),searchPerson:e.callSearchPerson,handlePersonSelection:e=>x(e),isShowError:e=>{b(e),e||v({header:"",message:""})},searchOnBlur:!0,ref:M,isOptionalField:!0,isPrivateOwner:i.isPrivatePerson}),label:(0,un.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.owner"}),info:{content:"detailsearch.filter.tooltip.owner.extended",placement:"top-start"}})}),(0,un.jsx)(Z.Col,{xs:20,md:20,lg:10,children:ds(i.isPrivatePerson,(function(e){r((t=>({...t,isPrivatePerson:e})))}),"detailsearch.filter.label.checkbox.owner.private","",{xs:20,md:1})})]})})]}),(0,un.jsxs)(Z.Row,{children:[(0,un.jsx)(Z.Col,{children:(0,un.jsx)(Z.Button,{onClick:()=>(l([]),r(n),M.current.clearTypeahead(),void S({})),colourScheme:"light",squared:!0,children:(0,un.jsx)(Q.FormattedMessage,{id:"button.epmty_fields"})})}),(0,un.jsx)(Z.Col,{children:(0,un.jsx)(Z.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!!(f.length>0||y),squared:!0,children:(0,un.jsx)(Q.FormattedMessage,{id:"button.search"})})})]})]})},oo=e=>{const t=(0,Q.useIntl)(),n={buildingLocation:"",buildingName:"",institutions:[],documentDate:{from:"",to:""},documentType:[],documentNr:"",documentState:[],connectedPerson:void 0},[s,o]=(0,z.useState)(n),[i,r]=(0,z.useState)(""),[a,l]=(0,z.useState)([]),[d,c]=(0,z.useState)([]),[u,p]=(0,z.useState)([]),[h]=(0,z.useState)(Qs([{code:Ln.DO_DOKUSEIS_ESITATUD,value:"Esitatud"},{code:Ln.DO_DOKUSEIS_KOOSTAMISEL,value:"Koostamisel"},{code:Ln.DO_DOKUSEIS_MENETLUSES,value:"Menetluses"},{code:Ln.DO_DOKUSEIS_MUUTMISEL,value:"Muutmisel"},{code:Ln.DO_DOKUSEIS_TAIENDAMISEL,value:"Täiendamisel"},{code:Ln.DO_DOKUSEIS_KEHTETU,value:"Kehtetu"},{code:Ln.DO_DOKUSEIS_REG_KANTUD,value:"Registrisse kantud"},{code:Ln.DO_DOKUSEIS_TYHISTATUD,value:"Tühistatud"},{code:Ln.DO_DOKUSEIS_LOOBUTUD,value:"Tagasi võetud"},{code:Ln.DO_DOKUSEIS_ALLKIRJASTAMISEL,value:"Allkirjastamisel"},{code:Ln.DO_DOKUSEIS_VANA_VERSIOON,value:"Vana versioon"}].sort(((e,t)=>e.value.localeCompare(t.value))))),[m,g]=(0,z.useState)({}),[S,f]=(0,z.useState)(""),[I,T]=(0,z.useState)(!1),[v,E]=(0,z.useState)({code:"",value:""}),[_,y]=(0,z.useState)({}),[b,D]=(0,z.useState)(!1),x=(0,z.useRef)(),M=(0,vn.useSelector)((e=>e.myViewsPage.filter.documentTypes)),O=(0,vn.useSelector)((e=>e.myViewsPage.filter.institutions)),N=(0,vn.useSelector)((e=>e.myViewsPage.detailSearch.documents));function A(e,t){let n;e.selectedData.length>0?(n=void 0!==e.selectedData[0].data?e.selectedData[0].data:e.selectedData,n=n.map((e=>e.id.length<5?e.children.map((e=>e.id)):e.id)).flat()):n=[],s[t]=n,o((e=>({...e})))}function U(e,t){s[t]=e.trim(),o((e=>({...e})))}function w(e){return!(!_n()(e,"YYYY-MM-DD",!0).isValid()&&!_n()(e,"D.M.YYYY",!0).isValid())}(0,z.useEffect)((()=>{if(M){const e=us(M);c(e)}if(O){const e=hs([...O]);p(e)}}),[M,O]);const j={sm:20,md:8,lg:8};return(0,un.jsxs)(Z.Form,{onSubmit:()=>{i.length>0?D(!0):JSON.stringify(n)===JSON.stringify(s)?y({header:"detailsearch.empty_filter_error.header",message:"detailsearch.empty_filter_error.message"}):(e.onSubmit(s),y({header:"",message:""}))},children:[_.header&&_.header.length>0&&_.message&&_.message.length>0&&(0,un.jsx)(Z.MessageBlock,{dismissible:!0,header:(0,un.jsx)(Q.FormattedMessage,{id:_.header}),onDismiss:()=>y({header:"",message:""}),theme:"danger",messages:[(0,un.jsx)(Q.FormattedMessage,{id:_.message})]}),N&&N.length>500&&(0,un.jsx)(Z.MessageBlock,{dismissible:!0,header:(0,un.jsx)(Q.FormattedMessage,{id:"detailsearch.empty_filter_error.header"}),theme:"warning",messages:[(0,un.jsx)(Q.FormattedMessage,{id:"detailsearch.filter_error_message.more_than_500_results"})]}),(0,un.jsxs)(Z.Row,{className:"align-items-start",children:[(0,un.jsxs)(Z.Col,{xs:20,md:20,lg:10,className:"px-0",children:[(0,un.jsx)(Z.FieldWrapper,{labelCol:j,component:(0,un.jsx)(Z.Input,{name:"input",onChange:e=>U(e,"buildingLocation"),placeholder:t.formatMessage({id:"detailsearch.filter.placeholder.address_catastralUnit_ehrCode"}),value:s.buildingLocation}),label:(0,un.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.building_location"}),info:{content:"detailsearch.filter.tooltip.address_catastralUnit_ehrCode.extended",placement:"top-start"}}),(0,un.jsx)(Z.FieldWrapper,{labelCol:j,component:(0,un.jsx)(Z.Input,{name:"input",onChange:e=>U(e,"buildingName"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:s.buildingName}),label:(0,un.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.building_name"}),info:{content:"detailsearch.filter.tooltip.building_name",placement:"top-start"}}),(0,un.jsx)(Z.FieldWrapper,{labelCol:j,component:(0,un.jsx)(Z.Multiselect,{name:"multiselect",options:u,onSelect:e=>A(e,"institutions"),allSelection:!0,onRemoveItem:e=>A(e,"institutions"),value:s.institutions,selectedOptions:a}),label:(0,un.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.institution"})}),(0,un.jsx)(Z.FieldWrapper,{labelCol:j,component:(0,un.jsx)("div",{className:"daterange_in_form",children:(0,un.jsx)(Z.DateRange,{onBlur:()=>{D(!0)},value:s.documentDate,onChange:e=>(e=>{""!==e.from&&!w(e.from)||""!==e.to&&!w(e.to)?r(t.formatMessage({id:"filter.invalid_date_format"})):""!==e.from&&""!==e.to&&_n()(e.from)>_n()(e.to)?r(t.formatMessage({id:"filter.invalid_date_range"})):""!==e.from&&(_n()(e.from)<_n()("01.01.1990")||_n()(e.from)>_n()())||""!==e.to&&(_n()(e.to)<_n()("01.01.1990")||_n()(e.to)>_n()())?r(t.formatMessage({id:"detailsearch.document.date_range_error.message"},{dateToday:_n()().format("DD.MM.YYYY")})):_n()(e.to).diff(_n()(e.from),"days")>367?r(t.formatMessage({id:"detailsearch.filter_error_message.date_range_too_long"})):(r(""),D(!1)),o((t=>({...t,documentDate:e})))})(e)})}),errorMessage:b&&i.length>0?i:null,label:(0,un.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.document_date"}),info:{content:"detailsearch.filter.tooltip.document_date",placement:"top-start"}})]}),(0,un.jsxs)(Z.Col,{xs:20,md:20,lg:10,className:"px-0",children:[(0,un.jsx)(Z.FieldWrapper,{labelCol:j,component:(0,un.jsx)(Z.Multiselect,{name:"multiselect",options:d,onSelect:e=>A(e,"documentType"),allSelection:!0,onRemoveItem:e=>A(e,"documentType"),value:s.documentType,selectedOptions:a}),label:(0,un.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.document_type"}),info:{content:"detailsearch.filter.tooltip.document_type",placement:"top-start"}}),(0,un.jsx)(Z.FieldWrapper,{labelCol:j,component:(0,un.jsx)(Z.Input,{name:"input",onChange:e=>U(e,"documentNr"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:s.documentNr}),label:(0,un.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.document_nr"}),info:{content:"detailsearch.filter.tooltip.document_nr",placement:"top-start"}}),(0,un.jsx)(Z.FieldWrapper,{labelCol:j,component:(0,un.jsx)(Z.Multiselect,{name:"multiselect",options:h,onSelect:e=>A(e,"documentState"),allSelection:!0,onRemoveItem:e=>A(e,"documentState"),value:s.documentState,selectedOptions:a}),label:(0,un.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.document_state"})})]})]}),!e.isNonAuthenticatedUser&&(0,un.jsx)(Z.Row,{children:(0,un.jsx)(Z.Col,{xs:20,md:20,lg:10,className:"px-0",children:(0,un.jsx)(Z.FieldWrapper,{labelCol:j,component:(0,un.jsx)(Z.PersonSearchPageExtended,{person:m,disabled:!1,labelKey:"code",valueKey:"value",onInputChange:e=>{!function(e){f(e),v.code.length>0&&E({code:"",value:""})}(e)},updatedFromAR:()=>{},onPersonUpdate:e=>function(e){var t;g(e),e&&(S===e.idCode||S===(null===(t=e.id)||void 0===t?void 0:t.toString())||S===e.regCode)||e&&v.code===e.regCode?(s.connectedPerson=e.id,o((e=>({...e})))):e||(s.connectedPerson=void 0,o((e=>({...e}))))}(e),searchPerson:e.callSearchPerson,handlePersonSelection:e=>E(e),isShowError:e=>{T(e),e||y({header:"",message:""})},searchOnBlur:!0,ref:x,isOptionalField:!0}),label:(0,un.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.connected_person"}),info:{content:"detailsearch.filter.tooltip.connected_person.extended",placement:"top-start"}})})}),(0,un.jsxs)(Z.Row,{children:[(0,un.jsx)(Z.Col,{children:(0,un.jsx)(Z.Button,{onClick:()=>(l([]),o(n),x.current.clearTypeahead(),void g({})),colourScheme:"light",squared:!0,children:(0,un.jsx)(Q.FormattedMessage,{id:"button.epmty_fields"})})}),(0,un.jsx)(Z.Col,{children:(0,un.jsx)(Z.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!!(b&&i.length>0||I),squared:!0,children:(0,un.jsx)(Q.FormattedMessage,{id:"button.search"})})})]})]})},io=e=>{const t=(0,Q.useIntl)(),n={documentType:[],documentNr:"",proceedingDate:{from:"",to:""},proceedingNr:"",institutions:[]},[s,o]=(0,z.useState)(n),[i,r]=(0,z.useState)([]),[a,l]=(0,z.useState)([]),[d,c]=(0,z.useState)([]),[u,p]=(0,z.useState)(""),[h,m]=(0,z.useState)({}),[g,S]=(0,z.useState)(!1),f=(0,vn.useSelector)((e=>e.myViewsPage.filter.documentTypes)),I=(0,vn.useSelector)((e=>e.myViewsPage.filter.institutions)),T=(0,vn.useSelector)((e=>e.myViewsPage.detailSearch.proceedings));function v(e,t){let n;e.selectedData.length>0?(n=void 0!==e.selectedData[0].data?e.selectedData[0].data:e.selectedData,n=n.map((e=>e.id.length<5?e.children.map((e=>e.id)):e.id)).flat()):n=[],s[t]=n,o((e=>({...e})))}function E(e,t){s[t]=e,o((e=>({...e})))}function _(e){return!(!_n()(e,"YYYY-MM-DD",!0).isValid()&&!_n()(e,"D.M.YYYY",!0).isValid())}(0,z.useEffect)((()=>{if(f){const e=us(f);l(e)}if(I){const e=hs([...I]);c(e)}}),[f,I]);const y={sm:20,md:8,lg:8};return(0,un.jsxs)(Z.Form,{onSubmit:()=>{u.length>0?S(!0):JSON.stringify(n)===JSON.stringify(s)?m({header:"detailsearch.empty_filter_error.header",message:"detailsearch.empty_filter_error.message"}):(e.onSubmit(s),m({header:"",message:""}))},children:[h.header&&h.header.length>0&&h.message&&h.message.length>0&&(0,un.jsx)(Z.MessageBlock,{dismissible:!0,header:(0,un.jsx)(Q.FormattedMessage,{id:h.header}),onDismiss:()=>m({header:"",message:""}),theme:"danger",messages:[(0,un.jsx)(Q.FormattedMessage,{id:h.message})]}),T&&T.length>500&&(0,un.jsx)(Z.MessageBlock,{dismissible:!0,header:(0,un.jsx)(Q.FormattedMessage,{id:"detailsearch.empty_filter_error.header"}),theme:"warning",messages:[(0,un.jsx)(Q.FormattedMessage,{id:"detailsearch.filter_error_message.more_than_500_results"})]}),(0,un.jsxs)(Z.Row,{className:"align-items-start",children:[(0,un.jsxs)(Z.Col,{xs:20,md:20,lg:10,className:"px-0",children:[(0,un.jsx)(Z.FieldWrapper,{labelCol:y,component:(0,un.jsx)(Z.Multiselect,{name:"multiselect",options:a,onSelect:e=>v(e,"documentType"),allSelection:!0,onRemoveItem:e=>v(e,"documentType"),value:s.documentType,selectedOptions:i}),label:(0,un.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.document_type"}),info:{content:"detailsearch.filter.tooltip.document_type",placement:"top-start"}}),(0,un.jsx)(Z.FieldWrapper,{labelCol:y,component:(0,un.jsx)(Z.Input,{name:"input",onChange:e=>E(e,"documentNr"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:s.documentNr}),label:(0,un.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.document_nr"}),info:{content:"detailsearch.filter.tooltip.document_nr",placement:"top-start"}}),(0,un.jsx)(Z.FieldWrapper,{labelCol:y,component:(0,un.jsx)("div",{className:"daterange_in_form",children:(0,un.jsx)(Z.DateRange,{onChange:e=>(e=>{""!==e.from&&!_(e.from)||""!==e.to&&!_(e.to)?p(t.formatMessage({id:"filter.invalid_date_format"})):""!==e.from&&""!==e.to&&_n()(e.from)>_n()(e.to)?p(t.formatMessage({id:"filter.invalid_date_range"})):""!==e.from&&(_n()(e.from)<_n()("01.01.1990")||_n()(e.from)>_n()())||""!==e.to&&(_n()(e.to)<_n()("01.01.1990")||_n()(e.to)>_n()())?p(t.formatMessage({id:"detailsearch.proceeding.date_range_error.message"},{dateToday:_n()().format("DD.MM.YYYY")})):_n()(e.to).diff(_n()(e.from),"days")>367?p(t.formatMessage({id:"detailsearch.filter_error_message.date_range_too_long"})):(p(""),S(!1)),o((t=>({...t,proceedingDate:e})))})(e),value:s.proceedingDate,onBlur:()=>{S(!0)}})}),errorMessage:g&&u.length>0?u:null,label:(0,un.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.proceeding_date"}),info:{content:"detailsearch.filter.tooltip.proceeding_date",placement:"top-start"}})]}),(0,un.jsxs)(Z.Col,{xs:20,md:20,lg:10,className:"px-0",children:[(0,un.jsx)(Z.FieldWrapper,{labelCol:y,component:(0,un.jsx)(Z.Input,{name:"input",onChange:e=>E(e,"proceedingNr"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:s.proceedingNr}),label:(0,un.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.proceeding_nr"})}),(0,un.jsx)(Z.FieldWrapper,{labelCol:y,component:(0,un.jsx)(Z.Multiselect,{name:"multiselect",options:d,onSelect:e=>v(e,"institutions"),allSelection:!0,onRemoveItem:e=>v(e,"institutions"),value:s.institutions,selectedOptions:i}),label:(0,un.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.institution"})})]})]}),(0,un.jsxs)(Z.Row,{children:[(0,un.jsx)(Z.Col,{children:(0,un.jsx)(Z.Button,{onClick:()=>(r([]),void o(n)),colourScheme:"light",squared:!0,children:(0,un.jsx)(Q.FormattedMessage,{id:"button.epmty_fields"})})}),(0,un.jsx)(Z.Col,{children:(0,un.jsx)(Z.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!!(g&&u.length>0),squared:!0,children:(0,un.jsx)(Q.FormattedMessage,{id:"button.search"})})})]})]})},ro={EHITIS_SEISUND_KAVAN:["EHITIS_SEISUND_KAVAN","EHITIS_SEISUND_EHITAM_LUBA","EHITIS_SEISUND_MENETLUSES"],EHITIS_SEISUND_PYSTI:["EHITIS_SEISUND_PYSTI","EHITIS_SEISUND_EHITAMISEL"],EHITIS_SEISUND_OLEMA:["EHITIS_SEISUND_OLEMA","EHITIS_SEISUND_KASUTUSEL","EHITIS_SEISUND_KASUT_OSALINE","EHITIS_SEISUND_KASUT_LUBA_EIKEH","EHITIS_SEISUND_LAMMUT_LUBA","EHITIS_SEISUND_KASUT_MAAS","EHITIS_SEISUND_EBASEADUSLIK","EHITIS_SEISUND_MAARAMATA"],EHITIS_SEISUND_LAMEL:["EHITIS_SEISUND_LAMEL","EHITIS_SEISUND_LAMMUTAMISEL"],EHITIS_SEISUND_LAMUT:["EHITIS_SEISUND_LAMUT","EHITIS_SEISUND_LAMMUTATUD"],EHITIS_SEISUND_REATA:["EHITIS_SEISUND_REATA","EHITIS_SEISUND_EHITAM_LUBA_EIKEH"],EHITIS_SEISUND_KUSTU:["EHITIS_SEISUND_KUSTU","EHITIS_SEISUND_KUSTUTATUD","EHITIS_SEISUND_REG_OBJ_LOPP","EHITIS_SEISUND_ARHIIVIS"]};function ao(e){const t=function(e){return Bn(ro,e)}(e);return t?function(e){switch(e){case"EHITIS_SEISUND_KAVAN":return{name:"Kavandatav",type:"info"};case"EHITIS_SEISUND_PYSTI":return{name:"EHITIS_SEISUND_PYSTI",type:"info"};case"EHITIS_SEISUND_OLEMA":return{name:"On",type:"success"};case"EHITIS_SEISUND_LAMEL":return{name:"Lammutamisel",type:"info"};case"EHITIS_SEISUND_LAMUT":return{name:"Lammutatud",type:"default"};case"EHITIS_SEISUND_REATA":return{name:"Realiseerimata",type:"default"};case"EHITIS_SEISUND_KUSTU":return{name:"Kustutatud",type:"default"};default:return{name:e,type:"default"}}}(t):{name:e,type:"default"}}const lo=e=>{const t=(0,Q.useIntl)(),[n,s]=(0,z.useState)([]),o=(0,vn.useSelector)((e=>e.myViewsPage.detailSearch.buildings));(0,z.useEffect)((()=>{if(o&&o.length>0){const t=e.isAdminRole?o:o.filter((e=>"EHITIS_SEISUND_KUSTU"!==e.buildingState.code));s(t)}}),[o]);const i=[{id:"ehr_code",property:"ehrCode",size:130,isFrozen:!0,getValue:e=>e.ehrCode?e.ehrCode:"",getFormattedValue:t=>{const{generateLink:n}=e,s=t.ehrCode?n(he,String(t.ehrCode),null,!1,!1,null):null;return t.ehrCode&&null!==t.ehrCode?(0,un.jsx)(gn,{linkName:t.ehrCode,tooltipText:"detailsearch.tooltip.open_building",href:s||void 0}):""}},{id:"building_address",property:"buildingaddress",size:160,getValue:e=>{var t;return null!==(t=e.buildingaddress)&&void 0!==t?t:""},getFormattedValue:e=>e.buildingaddress&&null!==e.buildingaddress?e.buildingaddress.map((e=>(0,un.jsx)("div",{children:e}))):""},{id:"building_name",property:"buildingName",size:130,getValue:e=>{var t;return null!==(t=e.buildingName)&&void 0!==t?t:""}},{id:"building_state",property:"buildingState",size:130,getValue:e=>{var t;return null!==(t=e.buildingState)&&void 0!==t?t:""},getFormattedValue:e=>e.buildingState&&null!==e.buildingState?(0,un.jsx)(Z.Status,{type:ao(e.buildingState.code).type,children:e.buildingState.value}):""},{id:"purpose_of_use",property:"purposeOfUse",size:150,getValue:e=>{var t,n;return null!==(t=null===(n=e.purposeOfUse)||void 0===n?void 0:n.value)&&void 0!==t?t:""}},{id:"first_use_date",property:"firstUseDate",size:150,getValue:e=>{var t;return null!==(t=e.firstUseDate)&&void 0!==t?t:""}},{id:"under_area",property:"underArea",size:130,getValue:e=>e.underArea?e.underArea:""},{id:"floor_count",property:"floorCount",size:130,getValue:e=>e.floorCount?e.floorCount:""},{id:"ownership_type",property:"ownershipType",size:130,getValue:e=>{var t,n;return null!==(t=null===(n=e.ownershipType)||void 0===n?void 0:n.value)&&void 0!==t?t:""}},{id:"owner",property:"owner",size:130,getValue:e=>{var t;return null!==(t=e.owner)&&void 0!==t?t:""},getFormattedValue:e=>e.owner?e.owner.map((e=>function(e){var t;const n=e.eesnimi?e.eesnimi+" "+e.perenimi:void 0,s=e.isikukood?(0,un.jsxs)(un.Fragment,{children:[(0,un.jsx)("br",{}),"IK "+e.isikukood]}):void 0,o=null!==e.regKood,i=null!==(t=e.jiNimi)&&void 0!==t?t:"";return!0===o?(0,un.jsx)("div",{children:i}):n?(0,un.jsxs)("div",{children:[n,null!=s?s:""]}):""}(e))):""}];return(0,un.jsx)("div",{children:(0,un.jsx)(Z.TableComponent,{config:{thead:{headers:(e.isAdminPlusRole?i:i.slice(0,-1)).map((e=>({id:e.id,size:e.size,className:"table-header-field text-align-left",label:t.formatMessage({id:"detailsearch.buildings.table.header."+e.id}),tooltip:{text:t.formatMessage({id:"detailsearch.buildings.table.tooltip."+e.id})},propertyName:e.property,sortable:!0,isShown:!0,isFrozen:e.isFrozen,type:"input",valueFormatter:t=>e.getFormattedValue?e.getFormattedValue(t):e.getValue(t)}))),icons:mn,expandableRow:!1,isFilter:!1}},data:function(e){return e.map((e=>({buildingaddress:e.buildingaddress,buildingId:e.buildingId,buildingName:e.buildingName,buildingType:e.buildingType,ehrCode:e.ehrCode,firstUseDate:e.firstUseDate,owner:e.owner,ownershipType:e.ownershipType,purposeOfUse:e.purposeOfUse,buildingState:e.buildingState,floorCount:e.floorCount,underArea:e.underArea})))}(n),handleEvent:()=>!0})})},co="DD.MM.YYYY",uo="YYYY-MM-DD";class po{static dateToStr(e){return po.formatDate(co,e)}static dateToStrForDatepicker(e){return po.formatDate(uo,e)}static dateWithTimeToStr(e){return po.formatDate("DD.MM.YYYY HH:mm",e)}static formatDate(e,t){return t?_n()(t).format(e):""}static dateToMs(e,t){const n=_n()(t,e);return t&&n.isValid()?n.valueOf():void 0}}const ho=e=>{var t,n,s,o,i,r;const a=(0,Q.useIntl)(),[l,d]=(0,z.useState)([]),c=(0,vn.useSelector)((e=>e.myViewsPage.detailSearch.documents)),u=(0,vn.useSelector)((e=>e.myViewsPage.filter.institutions)),p=null!==(t=null===(n=e.userInfo)||void 0===n||null===(s=n.activeRole)||void 0===s?void 0:s.businessType)&&void 0!==t?t:"",h=null!==(o=null===(i=e.userInfo)||void 0===i||null===(r=i.activeRole)||void 0===r?void 0:r.businessId)&&void 0!==o?o:0;(0,z.useEffect)((()=>{c&&c.length>0&&d(c)}),[c]);const m=e.filterStateDocumentsSearch.buildingLocation,g=e.filterStateDocumentsSearch.buildingName;const S=m?m.toString().toLowerCase().replace(/[&|=;~!$>*%_()?.+:'"\\]/g,"").replace(/\t/g," ").replace(/\s{2,}/g," ").replace(/\s?-\s?/g,"-"):"";function f(e,t){const n=(s=function(e){return e.replace(/\btn\b/g,"").replace(/\btänav\b/g,"").replace(/\btee\b/g,"").replace(/\bmaantee\b/g,"").replace(/\bmnt\b/g,"").replace(/\bküla\b/g,"").replace(/\blinnaosa\b/g,"").replace(/\blinn\b/g,"").replace(/\bpuiestee\b/g,"").replace(/\bpst\b/g,"").replace(/\bvald\b/g,"").replace(/\balevik\b/g,"").replace(/\balev\b/g,"").replace(/\bpõik\b/g,"").replace(/\blõik\b/g,"")}(e),s.replaceAll("//","").replaceAll(",","").split(/\s+/g).reduce(((e,t)=>{if(Number.isNaN(Number(t[0]))&&Number.isNaN(Number(t[1])))e.push(t);else{const n=` ${t}`;e[e.length-1]+=n}return e}),[]));var s;const o=t.replace(/\s+/g," ").split(/\/\/\s+(?=[a-z]+\b)/gi);return n.every((e=>{const t=e.trim().split(/\s+/);return o.some((e=>t.every((t=>new RegExp(`(?<![\\/\\-])\\b${t}\\b`,"i").test(e)))))}))}const I=["tn","tänav","tee","maantee","mnt","küla","linnaosa","linn","puiestee","pst","vald","alevik","alev","põik","lõik"];function T(e,t){var n;const s=null===(n=t.buildingAddress)||void 0===n?void 0:n.map((t=>function(e,t){return I.some((n=>{const s=new RegExp(`\\b(\\w+)\\s+${n}\\b`,"i"),o=e.match(s);if(o){const e=o[1];return new RegExp(`\\b${e}\\s+${n}\\b`,"i").test(t)}return!1}))}(e,t.toLowerCase())));return!!s&&s.indexOf(!0)>-1}function v(e){const t=e.filter((e=>function(e,t){var n;const s=null===(n=t.buildingAddress)||void 0===n?void 0:n.map((t=>f(e,t.toLowerCase())));return!!s&&s.indexOf(!0)>-1}(S,e)));return I.some((e=>function(e){return!new RegExp(`\\b${e}\\b`,"gi").test(e)}(e)))?t.filter((e=>T(S,e))):t}function E(){return!Number.isNaN(Number(S))}function _(){if(S&&S.indexOf(", ")>-1){return S.split(", ").reverse().join(", ")}return S}function y(e){const t=e.buildingName,n=e.buildingAddress;return t&&n&&(n.some((e=>e.toLowerCase().split(" ").some((e=>t.some((t=>t.toLowerCase().includes(e)))))))||t.some((e=>e.toLowerCase().split(" ").some((e=>n.some((t=>t.toLowerCase().includes(e))))))))}function b(e){let t=0;if(e.buildingAddress&&e.buildingAddress.length>0&&e.buildingAddress[0].length<200){const n=S.replace(",","").split(" ");let s=e.buildingAddress[0].toLowerCase().split(", ");const o=new Set;s.forEach((e=>{const t=e.split(" ")[0];return o.add(t)})),s=Array.from(o),s.forEach((e=>(n.includes(e)&&(t+=1),t)))}else t=-1;return t}const D=new RegExp(`\\b${S}\\b(?![\\/\\-])`,"i"),x=new RegExp(`\\b${_()}\\b(?![\\/\\-])`,"i"),M=S.replace(",","").split(/(?:\/|\s)+/g);function O(e){const t=e.buildingAddress;return t?t.findIndex((e=>e.toLowerCase()===S||e.toLowerCase()===_()))>-1?"exact":t.findIndex((e=>D.test(e.toLowerCase())||x.test(e.toLowerCase())))>-1?"partial":t.findIndex((e=>{const t=e.toLowerCase().replace(",","").replace(/\/\//g," ");return M.every((e=>t.includes(e)))}))>-1?"vague":"other":""}const N=["exact","partial","vague","other"];function A(e){return e.map((e=>{return t=e,{...t,title:t.docId,addressWithBuilding:y(t),addressMatch:O(t),addressRank:b(t)};var t})).sort(((e,t)=>{const n=N.indexOf(e.addressMatch),s=N.indexOf(t.addressMatch);return n!==s?n-s:e.addressWithBuilding!==t.addressWithBuilding?""===g?e.addressWithBuilding?1:-1:e.addressWithBuilding?-1:1:t.addressRank-e.addressRank}))}const U=[{id:"doc_date",property:"docDate",size:130,getValue:e=>po.dateToStr(e.docDate),isFrozen:!0},{id:"reg_date",property:"regDate",size:130,getValue:e=>po.dateToStr(e.regDate)},{id:"doc_nr",property:"docNr",size:160,getValue:e=>{var t;return null!==(t=e.docNr)&&void 0!==t?t:""},getFormattedValue:t=>{const{generateLink:n}=e,s=t.docNr?n(ge,String(t.docNr),null,!1,!1,{docId:t.docId,ehrCode:t.ehrCode}):null;return t.docNr&&null!==t.docNr?(0,un.jsx)(gn,{linkName:t.docNr,tooltipText:"detailsearch.tooltip.open_document",href:s||void 0}):""}},{id:"document_type",property:"documentType",size:160,getValue:e=>{var t;return null!==(t=e.documentType)&&void 0!==t?t:""}},{id:"building_name",property:"buildingName",size:130,getValue:e=>{var t;return null!==(t=e.buildingName)&&void 0!==t?t:""},getFormattedValue:e=>e.buildingName&&null!==e.buildingName?e.buildingName.map((e=>(0,un.jsx)("div",{children:e}))):""},{id:"ehr_code",property:"ehrCode",size:130,getValue:e=>{var t;return null!==(t=e.ehrCode)&&void 0!==t?t:""},getFormattedValue:t=>{const{generateLink:n}=e;return t.ehrCode?t.ehrCode.map(((e,s)=>{const o=t.ehrCode?n(he,String(e),null,!1,!1,null):null;return(0,un.jsxs)(un.Fragment,{children:[(0,un.jsx)(gn,{linkName:e,tooltipText:"detailsearch.tooltip.open_building",href:o||void 0}),s!==t.ehrCode.length-1?(0,un.jsx)("span",{children:", "}):""]})})):""}},{id:"building_address",property:"buildingAddress",size:130,getValue:e=>{var t;return null!==(t=e.buildingAddress)&&void 0!==t?t:""},getFormattedValue:e=>e.buildingAddress&&null!==e.buildingAddress?e.buildingAddress.map((e=>(0,un.jsx)("div",{children:e}))):""},{id:"doc_state",property:"stateCode",size:180,getValue:e=>{var t;return null!==(t=e.stateCode)&&void 0!==t?t:""},getFormattedValue:e=>e.stateCode&&null!==e.stateCode?(0,un.jsx)(Z.Status,{type:Kn(e.stateCode).type,children:Kn(e.stateCode).name}):""},{id:"proceeding_nr",property:"proceedingNr",size:130,getValue:e=>{var t;return null!==(t=e.proceedingNr)&&void 0!==t?t:""},getFormattedValue:t=>{const{generateLink:n}=e,s=function(e){return"Meretuulepargi hoonestusloa taotlus"===e.documentType||"Hoonestusloa taotlus"===e.documentType?Se:me}(t),o=t.proceedingNr?n(s,String(t.proceedingNr),null,!1,!1,null):null;return t.proceedingNr?p===fe.MKM||t.institutionId&&h===t.institutionId?(0,un.jsx)(gn,{linkName:t.proceedingNr,tooltipText:"detailsearch.tooltip.open_proceeding",href:o||void 0}):t.proceedingNr:""}},{id:"presenter",property:"presenter",size:130,getValue:e=>{var t;return null!==(t=e.presenter)&&void 0!==t?t:""},getFormattedValue:e=>e.presenter?e.presenter.map(((t,n)=>(0,un.jsxs)("div",{children:[t,n!==e.presenter.length-1?(0,un.jsx)("span",{children:", "}):""]}))):""},{id:"institution",property:"institutionName",size:130,getValue:e=>{var t;return null!==(t=e.institutionName)&&void 0!==t?t:""}}];return(0,un.jsx)(Z.TableComponent,{config:{thead:{headers:U.map((e=>({id:e.id,size:e.size,className:"table-header-field text-align-left",label:a.formatMessage({id:"detailsearch.documents.table.header."+e.id}),tooltip:{text:a.formatMessage({id:"detailsearch.documents.table.tooltip."+e.id})},propertyName:e.property,sortable:!0,isShown:!0,isFrozen:e.isFrozen,type:"input",valueFormatter:t=>e.getFormattedValue?e.getFormattedValue(t):null==e?void 0:e.getValue(t)}))),icons:mn,expandableRow:!1,isFilter:!1}},data:function(e){let t;if(0===(null==m?void 0:m.indexOf('"'))&&(null==m?void 0:m.lastIndexOf('"'))===m.length-1){const n=v(e);t=E()||S.length<2?n:A(n)}else t=E()||S.length<2?e:A(e);const n=t.map((e=>{var t,n,s,o;return{docId:e.docId,docDate:null!==(t=po.dateToMs(co,e.docDate))&&void 0!==t?t:"",regDate:null!==(n=po.dateToMs(co,e.regDate))&&void 0!==n?n:"",deadlineDate:e.deadlineDate,docNr:e.docNr,documentType:e.documentType,doty:e.doty,buildingName:e.buildingName,ehrCode:e.ehrCode,buildingAddress:e.buildingAddress,state:e.state,stateCode:e.stateCode,proceedingNr:e.proceedingNr,presenter:e.presenter,institutionId:e.institutionId,institutionName:null!==(s=null===(o=u.find((t=>t.id===e.institutionId)))||void 0===o?void 0:o.regName)&&void 0!==s?s:""}}));return n}(l),handleEvent:()=>!0})};const mo=e=>{var t,n,s,o;const i=(0,Q.useIntl)(),[r,a]=(0,z.useState)([]),l=(0,vn.useSelector)((e=>e.myViewsPage.detailSearch.proceedings)),d=(0,vn.useSelector)((e=>e.myViewsPage.filter.documentTypes)),c=(0,vn.useSelector)((e=>e.myViewsPage.filter.institutions)),u=e.userInfo&&e.userInfo.activeRole&&null!==(t=e.userInfo.activeRole)&&void 0!==t&&t.businessType?null===(n=e.userInfo.activeRole)||void 0===n?void 0:n.businessType:"",p=e.userInfo&&e.userInfo.activeRole&&null!==(s=e.userInfo.activeRole)&&void 0!==s&&s.businessId?null===(o=e.userInfo.activeRole)||void 0===o?void 0:o.businessId:0;(0,z.useEffect)((()=>{l&&l.length>0&&a(l)}),[l]);const h=[{id:"date_start",property:"dateStart",size:130,getValue:e=>po.dateToStr(e.dateStart),isFrozen:!0},{id:"date_end",property:"dateEnd",size:130,getValue:e=>po.dateToStr(e.dateEnd)},{id:"proceeding_nr",property:"proceedingNr",size:130,getValue:e=>{var t;return null!==(t=e.proceedingNr)&&void 0!==t?t:""},getFormattedValue:t=>{const{generateLink:n}=e,s=function(e){return"Meretuulepargi hoonestusloa taotlus"===e.documentType||"Hoonestusloa taotlus"===e.documentType?Se:me}(t),o=t.proceedingNr?n(s,String(t.proceedingNr),null,!1,!1,null):null;return t.proceedingNr&&null!==t.proceedingNr?"MKM"===u||t.institutionId&&p===t.institutionId?(0,un.jsx)(gn,{linkName:t.proceedingNr,tooltipText:"detailsearch.tooltip.open_proceeding",href:o||void 0}):t.proceedingNr:""}},{id:"proceeding_state",property:"proceedingState",size:200,getValue:e=>{var t;return null!==(t=e.proceedingStateCode)&&void 0!==t?t:""},getFormattedValue:e=>e.proceedingStateCode&&null!==e.proceedingStateCode?(0,un.jsx)(Z.Status,{type:bs(e.proceedingStateCode).type,children:bs(e.proceedingStateCode).name}):""},{id:"document",property:"docNr",size:160,getValue:e=>{var t;return null!==(t=e.docNr)&&void 0!==t?t:""},getFormattedValue:t=>{const{generateLink:n}=e,s=t.docNr?n(ge,String(t.docNr),null,!1,!1,null):null;return t.docNr&&null!==t.docNr?(0,un.jsx)(gn,{linkName:t.docNr,tooltipText:"detailsearch.tooltip.open_document",href:s||void 0}):""}},{id:"document_type",property:"documentType",size:180,getValue:e=>{var t;return null!==(t=e.documentType)&&void 0!==t?t:""}},{id:"building_name",property:"buildingName",size:130,getValue:e=>{var t;return null!==(t=e.buildingName)&&void 0!==t?t:""},getFormattedValue:e=>e.buildingName&&null!==e.buildingName?e.buildingName.map((e=>(0,un.jsx)("div",{children:e}))):""},{id:"ehr_code",property:"ehrCode",size:130,getValue:e=>{var t;return null!==(t=e.ehrCode)&&void 0!==t?t:""},getFormattedValue:t=>{const{generateLink:n}=e;return t.ehrCode&&null!==t.ehrCode?t.ehrCode.map(((e,s)=>{const o=t.ehrCode?n(he,String(e),null,!1,!1,null):null;return(0,un.jsxs)(un.Fragment,{children:[(0,un.jsx)(gn,{linkName:e,tooltipText:"detailsearch.tooltip.open_building",href:o||void 0}),s!==t.ehrCode.length-1?(0,un.jsx)("span",{children:", "}):""]})})):""}},{id:"building_address",property:"buildingAddress",size:160,getValue:e=>{var t;return null!==(t=e.buildingAddress)&&void 0!==t?t:""},getFormattedValue:e=>e.buildingAddress&&null!==e.buildingAddress?e.buildingAddress.map((e=>(0,un.jsx)("div",{children:e}))):""},{id:"proceeding_name",property:"proceedingName",size:160,getValue:e=>{var t;return null!==(t=e.proceedingName)&&void 0!==t?t:""}},{id:"supervisor",property:"supervisorName",size:130,getValue:e=>{var t;return null!==(t=e.supervisorName)&&void 0!==t?t:""}},{id:"institution",property:"institutionName",size:130,getValue:e=>{var t;return null!==(t=e.institutionName)&&void 0!==t?t:""}},{id:"archived",property:"archived",size:130,getValue:e=>e.archived&&"2"===e.archived?"Jah":"Ei"}];return(0,un.jsx)(Z.TableComponent,{config:{thead:{headers:h.map((e=>({id:e.id,size:e.size,className:"table-header-field text-align-left",label:i.formatMessage({id:"detailsearch.proceedings.table.header."+e.id}),tooltip:{text:i.formatMessage({id:"detailsearch.proceedings.table.tooltip."+e.id})},propertyName:e.property,sortable:!0,isShown:!0,isFrozen:e.isFrozen,type:"input",valueFormatter:t=>e.getFormattedValue?e.getFormattedValue(t):e.getValue(t)}))),icons:mn,expandableRow:!1,isFilter:!1}},data:function(e){const t=e.map((e=>{var t,n,s,o,i,r;return{proceedingId:e.proceedingId,dateStart:null!==(t=po.dateToMs(co,e.dateStart))&&void 0!==t?t:"",dateEnd:null!==(n=po.dateToMs(co,e.dateEnd))&&void 0!==n?n:"",proceedingNr:e.proceedingNr,proceedingState:e.proceedingState,proceedingStateCode:e.proceedingStateCode,docNr:e.docNr,documentType:null!==(s=null===(o=d.find((t=>t.id.toString()===e.documentType)))||void 0===o?void 0:o.name)&&void 0!==s?s:"",proceedingName:e.proceedingName,institutionId:e.institutionId,institutionName:null!==(i=null===(r=c.find((t=>t.id===e.institutionId)))||void 0===r?void 0:r.regName)&&void 0!==i?i:"",supervisorId:e.supervisorId,supervisorName:e.supervisorName,archived:e.archived,buildingName:e.buildingName,ehrCode:e.ehrCode,buildingAddress:e.buildingAddress}}));return t}(r),handleEvent:()=>!0})},go="https://devkluster.ehr.ee/api/building/v2".replace(/\/+$/,"");class So{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:go,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:De();this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class fo extends Error{constructor(e,t){super(t),this.name="RequiredError",this.field=e}}const Io="https://example.com",To=function(e,t,n){if(null==n)throw new fo(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},vo=function(e){const t=new URLSearchParams(e.search);for(var n=arguments.length,s=new Array(n>1?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];for(const e of s)for(const n in e)if(Array.isArray(e[n])){t.delete(n);for(const s of e[n])t.append(n,s)}else t.set(n,e[n]);e.search=t.toString()},Eo=function(e,t,n){const s="string"!=typeof e;return(s&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):s)?JSON.stringify(void 0!==e?e:{}):e||""},_o=function(e){return e.pathname+e.search+e.hash},yo=function(e,t,n,s){return function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;const r={...e.options,url:((null==s?void 0:s.basePath)||i)+e.url};return o.request(r)}},bo=function(e){const t=function(e){return{buildingChangesGet:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};To("buildingChangesGet","ehrCode",t),To("buildingChangesGet","dokNr",n);const o=new URL("/buildingChanges",Io);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...s},a={};void 0!==t&&(a.ehr_code=t),void 0!==n&&(a.dok_nr=n),vo(o,a,s.query);let l=i&&i.headers?i.headers:{};return r.headers={...l,...s.headers},{url:_o(o),options:r}},buildingCompareGet:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};To("buildingCompareGet","doEhitisId1",t),To("buildingCompareGet","doEhitisId2",n);const o=new URL("/buildingCompare",Io);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...s},a={};void 0!==t&&(a.do_ehitis_id1=t),void 0!==n&&(a.do_ehitis_id2=n),vo(o,a,s.query);let l=i&&i.headers?i.headers:{};return r.headers={...l,...s.headers},{url:_o(o),options:r}},buildingDataGet:async function(t,n,s,o){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const r=new URL("/buildingData",Io);let a;e&&(a=e.baseOptions);const l={method:"GET",...a,...i},d={};void 0!==t&&(d.ehr_code=t),void 0!==n&&(d.ehr_id=n),void 0!==s&&(d.version=s),void 0!==o&&(d.json=o),vo(r,d,i.query);let c=a&&a.headers?a.headers:{};return l.headers={...c,...i.headers},{url:_o(r),options:l}},buildingDeepCopyPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};To("buildingDeepCopyPost","deepCopyPostRequest",t);const s=new URL("/buildingDeepCopy",Io);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};vo(s,{},n.query);let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Eo(t,i,e),{url:_o(s),options:i}},buildingOwnerSearchPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};To("buildingOwnerSearchPost","bSearchOPostRequest",t);const s=new URL("/buildingOwnerSearch",Io);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};vo(s,{},n.query);let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Eo(t,i,e),{url:_o(s),options:i}},buildingSearchPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};To("buildingSearchPost","bSearchPostRequest",t);const s=new URL("/buildingSearch",Io);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};vo(s,{},n.query);let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Eo(t,i,e),{url:_o(s),options:i}},buildingSecureDataArrayPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};To("buildingSecureDataArrayPost","requestBody",t);const s=new URL("/buildingSecureDataArray",Io);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};vo(s,{},n.query);let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Eo(t,i,e),{url:_o(s),options:i}},buildingSecureDataGet:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const o=new URL("/buildingSecureData",Io);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...s},a={};void 0!==t&&(a.ehr_code=t),void 0!==n&&(a.ehr_id=n),vo(o,a,s.query);let l=i&&i.headers?i.headers:{};return r.headers={...l,...s.headers},{url:_o(o),options:r}},buildingVersionsGet:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};To("buildingVersionsGet","ehrCode",t);const s=new URL("/buildingVersions",Io);let o;e&&(o=e.baseOptions);const i={method:"GET",...o,...n},r={};void 0!==t&&(r.ehr_code=t),vo(s,r,n.query);let a=o&&o.headers?o.headers:{};return i.headers={...a,...n.headers},{url:_o(s),options:i}},buildingsDataPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};To("buildingsDataPost","ehrCodesPostRequest",t);const s=new URL("/buildingsData",Io);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};vo(s,{},n.query);let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Eo(t,i,e),{url:_o(s),options:i}},findEhrcodesDateafterGet:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};To("findEhrcodesDateafterGet","timestamp",t);const o=new URL("/find/ehrcodes/dateafter",Io);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...s},a={};void 0!==t&&(a.timestamp=t instanceof Date?t.toISOString():t),void 0!==n&&(a.offset=n),vo(o,a,s.query);let l=i&&i.headers?i.headers:{};return r.headers={...l,...s.headers},{url:_o(o),options:r}},findEhrcodesDocIdGet:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};To("findEhrcodesDocIdGet","id",t);const s=new URL("/find/ehrcodes/docId",Io);let o;e&&(o=e.baseOptions);const i={method:"GET",...o,...n},r={};void 0!==t&&(r.id=t),vo(s,r,n.query);let a=o&&o.headers?o.headers:{};return i.headers={...a,...n.headers},{url:_o(s),options:i}}}}(e);return{async buildingChangesGet(n,s,o){const i=await t.buildingChangesGet(n,s,o);return yo(i,De(),go,e)},async buildingCompareGet(n,s,o){const i=await t.buildingCompareGet(n,s,o);return yo(i,De(),go,e)},async buildingDataGet(n,s,o,i,r){const a=await t.buildingDataGet(n,s,o,i,r);return yo(a,De(),go,e)},async buildingDeepCopyPost(n,s){const o=await t.buildingDeepCopyPost(n,s);return yo(o,De(),go,e)},async buildingOwnerSearchPost(n,s){const o=await t.buildingOwnerSearchPost(n,s);return yo(o,De(),go,e)},async buildingSearchPost(n,s){const o=await t.buildingSearchPost(n,s);return yo(o,De(),go,e)},async buildingSecureDataArrayPost(n,s){const o=await t.buildingSecureDataArrayPost(n,s);return yo(o,De(),go,e)},async buildingSecureDataGet(n,s,o){const i=await t.buildingSecureDataGet(n,s,o);return yo(i,De(),go,e)},async buildingVersionsGet(n,s){const o=await t.buildingVersionsGet(n,s);return yo(o,De(),go,e)},async buildingsDataPost(n,s){const o=await t.buildingsDataPost(n,s);return yo(o,De(),go,e)},async findEhrcodesDateafterGet(n,s,o){const i=await t.findEhrcodesDateafterGet(n,s,o);return yo(i,De(),go,e)},async findEhrcodesDocIdGet(n,s){const o=await t.findEhrcodesDocIdGet(n,s);return yo(o,De(),go,e)}}};class Do extends So{buildingChangesGet(e,t,n){return bo(this.configuration).buildingChangesGet(e,t,n).then((e=>e(this.axios,this.basePath)))}buildingCompareGet(e,t,n){return bo(this.configuration).buildingCompareGet(e,t,n).then((e=>e(this.axios,this.basePath)))}buildingDataGet(e,t,n,s,o){return bo(this.configuration).buildingDataGet(e,t,n,s,o).then((e=>e(this.axios,this.basePath)))}buildingDeepCopyPost(e,t){return bo(this.configuration).buildingDeepCopyPost(e,t).then((e=>e(this.axios,this.basePath)))}buildingOwnerSearchPost(e,t){return bo(this.configuration).buildingOwnerSearchPost(e,t).then((e=>e(this.axios,this.basePath)))}buildingSearchPost(e,t){return bo(this.configuration).buildingSearchPost(e,t).then((e=>e(this.axios,this.basePath)))}buildingSecureDataArrayPost(e,t){return bo(this.configuration).buildingSecureDataArrayPost(e,t).then((e=>e(this.axios,this.basePath)))}buildingSecureDataGet(e,t,n){return bo(this.configuration).buildingSecureDataGet(e,t,n).then((e=>e(this.axios,this.basePath)))}buildingVersionsGet(e,t){return bo(this.configuration).buildingVersionsGet(e,t).then((e=>e(this.axios,this.basePath)))}buildingsDataPost(e,t){return bo(this.configuration).buildingsDataPost(e,t).then((e=>e(this.axios,this.basePath)))}findEhrcodesDateafterGet(e,t,n){return bo(this.configuration).findEhrcodesDateafterGet(e,t,n).then((e=>e(this.axios,this.basePath)))}findEhrcodesDocIdGet(e,t){return bo(this.configuration).findEhrcodesDocIdGet(e,t).then((e=>e(this.axios,this.basePath)))}}const xo=e=>{var t,n,s,o;let{buildingsActualDataApiEndpoint:i,classifierApiEndpoint:r,linkGen:a,generateLink:l,myViewsApiEndpoint:d,searchType:c,userApiEndpoint:u,userInfo:p}=e;const h=(0,vn.useDispatch)(),m=["MKM","KOV","TJA"].includes(p&&p.activeRole&&null!==(t=p.activeRole)&&void 0!==t&&t.businessType?null===(n=p.activeRole)||void 0===n?void 0:n.businessType:""),S=["MKM","KOV","TJA","N","KT"].includes(p&&p.activeRole&&null!==(s=p.activeRole)&&void 0!==s&&s.businessType?null===(o=p.activeRole)||void 0===o?void 0:o.businessType:""),T=!p,[v,E]=(0,z.useState)({}),[_,y]=(0,z.useState)({}),[b,D]=(0,z.useState)({}),[x,M]=(0,z.useState)([]),[O,N]=(0,z.useState)([]),[A,U]=(0,z.useState)([]),[w,j]=(0,z.useState)(!1),[C,L]=(0,z.useState)(!1),[P,R]=(0,z.useState)(!1),Y=new Le(new Et({basePath:r})),B=new qe(new tt({basePath:u})),V=new St(new Et({basePath:d})),G=new Qe(new tt({basePath:u})),H=new Do(new Et({basePath:i})),J=async(e,t,n)=>{try{const s=await G.searchPerson(e,t,n);return s.data}catch(e){console.log("= = = callSearchPerson error occured:",e)}};return(0,z.useEffect)((()=>{Y.getAllDocumentTypes().then((e=>{h(g(e.data))})).catch((e=>{console.log(e)})),B.getJurKovPersons().then((e=>{h(f(e.data))})).catch((e=>{console.log(e)})),Y.getUsageClassifierTypes().then((e=>{h(I(e.data))})).catch((e=>{console.log(e)}))}),[]),(0,z.useEffect)((()=>{if(Object.keys(b).length>0){R(!0);V.searchDetailProceedings(b).then((e=>{h(F(e.data)),U(e.data),R(!1)})).catch((e=>{console.log(e),R(!1)}))}}),[b]),(0,z.useEffect)((()=>{if(Object.keys(_).length>0){L(!0);V.searchDetailDocuments(_).then((e=>{h(k(e.data)),N(e.data),L(!1)})).catch((e=>{console.log(e),L(!1)}))}}),[_]),(0,z.useEffect)((()=>{if(Object.keys(v).length>0){let e;j(!0),e=S?H.buildingOwnerSearchPost(v):H.buildingSearchPost(v),e.then((e=>{h(K(e.data)),M(e.data),j(!1)})).catch((e=>{console.log(e),j(!1)}))}}),[v,S]),(0,un.jsxs)("div",{children:[(0,un.jsx)(Z.Section,{collapsed:c!==ue,title:"detailsearch.buildings_detail_search",children:(0,un.jsxs)("div",{children:[(0,un.jsx)("div",{className:"filter-block",style:{paddingBottom:20},children:(0,un.jsx)(so,{onSubmit:e=>{E(e)},isAdminRole:m,isAdminPlusRole:S,callSearchPerson:J})}),Object.keys(v).length>0&&0===x.length&&!w?(0,un.jsx)("div",{style:{height:210},className:"d-flex justify-content-center align-items-center",children:(0,un.jsx)(Z.Text,{raw:"detailsearch.empty_search_result"})}):w?(0,un.jsx)(Z.SectionLoader,{}):(0,un.jsx)(lo,{linkGen:a,generateLink:l,isAdminRole:m,isAdminPlusRole:S})]})}),(0,un.jsx)(Z.Section,{collapsed:"DOCUMENTS_SEARCH"!==c,title:"detailsearch.documents_detail_search",children:(0,un.jsxs)("div",{children:[(0,un.jsx)("div",{className:"filter-block",style:{paddingBottom:20},children:(0,un.jsx)(oo,{onSubmit:e=>{y(e)},callSearchPerson:J,isNonAuthenticatedUser:T})}),Object.keys(_).length>0&&0===O.length&&!C?(0,un.jsx)("div",{style:{height:210},className:"d-flex justify-content-center align-items-center",children:(0,un.jsx)(Z.Text,{raw:"detailsearch.empty_search_result"})}):C?(0,un.jsx)(Z.SectionLoader,{}):(0,un.jsx)(ho,{linkGen:a,generateLink:l,userInfo:p,filterStateDocumentsSearch:_})]})}),m&&(0,un.jsx)(Z.Section,{collapsed:"PROCEEDINGS_SEARCH"!==c,title:"detailsearch.proceedings_detail_search",children:(0,un.jsxs)("div",{children:[(0,un.jsx)("div",{className:"filter-block",style:{paddingBottom:20},children:(0,un.jsx)(io,{onSubmit:e=>{D(e)}})}),Object.keys(b).length>0&&0===A.length&&!P?(0,un.jsx)("div",{style:{height:210},className:"d-flex justify-content-center align-items-center",children:(0,un.jsx)(Z.Text,{raw:"detailsearch.empty_search_result"})}):P?(0,un.jsx)(Z.SectionLoader,{}):(0,un.jsx)(mo,{linkGen:a,userInfo:p,generateLink:l})]})})]})};return u})()));
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@reduxjs/toolkit"),require("react"),require("react-intl"),require("ehr-components"),require("axios"),require("react-redux"),require("moment"),require("reactstrap")):"function"==typeof define&&define.amd?define(["@reduxjs/toolkit","react","react-intl","ehr-components","axios","react-redux","moment","reactstrap"],t):"object"==typeof exports?exports.ehrDocumentUI=t(require("@reduxjs/toolkit"),require("react"),require("react-intl"),require("ehr-components"),require("axios"),require("react-redux"),require("moment"),require("reactstrap")):e.ehrDocumentUI=t(e["@reduxjs/toolkit"],e.react,e["react-intl"],e["ehr-components"],e.axios,e["react-redux"],e.moment,e.reactstrap)}(this,((e,t,n,s,o,i,r,a)=>(()=>{"use strict";var l={20:(e,t,n)=>{var s=n(932),o=Symbol.for("react.element"),i=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,a=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function d(e,t,n){var s,i={},d=null,c=null;for(s in void 0!==n&&(d=""+n),void 0!==t.key&&(d=""+t.key),void 0!==t.ref&&(c=t.ref),t)r.call(t,s)&&!l.hasOwnProperty(s)&&(i[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps)void 0===i[s]&&(i[s]=t[s]);return{$$typeof:o,type:e,key:d,ref:c,props:i,_owner:a.current}}t.Fragment=i,t.jsx=d,t.jsxs=d},114:e=>{e.exports=s},130:e=>{e.exports=i},306:t=>{t.exports=e},480:e=>{e.exports=n},558:e=>{e.exports=r},572:e=>{e.exports=a},674:e=>{e.exports=o},848:(e,t,n)=>{e.exports=n(20)},932:e=>{e.exports=t}},d={};function c(e){var t=d[e];if(void 0!==t)return t.exports;var n=d[e]={exports:{}};return l[e](n,n.exports,c),n.exports}c.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return c.d(t,{a:t}),t},c.d=(e,t)=>{for(var n in t)c.o(t,n)&&!c.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},c.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var u={};c.r(u),c.d(u,{DetailSearch:()=>jo,MyAdministrativeProceedings:()=>bn,MyApprovals:()=>Zs,MyDocuments:()=>xs,MyInvolvements:()=>no,MyOpinions:()=>eo,MyProceedings:()=>Qs,documentsReducer:()=>x,filterReducer:()=>T,myOperationsReducer:()=>P,proceedingsReducer:()=>U,rootReducer:()=>$});var p=c(306);const h=(0,p.createSlice)({name:"filter",initialState:{classifiers:{},documentTypes:[],institutionUsers:[],institutions:[],usageClassifierTypes:[]},reducers:{classifiersLoaded:(e,t)=>{e.classifiers=t.payload},documentTypesLoaded:(e,t)=>{e.documentTypes=t.payload},institutionUsersLoaded:(e,t)=>{e.institutionUsers=t.payload},institutionsLoaded:(e,t)=>{e.institutions=t.payload},usageClassifierTypesLoaded:(e,t)=>{e.usageClassifierTypes=t.payload}}}),{classifiersLoaded:m,documentTypesLoaded:g,institutionUsersLoaded:S,institutionsLoaded:f,usageClassifierTypesLoaded:I}=h.actions,T=h.reducer;const v=(0,p.createSlice)({name:"documents",initialState:{workingDocuments:[],signingDocuments:[],finishedDocuments:[],allowedDocumentTypesToStart:[]},reducers:{workingDocumentsLoaded:(e,t)=>{e.workingDocuments=t.payload},signingDocumentsLoaded:(e,t)=>{e.signingDocuments=t.payload},finishedDocumentsLoaded:(e,t)=>{e.finishedDocuments=t.payload},deleteDocument(e,t){e.workingDocuments=e.workingDocuments.filter((e=>e.docNr!==t.payload))},allowedDocumentTypesLoaded:(e,t)=>{e.allowedDocumentTypesToStart=t.payload}}}),{workingDocumentsLoaded:E,signingDocumentsLoaded:_,finishedDocumentsLoaded:y,deleteDocument:b,allowedDocumentTypesLoaded:D}=v.actions,x=v.reducer;const M=(0,p.createSlice)({name:"proceedings",initialState:{myProceedings:[],proceedingsToComment:[],incomingDocuments:[]},reducers:{myProceedingsLoaded:(e,t)=>{e.myProceedings=t.payload},proceedingsToCommentLoaded:(e,t)=>{e.proceedingsToComment=t.payload},incomingDocumentsLoaded:(e,t)=>{e.incomingDocuments=t.payload}}}),{myProceedingsLoaded:N,proceedingsToCommentLoaded:O,incomingDocumentsLoaded:A}=M.actions,U=M.reducer;const w=(0,p.createSlice)({name:"myOperations",initialState:{myOperations:[],toCommentOperations:[],operationInvitations:[]},reducers:{myOperationsLoaded:(e,t)=>{e.myOperations=t.payload},toCommentOperationsLoaded:(e,t)=>{e.toCommentOperations=t.payload},operationInvitationsLoaded:(e,t)=>{e.operationInvitations=t.payload}}}),{myOperationsLoaded:j,toCommentOperationsLoaded:C,operationInvitationsLoaded:L}=w.actions,P=w.reducer;const R=(0,p.createSlice)({name:"detailSearch",initialState:{buildings:[],documents:[],proceedings:[]},reducers:{buildingsLoaded:(e,t)=>{e.buildings=t.payload},documentsLoaded:(e,t)=>{e.documents=t.payload},proceedingsLoaded:(e,t)=>{e.proceedings=t.payload}}}),{buildingsLoaded:K,documentsLoaded:F,proceedingsLoaded:k}=R.actions,Y=R.reducer,B={notices:[]},G=(0,p.createSlice)({name:"notification",initialState:B,reducers:{setNotifications:(e,t)=>{e.notices=t.payload},removeNotification:(e,t)=>{const n=e.notices.filter((e=>e.id!==t.payload));e.notices=n},cleanState:e=>B}}),V=(0,p.createSelector)((e=>e.myViewsPage.notifications.notices),(e=>e)),{cleanState:H,setNotifications:J,removeNotification:W}=G.actions,q=G.reducer,$=(0,p.combineReducers)({filter:T,myDocuments:x,myProceedings:U,myOperations:P,detailSearch:Y,notifications:q});var z=c(932),X=c.n(z),Q=c(480),Z=c(114);const ee="SIGNING_DOCUMENTS",te="WORKING_DOCUMENTS",ne="FINISHED_DOCUMENTS",se="INCOMING_DOCUMENTS",oe="MY_APPROVALS",ie="MY_OPINIONS",re="MY_INVOLVEMENTS",ae="MY_OPERATIONS",le="OPERATIONS_TO_COMMENT",de="OPERATION_INVITATIONS",ce="PROCEEDINGS_TO_COMMENT",ue="BUILDINGS_SEARCH";let pe=function(e){return e.DEFAULT="default",e.INFO="info",e.SUCCESS="success",e.WARNING="warning",e.DANGER="danger",e}({});const he="BUILDING",me="PROCEEDING",ge="DOCUMENT";let Se=function(e){return e.KOV="KOV",e.MKM="MKM",e.A="A",e.N="N",e.KT="KT",e.JUR="JUR",e.AMAS="AMAS",e.TJA="TJA",e}({});let fe=function(e){return e.MENTOIMLIIK_AUTO_REG="MENTOIMLIIK_AUTO_REG",e.MENTOIMLIIK_KAASAMINE="MENTOIMLIIK_KAASAMINE",e.MENTOIMLIIK_MASSKAASAMINE="MENTOIMLIIK_MASSKAASAMINE",e.MENTOIMLIIK_YKSIKKAASAMINE="MENTOIMLIIK_YKSIKKAASAMINE",e.MENTOIMLIIK_ARVAMUS="MENTOIMLIIK_ARVAMUS",e.MENTOIMLIIK_VALINE_KOOSK="MENTOIMLIIK_VALINE_KOOSK",e.MENTOIMLIIK_SISENE_KOOSK="MENTOIMLIIK_SISENE_KOOSK",e.MENTOIMLIIK_KOOSK="MENTOIMLIIK_KOOSK",e.MENTOIMLIIK_MARKUS_TAIEND="MENTOIMLIIK_MARKUS_TAIEND",e.MENTOIMLIIK_MEN_MARKUS="MENTOIMLIIK_MEN_MARKUS",e.MENTOIMLIIK_EHIT_KK_RING="MENTOIMLIIK_EHIT_KK_RING",e.MENTOIMLIIK_ADS="MENTOIMLIIK_ADS",e.MENTOIMLIIK_ADS_SAADA="MENTOIMLIIK_ADS_SAADA",e.MENTOIMLIIK_ADS_ESIT="MENTOIMLIIK_ADS_ESIT",e.MENTOIMLIIK_AVALIK="MENTOIMLIIK_AVALIK",e.MENTOIMLIIK_AVALIK_TAGASISIDE="MENTOIMLIIK_AVALIK_TAGASISIDE",e.MENTOIMLIIK_RAHV_KAASAMINE="MENTOIMLIIK_RAHV_KAASAMINE",e.MENTOIMLIIK_KAAS_TAGASISIDE="MENTOIMLIIK_KAAS_TAGASISIDE",e.MENTOIMLIIK_ALLKIRJASTAMINE="MENTOIMLIIK_ALLKIRJASTAMINE",e.MENTOIMLIIK_KMH_PR="MENTOIMLIIK_KMH_PR",e.MENTOIMLIIK_KMH_AR="MENTOIMLIIK_KMH_AR",e}({});const Ie="12975",Te="12976",ve="11274",Ee="11275",_e="12977",ye="12978",be=["11272","12972",Ie,"12974",ye,Ee],De=["11273","12973",Te,"12971",_e,ve],xe=[Ie,Te],Me={[Te]:_e,[Ie]:ye},Ne={[Te]:ve,[Ie]:Ee};var Oe=c(674),Ae=c.n(Oe);const Ue="https://devkluster.ehr.ee".replace(/\/+$/,"");class we{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ue,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ae();this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class je extends Error{constructor(e,t){super(t),this.name="RequiredError",this.field=e}}const Ce="https://example.com",Le=function(e,t,n){if(null==n)throw new je(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},Pe=function(e){const t=new URLSearchParams(e.search);for(var n=arguments.length,s=new Array(n>1?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];for(const e of s)for(const n in e)if(Array.isArray(e[n])){t.delete(n);for(const s of e[n])t.append(n,s)}else t.set(n,e[n]);e.search=t.toString()},Re=function(e){return e.pathname+e.search+e.hash},Ke=function(e,t,n,s){return function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;const r={...e.options,url:((null==s?void 0:s.basePath)||i)+e.url};return o.request(r)}},Fe=function(e){const t=function(e){return{getAllDocumentTypes:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/alldocumenttypes",Ce);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Pe(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Re(n),options:o}},getBusinessTypesList:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/businesstypelist",Ce);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Pe(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Re(n),options:o}},getClassifierByType:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Le("getClassifierByType","classifierType",t);const s="/classifier/{classifierType}".replace("{classifierType}",encodeURIComponent(String(t))),o=new URL(s,Ce);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Pe(o,{},n.query);let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Re(o),options:r}},getClassifiersByRelatedType:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Le("getClassifiersByRelatedType","relatedClassifierType",t);const s="/classifier/related-type/{relatedClassifierType}".replace("{relatedClassifierType}",encodeURIComponent(String(t))),o=new URL(s,Ce);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Pe(o,{},n.query);let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Re(o),options:r}},getClassifiersByType:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Le("getClassifiersByType","classifierTypesCommaSeparated",t);const s="/classifiers/{classifierTypesCommaSeparated}".replace("{classifierTypesCommaSeparated}",encodeURIComponent(String(t))),o=new URL(s,Ce);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};Pe(o,{},n.query);let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:Re(o),options:r}},getDocumentTypes:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/documenttypes",Ce);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Pe(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Re(n),options:o}},getFileTypes:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/filetypes",Ce);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Pe(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Re(n),options:o}},getHealth:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/health",Ce);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Pe(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Re(n),options:o}},getUsageClassifierTypes:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/classifier/usage",Ce);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Pe(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Re(n),options:o}},getUserRolesList:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/userroleslist",Ce);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Pe(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Re(n),options:o}}}}(e);return{async getAllDocumentTypes(n){const s=await t.getAllDocumentTypes(n);return Ke(s,Ae(),Ue,e)},async getBusinessTypesList(n){const s=await t.getBusinessTypesList(n);return Ke(s,Ae(),Ue,e)},async getClassifierByType(n,s){const o=await t.getClassifierByType(n,s);return Ke(o,Ae(),Ue,e)},async getClassifiersByRelatedType(n,s){const o=await t.getClassifiersByRelatedType(n,s);return Ke(o,Ae(),Ue,e)},async getClassifiersByType(n,s){const o=await t.getClassifiersByType(n,s);return Ke(o,Ae(),Ue,e)},async getDocumentTypes(n){const s=await t.getDocumentTypes(n);return Ke(s,Ae(),Ue,e)},async getFileTypes(n){const s=await t.getFileTypes(n);return Ke(s,Ae(),Ue,e)},async getHealth(n){const s=await t.getHealth(n);return Ke(s,Ae(),Ue,e)},async getUsageClassifierTypes(n){const s=await t.getUsageClassifierTypes(n);return Ke(s,Ae(),Ue,e)},async getUserRolesList(n){const s=await t.getUserRolesList(n);return Ke(s,Ae(),Ue,e)}}};class ke extends we{getAllDocumentTypes(e){return Fe(this.configuration).getAllDocumentTypes(e).then((e=>e(this.axios,this.basePath)))}getBusinessTypesList(e){return Fe(this.configuration).getBusinessTypesList(e).then((e=>e(this.axios,this.basePath)))}getClassifierByType(e,t){return Fe(this.configuration).getClassifierByType(e,t).then((e=>e(this.axios,this.basePath)))}getClassifiersByRelatedType(e,t){return Fe(this.configuration).getClassifiersByRelatedType(e,t).then((e=>e(this.axios,this.basePath)))}getClassifiersByType(e,t){return Fe(this.configuration).getClassifiersByType(e,t).then((e=>e(this.axios,this.basePath)))}getDocumentTypes(e){return Fe(this.configuration).getDocumentTypes(e).then((e=>e(this.axios,this.basePath)))}getFileTypes(e){return Fe(this.configuration).getFileTypes(e).then((e=>e(this.axios,this.basePath)))}getHealth(e){return Fe(this.configuration).getHealth(e).then((e=>e(this.axios,this.basePath)))}getUsageClassifierTypes(e){return Fe(this.configuration).getUsageClassifierTypes(e).then((e=>e(this.axios,this.basePath)))}getUserRolesList(e){return Fe(this.configuration).getUserRolesList(e).then((e=>e(this.axios,this.basePath)))}}class Ye{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}const Be="http://localhost:8080".replace(/\/+$/,"");class Ge{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Be,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ae();this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class Ve extends Error{constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const He="https://example.com",Je=function(e,t,n){if(null==n)throw new Ve(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function We(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>We(e,t,n))):Object.keys(t).forEach((s=>We(e,t[s],`${n}${""!==n?".":""}${s}`))):e.has(n)?e.append(n,t):e.set(n,t))}const qe=function(e){const t=new URLSearchParams(e.search);for(var n=arguments.length,s=new Array(n>1?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];We(t,s),e.search=t.toString()},$e=function(e,t,n){const s="string"!=typeof e;return(s&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):s)?JSON.stringify(void 0!==e?e:{}):e||""},ze=function(e){return e.pathname+e.search+e.hash},Xe=function(e,t,n,s){return function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;const r={...e.options,url:((null==s?void 0:s.basePath)||i)+e.url};return o.request(r)}};const Qe=function(e){const t=function(e){return{getJurKovPersons:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/person/jur/kov",He);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};qe(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:ze(n),options:o}},getJurPersonCoordRelJurs:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Je("getJurPersonCoordRelJurs","personId",t);const s="/person/jur/{personId}/coord".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,He);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};qe(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:ze(o),options:r}},getUserPossibleProceedingSupervisorsByEHAKCode:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Je("getUserPossibleProceedingSupervisorsByEHAKCode","eHAKCode",t);const s="/user/possiblesupervisors/{EHAKCode}".replace("{EHAKCode}",encodeURIComponent(String(t))),o=new URL(s,He);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};qe(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:ze(o),options:r}},getUserPossibleProceedingSupervisorsByIdAndEHAKCode:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Je("getUserPossibleProceedingSupervisorsByIdAndEHAKCode","id",t),Je("getUserPossibleProceedingSupervisorsByIdAndEHAKCode","eHAKCode",n);const o="/user/possiblesupervisors/{id}/{EHAKCode}".replace("{id}",encodeURIComponent(String(t))).replace("{EHAKCode}",encodeURIComponent(String(n))),i=new URL(o,He);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};qe(i,{});let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:ze(i),options:a}},getUserPossibleProceedingSupervisorsByJurId:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Je("getUserPossibleProceedingSupervisorsByJurId","personId",t);const s="/user/jur/possiblesupervisors/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,He);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};qe(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:ze(o),options:r}}}}(e);return{async getJurKovPersons(n){const s=await t.getJurKovPersons(n);return Xe(s,Ae(),Be,e)},async getJurPersonCoordRelJurs(n,s){const o=await t.getJurPersonCoordRelJurs(n,s);return Xe(o,Ae(),Be,e)},async getUserPossibleProceedingSupervisorsByEHAKCode(n,s){const o=await t.getUserPossibleProceedingSupervisorsByEHAKCode(n,s);return Xe(o,Ae(),Be,e)},async getUserPossibleProceedingSupervisorsByIdAndEHAKCode(n,s,o){const i=await t.getUserPossibleProceedingSupervisorsByIdAndEHAKCode(n,s,o);return Xe(i,Ae(),Be,e)},async getUserPossibleProceedingSupervisorsByJurId(n,s){const o=await t.getUserPossibleProceedingSupervisorsByJurId(n,s);return Xe(o,Ae(),Be,e)}}};class Ze extends Ge{getJurKovPersons(e){return Qe(this.configuration).getJurKovPersons(e).then((e=>e(this.axios,this.basePath)))}getJurPersonCoordRelJurs(e,t){return Qe(this.configuration).getJurPersonCoordRelJurs(e,t).then((e=>e(this.axios,this.basePath)))}getUserPossibleProceedingSupervisorsByEHAKCode(e,t){return Qe(this.configuration).getUserPossibleProceedingSupervisorsByEHAKCode(e,t).then((e=>e(this.axios,this.basePath)))}getUserPossibleProceedingSupervisorsByIdAndEHAKCode(e,t,n){return Qe(this.configuration).getUserPossibleProceedingSupervisorsByIdAndEHAKCode(e,t,n).then((e=>e(this.axios,this.basePath)))}getUserPossibleProceedingSupervisorsByJurId(e,t){return Qe(this.configuration).getUserPossibleProceedingSupervisorsByJurId(e,t).then((e=>e(this.axios,this.basePath)))}}const et=function(e){const t=function(e){return{addAllyksusToJurPerson:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/person/jur/addAllyksus",He);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};qe(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=$e(t,i,e),{url:ze(s),options:i}},addPerson:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/person",He);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};qe(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=$e(t,i,e),{url:ze(s),options:i}},deletePerson:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Je("deletePerson","personId",t);const s="/person/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,He);let i;e&&(i=e.baseOptions);const r={method:"DELETE",...i,...n};qe(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:ze(o),options:r}},findKovsAndJurPersonsInTheSameAdministrativeDivision:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Je("findKovsAndJurPersonsInTheSameAdministrativeDivision","regNameOrCode",t);const i="/person/kovs-and-institutions/{regNameOrCode}".replace("{regNameOrCode}",encodeURIComponent(String(t))),r=new URL(i,He);let a;e&&(a=e.baseOptions);const l={method:"PUT",...a,...o},d={},c={};void 0!==n&&(c.searchFromAll=n),d["Content-Type"]="application/json",qe(r,c);let u=a&&a.headers?a.headers:{};return l.headers={...d,...u,...o.headers},l.data=$e(s,l,e),{url:ze(r),options:l}},findPublicSectorInstitutions:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Je("findPublicSectorInstitutions","regNameOrCode",t);const o="/person/public-sector-institutions/{regNameOrCode}".replace("{regNameOrCode}",encodeURIComponent(String(t))),i=new URL(o,He);let r;e&&(r=e.baseOptions);const a={method:"PUT",...r,...s},l={"Content-Type":"application/json"};qe(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},a.data=$e(n,a,e),{url:ze(i),options:a}},findRolesByDbName:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/person/personroles",He);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};qe(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:ze(n),options:o}},getAllActiveInstitutions:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/person/jur",He);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};qe(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:ze(n),options:o}},getAllClassifierBusinessTypeDtos:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/person/jur/businessTypes",He);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};qe(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:ze(n),options:o}},getJurPerson:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Je("getJurPerson","personId",t);const s="/person/jur/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,He);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};qe(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:ze(o),options:r}},getJurPersonAncestors:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Je("getJurPersonAncestors","jurPersonId",t);const s="/person/jur/ancestor/{jurPersonId}".replace("{jurPersonId}",encodeURIComponent(String(t))),o=new URL(s,He);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};qe(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:ze(o),options:r}},getJurPersonSuccessors:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Je("getJurPersonSuccessors","jurPersonId",t);const s="/person/jur/successor/{jurPersonId}".replace("{jurPersonId}",encodeURIComponent(String(t))),o=new URL(s,He);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};qe(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:ze(o),options:r}},getJurPersonsByEhakCode:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Je("getJurPersonsByEhakCode","ehakCode",t);const s="/person/jur/byEhakCode/{ehakCode}".replace("{ehakCode}",encodeURIComponent(String(t))),o=new URL(s,He);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};qe(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:ze(o),options:r}},getPerson:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Je("getPerson","personId",t);const s="/person/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,He);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};qe(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:ze(o),options:r}},getPersonDetails:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/person/details",He);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};qe(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:ze(n),options:o}},refreshUpdateArPersonFromAR:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Je("refreshUpdateArPersonFromAR","regCode",t);const s="/person/jur/refresh/{regCode}".replace("{regCode}",encodeURIComponent(String(t))),o=new URL(s,He);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};qe(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:ze(o),options:r}},removeYlemyksusReference:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Je("removeYlemyksusReference","allyksusId",t);const s="/person/jur/removeYlemyksusReference/{allyksusId}".replace("{allyksusId}",encodeURIComponent(String(t))),o=new URL(s,He);let i;e&&(i=e.baseOptions);const r={method:"PUT",...i,...n};qe(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:ze(o),options:r}},updatePerson:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Je("updatePerson","personId",t);const o="/person/{personId}".replace("{personId}",encodeURIComponent(String(t))),i=new URL(o,He);let r;e&&(r=e.baseOptions);const a={method:"PUT",...r,...s},l={"Content-Type":"application/json"};qe(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},a.data=$e(n,a,e),{url:ze(i),options:a}}}}(e);return{async addAllyksusToJurPerson(n,s){const o=await t.addAllyksusToJurPerson(n,s);return Xe(o,Ae(),Be,e)},async addPerson(n,s){const o=await t.addPerson(n,s);return Xe(o,Ae(),Be,e)},async deletePerson(n,s){const o=await t.deletePerson(n,s);return Xe(o,Ae(),Be,e)},async findKovsAndJurPersonsInTheSameAdministrativeDivision(n,s,o,i){const r=await t.findKovsAndJurPersonsInTheSameAdministrativeDivision(n,s,o,i);return Xe(r,Ae(),Be,e)},async findPublicSectorInstitutions(n,s,o){const i=await t.findPublicSectorInstitutions(n,s,o);return Xe(i,Ae(),Be,e)},async findRolesByDbName(n){const s=await t.findRolesByDbName(n);return Xe(s,Ae(),Be,e)},async getAllActiveInstitutions(n){const s=await t.getAllActiveInstitutions(n);return Xe(s,Ae(),Be,e)},async getAllClassifierBusinessTypeDtos(n){const s=await t.getAllClassifierBusinessTypeDtos(n);return Xe(s,Ae(),Be,e)},async getJurPerson(n,s){const o=await t.getJurPerson(n,s);return Xe(o,Ae(),Be,e)},async getJurPersonAncestors(n,s){const o=await t.getJurPersonAncestors(n,s);return Xe(o,Ae(),Be,e)},async getJurPersonSuccessors(n,s){const o=await t.getJurPersonSuccessors(n,s);return Xe(o,Ae(),Be,e)},async getJurPersonsByEhakCode(n,s){const o=await t.getJurPersonsByEhakCode(n,s);return Xe(o,Ae(),Be,e)},async getPerson(n,s){const o=await t.getPerson(n,s);return Xe(o,Ae(),Be,e)},async getPersonDetails(n){const s=await t.getPersonDetails(n);return Xe(s,Ae(),Be,e)},async refreshUpdateArPersonFromAR(n,s){const o=await t.refreshUpdateArPersonFromAR(n,s);return Xe(o,Ae(),Be,e)},async removeYlemyksusReference(n,s){const o=await t.removeYlemyksusReference(n,s);return Xe(o,Ae(),Be,e)},async updatePerson(n,s,o){const i=await t.updatePerson(n,s,o);return Xe(i,Ae(),Be,e)}}};class tt extends Ge{addAllyksusToJurPerson(e,t){return et(this.configuration).addAllyksusToJurPerson(e,t).then((e=>e(this.axios,this.basePath)))}addPerson(e,t){return et(this.configuration).addPerson(e,t).then((e=>e(this.axios,this.basePath)))}deletePerson(e,t){return et(this.configuration).deletePerson(e,t).then((e=>e(this.axios,this.basePath)))}findKovsAndJurPersonsInTheSameAdministrativeDivision(e,t,n,s){return et(this.configuration).findKovsAndJurPersonsInTheSameAdministrativeDivision(e,t,n,s).then((e=>e(this.axios,this.basePath)))}findPublicSectorInstitutions(e,t,n){return et(this.configuration).findPublicSectorInstitutions(e,t,n).then((e=>e(this.axios,this.basePath)))}findRolesByDbName(e){return et(this.configuration).findRolesByDbName(e).then((e=>e(this.axios,this.basePath)))}getAllActiveInstitutions(e){return et(this.configuration).getAllActiveInstitutions(e).then((e=>e(this.axios,this.basePath)))}getAllClassifierBusinessTypeDtos(e){return et(this.configuration).getAllClassifierBusinessTypeDtos(e).then((e=>e(this.axios,this.basePath)))}getJurPerson(e,t){return et(this.configuration).getJurPerson(e,t).then((e=>e(this.axios,this.basePath)))}getJurPersonAncestors(e,t){return et(this.configuration).getJurPersonAncestors(e,t).then((e=>e(this.axios,this.basePath)))}getJurPersonSuccessors(e,t){return et(this.configuration).getJurPersonSuccessors(e,t).then((e=>e(this.axios,this.basePath)))}getJurPersonsByEhakCode(e,t){return et(this.configuration).getJurPersonsByEhakCode(e,t).then((e=>e(this.axios,this.basePath)))}getPerson(e,t){return et(this.configuration).getPerson(e,t).then((e=>e(this.axios,this.basePath)))}getPersonDetails(e){return et(this.configuration).getPersonDetails(e).then((e=>e(this.axios,this.basePath)))}refreshUpdateArPersonFromAR(e,t){return et(this.configuration).refreshUpdateArPersonFromAR(e,t).then((e=>e(this.axios,this.basePath)))}removeYlemyksusReference(e,t){return et(this.configuration).removeYlemyksusReference(e,t).then((e=>e(this.axios,this.basePath)))}updatePerson(e,t,n){return et(this.configuration).updatePerson(e,t,n).then((e=>e(this.axios,this.basePath)))}}const nt=function(e){const t=function(e){return{searchPerson:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Je("searchPerson","input",t);const i=new URL("/search/searchPerson",He);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...o},l={};void 0!==t&&(l.input=t),void 0!==n&&(l.xRoad=n),void 0!==s&&(l.isPrivate=s),qe(i,l);let d=r&&r.headers?r.headers:{};return a.headers={...d,...o.headers},{url:ze(i),options:a}}}}(e);return{async searchPerson(n,s,o,i){const r=await t.searchPerson(n,s,o,i);return Xe(r,Ae(),Be,e)}}};class st extends Ge{searchPerson(e,t,n,s){return nt(this.configuration).searchPerson(e,t,n,s).then((e=>e(this.axios,this.basePath)))}}const ot=function(e){const t=function(e){return{addRoleToUser:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/user/addrole",He);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};qe(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=$e(t,i,e),{url:ze(s),options:i}},addUser:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/user",He);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};qe(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=$e(t,i,e),{url:ze(s),options:i}},appointSubstituteUser:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/user-substitution/appoint-substitute",He);let o;e&&(o=e.baseOptions);const i={method:"PUT",...o,...n},r={"Content-Type":"application/json"};qe(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=$e(t,i,e),{url:ze(s),options:i}},deleteUser:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Je("deleteUser","userId",t);const s="/user/{userId}".replace("{userId}",encodeURIComponent(String(t))),o=new URL(s,He);let i;e&&(i=e.baseOptions);const r={method:"DELETE",...i,...n};qe(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:ze(o),options:r}},deleteUserRole:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Je("deleteUserRole","userRoleRelId",t);const s="/user/role/{userRoleRelId}".replace("{userRoleRelId}",encodeURIComponent(String(t))),o=new URL(s,He);let i;e&&(i=e.baseOptions);const r={method:"DELETE",...i,...n};qe(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:ze(o),options:r}},findUsersByRoleId:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Je("findUsersByRoleId","roleId",t);const s="/user/byroleid/{roleId}".replace("{roleId}",encodeURIComponent(String(t))),o=new URL(s,He);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};qe(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:ze(o),options:r}},getAllClassifierUserRoleDtos:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/user/roles/all",He);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};qe(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:ze(n),options:o}},getHealth:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/health",He);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};qe(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:ze(n),options:o}},getJurUsers:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Je("getJurUsers","personId",t);const s="/jur/user/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,He);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};qe(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:ze(o),options:r}},getJurUsersWithoutGivenRole:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Je("getJurUsersWithoutGivenRole","personId",t),Je("getJurUsersWithoutGivenRole","roleId",n);const o="/jur/user/withoutrole/{personId}/{roleId}".replace("{personId}",encodeURIComponent(String(t))).replace("{roleId}",encodeURIComponent(String(n))),i=new URL(o,He);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};qe(i,{});let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:ze(i),options:a}},getUser:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Je("getUser","userId",t);const s="/user/{userId}".replace("{userId}",encodeURIComponent(String(t))),o=new URL(s,He);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};qe(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:ze(o),options:r}},getUserPossibleRecipients:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/user/possiblerecipients",He);let o;e&&(o=e.baseOptions);const i={method:"GET",...o,...n},r={};void 0!==t&&(r.searchInput=t),qe(s,r);let a=o&&o.headers?o.headers:{};return i.headers={...a,...n.headers},{url:ze(s),options:i}},getUsers:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Je("getUsers","personId",t);const s="/user/usersByPersonId/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,He);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};qe(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:ze(o),options:r}},getUsersJurPerson:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Je("getUsersJurPerson","userId",t);const o="/user/jur/{userId}".replace("{userId}",encodeURIComponent(String(t))),i=new URL(o,He);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s},l={};void 0!==n&&(l.valid=n),qe(i,l);let d=r&&r.headers?r.headers:{};return a.headers={...d,...s.headers},{url:ze(i),options:a}},updateUser:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Je("updateUser","userId",t);const o="/user/{userId}".replace("{userId}",encodeURIComponent(String(t))),i=new URL(o,He);let r;e&&(r=e.baseOptions);const a={method:"PUT",...r,...s},l={"Content-Type":"application/json"};qe(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},a.data=$e(n,a,e),{url:ze(i),options:a}},updateUserRole:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Je("updateUserRole","userRoleRelId",t);const o="/user/modifyrole/{userRoleRelId}".replace("{userRoleRelId}",encodeURIComponent(String(t))),i=new URL(o,He);let r;e&&(r=e.baseOptions);const a={method:"PUT",...r,...s},l={"Content-Type":"application/json"};qe(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},a.data=$e(n,a,e),{url:ze(i),options:a}}}}(e);return{async addRoleToUser(n,s){const o=await t.addRoleToUser(n,s);return Xe(o,Ae(),Be,e)},async addUser(n,s){const o=await t.addUser(n,s);return Xe(o,Ae(),Be,e)},async appointSubstituteUser(n,s){const o=await t.appointSubstituteUser(n,s);return Xe(o,Ae(),Be,e)},async deleteUser(n,s){const o=await t.deleteUser(n,s);return Xe(o,Ae(),Be,e)},async deleteUserRole(n,s){const o=await t.deleteUserRole(n,s);return Xe(o,Ae(),Be,e)},async findUsersByRoleId(n,s){const o=await t.findUsersByRoleId(n,s);return Xe(o,Ae(),Be,e)},async getAllClassifierUserRoleDtos(n){const s=await t.getAllClassifierUserRoleDtos(n);return Xe(s,Ae(),Be,e)},async getHealth(n){const s=await t.getHealth(n);return Xe(s,Ae(),Be,e)},async getJurUsers(n,s){const o=await t.getJurUsers(n,s);return Xe(o,Ae(),Be,e)},async getJurUsersWithoutGivenRole(n,s,o){const i=await t.getJurUsersWithoutGivenRole(n,s,o);return Xe(i,Ae(),Be,e)},async getUser(n,s){const o=await t.getUser(n,s);return Xe(o,Ae(),Be,e)},async getUserPossibleRecipients(n,s){const o=await t.getUserPossibleRecipients(n,s);return Xe(o,Ae(),Be,e)},async getUsers(n,s){const o=await t.getUsers(n,s);return Xe(o,Ae(),Be,e)},async getUsersJurPerson(n,s,o){const i=await t.getUsersJurPerson(n,s,o);return Xe(i,Ae(),Be,e)},async updateUser(n,s,o){const i=await t.updateUser(n,s,o);return Xe(i,Ae(),Be,e)},async updateUserRole(n,s,o){const i=await t.updateUserRole(n,s,o);return Xe(i,Ae(),Be,e)}}};class it extends Ge{addRoleToUser(e,t){return ot(this.configuration).addRoleToUser(e,t).then((e=>e(this.axios,this.basePath)))}addUser(e,t){return ot(this.configuration).addUser(e,t).then((e=>e(this.axios,this.basePath)))}appointSubstituteUser(e,t){return ot(this.configuration).appointSubstituteUser(e,t).then((e=>e(this.axios,this.basePath)))}deleteUser(e,t){return ot(this.configuration).deleteUser(e,t).then((e=>e(this.axios,this.basePath)))}deleteUserRole(e,t){return ot(this.configuration).deleteUserRole(e,t).then((e=>e(this.axios,this.basePath)))}findUsersByRoleId(e,t){return ot(this.configuration).findUsersByRoleId(e,t).then((e=>e(this.axios,this.basePath)))}getAllClassifierUserRoleDtos(e){return ot(this.configuration).getAllClassifierUserRoleDtos(e).then((e=>e(this.axios,this.basePath)))}getHealth(e){return ot(this.configuration).getHealth(e).then((e=>e(this.axios,this.basePath)))}getJurUsers(e,t){return ot(this.configuration).getJurUsers(e,t).then((e=>e(this.axios,this.basePath)))}getJurUsersWithoutGivenRole(e,t,n){return ot(this.configuration).getJurUsersWithoutGivenRole(e,t,n).then((e=>e(this.axios,this.basePath)))}getUser(e,t){return ot(this.configuration).getUser(e,t).then((e=>e(this.axios,this.basePath)))}getUserPossibleRecipients(e,t){return ot(this.configuration).getUserPossibleRecipients(e,t).then((e=>e(this.axios,this.basePath)))}getUsers(e,t){return ot(this.configuration).getUsers(e,t).then((e=>e(this.axios,this.basePath)))}getUsersJurPerson(e,t,n){return ot(this.configuration).getUsersJurPerson(e,t,n).then((e=>e(this.axios,this.basePath)))}updateUser(e,t,n){return ot(this.configuration).updateUser(e,t,n).then((e=>e(this.axios,this.basePath)))}updateUserRole(e,t,n){return ot(this.configuration).updateUserRole(e,t,n).then((e=>e(this.axios,this.basePath)))}}class rt{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}const at="http://localhost:8080".replace(/\/+$/,"");class lt{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:at,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ae();var s;(this.basePath=t,this.axios=n,e)&&(this.configuration=e,this.basePath=null!==(s=e.basePath)&&void 0!==s?s:t)}}class dt extends Error{constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const ct={},ut="https://example.com",pt=function(e,t,n){if(null==n)throw new dt(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function ht(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>ht(e,t,n))):Object.keys(t).forEach((s=>ht(e,t[s],`${n}${""!==n?".":""}${s}`))):e.has(n)?e.append(n,t):e.set(n,t))}const mt=function(e){const t=new URLSearchParams(e.search);for(var n=arguments.length,s=new Array(n>1?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];ht(t,s),e.search=t.toString()},gt=function(e,t,n){const s="string"!=typeof e;return(s&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):s)?JSON.stringify(void 0!==e?e:{}):e||""},St=function(e){return e.pathname+e.search+e.hash},ft=function(e,t,n,s){return function(){var o;let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;const a={...e.options,url:(i.defaults.baseURL?"":null!==(o=null==s?void 0:s.basePath)&&void 0!==o?o:r)+e.url};return i.request(a)}},It=function(e){const t=function(e){return{findIncomingBaseDocuments:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};pt("findIncomingBaseDocuments","documentBaseQueryDto",t);const s=new URL("/documents/incomingdocuments",ut);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};mt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=gt(t,i,e),{url:St(s),options:i}},findWorkingDocuments:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};pt("findWorkingDocuments","documentBaseQueryDto",t);const s=new URL("/documents/basedocuments",ut);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};mt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=gt(t,i,e),{url:St(s),options:i}}}}(e);return{async findIncomingBaseDocuments(n,s){var o,i,r;const a=await t.findIncomingBaseDocuments(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=ct["BaseMyDocumentsApi.findIncomingBaseDocuments"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>ft(a,Ae(),at,e)(t,d||n)},async findWorkingDocuments(n,s){var o,i,r;const a=await t.findWorkingDocuments(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=ct["BaseMyDocumentsApi.findWorkingDocuments"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>ft(a,Ae(),at,e)(t,d||n)}}};class Tt extends lt{findIncomingBaseDocuments(e,t){return It(this.configuration).findIncomingBaseDocuments(e,t).then((e=>e(this.axios,this.basePath)))}findWorkingDocuments(e,t){return It(this.configuration).findWorkingDocuments(e,t).then((e=>e(this.axios,this.basePath)))}}const vt=function(e){const t=function(e){return{searchDetailBuildings:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};pt("searchDetailBuildings","buildingSearchDto",t);const s=new URL("/search/buildings",ut);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};mt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=gt(t,i,e),{url:St(s),options:i}},searchDetailDocuments:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};pt("searchDetailDocuments","documentSearchDto",t);const s=new URL("/search/documents",ut);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};mt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=gt(t,i,e),{url:St(s),options:i}},searchDetailProceedings:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};pt("searchDetailProceedings","proceedingSearchDto",t);const s=new URL("/search/proceedings",ut);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};mt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=gt(t,i,e),{url:St(s),options:i}}}}(e);return{async searchDetailBuildings(n,s){var o,i,r;const a=await t.searchDetailBuildings(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=ct["DetailSearchesApi.searchDetailBuildings"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>ft(a,Ae(),at,e)(t,d||n)},async searchDetailDocuments(n,s){var o,i,r;const a=await t.searchDetailDocuments(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=ct["DetailSearchesApi.searchDetailDocuments"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>ft(a,Ae(),at,e)(t,d||n)},async searchDetailProceedings(n,s){var o,i,r;const a=await t.searchDetailProceedings(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=ct["DetailSearchesApi.searchDetailProceedings"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>ft(a,Ae(),at,e)(t,d||n)}}};class Et extends lt{searchDetailBuildings(e,t){return vt(this.configuration).searchDetailBuildings(e,t).then((e=>e(this.axios,this.basePath)))}searchDetailDocuments(e,t){return vt(this.configuration).searchDetailDocuments(e,t).then((e=>e(this.axios,this.basePath)))}searchDetailProceedings(e,t){return vt(this.configuration).searchDetailProceedings(e,t).then((e=>e(this.axios,this.basePath)))}}const _t=function(e){const t=function(e){return{findOperationInvitations:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};pt("findOperationInvitations","operationQueryDto",t);const s=new URL("/myoperations/operationinvitations",ut);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};mt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=gt(t,i,e),{url:St(s),options:i}},findOperations:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};pt("findOperations","operationQueryDto",t);const s=new URL("/myoperations/myoperations",ut);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};mt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=gt(t,i,e),{url:St(s),options:i}},findOperationsToComment:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};pt("findOperationsToComment","operationQueryDto",t);const s=new URL("/myoperations/operationstocomment",ut);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};mt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=gt(t,i,e),{url:St(s),options:i}}}}(e);return{async findOperationInvitations(n,s){var o,i,r;const a=await t.findOperationInvitations(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=ct["MyOperationsApi.findOperationInvitations"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>ft(a,Ae(),at,e)(t,d||n)},async findOperations(n,s){var o,i,r;const a=await t.findOperations(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=ct["MyOperationsApi.findOperations"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>ft(a,Ae(),at,e)(t,d||n)},async findOperationsToComment(n,s){var o,i,r;const a=await t.findOperationsToComment(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=ct["MyOperationsApi.findOperationsToComment"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>ft(a,Ae(),at,e)(t,d||n)}}};class yt extends lt{findOperationInvitations(e,t){return _t(this.configuration).findOperationInvitations(e,t).then((e=>e(this.axios,this.basePath)))}findOperations(e,t){return _t(this.configuration).findOperations(e,t).then((e=>e(this.axios,this.basePath)))}findOperationsToComment(e,t){return _t(this.configuration).findOperationsToComment(e,t).then((e=>e(this.axios,this.basePath)))}}const bt=function(e){const t=function(e){return{findAreaProceedings:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};pt("findAreaProceedings","proceedingQueryDto",t);const s=new URL("/myproceedings/my-area-proceedings",ut);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};mt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=gt(t,i,e),{url:St(s),options:i}},findProceedings:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};pt("findProceedings","myProceedingsRequestDto",t);const s=new URL("/myproceedings/myproceedings",ut);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};mt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=gt(t,i,e),{url:St(s),options:i}}}}(e);return{async findAreaProceedings(n,s){var o,i,r;const a=await t.findAreaProceedings(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=ct["MyProceedingsApi.findAreaProceedings"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>ft(a,Ae(),at,e)(t,d||n)},async findProceedings(n,s){var o,i,r;const a=await t.findProceedings(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=ct["MyProceedingsApi.findProceedings"])||void 0===i||null===(r=i[l])||void 0===r?void 0:r.url;return(t,n)=>ft(a,Ae(),at,e)(t,d||n)}}};class Dt extends lt{findAreaProceedings(e,t){return bt(this.configuration).findAreaProceedings(e,t).then((e=>e(this.axios,this.basePath)))}findProceedings(e,t){return bt(this.configuration).findProceedings(e,t).then((e=>e(this.axios,this.basePath)))}}class xt{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.serverIndex=e.serverIndex,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}const Mt="http://localhost:8080".replace(/\/+$/,"");class Nt{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Mt,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ae();this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class Ot extends Error{constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const At="https://example.com",Ut=function(e,t,n){if(null==n)throw new Ot(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},wt=async function(e,t){if(t&&t.accessToken){const n="function"==typeof t.accessToken?await t.accessToken():await t.accessToken;e.Authorization="Bearer "+n}};function jt(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>jt(e,t,n))):Object.keys(t).forEach((s=>jt(e,t[s],`${n}${""!==n?".":""}${s}`))):e.has(n)?e.append(n,t):e.set(n,t))}const Ct=function(e){const t=new URLSearchParams(e.search);for(var n=arguments.length,s=new Array(n>1?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];jt(t,s),e.search=t.toString()},Lt=function(e,t,n){const s="string"!=typeof e;return(s&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):s)?JSON.stringify(void 0!==e?e:{}):e||""},Pt=function(e){return e.pathname+e.search+e.hash},Rt=function(e,t,n,s){return function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;const r={...e.options,url:((null==s?void 0:s.basePath)||o.defaults.baseURL||i)+e.url};return o.request(r)}};const Kt=function(e){const t=function(e){return{addAuthz:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ut("addAuthz","documentType",t),Ut("addAuthz","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/addAuthz".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,At);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};Ct(i,{});let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:Pt(i),options:a}},apiVersion:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/version",At);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ct(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Pt(n),options:o}},autoUpdateOwnershipType:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/document/updateOwnershipType",At);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ct(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Pt(n),options:o}},createDoDokuDokuRel:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ut("createDoDokuDokuRel","documentId",t),Ut("createDoDokuDokuRel","addEntityDto",n);const o="/document/{documentId}/createDoDokuDokuRel".replace("{documentId}",encodeURIComponent(String(t))),i=new URL(o,At);let r;e&&(r=e.baseOptions);const a={method:"POST",...r,...s},l={};await wt(l,e),l["Content-Type"]="application/json",Ct(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},a.data=Lt(n,a,e),{url:Pt(i),options:a}},createDocument:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ut("createDocument","documentType",t);const o="/document/{documentType}".replace("{documentType}",encodeURIComponent(String(t))),i=new URL(o,At);let r;e&&(r=e.baseOptions);const a={method:"POST",...r,...s},l={};await wt(l,e),l["Content-Type"]="application/json",Ct(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},a.data=Lt(n,a,e),{url:Pt(i),options:a}},createNewVersion:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Ut("createNewVersion","documentType",t),Ut("createNewVersion","applicationNumber",n),Ut("createNewVersion","versionDto",s);const i="/document/{documentType}/{applicationNumber}/version/new".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),r=new URL(i,At);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...o},d={};await wt(d,e),d["Content-Type"]="application/json",Ct(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},l.data=Lt(s,l,e),{url:Pt(r),options:l}},deleteApplicationByNumber:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ut("deleteApplicationByNumber","documentType",t),Ut("deleteApplicationByNumber","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,At);let r;e&&(r=e.baseOptions);const a={method:"DELETE",...r,...s},l={};await wt(l,e),Ct(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},{url:Pt(i),options:a}},endProceedingCircleDocuments:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Ut("endProceedingCircleDocuments","documentType",t),Ut("endProceedingCircleDocuments","applicationNumber",n),Ut("endProceedingCircleDocuments","proceedingId",s);const i="/document/{documentType}/{applicationNumber}/proceeding/{proceedingId}/endCircle".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))).replace("{proceedingId}",encodeURIComponent(String(s))),r=new URL(i,At);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...o},d={};await wt(d,e),Ct(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},{url:Pt(r),options:l}},getAccessRights:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ut("getAccessRights","documentType",t),Ut("getAccessRights","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/rights".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,At);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s},l={};await wt(l,e),Ct(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},{url:Pt(i),options:a}},getApplicationById:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ut("getApplicationById","documentId",t);const s="/document/{documentId}".replace("{documentId}",encodeURIComponent(String(t))),o=new URL(s,At);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n},a={};await wt(a,e),Ct(o,{});let l=i&&i.headers?i.headers:{};return r.headers={...a,...l,...n.headers},{url:Pt(o),options:r}},getApplicationByNumber:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ut("getApplicationByNumber","documentType",t),Ut("getApplicationByNumber","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,At);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s},l={};await wt(l,e),Ct(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},{url:Pt(i),options:a}},getApplicationByNumberOld:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ut("getApplicationByNumberOld","ehrCode",t),Ut("getApplicationByNumberOld","applicationNumber",n);const o="/document/old/{ehrCode}/{applicationNumber}".replace("{ehrCode}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,At);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s},l={};await wt(l,e),Ct(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},{url:Pt(i),options:a}},getApplicationByNumberWithVersion:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Ut("getApplicationByNumberWithVersion","documentType",t),Ut("getApplicationByNumberWithVersion","applicationNumber",n),Ut("getApplicationByNumberWithVersion","version",s);const i="/document/{documentType}/{applicationNumber}/{version}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))).replace("{version}",encodeURIComponent(String(s))),r=new URL(i,At);let a;e&&(a=e.baseOptions);const l={method:"GET",...a,...o},d={};await wt(d,e),Ct(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},{url:Pt(r),options:l}},getApplicationStateFee:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Ut("getApplicationStateFee","documentType",t),Ut("getApplicationStateFee","applicationNumber",n),Ut("getApplicationStateFee","applicationDto",s);const i="/document/{documentType}/{applicationNumber}/stateFee".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),r=new URL(i,At);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...o},d={};await wt(d,e),d["Content-Type"]="application/json",Ct(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},l.data=Lt(s,l,e),{url:Pt(r),options:l}},getApplicationStateFeeOfVersion:async function(t,n,s,o){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};Ut("getApplicationStateFeeOfVersion","documentType",t),Ut("getApplicationStateFeeOfVersion","applicationNumber",n),Ut("getApplicationStateFeeOfVersion","version",s),Ut("getApplicationStateFeeOfVersion","applicationDto",o);const r="/document/{documentType}/{applicationNumber}/{version}/stateFee".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))).replace("{version}",encodeURIComponent(String(s))),a=new URL(r,At);let l;e&&(l=e.baseOptions);const d={method:"POST",...l,...i},c={};await wt(c,e),c["Content-Type"]="application/json",Ct(a,{});let u=l&&l.headers?l.headers:{};return d.headers={...c,...u,...i.headers},d.data=Lt(o,d,e),{url:Pt(a),options:d}},getDocumentFileRels:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ut("getDocumentFileRels","docNr",t);const s=new URL("/document/fileRels",At);let o;e&&(o=e.baseOptions);const i={method:"GET",...o,...n},r={},a={};await wt(r,e),void 0!==t&&(a.docNr=t),Ct(s,a);let l=o&&o.headers?o.headers:{};return i.headers={...r,...l,...n.headers},{url:Pt(s),options:i}},getDotysBasedOnUserRights:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/document/starting_rights",At);let o;e&&(o=e.baseOptions);const i={method:"GET",...o,...n},r={};void 0!==t&&(r.ehrCode=t),Ct(s,r);let a=o&&o.headers?o.headers:{};return i.headers={...a,...n.headers},{url:Pt(s),options:i}},getHealth:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/health",At);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ct(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Pt(n),options:o}},getLastStateHistory:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ut("getLastStateHistory","documentType",t),Ut("getLastStateHistory","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/state-history/last".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,At);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};Ct(i,{});let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:Pt(i),options:a}},initializeAds:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ut("initializeAds","documentType",t),Ut("initializeAds","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/initAds".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,At);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};Ct(i,{});let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:Pt(i),options:a}},mergeInstitutions:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ut("mergeInstitutions","mergeInstitutionsDTO",t);const s=new URL("/document/merge",At);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Ct(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=Lt(t,i,e),{url:Pt(s),options:i}},reSubmit:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Ut("reSubmit","documentType",t),Ut("reSubmit","applicationNumber",n),Ut("reSubmit","proceedingNumber",s);const i="/document/{documentType}/{applicationNumber}/resubmit/{proceedingNumber}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))).replace("{proceedingNumber}",encodeURIComponent(String(s))),r=new URL(i,At);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...o},d={};await wt(d,e),Ct(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},{url:Pt(r),options:l}},recalculatestate:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ut("recalculatestate","documentType",t),Ut("recalculatestate","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/recalculatedetailstate".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,At);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};Ct(i,{});let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:Pt(i),options:a}},revertCreateNewVersion:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Ut("revertCreateNewVersion","documentType",t),Ut("revertCreateNewVersion","applicationNumber",n),Ut("revertCreateNewVersion","versionDto",s);const i="/document/{documentType}/{applicationNumber}/version/revert".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),r=new URL(i,At);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...o},d={};await wt(d,e),d["Content-Type"]="application/json",Ct(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},l.data=Lt(s,l,e),{url:Pt(r),options:l}},saveAndValidate:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Ut("saveAndValidate","documentType",t),Ut("saveAndValidate","applicationNumber",n),Ut("saveAndValidate","applicationDto",s);const i="/document/{documentType}/{applicationNumber}/saveAndValidate".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),r=new URL(i,At);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...o},d={};await wt(d,e),d["Content-Type"]="application/json",Ct(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},l.data=Lt(s,l,e),{url:Pt(r),options:l}},saveApplicationByNumber:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Ut("saveApplicationByNumber","documentType",t),Ut("saveApplicationByNumber","applicationNumber",n),Ut("saveApplicationByNumber","applicationDto",s);const i="/document/{documentType}/{applicationNumber}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),r=new URL(i,At);let a;e&&(a=e.baseOptions);const l={method:"PUT",...a,...o},d={};await wt(d,e),d["Content-Type"]="application/json",Ct(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},l.data=Lt(s,l,e),{url:Pt(r),options:l}},setWaterExtractionPointsTestDates:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ut("setWaterExtractionPointsTestDates","documentType",t),Ut("setWaterExtractionPointsTestDates","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/water-extraction-point/set-test-dates".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,At);let r;e&&(r=e.baseOptions);const a={method:"PUT",...r,...s},l={};await wt(l,e),Ct(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},{url:Pt(i),options:a}},setWaterExtractionPointsTestDatesForBuilding:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Ut("setWaterExtractionPointsTestDatesForBuilding","documentType",t),Ut("setWaterExtractionPointsTestDatesForBuilding","applicationNumber",n),Ut("setWaterExtractionPointsTestDatesForBuilding","ehrCode",s);const i="/document/{documentType}/{applicationNumber}/building/{ehrCode}/water-extraction-point/set-test-dates".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))).replace("{ehrCode}",encodeURIComponent(String(s))),r=new URL(i,At);let a;e&&(a=e.baseOptions);const l={method:"PUT",...a,...o},d={};await wt(d,e),Ct(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},{url:Pt(r),options:l}},submitStraightToRegistry:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ut("submitStraightToRegistry","documentType",t),Ut("submitStraightToRegistry","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/submitToRegistry".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,At);let r;e&&(r=e.baseOptions);const a={method:"POST",...r,...s},l={};await wt(l,e),Ct(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},{url:Pt(i),options:a}},submitToProcessing:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ut("submitToProcessing","documentType",t),Ut("submitToProcessing","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/submitToProcessing".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,At);let r;e&&(r=e.baseOptions);const a={method:"PUT",...r,...s},l={};await wt(l,e),Ct(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},{url:Pt(i),options:a}},submitToSigning:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Ut("submitToSigning","documentType",t),Ut("submitToSigning","applicationNumber",n),Ut("submitToSigning","applicationDto",s);const i="/document/{documentType}/{applicationNumber}/submitToSigning".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),r=new URL(i,At);let a;e&&(a=e.baseOptions);const l={method:"PUT",...a,...o},d={};await wt(d,e),d["Content-Type"]="application/json",Ct(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},l.data=Lt(s,l,e),{url:Pt(r),options:l}},submitToSupervisorProcessing:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Ut("submitToSupervisorProcessing","documentType",t),Ut("submitToSupervisorProcessing","applicationNumber",n),Ut("submitToSupervisorProcessing","supervisorId",s);const i="/document/{documentType}/{applicationNumber}/submitToSupervisor/{supervisorId}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))).replace("{supervisorId}",encodeURIComponent(String(s))),r=new URL(i,At);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...o},d={};await wt(d,e),Ct(r,{});let c=a&&a.headers?a.headers:{};return l.headers={...d,...c,...o.headers},{url:Pt(r),options:l}},validateSavedDocument:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ut("validateSavedDocument","documentType",t),Ut("validateSavedDocument","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/completeApplicationChecks".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,At);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};Ct(i,{});let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:Pt(i),options:a}}}}(e);return{async addAuthz(n,s,o){const i=await t.addAuthz(n,s,o);return Rt(i,Ae(),Mt,e)},async apiVersion(n){const s=await t.apiVersion(n);return Rt(s,Ae(),Mt,e)},async autoUpdateOwnershipType(n){const s=await t.autoUpdateOwnershipType(n);return Rt(s,Ae(),Mt,e)},async createDoDokuDokuRel(n,s,o){const i=await t.createDoDokuDokuRel(n,s,o);return Rt(i,Ae(),Mt,e)},async createDocument(n,s,o){const i=await t.createDocument(n,s,o);return Rt(i,Ae(),Mt,e)},async createNewVersion(n,s,o,i){const r=await t.createNewVersion(n,s,o,i);return Rt(r,Ae(),Mt,e)},async deleteApplicationByNumber(n,s,o){const i=await t.deleteApplicationByNumber(n,s,o);return Rt(i,Ae(),Mt,e)},async endProceedingCircleDocuments(n,s,o,i){const r=await t.endProceedingCircleDocuments(n,s,o,i);return Rt(r,Ae(),Mt,e)},async getAccessRights(n,s,o){const i=await t.getAccessRights(n,s,o);return Rt(i,Ae(),Mt,e)},async getApplicationById(n,s){const o=await t.getApplicationById(n,s);return Rt(o,Ae(),Mt,e)},async getApplicationByNumber(n,s,o){const i=await t.getApplicationByNumber(n,s,o);return Rt(i,Ae(),Mt,e)},async getApplicationByNumberOld(n,s,o){const i=await t.getApplicationByNumberOld(n,s,o);return Rt(i,Ae(),Mt,e)},async getApplicationByNumberWithVersion(n,s,o,i){const r=await t.getApplicationByNumberWithVersion(n,s,o,i);return Rt(r,Ae(),Mt,e)},async getApplicationStateFee(n,s,o,i){const r=await t.getApplicationStateFee(n,s,o,i);return Rt(r,Ae(),Mt,e)},async getApplicationStateFeeOfVersion(n,s,o,i,r){const a=await t.getApplicationStateFeeOfVersion(n,s,o,i,r);return Rt(a,Ae(),Mt,e)},async getDocumentFileRels(n,s){const o=await t.getDocumentFileRels(n,s);return Rt(o,Ae(),Mt,e)},async getDotysBasedOnUserRights(n,s){const o=await t.getDotysBasedOnUserRights(n,s);return Rt(o,Ae(),Mt,e)},async getHealth(n){const s=await t.getHealth(n);return Rt(s,Ae(),Mt,e)},async getLastStateHistory(n,s,o){const i=await t.getLastStateHistory(n,s,o);return Rt(i,Ae(),Mt,e)},async initializeAds(n,s,o){const i=await t.initializeAds(n,s,o);return Rt(i,Ae(),Mt,e)},async mergeInstitutions(n,s){const o=await t.mergeInstitutions(n,s);return Rt(o,Ae(),Mt,e)},async reSubmit(n,s,o,i){const r=await t.reSubmit(n,s,o,i);return Rt(r,Ae(),Mt,e)},async recalculatestate(n,s,o){const i=await t.recalculatestate(n,s,o);return Rt(i,Ae(),Mt,e)},async revertCreateNewVersion(n,s,o,i){const r=await t.revertCreateNewVersion(n,s,o,i);return Rt(r,Ae(),Mt,e)},async saveAndValidate(n,s,o,i){const r=await t.saveAndValidate(n,s,o,i);return Rt(r,Ae(),Mt,e)},async saveApplicationByNumber(n,s,o,i){const r=await t.saveApplicationByNumber(n,s,o,i);return Rt(r,Ae(),Mt,e)},async setWaterExtractionPointsTestDates(n,s,o){const i=await t.setWaterExtractionPointsTestDates(n,s,o);return Rt(i,Ae(),Mt,e)},async setWaterExtractionPointsTestDatesForBuilding(n,s,o,i){const r=await t.setWaterExtractionPointsTestDatesForBuilding(n,s,o,i);return Rt(r,Ae(),Mt,e)},async submitStraightToRegistry(n,s,o){const i=await t.submitStraightToRegistry(n,s,o);return Rt(i,Ae(),Mt,e)},async submitToProcessing(n,s,o){const i=await t.submitToProcessing(n,s,o);return Rt(i,Ae(),Mt,e)},async submitToSigning(n,s,o,i){const r=await t.submitToSigning(n,s,o,i);return Rt(r,Ae(),Mt,e)},async submitToSupervisorProcessing(n,s,o,i){const r=await t.submitToSupervisorProcessing(n,s,o,i);return Rt(r,Ae(),Mt,e)},async validateSavedDocument(n,s,o){const i=await t.validateSavedDocument(n,s,o);return Rt(i,Ae(),Mt,e)}}};class Ft extends Nt{addAuthz(e,t,n){return Kt(this.configuration).addAuthz(e,t,n).then((e=>e(this.axios,this.basePath)))}apiVersion(e){return Kt(this.configuration).apiVersion(e).then((e=>e(this.axios,this.basePath)))}autoUpdateOwnershipType(e){return Kt(this.configuration).autoUpdateOwnershipType(e).then((e=>e(this.axios,this.basePath)))}createDoDokuDokuRel(e,t,n){return Kt(this.configuration).createDoDokuDokuRel(e,t,n).then((e=>e(this.axios,this.basePath)))}createDocument(e,t,n){return Kt(this.configuration).createDocument(e,t,n).then((e=>e(this.axios,this.basePath)))}createNewVersion(e,t,n,s){return Kt(this.configuration).createNewVersion(e,t,n,s).then((e=>e(this.axios,this.basePath)))}deleteApplicationByNumber(e,t,n){return Kt(this.configuration).deleteApplicationByNumber(e,t,n).then((e=>e(this.axios,this.basePath)))}endProceedingCircleDocuments(e,t,n,s){return Kt(this.configuration).endProceedingCircleDocuments(e,t,n,s).then((e=>e(this.axios,this.basePath)))}getAccessRights(e,t,n){return Kt(this.configuration).getAccessRights(e,t,n).then((e=>e(this.axios,this.basePath)))}getApplicationById(e,t){return Kt(this.configuration).getApplicationById(e,t).then((e=>e(this.axios,this.basePath)))}getApplicationByNumber(e,t,n){return Kt(this.configuration).getApplicationByNumber(e,t,n).then((e=>e(this.axios,this.basePath)))}getApplicationByNumberOld(e,t,n){return Kt(this.configuration).getApplicationByNumberOld(e,t,n).then((e=>e(this.axios,this.basePath)))}getApplicationByNumberWithVersion(e,t,n,s){return Kt(this.configuration).getApplicationByNumberWithVersion(e,t,n,s).then((e=>e(this.axios,this.basePath)))}getApplicationStateFee(e,t,n,s){return Kt(this.configuration).getApplicationStateFee(e,t,n,s).then((e=>e(this.axios,this.basePath)))}getApplicationStateFeeOfVersion(e,t,n,s,o){return Kt(this.configuration).getApplicationStateFeeOfVersion(e,t,n,s,o).then((e=>e(this.axios,this.basePath)))}getDocumentFileRels(e,t){return Kt(this.configuration).getDocumentFileRels(e,t).then((e=>e(this.axios,this.basePath)))}getDotysBasedOnUserRights(e,t){return Kt(this.configuration).getDotysBasedOnUserRights(e,t).then((e=>e(this.axios,this.basePath)))}getHealth(e){return Kt(this.configuration).getHealth(e).then((e=>e(this.axios,this.basePath)))}getLastStateHistory(e,t,n){return Kt(this.configuration).getLastStateHistory(e,t,n).then((e=>e(this.axios,this.basePath)))}initializeAds(e,t,n){return Kt(this.configuration).initializeAds(e,t,n).then((e=>e(this.axios,this.basePath)))}mergeInstitutions(e,t){return Kt(this.configuration).mergeInstitutions(e,t).then((e=>e(this.axios,this.basePath)))}reSubmit(e,t,n,s){return Kt(this.configuration).reSubmit(e,t,n,s).then((e=>e(this.axios,this.basePath)))}recalculatestate(e,t,n){return Kt(this.configuration).recalculatestate(e,t,n).then((e=>e(this.axios,this.basePath)))}revertCreateNewVersion(e,t,n,s){return Kt(this.configuration).revertCreateNewVersion(e,t,n,s).then((e=>e(this.axios,this.basePath)))}saveAndValidate(e,t,n,s){return Kt(this.configuration).saveAndValidate(e,t,n,s).then((e=>e(this.axios,this.basePath)))}saveApplicationByNumber(e,t,n,s){return Kt(this.configuration).saveApplicationByNumber(e,t,n,s).then((e=>e(this.axios,this.basePath)))}setWaterExtractionPointsTestDates(e,t,n){return Kt(this.configuration).setWaterExtractionPointsTestDates(e,t,n).then((e=>e(this.axios,this.basePath)))}setWaterExtractionPointsTestDatesForBuilding(e,t,n,s){return Kt(this.configuration).setWaterExtractionPointsTestDatesForBuilding(e,t,n,s).then((e=>e(this.axios,this.basePath)))}submitStraightToRegistry(e,t,n){return Kt(this.configuration).submitStraightToRegistry(e,t,n).then((e=>e(this.axios,this.basePath)))}submitToProcessing(e,t,n){return Kt(this.configuration).submitToProcessing(e,t,n).then((e=>e(this.axios,this.basePath)))}submitToSigning(e,t,n,s){return Kt(this.configuration).submitToSigning(e,t,n,s).then((e=>e(this.axios,this.basePath)))}submitToSupervisorProcessing(e,t,n,s){return Kt(this.configuration).submitToSupervisorProcessing(e,t,n,s).then((e=>e(this.axios,this.basePath)))}validateSavedDocument(e,t,n){return Kt(this.configuration).validateSavedDocument(e,t,n).then((e=>e(this.axios,this.basePath)))}}class kt{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}const Yt="https://devkluster.ehr.ee/api/file-upload-api/v1".replace(/\/+$/,"");class Bt{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Yt,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ae();this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class Gt extends Error{constructor(e,t){super(t),this.name="RequiredError",this.field=e}}const Vt="https://example.com",Ht=function(e,t,n){if(null==n)throw new Gt(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},Jt=async function(e,t){if(t&&t.accessToken){const n="function"==typeof t.accessToken?await t.accessToken():await t.accessToken;e.Authorization="Bearer "+n}},Wt=function(e){const t=new URLSearchParams(e.search);for(var n=arguments.length,s=new Array(n>1?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];for(const e of s)for(const n in e)if(Array.isArray(e[n])){t.delete(n);for(const s of e[n])t.append(n,s)}else t.set(n,e[n]);e.search=t.toString()},qt=function(e,t,n){const s="string"!=typeof e;return(s&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):s)?JSON.stringify(void 0!==e?e:{}):e||""},$t=function(e){return e.pathname+e.search+e.hash},zt=function(e,t,n,s){return function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;const r={...e.options,url:((null==s?void 0:s.basePath)||i)+e.url};return o.request(r)}},Xt=function(e){const t=function(e){return{cloneFilesAndCreateRels:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Ht("cloneFilesAndCreateRels","fileIds",t);const i=new URL("/fileClone",Vt);let r;e&&(r=e.baseOptions);const a={method:"POST",...r,...o},l={},d={};await Jt(l,e),t&&(d.fileIds=t),void 0!==n&&(d.docNr=n),void 0!==s&&(d.relType=s),Wt(i,d);let c=r&&r.headers?r.headers:{};return a.headers={...l,...c,...o.headers},{url:$t(i),options:a}},deleteFile:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ht("deleteFile","fileId",t);const s="/file/{fileId}".replace("{fileId}",encodeURIComponent(String(t))),o=new URL(s,Vt);let i;e&&(i=e.baseOptions);const r={method:"DELETE",...i,...n},a={};await Jt(a,e),Wt(o,{});let l=i&&i.headers?i.headers:{};return r.headers={...a,...l,...n.headers},{url:$t(o),options:r}},downloadFile:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ht("downloadFile","fileId",t);const s="/file/{fileId}".replace("{fileId}",encodeURIComponent(String(t))),o=new URL(s,Vt);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n},a={};await Jt(a,e),Wt(o,{});let l=i&&i.headers?i.headers:{};return r.headers={...a,...l,...n.headers},{url:$t(o),options:r}},updateFile:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ht("updateFile","fileId",t);const o="/file/{fileId}".replace("{fileId}",encodeURIComponent(String(t))),i=new URL(o,Vt);let r;e&&(r=e.baseOptions);const a={method:"PUT",...r,...s},l={};await Jt(l,e),l["Content-Type"]="application/json",Wt(i,{});let d=r&&r.headers?r.headers:{};return a.headers={...l,...d,...s.headers},a.data=qt(n,a,e),{url:$t(i),options:a}},updateFileInfo:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ht("updateFileInfo","doFail",t);const s=new URL("/file/info",Vt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={};await Jt(r,e),r["Content-Type"]="application/json",Wt(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=qt(t,i,e),{url:$t(s),options:i}},uploadFile:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/file",Vt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={},a=new(e&&e.formDataCtor||FormData);await Jt(r,e),void 0!==t&&a.append("file",t),r["Content-Type"]="multipart/form-data",Wt(s,{});let l=o&&o.headers?o.headers:{};return i.headers={...r,...l,...n.headers},i.data=a,{url:$t(s),options:i}},uploadFileWithFileInfo:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const o=new URL("/fileWithInfo",Vt);let i;e&&(i=e.baseOptions);const r={method:"POST",...i,...s},a={},l=new(e&&e.formDataCtor||FormData);await Jt(a,e),void 0!==t&&l.append("file",t),void 0!==n&&l.append("fileInfo",new Blob([JSON.stringify(n)],{type:"application/json"})),a["Content-Type"]="multipart/form-data",Wt(o,{});let d=i&&i.headers?i.headers:{};return r.headers={...a,...d,...s.headers},r.data=l,{url:$t(o),options:r}},uploadFileWithFileInfoAndDocRel:async function(t,n,s,o){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const r=new URL("/fileWithInfoAndDocRel",Vt);let a;e&&(a=e.baseOptions);const l={method:"POST",...a,...i},d={},c=new(e&&e.formDataCtor||FormData);await Jt(d,e),void 0!==t&&c.append("file",t),void 0!==n&&c.append("fileInfo",new Blob([JSON.stringify(n)],{type:"application/json"})),void 0!==s&&c.append("docNr",s),void 0!==o&&c.append("relType",o),d["Content-Type"]="multipart/form-data",Wt(r,{});let u=a&&a.headers?a.headers:{};return l.headers={...d,...u,...i.headers},l.data=c,{url:$t(r),options:l}}}}(e);return{async cloneFilesAndCreateRels(n,s,o,i){const r=await t.cloneFilesAndCreateRels(n,s,o,i);return zt(r,Ae(),Yt,e)},async deleteFile(n,s){const o=await t.deleteFile(n,s);return zt(o,Ae(),Yt,e)},async downloadFile(n,s){const o=await t.downloadFile(n,s);return zt(o,Ae(),Yt,e)},async updateFile(n,s,o){const i=await t.updateFile(n,s,o);return zt(i,Ae(),Yt,e)},async updateFileInfo(n,s){const o=await t.updateFileInfo(n,s);return zt(o,Ae(),Yt,e)},async uploadFile(n,s){const o=await t.uploadFile(n,s);return zt(o,Ae(),Yt,e)},async uploadFileWithFileInfo(n,s,o){const i=await t.uploadFileWithFileInfo(n,s,o);return zt(i,Ae(),Yt,e)},async uploadFileWithFileInfoAndDocRel(n,s,o,i,r){const a=await t.uploadFileWithFileInfoAndDocRel(n,s,o,i,r);return zt(a,Ae(),Yt,e)}}};class Qt extends Bt{cloneFilesAndCreateRels(e,t,n,s){return Xt(this.configuration).cloneFilesAndCreateRels(e,t,n,s).then((e=>e(this.axios,this.basePath)))}deleteFile(e,t){return Xt(this.configuration).deleteFile(e,t).then((e=>e(this.axios,this.basePath)))}downloadFile(e,t){return Xt(this.configuration).downloadFile(e,t).then((e=>e(this.axios,this.basePath)))}updateFile(e,t,n){return Xt(this.configuration).updateFile(e,t,n).then((e=>e(this.axios,this.basePath)))}updateFileInfo(e,t){return Xt(this.configuration).updateFileInfo(e,t).then((e=>e(this.axios,this.basePath)))}uploadFile(e,t){return Xt(this.configuration).uploadFile(e,t).then((e=>e(this.axios,this.basePath)))}uploadFileWithFileInfo(e,t,n){return Xt(this.configuration).uploadFileWithFileInfo(e,t,n).then((e=>e(this.axios,this.basePath)))}uploadFileWithFileInfoAndDocRel(e,t,n,s,o){return Xt(this.configuration).uploadFileWithFileInfoAndDocRel(e,t,n,s,o).then((e=>e(this.axios,this.basePath)))}}class Zt{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}const en="https://devkluster.ehr.ee/api/yld-esi/v1".replace(/\/+$/,"");class tn{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:en,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ae();this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class nn extends Error{constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const sn="https://example.com",on=function(e,t,n){if(null==n)throw new nn(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function rn(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>rn(e,t,n))):Object.keys(t).forEach((s=>rn(e,t[s],`${n}${""!==n?".":""}${s}`))):e.has(n)?e.append(n,t):e.set(n,t))}const an=function(e){const t=new URLSearchParams(e.search);for(var n=arguments.length,s=new Array(n>1?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];rn(t,s),e.search=t.toString()},ln=function(e){return e.pathname+e.search+e.hash},dn=function(e,t,n,s){return function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;const r={...e.options,url:((null==s?void 0:s.basePath)||o.defaults.baseURL||i)+e.url};return o.request(r)}};const cn=function(e){return{esileht:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};on("esileht","id",t),on("esileht","language",n);const o="/public/page/{id}/{language}".replace("{id}",encodeURIComponent(String(t))).replace("{language}",encodeURIComponent(String(n))),i=new URL(o,sn);let r;e&&(r=e.baseOptions);const a={method:"GET",...r,...s};an(i,{});let l=r&&r.headers?r.headers:{};return a.headers={...l,...s.headers},{url:ln(i),options:a}},lehed:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/api/pages",sn);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};an(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:ln(n),options:o}},lehedId:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/api/pages/dotyid",sn);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};an(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:ln(n),options:o}},leht:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};on("leht","id",t);const s="/api/pages/{id}".replace("{id}",encodeURIComponent(String(t))),o=new URL(s,sn);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n};an(o,{});let a=i&&i.headers?i.headers:{};return r.headers={...a,...n.headers},{url:ln(o),options:r}},lehtdSave:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};on("lehtdSave","esileht",t);const s=new URL("/api/pages",sn);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={};r["Content-Type"]="application/json",an(s,{});let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=function(e,t,n){const s="string"!=typeof e;return(s&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):s)?JSON.stringify(void 0!==e?e:{}):e||""}(t,i,e),{url:ln(s),options:i}}}},un=function(e){const t=cn(e);return{async esileht(n,s,o){const i=await t.esileht(n,s,o);return dn(i,Ae(),en,e)},async lehed(n){const s=await t.lehed(n);return dn(s,Ae(),en,e)},async lehedId(n){const s=await t.lehedId(n);return dn(s,Ae(),en,e)},async leht(n,s){const o=await t.leht(n,s);return dn(o,Ae(),en,e)},async lehtdSave(n,s){const o=await t.lehtdSave(n,s);return dn(o,Ae(),en,e)}}};class pn extends tn{esileht(e,t,n){return un(this.configuration).esileht(e,t,n).then((e=>e(this.axios,this.basePath)))}lehed(e){return un(this.configuration).lehed(e).then((e=>e(this.axios,this.basePath)))}lehedId(e){return un(this.configuration).lehedId(e).then((e=>e(this.axios,this.basePath)))}leht(e,t){return un(this.configuration).leht(e,t).then((e=>e(this.axios,this.basePath)))}lehtdSave(e,t){return un(this.configuration).lehtdSave(e,t).then((e=>e(this.axios,this.basePath)))}}class hn{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}const mn={myViewsApiEndpoint:window.REACT_APP_MY_VIEWS_API_PATH,classifierApiEndpoint:window.REACT_APP_CLASSIFIER_SERVICE_ENDPOINT,userApiEndpoint:window.REACT_APP_USER_SERVICE_ENDPOINT,documentApiEndpoint:window.REACT_APP_DOCUMENT_SERVICE_ENDPOINT,fileUploadApiEndpoint:window.REACT_APP_FILE_UPLOAD_API_ENDPOINT,frontPageApiEndpoint:window.REACT_APP_YLD_API},gn={proceedingApiService:new Dt(new xt({basePath:mn.myViewsApiEndpoint})),classifierApiService:new ke(new Ye({basePath:mn.classifierApiEndpoint})),personApiService:new tt(new rt({basePath:mn.userApiEndpoint})),userApiService:new it(new rt({basePath:mn.userApiEndpoint})),myDocumentBaseApiService:new Tt(new xt({basePath:mn.myViewsApiEndpoint})),documentApiService:new Ft(new kt({basePath:mn.documentApiEndpoint})),fileApiService:new Qt(new Zt({basePath:mn.fileUploadApiEndpoint})),frontPageApi:new pn(new hn({basePath:mn.frontPageApiEndpoint})),institutionKovEndpointApi:new Ze(new rt({basePath:mn.userApiEndpoint}))};var Sn=c(848);const fn=11272,In=e=>{var t;let{userInfo:n}=e;const s=(0,Q.useIntl)(),[o,i]=(0,z.useState)(!0),[r,a]=(0,z.useState)(""),[l,d]=(0,z.useState)(""),c=(null===(t=n.activeRole)||void 0===t?void 0:t.businessType)===Se.MKM;(0,z.useEffect)((()=>{c?u():p()}),[]);const u=async()=>{gn.frontPageApi.leht(fn).then((e=>{const t=e.data;t[0].body&&(a(t[0].body),d(t[0].body))}))},p=async()=>{gn.frontPageApi.esileht(fn,"ee").then((e=>{const t=e.data;t.body&&(a(t.body),d(t.body))}))};return(0,Sn.jsx)(Z.Section,{collapsed:!1,title:"my_admin_proceedings.admin_proceedings_reminder",showSettings:!0,children:(0,Sn.jsxs)("div",{className:o?"d-flex justify-content-between":"",children:[(0,Sn.jsx)(Z.RichTextEditor,{placeholder:o?"":s.formatMessage({id:"placeholder.writing"}),onChange:e=>d(e),value:l,readOnly:o,view:o}),c&&o&&(0,Sn.jsx)(Z.Link,{onClick:()=>i(!1),type:"edit"}),!o&&(0,Sn.jsxs)("div",{className:"pt-2",children:[(0,Sn.jsx)(Z.Button,{colourScheme:"light",squared:!0,onClick:()=>{d(r),i(!0)},children:s.formatMessage({id:"button.cancel"})}),(0,Sn.jsx)(Z.Button,{className:"float-right",colourScheme:"success",squared:!0,onClick:()=>(async()=>{i(!o),a(l),gn.frontPageApi.lehtdSave({id:fn,body:l,language:"ee"})})(),children:s.formatMessage({id:"button.save"})})]})]})})},Tn={default:"header-arrow-up-down-icon",des:"header-arrow-down-icon",asc:"header-arrow-up-icon"},vn=e=>(0,Sn.jsx)(Z.Tooltip,{content:(0,Sn.jsx)(Z.Text,{raw:e.tooltipText}),placement:"bottom",theme:"dark",children:e.functionCall?(0,Sn.jsx)(Z.Link,{onClick:t=>{var n;return null===(n=e.functionCall)||void 0===n?void 0:n.call(e,t)},text:e.linkName,href:e.href}):(0,Sn.jsx)(Z.Link,{text:e.linkName,href:e.href,onClick:t=>{t.preventDefault(),t.stopPropagation();const n=window.open(e.href,"_blank");null==n||n.focus()}})},e.linkName),En=e=>{let{proceedings:t,linkGen:n}=e;const s=(0,Q.useIntl)(),o=[{id:"document_type",property:"documentType",size:180,getValue:e=>{var t;return null!==(t=e.documentType)&&void 0!==t?t:""}},{id:"proceeding_nr",property:"proceedingNr",size:130,getValue:e=>{return(t=e).proceedingNr?(0,Sn.jsx)(vn,{linkName:t.proceedingNr,tooltipText:"detailsearch.tooltip.open_proceeding",functionCall:e=>{n(!0,e,void 0,`administrativeActProceeding/${t.proceedingNr}`)}}):(0,Sn.jsx)(Sn.Fragment,{children:"-"});var t}},{id:"doty",property:"document",size:160,getValue:e=>e.document&&null!==e.document?(0,Sn.jsx)(vn,{linkName:e.document,tooltipText:"detailsearch.tooltip.open_document",functionCall:t=>{n(!0,t,"DOCUMENT",e.document)}}):""},{id:"ehr_code",property:"ehrCode",size:130,getValue:e=>e.ehrCode&&null!==e.ehrCode?e.ehrCode.map(((t,s)=>(0,Sn.jsxs)(Sn.Fragment,{children:[(0,Sn.jsx)(vn,{linkName:t,tooltipText:"detailsearch.tooltip.open_building",functionCall:e=>{n(!0,e,"BUILDING",t)}}),s!==e.ehrCode.length-1?(0,Sn.jsx)("span",{children:", "}):""]}))):""},{id:"building_address",property:"buildingAddress",size:160,getValue:e=>e.address&&null!==e.address?e.address.map((e=>(0,Sn.jsx)("div",{children:e}))):""},{id:"proceeding_state",property:"state",size:130,getValue:e=>e.state}];return(0,Sn.jsx)(Z.TableComponent,{config:{thead:{headers:o.map((e=>({id:e.id,size:e.size,className:"table-header-field text-align-left",label:s.formatMessage({id:"my_admin_proceedings.table.header."+e.id}),tooltip:{text:s.formatMessage({id:"my_admin_proceedings.table.tooltip."+e.id})},propertyName:e.property,sortable:!0,isShown:!0,type:"input",valueFormatter:t=>e.getValue(t)}))),icons:Tn,expandableRow:!1,isFilter:!1}},data:t,handleEvent:()=>!0})},_n=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const[n,s]=(0,z.useState)(!1),[o,i]=(0,z.useState)(void 0),[r,a]=(0,z.useState)([]);(0,z.useEffect)((()=>{i(void 0),l()}),[e,t]);const l=async()=>{var n;if((null===(n=e.activeRole)||void 0===n?void 0:n.businessType)===Se.TJA){s(!0);try{var o;const n=t?{institutionId:e.activeRole.businessId}:{userId:e.userId},s=await gn.proceedingApiService.findAreaProceedings(n);a(null!==(o=null==s?void 0:s.data)&&void 0!==o?o:[])}catch(e){i("my_admin_proceedings.proceedings_request.error")}finally{s(!1)}}else a([])};return{loading:n,proceedings:r,error:o}},yn=e=>{let{userInfo:t,linkGen:n}=e;const s=(0,Q.useIntl)(),[o,i]=(0,z.useState)(!1),{loading:r,error:a,proceedings:l}=_n(t,o);return(0,Sn.jsxs)(Z.Section,{collapsed:!1,title:"my_admin_proceedings.my_proceedings",showSettings:!0,children:[a&&(0,Sn.jsx)(Z.MessageBlock,{dismissible:!1,theme:"danger",children:s.formatMessage({id:a})}),r&&(0,Sn.jsxs)(Z.Row,{className:"mb-4 justify-content-center",children:[(0,Sn.jsx)("br",{}),(0,Sn.jsx)(Z.Loader,{}),(0,Sn.jsx)("br",{})]}),!r&&!(null==l||!l.length)&&!a&&(0,Sn.jsx)(En,{proceedings:l,linkGen:n}),(0,Sn.jsx)("div",{className:"d-flex justify-content-start my-2",children:(0,Sn.jsx)(Z.Checkbox,{name:"checkbox",onChange:e=>i(e),text:s.formatMessage({id:"my_proceedings.view_all_institution_admin_proceedings"}),checked:o})})]})},bn=e=>{var t;let{userInfo:n,linkGen:s}=e;const o=(0,Q.useIntl)(),i=(null===(t=n.activeRole)||void 0===t?void 0:t.businessType)===Se.TJA;return(0,Sn.jsxs)("div",{children:[(0,Sn.jsx)("h2",{children:o.formatMessage({id:"my_admin_proceedings.page_title"})}),i&&(0,Sn.jsx)("div",{className:"d-flex justify-content-end mt-2",children:(0,Sn.jsx)(Z.Button,{withPlus:!0,type:"submit",onClick:()=>{s(!0,void 0,"","/administrativeActProceeding")},children:o.formatMessage({id:"my_admin_proceedings.new_proceeding"})})}),(0,Sn.jsx)(In,{userInfo:n}),i&&(0,Sn.jsx)(yn,{userInfo:n,linkGen:s})]})};var Dn=c(130),xn=c(558),Mn=c.n(xn);function Nn(e,t,n){const s=n(e).trim(),o=n(t).trim();return s.toLowerCase()===o.toLowerCase()?0:""===s?1:""===o?-1:s.toLowerCase()>o.toLowerCase()?1:-1}function On(e,t,n){const s=n(e),o=n(t);return s===o?0:s>o?1:-1}function An(e){if("0"===e.done&&"0"===e.all)return 15;if(e.done===e.all)return 9;let t=parseInt(e.done)/parseInt(e.all);return 1===t&&(t+=parseInt(e.all)/1e4),t}function Un(e,t,n){const s=n(e),o=n(t),i=An(s),r=An(o);return r===i?0:i>r?1:-1}function wn(e,t,n){const s=n(e),o=n(t);return s===o?0:s>o?1:-1}function jn(e,t,n){if(0===e.length)return e;const s={string:Nn,number:On,object:Un,date:wn}[typeof t(e[0])];return[...e].sort(((e,o)=>s(e,o,t)*n))}const Cn=0,Ln=1,Pn=-1;function Rn(e,t){return{column:e,direction:e===t.column?function(e){switch(e){case Cn:return Ln;case Ln:return Pn;case Pn:return Ln}}(t.direction):Ln}}const Kn=e=>-1===e.sortDirection?(0,Sn.jsx)("svg",{width:"10",height:"8",viewBox:"0 8 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,Sn.jsx)("path",{d:"M1.55 6.05L5 2.6L8.45 6.05L9.5 5L5 0.5L0.5 5L1.55 6.05ZM1.55 9.95L5 13.4L8.45 9.95L9.5 11L5 15.5L0.5 11L1.55 9.95Z",fill:"#5D6071"})}):1===e.sortDirection?(0,Sn.jsx)("svg",{width:"10",height:"8",viewBox:"0 0 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,Sn.jsx)("path",{d:"M1.55 6.05L5 2.6L8.45 6.05L9.5 5L5 0.5L0.5 5L1.55 6.05ZM1.55 9.95L5 13.4L8.45 9.95L9.5 11L5 15.5L0.5 11L1.55 9.95Z",fill:"#5D6071"})}):(0,Sn.jsx)("svg",{width:"10",height:"16",viewBox:"0 0 10 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,Sn.jsx)("path",{d:"M1.55 6.05L5 2.6L8.45 6.05L9.5 5L5 0.5L0.5 5L1.55 6.05ZM1.55 9.95L5 13.4L8.45 9.95L9.5 11L5 15.5L0.5 11L1.55 9.95Z",fill:"#5D6071"})}),Fn=e=>{const[t,n]=(0,z.useState)(!1);return(0,Sn.jsx)(Sn.Fragment,{children:e.fileId&&(0,Sn.jsx)(Z.ControlledPopover,{content:(0,Sn.jsxs)("div",{style:{width:"250px"},children:[(0,Sn.jsx)("h4",{children:(0,Sn.jsx)(Q.FormattedMessage,{id:"download.file"})}),(0,Sn.jsx)("br",{}),(0,Sn.jsxs)("div",{className:"d-flex justify-content-between mt-2",children:[(0,Sn.jsx)(Z.Button,{colourScheme:"light",type:"reset",squared:!0,children:(0,Sn.jsx)(Q.FormattedMessage,{id:"button.cancel"})}),(0,Sn.jsx)(Z.Button,{className:"float-right",colourScheme:"success",onClick:()=>{e.fileId&&e.fileApi.downloadFile(e.fileId,{responseType:"blob"}).then((e=>{const s=e.headers["content-disposition"];let o="download";if(s){const e=s.match(/filename\*=UTF-8''(.+?)(;|$)/);e&&e.length>=2&&(o=decodeURIComponent(e[1].replace(/\+/g," ")))}const i=new Blob([e.data],{}),r=document.createElement("a");r.download=o,r.href=URL.createObjectURL(i),r.addEventListener("click",(()=>{setTimeout((()=>URL.revokeObjectURL(r.href)),3e4)})),r.click(),n(!t)})).catch((e=>console.log(e)))},squared:!0,type:"submit",children:(0,Sn.jsx)(Q.FormattedMessage,{id:"button.download"})})]})]}),open:t,placement:"bottom-end",toggle:()=>n(!t),children:(0,Sn.jsx)(Z.Icon,{tooltipText:(0,Sn.jsx)(Q.FormattedMessage,{id:"tooltip.download"}),type:"download"})})})};let kn=function(e){return e.DO_DOKUSEIS_ESITATUD="DO_DOKUSEIS_ESITATUD",e.DO_DOKUSEIS_KEHTETU="DO_DOKUSEIS_KEHTETU",e.DO_DOKUSEIS_KOOSTAMISEL="DO_DOKUSEIS_KOOSTAMISEL",e.DO_DOKUSEIS_EELNOU_AKTIIVNE="DO_DOKUSEIS_EELNOU_AKTIIVNE",e.DO_DOKUSEIS_ALLKIRJASTAMISEL="DO_DOKUSEIS_ALLKIRJASTAMISEL",e.DO_DOKUSEIS_MENETLUSES="DO_DOKUSEIS_MENETLUSES",e.DO_DOKUSEIS_MUUTMISEL="DO_DOKUSEIS_MUUTMISEL",e.DO_DOKUSEIS_TAIENDAMISEL="DO_DOKUSEIS_TAIENDAMISEL",e.DO_DOKUSEIS_TYHISTATUD="DO_DOKUSEIS_TYHISTATUD",e.DO_DOKUSEIS_VANA_VERSIOON="DO_DOKUSEIS_VANA_VERSIOON",e.DO_DOKUSEIS_LOOBUTUD="DO_DOKUSEIS_LOOBUTUD",e.DO_DOKUSEIS_ALLKIRJASTATUD="DO_DOKUSEIS_ALLKIRJASTATUD",e.DO_DOKUSEIS_MENETLETUD="DO_DOKUSEIS_MENETLETUD",e.DO_DOKUSEIS_LUBATUD="DO_DOKUSEIS_LUBATUD",e.DO_DOKUSEIS_LUB_TEAV="DO_DOKUSEIS_LUB_TEAV",e.DO_DOKUSEIS_KEELDUTUD="DO_DOKUSEIS_KEELDUTUD",e.DO_DOKUSEIS_TEAVITATUD="DO_DOKUSEIS_TEAVITATUD",e.DO_DOKUSEIS_REG_KANTUD="DO_DOKUSEIS_REG_KANTUD",e.DO_DOKUSEIS_ANTUD="DO_DOKUSEIS_ANTUD",e.DO_DOKUSEIS_KEHTIV="DO_DOKUSEIS_KEHTIV",e.DO_DOKUSEIS_TUNNIST_KEHTETUKS="DO_DOKUSEIS_TUNNIST_KEHTETUKS",e.DO_DOKUSEIS_KOOSK_RINGIL="DO_DOKUSEIS_KOOSK_RINGIL",e.DO_DOKUSEIS_EM_KINNITATUD_AKTUAL="DO_DOKUSEIS_EM_KINNITATUD_AKTUAL",e}({});const Yn=[{code:kn.DO_DOKUSEIS_ESITATUD,value:"Esitatud"},{code:kn.DO_DOKUSEIS_KOOSTAMISEL,value:"Koostamisel"},{code:kn.DO_DOKUSEIS_MENETLUSES,value:"Menetluses"},{code:kn.DO_DOKUSEIS_MUUTMISEL,value:"Muutmisel"},{code:kn.DO_DOKUSEIS_TAIENDAMISEL,value:"Täiendamisel"}],Bn=[{code:kn.DO_DOKUSEIS_KEHTETU,value:"Kehtetu"},{code:kn.DO_DOKUSEIS_REG_KANTUD,value:"Registrisse kantud"},{code:kn.DO_DOKUSEIS_TYHISTATUD,value:"Tühistatud"},{code:kn.DO_DOKUSEIS_LOOBUTUD,value:"Tagasi võetud"}];function Gn(e){const t=(e,t)=>({name:e,type:t});switch(kn[e]){case kn.DO_DOKUSEIS_ESITATUD:return t("Esitatud",pe.INFO);case kn.DO_DOKUSEIS_KEHTETU:return t("Kehtetu",pe.DEFAULT);case kn.DO_DOKUSEIS_KOOSTAMISEL:case kn.DO_DOKUSEIS_EELNOU_AKTIIVNE:return t("Koostamisel",pe.INFO);case kn.DO_DOKUSEIS_ALLKIRJASTAMISEL:return t("Allkirjastamisel",pe.INFO);case kn.DO_DOKUSEIS_MENETLUSES:return t("Menetluses",pe.INFO);case kn.DO_DOKUSEIS_MUUTMISEL:return t("Muutmisel",pe.INFO);case kn.DO_DOKUSEIS_TAIENDAMISEL:return t("Täiendamisel",pe.WARNING);case kn.DO_DOKUSEIS_TYHISTATUD:return t("Tühistatud",pe.DEFAULT);case kn.DO_DOKUSEIS_VANA_VERSIOON:return t("Vana versioon",pe.DEFAULT);case kn.DO_DOKUSEIS_LOOBUTUD:return t("Tagasi võetud",pe.DEFAULT);case kn.DO_DOKUSEIS_ALLKIRJASTATUD:return t("Allkirjastatud",pe.INFO);case kn.DO_DOKUSEIS_MENETLETUD:return t("Menetletud",pe.SUCCESS);case kn.DO_DOKUSEIS_LUBATUD:return t("Lubatud/Teavitatud",pe.SUCCESS);case kn.DO_DOKUSEIS_LUB_TEAV:return t("Lubatud/Teavitatud",pe.WARNING);case kn.DO_DOKUSEIS_KEELDUTUD:return t("Keelatud/Tagasi lükatud",pe.DANGER);case kn.DO_DOKUSEIS_TEAVITATUD:return t("Teavitatud",pe.SUCCESS);case kn.DO_DOKUSEIS_REG_KANTUD:return t("Registrisse kantud",pe.SUCCESS);case kn.DO_DOKUSEIS_ANTUD:return t("Antud",pe.SUCCESS);case kn.DO_DOKUSEIS_EM_KINNITATUD_AKTUAL:case kn.DO_DOKUSEIS_KEHTIV:return t("Kehtiv",pe.SUCCESS);case kn.DO_DOKUSEIS_TUNNIST_KEHTETUKS:return t("Tunnistatud kehtetuks",pe.DEFAULT);case kn.DO_DOKUSEIS_KOOSK_RINGIL:return t("Kooskõlastusringil",pe.INFO);default:return t(e,pe.DEFAULT)}}function Vn(e){let t=[];e===te?t=Yn:e===ne&&(t=Bn);return function(e){return e.map((e=>({id:e.code+"",label:e.value,level:2,children:[],selectable:!0,value:!1})))}(t.sort(((e,t)=>e.value.localeCompare(t.value))))}function Hn(e,t){if(t.documentTypes.length>0&&(e=e.filter((e=>void 0!==e.doty&&t.documentTypes.includes(e.doty)))),t.ehrCode.length>0&&(e=e.filter((e=>{var n;return null===(n=e.ehrCode)||void 0===n?void 0:n.some((e=>{var n;return null!==(n=e.startsWith(t.ehrCode.trim()))&&void 0!==n&&n}))}))),t.buildingName.length>0&&(e=e.filter((e=>{var n;return null===(n=e.buildingName)||void 0===n?void 0:n.some((e=>{var n,s;return null!==(n=null==e||null===(s=e.toLocaleLowerCase())||void 0===s?void 0:s.includes(t.buildingName.toLocaleLowerCase()))&&void 0!==n&&n}))}))),t.wordInAddress.length>0&&(e=e.filter((e=>{var n,s;return null!==(n=null===(s=e.buildingAddress)||void 0===s?void 0:s.some((e=>null==e?void 0:e.toLocaleLowerCase().includes(t.wordInAddress.trim().toLocaleLowerCase()))))&&void 0!==n&&n}))),t.documentNumber.length>0&&(e=e.filter((e=>{var n,s;return null!==(n=null===(s=e.docNr)||void 0===s?void 0:s.includes(t.documentNumber.trim()))&&void 0!==n&&n}))),t.documentStates.length>0&&(e=e.filter((e=>{return(n=e.stateCode)&&[kn.DO_DOKUSEIS_MENETLETUD,kn.DO_DOKUSEIS_LUBATUD,kn.DO_DOKUSEIS_LUB_TEAV,kn.DO_DOKUSEIS_KEELDUTUD,kn.DO_DOKUSEIS_TEAVITATUD,kn.DO_DOKUSEIS_REG_KANTUD,kn.DO_DOKUSEIS_ANTUD,kn.DO_DOKUSEIS_KEHTIV].includes(n)?t.documentStates.includes(kn.DO_DOKUSEIS_REG_KANTUD):e.stateCode&&t.documentStates.includes(e.stateCode);var n}))),t.institutionUsers.length>0&&(e=e.filter((e=>(void 0!==e.presenter||null!==e.presenter)&&t.institutionUsers.find((t=>{var n;return!0===(null===(n=e.connectedPersonId)||void 0===n?void 0:n.includes(t))}))))),t.proceedingNumber.length>0&&(e=e.filter((e=>{var n,s;return null!==(n=null===(s=e.proceedingNr)||void 0===s?void 0:s.includes(t.proceedingNumber.trim()))&&void 0!==n&&n}))),t.institutions.length>0&&(e=e.filter((e=>void 0!==e.institutionId&&t.institutions.includes(e.institutionId)))),!0===t.proceedingMissing&&(e=e.filter((e=>null===e.proceedingNr||void 0===e.proceedingNr))),t.documentDate.from.length>0&&0===t.documentDate.to.length){const n=new Date(t.documentDate.from).getTime();e=e.filter((e=>new Date(Mn()(e.docDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n))}if(t.documentDate.to.length>0&&0===t.documentDate.from.length){const n=new Date(t.documentDate.to).getTime();e=e.filter((e=>new Date(Mn()(e.docDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()<=n))}if(t.documentDate.from.length>0&&t.documentDate.to.length>0){const n=new Date(t.documentDate.from).getTime(),s=new Date(t.documentDate.to).getTime();e=e.filter((e=>new Date(Mn()(e.docDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n&&new Date(Mn()(e.docDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()<=s))}return e}function Jn(e){return null!=e}function Wn(e,t){return Object.keys(e).find((n=>e[n]===Object.values(e).find((e=>e.includes(t)))))}function qn(e){var t,n,s,o;const[i,r]=(0,z.useState)(!1);function a(){r(!i)}const l=(0,Sn.jsxs)("div",{children:[(0,Sn.jsx)("h4",{children:(0,Sn.jsx)(Q.FormattedMessage,{defaultMessage:"Kas olete kindel, et soovite selle rea kustutada?",id:null!==(t=e.titleText)&&void 0!==t?t:"common.confirmation.modal.header"})}),(0,Sn.jsx)("p",{children:(0,Sn.jsx)(Q.FormattedMessage,{defaultMessage:"Kustutatud ridu ei ole võimalik hiljem taastada",id:null!==(n=e.messageText)&&void 0!==n?n:"common.confirmation.modal.description"})}),(0,Sn.jsxs)("div",{children:[(0,Sn.jsx)(Z.Button,{colourScheme:"light",squared:!0,type:"reset",children:(0,Sn.jsx)(Q.FormattedMessage,{defaultMessage:"Loobun",id:"common.confirmation.modal.no"})}),(0,Sn.jsx)(Z.Button,{className:"float-right",colourScheme:"danger",onClick:()=>(e.onConfirm(),void a()),squared:!0,type:"submit",children:(0,Sn.jsx)(Q.FormattedMessage,{defaultMessage:"Kustutan",id:"common.confirmation.modal.yes"})})]})]});return(0,Sn.jsx)(Z.ControlledPopover,{delegateFocusOnOpen:null===(s=e.delegateFocusOnOpen)||void 0===s||s,className:"popover-confirm",content:e.content||l,open:i,placement:"top-end",theme:"danger",toggle:()=>a(),wrapperClassName:null!==(o=e.wrapperClassName)&&void 0!==o?o:"",children:e.children})}function $n(e){return(0,Sn.jsx)(qn,{titleText:e.titleText,messageText:e.messageText,onConfirm:e.onConfirm,children:(0,Sn.jsx)(Z.Icon,{tooltipText:(0,Sn.jsx)(Q.FormattedMessage,{id:"tooltip.delete"}),type:"delete"})})}const zn=e=>{let{linkName:t,functionCall:n,tooltipText:s}=e;return(0,Sn.jsxs)(Sn.Fragment,{children:[(0,Sn.jsx)(Z.Link,{onClick:e=>null==n?void 0:n(e),text:(0,Sn.jsx)(Z.Text,{raw:t})}),(0,Sn.jsx)(Z.Info,{tooltipText:s})]})};var Xn,Qn=new Uint8Array(16);function Zn(){if(!Xn&&!(Xn="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Xn(Qn)}const es=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;const ts=function(e){return"string"==typeof e&&es.test(e)};for(var ns=[],ss=0;ss<256;++ss)ns.push((ss+256).toString(16).substr(1));const os=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(ns[e[t+0]]+ns[e[t+1]]+ns[e[t+2]]+ns[e[t+3]]+"-"+ns[e[t+4]]+ns[e[t+5]]+"-"+ns[e[t+6]]+ns[e[t+7]]+"-"+ns[e[t+8]]+ns[e[t+9]]+"-"+ns[e[t+10]]+ns[e[t+11]]+ns[e[t+12]]+ns[e[t+13]]+ns[e[t+14]]+ns[e[t+15]]).toLowerCase();if(!ts(n))throw TypeError("Stringified UUID is invalid");return n};const is=function(e,t,n){var s=(e=e||{}).random||(e.rng||Zn)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t){n=n||0;for(var o=0;o<16;++o)t[n+o]=s[o];return t}return os(s)},rs=e=>{let{notificationStyle:t,header:n,link:s,body:o,onCloseNotification:i,isNotClosable:r,customBody:a}=e;const l=(0,Q.useIntl)(),d=null!=a?a:(0,Sn.jsxs)("div",{children:[(0,Sn.jsx)("h3",{className:"alert-heading",children:n}),(0,Sn.jsx)("p",{className:"alert-body mb-0",children:o}),s&&(0,Sn.jsx)("div",{className:"mx-2",children:(0,Sn.jsx)(Z.Link,{onClick:s.onClick,text:l.formatMessage({id:s.text})})})]});return r?(0,Sn.jsx)("div",{id:"danger-toast",className:`alert ${t}`,children:d}):(0,Sn.jsxs)("div",{id:"danger-toast",className:`alert alert-toast-box ${t}`,children:[(0,Sn.jsx)("a",{className:"toast-close icon-close",role:"button","data-toggle":"tooltip","data-tooltip-placement":"bottom","data-tooltip-class":"tooltip-icon","data-tooltip-trigger":"hover focus","data-tooltip-title":"Sulgen","aria-label":"Sulgen","data-animation":"false",onClick:i}),d]})};let as=function(e){return e.Danger="danger",e.Warning="warning",e.Info="info",e.Success="success",e}({});const ls=()=>{const e=(0,Q.useIntl)(),t=(0,Dn.useDispatch)(),n=(0,Dn.useSelector)(V),[s,o]=(0,z.useState)();(0,z.useEffect)((()=>{n&&o(n)}),[n]);const i=t=>{if(t)return"string"==typeof t?e.formatMessage({id:t}):t.values?e.formatMessage({id:t.id},{...t.values}):e.formatMessage({id:t.id})};return(0,Sn.jsx)(Sn.Fragment,{children:(0,Sn.jsx)("div",{className:"notification-alert-box",children:(0,Sn.jsx)("ul",{children:(null==s?void 0:s.length)>0&&s.map((e=>{var n;return(0,Sn.jsx)("li",{children:e.theme&&(0,Sn.jsx)(rs,{notificationStyle:"alert-"+e.theme+" show",header:i(null!==(n=e.messageCode)&&void 0!==n?n:e.header),body:e.messageCode?void 0:i(e.body),onCloseNotification:()=>{return n=e.id,void t(W(n));var n},link:e.link})},e.id)}))})})})},ds=(0,p.createAsyncThunk)("globalUI/handleNotification",(async(e,t)=>{let{dispatch:n,getState:s}=t;const o=s().myViewsPage.notifications.notices,i=is(),r={...e,id:i};n(J([...o,r])),e.theme!==as.Danger&&setTimeout((()=>{n(W(i))}),7e3)})),cs=(0,p.createAsyncThunk)("document/createDocument",(async(e,t)=>{let{addEntityDto:n,successCallback:s}=e,{dispatch:o}=t;try{const e=await gn.documentApiService.createDocument(n.documentType,n);return s&&s(e.data),o(H()),e.data}catch(e){o(ds({header:"request.error.create_document.title",body:"request.error.create_document.message",theme:as.Danger}))}})),us=e=>{var t;let{doty:n,documentId:s,linkGen:o,userInfo:i}=e;const r=(0,Dn.useDispatch)(),[a,l]=(0,z.useState)(!1),d=(null==i||null===(t=i.activeRole)||void 0===t?void 0:t.businessType)===Se.TJA,c=(e,t)=>{if(!t)return;r(cs({addEntityDto:{documentType:t,baseDocumentId:s},successCallback:t=>((e,t)=>{const n=`${e.documentTypeWithYear}/${e.documentNumber}`;e&&o(!0,t,ge,n)})(t,e)}))};return(0,Sn.jsx)(Z.ControlledPopover,{content:(()=>{const e=n,t=Me[e],s=Ne[e];return(0,Sn.jsxs)("div",{children:[(0,Sn.jsxs)("ul",{children:[(0,Sn.jsx)("li",{className:"d-flex justify-content-between",children:(0,Sn.jsx)(zn,{linkName:"my_documents.document_table.more_actions.request_document_cancellation",tooltipText:`my_documents.document_table.more_actions.request_document_cancellation.tooltip.${e}`,functionCall:e=>{c(e,s),l(!a)}})}),d&&(0,Sn.jsx)("li",{className:"d-flex justify-content-between",children:(0,Sn.jsx)(zn,{linkName:"my_documents.document_table.more_actions.cancel_document",tooltipText:`my_documents.document_table.more_actions.cancel_document.tooltip.${e}`,functionCall:e=>{c(e,t),l(!a)}})})]}),(0,Sn.jsx)(Z.Button,{onClick:()=>{l(!1)},squared:!0,colourScheme:"light",children:(0,Sn.jsx)(Q.FormattedMessage,{id:"button.cancel"})})]})})(),open:a,placement:"bottom-end",toggle:()=>l(!a),children:(0,Sn.jsx)("div",{className:"pl-2",children:(0,Sn.jsx)(Z.Icon,{tooltipText:(0,Sn.jsx)(Q.FormattedMessage,{id:"tooltip.more_actions"}),type:"more"})})})},ps=e=>{var t;let{linkGen:n,userInfo:s,documentType:o,onAllUsersChecked:i,isAllUsersChecked:r,filter:a,onDocumentDelete:l,fileApi:d,hidePresenter:c}=e;const u=(0,Q.useIntl)(),[p,h]=(0,z.useState)({offset:0,limit:10}),[m,g]=(0,z.useState)([]),[S,f]=(0,z.useState)({column:0,direction:Cn}),[I,T]=(0,z.useState)(!1),[v,E]=(0,z.useState)(!1),[_,y]=(0,z.useState)(!1),b=(0,Dn.useSelector)((e=>e.myViewsPage.myDocuments.workingDocuments)),D=(0,Dn.useSelector)((e=>e.myViewsPage.myDocuments.signingDocuments)),x=(0,Dn.useSelector)((e=>e.myViewsPage.myDocuments.finishedDocuments)),M=(0,Dn.useSelector)((e=>e.myViewsPage.myProceedings.incomingDocuments)),N=(null===(t=s.activeRole)||void 0===t?void 0:t.businessType)!==Se.A;(0,z.useEffect)((()=>{b&&o===te&&(Object.keys(a).length>0?(g(Hn(b,a)),h({offset:0,limit:10})):g(b))}),[b,a]),(0,z.useEffect)((()=>{D&&o===ee&&(Object.keys(a).length>0?(g(Hn(D,a)),h({offset:0,limit:10})):g(D))}),[D,a]),(0,z.useEffect)((()=>{x&&o===ne&&(Object.keys(a).length>0?(g(Hn(x,a)),h({offset:0,limit:10})):g(x))}),[x,a]),(0,z.useEffect)((()=>{M&&o===se&&(Object.keys(a).length>0?(g(Hn(M,a)),h({offset:0,limit:10})):g(M))}),[M,a]);const O=["my_documents.doc_date","my_documents.reg_date","my_documents.doc_nr","my_documents.document_type","my_documents.building_name","my_documents.ehr_code","my_documents.building_address","my_documents.state","my_documents.proceeding_nr"];c||O.push("my_documents.presenter");const A=[e=>Jn(e.docDate)?new Date(Mn()(e.docDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>o===se?Jn(e.deadlineDate)?new Date(Mn()(e.deadlineDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER:Jn(e.regDate)?new Date(Mn()(e.regDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>{var t;return null!==(t=e.docNr)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.documentType)&&void 0!==t?t:""},e=>e.buildingName&&Jn(e.buildingName[0])?e.buildingName[0]:"",e=>e.ehrCode&&Jn(e.ehrCode[0])?e.ehrCode[0]:"",e=>e.buildingAddress&&Jn(e.buildingAddress[0])?e.buildingAddress[0]:"",e=>{var t;return null!==(t=e.state)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.proceedingNr)&&void 0!==t?t:""},e=>e.presenter?e.presenter.join(","):""];const U=e=>{var t;const i=[(0,Sn.jsx)(Fn,{fileApi:d,fileId:e.generatedFileId,docNr:null!==(t=e.docNr)&&void 0!==t?t:""},e.docId+"download")];return o===te&&e.stateCode===kn.DO_DOKUSEIS_KOOSTAMISEL?i.push((0,Sn.jsx)($n,{onConfirm:()=>{l(e.docNr)},titleText:"my_documents.delete_document_confirmation.modal.header",messageText:"my_documents.delete_document_confirmation.modal.message"},e.docNr)):o===ne&&e.doty&&xe.includes(e.doty)&&e.stateCode!==kn.DO_DOKUSEIS_TYHISTATUD&&i.push((0,Sn.jsx)(us,{doty:e.doty,documentId:e.docId,linkGen:n,userInfo:s})),i};return(0,Sn.jsxs)(Z.Section,{form:!0,children:[m&&(0,Sn.jsx)(Z.CollapseTable,{content:m.slice(p.offset,p.offset+p.limit).map((e=>{var t,s,i,r,a,l,d;return(0,Sn.jsx)(Z.CollapseTableRow,{fields:[e.docDate,o===se?Mn()(e.deadlineDate,"DD.MM.YYYY").valueOf()<Mn()().valueOf()?(0,Sn.jsx)("div",{className:"red-text",children:null===(t=e.deadlineDate)||void 0===t?void 0:t.toString()}):e.deadlineDate:e.regDate,(0,Sn.jsx)(Z.Tooltip,{content:(0,Sn.jsx)(Z.Text,{raw:"my_documents.tooltip.open_document"}),placement:"bottom",theme:"dark",children:(0,Sn.jsx)(Z.Link,{onClick:t=>{n(!0,t,ge,e.docNr)},text:e.docNr,href:n(!1,void 0,ge,e.docNr)})},e.docNr),e.documentType,e.buildingName?(0,Sn.jsx)("div",{children:_?(0,Sn.jsxs)("div",{children:[e.buildingName.map(((e,t)=>(0,Sn.jsxs)(X().Fragment,{children:[e,";",(0,Sn.jsx)("br",{})]},t))),e.buildingName.length>5&&(0,Sn.jsx)(Z.Link,{type:"hide",onClick:e=>{e.preventDefault(),y(!_)},text:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_documents.link.view_less_building_names"})})]}):1===e.buildingName.length?e.buildingName:(0,Sn.jsxs)("div",{children:[null===(s=e.buildingName)||void 0===s?void 0:s.slice(0,4).map(((e,t)=>(0,Sn.jsxs)(X().Fragment,{children:[e,";",(0,Sn.jsx)("br",{})]},t))),null===(i=e.buildingName)||void 0===i?void 0:i.slice(4,5),e.buildingName.length>5?" ...":"",e.buildingName.length>5&&(0,Sn.jsx)("div",{className:"pr-3",children:(0,Sn.jsx)(Z.Link,{type:"show",onClick:e=>{e.preventDefault(),y(!_)},text:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_documents.link.view_all_building_names"})})})]})}):"",e.ehrCode?(0,Sn.jsx)("div",{children:v?(0,Sn.jsxs)("div",{children:[e.ehrCode.map(((e,t)=>(0,Sn.jsxs)(X().Fragment,{children:[(0,Sn.jsx)(vn,{linkName:e,tooltipText:"my_documents.tooltip.open_building",functionCall:t=>{n(!0,t,he,e)},href:n(!1,void 0,he,e)}),(0,Sn.jsx)("br",{})]},t))),e.ehrCode.length>5&&(0,Sn.jsx)(Z.Link,{type:"hide",onClick:e=>{e.preventDefault(),E(!v)},text:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_documents.link.view_less_ehrCodes"})})]}):(0,Sn.jsxs)("div",{children:[null===(r=e.ehrCode)||void 0===r?void 0:r.slice(0,4).map(((e,t)=>(0,Sn.jsxs)(X().Fragment,{children:[(0,Sn.jsx)(vn,{linkName:e,tooltipText:"my_documents.tooltip.open_building",functionCall:t=>{n(!0,t,he,e)},href:n(!1,void 0,he,e)}),(0,Sn.jsx)("br",{})]},t))),null===(a=e.ehrCode)||void 0===a?void 0:a.slice(4,5).map((e=>(0,Sn.jsx)(vn,{linkName:e,tooltipText:"my_documents.tooltip.open_building",functionCall:t=>{n(!0,t,he,e)},href:n(!1,void 0,he,e)}))),e.ehrCode.length>5?" ...":"",e.ehrCode.length>5&&(0,Sn.jsx)("div",{className:"pr-3",children:(0,Sn.jsx)(Z.Link,{type:"show",onClick:e=>{e.preventDefault(),E(!v)},text:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_documents.link.view_all_ehrCodes"})})})]})}):"",e.buildingAddress?(0,Sn.jsx)("div",{children:I?(0,Sn.jsxs)("div",{children:[e.buildingAddress.map(((e,t)=>(0,Sn.jsxs)(X().Fragment,{children:[e,";",(0,Sn.jsx)("br",{})]},t))),e.buildingAddress.length>5&&(0,Sn.jsx)(Z.Link,{type:"hide",onClick:e=>{e.preventDefault(),T(!I)},text:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_documents.link.view_less_addresses"})})]}):1===e.buildingAddress.length?e.buildingAddress:(0,Sn.jsxs)("div",{children:[null===(l=e.buildingAddress)||void 0===l?void 0:l.slice(0,4).map(((e,t)=>(0,Sn.jsxs)(X().Fragment,{children:[e,";",(0,Sn.jsx)("br",{})]},t))),null===(d=e.buildingAddress)||void 0===d?void 0:d.slice(4,5),e.buildingAddress.length>5?" ...":"",e.buildingAddress.length>5&&(0,Sn.jsx)("div",{className:"pr-3",children:(0,Sn.jsx)(Z.Link,{type:"show",onClick:e=>{e.preventDefault(),T(!I)},text:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_documents.link.view_all_addresses"})})})]})}):"",e.stateCode?(0,Sn.jsx)(Z.Status,{type:Gn(e.stateCode).type,children:Gn(e.stateCode).name}):"",o===ee?(0,Sn.jsx)(Z.Tooltip,{content:(0,Sn.jsx)(Z.Text,{raw:"my_documents.tooltip.open_proceeding"}),placement:"bottom",theme:"dark",children:(0,Sn.jsx)(Z.Link,{onClick:t=>{n(!0,t,me,e.proceedingNr)},text:e.proceedingNr,href:n(!1,void 0,me,e.proceedingNr)})},e.proceedingNr):e.proceedingNr,e.presenter?e.presenter.map(((t,n)=>(0,Sn.jsxs)("div",{children:[t,n!==e.presenter.length-1?(0,Sn.jsx)("span",{children:", "}):""]}))):""],tools:U(e),editable:!0},e.docId)})),headers:function(){const e=[...O];return e[1]="my_documents.deadline",(o===se?e:O).map(((e,t)=>(0,Sn.jsxs)("div",{children:[(0,Sn.jsx)("a",{className:"link-gray",style:{paddingRight:"2px"},onClick:()=>{const e=Rn(t,S);f(e),e.direction!==Cn&&g(jn(m,A[t],e.direction))},children:S.column===t?(0,Sn.jsx)(Kn,{sortDirection:S.direction}):(0,Sn.jsx)(Kn,{sortDirection:Cn})}),u.formatMessage({id:e})]})))}(),paginationEnabled:!0,pager:{offset:p.offset,limit:p.limit,total:m.length},onPaginationReload:h,editable:!0}),(0,Sn.jsx)(Z.Row,{children:N&&o!==se?(0,Sn.jsx)(Z.Col,{children:(0,Sn.jsx)(Z.Checkbox,{name:"checkbox",onChange:e=>i(e),text:(0,Sn.jsx)(Z.Text,{raw:"my_documents.view_all_institution_documents"}),checked:r})}):(0,Sn.jsx)(Z.Col,{})})]})};var hs=c(572);function ms(e,t,n,s,o){return s?(0,Sn.jsx)(Z.FieldWrapper,{labelCol:o,component:(0,Sn.jsxs)(hs.Row,{className:"w-100 px-0 mx-0",children:[(0,Sn.jsx)(hs.Col,{md:1,className:"mr-3 pl-0",children:(0,Sn.jsx)(Z.Checkbox,{"data-testid":"checkbox",info:{content:s,placement:"top-start"},name:"checkbox",text:"",checked:e})}),(0,Sn.jsx)(hs.Col,{className:"px-0 ",children:(0,Sn.jsx)(Z.Text,{raw:(0,Sn.jsx)(Q.FormattedMessage,{id:n})})})]}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"label.empty"})}):(0,Sn.jsx)(Z.FieldWrapper,{labelCol:o,component:(0,Sn.jsx)(Z.Checkbox,{"data-testid":"checkbox",name:"checkbox",onChange:e=>t(e),text:(0,Sn.jsx)(Z.Text,{raw:(0,Sn.jsx)(Q.FormattedMessage,{id:n})}),checked:e}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"label.empty"})})}const gs=["110","11002","111","11119","11129","11139","11149","11158","11159","11191","11199","112","11201","11202","11203","11204","11205","11206","11211","11212","11213","11214","11219","11229","11231","11232","11233","11234","11239","11241","11249","11251","11271","11272","11273","11274","11275","11291","11299","113","11301","11302","11303","11304","11305","11306","11311","11312","11313","11314","11318","11319","11328","11329","11331","11332","11333","11334","11338","11339","11341","11348","11349","11351","11359","11371","11381","11391","11399","114","11411","11412","11413","11430","115","11511","11512","11513","11514","11515","11516","11518","11521","11522","11523","11524","11525","11526","11527","11531","11542","11551","11561","11563","11564","11565","11566","11567","11569","11571","11573","11574","11576","11577","11578","11581","11582","11584","11601","118","11802","11811","11821","11831","120","121","12119","12129","12139","12149","12158","12159","12199","122","12211","12212","12213","12214","12219","12229","12231","12232","12233","12234","12239","12241","12249","12251","12271","12291","12299","123","12311","12312","12313","12314","12318","12319","12328","12329","12331","12332","12333","12334","12338","12339","12341","12348","12349","12351","12359","12371","12381","12391","12399","127","12711","12731","12741","12742","12743","12744","12745","12899","129","12902","12911","12912","12921","12922","12931","12932","12942","12972","12973","12971","12974","12975","12976","12977","12978","12994","12999","130","13001","13002","13003","13009","131","13101","900","91511","91561","92731","92741","92743","92744","92745","11583"];function Ss(e){return function(e){let t={id:"0",label:"00000",parentId:"0",level:1,value:!1,selectable:!1,children:[]};for(let n of e){let e=n.id.toString(),s=t;for(let t=1;t<=n.id;t++)if(s.children){let n=s.children.find((n=>n.id.toString()===e.slice(0,t)));n&&(s=n)}s.children&&s.children.push({id:e+"",parentId:s.id,label:n.name+(null!==n.validTo&&Mn()(n.validTo).isBefore(Mn()(new Date))?" (kuni "+Mn()(n.validTo).format("DD.MM.YYYY")+")":""),level:s.level+1,children:[],selectable:!0,value:!1})}return t.children?t.children:[]}(e.filter((e=>gs.includes(e.id.toString()))).sort(((e,t)=>e.id-t.id)))}function fs(e){return function(e){return e.map((e=>({id:e.id+"",label:e.firstName+" "+e.lastName+" ("+e.personalCode+")",level:2,children:[],selectable:!0,value:!1})))}(e.sort(((e,t)=>e.firstName.localeCompare(t.firstName))))}function Is(e){return function(e){return e.map((e=>({id:e.id+"",label:e.regName,level:2,children:[],selectable:!0,value:!1})))}(e.sort(((e,t)=>e.regName.localeCompare(t.regName))))}function Ts(e){var t,n,s,o;return(0,Sn.jsxs)("div",{className:"d-flex align-items-center",children:[(0,Sn.jsx)("div",{className:"range--from",style:{flexGrow:1},children:(0,Sn.jsx)(Z.DatePicker,{disabled:null!==(t=e.disabled)&&void 0!==t&&t,maxLength:e.maxLength,onBlur:(t,n)=>e.onBlur?e.onBlur(t,n):null,onChange:(t,n)=>function(t,n){const s={...e.value};s.from=t,e.onChange(s,n)}(t,n),onFocus:(t,n)=>e.onFocus?e.onFocus(t,n):null,value:null===(n=e.value)||void 0===n?void 0:n.from})}),(0,Sn.jsx)("span",{className:"px-1",children:"—"}),(0,Sn.jsx)("div",{className:"range--to",style:{flexGrow:1},children:(0,Sn.jsx)(Z.DatePicker,{disabled:null!==(s=e.disabled)&&void 0!==s&&s,maxLength:e.maxLength,onBlur:(t,n)=>e.onBlur?e.onBlur(t,n):null,onChange:(t,n)=>function(t,n){const s={...e.value};s.to=t,e.onChange(s,n)}(t,n),onFocus:(t,n)=>e.onFocus?e.onFocus(t,n):null,value:null===(o=e.value)||void 0===o?void 0:o.to})})]})}const vs=e=>{const t=(0,Q.useIntl)(),n=/^[\\s0-9]{0,9}$/,s=/^([\\s0-9]{5}:[\\s0-9]{3}:[\\s0-9]{1,4}|[\\s0-9]{5}:[\\s0-9]{1,3}|[\\s0-9]{1,5})$/,o={documentTypes:[],ehrCode:"",buildingName:"",wordInAddress:"",documentNumber:"",cadastralNumber:"",documentStates:[],institutionUsers:[],proceedingNumber:"",institutions:[],proceedingMissing:!1,documentDate:{from:"",to:""}},[i,r]=(0,z.useState)(o);(0,z.useEffect)((()=>{Object.keys(e.filterState).length>0&&r(e.filterState)}),[e.documentType]);const[a,l]=(0,z.useState)(!0),[d,c]=(0,z.useState)(!0),[u,p]=(0,z.useState)(""),[h,m]=(0,z.useState)([]),[g,S]=(0,z.useState)([]),[f,I]=(0,z.useState)([]),[T,v]=(0,z.useState)(Vn(e.documentType)),[E,_]=(0,z.useState)([]),y=(0,Dn.useSelector)((e=>e.myViewsPage.filter.documentTypes)),b=(0,Dn.useSelector)((e=>e.myViewsPage.filter.institutionUsers)),D=(0,Dn.useSelector)((e=>e.myViewsPage.filter.institutions));function x(e){return n.test(e)}function M(e,t){let n;e.selectedData.length>0?(n=void 0!==e.selectedData[0].data?e.selectedData[0].data:e.selectedData,n=n.map((e=>e.id.length<5?e.children.map((e=>e.id)):e.id)).flat()):n=[],i[t]=n,r((e=>({...e})))}function N(e,t){var n;i[t]=e,"ehrCode"===t&&x(e)?l(!0):"cadastralNumber"===t&&(0===(n=e).length||s.test(n))&&c(!0),r((e=>({...e})))}(0,z.useEffect)((()=>{v(Vn(e.documentType))}),[e.documentType]),(0,z.useEffect)((()=>{if(y){const e=Ss(y);m(e)}if(b&&e.isKov){const e=fs(b?[...b]:[]);I(e)}if(D){const e=Is([...D]);S(e)}}),[y,b,D]);return(0,Sn.jsxs)(Z.Form,{onSubmit:()=>e.onSubmit(i),children:[(0,Sn.jsxs)(Z.Row,{className:"align-items-start",children:[(0,Sn.jsxs)(Z.Col,{sm:10,className:"mx-0 px-0",children:[(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)(Z.Multiselect,{name:"multiselect",options:h,onSelect:e=>M(e,"documentTypes"),allSelection:!0,onRemoveItem:e=>M(e,"documentTypes"),value:i.documentTypes,selectedOptions:E}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_documents.filter.label.document_type"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.document_type",placement:"top-start"}}),(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)(Z.Input,{name:"input",onChange:e=>N(e,"buildingName"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.buildingName}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_documents.filter.label.building_name"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.building_name",placement:"top-start"}}),(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)(Z.Input,{name:"input",onChange:e=>N(e,"documentNumber"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.documentNumber}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_documents.filter.label.document_number"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.document_number",placement:"top-start"}}),e.documentType!==se&&e.documentType!==ee&&(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)(Z.Multiselect,{name:"multiselect",options:T,onSelect:e=>M(e,"documentStates"),allSelection:!0,onRemoveItem:e=>M(e,"documentStates"),value:i.documentStates,selectedOptions:E}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_documents.filter.label.document_state"}),labelCol:{sm:20,md:8,lg:8}}),(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)(Z.Input,{name:"input",onChange:e=>N(e,"proceedingNumber"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.proceedingNumber}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_documents.filter.label.proceeding_number"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.proceeding_number",placement:"top-start"}}),ms(i.proceedingMissing,(function(e){r((t=>({...t,proceedingMissing:e})))}),"my_documents.filter.label.proceeding_missing","my_documents.filter.tooltip.proceeding_missing"),(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)(Ts,{onChange:e=>(e=>{""!==e.from&&!Mn()(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!Mn()(e.to,"YYYY-MM-DD",!0).isValid()?p(t.formatMessage({id:"filter.invalid_date_format"})):""!==e.from&&""!==e.to&&e.from>e.to?p(t.formatMessage({id:"filter.invalid_date_range"})):p(""),r((t=>({...t,documentDate:e})))})(e),value:i.documentDate}),errorMessage:u.length>0?u:null,label:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_documents.filter.label.document_date"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.document_date",placement:"top-start"}})]}),(0,Sn.jsxs)(Z.Col,{sm:10,className:"mx-0 px-0",children:[(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)(Z.Input,{name:"input",onChange:e=>N(e,"ehrCode"),onBlur:e=>l(x(e.trim())),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.ehrCode}),errorMessage:!a&&(0,Sn.jsx)(Z.Text,{raw:"filter.invalid_building_code"}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_documents.filter.label.ehrCode"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.ehrCode",placement:"top-start"}}),(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)(Z.Input,{name:"input",onChange:e=>N(e,"wordInAddress"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.wordInAddress}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_documents.filter.label.word_in_address"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.word_in_address",placement:"top-start"}}),e.documentType!==se&&e.documentType!==ee&&e.isKov&&(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)(Z.Multiselect,{name:"multiselect",options:f,onSelect:e=>M(e,"institutionUsers"),allSelection:!0,onRemoveItem:e=>M(e,"institutionUsers"),value:i.institutionUsers,selectedOptions:E}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_documents.filter.label.institution_users"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.institution_users",placement:"top-start"}}),e.documentType!==se&&(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)(Z.Multiselect,{name:"multiselect",options:g,onSelect:e=>M(e,"institutions"),allSelection:!0,onRemoveItem:e=>M(e,"institutions"),value:i.institutions,selectedOptions:E}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_documents.filter.label.institution"}),labelCol:{sm:20,md:8,lg:8}}),e.isKov&&e.documentType===ee&&(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)(Z.Multiselect,{name:"multiselect",options:f,onSelect:e=>M(e,"institutionUsers"),allSelection:!0,onRemoveItem:e=>M(e,"institutionUsers"),value:i.institutionUsers,selectedOptions:E}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_documents.filter.label.institution_users"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_documents.filter.tooltip.institution_users",placement:"top-start"}})]})]}),(0,Sn.jsxs)(Z.Row,{children:[(0,Sn.jsx)(Z.Col,{children:(0,Sn.jsx)(Z.Button,{onClick:()=>(_([]),void r(o)),colourScheme:"light",squared:!0,children:(0,Sn.jsx)(Q.FormattedMessage,{id:"button.epmty_fields"})})}),(0,Sn.jsx)(Z.Col,{children:(0,Sn.jsx)(Z.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!(a&&d),squared:!0,children:(0,Sn.jsx)(Q.FormattedMessage,{id:"button.search"})})})]})]})},Es=["11566","11567","11569","11576","11577"],_s=e=>{const[t,n]=(0,z.useState)(!1),[s,o]=(0,z.useState)(""),[i,r]=(0,z.useState)(!1),[a,l]=(0,z.useState)([]),d=(0,Dn.useSelector)((e=>e.myViewsPage.myDocuments.allowedDocumentTypesToStart)),c=e=>null==e||Number.isNaN(e)||"object"==typeof e&&0===Object.keys(e).length||"string"==typeof e&&0===e.trim().length;(0,z.useEffect)((()=>{if(d){const e=d.filter((e=>!Es.includes(e.code)));l(e.map((e=>({code:e.code,texts:e.value}))))}}),[d]);return(0,Sn.jsx)(Z.ControlledPopover,{maxWidth:900,open:t,content:(0,Sn.jsx)("div",{style:{width:"600px"},children:(0,Sn.jsxs)(Z.Form,{onSubmit:()=>{r(!0)},children:[(0,Sn.jsx)("h2",{children:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_documents.popover.title.composing_new_document"})}),(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)(Z.Select,{filterable:!0,placeholder:"placeholder.choose",name:"role",onChange:e=>o(e),options:a,value:s}),errorMessage:i&&c(s)&&(0,Sn.jsx)(Z.Text,{raw:"common.select.required"}),label:(0,Sn.jsx)(Z.Text,{raw:"my_documents.popover.label.new_document_type"}),name:"documentType",info:{content:"my_documents.popover.tooltip.document_type"}}),(0,Sn.jsxs)("div",{className:"d-flex justify-content-between mt-2",children:[(0,Sn.jsx)(Z.Button,{colourScheme:"light",onClick:()=>{r(!1),o("")},children:(0,Sn.jsx)(Q.FormattedMessage,{id:"button.cancel"})}),(0,Sn.jsx)(Z.Button,{className:"float-right",colourScheme:"success",onClick:t=>{c(s)||(e.linkGen(!0,t,"DOCUMENT","",{doty:s}),n(!1))},children:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_documents.popover.button.compose_new_document"})})]})]})}),placement:"bottom-end",toggle:()=>{n(!t)},children:(0,Sn.jsx)(Z.Button,{withPlus:!0,colourScheme:"info",onClick:()=>{n(!t)},children:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_documents.button.start_new_document"})})})},ys=["11273","11272","11274","11275","11002","11051","11201","11271","11301","11371","11412","11413","11430","11522","11525","11527","11542","11566","11567","11569","11571","11576","11577","11581","11582","11584","11831","12731","12743","12744","12745","12899","12922","12932","12942","12973","12975","12976","12977","12978","12999","11526","11601","11583"],bs=["11273","11272","11274","11275","11002","11051","11201","11271","11301","11371","11412","11413","11430","11522","11525","11527","11542","11566","11567","11569","11571","11573","11574","11576","11577","11581","11582","11584","11831","12731","12743","12744","12745","12899","12922","12932","12942","12951","12952","12953","12973","12975","12976","12977","12978","12999","11526","11601","11583"],Ds=["11273","11272","11582","11525","11271","11201","11301","11371","11002","11581","12271","12371","12921","12931","12995","12996","12902","11802","12999","12922","12932","12942","12899","11526","12972","12973"],xs=e=>{var t,n,s,o,i,r,a;let{linkGen:l,userInfo:d}=e;const c=(0,Dn.useDispatch)(),[u,p]=(0,z.useState)({signingDocs:!1,workingDocs:!1,finishedDocs:!1}),[h,m]=(0,z.useState)(!1),[I,T]=(0,z.useState)(!0),[v,x]=(0,z.useState)(!0),[M,N]=(0,z.useState)([]),[O,A]=(0,z.useState)([]),[U,w]=(0,z.useState)([]),[j,C]=(0,z.useState)({}),[L,P]=(0,z.useState)({}),[R,K]=(0,z.useState)({}),F="A"!==(null===(t=d.activeRole)||void 0===t?void 0:t.businessType);const k={userId:null===(n=d.activeRole)||void 0===n?void 0:n.userId,personId:null===(s=d.activeRole)||void 0===s?void 0:s.businessId,dotys:ys,states:[kn.DO_DOKUSEIS_ESITATUD,kn.DO_DOKUSEIS_KOOSTAMISEL,kn.DO_DOKUSEIS_EELNOU_AKTIIVNE,kn.DO_DOKUSEIS_ALLKIRJASTAMISEL,kn.DO_DOKUSEIS_MENETLUSES,kn.DO_DOKUSEIS_TAIENDAMISEL,kn.DO_DOKUSEIS_MUUTMISEL]},Y={userId:null===(o=d.activeRole)||void 0===o?void 0:o.userId,personId:null===(i=d.activeRole)||void 0===i?void 0:i.businessId,dotys:bs,states:[kn.DO_DOKUSEIS_KEHTETU,kn.DO_DOKUSEIS_TUNNIST_KEHTETUKS,kn.DO_DOKUSEIS_REG_KANTUD,"DO_DOKUSEIS_TAGASTATUD",kn.DO_DOKUSEIS_KEELDUTUD,kn.DO_DOKUSEIS_TYHISTATUD,kn.DO_DOKUSEIS_LOOBUTUD,kn.DO_DOKUSEIS_ALLKIRJASTATUD,kn.DO_DOKUSEIS_MENETLETUD,kn.DO_DOKUSEIS_LUBATUD,kn.DO_DOKUSEIS_LUB_TEAV,kn.DO_DOKUSEIS_TEAVITATUD,kn.DO_DOKUSEIS_ANTUD,kn.DO_DOKUSEIS_KEHTIV]},B={userId:null===(r=d.activeRole)||void 0===r?void 0:r.userId,personId:null===(a=d.activeRole)||void 0===a?void 0:a.businessId,roles:["DO_DOKU_ISIK_ROLL_ALLAK"],dotys:Ds,states:[kn.DO_DOKUSEIS_ALLKIRJASTAMISEL]};return(0,z.useEffect)((()=>{var e,t;gn.classifierApiService.getAllDocumentTypes().then((e=>{c(g(e.data))})).catch((e=>{console.log(e)})),gn.institutionKovEndpointApi.getJurKovPersons().then((e=>{c(f(e.data))})).catch((e=>{console.log(e)})),F&&gn.userApiService.getJurUsers(null!==(e=null===(t=d.activeRole)||void 0===t?void 0:t.businessId)&&void 0!==e?e:0).then((e=>{c(S(e.data))})).catch((e=>{console.log(e)})),gn.documentApiService.getDotysBasedOnUserRights().then((e=>{const t=e.data.filter((e=>"12922"!==e.code&&"11412"!==e.code&&"11413"!==e.code&&"12932"!==e.code&&"11430"!==e.code&&"12942"!==e.code));c(D(t))})).catch((e=>{console.log("Following error occured:",e)}))}),[d]),(0,z.useEffect)((()=>{(()=>{const e=k;u.workingDocs&&(e.userId=void 0),T(!0),gn.myDocumentBaseApiService.findWorkingDocuments(e).then((e=>{c(E(e.data)),T(!1),A(e.data)})).catch((e=>{console.log("Following error occured:",e),T(!1)}))})()}),[u.workingDocs,d]),(0,z.useEffect)((()=>{!function(){const e=Y;u.finishedDocs&&(e.userId=void 0),x(!0),gn.myDocumentBaseApiService.findWorkingDocuments(e).then((e=>{c(y(e.data)),x(!1),w(e.data)})).catch((e=>{console.log("Following error occured:",e),x(!1)}))}()}),[u.finishedDocs,d]),(0,z.useEffect)((()=>{!function(){const e=B;u.signingDocs&&(e.userId=void 0),m(!0),gn.myDocumentBaseApiService.findWorkingDocuments(e).then((e=>{c(_(e.data)),m(!1),N(e.data)})).catch((e=>{console.log("Following error occured:",e),m(!1)}))}()}),[u.signingDocs,d]),(0,Sn.jsxs)("div",{children:[(0,Sn.jsx)(ls,{}),(0,Sn.jsx)("div",{className:"d-flex justify-content-end mt-2",children:(0,Sn.jsx)(_s,{linkGen:l})}),F&&(0,Sn.jsx)(Z.Section,{collapsed:!1,title:"my_documents.my_documents_to_sign",showSettings:!0,filterContents:(0,Sn.jsx)(vs,{documentType:ee,filterState:j,onSubmit:e=>C(e),isKov:F}),children:h?(0,Sn.jsx)(Z.SectionLoader,{}):0===M.length?(0,Sn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Sn.jsx)(Z.Text,{raw:"my_documents.signing_documents.no_docs"})}):(0,Sn.jsx)(ps,{linkGen:l,userInfo:d,documentType:ee,onAllUsersChecked:e=>{p({signingDocs:e,workingDocs:u.workingDocs,finishedDocs:u.finishedDocs})},isAllUsersChecked:u.signingDocs,filter:j,fileApi:gn.fileApiService,hidePresenter:!0})}),(0,Sn.jsx)(Z.Section,{collapsed:!1,title:"my_documents.working_documents",showSettings:!0,filterContents:(0,Sn.jsx)(vs,{documentType:te,filterState:L,onSubmit:e=>P(e),isKov:F}),children:I?(0,Sn.jsx)(Z.SectionLoader,{}):0===O.length?(0,Sn.jsxs)("div",{children:[(0,Sn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Sn.jsx)(Z.Text,{raw:"my_documents.working_documents.no_docs"})}),F&&(0,Sn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Sn.jsx)(Z.Link,{text:"my_documents.view_all_institution_documents",onClick:()=>{p({signingDocs:u.signingDocs,workingDocs:!0,finishedDocs:u.finishedDocs})}})}),(0,Sn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Sn.jsx)(_s,{linkGen:l})})]}):(0,Sn.jsx)(ps,{linkGen:l,userInfo:d,documentType:te,onAllUsersChecked:e=>{p({signingDocs:u.signingDocs,workingDocs:e,finishedDocs:u.finishedDocs})},isAllUsersChecked:u.workingDocs,filter:L,onDocumentDelete:e=>function(e){const t=e.slice(0,e.indexOf("/")),n=e.slice(e.indexOf("/")+1);gn.documentApiService.deleteApplicationByNumber(t,n),c(b(e))}(e),fileApi:gn.fileApiService})}),(0,Sn.jsx)(Z.Section,{collapsed:!1,title:"my_documents.finished_documents",showSettings:!0,filterContents:(0,Sn.jsx)(vs,{documentType:ne,filterState:R,onSubmit:e=>K(e),isKov:F}),children:v?(0,Sn.jsx)(Z.SectionLoader,{}):0===U.length?(0,Sn.jsxs)("div",{children:[(0,Sn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Sn.jsx)(Z.Text,{raw:"my_documents.finished_documents.no_docs"})}),F&&(0,Sn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Sn.jsx)(Z.Link,{text:"my_documents.view_all_institution_documents",onClick:()=>{p({signingDocs:u.signingDocs,workingDocs:u.workingDocs,finishedDocs:!0})}})}),(0,Sn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Sn.jsx)(_s,{linkGen:l})})]}):(0,Sn.jsx)(ps,{linkGen:l,userInfo:d,documentType:ne,onAllUsersChecked:e=>{p({signingDocs:u.signingDocs,workingDocs:u.workingDocs,finishedDocs:e}),x(!0)},isAllUsersChecked:u.finishedDocs,filter:R,fileApi:gn.fileApiService})})]})},Ms={MENSEIS_TAIENDAMISEL:["MENSEIS_TAIENDAMISEL","MENSEIS_ESITATUD_TAPSUST","MENSEIS_MEN_EHITUSL_TAOT_TAPS","MENSEIS_MEN_KASUTUSL_TAOT_TAPS","MENSEIS_MEN_EDASTATUD_MARK_LAHEND"],MENSEIS_ALGATATUD:["MENSEIS_ALGATATUD","MENSEIS_ESITATUD"],MENSEIS_KAIMASOLEV:["MENSEIS_KAIMASOLEV","MENSEIS_MEN","MENSEIS_MEN_KNT_TAOT","MENSEIS_EHITUSTEGEVUS_ALANUD","MENSEIS_EHITUSTEGEVUS_LOPPENUD","MENSEIS_EHITUSTEG_LOPP","MENSEIS_LAMMUTATUD","MENSEIS_MEN_EHITUSL_TAOT","MENSEIS_MEN_KASUTUSL_TAOT","MENSEIS_MEN_LAMMUTUSL_TAOT"],MENSEIS_LOPETATUD:["MENSEIS_LOPETATUD","MENSEIS_MEN_ALLKIRJASTATUD","MENSEIS_MEN_KNT_ANTUD","MENSEIS_MEN_KNT_KEELD","MENSEIS_EHITUSL_KEHTETU","MENSEIS_KASUTUSL_KEHTETU","MENSEIS_KNT_KEHTETU","MENSEIS_MEN_EHITUSL_ANTUD","MENSEIS_MEN_EHITUSL_KEELD","MENSEIS_MEN_KASUTUSL_ANTUD","MENSEIS_MEN_KASUTUSL_KEELD","MENSEIS_MEN_LAMMUTUSL_ANTUD","MENSEIS_MEN_LAMMUTUSL_KEELD","MENSEIS_MEN_PRO_TING_ANTUD","MENSEIS_MEN_TEAVITATUD"],MENSEIS_MUUTMISEL:["MENSEIS_MUUTMISEL","MENSEIS_MEN_TAIENDAB"],MENSEIS_PEATATUD:["MENSEIS_PEATATUD"],MENSEIS_ARHIIVIS:["MENSEIS_ARHIIVIS"]};function Ns(e){return Wn(Ms,e)}function Os(e){const t=Ns(e);return t?function(e){switch(e){case"MENSEIS_TAIENDAMISEL":return{name:"Algdokument täiendamisel",type:"warning"};case"MENSEIS_ALGATATUD":return{name:"Algatatud",type:"info"};case"MENSEIS_KAIMASOLEV":return{name:"Käimasolev",type:"info"};case"MENSEIS_LOPETATUD":return{name:"Lõpetatud",type:"success"};case"MENSEIS_MUUTMISEL":return{name:"Algdokument muutmisel",type:"info"};case"MENSEIS_PEATATUD":return{name:"Peatatud",type:"warning"};case"MENSEIS_ARHIIVIS":return{name:"Arhiivis",type:"default"};default:return{name:e,type:"default"}}}(t):{name:e,type:"default"}}const As=[{code:"MENSEIS_TAIENDAMISEL",value:"Algdokument täiendamisel"},{code:"MENSEIS_ALGATATUD",value:"Algatatud"},{code:"MENSEIS_KAIMASOLEV",value:"Käimasolev"},{code:"MENSEIS_LOPETATUD",value:"Lõpetatud"},{code:"MENSEIS_MUUTMISEL",value:"Algdokument muutmisel"},{code:"MENSEIS_PEATATUD",value:"Peatatud"}];function Us(){return As.map((e=>({id:e.code+"",label:e.value,level:2,children:[],selectable:!0,value:!1})))}function ws(e,t){if(console.log("filterService",t),t.documentTypes.length>0&&(e=e.filter((e=>void 0!==e.doty&&t.documentTypes.includes(e.doty)))),t.ehrCode.length>0&&(e=e.filter((e=>{var n;return null===(n=e.ehrCode)||void 0===n?void 0:n.some((e=>{var n;return null!==(n=e.startsWith(t.ehrCode.trim()))&&void 0!==n&&n}))}))),t.buildingName.length>0&&(e=e.filter((e=>{var n;return null===(n=e.buildingName)||void 0===n?void 0:n.some((e=>{var n,s;return null!==(n=null===(s=e.toLocaleLowerCase())||void 0===s?void 0:s.includes(t.buildingName.toLocaleLowerCase()))&&void 0!==n&&n}))}))),t.wordInAddress.length>0&&(e=e.filter((e=>{var n,s;return null!==(n=null===(s=e.address)||void 0===s?void 0:s.some((e=>e.toLocaleLowerCase().includes(t.wordInAddress.trim().toLocaleLowerCase()))))&&void 0!==n&&n}))),t.proceedingNumber.length>0&&(e=e.filter((e=>{var n,s;return null!==(n=null===(s=e.proceedingNr)||void 0===s?void 0:s.includes(t.proceedingNumber.trim()))&&void 0!==n&&n}))),t.proceedingStates.length>0&&(e=e.filter((e=>void 0!==e.stateCode&&t.proceedingStates.includes(Ns(e.stateCode))))),t.connectedPerson.length>0&&(e=e.filter((e=>{var n,s;return null!==(n=null===(s=e.supervisor)||void 0===s?void 0:s.startsWith(t.connectedPerson))&&void 0!==n&&n}))),!1===t.showProceedingInArchive&&(e=e.filter((e=>"Ei"===e.archived))),t.supervisors.length>0&&(e=e.filter((e=>void 0!==e.supervisorId&&t.supervisors.includes(e.supervisorId.toString())))),t.proceedingDate.from.length>0&&0===t.proceedingDate.to.length){const n=new Date(t.proceedingDate.from).getTime();e=e.filter((e=>new Date(Mn()(e.dateStart,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n))}if(t.proceedingDate.to.length>0&&0===t.proceedingDate.from.length){const n=new Date(t.proceedingDate.to).getTime();e=e.filter((e=>new Date(Mn()(e.dateStart,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()<=n))}if(t.proceedingDate.from.length>0&&t.proceedingDate.to.length>0){const n=new Date(t.proceedingDate.from).getTime(),s=new Date(t.proceedingDate.to).getTime();e=e.filter((e=>new Date(Mn()(e.dateStart,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n&&new Date(Mn()(e.dateStart,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()<=s))}if(t.lastEventDate.length>0){const n=new Date(t.lastEventDate).getTime();e=e.filter((e=>e.lastEventDate&&new Date(Mn()(e.lastEventDate).format("YYYY-MM-DD")).getTime()<=n))}return e}function js(){return As.filter((e=>"MENSEIS_TAIENDAMISEL"!==e.code&&"MENSEIS_MUUTMISEL"!==e.code&&"MENSEIS_LOPETATUD"!==e.code&&"MENSEIS_PEATATUD"!==e.code)).map((e=>({id:e.code})))}const Cs=e=>{const t=(0,Q.useIntl)(),[n,s]=(0,z.useState)({offset:0,limit:50}),[o,i]=(0,z.useState)([]),[r,a]=(0,z.useState)({column:5,direction:Ln}),[l,d]=(0,z.useState)(!1),[c,u]=(0,z.useState)(!1),[p,h]=(0,z.useState)(!1),m=(0,Dn.useSelector)((e=>e.myViewsPage.myProceedings.myProceedings)),g=[e=>Jn(e.dateStart)?new Date(Mn()(e.dateStart,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>Jn(e.deadline)?new Date(Mn()(e.deadline,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>{var t;return null!==(t=e.proceedingNr)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.state)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.proceedingCircleNr)&&void 0!==t?t:""},e=>e.operationsCount?{done:e.operationsCount.split("/")[0],all:e.operationsCount.split("/")[1]}:"",e=>Jn(e.innerCommentDeadline)?new Date(e.innerCommentDeadline).getTime():Number.MAX_SAFE_INTEGER,e=>Jn(e.lastEventDate)?new Date(e.lastEventDate).getTime():Number.MAX_SAFE_INTEGER,e=>{var t;return null!==(t=e.document)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.documentType)&&void 0!==t?t:""},e=>e.buildingName&&e.buildingName[0]?e.buildingName[0]:"",e=>e.ehrCode&&e.ehrCode[0]?e.ehrCode[0]:"",e=>e.address&&e.address[0]?e.address[0]:"",e=>{var t;return null!==(t=e.proceedingName)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.supervisor)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.documentPresenter)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.archived)&&void 0!==t?t:""},e=>e.proceedingLength?e.proceedingLength:Number.MAX_SAFE_INTEGER];(0,z.useEffect)((()=>{if(m){const e=5,t=Rn(e,r);t.direction===Cn&&(t.direction=Ln),a(t),i(jn(m,g[e],t.direction))}}),[m]),(0,z.useEffect)((()=>{m&&Object.keys(e.filter).length>0&&(r.direction===Cn?i(ws(m,e.filter)):i(jn(ws(m,e.filter),g[r.column],r.direction)),s({offset:0,limit:50}))}),[e.filter,m]),(0,z.useEffect)((()=>{r&&r.direction!==Cn&&0!==o.length&&i(jn(o,g[r.column],r.direction))}),[r]);const S=["my_proceedings.date_start","my_proceedings.deadline","my_proceedings.proceeding_nr","my_proceedings.state","my_proceedings.proceeding_circle_nr","my_proceedings.operations_count","my_proceedings.inner_comment_deadline","my_proceedings.last_event","my_proceedings.document","my_proceedings.document_type","my_proceedings.building_name","my_proceedings.ehr_code","my_proceedings.address","my_proceedings.proceeding_name","my_proceedings.supervisor","my_proceedings.document_presenter","my_proceedings.archived","my_proceedings.proceeding_length"];return(0,Sn.jsxs)(Z.Section,{form:!0,children:[o&&(0,Sn.jsx)(Z.CollapseTable,{content:(t=>t.slice(n.offset,n.offset+n.limit).map((t=>{var n,s,o,i,r,a;let m={addresses:[],ehrCodes:[],buildingNames:[]};return t.address&&(null===(n=t.address)||void 0===n?void 0:n.length)>1&&(m=function(e,t,n){let s={addresses:[],ehrCodes:[],buildingNames:[]};if(e&&e.length>1){let o=[];for(let s=0;s<e.length;s++){let i=e[s].split(",");o.push({county:i[0],city:i[1]?i[1].trimStart():"",other:i[2]?i[2].trimStart()+","+i[3]:"",ehrCode:t?t[s]:"",buildingName:n?n[s]:""})}const i=o.reduce(((e,t)=>{var n;const{county:s}=t;return e[s]=null!==(n=e[s])&&void 0!==n?n:[],e[s].push(t),e}),{});let r=[];o.forEach((e=>{const t=e.county;r.includes(t)||r.push(t)}));let a=[];o.forEach((e=>{const t=e.city;a.includes(t)||a.push(t)})),r.forEach((e=>{const t=i[e].reduce(((e,t)=>{var n;const{city:s}=t;return e[s]=null!==(n=e[s])&&void 0!==n?n:[],e[s].push(t),e}),{});i[e]=t}));let l=[],d=[],c=[];r.forEach((e=>{a.forEach((t=>{let n="";if(i[e][t]){n+=e+", "+t;for(let s=0;s<i[e][t].length;s++){const o=i[e][t][s];n+=", "+o.other,0===s?l.push(n):l.push(o.other),d.push(o.ehrCode),c.push(o.buildingName)}}}))})),s={addresses:l,ehrCodes:d,buildingNames:c}}return s}(t.address,t.ehrCode,t.buildingName)),(0,Sn.jsx)(Z.CollapseTableRow,{fields:[t.dateStart,Mn()(t.deadline,"DD.MM.YYYY").valueOf()<Mn()().valueOf()?(0,Sn.jsx)("div",{className:"red-text",children:null===(s=t.deadline)||void 0===s?void 0:s.toString()}):t.deadline,(0,Sn.jsx)(Z.Tooltip,{content:(0,Sn.jsx)(Z.Text,{raw:"my_proceedings.tooltip.open_proceeding"}),placement:"bottom",theme:"dark",children:(0,Sn.jsx)(Z.Link,{onClick:n=>{e.linkGen(!0,n,"PROCEEDING",t.proceedingNr)},text:t.proceedingNr,href:e.linkGen(!1,void 0,"PROCEEDING",t.proceedingNr)})},t.proceedingNr),t.stateCode?(0,Sn.jsx)(Z.Status,{type:Os(t.stateCode).type,children:Os(t.stateCode).name}):"",t.proceedingCircleNr,t.operationsCount,t.innerCommentDeadline?Mn()(t.innerCommentDeadline).valueOf()<=Mn()().valueOf()?(0,Sn.jsx)("div",{style:{color:"#00b649"},children:Mn()(t.innerCommentDeadline).format("DD.MM.YYYY")}):Mn()(t.innerCommentDeadline).format("DD.MM.YYYY"):"",t.lastEventDate?Mn()(t.lastEventDate).format("DD.MM.YYYY"):"",(0,Sn.jsx)(vn,{linkName:t.document,tooltipText:"my_proceedings.tooltip.open_document",functionCall:n=>{e.linkGen(!0,n,"DOCUMENT",t.document)}}),t.documentType,t.buildingName&&(null===(o=t.buildingName)||void 0===o?void 0:o.length)>0?(0,Sn.jsx)("div",{children:p?(0,Sn.jsxs)("div",{children:[m.buildingNames.map((e=>(0,Sn.jsxs)(Sn.Fragment,{children:[e,";",(0,Sn.jsx)("br",{})]}))),t.buildingName.length>5&&(0,Sn.jsx)(Z.Link,{type:"hide",onClick:e=>{e.preventDefault(),h(!p)},text:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_proceedings.link.view_less_building_names"})})]}):1===t.buildingName.length?t.buildingName:(0,Sn.jsxs)("div",{children:[null===(i=m.buildingNames)||void 0===i?void 0:i.slice(0,4).map((e=>(0,Sn.jsxs)(Sn.Fragment,{children:[e,";",(0,Sn.jsx)("br",{})]}))),null===(r=m.buildingNames)||void 0===r?void 0:r.slice(4,5),t.buildingName.length>5?" ...":"",t.buildingName.length>5&&(0,Sn.jsx)("div",{className:"pr-3",children:(0,Sn.jsx)(Z.Link,{type:"show",onClick:e=>{e.preventDefault(),h(!p)},text:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_proceedings.link.view_all_building_names"})})})]})}):"",t.ehrCode?(0,Sn.jsx)("div",{children:c?(0,Sn.jsxs)("div",{children:[m.ehrCodes.map((t=>(0,Sn.jsxs)(Sn.Fragment,{children:[(0,Sn.jsx)(vn,{linkName:t,tooltipText:"my_proceedings.tooltip.open_building",functionCall:n=>{e.linkGen(!0,n,"BUILDING",t)},href:e.linkGen(!1,void 0,"BUILDING",t)}),(0,Sn.jsx)("br",{})]}))),t.ehrCode.length>5&&(0,Sn.jsx)(Z.Link,{type:"hide",onClick:e=>{e.preventDefault(),u(!c)},text:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_proceedings.link.view_less_ehrCodes"})})]}):1===t.ehrCode.length?(0,Sn.jsx)(vn,{linkName:t.ehrCode[0],tooltipText:"my_proceedings.tooltip.open_building",functionCall:n=>{e.linkGen(!0,n,"BUILDING",t.ehrCode)},href:e.linkGen(!1,void 0,"BUILDING",t.ehrCode)}):(0,Sn.jsxs)("div",{children:[m.ehrCodes.slice(0,4).map(((t,n)=>(0,Sn.jsxs)(X().Fragment,{children:[(0,Sn.jsx)(vn,{linkName:t,tooltipText:"my_proceedings.tooltip.open_building",functionCall:n=>{e.linkGen(!0,n,"BUILDING",t)},href:e.linkGen(!1,void 0,"BUILDING",t)}),(0,Sn.jsx)("br",{})]},n))),m.ehrCodes.slice(4,5).map((t=>(0,Sn.jsx)(vn,{linkName:t,tooltipText:"my_proceedings.tooltip.open_building",functionCall:n=>{e.linkGen(!0,n,"BUILDING",t)},href:e.linkGen(!1,void 0,"BUILDING",t)}))),t.ehrCode.length>5?" ...":"",t.ehrCode.length>5&&(0,Sn.jsx)("div",{className:"pr-3",children:(0,Sn.jsx)(Z.Link,{type:"show",onClick:e=>{e.preventDefault(),u(!c)},text:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_proceedings.link.view_all_ehrCodes"})})})]})}):"",t.address?(0,Sn.jsx)("div",{style:{width:125},children:l?(0,Sn.jsxs)("div",{children:[m.addresses.map((e=>(0,Sn.jsxs)(Sn.Fragment,{children:[e,";",(0,Sn.jsx)("br",{})]}))),t.address.length>5&&(0,Sn.jsx)(Z.Link,{type:"hide",onClick:e=>{e.preventDefault(),d(!l)},text:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_proceedings.link.view_less_addresses"})})]}):1===t.address.length?t.address:(0,Sn.jsxs)("div",{children:[m.addresses.slice(0,4).map((e=>(0,Sn.jsxs)(Sn.Fragment,{children:[e,";",(0,Sn.jsx)("br",{})]}))),null===(a=m.addresses)||void 0===a?void 0:a.slice(4,5),t.address.length>5?" ...":"",t.address.length>5&&(0,Sn.jsx)("div",{className:"pr-3",children:(0,Sn.jsx)(Z.Link,{type:"show",onClick:e=>{e.preventDefault(),d(!l)},text:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_proceedings.link.view_all_addresses"})})})]})}):"",t.proceedingName,t.supervisor,t.documentPresenter,t.archived,t.proceedingLength]},t.id)})))(o),headers:S.map(((e,n)=>(0,Sn.jsxs)("div",{children:[(0,Sn.jsx)("a",{className:"link-gray",style:{paddingRight:"2px"},onClick:()=>{const e=Rn(n,r);a(e)},children:r.column===n?(0,Sn.jsx)(Kn,{sortDirection:r.direction}):(0,Sn.jsx)(Kn,{sortDirection:Cn})}),t.formatMessage({id:e})]}))),paginationEnabled:!0,pager:{offset:n.offset,limit:n.limit,total:o.length},onPaginationReload:s}),(0,Sn.jsx)(Sn.Fragment,{children:e.isKov?(0,Sn.jsx)("div",{className:"d-flex justify-content-start",children:(0,Sn.jsx)(Z.Checkbox,{name:"checkbox",onChange:t=>e.onAllUsersChecked(t),text:(0,Sn.jsx)(Z.Text,{raw:"my_proceedings.view_all_institution_proceedings"}),checked:e.isAllUsersChecked})}):null})]})},Ls={documentTypes:[],ehrCode:"",buildingName:"",wordInAddress:"",proceedingNumber:"",cadastralNumber:"",proceedingStates:["MENSEIS_ALGATATUD","MENSEIS_KAIMASOLEV"],connectedPerson:"",showProceedingInArchive:!1,supervisors:[],proceedingDate:{from:"",to:""},lastEventDate:""},Ps=e=>{let{onSubmit:t,isKov:n,filterState:s}=e;const o=(0,Q.useIntl)(),i=/^[\\s0-9]{0,9}$/,r=/^([\\s0-9]{5}:[\\s0-9]{3}:[\\s0-9]{1,4}|[\\s0-9]{5}:[\\s0-9]{1,3}|[\\s0-9]{1,5})$/,[a,l]=(0,z.useState)(s),[d,c]=(0,z.useState)(!0),[u,p]=(0,z.useState)(!0),[h,m]=(0,z.useState)(""),[g,S]=(0,z.useState)(""),[f,I]=(0,z.useState)([]),[T,v]=(0,z.useState)([]),[E]=(0,z.useState)(Us()),[_,y]=(0,z.useState)([]),[b,D]=(0,z.useState)(js()),x=(0,Dn.useSelector)((e=>e.myViewsPage.filter.documentTypes)),M=(0,Dn.useSelector)((e=>e.myViewsPage.filter.institutionUsers));function N(e){return i.test(e)}function O(e,t){let n;e.selectedData.length>0?(n=void 0!==e.selectedData[0].data?e.selectedData[0].data:e.selectedData,n=n.map((e=>e.id.length<5?e.children.map((e=>e.id)):e.id)).flat()):n=[],D(n.map((e=>({id:e})))),l((e=>({...e,[t]:n})))}function A(e,t){var n;"ehrCode"===t&&N(e)?c(!0):"cadastralNumber"===t&&(0===(n=e).length||r.test(n))&&p(!0),l((n=>({...n,[t]:e})))}(0,z.useEffect)((()=>{if(x){const e=Ss(x);I(e)}if(M&&n){const e=fs([...M]);v(e)}}),[x,M]);return(0,Sn.jsxs)(Z.Form,{onSubmit:()=>t(a),children:[(0,Sn.jsxs)(Z.Row,{className:"align-items-start",children:[(0,Sn.jsxs)(Z.Col,{sm:10,className:"mx-0 px-0",children:[(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)(Z.Multiselect,{name:"multiselect",options:f,onSelect:e=>O(e,"documentTypes"),allSelection:!0,onRemoveItem:e=>O(e,"documentTypes"),value:a.documentTypes,selectedOptions:_}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_proceedings.filter.label.document_type"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_proceedings.filter.tooltip.document_type",placement:"top-start"}}),(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)(Z.Input,{name:"input",onChange:e=>A(e,"proceedingNumber"),placeholder:o.formatMessage({id:"placeholder.writing"}),value:a.proceedingNumber}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_proceedings.filter.label.proceeding_number"}),labelCol:{sm:20,md:8,lg:8}}),(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)(Z.Multiselect,{name:"multiselect",options:E,onSelect:e=>{O(e,"proceedingStates")},allSelection:!0,onRemoveItem:e=>O(e,"proceedingStates"),value:a.proceedingStates,selectedOptions:b}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_proceedings.filter.label.proceeding_state"}),labelCol:{sm:20,md:8,lg:8}}),ms(a.showProceedingInArchive,(function(e){l((t=>({...t,showProceedingInArchive:e})))}),"my_proceedings.filter.label.show_archived_proceedings"),(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)("div",{className:"daterange_in_form",children:(0,Sn.jsx)(Z.DateRange,{name:"daterange",onChange:e=>(e=>{""!==e.from&&!Mn()(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!Mn()(e.to,"YYYY-MM-DD",!0).isValid()?m(o.formatMessage({id:"filter.invalid_date_format"})):""!==e.from&&""!==e.to&&e.from>e.to?m(o.formatMessage({id:"filter.invalid_date_range"})):m(""),l((t=>({...t,proceedingDate:e})))})(e),value:a.proceedingDate})}),errorMessage:h.length>0?h:null,label:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_proceedings.filter.label.proceeding_date"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_proceedings.filter.tooltip.proceeding_date",placement:"top-start"}}),(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)(Z.DatePicker,{name:"datepicker-field",value:a.lastEventDate,onChange:e=>function(e){""===e||Mn()(e,"YYYY-MM-DD",!0).isValid()?S(""):S(o.formatMessage({id:"filter.invalid_date_format"})),l((t=>({...t,lastEventDate:e})))}(e)}),errorMessage:g.length>0?g:null,label:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_proceedings.filter.label.last_event_date"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_proceedings.filter.tooltip.last_event_date",placement:"top-start"}})]}),(0,Sn.jsxs)(Z.Col,{sm:10,className:"mx-0 px-0",children:[(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)(Z.Input,{name:"input",onChange:e=>A(e,"ehrCode"),onBlur:e=>c(N(e.trim())),placeholder:o.formatMessage({id:"placeholder.writing"}),value:a.ehrCode}),errorMessage:!d&&(0,Sn.jsx)(Z.Text,{raw:"filter.invalid_building_code"}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_proceedings.filter.label.ehrCode"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_proceedings.filter.tooltip.ehrCode",placement:"top-start"}}),(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)(Z.Input,{name:"input",onChange:e=>A(e,"buildingName"),placeholder:o.formatMessage({id:"placeholder.writing"}),value:a.buildingName}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_proceedings.filter.label.building_name"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_proceedings.filter.tooltip.building_name",placement:"top-start"}}),(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)(Z.Input,{name:"input",onChange:e=>A(e,"wordInAddress"),placeholder:o.formatMessage({id:"placeholder.writing"}),value:a.wordInAddress}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_proceedings.filter.label.word_in_address"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_proceedings.filter.tooltip.word_in_address",placement:"top-start"}}),(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)(Z.Input,{name:"input",onChange:e=>A(e,"connectedPerson"),placeholder:o.formatMessage({id:"placeholder.writing"}),value:a.connectedPerson}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_proceedings.filter.label.connected_person"}),labelCol:{sm:20,md:8,lg:8},info:{content:"my_proceedings.filter.tooltip.connected_person",placement:"top-start"}}),n&&(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)(Z.Multiselect,{name:"multiselect",options:T,onSelect:e=>O(e,"supervisors"),allSelection:!0,onRemoveItem:e=>O(e,"supervisors"),value:a.supervisors,selectedOptions:_}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_proceedings.filter.label.supervisor"}),labelCol:{sm:20,md:8,lg:8}})]})]}),(0,Sn.jsxs)(Z.Row,{children:[(0,Sn.jsx)(Z.Col,{children:(0,Sn.jsx)(Z.Button,{onClick:()=>(y([]),l(Ls),void D(js())),colourScheme:"light",squared:!0,children:(0,Sn.jsx)(Q.FormattedMessage,{id:"button.epmty_fields"})})}),(0,Sn.jsx)(Z.Col,{children:(0,Sn.jsx)(Z.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!(d&&u),squared:!0,children:(0,Sn.jsx)(Q.FormattedMessage,{id:"button.search"})})})]})]})},Rs={MENTOIMSEIS_OOTEL:["MENTOIMSEIS_OOTEL","MENTOIMSEIS_JATKAMINE"],MENTOIMSEIS_TEOSTAMISEL:["MENTOIMSEIS_TEOSTAMISEL"],MENTOIMSEIS_TYHISTATUD:["MENTOIMSEIS_TYHISTATUD"],MENTOIMSEIS_TEOSTATUD:["MENTOIMSEIS_TEOSTATUD","MENTOIMSEIS_KOOSKOLA","MENTOIMSEIS_KOOSKOLA_MARK","MENTOIMSEIS_VALMIS","MENTOIMSEIS_VANA_VERSIOON","MENTOIMSEIS_ARHIIVIS","MENTOIMSEIS_EDASTATUD"],MENTOIMSEIS_LOOBUTUD:["MENTOIMSEIS_LOOBUTUD","MENTOIMSEIS_KEELDUTUD","MENTOIMSEIS_TAGASI_LYKATUD"],MENTOIMSEIS_TAHTAEG_MOODUNUD:["MENTOIMSEIS_TAHTAEG_MOODUNUD"]};let Ks=function(e){return e.MENTOIMSEIS_ARHIIVIS="MENTOIMSEIS_ARHIIVIS",e.MENTOIMSEIS_TYISTATUD="MENTOIMSEIS_TYISTATUD",e.MENTOIMSEIS_EDASTATUD="MENTOIMSEIS_EDASTATUD",e.MENTOIMSEIS_TEOSTAMISEL="MENTOIMSEIS_TEOSTAMISEL",e.MENTOIMSEIS_TYHISTATUD="MENTOIMSEIS_TYHISTATUD",e.MENTOIMSEIS_VALMIS="MENTOIMSEIS_VALMIS",e.MENTOIMSEIS_KEELDUTUD="MENTOIMSEIS_KEELDUTUD",e.MENTOIMSEIS_KOOSKOLA="MENTOIMSEIS_KOOSKOLA",e.MENTOIMSEIS_KOOSKOLA_MARK="MENTOIMSEIS_KOOSKOLA_MARK",e.MENTOIMSEIS_OOTEL="MENTOIMSEIS_OOTEL",e.MENTOIMSEIS_TAGASI_LYKATUD="MENTOIMSEIS_TAGASI_LYKATUD",e.MENTOIMSEIS_ADS="MENTOIMSEIS_ADS",e.MENTOIMSEIS_ADS_ESITAMATA="MENTOIMSEIS_ADS_ESITAMATA",e.MENTOIMSEIS_ADS_JOUSTUNUD="MENTOIMSEIS_ADS_JOUSTUNUD",e.MENTOIMSEIS_ADS_KONTROLL="MENTOIMSEIS_ADS_KONTROLL",e.MENTOIMSEIS_ADS_PROBLEEM="MENTOIMSEIS_ADS_PROBLEEM",e.MENTOIMSEIS_ADS_TYHISTATUD="MENTOIMSEIS_ADS_TYHISTATUD",e.MENTOIMSEIS_ADS_TYISTATUD="MENTOIMSEIS_ADS_TYISTATUD",e.MENTOIMSEIS_VANA_VERSIOON="MENTOIMSEIS_VANA_VERSIOON",e.MENTOIMSEIS_LOOBUTUD="MENTOIMSEIS_LOOBUTUD",e.MENTOIMSEIS_TEOSTATUD="MENTOIMSEIS_TEOSTATUD",e.MENTOIMSEIS_TAHTAEG_MOODUNUD="MENTOIMSEIS_TAHTAEG_MOODUNUD",e.MENTOIMSEIS_JATKAMINE="MENTOIMSEIS_JATKAMINE",e}({});function Fs(e){return Wn(Rs,e)}const ks={[Ks.MENTOIMSEIS_OOTEL]:"info",[Ks.MENTOIMSEIS_TEOSTAMISEL]:"info",[Ks.MENTOIMSEIS_TYHISTATUD]:"default",[Ks.MENTOIMSEIS_TEOSTATUD]:"success",[Ks.MENTOIMSEIS_LOOBUTUD]:"default",[Ks.MENTOIMSEIS_TAHTAEG_MOODUNUD]:"default"},Ys={[Ks.MENTOIMSEIS_OOTEL]:"my_operations.operation.state.idle",[Ks.MENTOIMSEIS_TEOSTAMISEL]:"my_operations.operation.state.in_process",[Ks.MENTOIMSEIS_TYHISTATUD]:"my_operations.operation.state.cancelled",[Ks.MENTOIMSEIS_TEOSTATUD]:"my_operations.operation.state.done",[Ks.MENTOIMSEIS_LOOBUTUD]:"my_operations.operation.state.abandoned",[Ks.MENTOIMSEIS_TAHTAEG_MOODUNUD]:"my_operations.operation.state.expired"};function Bs(e,t){return((e,t)=>({state:Object.keys(Ys).includes(e)?t.formatMessage({id:Ys[e]}):e,type:Object.keys(ks).includes(e)?ks[e]:"default"}))(Fs(e),t)}const Gs=(e,t)=>({code:e,value:t.formatMessage({id:Ys[e]})});function Vs(e,t){let n;return n=e===re?[Ks.MENTOIMSEIS_OOTEL,Ks.MENTOIMSEIS_TEOSTAMISEL,Ks.MENTOIMSEIS_TYHISTATUD,Ks.MENTOIMSEIS_TEOSTATUD,Ks.MENTOIMSEIS_LOOBUTUD,Ks.MENTOIMSEIS_TAHTAEG_MOODUNUD].map((e=>Gs(e,t))):e===de?[Ks.MENTOIMSEIS_OOTEL,Ks.MENTOIMSEIS_TEOSTAMISEL,Ks.MENTOIMSEIS_TYHISTATUD,Ks.MENTOIMSEIS_LOOBUTUD,Ks.MENTOIMSEIS_TAHTAEG_MOODUNUD].map((e=>Gs(e,t))):e===ce?[Ks.MENTOIMSEIS_OOTEL,Ks.MENTOIMSEIS_TEOSTAMISEL,Ks.MENTOIMSEIS_TEOSTATUD,Ks.MENTOIMSEIS_LOOBUTUD].map((e=>Gs(e,t))):[Ks.MENTOIMSEIS_OOTEL,Ks.MENTOIMSEIS_TEOSTAMISEL,Ks.MENTOIMSEIS_TEOSTATUD,Ks.MENTOIMSEIS_LOOBUTUD,Ks.MENTOIMSEIS_TAHTAEG_MOODUNUD].map((e=>Gs(e,t))),function(e){return e.map((e=>({id:e.code+"",label:e.value,level:2,children:[],selectable:!0,value:!1})))}(n)}function Hs(){return[{code:"11271",value:"Ehitusluba"},{code:"11201",value:"Ehitusteatis"},{code:"11371",value:"Kasutusluba"},{code:"11301",value:"Kasutusteatis"},{code:"11002",value:"Projekteerimistingimused"},{code:"11051",value:"5G pääsupunkti taotlus"}].map((e=>({id:`${e.code}`,label:e.value,level:2,children:[],selectable:!0,value:!1})))}function Js(e,t){if(t.documentTypes.length>0&&(e=e.filter((e=>e.doty&&void 0!==e.doty&&t.documentTypes.includes(e.doty)))),t.ehrCode.length>0&&(e=e.filter((e=>{var n;return null===(n=e.ehrCode)||void 0===n?void 0:n.some((e=>{var n;return null!==(n=e.startsWith(t.ehrCode.trim()))&&void 0!==n&&n}))}))),t.institutions.length>0&&(e=e.filter((e=>{var n;return e.supervisorJurId&&void 0!==e.supervisorJurId&&t.institutions.includes(null===(n=e.supervisorJurId)||void 0===n?void 0:n.toString())}))),t.wordInAddress.length>0&&(e=e.filter((e=>{var n,s;return null!==(n=null===(s=e.address)||void 0===s?void 0:s.some((e=>null==e?void 0:e.toLocaleLowerCase().includes(t.wordInAddress.trim().toLocaleLowerCase()))))&&void 0!==n&&n}))),t.proceedingNumber.length>0&&(e=e.filter((e=>{var n,s;return null!==(n=null===(s=e.proceedingNr)||void 0===s?void 0:s.includes(t.proceedingNumber.trim()))&&void 0!==n&&n}))),t.operationStates.length>0&&(e=e.filter((e=>e.stateCode&&void 0!==e.stateCode&&t.operationStates.includes(Fs(e.stateCode))))),t.institutionUsers&&t.institutionUsers.length>0&&(e=e.filter((e=>e.operationExecutorId&&void 0!==e.operationExecutorId&&t.institutionUsers.includes(e.operationExecutorId.toString())))),t.operationDate.from.length>0&&0===t.operationDate.to.length){const n=new Date(t.operationDate.from).getTime();e=e.filter((e=>new Date(Mn()(e.invitationDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n))}if(t.operationDate.to.length>0&&0===t.operationDate.from.length){const n=new Date(t.operationDate.to).getTime();e=e.filter((e=>new Date(Mn()(e.invitationDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()<=n))}if(t.operationDeadline.from.length>0){const n=new Date(t.operationDeadline.from).getTime();e=e.filter((e=>!e.deadline||new Date(Mn()(e.deadline,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n))}if(t.operationDeadline.to.length>0){const n=new Date(t.operationDeadline.to).getTime();e=e.filter((e=>!e.deadline||new Date(Mn()(e.deadline,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()<=n))}if(t.operationDate.from.length>0&&t.operationDate.to.length>0){const n=new Date(t.operationDate.from).getTime(),s=new Date(t.operationDate.to).getTime();e=e.filter((e=>new Date(Mn()(e.invitationDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n&&new Date(Mn()(e.invitationDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()<=s))}return e}function Ws(e){return[{id:Ks.MENTOIMSEIS_OOTEL},{id:Ks.MENTOIMSEIS_TEOSTAMISEL},{id:Ks.MENTOIMSEIS_TEOSTATUD},{id:Ks.MENTOIMSEIS_LOOBUTUD}].filter((t=>e.includes(t.id)))}let qs=function(e){return e.Document="DOCUMENT",e.Proceeding="PROCEEDING",e.AdminProceeding="ADMIN_PROCEEDING",e.AdminOperation="ADMIN_OPERATION",e.ProceedingDecision="PROCEEDING_DECISION",e.Operation="OPERATION",e.MyDocuments="MY_DOCUMENTS",e.MyProceedings="MY_PROCEEDINGS",e.MyAdministrativeProceedings="MY_ADMIN_PROCEEDINGS",e.Building="BUILDING",e.NewEnergy="NEW_ENERGY",e.ArchiveBuildingRegistryFile="ARCHIVE_BUILDINGREGISTRYFILE",e.ArchiveBuildingDatasOf2003="ARCHIVE_BUILDINGDATAASOF2003",e.ArchiveBuildingDatasOf2014="ARCHIVE_BUILDINGDATAASOF2014",e.Restriction="RESTRICTION",e.NotFound="404",e}({});const $s=["11273","11272"],zs=e=>{const t=(0,Q.useIntl)(),[n,s]=(0,z.useState)({offset:0,limit:10}),[o,i]=(0,z.useState)([]),[r,a]=(0,z.useState)({column:1,direction:Pn}),[l,d]=(0,z.useState)(!1),[c,u]=(0,z.useState)(!1),[p,h]=(0,z.useState)(!1),m=(0,Dn.useSelector)((e=>e.myViewsPage.myOperations.myOperations)),g=(0,Dn.useSelector)((e=>e.myViewsPage.myOperations.toCommentOperations)),S=(0,Dn.useSelector)((e=>e.myViewsPage.myOperations.operationInvitations)),f=(0,Dn.useSelector)((e=>e.myViewsPage.myProceedings.proceedingsToComment)),I=(0,Dn.useSelector)((e=>e.myViewsPage.filter.institutions)),T=(0,Dn.useSelector)((e=>e.myViewsPage.filter.documentTypes)),v=[e=>Jn(e.invitationDate)?new Date(Mn()(e.invitationDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>Jn(e.deadline)?new Date(Mn()(e.deadline,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>{var t;return null!==(t=e.proceedingNr)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.state)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.operationExecutor)&&void 0!==t?t:""},e=>{var t,n;return null!==(t=null===(n=T.find((t=>t.id.toString()===e.doty)))||void 0===n?void 0:n.name)&&void 0!==t?t:""},e=>void 0!==e.buildingName&&null!==e.buildingName&&Jn(e.buildingName[0])?e.buildingName[0]:"",e=>void 0!==e.ehrCode&&null!==e.ehrCode&&Jn(e.ehrCode[0])?e.ehrCode[0]:"",e=>void 0!==e.address&&null!==e.address&&Jn(e.address[0])?e.address[0]:"",e=>{var t,n;return null!==(t=null===(n=I.find((t=>t.id===e.supervisorJurId)))||void 0===n?void 0:n.regName)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.supervisor)&&void 0!==t?t:""}];(0,z.useEffect)((()=>{!m||e.viewType!==ie&&e.viewType!==oe||(i(Js(m,e.filter)),s({offset:0,limit:10}))}),[m,e.filter]),(0,z.useEffect)((()=>{m&&e.viewType===re&&(i(jn(Js(m,e.filter),v[0],Pn)),s({offset:0,limit:10}))}),[m,e.filter]),(0,z.useEffect)((()=>{g&&e.viewType===le&&(r.direction===Cn?i(Js(g,e.filter)):i(jn(Js(g,e.filter),v[r.column],r.direction)),s({offset:0,limit:10}))}),[g,e.filter]),(0,z.useEffect)((()=>{S&&e.viewType===de&&(i(Js(S,e.filter)),s({offset:0,limit:10}))}),[S,e.filter]),(0,z.useEffect)((()=>{f&&e.viewType===ce&&(r.direction===Cn?i(Js(f,e.filter)):i(jn(Js(f,e.filter),v[r.column],r.direction)))}),[f,e.filter]);const E=["my_operations.invitation_date","my_operations.deadline","my_operations.proceeding_nr","my_operations.state","my_operations.operation_executor","my_operations.connected_document_type","my_operations.building_name","my_operations.ehr_code","my_operations.building_address","my_operations.institution","my_operations.supervisor"],_=["my_operations.deadline","my_operations.proceeding_nr","my_operations.state","my_operations.supervisor","my_operations.connected_document_type","my_operations.building_address"],y=[e=>Jn(e.deadline)?new Date(Mn()(e.deadline,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>{var t;return null!==(t=e.proceedingNr)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.state)&&void 0!==t?t:""},e=>{var t;return null!==(t=e.supervisor)&&void 0!==t?t:""},e=>{var t,n;return null!==(t=null===(n=T.find((t=>t.id.toString()===e.doty)))||void 0===n?void 0:n.name)&&void 0!==t?t:""},e=>void 0!==e.address&&null!==e.address&&Jn(e.address[0])?e.address[0]:""];const b=t=>{let n=qs.Operation;return e.viewType===ce?(n=t.doty&&$s.includes(t.doty)?qs.AdminProceeding:qs.Proceeding,e.linkGen(!1,void 0,n,t.proceedingNr)):((t.doty&&$s.includes(t.doty)||t.typeCode===fe.MENTOIMLIIK_KAAS_TAGASISIDE)&&(n=qs.AdminOperation),e.linkGen(!1,void 0,n,t.id))};return(0,Sn.jsxs)(Z.Section,{form:!0,children:[o&&(0,Sn.jsx)(Z.CollapseTable,{content:(s=>s.slice(n.offset,n.offset+n.limit).map((n=>{var s,o,i,r,a,m,g,S;const f=[n.invitationDate,Mn()(n.deadline,"DD.MM.YYYY").valueOf()<Mn()().valueOf()?(0,Sn.jsx)("div",{className:"red-text",children:n.deadline}):n.deadline,(0,Sn.jsx)(Z.Tooltip,{content:(0,Sn.jsx)(Z.Text,{raw:"my_operations.tooltip.open_proceeding"}),placement:"bottom",theme:"dark",children:(0,Sn.jsx)(Z.Link,{text:n.proceedingNr,href:b(n)})},n.proceedingNr),n.stateCode?(0,Sn.jsx)(Z.Status,{type:Bs(n.stateCode,t).type,children:Bs(n.stateCode,t).state}):"",n.operationExecutor,n.doty?null===(s=T.find((e=>e.id.toString()===n.doty)))||void 0===s?void 0:s.name:"",n.buildingName?(0,Sn.jsx)("div",{children:p?(0,Sn.jsxs)("div",{children:[n.buildingName.map(((e,t)=>(0,Sn.jsxs)(X().Fragment,{children:[e,";",(0,Sn.jsx)("br",{})]},t))),n.buildingName.length>5&&(0,Sn.jsx)(Z.Link,{type:"hide",onClick:e=>{e.preventDefault(),h(!p)},text:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_operations.link.view_less_building_names"})})]}):1===n.buildingName.length?n.buildingName:(0,Sn.jsxs)("div",{children:[null===(o=n.buildingName)||void 0===o?void 0:o.slice(0,4).map(((e,t)=>(0,Sn.jsxs)(X().Fragment,{children:[e,";",(0,Sn.jsx)("br",{})]},t))),null===(i=n.buildingName)||void 0===i?void 0:i.slice(4,5),n.buildingName.length>5?" ...":"",n.buildingName.length>5&&(0,Sn.jsx)("div",{className:"pr-3",children:(0,Sn.jsx)(Z.Link,{type:"show",onClick:e=>{e.preventDefault(),h(!p)},text:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_operations.link.view_all_building_names"})})})]})}):"",n.ehrCode?(0,Sn.jsx)("div",{children:c?(0,Sn.jsxs)("div",{children:[n.ehrCode.map(((t,n)=>(0,Sn.jsxs)(X().Fragment,{children:[(0,Sn.jsx)(vn,{linkName:t,tooltipText:"my_operations.tooltip.open_building",functionCall:n=>{e.linkGen(!0,n,"BUILDING",t)},href:e.linkGen(!1,void 0,"BUILDING",t)}),(0,Sn.jsx)("br",{})]},n))),n.ehrCode.length>5&&(0,Sn.jsx)(Z.Link,{type:"hide",onClick:e=>{e.preventDefault(),u(!c)},text:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_operations.link.view_less_ehrCodes"})})]}):(0,Sn.jsxs)("div",{children:[null===(r=n.ehrCode)||void 0===r?void 0:r.slice(0,4).map(((t,n)=>(0,Sn.jsxs)(X().Fragment,{children:[(0,Sn.jsx)(vn,{linkName:t,tooltipText:"my_operations.tooltip.open_building",functionCall:n=>{e.linkGen(!0,n,"BUILDING",t)},href:e.linkGen(!1,void 0,"BUILDING",t)}),(0,Sn.jsx)("br",{})]},n))),null===(a=n.ehrCode)||void 0===a?void 0:a.slice(4,5).map((t=>(0,Sn.jsx)(vn,{linkName:t,tooltipText:"my_operations.tooltip.open_building",functionCall:n=>{e.linkGen(!0,n,"BUILDING",t)},href:e.linkGen(!1,void 0,"BUILDING",t)}))),n.ehrCode.length>5?" ...":"",n.ehrCode.length>5&&(0,Sn.jsx)("div",{className:"pr-3",children:(0,Sn.jsx)(Z.Link,{type:"show",onClick:e=>{e.preventDefault(),u(!c)},text:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_operations.link.view_all_ehrCodes"})})})]})}):"",n.address?(0,Sn.jsx)("div",{children:l?(0,Sn.jsxs)("div",{children:[n.address.map(((e,t)=>(0,Sn.jsxs)(X().Fragment,{children:[e,";",(0,Sn.jsx)("br",{})]},t))),n.address.length>5&&(0,Sn.jsx)(Z.Link,{type:"hide",onClick:e=>{e.preventDefault(),d(!l)},text:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_operations.link.view_less_addresses"})})]}):1===n.address.length?n.address:(0,Sn.jsxs)("div",{children:[null===(m=n.address)||void 0===m?void 0:m.slice(0,4).map(((e,t)=>(0,Sn.jsxs)(X().Fragment,{children:[e,";",(0,Sn.jsx)("br",{})]},t))),null===(g=n.address)||void 0===g?void 0:g.slice(4,5),n.address.length>5?" ...":"",n.address.length>5&&(0,Sn.jsx)("div",{className:"pr-3",children:(0,Sn.jsx)(Z.Link,{type:"show",onClick:e=>{e.preventDefault(),d(!l)},text:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_operations.link.view_all_addresses"})})})]})}):"",n.supervisorJurId?null===(S=I.find((e=>e.id===n.supervisorJurId)))||void 0===S?void 0:S.regName:"",n.supervisor],v=[...f];v.splice(4,1);const E=[...f].slice(1,4).concat(f[10]).concat(f[5]).concat(f[8]);return(0,Sn.jsx)(Z.CollapseTableRow,{fields:e.viewType===re?v:e.viewType===ce?E:f},n.id)})))(o),headers:function(){const n=[...E];n.splice(4,1);const s=e.viewType===re?n:e.viewType===ce?_:E,l=[...v];l.splice(4,1);const d=e.viewType===re?l:e.viewType===ce?y:v;return s.map(((e,n)=>(0,Sn.jsxs)("div",{children:[(0,Sn.jsx)("a",{className:"link-gray",style:{paddingRight:"2px"},onClick:()=>{const e=Rn(n,r);a(e),e.direction!==Cn&&i(jn(o,d[n],e.direction))},children:r.column===n?(0,Sn.jsx)(Kn,{sortDirection:r.direction}):(0,Sn.jsx)(Kn,{sortDirection:Cn})}),t.formatMessage({id:e})]})))}(),paginationEnabled:!0,pager:{offset:n.offset,limit:n.limit,total:o.length},onPaginationReload:s}),(e.viewType===oe||e.viewType===ie)&&(0,Sn.jsx)("div",{className:"d-flex justify-content-start",children:(0,Sn.jsx)(Z.Checkbox,{name:"checkbox",onChange:t=>e.onAllUsersChecked(t),text:e.viewType===oe?(0,Sn.jsx)(Z.Text,{raw:"my_approvals.view_all_institution_approvals"}):(0,Sn.jsx)(Z.Text,{raw:"my_opinions.view_all_institution_opinions"}),checked:e.isAllUsersChecked})})]})},Xs=e=>{var t;const n=(0,Q.useIntl)(),s=/^[\\s0-9]{0,9}$/,o=/^([\\s0-9]{5}:[\\s0-9]{3}:[\\s0-9]{1,4}|[\\s0-9]{5}:[\\s0-9]{1,3}|[\\s0-9]{1,5})$/,i=null!==(t=e.initialFilter)&&void 0!==t?t:{documentTypes:[],ehrCode:"",institutions:[],wordInAddress:"",proceedingNumber:"",cadastralNumber:"",operationStates:[],institutionUsers:[],operationDate:{from:"",to:""},operationDeadline:{from:"",to:""}},r={...i,operationStates:[Ks.MENTOIMSEIS_TEOSTAMISEL]},a={...i,operationStates:[Ks.MENTOIMSEIS_OOTEL,Ks.MENTOIMSEIS_TEOSTAMISEL,Ks.MENTOIMSEIS_JATKAMINE]},l={...i,operationStates:[Ks.MENTOIMSEIS_OOTEL]},[d,c]=(0,z.useState)(e.filterState),[u,p]=(0,z.useState)(Ws(d.operationStates)),[h,m]=(0,z.useState)(!0),[g,S]=(0,z.useState)(!0),[f,I]=(0,z.useState)(""),[T,v]=(0,z.useState)(""),E=(0,z.useMemo)((()=>Hs()),[]),[_,y]=(0,z.useState)([]),[b,D]=(0,z.useState)([]),x=(0,z.useMemo)((()=>Vs(e.viewType,n)),[e.viewType]),[M,N]=(0,z.useState)([]),O=(0,Dn.useSelector)((e=>e.myViewsPage.filter.institutionUsers)),A=(0,Dn.useSelector)((e=>e.myViewsPage.filter.institutions));function U(e){return s.test(e)}function w(e,t){let n;e.selectedData.length>0?(n=void 0!==e.selectedData[0].data?e.selectedData[0].data:e.selectedData,n=n.map((e=>e.id.length<5?e.children.map((e=>e.id)):e.id)).flat()):n=[],d[t]=n,c((e=>({...e})))}function j(e,t){var n;d[t]=e,"ehrCode"===t&&U(e)?m(!0):"cadastralNumber"===t&&(0===(n=e).length||o.test(n))&&S(!0),c((e=>({...e})))}(0,z.useEffect)((()=>{if(O){const e=fs(O?[...O]:[]);D(e)}if(A){const e=Is([...A]);y(e)}}),[O,A]);return(0,Sn.jsxs)(Z.Form,{onSubmit:()=>e.onSubmit(d),children:[(0,Sn.jsx)(Z.Row,{className:"align-items-start",children:(0,Sn.jsx)(Z.Col,{sm:10,className:"mx-0 px-0",children:(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)(Z.Multiselect,{name:"multiselect",options:E,onSelect:e=>w(e,"documentTypes"),allSelection:!0,onRemoveItem:e=>w(e,"documentTypes"),value:d.documentTypes,selectedOptions:M}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_operations.filter.label.document_type"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})})}),(0,Sn.jsx)(Z.Row,{className:"align-items-start",children:(0,Sn.jsx)(Z.Col,{sm:10,className:"mx-0 px-0",children:(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)(Z.Input,{name:"input",onChange:e=>j(e,"ehrCode"),onBlur:e=>S(U(e.trim())),placeholder:n.formatMessage({id:"placeholder.writing"}),value:d.ehrCode}),errorMessage:!h&&(0,Sn.jsx)(Z.Text,{raw:"filter.invalid_building_code"}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_operations.filter.label.ehrCode"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})})}),(0,Sn.jsxs)(Z.Row,{className:"align-items-start",children:[(0,Sn.jsxs)(Z.Col,{sm:10,className:"mx-0 px-0",children:[(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)(Z.Multiselect,{name:"multiselect",options:_,onSelect:e=>w(e,"institutions"),allSelection:!0,onRemoveItem:e=>w(e,"institutions"),value:d.institutions,selectedOptions:M}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_operations.filter.label.institution"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)(Z.Input,{name:"input",onChange:e=>j(e,"proceedingNumber"),placeholder:n.formatMessage({id:"placeholder.writing"}),value:d.proceedingNumber}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_operations.filter.label.proceeding_number"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)(Z.Multiselect,{name:"multiselect",options:x,onSelect:e=>w(e,"operationStates"),allSelection:!0,onRemoveItem:e=>w(e,"operationStates"),value:d.operationStates,selectedOptions:u}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_operations.filter.label.operation_state"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)(Ts,{onChange:e=>(e=>{""!==e.from&&!Mn()(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!Mn()(e.to,"YYYY-MM-DD",!0).isValid()?I(n.formatMessage({id:"filter.invalid_date_format"})):""!==e.from&&""!==e.to&&e.from>e.to?I(n.formatMessage({id:"filter.invalid_date_range"})):I(""),c((t=>({...t,operationDate:e})))})(e),value:d.operationDate}),errorMessage:f.length>0?f:null,label:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_operations.filter.label.operation_date"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})]}),(0,Sn.jsxs)(Z.Col,{sm:10,className:"mx-0 px-0",children:[(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)(Z.Input,{name:"input",onChange:e=>j(e,"wordInAddress"),placeholder:n.formatMessage({id:"placeholder.writing"}),value:d.wordInAddress}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_operations.filter.label.word_in_address"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)(Z.Multiselect,{name:"multiselect",options:b,onSelect:e=>w(e,"institutionUsers"),allSelection:!0,onRemoveItem:e=>w(e,"institutionUsers"),value:d.institutionUsers,selectedOptions:M}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_operations.filter.label.institution_users"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)(Ts,{onChange:e=>(e=>{""!==e.from&&!Mn()(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!Mn()(e.to,"YYYY-MM-DD",!0).isValid()?v(n.formatMessage({id:"filter.invalid_date_format"})):""!==e.from&&""!==e.to&&e.from>e.to?v(n.formatMessage({id:"filter.invalid_date_range"})):v(""),c((t=>({...t,operationDeadline:e})))})(e),value:d.operationDeadline}),errorMessage:T.length>0?T:null,label:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_operations.filter.label.operation_deadline"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})]})]}),(0,Sn.jsxs)(Z.Row,{children:[(0,Sn.jsx)(Z.Col,{children:(0,Sn.jsx)(Z.Button,{onClick:()=>function(){let t;switch(N([]),e.viewType){case ae:t=r;break;case le:case ce:t=a;break;case de:t=l;break;default:t=i}c(t),p(Ws(t.operationStates))}(),colourScheme:"light",squared:!0,children:(0,Sn.jsx)(Q.FormattedMessage,{id:"button.epmty_fields"})})}),(0,Sn.jsx)(Z.Col,{children:(0,Sn.jsx)(Z.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!(h&&g),squared:!0,children:(0,Sn.jsx)(Q.FormattedMessage,{id:"button.search"})})})]})]})},Qs=e=>{var t,n,s,o;let{classifierApiEndpoint:i,fileUploadApiEndpoint:r,linkGen:a,myViewsApiEndpoint:l,userInfo:d,userApiEndpoint:c}=e;const u=(0,Dn.useDispatch)(),[p,h]=(0,z.useState)({proceedings:!1}),[m,f]=(0,z.useState)(!0),[I,T]=(0,z.useState)(!0),[v,E]=(0,z.useState)(!0),[_,y]=(0,z.useState)([]),[b,D]=(0,z.useState)([]),[x,M]=(0,z.useState)([]),U=new ke(new xt({basePath:i})),w=new it(new xt({basePath:c})),j=new Dt(new xt({basePath:l})),C=new Tt(new xt({basePath:l})),L=new yt(new xt({basePath:l})),P=new Qt(new Zt({basePath:r})),R="A"!==(null===(t=d.activeRole)||void 0===t?void 0:t.businessType);let K=new Date;K.setDate(K.getDate()-7);const F={documentTypes:[],ehrCode:"",institutions:[],wordInAddress:"",proceedingNumber:"",cadastralNumber:"",operationStates:["MENTOIMSEIS_OOTEL","MENTOIMSEIS_TEOSTAMISEL"],institutionUsers:[(null===(n=d.activeRole)||void 0===n?void 0:n.userId)+""],operationDate:{from:"",to:""},operationDeadline:{from:K.toISOString().split("T")[0],to:""}},[k,Y]=(0,z.useState)({documentTypes:[],ehrCode:"",buildingName:"",wordInAddress:"",proceedingNumber:"",cadastralNumber:"",proceedingStates:["MENSEIS_ALGATATUD","MENSEIS_KAIMASOLEV"],connectedPerson:"",showProceedingInArchive:!1,supervisors:[],proceedingDate:{from:"",to:""},lastEventDate:""}),[B,G]=(0,z.useState)(F),[V,H]=(0,z.useState)({});const J={userId:null===(s=d.activeRole)||void 0===s?void 0:s.userId,personId:null===(o=d.activeRole)||void 0===o?void 0:o.businessId,dotys:["11525","11271","11201","11301","11271","11371","11002","11582","11581","12271","12371","11413","11412","11430","11583"],states:[kn.DO_DOKUSEIS_ESITATUD,kn.DO_DOKUSEIS_MENETLUSES]};return(0,z.useEffect)((()=>{!function(e){var t,n;const s={userId:e.institutionUsers?Number(e.institutionUsers[0]):null===(t=d.activeRole)||void 0===t?void 0:t.userId,personId:null===(n=d.activeRole)||void 0===n?void 0:n.businessId,states:e.operationStates,type:[fe.MENTOIMLIIK_MEN_MARKUS]};T(!0),L.findOperationsToComment(s).then((e=>{u(O(e.data)),D(e.data),T(!1)})).catch((e=>{console.log("Following error occured:",e),T(!1)}))}(B)}),[d,B]),(0,z.useEffect)((()=>{(()=>{const e=J;p.proceedings&&(e.userId=void 0),f(!0),j.findProceedings(e).then((e=>{u(N(e.data)),y(e.data),f(!1)})).catch((e=>{console.log("Following error occured:",e),f(!1)}))})()}),[p.proceedings]),(0,z.useEffect)((()=>{!function(){const e=J;e.userId=void 0,E(!0),C.findIncomingBaseDocuments(e).then((e=>{u(A(e.data)),E(!1),M(e.data)})).catch((e=>{console.log("Following error occured:",e),E(!1)}))}()}),[d]),(0,z.useEffect)((()=>{var e,t;U.getAllDocumentTypes().then((e=>{u(g(e.data))})).catch((e=>{console.log(e)})),R&&w.getJurUsers(null!==(e=null===(t=d.activeRole)||void 0===t?void 0:t.businessId)&&void 0!==e?e:0).then((e=>{u(S(e.data))})).catch((e=>{console.log(e)}))}),[d]),(0,Sn.jsxs)("div",{children:[(0,Sn.jsx)(Z.Section,{collapsed:!1,title:"my_proceedings.my_proceedings",showSettings:!0,filterContents:(0,Sn.jsx)(Ps,{onSubmit:e=>{Y(e)},isKov:R,filterState:k}),children:m?(0,Sn.jsx)(Z.SectionLoader,{}):0===_.length?(0,Sn.jsxs)("div",{children:[(0,Sn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Sn.jsx)(Z.Text,{raw:"my_proceedings.no_proceedings"})}),R&&(0,Sn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Sn.jsx)(Z.Link,{text:"my_proceedings.view_all_institution_proceedings",onClick:()=>{h({proceedings:!0})}})})]}):(0,Sn.jsx)(Cs,{linkGen:a,isKov:R,onAllUsersChecked:e=>{h({proceedings:e})},isAllUsersChecked:p.proceedings,filter:k})}),R&&(0,Sn.jsx)(Z.Section,{collapsed:!1,title:"my_proceedings.section_title.proceedings_to_comment",showSettings:!0,filterContents:(0,Sn.jsx)(Xs,{viewType:ce,initialFilter:F,filterState:B,onSubmit:e=>G(e)}),children:I?(0,Sn.jsx)(Z.SectionLoader,{}):0===b.length?(0,Sn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Sn.jsx)(Z.Text,{raw:"my_proceedings.proceedings_to_comment.no_proceedings"})}):(0,Sn.jsx)(zs,{linkGen:a,viewType:ce,filter:B})}),R&&(0,Sn.jsx)(Z.Section,{collapsed:!1,title:"my_documents.incoming_documents",showSettings:!0,filterContents:(0,Sn.jsx)(vs,{documentType:se,filterState:V,onSubmit:e=>H(e),isKov:R}),children:v?(0,Sn.jsx)(Z.SectionLoader,{}):0===x.length?(0,Sn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Sn.jsx)(Z.Text,{raw:"my_documents.incoming_documents.no_docs"})}):(0,Sn.jsx)(ps,{linkGen:a,userInfo:d,documentType:se,filter:V,fileApi:P})})]})},Zs=e=>{let{classifierApiEndpoint:t,linkGen:n,myViewsApiEndpoint:s,userApiEndpoint:o,userInfo:{activeRole:i}}=e;const r=(0,Dn.useDispatch)(),[a,l]=(0,z.useState)(!0),[d,c]=(0,z.useState)(!1),[u,p]=(0,z.useState)(!1),[h,m]=(0,z.useState)(null),[I,T]=(0,z.useState)(null),[v,E]=(0,z.useState)(null),_={documentTypes:[],ehrCode:"",institutions:[],wordInAddress:"",proceedingNumber:"",cadastralNumber:"",operationStates:[],institutionUsers:[],operationDate:{from:"",to:""},operationDeadline:{from:"",to:""}},y={..._,operationStates:[Ks.MENTOIMSEIS_TEOSTAMISEL]},b={..._,operationStates:[Ks.MENTOIMSEIS_OOTEL,Ks.MENTOIMSEIS_TEOSTAMISEL,Ks.MENTOIMSEIS_JATKAMINE]},D={..._,operationStates:[Ks.MENTOIMSEIS_OOTEL]},[x,M]=(0,z.useState)(y),[N,O]=(0,z.useState)(b),[A,U]=(0,z.useState)(D),[w,P]=(0,z.useState)(!1),R=new Ze(new xt({basePath:o})),K=new it(new xt({basePath:o})),F=new yt(new xt({basePath:s})),k=new ke(new xt({basePath:t}));return(0,z.useEffect)((()=>{var e;R.getJurKovPersons().then((e=>{r(f(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)})),K.getJurUsers(null!==(e=null==i?void 0:i.businessId)&&void 0!==e?e:0).then((e=>{r(S(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)})),k.getAllDocumentTypes().then((e=>{r(g(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)}))}),[]),(0,z.useEffect)((()=>{!function(){const e={userId:null==i?void 0:i.userId,personId:null==i?void 0:i.businessId,type:[fe.MENTOIMLIIK_VALINE_KOOSK],states:Rs.MENTOIMSEIS_TEOSTAMISEL.concat(Rs.MENTOIMSEIS_TEOSTATUD,Rs.MENTOIMSEIS_LOOBUTUD,Rs.MENTOIMSEIS_TAHTAEG_MOODUNUD)};w&&(e.userId=void 0),l(!0),F.findOperations(e).then((e=>{r(j(e.data)),m(e.data),l(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),l(!1)}))}()}),[w]),(0,z.useEffect)((()=>{c(!0),F.findOperationsToComment({userId:null==i?void 0:i.userId,type:[fe.MENTOIMLIIK_VALINE_KOOSK],states:Rs.MENTOIMSEIS_TEOSTAMISEL.concat(Rs.MENTOIMSEIS_TEOSTATUD,Rs.MENTOIMSEIS_LOOBUTUD,Rs.MENTOIMSEIS_TAHTAEG_MOODUNUD)}).then((e=>{r(C(e.data)),T(e.data),c(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),c(!1)})),p(!0),F.findOperationInvitations({userId:void 0,personId:null==i?void 0:i.businessId,type:[fe.MENTOIMLIIK_VALINE_KOOSK],states:Rs.MENTOIMSEIS_OOTEL.concat(Rs.MENTOIMSEIS_TEOSTAMISEL,Rs.MENTOIMSEIS_TYHISTATUD,Rs.MENTOIMSEIS_LOOBUTUD,Rs.MENTOIMSEIS_TAHTAEG_MOODUNUD)}).then((e=>{r(L(e.data)),E(e.data),p(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),p(!1)}))}),[]),(0,Sn.jsxs)("div",{children:[(0,Sn.jsxs)(Z.Section,{collapsed:!1,title:"my_approvals.my_approvals",showSettings:!0,filterContents:(0,Sn.jsx)(Xs,{viewType:ae,filterState:x,onSubmit:e=>M(e)}),children:[a&&(0,Sn.jsx)(Z.SectionLoader,{}),a||h?(0,Sn.jsx)(zs,{linkGen:n,viewType:oe,filter:x,isAllUsersChecked:w,onAllUsersChecked:e=>{P(e)}}):(0,Sn.jsxs)("div",{children:[(0,Sn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Sn.jsx)(Z.Text,{raw:"my_approvals.no_approvals"})}),(0,Sn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Sn.jsx)(Z.Link,{text:"my_approvals.view_all_institution_approvals",onClick:()=>{P(!0)}})})]})]}),(0,Sn.jsxs)(Z.Section,{collapsed:!1,title:"my_approvals.approvals_to_comment",showSettings:!0,filterContents:(0,Sn.jsx)(Xs,{viewType:le,filterState:N,onSubmit:e=>O(e)}),children:[d&&(0,Sn.jsx)(Z.SectionLoader,{}),d||I?(0,Sn.jsx)(zs,{linkGen:n,viewType:le,filter:N}):(0,Sn.jsx)("div",{children:(0,Sn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Sn.jsx)(Z.Text,{raw:"my_approvals.no_approvals_to_comment"})})})]}),(0,Sn.jsxs)(Z.Section,{collapsed:!1,title:"my_approvals.approval_invitations",showSettings:!0,filterContents:(0,Sn.jsx)(Xs,{viewType:de,filterState:A,onSubmit:e=>U(e)}),children:[u&&(0,Sn.jsx)(Z.SectionLoader,{}),u||v?(0,Sn.jsx)(zs,{linkGen:n,viewType:de,filter:A}):(0,Sn.jsx)("div",{children:(0,Sn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Sn.jsx)(Z.Text,{raw:"my_approvals.no_approval_invitations"})})})]})]})},eo=e=>{let{classifierApiEndpoint:t,linkGen:n,myViewsApiEndpoint:s,userApiEndpoint:o,userInfo:{activeRole:i}}=e;const r=(0,Dn.useDispatch)(),[a,l]=(0,z.useState)(!1),[d,c]=(0,z.useState)(!1),[u,p]=(0,z.useState)(!1),[h,m]=(0,z.useState)(null),[I,T]=(0,z.useState)(null),[v,E]=(0,z.useState)(null),_={documentTypes:[],ehrCode:"",institutions:[],wordInAddress:"",proceedingNumber:"",cadastralNumber:"",operationStates:[],institutionUsers:[],operationDate:{from:"",to:""},operationDeadline:{from:"",to:""}},y={..._,operationStates:[Ks.MENTOIMSEIS_TEOSTAMISEL]},b={..._,operationStates:[Ks.MENTOIMSEIS_OOTEL,Ks.MENTOIMSEIS_TEOSTAMISEL,Ks.MENTOIMSEIS_JATKAMINE]},D={..._,operationStates:[Ks.MENTOIMSEIS_OOTEL]},[x,M]=(0,z.useState)(y),[N,O]=(0,z.useState)(b),[A,U]=(0,z.useState)(D),[w,P]=(0,z.useState)(!1),R=new Ze(new xt({basePath:o})),K=new it(new xt({basePath:o})),F=new yt(new xt({basePath:s})),k=new ke(new xt({basePath:t}));return(0,z.useEffect)((()=>{var e;R.getJurKovPersons().then((e=>{r(f(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)})),K.getJurUsers(null!==(e=null==i?void 0:i.businessId)&&void 0!==e?e:0).then((e=>{r(S(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)})),k.getAllDocumentTypes().then((e=>{r(g(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)}))}),[]),(0,z.useEffect)((()=>{!function(){const e=w?null==i?void 0:i.businessId:null==i?void 0:i.userId;l(!0),F.findOperations({personId:w?e:void 0,userId:w?void 0:e,type:[fe.MENTOIMLIIK_ARVAMUS],states:Rs.MENTOIMSEIS_TEOSTAMISEL.concat(Rs.MENTOIMSEIS_TEOSTATUD,Rs.MENTOIMSEIS_LOOBUTUD,Rs.MENTOIMSEIS_TAHTAEG_MOODUNUD)}).then((e=>{r(j(e.data)),m(e.data),l(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),l(!1)}))}()}),[w]),(0,z.useEffect)((()=>{c(!0),F.findOperationsToComment({userId:null==i?void 0:i.userId,type:[fe.MENTOIMLIIK_ARVAMUS],states:Rs.MENTOIMSEIS_TEOSTAMISEL.concat(Rs.MENTOIMSEIS_TEOSTATUD,Rs.MENTOIMSEIS_LOOBUTUD,Rs.MENTOIMSEIS_TAHTAEG_MOODUNUD)}).then((e=>{r(C(e.data)),T(e.data),c(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),c(!1)})),p(!0),F.findOperationInvitations({userId:void 0,personId:null==i?void 0:i.businessId,type:[fe.MENTOIMLIIK_ARVAMUS],states:Rs.MENTOIMSEIS_OOTEL.concat(Rs.MENTOIMSEIS_TEOSTAMISEL,Rs.MENTOIMSEIS_TYHISTATUD,Rs.MENTOIMSEIS_LOOBUTUD,Rs.MENTOIMSEIS_TAHTAEG_MOODUNUD)}).then((e=>{r(L(e.data)),E(e.data),p(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),p(!1)}))}),[]),(0,Sn.jsxs)("div",{children:[(0,Sn.jsxs)(Z.Section,{collapsed:!1,title:"my_opinions.my_opinions",showSettings:!0,filterContents:(0,Sn.jsx)(Xs,{viewType:ae,filterState:x,onSubmit:e=>M(e)}),children:[a&&(0,Sn.jsx)(Z.SectionLoader,{}),a||h?(0,Sn.jsx)(zs,{linkGen:n,viewType:ie,filter:x,isAllUsersChecked:w,onAllUsersChecked:e=>{P(e)}}):(0,Sn.jsxs)("div",{children:[(0,Sn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Sn.jsx)(Z.Text,{raw:"my_opinions.no_opinions"})}),(0,Sn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Sn.jsx)(Z.Link,{text:"my_opinions.view_all_institution_opinions",onClick:()=>{P(!0)}})})]})]}),(0,Sn.jsxs)(Z.Section,{collapsed:!1,title:"my_opinions.opinions_to_comment",showSettings:!0,filterContents:(0,Sn.jsx)(Xs,{viewType:le,filterState:N,onSubmit:e=>O(e)}),children:[d&&(0,Sn.jsx)(Z.SectionLoader,{}),d||I?(0,Sn.jsx)(zs,{linkGen:n,viewType:le,filter:N}):(0,Sn.jsx)("div",{children:(0,Sn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Sn.jsx)(Z.Text,{raw:"my_opinions.no_opinions_to_comment"})})})]}),(0,Sn.jsxs)(Z.Section,{collapsed:!1,title:"my_opinions.opinion_invitations",showSettings:!0,filterContents:(0,Sn.jsx)(Xs,{viewType:de,filterState:A,onSubmit:e=>U(e)}),children:[u&&(0,Sn.jsx)(Z.SectionLoader,{}),u||v?(0,Sn.jsx)(zs,{linkGen:n,viewType:de,filter:A}):(0,Sn.jsx)("div",{children:(0,Sn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Sn.jsx)(Z.Text,{raw:"my_opinions.no_opinion_invitations"})})})]})]})},to=e=>{const t=(0,Q.useIntl)(),n=/^[\\s0-9]{0,9}$/,s=/^([\\s0-9]{5}:[\\s0-9]{3}:[\\s0-9]{1,4}|[\\s0-9]{5}:[\\s0-9]{1,3}|[\\s0-9]{1,5})$/,o={documentTypes:[],ehrCode:"",institutions:[],wordInAddress:"",proceedingNumber:"",cadastralNumber:"",operationStates:[Ks.MENTOIMSEIS_OOTEL,Ks.MENTOIMSEIS_TEOSTAMISEL,Ks.MENTOIMSEIS_TEOSTATUD,Ks.MENTOIMSEIS_LOOBUTUD],operationDate:{from:"",to:""},operationDeadline:{from:"",to:""}},[i,r]=(0,z.useState)(e.filterState),[a,l]=(0,z.useState)(Ws(i.operationStates)),[d,c]=(0,z.useState)(!0),[u,p]=(0,z.useState)(!0),[h,m]=(0,z.useState)(""),g=(0,z.useMemo)((()=>Hs()),[]),[S,f]=(0,z.useState)([]),I=(0,z.useMemo)((()=>Vs(re,t)),[]),[T,v]=(0,z.useState)([]),E=(0,Dn.useSelector)((e=>e.myViewsPage.filter.institutions));function _(e){return n.test(e)}function y(e,t){let n;e.selectedData.length>0?(n=void 0!==e.selectedData[0].data?e.selectedData[0].data:e.selectedData,n=n.map((e=>e.id.length<5?e.children.map((e=>e.id)):e.id)).flat()):n=[],i[t]=n,r((e=>({...e})))}function b(e,t){var n;i[t]=e,"ehrCode"===t&&_(e)?c(!0):"cadastralNumber"===t&&(0===(n=e).length||s.test(n))&&p(!0),r((e=>({...e})))}(0,z.useEffect)((()=>{if(E){const e=Is([...E]);f(e)}}),[E]);return(0,Sn.jsxs)(Z.Form,{onSubmit:()=>e.onSubmit(i),children:[(0,Sn.jsxs)(Z.Row,{children:[(0,Sn.jsx)(Z.Col,{children:(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)(Z.Multiselect,{name:"multiselect",options:g,onSelect:e=>y(e,"documentTypes"),allSelection:!0,onRemoveItem:e=>y(e,"documentTypes"),value:i.documentTypes,selectedOptions:T}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_operations.filter.label.document_type"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,Sn.jsx)(Z.Col,{})]}),(0,Sn.jsxs)(Z.Row,{children:[(0,Sn.jsx)(Z.Col,{children:(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)(Z.Input,{name:"input",onChange:e=>b(e,"ehrCode"),onBlur:e=>c(_(e.trim())),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.ehrCode}),errorMessage:!d&&(0,Sn.jsx)(Z.Text,{raw:"filter.invalid_building_code"}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_operations.filter.label.ehrCode"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,Sn.jsx)(Z.Col,{children:(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)(Z.Input,{name:"input",onChange:e=>b(e,"wordInAddress"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.wordInAddress}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_operations.filter.label.word_in_address"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})})]}),(0,Sn.jsxs)(Z.Row,{children:[(0,Sn.jsx)(Z.Col,{children:(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)(Z.Multiselect,{name:"multiselect",options:S,onSelect:e=>y(e,"institutions"),allSelection:!0,onRemoveItem:e=>y(e,"institutions"),value:i.institutions,selectedOptions:T}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_operations.filter.label.institution"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,Sn.jsx)(Z.Col,{})]}),(0,Sn.jsxs)(Z.Row,{children:[(0,Sn.jsx)(Z.Col,{children:(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)(Z.Input,{name:"input",onChange:e=>b(e,"proceedingNumber"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.proceedingNumber}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_operations.filter.label.proceeding_number"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,Sn.jsx)(Z.Col,{children:(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)(Z.Multiselect,{name:"multiselect",options:I,onSelect:e=>y(e,"operationStates"),allSelection:!0,onRemoveItem:e=>y(e,"operationStates"),value:i.operationStates,selectedOptions:a}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_involvements.filter.label.involvement_state"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})})]}),(0,Sn.jsxs)(Z.Row,{children:[(0,Sn.jsx)(Z.Col,{children:(0,Sn.jsx)(Z.FieldWrapper,{component:(0,Sn.jsx)(Ts,{onChange:e=>(e=>{""!==e.from&&!Mn()(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!Mn()(e.to,"YYYY-MM-DD",!0).isValid()?m(t.formatMessage({id:"filter.invalid_date_format"})):""!==e.from&&""!==e.to&&e.from>e.to?m(t.formatMessage({id:"filter.invalid_date_range"})):m(""),r((t=>({...t,operationDate:e})))})(e),value:i.operationDate}),errorMessage:h.length>0?h:null,label:(0,Sn.jsx)(Q.FormattedMessage,{id:"my_involvements.filter.label.involvement_date"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,Sn.jsx)(Z.Col,{})]}),(0,Sn.jsxs)(Z.Row,{children:[(0,Sn.jsx)(Z.Col,{children:(0,Sn.jsx)(Z.Button,{onClick:()=>(v([]),r(o),void l(Ws(o.operationStates))),colourScheme:"light",squared:!0,children:(0,Sn.jsx)(Q.FormattedMessage,{id:"button.epmty_fields"})})}),(0,Sn.jsx)(Z.Col,{children:(0,Sn.jsx)(Z.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!(d&&u),squared:!0,children:(0,Sn.jsx)(Q.FormattedMessage,{id:"button.search"})})})]})]})},no=e=>{var t;let{classifierApiEndpoint:n,linkGen:s,myViewsApiEndpoint:o,userInfo:i,userApiEndpoint:r}=e;const a=(0,Dn.useDispatch)(),[l,d]=(0,z.useState)(!1),[c,u]=(0,z.useState)([]),p=!(void 0===i||"A"===(null==i||null===(t=i.activeRole)||void 0===t?void 0:t.businessType)),h={documentTypes:[],ehrCode:"",institutions:[],wordInAddress:"",proceedingNumber:"",cadastralNumber:"",operationStates:[Ks.MENTOIMSEIS_OOTEL,Ks.MENTOIMSEIS_TEOSTAMISEL,Ks.MENTOIMSEIS_TEOSTATUD,Ks.MENTOIMSEIS_LOOBUTUD],operationDate:{from:"",to:""},operationDeadline:{from:"",to:""}},[m,S]=(0,z.useState)(h),I=new Ze(new xt({basePath:r})),T=new yt(new xt({basePath:o})),v=new ke(new xt({basePath:n}));return(0,z.useEffect)((()=>{var e;I.getJurKovPersons().then((e=>{a(f(e.data))})).catch((e=>{console.log(e)})),v.getAllDocumentTypes().then((e=>{a(g(e.data))})).catch((e=>{console.log(e)})),d(!0),T.findOperations({userId:void 0,personId:p?null===(e=i.activeRole)||void 0===e?void 0:e.businessId:i.personId,type:[fe.MENTOIMLIIK_KAASAMINE,fe.MENTOIMLIIK_KAAS_TAGASISIDE],states:[Ks.MENTOIMSEIS_OOTEL,Ks.MENTOIMSEIS_TEOSTAMISEL,Ks.MENTOIMSEIS_TEOSTATUD,Ks.MENTOIMSEIS_VALMIS,Ks.MENTOIMSEIS_JATKAMINE,Ks.MENTOIMSEIS_TYHISTATUD,Ks.MENTOIMSEIS_LOOBUTUD,Ks.MENTOIMSEIS_KEELDUTUD,Ks.MENTOIMSEIS_TAGASI_LYKATUD,Ks.MENTOIMSEIS_TAHTAEG_MOODUNUD]}).then((e=>{a(j(e.data)),u(e.data),d(!1)})).catch((e=>{console.log("Following error occured:",e),d(!1)}))}),[i]),(0,Sn.jsx)("div",{children:(0,Sn.jsx)(Z.Section,{collapsed:!1,title:"my_involvements.my_involvements",showSettings:!0,filterContents:(0,Sn.jsx)(to,{filterState:m,onSubmit:e=>S(e)}),children:l?(0,Sn.jsx)(Z.SectionLoader,{}):0===c.length?(0,Sn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,Sn.jsx)(Z.Text,{raw:"my_involvements.no_involvements"})}):(0,Sn.jsx)(zs,{linkGen:s,viewType:re,filter:m})})})};function so(e){return e.map((e=>({id:e.code+"",label:e.value,level:2,children:[],selectable:!0,value:!1})))}function oo(e){let t=so([{code:"EHITIS_SEISUND_KAVAN",value:"Kavandatav"},{code:"EHITIS_SEISUND_PYSTI",value:"Püstitamisel"},{code:"EHITIS_SEISUND_OLEMA",value:"Olemas"},{code:"EHITIS_SEISUND_LAMEL",value:"Lammutamisel"},{code:"EHITIS_SEISUND_LAMUT",value:"Lammutatud"},{code:"EHITIS_SEISUND_REATA",value:"Realiseerimata"},{code:"EHITIS_SEISUND_KUSTU",value:"Kustutatud"}]);return e?t:t.slice(0,-1)}const io=[{code:"EHITIS_OMANDI_LIIK_KINNIS",value:"Kinnisasi"},{code:"EHITIS_OMANDI_LIIK_VALLAS",value:"Vallasasi"},{code:"EHITIS_OMANDI_LIIK_VALLASRO",value:"Reaalosa kui vallasasi"}];function ro(){return so(io)}function ao(e){let t=[];for(let n of e)t.push(n.id),t.push(...ao(n.children?n.children:[]));return t}const lo=e=>{const t=(0,Q.useIntl)(),n={buildingLocation:"",buildingName:"",buildingStates:[],firstUseDate:{from:"",to:""},firstUseMissing:!1,buildingType:[],purposeOfUse:[],ownershipType:[],owner:void 0,isPrivatePerson:!1,searchType:ue},s=(0,Dn.useSelector)((e=>e.myViewsPage.filter.usageClassifierTypes)),o=(0,Dn.useSelector)((e=>e.myViewsPage.detailSearch.buildings)),[i,r]=(0,z.useState)(n),[a,l]=(0,z.useState)([]),[d,c]=(0,z.useState)(oo(e.isAdminRole)),[u]=(0,z.useState)(so([{code:"H",value:"Hoone"},{code:"R",value:"Rajatis"}])),[p]=(0,z.useState)(ro()),[h,m]=(0,z.useState)([]),[g,S]=(0,z.useState)({}),[f,I]=(0,z.useState)(""),[T,v]=(0,z.useState)({}),[E,_]=(0,z.useState)(""),[y,b]=(0,z.useState)(!1),[D,x]=(0,z.useState)({code:"",value:""}),M=(0,z.useRef)(),[N,O]=(0,z.useState)({});function A(e,t){let n;n=e.selectedData.length>0?void 0!==e.selectedData[0].data?e.selectedData[0].data.map((e=>e.id)):e.selectedData.map((e=>e.id)).flat():[],i[t]=n,r((e=>({...e})))}function U(e,t){let n;if(e.selectedData.length>0){n=ao(void 0===e.selectedData[0].data?e.selectedData:e.selectedData[0].data)}else n=[];i[t]=n,r((e=>({...e})))}function w(e,t){i[t]=e,r((e=>({...e})))}(0,z.useEffect)((()=>{if(s.length>0){const e=function(e){let t={id:"00000",label:"00000",parentId:"0",level:1,value:!1,selectable:!1,children:[]};for(let n of e){const{code:e,name:s,validTo:o}=n;let i=e.replace(/0/g,""),r=i.slice(0,i.length-1),a=t;for(let e=2;e<=r.length;e++)if(a.children){let t=a.children.find((t=>t.id.replace(/0/g,"")===r.slice(0,e)));t&&(a=t)}if(a.children){const t=`${e} ${s}${null!=o&&o.trim()?` (kuni ${o})`:""}`;a.children.push({id:n.id+"",parentId:a.id,label:t,level:a.level+1,children:[],selectable:!0,value:!1})}}return t.children?t.children:[]}([...s].sort(((e,t)=>Number(e.code)-Number(t.code))));m(e)}}),[s]),(0,z.useEffect)((()=>{c(oo(e.isAdminRole))}),[e.isAdminRole]);const j={sm:20,md:8,lg:8};return(0,Sn.jsxs)(Z.Form,{onSubmit:()=>function(){if(JSON.stringify(n)===JSON.stringify(i))v({header:"detailsearch.empty_filter_error.header",message:"detailsearch.empty_filter_error.message"});else if(i.firstUseMissing){let t={...i};t.firstUseDate={from:"",to:""},e.onSubmit(t)}else v({header:"",message:""}),e.onSubmit(i)}(),children:[T.header&&T.header.length>0&&T.message&&T.message.length>0&&(0,Sn.jsx)(Z.MessageBlock,{dismissible:!0,header:(0,Sn.jsx)(Q.FormattedMessage,{id:T.header}),onDismiss:()=>v({header:"",message:""}),theme:"danger",messages:[(0,Sn.jsx)(Q.FormattedMessage,{id:T.message})]}),o&&o.length>=500&&(0,Sn.jsx)(Z.MessageBlock,{dismissible:!0,header:(0,Sn.jsx)(Q.FormattedMessage,{id:"detailsearch.empty_filter_error.header"}),theme:"warning",messages:[(0,Sn.jsx)(Q.FormattedMessage,{id:"detailsearch.filter_error_message.more_than_500_results"})]}),(0,Sn.jsxs)(Z.Row,{className:"align-items-start",children:[(0,Sn.jsxs)(Z.Col,{xs:20,md:20,lg:10,className:"px-0",children:[(0,Sn.jsx)(Z.FieldWrapper,{labelCol:j,component:(0,Sn.jsx)(Z.Input,{name:"input",onChange:e=>w(e,"buildingLocation"),placeholder:t.formatMessage({id:"detailssearch.filter.placeholder.address"}),value:i.buildingLocation}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.building_location"}),info:{content:"detailsearch.filter.tooltip.building_location",placement:"top-start"}}),(0,Sn.jsx)(Z.FieldWrapper,{labelCol:j,component:(0,Sn.jsx)(Z.Input,{name:"input",onChange:e=>w(e,"buildingName"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.buildingName}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.building_name"}),info:{content:"detailsearch.filter.tooltip.building_name",placement:"top-start"}}),(0,Sn.jsx)(Z.FieldWrapper,{labelCol:j,component:(0,Sn.jsx)(Z.Multiselect,{name:"multiselect",options:d,onSelect:e=>A(e,"buildingStates"),allSelection:!0,onRemoveItem:e=>A(e,"buildingStates"),value:i.buildingStates,selectedOptions:a}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.building_state"}),info:{content:"detailsearch.filter.tooltip.building_state",placement:"top-start"}}),(0,Sn.jsx)(Z.FieldWrapper,{labelCol:j,component:(0,Sn.jsx)("div",{className:"daterange_in_form",children:(0,Sn.jsx)(Z.NumberRangeExtended,{value:{from:i.firstUseDate.from,to:i.firstUseDate.to},onChange:e=>function(e){I(""),v({header:"",message:""});let t=null!==e.from?e.from:"",n=null!==e.to?e.to:"";r((e=>({...e,firstUseDate:{from:t,to:n}})))}(e),onBlur:e=>function(e){let n=Number(e.from),s=Number(e.to);n<0||n>2100||s<0||s>2100?I(t.formatMessage({id:"detailsearch.error_field.year-between"})):null!==e.from&&null!==e.to&&n>s?I(t.formatMessage({id:"detailsearch.error_field.beginning-bigger"})):(I(""),v({header:"",message:""}))}(e),onlyPositive:!0,disabled:i.firstUseMissing})}),errorMessage:f,label:(0,Sn.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.first_use"}),info:{content:"detailsearch.filter.tooltip.first_use",placement:"top-start"}}),(0,Sn.jsx)(Sn.Fragment,{children:ms(i.firstUseMissing,(function(e){r((t=>({...t,firstUseMissing:e})))}),"detailsearch.filter.label.checkbox.first_use_missing","detailsearch.filter.tooltip.checkbox.first_use_missing",j)})]}),(0,Sn.jsxs)(Z.Col,{xs:20,md:20,lg:10,className:"px-0",children:[(0,Sn.jsx)(Z.FieldWrapper,{labelCol:j,component:(0,Sn.jsx)(Z.Multiselect,{name:"multiselect",options:u,onSelect:e=>A(e,"buildingType"),allSelection:!0,onRemoveItem:e=>A(e,"buildingType"),value:i.buildingType,selectedOptions:a}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.building_type"}),info:{content:"detailsearch.filter.tooltip.building_type",placement:"top-start"}}),(0,Sn.jsx)(Z.FieldWrapper,{labelCol:j,component:(0,Sn.jsx)(Z.Multiselect,{name:"multiselect",options:h,onSelect:e=>U(e,"purposeOfUse"),allSelection:!0,onRemoveItem:e=>U(e,"purposeOfUse"),value:i.purposeOfUse,selectedOptions:a,isSearchExactMatch:!0}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.purpose_of_use"}),info:{content:"detailsearch.filter.tooltip.purpose_of_use",placement:"top-start"}}),(0,Sn.jsx)(Z.FieldWrapper,{labelCol:j,component:(0,Sn.jsx)(Z.Multiselect,{name:"multiselect",options:p,onSelect:e=>A(e,"ownershipType"),allSelection:!0,onRemoveItem:e=>A(e,"ownershipType"),value:i.ownershipType,selectedOptions:a}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.ownershiptype"}),info:{content:"detailsearch.filter.tooltip.ownershiptype",placement:"top-start"}})]}),e.isAdminPlusRole&&(0,Sn.jsx)(Sn.Fragment,{children:(0,Sn.jsxs)(Z.Row,{className:"align-items-start w-100",children:[(0,Sn.jsx)(Z.Col,{xs:20,md:20,lg:10,className:"px-0",children:(0,Sn.jsx)(Z.FieldWrapper,{labelCol:j,component:(0,Sn.jsx)(Z.PersonSearchPageExtended,{person:g,disabled:!1,labelKey:"code",valueKey:"value",onInputChange:e=>{!function(e){_(e)}(e)},updatedFromAR:()=>{},onPersonUpdate:e=>function(e){var t,n,s;if(S(e),e&&e.id&&e.id>0&&O(e),e&&(E===e.idCode||E===(null===(t=e.id)||void 0===t?void 0:t.toString())||E===e.regCode)||e&&D.code===e.regCode)i.owner=null===(s=e.id)||void 0===s?void 0:s.toString(),r((e=>({...e})));else if(e||E.substring(4)!==(null===(n=N.id)||void 0===n?void 0:n.toString()))e||(i.owner=void 0,r((e=>({...e}))));else{var o;i.owner=null===(o=N.id)||void 0===o?void 0:o.toString(),r((e=>({...e})))}}(e),searchPerson:e.callSearchPerson,handlePersonSelection:e=>x(e),isShowError:e=>{b(e),e||v({header:"",message:""})},searchOnBlur:!0,ref:M,isOptionalField:!0,isPrivateOwner:i.isPrivatePerson}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.owner"}),info:{content:"detailsearch.filter.tooltip.owner.extended",placement:"top-start"}})}),(0,Sn.jsx)(Z.Col,{xs:20,md:20,lg:10,children:ms(i.isPrivatePerson,(function(e){r((t=>({...t,isPrivatePerson:e})))}),"detailsearch.filter.label.checkbox.owner.private","",{xs:20,md:1})})]})})]}),(0,Sn.jsxs)(Z.Row,{children:[(0,Sn.jsx)(Z.Col,{children:(0,Sn.jsx)(Z.Button,{onClick:()=>(l([]),r(n),M.current.clearTypeahead(),void S({})),colourScheme:"light",squared:!0,children:(0,Sn.jsx)(Q.FormattedMessage,{id:"button.epmty_fields"})})}),(0,Sn.jsx)(Z.Col,{children:(0,Sn.jsx)(Z.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!!(f.length>0||y),squared:!0,children:(0,Sn.jsx)(Q.FormattedMessage,{id:"button.search"})})})]})]})},co=e=>{const t=(0,Q.useIntl)(),n={buildingLocation:"",buildingName:"",institutions:[],documentDate:{from:"",to:""},documentType:[],documentNr:"",documentState:[],connectedPerson:void 0},[s,o]=(0,z.useState)(n),[i,r]=(0,z.useState)(""),[a,l]=(0,z.useState)([]),[d,c]=(0,z.useState)([]),[u,p]=(0,z.useState)([]),[h]=(0,z.useState)(so([{code:kn.DO_DOKUSEIS_ESITATUD,value:"Esitatud"},{code:kn.DO_DOKUSEIS_KOOSTAMISEL,value:"Koostamisel"},{code:kn.DO_DOKUSEIS_MENETLUSES,value:"Menetluses"},{code:kn.DO_DOKUSEIS_MUUTMISEL,value:"Muutmisel"},{code:kn.DO_DOKUSEIS_TAIENDAMISEL,value:"Täiendamisel"},{code:kn.DO_DOKUSEIS_KEHTETU,value:"Kehtetu"},{code:kn.DO_DOKUSEIS_REG_KANTUD,value:"Registrisse kantud"},{code:kn.DO_DOKUSEIS_TYHISTATUD,value:"Tühistatud"},{code:kn.DO_DOKUSEIS_LOOBUTUD,value:"Tagasi võetud"},{code:kn.DO_DOKUSEIS_ALLKIRJASTAMISEL,value:"Allkirjastamisel"},{code:kn.DO_DOKUSEIS_VANA_VERSIOON,value:"Vana versioon"}].sort(((e,t)=>e.value.localeCompare(t.value))))),[m,g]=(0,z.useState)({}),[S,f]=(0,z.useState)(""),[I,T]=(0,z.useState)(!1),[v,E]=(0,z.useState)({code:"",value:""}),[_,y]=(0,z.useState)({}),[b,D]=(0,z.useState)(!1),x=(0,z.useRef)(),M=(0,Dn.useSelector)((e=>e.myViewsPage.filter.documentTypes)),N=(0,Dn.useSelector)((e=>e.myViewsPage.filter.institutions)),O=(0,Dn.useSelector)((e=>e.myViewsPage.detailSearch.documents));function A(e,t){let n;e.selectedData.length>0?(n=void 0!==e.selectedData[0].data?e.selectedData[0].data:e.selectedData,n=n.map((e=>e.id.length<5?e.children.map((e=>e.id)):e.id)).flat()):n=[],s[t]=n,o((e=>({...e})))}function U(e,t){s[t]=e.trim(),o((e=>({...e})))}function w(e){return!(!Mn()(e,"YYYY-MM-DD",!0).isValid()&&!Mn()(e,"D.M.YYYY",!0).isValid())}(0,z.useEffect)((()=>{if(M){const e=Ss(M);c(e)}if(N){const e=Is([...N]);p(e)}}),[M,N]);const j={sm:20,md:8,lg:8};return(0,Sn.jsxs)(Z.Form,{onSubmit:()=>{i.length>0?D(!0):JSON.stringify(n)===JSON.stringify(s)?y({header:"detailsearch.empty_filter_error.header",message:"detailsearch.empty_filter_error.message"}):(e.onSubmit(s),y({header:"",message:""}))},children:[_.header&&_.header.length>0&&_.message&&_.message.length>0&&(0,Sn.jsx)(Z.MessageBlock,{dismissible:!0,header:(0,Sn.jsx)(Q.FormattedMessage,{id:_.header}),onDismiss:()=>y({header:"",message:""}),theme:"danger",messages:[(0,Sn.jsx)(Q.FormattedMessage,{id:_.message})]}),O&&O.length>500&&(0,Sn.jsx)(Z.MessageBlock,{dismissible:!0,header:(0,Sn.jsx)(Q.FormattedMessage,{id:"detailsearch.empty_filter_error.header"}),theme:"warning",messages:[(0,Sn.jsx)(Q.FormattedMessage,{id:"detailsearch.filter_error_message.more_than_500_results"})]}),(0,Sn.jsxs)(Z.Row,{className:"align-items-start",children:[(0,Sn.jsxs)(Z.Col,{xs:20,md:20,lg:10,className:"px-0",children:[(0,Sn.jsx)(Z.FieldWrapper,{labelCol:j,component:(0,Sn.jsx)(Z.Input,{name:"input",onChange:e=>U(e,"buildingLocation"),placeholder:t.formatMessage({id:"detailsearch.filter.placeholder.address_catastralUnit_ehrCode"}),value:s.buildingLocation}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.building_location"}),info:{content:"detailsearch.filter.tooltip.address_catastralUnit_ehrCode.extended",placement:"top-start"}}),(0,Sn.jsx)(Z.FieldWrapper,{labelCol:j,component:(0,Sn.jsx)(Z.Input,{name:"input",onChange:e=>U(e,"buildingName"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:s.buildingName}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.building_name"}),info:{content:"detailsearch.filter.tooltip.building_name",placement:"top-start"}}),(0,Sn.jsx)(Z.FieldWrapper,{labelCol:j,component:(0,Sn.jsx)(Z.Multiselect,{name:"multiselect",options:u,onSelect:e=>A(e,"institutions"),allSelection:!0,onRemoveItem:e=>A(e,"institutions"),value:s.institutions,selectedOptions:a}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.institution"})}),(0,Sn.jsx)(Z.FieldWrapper,{labelCol:j,component:(0,Sn.jsx)("div",{className:"daterange_in_form",children:(0,Sn.jsx)(Z.DateRange,{onBlur:()=>{D(!0)},value:s.documentDate,onChange:e=>(e=>{""!==e.from&&!w(e.from)||""!==e.to&&!w(e.to)?r(t.formatMessage({id:"filter.invalid_date_format"})):""!==e.from&&""!==e.to&&Mn()(e.from)>Mn()(e.to)?r(t.formatMessage({id:"filter.invalid_date_range"})):""!==e.from&&(Mn()(e.from)<Mn()("01.01.1990")||Mn()(e.from)>Mn()())||""!==e.to&&(Mn()(e.to)<Mn()("01.01.1990")||Mn()(e.to)>Mn()())?r(t.formatMessage({id:"detailsearch.document.date_range_error.message"},{dateToday:Mn()().format("DD.MM.YYYY")})):Mn()(e.to).diff(Mn()(e.from),"days")>367?r(t.formatMessage({id:"detailsearch.filter_error_message.date_range_too_long"})):(r(""),D(!1)),o((t=>({...t,documentDate:e})))})(e)})}),errorMessage:b&&i.length>0?i:null,label:(0,Sn.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.document_date"}),info:{content:"detailsearch.filter.tooltip.document_date",placement:"top-start"}})]}),(0,Sn.jsxs)(Z.Col,{xs:20,md:20,lg:10,className:"px-0",children:[(0,Sn.jsx)(Z.FieldWrapper,{labelCol:j,component:(0,Sn.jsx)(Z.Multiselect,{name:"multiselect",options:d,onSelect:e=>A(e,"documentType"),allSelection:!0,onRemoveItem:e=>A(e,"documentType"),value:s.documentType,selectedOptions:a}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.document_type"}),info:{content:"detailsearch.filter.tooltip.document_type",placement:"top-start"}}),(0,Sn.jsx)(Z.FieldWrapper,{labelCol:j,component:(0,Sn.jsx)(Z.Input,{name:"input",onChange:e=>U(e,"documentNr"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:s.documentNr}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.document_nr"}),info:{content:"detailsearch.filter.tooltip.document_nr",placement:"top-start"}}),(0,Sn.jsx)(Z.FieldWrapper,{labelCol:j,component:(0,Sn.jsx)(Z.Multiselect,{name:"multiselect",options:h,onSelect:e=>A(e,"documentState"),allSelection:!0,onRemoveItem:e=>A(e,"documentState"),value:s.documentState,selectedOptions:a}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.document_state"})})]})]}),!e.isNonAuthenticatedUser&&(0,Sn.jsx)(Z.Row,{children:(0,Sn.jsx)(Z.Col,{xs:20,md:20,lg:10,className:"px-0",children:(0,Sn.jsx)(Z.FieldWrapper,{labelCol:j,component:(0,Sn.jsx)(Z.PersonSearchPageExtended,{person:m,disabled:!1,labelKey:"code",valueKey:"value",onInputChange:e=>{!function(e){f(e),v.code.length>0&&E({code:"",value:""})}(e)},updatedFromAR:()=>{},onPersonUpdate:e=>function(e){var t;g(e),e&&(S===e.idCode||S===(null===(t=e.id)||void 0===t?void 0:t.toString())||S===e.regCode)||e&&v.code===e.regCode?(s.connectedPerson=e.id,o((e=>({...e})))):e||(s.connectedPerson=void 0,o((e=>({...e}))))}(e),searchPerson:e.callSearchPerson,handlePersonSelection:e=>E(e),isShowError:e=>{T(e),e||y({header:"",message:""})},searchOnBlur:!0,ref:x,isOptionalField:!0}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.connected_person"}),info:{content:"detailsearch.filter.tooltip.connected_person.extended",placement:"top-start"}})})}),(0,Sn.jsxs)(Z.Row,{children:[(0,Sn.jsx)(Z.Col,{children:(0,Sn.jsx)(Z.Button,{onClick:()=>(l([]),o(n),x.current.clearTypeahead(),void g({})),colourScheme:"light",squared:!0,children:(0,Sn.jsx)(Q.FormattedMessage,{id:"button.epmty_fields"})})}),(0,Sn.jsx)(Z.Col,{children:(0,Sn.jsx)(Z.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!!(b&&i.length>0||I),squared:!0,children:(0,Sn.jsx)(Q.FormattedMessage,{id:"button.search"})})})]})]})},uo=e=>{const t=(0,Q.useIntl)(),n={documentType:[],documentNr:"",proceedingDate:{from:"",to:""},proceedingNr:"",institutions:[]},[s,o]=(0,z.useState)(n),[i,r]=(0,z.useState)([]),[a,l]=(0,z.useState)([]),[d,c]=(0,z.useState)([]),[u,p]=(0,z.useState)(""),[h,m]=(0,z.useState)({}),[g,S]=(0,z.useState)(!1),f=(0,Dn.useSelector)((e=>e.myViewsPage.filter.documentTypes)),I=(0,Dn.useSelector)((e=>e.myViewsPage.filter.institutions)),T=(0,Dn.useSelector)((e=>e.myViewsPage.detailSearch.proceedings));function v(e,t){let n;e.selectedData.length>0?(n=void 0!==e.selectedData[0].data?e.selectedData[0].data:e.selectedData,n=n.map((e=>e.id.length<5?e.children.map((e=>e.id)):e.id)).flat()):n=[],s[t]=n,o((e=>({...e})))}function E(e,t){s[t]=e,o((e=>({...e})))}function _(e){return!(!Mn()(e,"YYYY-MM-DD",!0).isValid()&&!Mn()(e,"D.M.YYYY",!0).isValid())}(0,z.useEffect)((()=>{if(f){const e=Ss(f);l(e)}if(I){const e=Is([...I]);c(e)}}),[f,I]);const y={sm:20,md:8,lg:8};return(0,Sn.jsxs)(Z.Form,{onSubmit:()=>{u.length>0?S(!0):JSON.stringify(n)===JSON.stringify(s)?m({header:"detailsearch.empty_filter_error.header",message:"detailsearch.empty_filter_error.message"}):(e.onSubmit(s),m({header:"",message:""}))},children:[h.header&&h.header.length>0&&h.message&&h.message.length>0&&(0,Sn.jsx)(Z.MessageBlock,{dismissible:!0,header:(0,Sn.jsx)(Q.FormattedMessage,{id:h.header}),onDismiss:()=>m({header:"",message:""}),theme:"danger",messages:[(0,Sn.jsx)(Q.FormattedMessage,{id:h.message})]}),T&&T.length>500&&(0,Sn.jsx)(Z.MessageBlock,{dismissible:!0,header:(0,Sn.jsx)(Q.FormattedMessage,{id:"detailsearch.empty_filter_error.header"}),theme:"warning",messages:[(0,Sn.jsx)(Q.FormattedMessage,{id:"detailsearch.filter_error_message.more_than_500_results"})]}),(0,Sn.jsxs)(Z.Row,{className:"align-items-start",children:[(0,Sn.jsxs)(Z.Col,{xs:20,md:20,lg:10,className:"px-0",children:[(0,Sn.jsx)(Z.FieldWrapper,{labelCol:y,component:(0,Sn.jsx)(Z.Multiselect,{name:"multiselect",options:a,onSelect:e=>v(e,"documentType"),allSelection:!0,onRemoveItem:e=>v(e,"documentType"),value:s.documentType,selectedOptions:i}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.document_type"}),info:{content:"detailsearch.filter.tooltip.document_type",placement:"top-start"}}),(0,Sn.jsx)(Z.FieldWrapper,{labelCol:y,component:(0,Sn.jsx)(Z.Input,{name:"input",onChange:e=>E(e,"documentNr"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:s.documentNr}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.document_nr"}),info:{content:"detailsearch.filter.tooltip.document_nr",placement:"top-start"}}),(0,Sn.jsx)(Z.FieldWrapper,{labelCol:y,component:(0,Sn.jsx)("div",{className:"daterange_in_form",children:(0,Sn.jsx)(Z.DateRange,{onChange:e=>(e=>{""!==e.from&&!_(e.from)||""!==e.to&&!_(e.to)?p(t.formatMessage({id:"filter.invalid_date_format"})):""!==e.from&&""!==e.to&&Mn()(e.from)>Mn()(e.to)?p(t.formatMessage({id:"filter.invalid_date_range"})):""!==e.from&&(Mn()(e.from)<Mn()("01.01.1990")||Mn()(e.from)>Mn()())||""!==e.to&&(Mn()(e.to)<Mn()("01.01.1990")||Mn()(e.to)>Mn()())?p(t.formatMessage({id:"detailsearch.proceeding.date_range_error.message"},{dateToday:Mn()().format("DD.MM.YYYY")})):Mn()(e.to).diff(Mn()(e.from),"days")>367?p(t.formatMessage({id:"detailsearch.filter_error_message.date_range_too_long"})):(p(""),S(!1)),o((t=>({...t,proceedingDate:e})))})(e),value:s.proceedingDate,onBlur:()=>{S(!0)}})}),errorMessage:g&&u.length>0?u:null,label:(0,Sn.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.proceeding_date"}),info:{content:"detailsearch.filter.tooltip.proceeding_date",placement:"top-start"}})]}),(0,Sn.jsxs)(Z.Col,{xs:20,md:20,lg:10,className:"px-0",children:[(0,Sn.jsx)(Z.FieldWrapper,{labelCol:y,component:(0,Sn.jsx)(Z.Input,{name:"input",onChange:e=>E(e,"proceedingNr"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:s.proceedingNr}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.proceeding_nr"})}),(0,Sn.jsx)(Z.FieldWrapper,{labelCol:y,component:(0,Sn.jsx)(Z.Multiselect,{name:"multiselect",options:d,onSelect:e=>v(e,"institutions"),allSelection:!0,onRemoveItem:e=>v(e,"institutions"),value:s.institutions,selectedOptions:i}),label:(0,Sn.jsx)(Q.FormattedMessage,{id:"detailsearch.filter.label.institution"})})]})]}),(0,Sn.jsxs)(Z.Row,{children:[(0,Sn.jsx)(Z.Col,{children:(0,Sn.jsx)(Z.Button,{onClick:()=>(r([]),void o(n)),colourScheme:"light",squared:!0,children:(0,Sn.jsx)(Q.FormattedMessage,{id:"button.epmty_fields"})})}),(0,Sn.jsx)(Z.Col,{children:(0,Sn.jsx)(Z.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!!(g&&u.length>0),squared:!0,children:(0,Sn.jsx)(Q.FormattedMessage,{id:"button.search"})})})]})]})},po={EHITIS_SEISUND_KAVAN:["EHITIS_SEISUND_KAVAN","EHITIS_SEISUND_EHITAM_LUBA","EHITIS_SEISUND_MENETLUSES"],EHITIS_SEISUND_PYSTI:["EHITIS_SEISUND_PYSTI","EHITIS_SEISUND_EHITAMISEL"],EHITIS_SEISUND_OLEMA:["EHITIS_SEISUND_OLEMA","EHITIS_SEISUND_KASUTUSEL","EHITIS_SEISUND_KASUT_OSALINE","EHITIS_SEISUND_KASUT_LUBA_EIKEH","EHITIS_SEISUND_LAMMUT_LUBA","EHITIS_SEISUND_KASUT_MAAS","EHITIS_SEISUND_EBASEADUSLIK","EHITIS_SEISUND_MAARAMATA"],EHITIS_SEISUND_LAMEL:["EHITIS_SEISUND_LAMEL","EHITIS_SEISUND_LAMMUTAMISEL"],EHITIS_SEISUND_LAMUT:["EHITIS_SEISUND_LAMUT","EHITIS_SEISUND_LAMMUTATUD"],EHITIS_SEISUND_REATA:["EHITIS_SEISUND_REATA","EHITIS_SEISUND_EHITAM_LUBA_EIKEH"],EHITIS_SEISUND_KUSTU:["EHITIS_SEISUND_KUSTU","EHITIS_SEISUND_KUSTUTATUD","EHITIS_SEISUND_REG_OBJ_LOPP","EHITIS_SEISUND_ARHIIVIS"]};function ho(e){const t=function(e){return Wn(po,e)}(e);return t?function(e){switch(e){case"EHITIS_SEISUND_KAVAN":return{name:"Kavandatav",type:"info"};case"EHITIS_SEISUND_PYSTI":return{name:"EHITIS_SEISUND_PYSTI",type:"info"};case"EHITIS_SEISUND_OLEMA":return{name:"On",type:"success"};case"EHITIS_SEISUND_LAMEL":return{name:"Lammutamisel",type:"info"};case"EHITIS_SEISUND_LAMUT":return{name:"Lammutatud",type:"default"};case"EHITIS_SEISUND_REATA":return{name:"Realiseerimata",type:"default"};case"EHITIS_SEISUND_KUSTU":return{name:"Kustutatud",type:"default"};default:return{name:e,type:"default"}}}(t):{name:e,type:"default"}}const mo=e=>{const t=(0,Q.useIntl)(),[n,s]=(0,z.useState)([]),o=(0,Dn.useSelector)((e=>e.myViewsPage.detailSearch.buildings));(0,z.useEffect)((()=>{if(o&&o.length>0){const t=e.isAdminRole?o:o.filter((e=>"EHITIS_SEISUND_KUSTU"!==e.buildingState.code));s(t)}}),[o]);const i=[{id:"ehr_code",property:"ehrCode",size:130,isFrozen:!0,getValue:e=>e.ehrCode?e.ehrCode:"",getFormattedValue:t=>{const{generateLink:n}=e,s=t.ehrCode?n(he,String(t.ehrCode),null,!1,!1,null):null;return t.ehrCode&&null!==t.ehrCode?(0,Sn.jsx)(vn,{linkName:t.ehrCode,tooltipText:"detailsearch.tooltip.open_building",href:s||void 0}):""}},{id:"building_address",property:"buildingaddress",size:160,getValue:e=>{var t;return null!==(t=e.buildingaddress)&&void 0!==t?t:""},getFormattedValue:e=>e.buildingaddress&&null!==e.buildingaddress?e.buildingaddress.map((e=>(0,Sn.jsx)("div",{children:e}))):""},{id:"building_name",property:"buildingName",size:130,getValue:e=>{var t;return null!==(t=e.buildingName)&&void 0!==t?t:""}},{id:"building_state",property:"buildingState",size:130,getValue:e=>{var t;return null!==(t=e.buildingState)&&void 0!==t?t:""},getFormattedValue:e=>e.buildingState&&null!==e.buildingState?(0,Sn.jsx)(Z.Status,{type:ho(e.buildingState.code).type,children:e.buildingState.value}):""},{id:"purpose_of_use",property:"purposeOfUse",size:150,getValue:e=>{var t,n;return null!==(t=null===(n=e.purposeOfUse)||void 0===n?void 0:n.value)&&void 0!==t?t:""}},{id:"first_use_date",property:"firstUseDate",size:150,getValue:e=>{var t;return null!==(t=e.firstUseDate)&&void 0!==t?t:""}},{id:"under_area",property:"underArea",size:130,getValue:e=>e.underArea?e.underArea:""},{id:"floor_count",property:"floorCount",size:130,getValue:e=>e.floorCount?e.floorCount:""},{id:"ownership_type",property:"ownershipType",size:130,getValue:e=>{var t,n;return null!==(t=null===(n=e.ownershipType)||void 0===n?void 0:n.value)&&void 0!==t?t:""}},{id:"owner",property:"owner",size:130,getValue:e=>{var t;return null!==(t=e.owner)&&void 0!==t?t:""},getFormattedValue:e=>e.owner?e.owner.map((e=>function(e){var t;const n=e.eesnimi?e.eesnimi+" "+e.perenimi:void 0,s=e.isikukood?(0,Sn.jsxs)(Sn.Fragment,{children:[(0,Sn.jsx)("br",{}),"IK "+e.isikukood]}):void 0,o=null!==e.regKood,i=null!==(t=e.jiNimi)&&void 0!==t?t:"";return!0===o?(0,Sn.jsx)("div",{children:i}):n?(0,Sn.jsxs)("div",{children:[n,null!=s?s:""]}):""}(e))):""}];return(0,Sn.jsx)("div",{children:(0,Sn.jsx)(Z.TableComponent,{config:{thead:{headers:(e.isAdminPlusRole?i:i.slice(0,-1)).map((e=>({id:e.id,size:e.size,className:"table-header-field text-align-left",label:t.formatMessage({id:"detailsearch.buildings.table.header."+e.id}),tooltip:{text:t.formatMessage({id:"detailsearch.buildings.table.tooltip."+e.id})},propertyName:e.property,sortable:!0,isShown:!0,isFrozen:e.isFrozen,type:"input",valueFormatter:t=>e.getFormattedValue?e.getFormattedValue(t):e.getValue(t)}))),icons:Tn,expandableRow:!1,isFilter:!1}},data:function(e){return e.map((e=>({buildingaddress:e.buildingaddress,buildingId:e.buildingId,buildingName:e.buildingName,buildingType:e.buildingType,ehrCode:e.ehrCode,firstUseDate:e.firstUseDate,owner:e.owner,ownershipType:e.ownershipType,purposeOfUse:e.purposeOfUse,buildingState:e.buildingState,floorCount:e.floorCount,underArea:e.underArea})))}(n),handleEvent:()=>!0})})},go="DD.MM.YYYY",So="YYYY-MM-DD";class fo{static dateToStr(e){return fo.formatDate(go,e)}static dateToStrForDatepicker(e){return fo.formatDate(So,e)}static dateWithTimeToStr(e){return fo.formatDate("DD.MM.YYYY HH:mm",e)}static formatDate(e,t){return t?Mn()(t).format(e):""}static dateToMs(e,t){const n=Mn()(t,e);return t&&n.isValid()?n.valueOf():void 0}}let Io=function(e){return e.Document="DOCUMENT",e.Proceeding="PROCEEDING",e.AdminProceeding="ADMIN_PROCEEDING",e.ProceedingDecision="PROCEEDING_DECISION",e.Operation="OPERATION",e.MyDocuments="MY_DOCUMENTS",e.MyProceedings="MY_PROCEEDINGS",e.MyAdministrativeProceedings="MY_ADMIN_PROCEEDINGS",e.Building="BUILDING",e.NewEnergy="NEW_ENERGY",e.ArchiveBuildingRegistryFile="ARCHIVE_BUILDINGREGISTRYFILE",e.ArchiveBuildingDatasOf2003="ARCHIVE_BUILDINGDATAASOF2003",e.ArchiveBuildingDatasOf2014="ARCHIVE_BUILDINGDATAASOF2014",e.Restriction="RESTRICTION",e.NotFound="404",e}({});const To=e=>e?(e=>[...be,...De].includes(e))(e)?Io.AdminProceeding:Io.Proceeding:Io.NotFound;const vo=e=>{var t,n,s,o,i,r;const a=(0,Q.useIntl)(),[l,d]=(0,z.useState)([]),c=(0,Dn.useSelector)((e=>e.myViewsPage.detailSearch.documents)),u=(0,Dn.useSelector)((e=>e.myViewsPage.filter.institutions)),p=null!==(t=null===(n=e.userInfo)||void 0===n||null===(s=n.activeRole)||void 0===s?void 0:s.businessType)&&void 0!==t?t:"",h=null!==(o=null===(i=e.userInfo)||void 0===i||null===(r=i.activeRole)||void 0===r?void 0:r.businessId)&&void 0!==o?o:0;(0,z.useEffect)((()=>{c&&c.length>0&&d(c)}),[c]);const m=e.filterStateDocumentsSearch.buildingLocation,g=e.filterStateDocumentsSearch.buildingName;const S=m?m.toString().toLowerCase().replace(/[&|=;~!$>*%_()?.+:'"\\]/g,"").replace(/\t/g," ").replace(/\s{2,}/g," ").replace(/\s?-\s?/g,"-"):"";function f(e,t){const n=(s=function(e){return e.replace(/\btn\b/g,"").replace(/\btänav\b/g,"").replace(/\btee\b/g,"").replace(/\bmaantee\b/g,"").replace(/\bmnt\b/g,"").replace(/\bküla\b/g,"").replace(/\blinnaosa\b/g,"").replace(/\blinn\b/g,"").replace(/\bpuiestee\b/g,"").replace(/\bpst\b/g,"").replace(/\bvald\b/g,"").replace(/\balevik\b/g,"").replace(/\balev\b/g,"").replace(/\bpõik\b/g,"").replace(/\blõik\b/g,"")}(e),s.replaceAll("//","").replaceAll(",","").split(/\s+/g).reduce(((e,t)=>{if(Number.isNaN(Number(t[0]))&&Number.isNaN(Number(t[1])))e.push(t);else{const n=` ${t}`;e[e.length-1]+=n}return e}),[]));var s;const o=t.replace(/\s+/g," ").split(/\/\/\s+(?=[a-z]+\b)/gi);return n.every((e=>{const t=e.trim().split(/\s+/);return o.some((e=>t.every((t=>new RegExp(`(?<![\\/\\-])\\b${t}\\b`,"i").test(e)))))}))}const I=["tn","tänav","tee","maantee","mnt","küla","linnaosa","linn","puiestee","pst","vald","alevik","alev","põik","lõik"];function T(e,t){var n;const s=null===(n=t.buildingAddress)||void 0===n?void 0:n.map((t=>function(e,t){return I.some((n=>{const s=new RegExp(`\\b(\\w+)\\s+${n}\\b`,"i"),o=e.match(s);if(o){const e=o[1];return new RegExp(`\\b${e}\\s+${n}\\b`,"i").test(t)}return!1}))}(e,t.toLowerCase())));return!!s&&s.indexOf(!0)>-1}function v(e){const t=e.filter((e=>function(e,t){var n;const s=null===(n=t.buildingAddress)||void 0===n?void 0:n.map((t=>f(e,t.toLowerCase())));return!!s&&s.indexOf(!0)>-1}(S,e)));return I.some((e=>function(e){return!new RegExp(`\\b${e}\\b`,"gi").test(e)}(e)))?t.filter((e=>T(S,e))):t}function E(){return!Number.isNaN(Number(S))}function _(){if(S&&S.indexOf(", ")>-1){return S.split(", ").reverse().join(", ")}return S}function y(e){const t=e.buildingName,n=e.buildingAddress;return t&&n&&(n.some((e=>e.toLowerCase().split(" ").some((e=>t.some((t=>t.toLowerCase().includes(e)))))))||t.some((e=>e.toLowerCase().split(" ").some((e=>n.some((t=>t.toLowerCase().includes(e))))))))}function b(e){let t=0;if(e.buildingAddress&&e.buildingAddress.length>0&&e.buildingAddress[0].length<200){const n=S.replace(",","").split(" ");let s=e.buildingAddress[0].toLowerCase().split(", ");const o=new Set;s.forEach((e=>{const t=e.split(" ")[0];return o.add(t)})),s=Array.from(o),s.forEach((e=>(n.includes(e)&&(t+=1),t)))}else t=-1;return t}const D=new RegExp(`\\b${S}\\b(?![\\/\\-])`,"i"),x=new RegExp(`\\b${_()}\\b(?![\\/\\-])`,"i"),M=S.replace(",","").split(/(?:\/|\s)+/g);function N(e){const t=e.buildingAddress;return t?t.findIndex((e=>e.toLowerCase()===S||e.toLowerCase()===_()))>-1?"exact":t.findIndex((e=>D.test(e.toLowerCase())||x.test(e.toLowerCase())))>-1?"partial":t.findIndex((e=>{const t=e.toLowerCase().replace(",","").replace(/\/\//g," ");return M.every((e=>t.includes(e)))}))>-1?"vague":"other":""}const O=["exact","partial","vague","other"];function A(e){return e.map((e=>{return t=e,{...t,title:t.docId,addressWithBuilding:y(t),addressMatch:N(t),addressRank:b(t)};var t})).sort(((e,t)=>{const n=O.indexOf(e.addressMatch),s=O.indexOf(t.addressMatch);return n!==s?n-s:e.addressWithBuilding!==t.addressWithBuilding?""===g?e.addressWithBuilding?1:-1:e.addressWithBuilding?-1:1:t.addressRank-e.addressRank}))}const U=[{id:"doc_date",property:"docDate",size:130,getValue:e=>fo.dateToStr(e.docDate),isFrozen:!0},{id:"reg_date",property:"regDate",size:130,getValue:e=>fo.dateToStr(e.regDate)},{id:"doc_nr",property:"docNr",size:160,getValue:e=>{var t;return null!==(t=e.docNr)&&void 0!==t?t:""},getFormattedValue:t=>{const{generateLink:n}=e,s=t.docNr?n(ge,String(t.docNr),null,!1,!1,{docId:t.docId,ehrCode:t.ehrCode}):null;return t.docNr&&null!==t.docNr?(0,Sn.jsx)(vn,{linkName:t.docNr,tooltipText:"detailsearch.tooltip.open_document",href:s||void 0}):""}},{id:"document_type",property:"documentType",size:160,getValue:e=>{var t;return null!==(t=e.documentType)&&void 0!==t?t:""}},{id:"building_name",property:"buildingName",size:130,getValue:e=>{var t;return null!==(t=e.buildingName)&&void 0!==t?t:""},getFormattedValue:e=>e.buildingName&&null!==e.buildingName?e.buildingName.map((e=>(0,Sn.jsx)("div",{children:e}))):""},{id:"ehr_code",property:"ehrCode",size:130,getValue:e=>{var t;return null!==(t=e.ehrCode)&&void 0!==t?t:""},getFormattedValue:t=>{const{generateLink:n}=e;return t.ehrCode?t.ehrCode.map(((e,s)=>{const o=t.ehrCode?n(he,String(e),null,!1,!1,null):null;return(0,Sn.jsxs)(Sn.Fragment,{children:[(0,Sn.jsx)(vn,{linkName:e,tooltipText:"detailsearch.tooltip.open_building",href:o||void 0}),s!==t.ehrCode.length-1?(0,Sn.jsx)("span",{children:", "}):""]})})):""}},{id:"building_address",property:"buildingAddress",size:130,getValue:e=>{var t;return null!==(t=e.buildingAddress)&&void 0!==t?t:""},getFormattedValue:e=>e.buildingAddress&&null!==e.buildingAddress?e.buildingAddress.map((e=>(0,Sn.jsx)("div",{children:e}))):""},{id:"doc_state",property:"stateCode",size:180,getValue:e=>{var t;return null!==(t=e.stateCode)&&void 0!==t?t:""},getFormattedValue:e=>e.stateCode&&null!==e.stateCode?(0,Sn.jsx)(Z.Status,{type:Gn(e.stateCode).type,children:Gn(e.stateCode).name}):""},{id:"proceeding_nr",property:"proceedingNr",size:130,getValue:e=>{var t;return null!==(t=e.proceedingNr)&&void 0!==t?t:""},getFormattedValue:t=>{var n;const{generateLink:s}=e,o=To(null===(n=t.doty)||void 0===n?void 0:n.toString()),i=t.proceedingNr?s(o,String(t.proceedingNr),null,!1,!1,null):null;return t.proceedingNr?p===Se.MKM||t.institutionId&&h===t.institutionId?(0,Sn.jsx)(vn,{linkName:t.proceedingNr,tooltipText:"detailsearch.tooltip.open_proceeding",href:i||void 0}):t.proceedingNr:""}},{id:"presenter",property:"presenter",size:130,getValue:e=>{var t;return null!==(t=e.presenter)&&void 0!==t?t:""},getFormattedValue:e=>e.presenter?e.presenter.map(((t,n)=>(0,Sn.jsxs)("div",{children:[t,n!==e.presenter.length-1?(0,Sn.jsx)("span",{children:", "}):""]}))):""},{id:"institution",property:"institutionName",size:130,getValue:e=>{var t;return null!==(t=e.institutionName)&&void 0!==t?t:""}}];return(0,Sn.jsx)(Z.TableComponent,{config:{thead:{headers:U.map((e=>({id:e.id,size:e.size,className:"table-header-field text-align-left",label:a.formatMessage({id:"detailsearch.documents.table.header."+e.id}),tooltip:{text:a.formatMessage({id:"detailsearch.documents.table.tooltip."+e.id})},propertyName:e.property,sortable:!0,isShown:!0,isFrozen:e.isFrozen,type:"input",valueFormatter:t=>e.getFormattedValue?e.getFormattedValue(t):null==e?void 0:e.getValue(t)}))),icons:Tn,expandableRow:!1,isFilter:!1}},data:function(e){let t;if(0===(null==m?void 0:m.indexOf('"'))&&(null==m?void 0:m.lastIndexOf('"'))===m.length-1){const n=v(e);t=E()||S.length<2?n:A(n)}else t=E()||S.length<2?e:A(e);const n=t.map((e=>{var t,n,s,o;return{docId:e.docId,docDate:null!==(t=fo.dateToMs(go,e.docDate))&&void 0!==t?t:"",regDate:null!==(n=fo.dateToMs(go,e.regDate))&&void 0!==n?n:"",deadlineDate:e.deadlineDate,docNr:e.docNr,documentType:e.documentType,doty:e.doty,buildingName:e.buildingName,ehrCode:e.ehrCode,buildingAddress:e.buildingAddress,state:e.state,stateCode:e.stateCode,proceedingNr:e.proceedingNr,presenter:e.presenter,institutionId:e.institutionId,institutionName:null!==(s=null===(o=u.find((t=>t.id===e.institutionId)))||void 0===o?void 0:o.regName)&&void 0!==s?s:""}}));return n}(l),handleEvent:()=>!0})},Eo=e=>{var t,n,s,o;const i=(0,Q.useIntl)(),[r,a]=(0,z.useState)([]),l=(0,Dn.useSelector)((e=>e.myViewsPage.detailSearch.proceedings)),d=(0,Dn.useSelector)((e=>e.myViewsPage.filter.documentTypes)),c=(0,Dn.useSelector)((e=>e.myViewsPage.filter.institutions)),u=e.userInfo&&e.userInfo.activeRole&&null!==(t=e.userInfo.activeRole)&&void 0!==t&&t.businessType?null===(n=e.userInfo.activeRole)||void 0===n?void 0:n.businessType:"",p=e.userInfo&&e.userInfo.activeRole&&null!==(s=e.userInfo.activeRole)&&void 0!==s&&s.businessId?null===(o=e.userInfo.activeRole)||void 0===o?void 0:o.businessId:0;(0,z.useEffect)((()=>{l&&l.length>0&&a(l)}),[l]);const h=[{id:"date_start",property:"dateStart",size:130,getValue:e=>fo.dateToStr(e.dateStart),isFrozen:!0},{id:"date_end",property:"dateEnd",size:130,getValue:e=>fo.dateToStr(e.dateEnd)},{id:"proceeding_nr",property:"proceedingNr",size:130,getValue:e=>{var t;return null!==(t=e.proceedingNr)&&void 0!==t?t:""},getFormattedValue:t=>{const{generateLink:n}=e,s=To(t.doty),o=t.proceedingNr?n(s,String(t.proceedingNr),null,!1,!1,null):null;return t.proceedingNr&&null!==t.proceedingNr?"MKM"===u||t.institutionId&&p===t.institutionId?(0,Sn.jsx)(vn,{linkName:t.proceedingNr,tooltipText:"detailsearch.tooltip.open_proceeding",href:o||void 0}):t.proceedingNr:""}},{id:"proceeding_state",property:"proceedingState",size:200,getValue:e=>{var t;return null!==(t=e.proceedingStateCode)&&void 0!==t?t:""},getFormattedValue:e=>e.proceedingStateCode&&null!==e.proceedingStateCode?(0,Sn.jsx)(Z.Status,{type:Os(e.proceedingStateCode).type,children:Os(e.proceedingStateCode).name}):""},{id:"document",property:"docNr",size:160,getValue:e=>{var t;return null!==(t=e.docNr)&&void 0!==t?t:""},getFormattedValue:t=>{const{generateLink:n}=e,s=t.docNr?n(ge,String(t.docNr),null,!1,!1,null):null;return t.docNr&&null!==t.docNr?(0,Sn.jsx)(vn,{linkName:t.docNr,tooltipText:"detailsearch.tooltip.open_document",href:s||void 0}):""}},{id:"document_type",property:"documentType",size:180,getValue:e=>{var t;return null!==(t=e.documentType)&&void 0!==t?t:""}},{id:"building_name",property:"buildingName",size:130,getValue:e=>{var t;return null!==(t=e.buildingName)&&void 0!==t?t:""},getFormattedValue:e=>e.buildingName&&null!==e.buildingName?e.buildingName.map((e=>(0,Sn.jsx)("div",{children:e}))):""},{id:"ehr_code",property:"ehrCode",size:130,getValue:e=>{var t;return null!==(t=e.ehrCode)&&void 0!==t?t:""},getFormattedValue:t=>{const{generateLink:n}=e;return t.ehrCode&&null!==t.ehrCode?t.ehrCode.map(((e,s)=>{const o=t.ehrCode?n(he,String(e),null,!1,!1,null):null;return(0,Sn.jsxs)(Sn.Fragment,{children:[(0,Sn.jsx)(vn,{linkName:e,tooltipText:"detailsearch.tooltip.open_building",href:o||void 0}),s!==t.ehrCode.length-1?(0,Sn.jsx)("span",{children:", "}):""]})})):""}},{id:"building_address",property:"buildingAddress",size:160,getValue:e=>{var t;return null!==(t=e.buildingAddress)&&void 0!==t?t:""},getFormattedValue:e=>e.buildingAddress&&null!==e.buildingAddress?e.buildingAddress.map((e=>(0,Sn.jsx)("div",{children:e}))):""},{id:"proceeding_name",property:"proceedingName",size:160,getValue:e=>{var t;return null!==(t=e.proceedingName)&&void 0!==t?t:""}},{id:"supervisor",property:"supervisorName",size:130,getValue:e=>{var t;return null!==(t=e.supervisorName)&&void 0!==t?t:""}},{id:"institution",property:"institutionName",size:130,getValue:e=>{var t;return null!==(t=e.institutionName)&&void 0!==t?t:""}},{id:"archived",property:"archived",size:130,getValue:e=>e.archived&&"2"===e.archived?"Jah":"Ei"}];return(0,Sn.jsx)(Z.TableComponent,{config:{thead:{headers:h.map((e=>({id:e.id,size:e.size,className:"table-header-field text-align-left",label:i.formatMessage({id:"detailsearch.proceedings.table.header."+e.id}),tooltip:{text:i.formatMessage({id:"detailsearch.proceedings.table.tooltip."+e.id})},propertyName:e.property,sortable:!0,isShown:!0,isFrozen:e.isFrozen,type:"input",valueFormatter:t=>e.getFormattedValue?e.getFormattedValue(t):e.getValue(t)}))),icons:Tn,expandableRow:!1,isFilter:!1}},data:function(e){const t=e.map((e=>{var t,n,s,o,i,r;return{proceedingId:e.proceedingId,dateStart:null!==(t=fo.dateToMs(go,e.dateStart))&&void 0!==t?t:"",dateEnd:null!==(n=fo.dateToMs(go,e.dateEnd))&&void 0!==n?n:"",proceedingNr:e.proceedingNr,proceedingState:e.proceedingState,proceedingStateCode:e.proceedingStateCode,docNr:e.docNr,documentType:null!==(s=null===(o=d.find((t=>t.id.toString()===e.documentType)))||void 0===o?void 0:o.name)&&void 0!==s?s:"",doty:e.documentType,proceedingName:e.proceedingName,institutionId:e.institutionId,institutionName:null!==(i=null===(r=c.find((t=>t.id===e.institutionId)))||void 0===r?void 0:r.regName)&&void 0!==i?i:"",supervisorId:e.supervisorId,supervisorName:e.supervisorName,archived:e.archived,buildingName:e.buildingName,ehrCode:e.ehrCode,buildingAddress:e.buildingAddress}}));return t}(r),handleEvent:()=>!0})},_o="https://devkluster.ehr.ee/api/building/v2".replace(/\/+$/,"");class yo{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_o,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ae();this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class bo extends Error{constructor(e,t){super(t),this.name="RequiredError",this.field=e}}const Do="https://example.com",xo=function(e,t,n){if(null==n)throw new bo(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},Mo=function(e){const t=new URLSearchParams(e.search);for(var n=arguments.length,s=new Array(n>1?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];for(const e of s)for(const n in e)if(Array.isArray(e[n])){t.delete(n);for(const s of e[n])t.append(n,s)}else t.set(n,e[n]);e.search=t.toString()},No=function(e,t,n){const s="string"!=typeof e;return(s&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):s)?JSON.stringify(void 0!==e?e:{}):e||""},Oo=function(e){return e.pathname+e.search+e.hash},Ao=function(e,t,n,s){return function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;const r={...e.options,url:((null==s?void 0:s.basePath)||i)+e.url};return o.request(r)}},Uo=function(e){const t=function(e){return{buildingChangesGet:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};xo("buildingChangesGet","ehrCode",t),xo("buildingChangesGet","dokNr",n);const o=new URL("/buildingChanges",Do);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...s},a={};void 0!==t&&(a.ehr_code=t),void 0!==n&&(a.dok_nr=n),Mo(o,a,s.query);let l=i&&i.headers?i.headers:{};return r.headers={...l,...s.headers},{url:Oo(o),options:r}},buildingCompareGet:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};xo("buildingCompareGet","doEhitisId1",t),xo("buildingCompareGet","doEhitisId2",n);const o=new URL("/buildingCompare",Do);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...s},a={};void 0!==t&&(a.do_ehitis_id1=t),void 0!==n&&(a.do_ehitis_id2=n),Mo(o,a,s.query);let l=i&&i.headers?i.headers:{};return r.headers={...l,...s.headers},{url:Oo(o),options:r}},buildingDataGet:async function(t,n,s,o){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const r=new URL("/buildingData",Do);let a;e&&(a=e.baseOptions);const l={method:"GET",...a,...i},d={};void 0!==t&&(d.ehr_code=t),void 0!==n&&(d.ehr_id=n),void 0!==s&&(d.version=s),void 0!==o&&(d.json=o),Mo(r,d,i.query);let c=a&&a.headers?a.headers:{};return l.headers={...c,...i.headers},{url:Oo(r),options:l}},buildingDeepCopyPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};xo("buildingDeepCopyPost","deepCopyPostRequest",t);const s=new URL("/buildingDeepCopy",Do);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Mo(s,{},n.query);let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=No(t,i,e),{url:Oo(s),options:i}},buildingOwnerSearchPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};xo("buildingOwnerSearchPost","bSearchOPostRequest",t);const s=new URL("/buildingOwnerSearch",Do);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Mo(s,{},n.query);let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=No(t,i,e),{url:Oo(s),options:i}},buildingSearchPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};xo("buildingSearchPost","bSearchPostRequest",t);const s=new URL("/buildingSearch",Do);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Mo(s,{},n.query);let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=No(t,i,e),{url:Oo(s),options:i}},buildingSecureDataArrayPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};xo("buildingSecureDataArrayPost","requestBody",t);const s=new URL("/buildingSecureDataArray",Do);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Mo(s,{},n.query);let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=No(t,i,e),{url:Oo(s),options:i}},buildingSecureDataGet:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const o=new URL("/buildingSecureData",Do);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...s},a={};void 0!==t&&(a.ehr_code=t),void 0!==n&&(a.ehr_id=n),Mo(o,a,s.query);let l=i&&i.headers?i.headers:{};return r.headers={...l,...s.headers},{url:Oo(o),options:r}},buildingVersionsGet:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};xo("buildingVersionsGet","ehrCode",t);const s=new URL("/buildingVersions",Do);let o;e&&(o=e.baseOptions);const i={method:"GET",...o,...n},r={};void 0!==t&&(r.ehr_code=t),Mo(s,r,n.query);let a=o&&o.headers?o.headers:{};return i.headers={...a,...n.headers},{url:Oo(s),options:i}},buildingsDataPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};xo("buildingsDataPost","ehrCodesPostRequest",t);const s=new URL("/buildingsData",Do);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},r={"Content-Type":"application/json"};Mo(s,{},n.query);let a=o&&o.headers?o.headers:{};return i.headers={...r,...a,...n.headers},i.data=No(t,i,e),{url:Oo(s),options:i}},findEhrcodesDateafterGet:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};xo("findEhrcodesDateafterGet","timestamp",t);const o=new URL("/find/ehrcodes/dateafter",Do);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...s},a={};void 0!==t&&(a.timestamp=t instanceof Date?t.toISOString():t),void 0!==n&&(a.offset=n),Mo(o,a,s.query);let l=i&&i.headers?i.headers:{};return r.headers={...l,...s.headers},{url:Oo(o),options:r}},findEhrcodesDocIdGet:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};xo("findEhrcodesDocIdGet","id",t);const s=new URL("/find/ehrcodes/docId",Do);let o;e&&(o=e.baseOptions);const i={method:"GET",...o,...n},r={};void 0!==t&&(r.id=t),Mo(s,r,n.query);let a=o&&o.headers?o.headers:{};return i.headers={...a,...n.headers},{url:Oo(s),options:i}}}}(e);return{async buildingChangesGet(n,s,o){const i=await t.buildingChangesGet(n,s,o);return Ao(i,Ae(),_o,e)},async buildingCompareGet(n,s,o){const i=await t.buildingCompareGet(n,s,o);return Ao(i,Ae(),_o,e)},async buildingDataGet(n,s,o,i,r){const a=await t.buildingDataGet(n,s,o,i,r);return Ao(a,Ae(),_o,e)},async buildingDeepCopyPost(n,s){const o=await t.buildingDeepCopyPost(n,s);return Ao(o,Ae(),_o,e)},async buildingOwnerSearchPost(n,s){const o=await t.buildingOwnerSearchPost(n,s);return Ao(o,Ae(),_o,e)},async buildingSearchPost(n,s){const o=await t.buildingSearchPost(n,s);return Ao(o,Ae(),_o,e)},async buildingSecureDataArrayPost(n,s){const o=await t.buildingSecureDataArrayPost(n,s);return Ao(o,Ae(),_o,e)},async buildingSecureDataGet(n,s,o){const i=await t.buildingSecureDataGet(n,s,o);return Ao(i,Ae(),_o,e)},async buildingVersionsGet(n,s){const o=await t.buildingVersionsGet(n,s);return Ao(o,Ae(),_o,e)},async buildingsDataPost(n,s){const o=await t.buildingsDataPost(n,s);return Ao(o,Ae(),_o,e)},async findEhrcodesDateafterGet(n,s,o){const i=await t.findEhrcodesDateafterGet(n,s,o);return Ao(i,Ae(),_o,e)},async findEhrcodesDocIdGet(n,s){const o=await t.findEhrcodesDocIdGet(n,s);return Ao(o,Ae(),_o,e)}}};class wo extends yo{buildingChangesGet(e,t,n){return Uo(this.configuration).buildingChangesGet(e,t,n).then((e=>e(this.axios,this.basePath)))}buildingCompareGet(e,t,n){return Uo(this.configuration).buildingCompareGet(e,t,n).then((e=>e(this.axios,this.basePath)))}buildingDataGet(e,t,n,s,o){return Uo(this.configuration).buildingDataGet(e,t,n,s,o).then((e=>e(this.axios,this.basePath)))}buildingDeepCopyPost(e,t){return Uo(this.configuration).buildingDeepCopyPost(e,t).then((e=>e(this.axios,this.basePath)))}buildingOwnerSearchPost(e,t){return Uo(this.configuration).buildingOwnerSearchPost(e,t).then((e=>e(this.axios,this.basePath)))}buildingSearchPost(e,t){return Uo(this.configuration).buildingSearchPost(e,t).then((e=>e(this.axios,this.basePath)))}buildingSecureDataArrayPost(e,t){return Uo(this.configuration).buildingSecureDataArrayPost(e,t).then((e=>e(this.axios,this.basePath)))}buildingSecureDataGet(e,t,n){return Uo(this.configuration).buildingSecureDataGet(e,t,n).then((e=>e(this.axios,this.basePath)))}buildingVersionsGet(e,t){return Uo(this.configuration).buildingVersionsGet(e,t).then((e=>e(this.axios,this.basePath)))}buildingsDataPost(e,t){return Uo(this.configuration).buildingsDataPost(e,t).then((e=>e(this.axios,this.basePath)))}findEhrcodesDateafterGet(e,t,n){return Uo(this.configuration).findEhrcodesDateafterGet(e,t,n).then((e=>e(this.axios,this.basePath)))}findEhrcodesDocIdGet(e,t){return Uo(this.configuration).findEhrcodesDocIdGet(e,t).then((e=>e(this.axios,this.basePath)))}}const jo=e=>{var t,n,s,o;let{buildingsActualDataApiEndpoint:i,classifierApiEndpoint:r,linkGen:a,generateLink:l,myViewsApiEndpoint:d,searchType:c,userApiEndpoint:u,userInfo:p}=e;const h=(0,Dn.useDispatch)(),m=["MKM","KOV","TJA"].includes(p&&p.activeRole&&null!==(t=p.activeRole)&&void 0!==t&&t.businessType?null===(n=p.activeRole)||void 0===n?void 0:n.businessType:""),S=["MKM","KOV","TJA","N","KT"].includes(p&&p.activeRole&&null!==(s=p.activeRole)&&void 0!==s&&s.businessType?null===(o=p.activeRole)||void 0===o?void 0:o.businessType:""),T=!p,[v,E]=(0,z.useState)({}),[_,y]=(0,z.useState)({}),[b,D]=(0,z.useState)({}),[x,M]=(0,z.useState)([]),[N,O]=(0,z.useState)([]),[A,U]=(0,z.useState)([]),[w,j]=(0,z.useState)(!1),[C,L]=(0,z.useState)(!1),[P,R]=(0,z.useState)(!1),Y=new ke(new xt({basePath:r})),B=new Ze(new rt({basePath:u})),G=new Et(new xt({basePath:d})),V=new st(new rt({basePath:u})),H=new wo(new xt({basePath:i})),J=async(e,t,n)=>{try{const s=await V.searchPerson(e,t,n);return s.data}catch(e){console.log("= = = callSearchPerson error occured:",e)}};return(0,z.useEffect)((()=>{Y.getAllDocumentTypes().then((e=>{h(g(e.data))})).catch((e=>{console.log(e)})),B.getJurKovPersons().then((e=>{h(f(e.data))})).catch((e=>{console.log(e)})),Y.getUsageClassifierTypes().then((e=>{h(I(e.data))})).catch((e=>{console.log(e)}))}),[]),(0,z.useEffect)((()=>{if(Object.keys(b).length>0){R(!0);G.searchDetailProceedings(b).then((e=>{h(k(e.data)),U(e.data),R(!1)})).catch((e=>{console.log(e),R(!1)}))}}),[b]),(0,z.useEffect)((()=>{if(Object.keys(_).length>0){L(!0);G.searchDetailDocuments(_).then((e=>{h(F(e.data)),O(e.data),L(!1)})).catch((e=>{console.log(e),L(!1)}))}}),[_]),(0,z.useEffect)((()=>{if(Object.keys(v).length>0){let e;j(!0),e=S?H.buildingOwnerSearchPost(v):H.buildingSearchPost(v),e.then((e=>{h(K(e.data)),M(e.data),j(!1)})).catch((e=>{console.log(e),j(!1)}))}}),[v,S]),(0,Sn.jsxs)("div",{children:[(0,Sn.jsx)(Z.Section,{collapsed:c!==ue,title:"detailsearch.buildings_detail_search",children:(0,Sn.jsxs)("div",{children:[(0,Sn.jsx)("div",{className:"filter-block",style:{paddingBottom:20},children:(0,Sn.jsx)(lo,{onSubmit:e=>{E(e)},isAdminRole:m,isAdminPlusRole:S,callSearchPerson:J})}),Object.keys(v).length>0&&0===x.length&&!w?(0,Sn.jsx)("div",{style:{height:210},className:"d-flex justify-content-center align-items-center",children:(0,Sn.jsx)(Z.Text,{raw:"detailsearch.empty_search_result"})}):w?(0,Sn.jsx)(Z.SectionLoader,{}):(0,Sn.jsx)(mo,{linkGen:a,generateLink:l,isAdminRole:m,isAdminPlusRole:S})]})}),(0,Sn.jsx)(Z.Section,{collapsed:"DOCUMENTS_SEARCH"!==c,title:"detailsearch.documents_detail_search",children:(0,Sn.jsxs)("div",{children:[(0,Sn.jsx)("div",{className:"filter-block",style:{paddingBottom:20},children:(0,Sn.jsx)(co,{onSubmit:e=>{y(e)},callSearchPerson:J,isNonAuthenticatedUser:T})}),Object.keys(_).length>0&&0===N.length&&!C?(0,Sn.jsx)("div",{style:{height:210},className:"d-flex justify-content-center align-items-center",children:(0,Sn.jsx)(Z.Text,{raw:"detailsearch.empty_search_result"})}):C?(0,Sn.jsx)(Z.SectionLoader,{}):(0,Sn.jsx)(vo,{linkGen:a,generateLink:l,userInfo:p,filterStateDocumentsSearch:_})]})}),m&&(0,Sn.jsx)(Z.Section,{collapsed:"PROCEEDINGS_SEARCH"!==c,title:"detailsearch.proceedings_detail_search",children:(0,Sn.jsxs)("div",{children:[(0,Sn.jsx)("div",{className:"filter-block",style:{paddingBottom:20},children:(0,Sn.jsx)(uo,{onSubmit:e=>{D(e)}})}),Object.keys(b).length>0&&0===A.length&&!P?(0,Sn.jsx)("div",{style:{height:210},className:"d-flex justify-content-center align-items-center",children:(0,Sn.jsx)(Z.Text,{raw:"detailsearch.empty_search_result"})}):P?(0,Sn.jsx)(Z.SectionLoader,{}):(0,Sn.jsx)(Eo,{linkGen:a,userInfo:p,generateLink:l})]})})]})};return u})()));
|