eehitus-my-task-list-ui 1.0.20 → 1.1.0
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/services/my_views_api_client/api.d.ts +65 -65
- package/dist/types/components/services/my_views_api_client/base.d.ts +2 -14
- package/dist/types/components/services/my_views_api_client/configuration.d.ts +0 -8
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see index.esm.js.LICENSE.txt */
|
|
2
|
-
import*as e from"react";import*as t from"@reduxjs/toolkit";import*as n from"react-intl";import*as s from"ehr-components";import*as o from"axios";import*as i from"react-redux";import*as a from"moment";import*as r from"reactstrap";var l={20:(e,t,n)=>{var s=n(649),o=Symbol.for("react.element"),i=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,r=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)a.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:r.current}}t.Fragment=i,t.jsx=d,t.jsxs=d},649:t=>{t.exports=e},848:(e,t,n)=>{e.exports=n(20)}},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.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);const u=(e=>{var t={};return c.d(t,e),t})({combineReducers:()=>t.combineReducers,createAsyncThunk:()=>t.createAsyncThunk,createSelector:()=>t.createSelector,createSlice:()=>t.createSlice});const p=(0,u.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:h,documentTypesLoaded:m,institutionUsersLoaded:g,institutionsLoaded:f,usageClassifierTypesLoaded:S}=p.actions,I=p.reducer;const T=(0,u.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:v,signingDocumentsLoaded:E,finishedDocumentsLoaded:_,deleteDocument:y,allowedDocumentTypesLoaded:b}=T.actions,D=T.reducer;const x=(0,u.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:M,proceedingsToCommentLoaded:N,incomingDocumentsLoaded:O}=x.actions,A=x.reducer;const U=(0,u.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:w,toCommentOperationsLoaded:j,operationInvitationsLoaded:C}=U.actions,L=U.reducer;const P=(0,u.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:R,documentsLoaded:K,proceedingsLoaded:F}=P.actions,k=P.reducer,Y={notices:[]},B=(0,u.createSlice)({name:"notification",initialState:Y,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=>Y}}),G=(0,u.createSelector)((e=>e.myViewsPage.notifications.notices),(e=>e)),{cleanState:V,setNotifications:H,removeNotification:J}=B.actions,W=B.reducer,$=(0,u.combineReducers)({filter:I,myDocuments:D,myProceedings:A,myOperations:L,detailSearch:k,notifications:W});var q=c(649);const z=(e=>{var t={};return c.d(t,e),t})({FormattedMessage:()=>n.FormattedMessage,useIntl:()=>n.useIntl});const X=(e=>{var t={};return c.d(t,e),t})({Button:()=>s.Button,Checkbox:()=>s.Checkbox,Col:()=>s.Col,CollapseTable:()=>s.CollapseTable,CollapseTableRow:()=>s.CollapseTableRow,ControlledPopover:()=>s.ControlledPopover,DatePicker:()=>s.DatePicker,DateRange:()=>s.DateRange,FieldWrapper:()=>s.FieldWrapper,Form:()=>s.Form,Icon:()=>s.Icon,Info:()=>s.Info,Input:()=>s.Input,Link:()=>s.Link,Loader:()=>s.Loader,MessageBlock:()=>s.MessageBlock,Multiselect:()=>s.Multiselect,NumberRangeExtended:()=>s.NumberRangeExtended,PersonSearchPageExtended:()=>s.PersonSearchPageExtended,RichTextEditor:()=>s.RichTextEditor,Row:()=>s.Row,Section:()=>s.Section,SectionLoader:()=>s.SectionLoader,Select:()=>s.Select,Status:()=>s.Status,TableComponent:()=>s.TableComponent,Text:()=>s.Text,Tooltip:()=>s.Tooltip}),Q="SIGNING_DOCUMENTS",Z="WORKING_DOCUMENTS",ee="FINISHED_DOCUMENTS",te="INCOMING_DOCUMENTS",ne="MY_APPROVALS",se="MY_OPINIONS",oe="MY_INVOLVEMENTS",ie="MY_OPERATIONS",ae="OPERATIONS_TO_COMMENT",re="OPERATION_INVITATIONS",le="PROCEEDINGS_TO_COMMENT",de="BUILDINGS_SEARCH";let ce=function(e){return e.DEFAULT="default",e.INFO="info",e.SUCCESS="success",e.WARNING="warning",e.DANGER="danger",e}({});const ue="BUILDING",pe="PROCEEDING",he="DOCUMENT";let me=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 ge=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 fe="12975",Se="12976",Ie="11274",Te="11275",ve="12977",Ee="12978",_e=["11272","12972",fe,"12974",Ee,Te],ye=["11273","12973",Se,"12971",ve,Ie],be=[fe,Se],De={[Se]:ve,[fe]:Ee},xe={[Se]:Ie,[fe]:Te};const Me=(e=>{var t={};return c.d(t,e),t})({default:()=>o.default}),Ne="https://devkluster.ehr.ee".replace(/\/+$/,"");class Oe{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ne,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Me.default;this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class Ae extends Error{constructor(e,t){super(t),this.name="RequiredError",this.field=e}}const Ue="https://example.com",we=function(e,t,n){if(null==n)throw new Ae(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},je=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()},Ce=function(e){return e.pathname+e.search+e.hash},Le=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 a={...e.options,url:((null==s?void 0:s.basePath)||i)+e.url};return o.request(a)}},Pe=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",Ue);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};je(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Ce(n),options:o}},getBusinessTypesList:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/businesstypelist",Ue);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};je(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Ce(n),options:o}},getClassifierByType:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};we("getClassifierByType","classifierType",t);const s="/classifier/{classifierType}".replace("{classifierType}",encodeURIComponent(String(t))),o=new URL(s,Ue);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n};je(o,{},n.query);let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:Ce(o),options:a}},getClassifiersByRelatedType:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};we("getClassifiersByRelatedType","relatedClassifierType",t);const s="/classifier/related-type/{relatedClassifierType}".replace("{relatedClassifierType}",encodeURIComponent(String(t))),o=new URL(s,Ue);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n};je(o,{},n.query);let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:Ce(o),options:a}},getClassifiersByType:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};we("getClassifiersByType","classifierTypesCommaSeparated",t);const s="/classifiers/{classifierTypesCommaSeparated}".replace("{classifierTypesCommaSeparated}",encodeURIComponent(String(t))),o=new URL(s,Ue);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n};je(o,{},n.query);let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:Ce(o),options:a}},getDocumentTypes:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/documenttypes",Ue);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};je(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Ce(n),options:o}},getFileTypes:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/filetypes",Ue);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};je(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Ce(n),options:o}},getHealth:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/health",Ue);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};je(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Ce(n),options:o}},getUsageClassifierTypes:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/classifier/usage",Ue);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};je(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Ce(n),options:o}},getUserRolesList:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/userroleslist",Ue);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};je(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Ce(n),options:o}}}}(e);return{async getAllDocumentTypes(n){const s=await t.getAllDocumentTypes(n);return Le(s,Me.default,Ne,e)},async getBusinessTypesList(n){const s=await t.getBusinessTypesList(n);return Le(s,Me.default,Ne,e)},async getClassifierByType(n,s){const o=await t.getClassifierByType(n,s);return Le(o,Me.default,Ne,e)},async getClassifiersByRelatedType(n,s){const o=await t.getClassifiersByRelatedType(n,s);return Le(o,Me.default,Ne,e)},async getClassifiersByType(n,s){const o=await t.getClassifiersByType(n,s);return Le(o,Me.default,Ne,e)},async getDocumentTypes(n){const s=await t.getDocumentTypes(n);return Le(s,Me.default,Ne,e)},async getFileTypes(n){const s=await t.getFileTypes(n);return Le(s,Me.default,Ne,e)},async getHealth(n){const s=await t.getHealth(n);return Le(s,Me.default,Ne,e)},async getUsageClassifierTypes(n){const s=await t.getUsageClassifierTypes(n);return Le(s,Me.default,Ne,e)},async getUserRolesList(n){const s=await t.getUserRolesList(n);return Le(s,Me.default,Ne,e)}}};class Re extends Oe{getAllDocumentTypes(e){return Pe(this.configuration).getAllDocumentTypes(e).then((e=>e(this.axios,this.basePath)))}getBusinessTypesList(e){return Pe(this.configuration).getBusinessTypesList(e).then((e=>e(this.axios,this.basePath)))}getClassifierByType(e,t){return Pe(this.configuration).getClassifierByType(e,t).then((e=>e(this.axios,this.basePath)))}getClassifiersByRelatedType(e,t){return Pe(this.configuration).getClassifiersByRelatedType(e,t).then((e=>e(this.axios,this.basePath)))}getClassifiersByType(e,t){return Pe(this.configuration).getClassifiersByType(e,t).then((e=>e(this.axios,this.basePath)))}getDocumentTypes(e){return Pe(this.configuration).getDocumentTypes(e).then((e=>e(this.axios,this.basePath)))}getFileTypes(e){return Pe(this.configuration).getFileTypes(e).then((e=>e(this.axios,this.basePath)))}getHealth(e){return Pe(this.configuration).getHealth(e).then((e=>e(this.axios,this.basePath)))}getUsageClassifierTypes(e){return Pe(this.configuration).getUsageClassifierTypes(e).then((e=>e(this.axios,this.basePath)))}getUserRolesList(e){return Pe(this.configuration).getUserRolesList(e).then((e=>e(this.axios,this.basePath)))}}class Ke{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 Fe="http://localhost:8080".replace(/\/+$/,"");class ke{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Fe,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Me.default;this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class Ye extends Error{constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const Be="https://example.com",Ge=function(e,t,n){if(null==n)throw new Ye(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function Ve(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>Ve(e,t,n))):Object.keys(t).forEach((s=>Ve(e,t[s],`${n}${""!==n?".":""}${s}`))):e.has(n)?e.append(n,t):e.set(n,t))}const He=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];Ve(t,s),e.search=t.toString()},Je=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||""},We=function(e){return e.pathname+e.search+e.hash},$e=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 a={...e.options,url:((null==s?void 0:s.basePath)||i)+e.url};return o.request(a)}};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",Be);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};He(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:We(n),options:o}},getJurPersonCoordRelJurs:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ge("getJurPersonCoordRelJurs","personId",t);const s="/person/jur/{personId}/coord".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Be);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n};He(o,{});let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:We(o),options:a}},getUserPossibleProceedingSupervisorsByEHAKCode:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ge("getUserPossibleProceedingSupervisorsByEHAKCode","eHAKCode",t);const s="/user/possiblesupervisors/{EHAKCode}".replace("{EHAKCode}",encodeURIComponent(String(t))),o=new URL(s,Be);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n};He(o,{});let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:We(o),options:a}},getUserPossibleProceedingSupervisorsByIdAndEHAKCode:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ge("getUserPossibleProceedingSupervisorsByIdAndEHAKCode","id",t),Ge("getUserPossibleProceedingSupervisorsByIdAndEHAKCode","eHAKCode",n);const o="/user/possiblesupervisors/{id}/{EHAKCode}".replace("{id}",encodeURIComponent(String(t))).replace("{EHAKCode}",encodeURIComponent(String(n))),i=new URL(o,Be);let a;e&&(a=e.baseOptions);const r={method:"GET",...a,...s};He(i,{});let l=a&&a.headers?a.headers:{};return r.headers={...l,...s.headers},{url:We(i),options:r}},getUserPossibleProceedingSupervisorsByJurId:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ge("getUserPossibleProceedingSupervisorsByJurId","personId",t);const s="/user/jur/possiblesupervisors/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Be);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n};He(o,{});let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:We(o),options:a}}}}(e);return{async getJurKovPersons(n){const s=await t.getJurKovPersons(n);return $e(s,Me.default,Fe,e)},async getJurPersonCoordRelJurs(n,s){const o=await t.getJurPersonCoordRelJurs(n,s);return $e(o,Me.default,Fe,e)},async getUserPossibleProceedingSupervisorsByEHAKCode(n,s){const o=await t.getUserPossibleProceedingSupervisorsByEHAKCode(n,s);return $e(o,Me.default,Fe,e)},async getUserPossibleProceedingSupervisorsByIdAndEHAKCode(n,s,o){const i=await t.getUserPossibleProceedingSupervisorsByIdAndEHAKCode(n,s,o);return $e(i,Me.default,Fe,e)},async getUserPossibleProceedingSupervisorsByJurId(n,s){const o=await t.getUserPossibleProceedingSupervisorsByJurId(n,s);return $e(o,Me.default,Fe,e)}}};class ze extends ke{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 Xe=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",Be);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};He(s,{});let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=Je(t,i,e),{url:We(s),options:i}},addPerson:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/person",Be);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};He(s,{});let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=Je(t,i,e),{url:We(s),options:i}},deletePerson:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ge("deletePerson","personId",t);const s="/person/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Be);let i;e&&(i=e.baseOptions);const a={method:"DELETE",...i,...n};He(o,{});let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:We(o),options:a}},findKovsAndJurPersonsInTheSameAdministrativeDivision:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Ge("findKovsAndJurPersonsInTheSameAdministrativeDivision","regNameOrCode",t);const i="/person/kovs-and-institutions/{regNameOrCode}".replace("{regNameOrCode}",encodeURIComponent(String(t))),a=new URL(i,Be);let r;e&&(r=e.baseOptions);const l={method:"PUT",...r,...o},d={},c={};void 0!==n&&(c.searchFromAll=n),d["Content-Type"]="application/json",He(a,c);let u=r&&r.headers?r.headers:{};return l.headers={...d,...u,...o.headers},l.data=Je(s,l,e),{url:We(a),options:l}},findPublicSectorInstitutions:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ge("findPublicSectorInstitutions","regNameOrCode",t);const o="/person/public-sector-institutions/{regNameOrCode}".replace("{regNameOrCode}",encodeURIComponent(String(t))),i=new URL(o,Be);let a;e&&(a=e.baseOptions);const r={method:"PUT",...a,...s},l={"Content-Type":"application/json"};He(i,{});let d=a&&a.headers?a.headers:{};return r.headers={...l,...d,...s.headers},r.data=Je(n,r,e),{url:We(i),options:r}},findRolesByDbName:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/person/personroles",Be);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};He(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:We(n),options:o}},getAllActiveInstitutions:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/person/jur",Be);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};He(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:We(n),options:o}},getAllClassifierBusinessTypeDtos:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/person/jur/businessTypes",Be);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};He(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:We(n),options:o}},getJurPerson:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ge("getJurPerson","personId",t);const s="/person/jur/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Be);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n};He(o,{});let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:We(o),options:a}},getJurPersonAncestors:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ge("getJurPersonAncestors","jurPersonId",t);const s="/person/jur/ancestor/{jurPersonId}".replace("{jurPersonId}",encodeURIComponent(String(t))),o=new URL(s,Be);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n};He(o,{});let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:We(o),options:a}},getJurPersonSuccessors:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ge("getJurPersonSuccessors","jurPersonId",t);const s="/person/jur/successor/{jurPersonId}".replace("{jurPersonId}",encodeURIComponent(String(t))),o=new URL(s,Be);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n};He(o,{});let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:We(o),options:a}},getJurPersonsByEhakCode:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ge("getJurPersonsByEhakCode","ehakCode",t);const s="/person/jur/byEhakCode/{ehakCode}".replace("{ehakCode}",encodeURIComponent(String(t))),o=new URL(s,Be);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n};He(o,{});let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:We(o),options:a}},getPerson:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ge("getPerson","personId",t);const s="/person/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Be);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n};He(o,{});let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:We(o),options:a}},getPersonDetails:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/person/details",Be);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};He(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:We(n),options:o}},refreshUpdateArPersonFromAR:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ge("refreshUpdateArPersonFromAR","regCode",t);const s="/person/jur/refresh/{regCode}".replace("{regCode}",encodeURIComponent(String(t))),o=new URL(s,Be);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n};He(o,{});let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:We(o),options:a}},removeYlemyksusReference:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ge("removeYlemyksusReference","allyksusId",t);const s="/person/jur/removeYlemyksusReference/{allyksusId}".replace("{allyksusId}",encodeURIComponent(String(t))),o=new URL(s,Be);let i;e&&(i=e.baseOptions);const a={method:"PUT",...i,...n};He(o,{});let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:We(o),options:a}},updatePerson:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ge("updatePerson","personId",t);const o="/person/{personId}".replace("{personId}",encodeURIComponent(String(t))),i=new URL(o,Be);let a;e&&(a=e.baseOptions);const r={method:"PUT",...a,...s},l={"Content-Type":"application/json"};He(i,{});let d=a&&a.headers?a.headers:{};return r.headers={...l,...d,...s.headers},r.data=Je(n,r,e),{url:We(i),options:r}}}}(e);return{async addAllyksusToJurPerson(n,s){const o=await t.addAllyksusToJurPerson(n,s);return $e(o,Me.default,Fe,e)},async addPerson(n,s){const o=await t.addPerson(n,s);return $e(o,Me.default,Fe,e)},async deletePerson(n,s){const o=await t.deletePerson(n,s);return $e(o,Me.default,Fe,e)},async findKovsAndJurPersonsInTheSameAdministrativeDivision(n,s,o,i){const a=await t.findKovsAndJurPersonsInTheSameAdministrativeDivision(n,s,o,i);return $e(a,Me.default,Fe,e)},async findPublicSectorInstitutions(n,s,o){const i=await t.findPublicSectorInstitutions(n,s,o);return $e(i,Me.default,Fe,e)},async findRolesByDbName(n){const s=await t.findRolesByDbName(n);return $e(s,Me.default,Fe,e)},async getAllActiveInstitutions(n){const s=await t.getAllActiveInstitutions(n);return $e(s,Me.default,Fe,e)},async getAllClassifierBusinessTypeDtos(n){const s=await t.getAllClassifierBusinessTypeDtos(n);return $e(s,Me.default,Fe,e)},async getJurPerson(n,s){const o=await t.getJurPerson(n,s);return $e(o,Me.default,Fe,e)},async getJurPersonAncestors(n,s){const o=await t.getJurPersonAncestors(n,s);return $e(o,Me.default,Fe,e)},async getJurPersonSuccessors(n,s){const o=await t.getJurPersonSuccessors(n,s);return $e(o,Me.default,Fe,e)},async getJurPersonsByEhakCode(n,s){const o=await t.getJurPersonsByEhakCode(n,s);return $e(o,Me.default,Fe,e)},async getPerson(n,s){const o=await t.getPerson(n,s);return $e(o,Me.default,Fe,e)},async getPersonDetails(n){const s=await t.getPersonDetails(n);return $e(s,Me.default,Fe,e)},async refreshUpdateArPersonFromAR(n,s){const o=await t.refreshUpdateArPersonFromAR(n,s);return $e(o,Me.default,Fe,e)},async removeYlemyksusReference(n,s){const o=await t.removeYlemyksusReference(n,s);return $e(o,Me.default,Fe,e)},async updatePerson(n,s,o){const i=await t.updatePerson(n,s,o);return $e(i,Me.default,Fe,e)}}};class Qe extends ke{addAllyksusToJurPerson(e,t){return Xe(this.configuration).addAllyksusToJurPerson(e,t).then((e=>e(this.axios,this.basePath)))}addPerson(e,t){return Xe(this.configuration).addPerson(e,t).then((e=>e(this.axios,this.basePath)))}deletePerson(e,t){return Xe(this.configuration).deletePerson(e,t).then((e=>e(this.axios,this.basePath)))}findKovsAndJurPersonsInTheSameAdministrativeDivision(e,t,n,s){return Xe(this.configuration).findKovsAndJurPersonsInTheSameAdministrativeDivision(e,t,n,s).then((e=>e(this.axios,this.basePath)))}findPublicSectorInstitutions(e,t,n){return Xe(this.configuration).findPublicSectorInstitutions(e,t,n).then((e=>e(this.axios,this.basePath)))}findRolesByDbName(e){return Xe(this.configuration).findRolesByDbName(e).then((e=>e(this.axios,this.basePath)))}getAllActiveInstitutions(e){return Xe(this.configuration).getAllActiveInstitutions(e).then((e=>e(this.axios,this.basePath)))}getAllClassifierBusinessTypeDtos(e){return Xe(this.configuration).getAllClassifierBusinessTypeDtos(e).then((e=>e(this.axios,this.basePath)))}getJurPerson(e,t){return Xe(this.configuration).getJurPerson(e,t).then((e=>e(this.axios,this.basePath)))}getJurPersonAncestors(e,t){return Xe(this.configuration).getJurPersonAncestors(e,t).then((e=>e(this.axios,this.basePath)))}getJurPersonSuccessors(e,t){return Xe(this.configuration).getJurPersonSuccessors(e,t).then((e=>e(this.axios,this.basePath)))}getJurPersonsByEhakCode(e,t){return Xe(this.configuration).getJurPersonsByEhakCode(e,t).then((e=>e(this.axios,this.basePath)))}getPerson(e,t){return Xe(this.configuration).getPerson(e,t).then((e=>e(this.axios,this.basePath)))}getPersonDetails(e){return Xe(this.configuration).getPersonDetails(e).then((e=>e(this.axios,this.basePath)))}refreshUpdateArPersonFromAR(e,t){return Xe(this.configuration).refreshUpdateArPersonFromAR(e,t).then((e=>e(this.axios,this.basePath)))}removeYlemyksusReference(e,t){return Xe(this.configuration).removeYlemyksusReference(e,t).then((e=>e(this.axios,this.basePath)))}updatePerson(e,t,n){return Xe(this.configuration).updatePerson(e,t,n).then((e=>e(this.axios,this.basePath)))}}const Ze=function(e){const t=function(e){return{searchPerson:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Ge("searchPerson","input",t);const i=new URL("/search/searchPerson",Be);let a;e&&(a=e.baseOptions);const r={method:"GET",...a,...o},l={};void 0!==t&&(l.input=t),void 0!==n&&(l.xRoad=n),void 0!==s&&(l.isPrivate=s),He(i,l);let d=a&&a.headers?a.headers:{};return r.headers={...d,...o.headers},{url:We(i),options:r}}}}(e);return{async searchPerson(n,s,o,i){const a=await t.searchPerson(n,s,o,i);return $e(a,Me.default,Fe,e)}}};class et extends ke{searchPerson(e,t,n,s){return Ze(this.configuration).searchPerson(e,t,n,s).then((e=>e(this.axios,this.basePath)))}}const tt=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",Be);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};He(s,{});let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=Je(t,i,e),{url:We(s),options:i}},addUser:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/user",Be);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};He(s,{});let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=Je(t,i,e),{url:We(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",Be);let o;e&&(o=e.baseOptions);const i={method:"PUT",...o,...n},a={"Content-Type":"application/json"};He(s,{});let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=Je(t,i,e),{url:We(s),options:i}},deleteUser:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ge("deleteUser","userId",t);const s="/user/{userId}".replace("{userId}",encodeURIComponent(String(t))),o=new URL(s,Be);let i;e&&(i=e.baseOptions);const a={method:"DELETE",...i,...n};He(o,{});let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:We(o),options:a}},deleteUserRole:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ge("deleteUserRole","userRoleRelId",t);const s="/user/role/{userRoleRelId}".replace("{userRoleRelId}",encodeURIComponent(String(t))),o=new URL(s,Be);let i;e&&(i=e.baseOptions);const a={method:"DELETE",...i,...n};He(o,{});let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:We(o),options:a}},findUsersByRoleId:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ge("findUsersByRoleId","roleId",t);const s="/user/byroleid/{roleId}".replace("{roleId}",encodeURIComponent(String(t))),o=new URL(s,Be);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n};He(o,{});let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:We(o),options:a}},getAllClassifierUserRoleDtos:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/user/roles/all",Be);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};He(n,{});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",Be);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};He(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:We(n),options:o}},getJurUsers:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ge("getJurUsers","personId",t);const s="/jur/user/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Be);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n};He(o,{});let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:We(o),options:a}},getJurUsersWithoutGivenRole:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ge("getJurUsersWithoutGivenRole","personId",t),Ge("getJurUsersWithoutGivenRole","roleId",n);const o="/jur/user/withoutrole/{personId}/{roleId}".replace("{personId}",encodeURIComponent(String(t))).replace("{roleId}",encodeURIComponent(String(n))),i=new URL(o,Be);let a;e&&(a=e.baseOptions);const r={method:"GET",...a,...s};He(i,{});let l=a&&a.headers?a.headers:{};return r.headers={...l,...s.headers},{url:We(i),options:r}},getUser:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ge("getUser","userId",t);const s="/user/{userId}".replace("{userId}",encodeURIComponent(String(t))),o=new URL(s,Be);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n};He(o,{});let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:We(o),options:a}},getUserPossibleRecipients:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/user/possiblerecipients",Be);let o;e&&(o=e.baseOptions);const i={method:"GET",...o,...n},a={};void 0!==t&&(a.searchInput=t),He(s,a);let r=o&&o.headers?o.headers:{};return i.headers={...r,...n.headers},{url:We(s),options:i}},getUsers:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ge("getUsers","personId",t);const s="/user/usersByPersonId/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Be);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n};He(o,{});let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:We(o),options:a}},getUsersJurPerson:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ge("getUsersJurPerson","userId",t);const o="/user/jur/{userId}".replace("{userId}",encodeURIComponent(String(t))),i=new URL(o,Be);let a;e&&(a=e.baseOptions);const r={method:"GET",...a,...s},l={};void 0!==n&&(l.valid=n),He(i,l);let d=a&&a.headers?a.headers:{};return r.headers={...d,...s.headers},{url:We(i),options:r}},updateUser:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ge("updateUser","userId",t);const o="/user/{userId}".replace("{userId}",encodeURIComponent(String(t))),i=new URL(o,Be);let a;e&&(a=e.baseOptions);const r={method:"PUT",...a,...s},l={"Content-Type":"application/json"};He(i,{});let d=a&&a.headers?a.headers:{};return r.headers={...l,...d,...s.headers},r.data=Je(n,r,e),{url:We(i),options:r}},updateUserRole:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ge("updateUserRole","userRoleRelId",t);const o="/user/modifyrole/{userRoleRelId}".replace("{userRoleRelId}",encodeURIComponent(String(t))),i=new URL(o,Be);let a;e&&(a=e.baseOptions);const r={method:"PUT",...a,...s},l={"Content-Type":"application/json"};He(i,{});let d=a&&a.headers?a.headers:{};return r.headers={...l,...d,...s.headers},r.data=Je(n,r,e),{url:We(i),options:r}}}}(e);return{async addRoleToUser(n,s){const o=await t.addRoleToUser(n,s);return $e(o,Me.default,Fe,e)},async addUser(n,s){const o=await t.addUser(n,s);return $e(o,Me.default,Fe,e)},async appointSubstituteUser(n,s){const o=await t.appointSubstituteUser(n,s);return $e(o,Me.default,Fe,e)},async deleteUser(n,s){const o=await t.deleteUser(n,s);return $e(o,Me.default,Fe,e)},async deleteUserRole(n,s){const o=await t.deleteUserRole(n,s);return $e(o,Me.default,Fe,e)},async findUsersByRoleId(n,s){const o=await t.findUsersByRoleId(n,s);return $e(o,Me.default,Fe,e)},async getAllClassifierUserRoleDtos(n){const s=await t.getAllClassifierUserRoleDtos(n);return $e(s,Me.default,Fe,e)},async getHealth(n){const s=await t.getHealth(n);return $e(s,Me.default,Fe,e)},async getJurUsers(n,s){const o=await t.getJurUsers(n,s);return $e(o,Me.default,Fe,e)},async getJurUsersWithoutGivenRole(n,s,o){const i=await t.getJurUsersWithoutGivenRole(n,s,o);return $e(i,Me.default,Fe,e)},async getUser(n,s){const o=await t.getUser(n,s);return $e(o,Me.default,Fe,e)},async getUserPossibleRecipients(n,s){const o=await t.getUserPossibleRecipients(n,s);return $e(o,Me.default,Fe,e)},async getUsers(n,s){const o=await t.getUsers(n,s);return $e(o,Me.default,Fe,e)},async getUsersJurPerson(n,s,o){const i=await t.getUsersJurPerson(n,s,o);return $e(i,Me.default,Fe,e)},async updateUser(n,s,o){const i=await t.updateUser(n,s,o);return $e(i,Me.default,Fe,e)},async updateUserRole(n,s,o){const i=await t.updateUserRole(n,s,o);return $e(i,Me.default,Fe,e)}}};class nt extends ke{addRoleToUser(e,t){return tt(this.configuration).addRoleToUser(e,t).then((e=>e(this.axios,this.basePath)))}addUser(e,t){return tt(this.configuration).addUser(e,t).then((e=>e(this.axios,this.basePath)))}appointSubstituteUser(e,t){return tt(this.configuration).appointSubstituteUser(e,t).then((e=>e(this.axios,this.basePath)))}deleteUser(e,t){return tt(this.configuration).deleteUser(e,t).then((e=>e(this.axios,this.basePath)))}deleteUserRole(e,t){return tt(this.configuration).deleteUserRole(e,t).then((e=>e(this.axios,this.basePath)))}findUsersByRoleId(e,t){return tt(this.configuration).findUsersByRoleId(e,t).then((e=>e(this.axios,this.basePath)))}getAllClassifierUserRoleDtos(e){return tt(this.configuration).getAllClassifierUserRoleDtos(e).then((e=>e(this.axios,this.basePath)))}getHealth(e){return tt(this.configuration).getHealth(e).then((e=>e(this.axios,this.basePath)))}getJurUsers(e,t){return tt(this.configuration).getJurUsers(e,t).then((e=>e(this.axios,this.basePath)))}getJurUsersWithoutGivenRole(e,t,n){return tt(this.configuration).getJurUsersWithoutGivenRole(e,t,n).then((e=>e(this.axios,this.basePath)))}getUser(e,t){return tt(this.configuration).getUser(e,t).then((e=>e(this.axios,this.basePath)))}getUserPossibleRecipients(e,t){return tt(this.configuration).getUserPossibleRecipients(e,t).then((e=>e(this.axios,this.basePath)))}getUsers(e,t){return tt(this.configuration).getUsers(e,t).then((e=>e(this.axios,this.basePath)))}getUsersJurPerson(e,t,n){return tt(this.configuration).getUsersJurPerson(e,t,n).then((e=>e(this.axios,this.basePath)))}updateUser(e,t,n){return tt(this.configuration).updateUser(e,t,n).then((e=>e(this.axios,this.basePath)))}updateUserRole(e,t,n){return tt(this.configuration).updateUserRole(e,t,n).then((e=>e(this.axios,this.basePath)))}}class st{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 ot="http://localhost:8080".replace(/\/+$/,"");class it{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ot,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Me.default;var s;(this.basePath=t,this.axios=n,e)&&(this.configuration=e,this.basePath=null!==(s=e.basePath)&&void 0!==s?s:t)}}class at extends Error{constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const rt={},lt="https://example.com",dt=function(e,t,n){if(null==n)throw new at(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function ct(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>ct(e,t,n))):Object.keys(t).forEach((s=>ct(e,t[s],`${n}${""!==n?".":""}${s}`))):e.has(n)?e.append(n,t):e.set(n,t))}const ut=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];ct(t,s),e.search=t.toString()},pt=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||""},ht=function(e){return e.pathname+e.search+e.hash},mt=function(e,t,n,s){return function(){var o;let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;const r={...e.options,url:(i.defaults.baseURL?"":null!==(o=null==s?void 0:s.basePath)&&void 0!==o?o:a)+e.url};return i.request(r)}},gt=function(e){const t=function(e){return{findIncomingBaseDocuments:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};dt("findIncomingBaseDocuments","documentBaseQueryDto",t);const s=new URL("/documents/incomingdocuments",lt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};ut(s,{});let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=pt(t,i,e),{url:ht(s),options:i}},findWorkingDocuments:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};dt("findWorkingDocuments","documentBaseQueryDto",t);const s=new URL("/documents/basedocuments",lt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};ut(s,{});let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=pt(t,i,e),{url:ht(s),options:i}}}}(e);return{async findIncomingBaseDocuments(n,s){var o,i,a;const r=await t.findIncomingBaseDocuments(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=rt["BaseMyDocumentsApi.findIncomingBaseDocuments"])||void 0===i||null===(a=i[l])||void 0===a?void 0:a.url;return(t,n)=>mt(r,Me.default,ot,e)(t,d||n)},async findWorkingDocuments(n,s){var o,i,a;const r=await t.findWorkingDocuments(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=rt["BaseMyDocumentsApi.findWorkingDocuments"])||void 0===i||null===(a=i[l])||void 0===a?void 0:a.url;return(t,n)=>mt(r,Me.default,ot,e)(t,d||n)}}};class ft extends it{findIncomingBaseDocuments(e,t){return gt(this.configuration).findIncomingBaseDocuments(e,t).then((e=>e(this.axios,this.basePath)))}findWorkingDocuments(e,t){return gt(this.configuration).findWorkingDocuments(e,t).then((e=>e(this.axios,this.basePath)))}}const St=function(e){const t=function(e){return{searchDetailBuildings:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};dt("searchDetailBuildings","buildingSearchDto",t);const s=new URL("/search/buildings",lt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};ut(s,{});let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=pt(t,i,e),{url:ht(s),options:i}},searchDetailDocuments:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};dt("searchDetailDocuments","documentSearchDto",t);const s=new URL("/search/documents",lt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};ut(s,{});let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=pt(t,i,e),{url:ht(s),options:i}},searchDetailProceedings:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};dt("searchDetailProceedings","proceedingSearchDto",t);const s=new URL("/search/proceedings",lt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};ut(s,{});let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=pt(t,i,e),{url:ht(s),options:i}}}}(e);return{async searchDetailBuildings(n,s){var o,i,a;const r=await t.searchDetailBuildings(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=rt["DetailSearchesApi.searchDetailBuildings"])||void 0===i||null===(a=i[l])||void 0===a?void 0:a.url;return(t,n)=>mt(r,Me.default,ot,e)(t,d||n)},async searchDetailDocuments(n,s){var o,i,a;const r=await t.searchDetailDocuments(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=rt["DetailSearchesApi.searchDetailDocuments"])||void 0===i||null===(a=i[l])||void 0===a?void 0:a.url;return(t,n)=>mt(r,Me.default,ot,e)(t,d||n)},async searchDetailProceedings(n,s){var o,i,a;const r=await t.searchDetailProceedings(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=rt["DetailSearchesApi.searchDetailProceedings"])||void 0===i||null===(a=i[l])||void 0===a?void 0:a.url;return(t,n)=>mt(r,Me.default,ot,e)(t,d||n)}}};class It extends it{searchDetailBuildings(e,t){return St(this.configuration).searchDetailBuildings(e,t).then((e=>e(this.axios,this.basePath)))}searchDetailDocuments(e,t){return St(this.configuration).searchDetailDocuments(e,t).then((e=>e(this.axios,this.basePath)))}searchDetailProceedings(e,t){return St(this.configuration).searchDetailProceedings(e,t).then((e=>e(this.axios,this.basePath)))}}const Tt=function(e){const t=function(e){return{findOperationInvitations:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};dt("findOperationInvitations","operationQueryDto",t);const s=new URL("/myoperations/operationinvitations",lt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};ut(s,{});let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=pt(t,i,e),{url:ht(s),options:i}},findOperations:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};dt("findOperations","operationQueryDto",t);const s=new URL("/myoperations/myoperations",lt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};ut(s,{});let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=pt(t,i,e),{url:ht(s),options:i}},findOperationsToComment:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};dt("findOperationsToComment","operationQueryDto",t);const s=new URL("/myoperations/operationstocomment",lt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};ut(s,{});let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=pt(t,i,e),{url:ht(s),options:i}}}}(e);return{async findOperationInvitations(n,s){var o,i,a;const r=await t.findOperationInvitations(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=rt["MyOperationsApi.findOperationInvitations"])||void 0===i||null===(a=i[l])||void 0===a?void 0:a.url;return(t,n)=>mt(r,Me.default,ot,e)(t,d||n)},async findOperations(n,s){var o,i,a;const r=await t.findOperations(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=rt["MyOperationsApi.findOperations"])||void 0===i||null===(a=i[l])||void 0===a?void 0:a.url;return(t,n)=>mt(r,Me.default,ot,e)(t,d||n)},async findOperationsToComment(n,s){var o,i,a;const r=await t.findOperationsToComment(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=rt["MyOperationsApi.findOperationsToComment"])||void 0===i||null===(a=i[l])||void 0===a?void 0:a.url;return(t,n)=>mt(r,Me.default,ot,e)(t,d||n)}}};class vt extends it{findOperationInvitations(e,t){return Tt(this.configuration).findOperationInvitations(e,t).then((e=>e(this.axios,this.basePath)))}findOperations(e,t){return Tt(this.configuration).findOperations(e,t).then((e=>e(this.axios,this.basePath)))}findOperationsToComment(e,t){return Tt(this.configuration).findOperationsToComment(e,t).then((e=>e(this.axios,this.basePath)))}}const Et=function(e){const t=function(e){return{findAreaProceedings:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};dt("findAreaProceedings","proceedingQueryDto",t);const s=new URL("/myproceedings/my-area-proceedings",lt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};ut(s,{});let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=pt(t,i,e),{url:ht(s),options:i}},findProceedings:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};dt("findProceedings","myProceedingsRequestDto",t);const s=new URL("/myproceedings/myproceedings",lt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};ut(s,{});let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=pt(t,i,e),{url:ht(s),options:i}}}}(e);return{async findAreaProceedings(n,s){var o,i,a;const r=await t.findAreaProceedings(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=rt["MyProceedingsApi.findAreaProceedings"])||void 0===i||null===(a=i[l])||void 0===a?void 0:a.url;return(t,n)=>mt(r,Me.default,ot,e)(t,d||n)},async findProceedings(n,s){var o,i,a;const r=await t.findProceedings(n,s),l=null!==(o=null==e?void 0:e.serverIndex)&&void 0!==o?o:0,d=null===(i=rt["MyProceedingsApi.findProceedings"])||void 0===i||null===(a=i[l])||void 0===a?void 0:a.url;return(t,n)=>mt(r,Me.default,ot,e)(t,d||n)}}};class _t extends it{findAreaProceedings(e,t){return Et(this.configuration).findAreaProceedings(e,t).then((e=>e(this.axios,this.basePath)))}findProceedings(e,t){return Et(this.configuration).findProceedings(e,t).then((e=>e(this.axios,this.basePath)))}}class yt{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 bt="http://localhost:8080".replace(/\/+$/,"");class Dt{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:bt,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Me.default;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 Mt="https://example.com",Nt=function(e,t,n){if(null==n)throw new xt(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},Ot=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 At(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>At(e,t,n))):Object.keys(t).forEach((s=>At(e,t[s],`${n}${""!==n?".":""}${s}`))):e.has(n)?e.append(n,t):e.set(n,t))}const Ut=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];At(t,s),e.search=t.toString()},wt=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||""},jt=function(e){return e.pathname+e.search+e.hash},Ct=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 a={...e.options,url:((null==s?void 0:s.basePath)||o.defaults.baseURL||i)+e.url};return o.request(a)}};const Lt=function(e){const t=function(e){return{addAuthz:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Nt("addAuthz","documentType",t),Nt("addAuthz","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/addAuthz".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,Mt);let a;e&&(a=e.baseOptions);const r={method:"GET",...a,...s};Ut(i,{});let l=a&&a.headers?a.headers:{};return r.headers={...l,...s.headers},{url:jt(i),options:r}},apiVersion:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/version",Mt);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ut(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:jt(n),options:o}},autoUpdateOwnershipType:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/document/updateOwnershipType",Mt);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ut(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:jt(n),options:o}},createDoDokuDokuRel:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Nt("createDoDokuDokuRel","documentId",t),Nt("createDoDokuDokuRel","addEntityDto",n);const o="/document/{documentId}/createDoDokuDokuRel".replace("{documentId}",encodeURIComponent(String(t))),i=new URL(o,Mt);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},l={};await Ot(l,e),l["Content-Type"]="application/json",Ut(i,{});let d=a&&a.headers?a.headers:{};return r.headers={...l,...d,...s.headers},r.data=wt(n,r,e),{url:jt(i),options:r}},createDocument:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Nt("createDocument","documentType",t);const o="/document/{documentType}".replace("{documentType}",encodeURIComponent(String(t))),i=new URL(o,Mt);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},l={};await Ot(l,e),l["Content-Type"]="application/json",Ut(i,{});let d=a&&a.headers?a.headers:{};return r.headers={...l,...d,...s.headers},r.data=wt(n,r,e),{url:jt(i),options:r}},createNewVersion:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Nt("createNewVersion","documentType",t),Nt("createNewVersion","applicationNumber",n),Nt("createNewVersion","versionDto",s);const i="/document/{documentType}/{applicationNumber}/version/new".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),a=new URL(i,Mt);let r;e&&(r=e.baseOptions);const l={method:"POST",...r,...o},d={};await Ot(d,e),d["Content-Type"]="application/json",Ut(a,{});let c=r&&r.headers?r.headers:{};return l.headers={...d,...c,...o.headers},l.data=wt(s,l,e),{url:jt(a),options:l}},deleteApplicationByNumber:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Nt("deleteApplicationByNumber","documentType",t),Nt("deleteApplicationByNumber","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,Mt);let a;e&&(a=e.baseOptions);const r={method:"DELETE",...a,...s},l={};await Ot(l,e),Ut(i,{});let d=a&&a.headers?a.headers:{};return r.headers={...l,...d,...s.headers},{url:jt(i),options:r}},endProceedingCircleDocuments:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Nt("endProceedingCircleDocuments","documentType",t),Nt("endProceedingCircleDocuments","applicationNumber",n),Nt("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))),a=new URL(i,Mt);let r;e&&(r=e.baseOptions);const l={method:"POST",...r,...o},d={};await Ot(d,e),Ut(a,{});let c=r&&r.headers?r.headers:{};return l.headers={...d,...c,...o.headers},{url:jt(a),options:l}},getAccessRights:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Nt("getAccessRights","documentType",t),Nt("getAccessRights","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/rights".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,Mt);let a;e&&(a=e.baseOptions);const r={method:"GET",...a,...s},l={};await Ot(l,e),Ut(i,{});let d=a&&a.headers?a.headers:{};return r.headers={...l,...d,...s.headers},{url:jt(i),options:r}},getApplicationById:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Nt("getApplicationById","documentId",t);const s="/document/{documentId}".replace("{documentId}",encodeURIComponent(String(t))),o=new URL(s,Mt);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n},r={};await Ot(r,e),Ut(o,{});let l=i&&i.headers?i.headers:{};return a.headers={...r,...l,...n.headers},{url:jt(o),options:a}},getApplicationByNumber:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Nt("getApplicationByNumber","documentType",t),Nt("getApplicationByNumber","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,Mt);let a;e&&(a=e.baseOptions);const r={method:"GET",...a,...s},l={};await Ot(l,e),Ut(i,{});let d=a&&a.headers?a.headers:{};return r.headers={...l,...d,...s.headers},{url:jt(i),options:r}},getApplicationByNumberOld:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Nt("getApplicationByNumberOld","ehrCode",t),Nt("getApplicationByNumberOld","applicationNumber",n);const o="/document/old/{ehrCode}/{applicationNumber}".replace("{ehrCode}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,Mt);let a;e&&(a=e.baseOptions);const r={method:"GET",...a,...s},l={};await Ot(l,e),Ut(i,{});let d=a&&a.headers?a.headers:{};return r.headers={...l,...d,...s.headers},{url:jt(i),options:r}},getApplicationByNumberWithVersion:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Nt("getApplicationByNumberWithVersion","documentType",t),Nt("getApplicationByNumberWithVersion","applicationNumber",n),Nt("getApplicationByNumberWithVersion","version",s);const i="/document/{documentType}/{applicationNumber}/{version}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))).replace("{version}",encodeURIComponent(String(s))),a=new URL(i,Mt);let r;e&&(r=e.baseOptions);const l={method:"GET",...r,...o},d={};await Ot(d,e),Ut(a,{});let c=r&&r.headers?r.headers:{};return l.headers={...d,...c,...o.headers},{url:jt(a),options:l}},getApplicationStateFee:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Nt("getApplicationStateFee","documentType",t),Nt("getApplicationStateFee","applicationNumber",n),Nt("getApplicationStateFee","applicationDto",s);const i="/document/{documentType}/{applicationNumber}/stateFee".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),a=new URL(i,Mt);let r;e&&(r=e.baseOptions);const l={method:"POST",...r,...o},d={};await Ot(d,e),d["Content-Type"]="application/json",Ut(a,{});let c=r&&r.headers?r.headers:{};return l.headers={...d,...c,...o.headers},l.data=wt(s,l,e),{url:jt(a),options:l}},getApplicationStateFeeOfVersion:async function(t,n,s,o){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};Nt("getApplicationStateFeeOfVersion","documentType",t),Nt("getApplicationStateFeeOfVersion","applicationNumber",n),Nt("getApplicationStateFeeOfVersion","version",s),Nt("getApplicationStateFeeOfVersion","applicationDto",o);const a="/document/{documentType}/{applicationNumber}/{version}/stateFee".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))).replace("{version}",encodeURIComponent(String(s))),r=new URL(a,Mt);let l;e&&(l=e.baseOptions);const d={method:"POST",...l,...i},c={};await Ot(c,e),c["Content-Type"]="application/json",Ut(r,{});let u=l&&l.headers?l.headers:{};return d.headers={...c,...u,...i.headers},d.data=wt(o,d,e),{url:jt(r),options:d}},getDocumentFileRels:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Nt("getDocumentFileRels","docNr",t);const s=new URL("/document/fileRels",Mt);let o;e&&(o=e.baseOptions);const i={method:"GET",...o,...n},a={},r={};await Ot(a,e),void 0!==t&&(r.docNr=t),Ut(s,r);let l=o&&o.headers?o.headers:{};return i.headers={...a,...l,...n.headers},{url:jt(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",Mt);let o;e&&(o=e.baseOptions);const i={method:"GET",...o,...n},a={};void 0!==t&&(a.ehrCode=t),Ut(s,a);let r=o&&o.headers?o.headers:{};return i.headers={...r,...n.headers},{url:jt(s),options:i}},getHealth:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/health",Mt);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};Ut(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:jt(n),options:o}},getLastStateHistory:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Nt("getLastStateHistory","documentType",t),Nt("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,Mt);let a;e&&(a=e.baseOptions);const r={method:"GET",...a,...s};Ut(i,{});let l=a&&a.headers?a.headers:{};return r.headers={...l,...s.headers},{url:jt(i),options:r}},initializeAds:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Nt("initializeAds","documentType",t),Nt("initializeAds","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/initAds".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,Mt);let a;e&&(a=e.baseOptions);const r={method:"GET",...a,...s};Ut(i,{});let l=a&&a.headers?a.headers:{};return r.headers={...l,...s.headers},{url:jt(i),options:r}},mergeInstitutions:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Nt("mergeInstitutions","mergeInstitutionsDTO",t);const s=new URL("/document/merge",Mt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};Ut(s,{});let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=wt(t,i,e),{url:jt(s),options:i}},reSubmit:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Nt("reSubmit","documentType",t),Nt("reSubmit","applicationNumber",n),Nt("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))),a=new URL(i,Mt);let r;e&&(r=e.baseOptions);const l={method:"POST",...r,...o},d={};await Ot(d,e),Ut(a,{});let c=r&&r.headers?r.headers:{};return l.headers={...d,...c,...o.headers},{url:jt(a),options:l}},recalculatestate:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Nt("recalculatestate","documentType",t),Nt("recalculatestate","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/recalculatedetailstate".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,Mt);let a;e&&(a=e.baseOptions);const r={method:"GET",...a,...s};Ut(i,{});let l=a&&a.headers?a.headers:{};return r.headers={...l,...s.headers},{url:jt(i),options:r}},revertCreateNewVersion:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Nt("revertCreateNewVersion","documentType",t),Nt("revertCreateNewVersion","applicationNumber",n),Nt("revertCreateNewVersion","versionDto",s);const i="/document/{documentType}/{applicationNumber}/version/revert".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),a=new URL(i,Mt);let r;e&&(r=e.baseOptions);const l={method:"POST",...r,...o},d={};await Ot(d,e),d["Content-Type"]="application/json",Ut(a,{});let c=r&&r.headers?r.headers:{};return l.headers={...d,...c,...o.headers},l.data=wt(s,l,e),{url:jt(a),options:l}},saveAndValidate:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Nt("saveAndValidate","documentType",t),Nt("saveAndValidate","applicationNumber",n),Nt("saveAndValidate","applicationDto",s);const i="/document/{documentType}/{applicationNumber}/saveAndValidate".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),a=new URL(i,Mt);let r;e&&(r=e.baseOptions);const l={method:"POST",...r,...o},d={};await Ot(d,e),d["Content-Type"]="application/json",Ut(a,{});let c=r&&r.headers?r.headers:{};return l.headers={...d,...c,...o.headers},l.data=wt(s,l,e),{url:jt(a),options:l}},saveApplicationByNumber:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Nt("saveApplicationByNumber","documentType",t),Nt("saveApplicationByNumber","applicationNumber",n),Nt("saveApplicationByNumber","applicationDto",s);const i="/document/{documentType}/{applicationNumber}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),a=new URL(i,Mt);let r;e&&(r=e.baseOptions);const l={method:"PUT",...r,...o},d={};await Ot(d,e),d["Content-Type"]="application/json",Ut(a,{});let c=r&&r.headers?r.headers:{};return l.headers={...d,...c,...o.headers},l.data=wt(s,l,e),{url:jt(a),options:l}},setWaterExtractionPointsTestDates:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Nt("setWaterExtractionPointsTestDates","documentType",t),Nt("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,Mt);let a;e&&(a=e.baseOptions);const r={method:"PUT",...a,...s},l={};await Ot(l,e),Ut(i,{});let d=a&&a.headers?a.headers:{};return r.headers={...l,...d,...s.headers},{url:jt(i),options:r}},setWaterExtractionPointsTestDatesForBuilding:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Nt("setWaterExtractionPointsTestDatesForBuilding","documentType",t),Nt("setWaterExtractionPointsTestDatesForBuilding","applicationNumber",n),Nt("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))),a=new URL(i,Mt);let r;e&&(r=e.baseOptions);const l={method:"PUT",...r,...o},d={};await Ot(d,e),Ut(a,{});let c=r&&r.headers?r.headers:{};return l.headers={...d,...c,...o.headers},{url:jt(a),options:l}},submitStraightToRegistry:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Nt("submitStraightToRegistry","documentType",t),Nt("submitStraightToRegistry","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/submitToRegistry".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,Mt);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},l={};await Ot(l,e),Ut(i,{});let d=a&&a.headers?a.headers:{};return r.headers={...l,...d,...s.headers},{url:jt(i),options:r}},submitToProcessing:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Nt("submitToProcessing","documentType",t),Nt("submitToProcessing","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/submitToProcessing".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,Mt);let a;e&&(a=e.baseOptions);const r={method:"PUT",...a,...s},l={};await Ot(l,e),Ut(i,{});let d=a&&a.headers?a.headers:{};return r.headers={...l,...d,...s.headers},{url:jt(i),options:r}},submitToSigning:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Nt("submitToSigning","documentType",t),Nt("submitToSigning","applicationNumber",n),Nt("submitToSigning","applicationDto",s);const i="/document/{documentType}/{applicationNumber}/submitToSigning".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),a=new URL(i,Mt);let r;e&&(r=e.baseOptions);const l={method:"PUT",...r,...o},d={};await Ot(d,e),d["Content-Type"]="application/json",Ut(a,{});let c=r&&r.headers?r.headers:{};return l.headers={...d,...c,...o.headers},l.data=wt(s,l,e),{url:jt(a),options:l}},submitToSupervisorProcessing:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Nt("submitToSupervisorProcessing","documentType",t),Nt("submitToSupervisorProcessing","applicationNumber",n),Nt("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))),a=new URL(i,Mt);let r;e&&(r=e.baseOptions);const l={method:"POST",...r,...o},d={};await Ot(d,e),Ut(a,{});let c=r&&r.headers?r.headers:{};return l.headers={...d,...c,...o.headers},{url:jt(a),options:l}},validateSavedDocument:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Nt("validateSavedDocument","documentType",t),Nt("validateSavedDocument","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/completeApplicationChecks".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,Mt);let a;e&&(a=e.baseOptions);const r={method:"GET",...a,...s};Ut(i,{});let l=a&&a.headers?a.headers:{};return r.headers={...l,...s.headers},{url:jt(i),options:r}}}}(e);return{async addAuthz(n,s,o){const i=await t.addAuthz(n,s,o);return Ct(i,Me.default,bt,e)},async apiVersion(n){const s=await t.apiVersion(n);return Ct(s,Me.default,bt,e)},async autoUpdateOwnershipType(n){const s=await t.autoUpdateOwnershipType(n);return Ct(s,Me.default,bt,e)},async createDoDokuDokuRel(n,s,o){const i=await t.createDoDokuDokuRel(n,s,o);return Ct(i,Me.default,bt,e)},async createDocument(n,s,o){const i=await t.createDocument(n,s,o);return Ct(i,Me.default,bt,e)},async createNewVersion(n,s,o,i){const a=await t.createNewVersion(n,s,o,i);return Ct(a,Me.default,bt,e)},async deleteApplicationByNumber(n,s,o){const i=await t.deleteApplicationByNumber(n,s,o);return Ct(i,Me.default,bt,e)},async endProceedingCircleDocuments(n,s,o,i){const a=await t.endProceedingCircleDocuments(n,s,o,i);return Ct(a,Me.default,bt,e)},async getAccessRights(n,s,o){const i=await t.getAccessRights(n,s,o);return Ct(i,Me.default,bt,e)},async getApplicationById(n,s){const o=await t.getApplicationById(n,s);return Ct(o,Me.default,bt,e)},async getApplicationByNumber(n,s,o){const i=await t.getApplicationByNumber(n,s,o);return Ct(i,Me.default,bt,e)},async getApplicationByNumberOld(n,s,o){const i=await t.getApplicationByNumberOld(n,s,o);return Ct(i,Me.default,bt,e)},async getApplicationByNumberWithVersion(n,s,o,i){const a=await t.getApplicationByNumberWithVersion(n,s,o,i);return Ct(a,Me.default,bt,e)},async getApplicationStateFee(n,s,o,i){const a=await t.getApplicationStateFee(n,s,o,i);return Ct(a,Me.default,bt,e)},async getApplicationStateFeeOfVersion(n,s,o,i,a){const r=await t.getApplicationStateFeeOfVersion(n,s,o,i,a);return Ct(r,Me.default,bt,e)},async getDocumentFileRels(n,s){const o=await t.getDocumentFileRels(n,s);return Ct(o,Me.default,bt,e)},async getDotysBasedOnUserRights(n,s){const o=await t.getDotysBasedOnUserRights(n,s);return Ct(o,Me.default,bt,e)},async getHealth(n){const s=await t.getHealth(n);return Ct(s,Me.default,bt,e)},async getLastStateHistory(n,s,o){const i=await t.getLastStateHistory(n,s,o);return Ct(i,Me.default,bt,e)},async initializeAds(n,s,o){const i=await t.initializeAds(n,s,o);return Ct(i,Me.default,bt,e)},async mergeInstitutions(n,s){const o=await t.mergeInstitutions(n,s);return Ct(o,Me.default,bt,e)},async reSubmit(n,s,o,i){const a=await t.reSubmit(n,s,o,i);return Ct(a,Me.default,bt,e)},async recalculatestate(n,s,o){const i=await t.recalculatestate(n,s,o);return Ct(i,Me.default,bt,e)},async revertCreateNewVersion(n,s,o,i){const a=await t.revertCreateNewVersion(n,s,o,i);return Ct(a,Me.default,bt,e)},async saveAndValidate(n,s,o,i){const a=await t.saveAndValidate(n,s,o,i);return Ct(a,Me.default,bt,e)},async saveApplicationByNumber(n,s,o,i){const a=await t.saveApplicationByNumber(n,s,o,i);return Ct(a,Me.default,bt,e)},async setWaterExtractionPointsTestDates(n,s,o){const i=await t.setWaterExtractionPointsTestDates(n,s,o);return Ct(i,Me.default,bt,e)},async setWaterExtractionPointsTestDatesForBuilding(n,s,o,i){const a=await t.setWaterExtractionPointsTestDatesForBuilding(n,s,o,i);return Ct(a,Me.default,bt,e)},async submitStraightToRegistry(n,s,o){const i=await t.submitStraightToRegistry(n,s,o);return Ct(i,Me.default,bt,e)},async submitToProcessing(n,s,o){const i=await t.submitToProcessing(n,s,o);return Ct(i,Me.default,bt,e)},async submitToSigning(n,s,o,i){const a=await t.submitToSigning(n,s,o,i);return Ct(a,Me.default,bt,e)},async submitToSupervisorProcessing(n,s,o,i){const a=await t.submitToSupervisorProcessing(n,s,o,i);return Ct(a,Me.default,bt,e)},async validateSavedDocument(n,s,o){const i=await t.validateSavedDocument(n,s,o);return Ct(i,Me.default,bt,e)}}};class Pt extends Dt{addAuthz(e,t,n){return Lt(this.configuration).addAuthz(e,t,n).then((e=>e(this.axios,this.basePath)))}apiVersion(e){return Lt(this.configuration).apiVersion(e).then((e=>e(this.axios,this.basePath)))}autoUpdateOwnershipType(e){return Lt(this.configuration).autoUpdateOwnershipType(e).then((e=>e(this.axios,this.basePath)))}createDoDokuDokuRel(e,t,n){return Lt(this.configuration).createDoDokuDokuRel(e,t,n).then((e=>e(this.axios,this.basePath)))}createDocument(e,t,n){return Lt(this.configuration).createDocument(e,t,n).then((e=>e(this.axios,this.basePath)))}createNewVersion(e,t,n,s){return Lt(this.configuration).createNewVersion(e,t,n,s).then((e=>e(this.axios,this.basePath)))}deleteApplicationByNumber(e,t,n){return Lt(this.configuration).deleteApplicationByNumber(e,t,n).then((e=>e(this.axios,this.basePath)))}endProceedingCircleDocuments(e,t,n,s){return Lt(this.configuration).endProceedingCircleDocuments(e,t,n,s).then((e=>e(this.axios,this.basePath)))}getAccessRights(e,t,n){return Lt(this.configuration).getAccessRights(e,t,n).then((e=>e(this.axios,this.basePath)))}getApplicationById(e,t){return Lt(this.configuration).getApplicationById(e,t).then((e=>e(this.axios,this.basePath)))}getApplicationByNumber(e,t,n){return Lt(this.configuration).getApplicationByNumber(e,t,n).then((e=>e(this.axios,this.basePath)))}getApplicationByNumberOld(e,t,n){return Lt(this.configuration).getApplicationByNumberOld(e,t,n).then((e=>e(this.axios,this.basePath)))}getApplicationByNumberWithVersion(e,t,n,s){return Lt(this.configuration).getApplicationByNumberWithVersion(e,t,n,s).then((e=>e(this.axios,this.basePath)))}getApplicationStateFee(e,t,n,s){return Lt(this.configuration).getApplicationStateFee(e,t,n,s).then((e=>e(this.axios,this.basePath)))}getApplicationStateFeeOfVersion(e,t,n,s,o){return Lt(this.configuration).getApplicationStateFeeOfVersion(e,t,n,s,o).then((e=>e(this.axios,this.basePath)))}getDocumentFileRels(e,t){return Lt(this.configuration).getDocumentFileRels(e,t).then((e=>e(this.axios,this.basePath)))}getDotysBasedOnUserRights(e,t){return Lt(this.configuration).getDotysBasedOnUserRights(e,t).then((e=>e(this.axios,this.basePath)))}getHealth(e){return Lt(this.configuration).getHealth(e).then((e=>e(this.axios,this.basePath)))}getLastStateHistory(e,t,n){return Lt(this.configuration).getLastStateHistory(e,t,n).then((e=>e(this.axios,this.basePath)))}initializeAds(e,t,n){return Lt(this.configuration).initializeAds(e,t,n).then((e=>e(this.axios,this.basePath)))}mergeInstitutions(e,t){return Lt(this.configuration).mergeInstitutions(e,t).then((e=>e(this.axios,this.basePath)))}reSubmit(e,t,n,s){return Lt(this.configuration).reSubmit(e,t,n,s).then((e=>e(this.axios,this.basePath)))}recalculatestate(e,t,n){return Lt(this.configuration).recalculatestate(e,t,n).then((e=>e(this.axios,this.basePath)))}revertCreateNewVersion(e,t,n,s){return Lt(this.configuration).revertCreateNewVersion(e,t,n,s).then((e=>e(this.axios,this.basePath)))}saveAndValidate(e,t,n,s){return Lt(this.configuration).saveAndValidate(e,t,n,s).then((e=>e(this.axios,this.basePath)))}saveApplicationByNumber(e,t,n,s){return Lt(this.configuration).saveApplicationByNumber(e,t,n,s).then((e=>e(this.axios,this.basePath)))}setWaterExtractionPointsTestDates(e,t,n){return Lt(this.configuration).setWaterExtractionPointsTestDates(e,t,n).then((e=>e(this.axios,this.basePath)))}setWaterExtractionPointsTestDatesForBuilding(e,t,n,s){return Lt(this.configuration).setWaterExtractionPointsTestDatesForBuilding(e,t,n,s).then((e=>e(this.axios,this.basePath)))}submitStraightToRegistry(e,t,n){return Lt(this.configuration).submitStraightToRegistry(e,t,n).then((e=>e(this.axios,this.basePath)))}submitToProcessing(e,t,n){return Lt(this.configuration).submitToProcessing(e,t,n).then((e=>e(this.axios,this.basePath)))}submitToSigning(e,t,n,s){return Lt(this.configuration).submitToSigning(e,t,n,s).then((e=>e(this.axios,this.basePath)))}submitToSupervisorProcessing(e,t,n,s){return Lt(this.configuration).submitToSupervisorProcessing(e,t,n,s).then((e=>e(this.axios,this.basePath)))}validateSavedDocument(e,t,n){return Lt(this.configuration).validateSavedDocument(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 Kt="https://devkluster.ehr.ee/api/file-upload-api/v1".replace(/\/+$/,"");class Ft{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Kt,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Me.default;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 Yt="https://example.com",Bt=function(e,t,n){if(null==n)throw new kt(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},Gt=async function(e,t){if(t&&t.accessToken){const n="function"==typeof t.accessToken?await t.accessToken():await t.accessToken;e.Authorization="Bearer "+n}},Vt=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()},Ht=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||""},Jt=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 a={...e.options,url:((null==s?void 0:s.basePath)||i)+e.url};return o.request(a)}},$t=function(e){const t=function(e){return{cloneFilesAndCreateRels:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Bt("cloneFilesAndCreateRels","fileIds",t);const i=new URL("/fileClone",Yt);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...o},l={},d={};await Gt(l,e),t&&(d.fileIds=t),void 0!==n&&(d.docNr=n),void 0!==s&&(d.relType=s),Vt(i,d);let c=a&&a.headers?a.headers:{};return r.headers={...l,...c,...o.headers},{url:Jt(i),options:r}},deleteFile:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Bt("deleteFile","fileId",t);const s="/file/{fileId}".replace("{fileId}",encodeURIComponent(String(t))),o=new URL(s,Yt);let i;e&&(i=e.baseOptions);const a={method:"DELETE",...i,...n},r={};await Gt(r,e),Vt(o,{});let l=i&&i.headers?i.headers:{};return a.headers={...r,...l,...n.headers},{url:Jt(o),options:a}},downloadFile:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Bt("downloadFile","fileId",t);const s="/file/{fileId}".replace("{fileId}",encodeURIComponent(String(t))),o=new URL(s,Yt);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n},r={};await Gt(r,e),Vt(o,{});let l=i&&i.headers?i.headers:{};return a.headers={...r,...l,...n.headers},{url:Jt(o),options:a}},updateFile:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Bt("updateFile","fileId",t);const o="/file/{fileId}".replace("{fileId}",encodeURIComponent(String(t))),i=new URL(o,Yt);let a;e&&(a=e.baseOptions);const r={method:"PUT",...a,...s},l={};await Gt(l,e),l["Content-Type"]="application/json",Vt(i,{});let d=a&&a.headers?a.headers:{};return r.headers={...l,...d,...s.headers},r.data=Ht(n,r,e),{url:Jt(i),options:r}},updateFileInfo:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Bt("updateFileInfo","doFail",t);const s=new URL("/file/info",Yt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={};await Gt(a,e),a["Content-Type"]="application/json",Vt(s,{});let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=Ht(t,i,e),{url:Jt(s),options:i}},uploadFile:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/file",Yt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={},r=new(e&&e.formDataCtor||FormData);await Gt(a,e),void 0!==t&&r.append("file",t),a["Content-Type"]="multipart/form-data",Vt(s,{});let l=o&&o.headers?o.headers:{};return i.headers={...a,...l,...n.headers},i.data=r,{url:Jt(s),options:i}},uploadFileWithFileInfo:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const o=new URL("/fileWithInfo",Yt);let i;e&&(i=e.baseOptions);const a={method:"POST",...i,...s},r={},l=new(e&&e.formDataCtor||FormData);await Gt(r,e),void 0!==t&&l.append("file",t),void 0!==n&&l.append("fileInfo",new Blob([JSON.stringify(n)],{type:"application/json"})),r["Content-Type"]="multipart/form-data",Vt(o,{});let d=i&&i.headers?i.headers:{};return a.headers={...r,...d,...s.headers},a.data=l,{url:Jt(o),options:a}},uploadFileWithFileInfoAndDocRel:async function(t,n,s,o){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const a=new URL("/fileWithInfoAndDocRel",Yt);let r;e&&(r=e.baseOptions);const l={method:"POST",...r,...i},d={},c=new(e&&e.formDataCtor||FormData);await Gt(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",Vt(a,{});let u=r&&r.headers?r.headers:{};return l.headers={...d,...u,...i.headers},l.data=c,{url:Jt(a),options:l}}}}(e);return{async cloneFilesAndCreateRels(n,s,o,i){const a=await t.cloneFilesAndCreateRels(n,s,o,i);return Wt(a,Me.default,Kt,e)},async deleteFile(n,s){const o=await t.deleteFile(n,s);return Wt(o,Me.default,Kt,e)},async downloadFile(n,s){const o=await t.downloadFile(n,s);return Wt(o,Me.default,Kt,e)},async updateFile(n,s,o){const i=await t.updateFile(n,s,o);return Wt(i,Me.default,Kt,e)},async updateFileInfo(n,s){const o=await t.updateFileInfo(n,s);return Wt(o,Me.default,Kt,e)},async uploadFile(n,s){const o=await t.uploadFile(n,s);return Wt(o,Me.default,Kt,e)},async uploadFileWithFileInfo(n,s,o){const i=await t.uploadFileWithFileInfo(n,s,o);return Wt(i,Me.default,Kt,e)},async uploadFileWithFileInfoAndDocRel(n,s,o,i,a){const r=await t.uploadFileWithFileInfoAndDocRel(n,s,o,i,a);return Wt(r,Me.default,Kt,e)}}};class qt extends Ft{cloneFilesAndCreateRels(e,t,n,s){return $t(this.configuration).cloneFilesAndCreateRels(e,t,n,s).then((e=>e(this.axios,this.basePath)))}deleteFile(e,t){return $t(this.configuration).deleteFile(e,t).then((e=>e(this.axios,this.basePath)))}downloadFile(e,t){return $t(this.configuration).downloadFile(e,t).then((e=>e(this.axios,this.basePath)))}updateFile(e,t,n){return $t(this.configuration).updateFile(e,t,n).then((e=>e(this.axios,this.basePath)))}updateFileInfo(e,t){return $t(this.configuration).updateFileInfo(e,t).then((e=>e(this.axios,this.basePath)))}uploadFile(e,t){return $t(this.configuration).uploadFile(e,t).then((e=>e(this.axios,this.basePath)))}uploadFileWithFileInfo(e,t,n){return $t(this.configuration).uploadFileWithFileInfo(e,t,n).then((e=>e(this.axios,this.basePath)))}uploadFileWithFileInfoAndDocRel(e,t,n,s,o){return $t(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 Xt="https://devkluster.ehr.ee/api/yld-esi/v1".replace(/\/+$/,"");class Qt{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Xt,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Me.default;this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class Zt extends Error{constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const en="https://example.com",tn=function(e,t,n){if(null==n)throw new Zt(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function nn(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>nn(e,t,n))):Object.keys(t).forEach((s=>nn(e,t[s],`${n}${""!==n?".":""}${s}`))):e.has(n)?e.append(n,t):e.set(n,t))}const sn=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];nn(t,s),e.search=t.toString()},on=function(e){return e.pathname+e.search+e.hash},an=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 a={...e.options,url:((null==s?void 0:s.basePath)||o.defaults.baseURL||i)+e.url};return o.request(a)}};const rn=function(e){return{esileht:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};tn("esileht","id",t),tn("esileht","language",n);const o="/public/page/{id}/{language}".replace("{id}",encodeURIComponent(String(t))).replace("{language}",encodeURIComponent(String(n))),i=new URL(o,en);let a;e&&(a=e.baseOptions);const r={method:"GET",...a,...s};sn(i,{});let l=a&&a.headers?a.headers:{};return r.headers={...l,...s.headers},{url:on(i),options:r}},lehed:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/api/pages",en);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};sn(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:on(n),options:o}},lehedId:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/api/pages/dotyid",en);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};sn(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:on(n),options:o}},leht:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};tn("leht","id",t);const s="/api/pages/{id}".replace("{id}",encodeURIComponent(String(t))),o=new URL(s,en);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n};sn(o,{});let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:on(o),options:a}},lehtdSave:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};tn("lehtdSave","esileht",t);const s=new URL("/api/pages",en);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={};a["Content-Type"]="application/json",sn(s,{});let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...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:on(s),options:i}}}},ln=function(e){const t=rn(e);return{async esileht(n,s,o){const i=await t.esileht(n,s,o);return an(i,Me.default,Xt,e)},async lehed(n){const s=await t.lehed(n);return an(s,Me.default,Xt,e)},async lehedId(n){const s=await t.lehedId(n);return an(s,Me.default,Xt,e)},async leht(n,s){const o=await t.leht(n,s);return an(o,Me.default,Xt,e)},async lehtdSave(n,s){const o=await t.lehtdSave(n,s);return an(o,Me.default,Xt,e)}}};class dn extends Qt{esileht(e,t,n){return ln(this.configuration).esileht(e,t,n).then((e=>e(this.axios,this.basePath)))}lehed(e){return ln(this.configuration).lehed(e).then((e=>e(this.axios,this.basePath)))}lehedId(e){return ln(this.configuration).lehedId(e).then((e=>e(this.axios,this.basePath)))}leht(e,t){return ln(this.configuration).leht(e,t).then((e=>e(this.axios,this.basePath)))}lehtdSave(e,t){return ln(this.configuration).lehtdSave(e,t).then((e=>e(this.axios,this.basePath)))}}class cn{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 un={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},pn={proceedingApiService:new _t(new yt({basePath:un.myViewsApiEndpoint})),classifierApiService:new Re(new Ke({basePath:un.classifierApiEndpoint})),personApiService:new Qe(new st({basePath:un.userApiEndpoint})),userApiService:new nt(new st({basePath:un.userApiEndpoint})),myDocumentBaseApiService:new ft(new yt({basePath:un.myViewsApiEndpoint})),documentApiService:new Pt(new Rt({basePath:un.documentApiEndpoint})),fileApiService:new qt(new zt({basePath:un.fileUploadApiEndpoint})),frontPageApi:new dn(new cn({basePath:un.frontPageApiEndpoint})),institutionKovEndpointApi:new ze(new st({basePath:un.userApiEndpoint}))};var hn=c(848);const mn=11272,gn=e=>{var t;let{userInfo:n}=e;const s=(0,z.useIntl)(),[o,i]=(0,q.useState)(!0),[a,r]=(0,q.useState)(""),[l,d]=(0,q.useState)(""),c=(null===(t=n.activeRole)||void 0===t?void 0:t.businessType)===me.MKM;(0,q.useEffect)((()=>{c?u():p()}),[]);const u=async()=>{pn.frontPageApi.leht(mn).then((e=>{const t=e.data;t[0].body&&(r(t[0].body),d(t[0].body))}))},p=async()=>{pn.frontPageApi.esileht(mn,"ee").then((e=>{const t=e.data;t.body&&(r(t.body),d(t.body))}))};return(0,hn.jsx)(X.Section,{collapsed:!1,title:"my_admin_proceedings.admin_proceedings_reminder",showSettings:!0,children:(0,hn.jsxs)("div",{className:o?"d-flex justify-content-between":"",children:[(0,hn.jsx)(X.RichTextEditor,{placeholder:o?"":s.formatMessage({id:"placeholder.writing"}),onChange:e=>d(e),value:l,readOnly:o,view:o}),c&&o&&(0,hn.jsx)(X.Link,{onClick:()=>i(!1),type:"edit"}),!o&&(0,hn.jsxs)("div",{className:"pt-2",children:[(0,hn.jsx)(X.Button,{colourScheme:"light",squared:!0,onClick:()=>{d(a),i(!0)},children:s.formatMessage({id:"button.cancel"})}),(0,hn.jsx)(X.Button,{className:"float-right",colourScheme:"success",squared:!0,onClick:()=>(async()=>{i(!o),r(l),pn.frontPageApi.lehtdSave({id:mn,body:l,language:"ee"})})(),children:s.formatMessage({id:"button.save"})})]})]})})},fn={default:"header-arrow-up-down-icon",des:"header-arrow-down-icon",asc:"header-arrow-up-icon"},Sn=e=>(0,hn.jsx)(X.Tooltip,{content:(0,hn.jsx)(X.Text,{raw:e.tooltipText}),placement:"bottom",theme:"dark",children:e.functionCall?(0,hn.jsx)(X.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,hn.jsx)(X.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),In=e=>{let{proceedings:t,linkGen:n}=e;const s=(0,z.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,hn.jsx)(Sn,{linkName:t.proceedingNr,tooltipText:"detailsearch.tooltip.open_proceeding",functionCall:e=>{n(!0,e,void 0,`administrativeActProceeding/${t.proceedingNr}`)}}):(0,hn.jsx)(hn.Fragment,{children:"-"});var t}},{id:"doty",property:"document",size:160,getValue:e=>e.document&&null!==e.document?(0,hn.jsx)(Sn,{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,hn.jsxs)(hn.Fragment,{children:[(0,hn.jsx)(Sn,{linkName:t,tooltipText:"detailsearch.tooltip.open_building",functionCall:e=>{n(!0,e,"BUILDING",t)}}),s!==e.ehrCode.length-1?(0,hn.jsx)("span",{children:", "}):""]}))):""},{id:"proceeding_state",property:"state",size:130,getValue:e=>e.state}];return(0,hn.jsx)(X.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:fn,expandableRow:!1,isFilter:!1}},data:t,handleEvent:()=>!0})},Tn=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const[n,s]=(0,q.useState)(!1),[o,i]=(0,q.useState)(void 0),[a,r]=(0,q.useState)([]);(0,q.useEffect)((()=>{i(void 0),l()}),[e,t]);const l=async()=>{var n;if((null===(n=e.activeRole)||void 0===n?void 0:n.businessType)===me.TJA){s(!0);try{var o;const n=t?{institutionId:e.activeRole.businessId}:{userId:e.userId},s=await pn.proceedingApiService.findAreaProceedings(n);r(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 r([])};return{loading:n,proceedings:a,error:o}},vn=e=>{let{userInfo:t,linkGen:n}=e;const s=(0,z.useIntl)(),[o,i]=(0,q.useState)(!1),{loading:a,error:r,proceedings:l}=Tn(t,o);return(0,hn.jsxs)(X.Section,{collapsed:!1,title:"my_admin_proceedings.my_proceedings",showSettings:!0,children:[r&&(0,hn.jsx)(X.MessageBlock,{dismissible:!1,theme:"danger",children:s.formatMessage({id:r})}),a&&(0,hn.jsxs)(X.Row,{className:"mb-4 justify-content-center",children:[(0,hn.jsx)("br",{}),(0,hn.jsx)(X.Loader,{}),(0,hn.jsx)("br",{})]}),!a&&!(null==l||!l.length)&&!r&&(0,hn.jsx)(In,{proceedings:l,linkGen:n}),(0,hn.jsx)("div",{className:"d-flex justify-content-start my-2",children:(0,hn.jsx)(X.Checkbox,{name:"checkbox",onChange:e=>i(e),text:s.formatMessage({id:"my_proceedings.view_all_institution_admin_proceedings"}),checked:o})})]})},En=e=>{var t;let{userInfo:n,linkGen:s}=e;const o=(0,z.useIntl)(),i=(null===(t=n.activeRole)||void 0===t?void 0:t.businessType)===me.TJA;return(0,hn.jsxs)("div",{children:[(0,hn.jsx)("h2",{children:o.formatMessage({id:"my_admin_proceedings.page_title"})}),i&&(0,hn.jsx)("div",{className:"d-flex justify-content-end mt-2",children:(0,hn.jsx)(X.Button,{withPlus:!0,type:"submit",onClick:()=>{s(!0,void 0,"","/administrativeActProceeding")},children:o.formatMessage({id:"my_admin_proceedings.new_proceeding"})})}),(0,hn.jsx)(gn,{userInfo:n}),i&&(0,hn.jsx)(vn,{userInfo:n,linkGen:s})]})};const _n=(e=>{var t={};return c.d(t,e),t})({useDispatch:()=>i.useDispatch,useSelector:()=>i.useSelector});const yn=(e=>{var t={};return c.d(t,e),t})({default:()=>a.default});function bn(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 Dn(e,t,n){const s=n(e),o=n(t);return s===o?0:s>o?1:-1}function xn(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 Mn(e,t,n){const s=n(e),o=n(t),i=xn(s),a=xn(o);return a===i?0:i>a?1:-1}function Nn(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:bn,number:Dn,object:Mn,date:Nn}[typeof t(e[0])];return[...e].sort(((e,o)=>s(e,o,t)*n))}const An=0,Un=1,wn=-1;function jn(e,t){return{column:e,direction:e===t.column?function(e){switch(e){case An:return Un;case Un:return wn;case wn:return Un}}(t.direction):Un}}const Cn=e=>-1===e.sortDirection?(0,hn.jsx)("svg",{width:"10",height:"8",viewBox:"0 8 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,hn.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,hn.jsx)("svg",{width:"10",height:"8",viewBox:"0 0 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,hn.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,hn.jsx)("svg",{width:"10",height:"16",viewBox:"0 0 10 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,hn.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"})}),Ln=e=>{const[t,n]=(0,q.useState)(!1);return(0,hn.jsx)(hn.Fragment,{children:e.fileId&&(0,hn.jsx)(X.ControlledPopover,{content:(0,hn.jsxs)("div",{style:{width:"250px"},children:[(0,hn.jsx)("h4",{children:(0,hn.jsx)(z.FormattedMessage,{id:"download.file"})}),(0,hn.jsx)("br",{}),(0,hn.jsxs)("div",{className:"d-flex justify-content-between mt-2",children:[(0,hn.jsx)(X.Button,{colourScheme:"light",type:"reset",squared:!0,children:(0,hn.jsx)(z.FormattedMessage,{id:"button.cancel"})}),(0,hn.jsx)(X.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],{}),a=document.createElement("a");a.download=o,a.href=URL.createObjectURL(i),a.addEventListener("click",(()=>{setTimeout((()=>URL.revokeObjectURL(a.href)),3e4)})),a.click(),n(!t)})).catch((e=>console.log(e)))},squared:!0,type:"submit",children:(0,hn.jsx)(z.FormattedMessage,{id:"button.download"})})]})]}),open:t,placement:"bottom-end",toggle:()=>n(!t),children:(0,hn.jsx)(X.Icon,{tooltipText:(0,hn.jsx)(z.FormattedMessage,{id:"tooltip.download"}),type:"download"})})})};let Pn=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 Rn=[{code:Pn.DO_DOKUSEIS_ESITATUD,value:"Esitatud"},{code:Pn.DO_DOKUSEIS_KOOSTAMISEL,value:"Koostamisel"},{code:Pn.DO_DOKUSEIS_MENETLUSES,value:"Menetluses"},{code:Pn.DO_DOKUSEIS_MUUTMISEL,value:"Muutmisel"},{code:Pn.DO_DOKUSEIS_TAIENDAMISEL,value:"Täiendamisel"}],Kn=[{code:Pn.DO_DOKUSEIS_KEHTETU,value:"Kehtetu"},{code:Pn.DO_DOKUSEIS_REG_KANTUD,value:"Registrisse kantud"},{code:Pn.DO_DOKUSEIS_TYHISTATUD,value:"Tühistatud"},{code:Pn.DO_DOKUSEIS_LOOBUTUD,value:"Tagasi võetud"}];function Fn(e){const t=(e,t)=>({name:e,type:t});switch(Pn[e]){case Pn.DO_DOKUSEIS_ESITATUD:return t("Esitatud",ce.INFO);case Pn.DO_DOKUSEIS_KEHTETU:return t("Kehtetu",ce.DEFAULT);case Pn.DO_DOKUSEIS_KOOSTAMISEL:case Pn.DO_DOKUSEIS_EELNOU_AKTIIVNE:return t("Koostamisel",ce.INFO);case Pn.DO_DOKUSEIS_ALLKIRJASTAMISEL:return t("Allkirjastamisel",ce.INFO);case Pn.DO_DOKUSEIS_MENETLUSES:return t("Menetluses",ce.INFO);case Pn.DO_DOKUSEIS_MUUTMISEL:return t("Muutmisel",ce.INFO);case Pn.DO_DOKUSEIS_TAIENDAMISEL:return t("Täiendamisel",ce.WARNING);case Pn.DO_DOKUSEIS_TYHISTATUD:return t("Tühistatud",ce.DEFAULT);case Pn.DO_DOKUSEIS_VANA_VERSIOON:return t("Vana versioon",ce.DEFAULT);case Pn.DO_DOKUSEIS_LOOBUTUD:return t("Tagasi võetud",ce.DEFAULT);case Pn.DO_DOKUSEIS_ALLKIRJASTATUD:return t("Allkirjastatud",ce.INFO);case Pn.DO_DOKUSEIS_MENETLETUD:return t("Menetletud",ce.SUCCESS);case Pn.DO_DOKUSEIS_LUBATUD:return t("Lubatud/Teavitatud",ce.SUCCESS);case Pn.DO_DOKUSEIS_LUB_TEAV:return t("Lubatud/Teavitatud",ce.WARNING);case Pn.DO_DOKUSEIS_KEELDUTUD:return t("Keelatud/Tagasi lükatud",ce.DANGER);case Pn.DO_DOKUSEIS_TEAVITATUD:return t("Teavitatud",ce.SUCCESS);case Pn.DO_DOKUSEIS_REG_KANTUD:return t("Registrisse kantud",ce.SUCCESS);case Pn.DO_DOKUSEIS_ANTUD:return t("Antud",ce.SUCCESS);case Pn.DO_DOKUSEIS_EM_KINNITATUD_AKTUAL:case Pn.DO_DOKUSEIS_KEHTIV:return t("Kehtiv",ce.SUCCESS);case Pn.DO_DOKUSEIS_TUNNIST_KEHTETUKS:return t("Tunnistatud kehtetuks",ce.DEFAULT);case Pn.DO_DOKUSEIS_KOOSK_RINGIL:return t("Kooskõlastusringil",ce.INFO);default:return t(e,ce.DEFAULT)}}function kn(e){let t=[];e===Z?t=Rn:e===ee&&(t=Kn);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 Yn(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)&&[Pn.DO_DOKUSEIS_MENETLETUD,Pn.DO_DOKUSEIS_LUBATUD,Pn.DO_DOKUSEIS_LUB_TEAV,Pn.DO_DOKUSEIS_KEELDUTUD,Pn.DO_DOKUSEIS_TEAVITATUD,Pn.DO_DOKUSEIS_REG_KANTUD,Pn.DO_DOKUSEIS_ANTUD,Pn.DO_DOKUSEIS_KEHTIV].includes(n)?t.documentStates.includes(Pn.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((0,yn.default)(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((0,yn.default)(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((0,yn.default)(e.docDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n&&new Date((0,yn.default)(e.docDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()<=s))}return e}function Bn(e){return null!=e}function Gn(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,a]=(0,q.useState)(!1);function r(){a(!i)}const l=(0,hn.jsxs)("div",{children:[(0,hn.jsx)("h4",{children:(0,hn.jsx)(z.FormattedMessage,{defaultMessage:"Kas olete kindel, et soovite selle rea kustutada?",id:null!==(t=e.titleText)&&void 0!==t?t:"common.confirmation.modal.header"})}),(0,hn.jsx)("p",{children:(0,hn.jsx)(z.FormattedMessage,{defaultMessage:"Kustutatud ridu ei ole võimalik hiljem taastada",id:null!==(n=e.messageText)&&void 0!==n?n:"common.confirmation.modal.description"})}),(0,hn.jsxs)("div",{children:[(0,hn.jsx)(X.Button,{colourScheme:"light",squared:!0,type:"reset",children:(0,hn.jsx)(z.FormattedMessage,{defaultMessage:"Loobun",id:"common.confirmation.modal.no"})}),(0,hn.jsx)(X.Button,{className:"float-right",colourScheme:"danger",onClick:()=>(e.onConfirm(),void r()),squared:!0,type:"submit",children:(0,hn.jsx)(z.FormattedMessage,{defaultMessage:"Kustutan",id:"common.confirmation.modal.yes"})})]})]});return(0,hn.jsx)(X.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:()=>r(),wrapperClassName:null!==(o=e.wrapperClassName)&&void 0!==o?o:"",children:e.children})}function Hn(e){return(0,hn.jsx)(Vn,{titleText:e.titleText,messageText:e.messageText,onConfirm:e.onConfirm,children:(0,hn.jsx)(X.Icon,{tooltipText:(0,hn.jsx)(z.FormattedMessage,{id:"tooltip.delete"}),type:"delete"})})}const Jn=e=>{let{linkName:t,functionCall:n,tooltipText:s}=e;return(0,hn.jsxs)(hn.Fragment,{children:[(0,hn.jsx)(X.Link,{onClick:e=>null==n?void 0:n(e),text:(0,hn.jsx)(X.Text,{raw:t})}),(0,hn.jsx)(X.Info,{tooltipText:s})]})};var Wn,$n=new Uint8Array(16);function qn(){if(!Wn&&!(Wn="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 Wn($n)}const zn=/^(?:[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 Xn=function(e){return"string"==typeof e&&zn.test(e)};for(var Qn=[],Zn=0;Zn<256;++Zn)Qn.push((Zn+256).toString(16).substr(1));const es=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(Qn[e[t+0]]+Qn[e[t+1]]+Qn[e[t+2]]+Qn[e[t+3]]+"-"+Qn[e[t+4]]+Qn[e[t+5]]+"-"+Qn[e[t+6]]+Qn[e[t+7]]+"-"+Qn[e[t+8]]+Qn[e[t+9]]+"-"+Qn[e[t+10]]+Qn[e[t+11]]+Qn[e[t+12]]+Qn[e[t+13]]+Qn[e[t+14]]+Qn[e[t+15]]).toLowerCase();if(!Xn(n))throw TypeError("Stringified UUID is invalid");return n};const ts=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 es(s)},ns=e=>{let{notificationStyle:t,header:n,link:s,body:o,onCloseNotification:i,isNotClosable:a,customBody:r}=e;const l=(0,z.useIntl)(),d=null!=r?r:(0,hn.jsxs)("div",{children:[(0,hn.jsx)("h3",{className:"alert-heading",children:n}),(0,hn.jsx)("p",{className:"alert-body mb-0",children:o}),s&&(0,hn.jsx)("div",{className:"mx-2",children:(0,hn.jsx)(X.Link,{onClick:s.onClick,text:l.formatMessage({id:s.text})})})]});return a?(0,hn.jsx)("div",{id:"danger-toast",className:`alert ${t}`,children:d}):(0,hn.jsxs)("div",{id:"danger-toast",className:`alert alert-toast-box ${t}`,children:[(0,hn.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 ss=function(e){return e.Danger="danger",e.Warning="warning",e.Info="info",e.Success="success",e}({});const os=()=>{const e=(0,z.useIntl)(),t=(0,_n.useDispatch)(),n=(0,_n.useSelector)(G),[s,o]=(0,q.useState)();(0,q.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,hn.jsx)(hn.Fragment,{children:(0,hn.jsx)("div",{className:"notification-alert-box",children:(0,hn.jsx)("ul",{children:(null==s?void 0:s.length)>0&&s.map((e=>{var n;return(0,hn.jsx)("li",{children:e.theme&&(0,hn.jsx)(ns,{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(J(n));var n},link:e.link})},e.id)}))})})})},is=(0,u.createAsyncThunk)("globalUI/handleNotification",(async(e,t)=>{let{dispatch:n,getState:s}=t;const o=s().myViewsPage.notifications.notices,i=ts(),a={...e,id:i};n(H([...o,a])),e.theme!==ss.Danger&&setTimeout((()=>{n(J(i))}),7e3)})),as=(0,u.createAsyncThunk)("document/createDocument",(async(e,t)=>{let{addEntityDto:n,successCallback:s}=e,{dispatch:o}=t;try{const e=await pn.documentApiService.createDocument(n.documentType,n);return s&&s(e.data),o(V()),e.data}catch(e){o(is({header:"request.error.create_document.title",body:"request.error.create_document.message",theme:ss.Danger}))}})),rs=e=>{var t;let{doty:n,documentId:s,linkGen:o,userInfo:i}=e;const a=(0,_n.useDispatch)(),[r,l]=(0,q.useState)(!1),d=(null==i||null===(t=i.activeRole)||void 0===t?void 0:t.businessType)===me.TJA,c=(e,t)=>{if(!t)return;a(as({addEntityDto:{documentType:t,baseDocumentId:s},successCallback:t=>((e,t)=>{const n=`${e.documentTypeWithYear}/${e.documentNumber}`;e&&o(!0,t,he,n)})(t,e)}))};return(0,hn.jsx)(X.ControlledPopover,{content:(()=>{const e=n,t=De[e],s=xe[e];return(0,hn.jsxs)("div",{children:[(0,hn.jsxs)("ul",{children:[(0,hn.jsx)("li",{className:"d-flex justify-content-between",children:(0,hn.jsx)(Jn,{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(!r)}})}),d&&(0,hn.jsx)("li",{className:"d-flex justify-content-between",children:(0,hn.jsx)(Jn,{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(!r)}})})]}),(0,hn.jsx)(X.Button,{onClick:()=>{l(!1)},squared:!0,colourScheme:"light",children:(0,hn.jsx)(z.FormattedMessage,{id:"button.cancel"})})]})})(),open:r,placement:"bottom-end",toggle:()=>l(!r),children:(0,hn.jsx)("div",{className:"pl-2",children:(0,hn.jsx)(X.Icon,{tooltipText:(0,hn.jsx)(z.FormattedMessage,{id:"tooltip.more_actions"}),type:"more"})})})},ls=e=>{var t;let{linkGen:n,userInfo:s,documentType:o,onAllUsersChecked:i,isAllUsersChecked:a,filter:r,onDocumentDelete:l,fileApi:d,hidePresenter:c}=e;const u=(0,z.useIntl)(),[p,h]=(0,q.useState)({offset:0,limit:10}),[m,g]=(0,q.useState)([]),[f,S]=(0,q.useState)({column:0,direction:An}),[I,T]=(0,q.useState)(!1),[v,E]=(0,q.useState)(!1),[_,y]=(0,q.useState)(!1),b=(0,_n.useSelector)((e=>e.myViewsPage.myDocuments.workingDocuments)),D=(0,_n.useSelector)((e=>e.myViewsPage.myDocuments.signingDocuments)),x=(0,_n.useSelector)((e=>e.myViewsPage.myDocuments.finishedDocuments)),M=(0,_n.useSelector)((e=>e.myViewsPage.myProceedings.incomingDocuments)),N=(null===(t=s.activeRole)||void 0===t?void 0:t.businessType)!==me.A;(0,q.useEffect)((()=>{b&&o===Z&&(Object.keys(r).length>0?(g(Yn(b,r)),h({offset:0,limit:10})):g(b))}),[b,r]),(0,q.useEffect)((()=>{D&&o===Q&&(Object.keys(r).length>0?(g(Yn(D,r)),h({offset:0,limit:10})):g(D))}),[D,r]),(0,q.useEffect)((()=>{x&&o===ee&&(Object.keys(r).length>0?(g(Yn(x,r)),h({offset:0,limit:10})):g(x))}),[x,r]),(0,q.useEffect)((()=>{M&&o===te&&(Object.keys(r).length>0?(g(Yn(M,r)),h({offset:0,limit:10})):g(M))}),[M,r]);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=>Bn(e.docDate)?new Date((0,yn.default)(e.docDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>o===te?Bn(e.deadlineDate)?new Date((0,yn.default)(e.deadlineDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER:Bn(e.regDate)?new Date((0,yn.default)(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&&Bn(e.buildingName[0])?e.buildingName[0]:"",e=>e.ehrCode&&Bn(e.ehrCode[0])?e.ehrCode[0]:"",e=>e.buildingAddress&&Bn(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,hn.jsx)(Ln,{fileApi:d,fileId:e.generatedFileId,docNr:null!==(t=e.docNr)&&void 0!==t?t:""},e.docId+"download")];return o===Z&&e.stateCode===Pn.DO_DOKUSEIS_KOOSTAMISEL?i.push((0,hn.jsx)(Hn,{onConfirm:()=>{l(e.docNr)},titleText:"my_documents.delete_document_confirmation.modal.header",messageText:"my_documents.delete_document_confirmation.modal.message"},e.docNr)):o===ee&&e.doty&&be.includes(e.doty)&&![Pn.DO_DOKUSEIS_TYHISTATUD,Pn.DO_DOKUSEIS_TUNNIST_KEHTETUKS].includes(e.stateCode)&&i.push((0,hn.jsx)(rs,{doty:e.doty,documentId:e.docId,linkGen:n,userInfo:s})),i};return(0,hn.jsxs)(X.Section,{form:!0,children:[m&&(0,hn.jsx)(X.CollapseTable,{content:m.slice(p.offset,p.offset+p.limit).map((e=>{var t,s,i,a,r,l,d;return(0,hn.jsx)(X.CollapseTableRow,{fields:[e.docDate,o===te?(0,yn.default)(e.deadlineDate,"DD.MM.YYYY").valueOf()<(0,yn.default)().valueOf()?(0,hn.jsx)("div",{className:"red-text",children:null===(t=e.deadlineDate)||void 0===t?void 0:t.toString()}):e.deadlineDate:e.regDate,(0,hn.jsx)(X.Tooltip,{content:(0,hn.jsx)(X.Text,{raw:"my_documents.tooltip.open_document"}),placement:"bottom",theme:"dark",children:(0,hn.jsx)(X.Link,{onClick:t=>{n(!0,t,he,e.docNr)},text:e.docNr,href:n(!1,void 0,he,e.docNr)})},e.docNr),e.documentType,e.buildingName?(0,hn.jsx)("div",{children:_?(0,hn.jsxs)("div",{children:[e.buildingName.map(((e,t)=>(0,hn.jsxs)(q.default.Fragment,{children:[e,";",(0,hn.jsx)("br",{})]},t))),e.buildingName.length>5&&(0,hn.jsx)(X.Link,{type:"hide",onClick:e=>{e.preventDefault(),y(!_)},text:(0,hn.jsx)(z.FormattedMessage,{id:"my_documents.link.view_less_building_names"})})]}):1===e.buildingName.length?e.buildingName:(0,hn.jsxs)("div",{children:[null===(s=e.buildingName)||void 0===s?void 0:s.slice(0,4).map(((e,t)=>(0,hn.jsxs)(q.default.Fragment,{children:[e,";",(0,hn.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,hn.jsx)("div",{className:"pr-3",children:(0,hn.jsx)(X.Link,{type:"show",onClick:e=>{e.preventDefault(),y(!_)},text:(0,hn.jsx)(z.FormattedMessage,{id:"my_documents.link.view_all_building_names"})})})]})}):"",e.ehrCode?(0,hn.jsx)("div",{children:v?(0,hn.jsxs)("div",{children:[e.ehrCode.map(((e,t)=>(0,hn.jsxs)(q.default.Fragment,{children:[(0,hn.jsx)(Sn,{linkName:e,tooltipText:"my_documents.tooltip.open_building",functionCall:t=>{n(!0,t,ue,e)},href:n(!1,void 0,ue,e)}),(0,hn.jsx)("br",{})]},t))),e.ehrCode.length>5&&(0,hn.jsx)(X.Link,{type:"hide",onClick:e=>{e.preventDefault(),E(!v)},text:(0,hn.jsx)(z.FormattedMessage,{id:"my_documents.link.view_less_ehrCodes"})})]}):(0,hn.jsxs)("div",{children:[null===(a=e.ehrCode)||void 0===a?void 0:a.slice(0,4).map(((e,t)=>(0,hn.jsxs)(q.default.Fragment,{children:[(0,hn.jsx)(Sn,{linkName:e,tooltipText:"my_documents.tooltip.open_building",functionCall:t=>{n(!0,t,ue,e)},href:n(!1,void 0,ue,e)}),(0,hn.jsx)("br",{})]},t))),null===(r=e.ehrCode)||void 0===r?void 0:r.slice(4,5).map((e=>(0,hn.jsx)(Sn,{linkName:e,tooltipText:"my_documents.tooltip.open_building",functionCall:t=>{n(!0,t,ue,e)},href:n(!1,void 0,ue,e)}))),e.ehrCode.length>5?" ...":"",e.ehrCode.length>5&&(0,hn.jsx)("div",{className:"pr-3",children:(0,hn.jsx)(X.Link,{type:"show",onClick:e=>{e.preventDefault(),E(!v)},text:(0,hn.jsx)(z.FormattedMessage,{id:"my_documents.link.view_all_ehrCodes"})})})]})}):"",e.buildingAddress?(0,hn.jsx)("div",{children:I?(0,hn.jsxs)("div",{children:[e.buildingAddress.map(((e,t)=>(0,hn.jsxs)(q.default.Fragment,{children:[e,";",(0,hn.jsx)("br",{})]},t))),e.buildingAddress.length>5&&(0,hn.jsx)(X.Link,{type:"hide",onClick:e=>{e.preventDefault(),T(!I)},text:(0,hn.jsx)(z.FormattedMessage,{id:"my_documents.link.view_less_addresses"})})]}):1===e.buildingAddress.length?e.buildingAddress:(0,hn.jsxs)("div",{children:[null===(l=e.buildingAddress)||void 0===l?void 0:l.slice(0,4).map(((e,t)=>(0,hn.jsxs)(q.default.Fragment,{children:[e,";",(0,hn.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,hn.jsx)("div",{className:"pr-3",children:(0,hn.jsx)(X.Link,{type:"show",onClick:e=>{e.preventDefault(),T(!I)},text:(0,hn.jsx)(z.FormattedMessage,{id:"my_documents.link.view_all_addresses"})})})]})}):"",e.stateCode?(0,hn.jsx)(X.Status,{type:Fn(e.stateCode).type,children:Fn(e.stateCode).name}):"",o===Q?(0,hn.jsx)(X.Tooltip,{content:(0,hn.jsx)(X.Text,{raw:"my_documents.tooltip.open_proceeding"}),placement:"bottom",theme:"dark",children:(0,hn.jsx)(X.Link,{onClick:t=>{n(!0,t,pe,e.proceedingNr)},text:e.proceedingNr,href:n(!1,void 0,pe,e.proceedingNr)})},e.proceedingNr):e.proceedingNr,e.presenter?e.presenter.map(((t,n)=>(0,hn.jsxs)("div",{children:[t,n!==e.presenter.length-1?(0,hn.jsx)("span",{children:", "}):""]}))):""],tools:U(e),editable:!0},e.docId)})),headers:function(){const e=[...O];return e[1]="my_documents.deadline",(o===te?e:O).map(((e,t)=>(0,hn.jsxs)("div",{children:[(0,hn.jsx)("a",{className:"link-gray",style:{paddingRight:"2px"},onClick:()=>{const e=jn(t,f);S(e),e.direction!==An&&g(On(m,A[t],e.direction))},children:f.column===t?(0,hn.jsx)(Cn,{sortDirection:f.direction}):(0,hn.jsx)(Cn,{sortDirection:An})}),u.formatMessage({id:e})]})))}(),paginationEnabled:!0,pager:{offset:p.offset,limit:p.limit,total:m.length},onPaginationReload:h,editable:!0}),(0,hn.jsx)(X.Row,{children:N&&o!==te?(0,hn.jsx)(X.Col,{children:(0,hn.jsx)(X.Checkbox,{name:"checkbox",onChange:e=>i(e),text:(0,hn.jsx)(X.Text,{raw:"my_documents.view_all_institution_documents"}),checked:a})}):(0,hn.jsx)(X.Col,{})})]})};const ds=(e=>{var t={};return c.d(t,e),t})({Col:()=>r.Col,Row:()=>r.Row});function cs(e,t,n,s,o){return s?(0,hn.jsx)(X.FieldWrapper,{labelCol:o,component:(0,hn.jsxs)(ds.Row,{className:"w-100 px-0 mx-0",children:[(0,hn.jsx)(ds.Col,{xs:"auto",md:1.5,className:"pl-0 px-0",children:(0,hn.jsx)(X.Checkbox,{"data-testid":"checkbox",info:{content:s,placement:"top-start"},name:"checkbox",text:"",checked:e})}),(0,hn.jsx)(ds.Col,{className:"px-0",children:(0,hn.jsx)(X.Text,{raw:(0,hn.jsx)(z.FormattedMessage,{id:n})})})]}),label:(0,hn.jsx)(z.FormattedMessage,{id:"label.empty"})}):(0,hn.jsx)(X.FieldWrapper,{labelCol:o,component:(0,hn.jsx)(X.Checkbox,{"data-testid":"checkbox",name:"checkbox",onChange:e=>t(e),text:(0,hn.jsx)(X.Text,{raw:(0,hn.jsx)(z.FormattedMessage,{id:n})}),checked:e}),label:(0,hn.jsx)(z.FormattedMessage,{id:"label.empty"})})}const us=["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 ps(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&&(0,yn.default)(n.validTo).isBefore((0,yn.default)(new Date))?" (kuni "+(0,yn.default)(n.validTo).format("DD.MM.YYYY")+")":""),level:s.level+1,children:[],selectable:!0,value:!1})}return t.children?t.children:[]}(e.filter((e=>us.includes(e.id.toString()))).sort(((e,t)=>e.id-t.id)))}function hs(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 ms(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 gs(e){var t,n,s,o;return(0,hn.jsxs)("div",{className:"d-flex align-items-center",children:[(0,hn.jsx)("div",{className:"range--from",style:{flexGrow:1},children:(0,hn.jsx)(X.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,hn.jsx)("span",{className:"px-1",children:"—"}),(0,hn.jsx)("div",{className:"range--to",style:{flexGrow:1},children:(0,hn.jsx)(X.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 fs=e=>{const t=(0,z.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,a]=(0,q.useState)(o);(0,q.useEffect)((()=>{Object.keys(e.filterState).length>0&&a(e.filterState)}),[e.documentType]);const[r,l]=(0,q.useState)(!0),[d,c]=(0,q.useState)(!0),[u,p]=(0,q.useState)(""),[h,m]=(0,q.useState)([]),[g,f]=(0,q.useState)([]),[S,I]=(0,q.useState)([]),[T,v]=(0,q.useState)(kn(e.documentType)),[E,_]=(0,q.useState)([]),y=(0,_n.useSelector)((e=>e.myViewsPage.filter.documentTypes)),b=(0,_n.useSelector)((e=>e.myViewsPage.filter.institutionUsers)),D=(0,_n.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,a((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),a((e=>({...e})))}(0,q.useEffect)((()=>{v(kn(e.documentType))}),[e.documentType]),(0,q.useEffect)((()=>{if(y){const e=ps(y);m(e)}if(b&&e.isKov){const e=hs(b?[...b]:[]);I(e)}if(D){const e=ms([...D]);f(e)}}),[y,b,D]);return(0,hn.jsxs)(X.Form,{onSubmit:()=>e.onSubmit(i),children:[(0,hn.jsxs)(X.Row,{className:"align-items-start",children:[(0,hn.jsxs)(X.Col,{sm:10,className:"mx-0 px-0",children:[(0,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)(X.Multiselect,{name:"multiselect",options:h,onSelect:e=>M(e,"documentTypes"),allSelection:!0,onRemoveItem:e=>M(e,"documentTypes"),value:i.documentTypes,selectedOptions:E}),label:(0,hn.jsx)(z.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,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)(X.Input,{name:"input",onChange:e=>N(e,"buildingName"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.buildingName}),label:(0,hn.jsx)(z.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,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)(X.Input,{name:"input",onChange:e=>N(e,"documentNumber"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.documentNumber}),label:(0,hn.jsx)(z.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!==te&&e.documentType!==Q&&(0,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)(X.Multiselect,{name:"multiselect",options:T,onSelect:e=>M(e,"documentStates"),allSelection:!0,onRemoveItem:e=>M(e,"documentStates"),value:i.documentStates,selectedOptions:E}),label:(0,hn.jsx)(z.FormattedMessage,{id:"my_documents.filter.label.document_state"}),labelCol:{sm:20,md:8,lg:8}}),(0,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)(X.Input,{name:"input",onChange:e=>N(e,"proceedingNumber"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.proceedingNumber}),label:(0,hn.jsx)(z.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"}}),cs(i.proceedingMissing,(function(e){a((t=>({...t,proceedingMissing:e})))}),"my_documents.filter.label.proceeding_missing","my_documents.filter.tooltip.proceeding_missing"),(0,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)(gs,{onChange:e=>(e=>{""!==e.from&&!(0,yn.default)(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!(0,yn.default)(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(""),a((t=>({...t,documentDate:e})))})(e),value:i.documentDate}),errorMessage:u.length>0?u:null,label:(0,hn.jsx)(z.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,hn.jsxs)(X.Col,{sm:10,className:"mx-0 px-0",children:[(0,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)(X.Input,{name:"input",onChange:e=>N(e,"ehrCode"),onBlur:e=>l(x(e.trim())),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.ehrCode}),errorMessage:!r&&(0,hn.jsx)(X.Text,{raw:"filter.invalid_building_code"}),label:(0,hn.jsx)(z.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,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)(X.Input,{name:"input",onChange:e=>N(e,"wordInAddress"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.wordInAddress}),label:(0,hn.jsx)(z.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!==te&&e.documentType!==Q&&e.isKov&&(0,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)(X.Multiselect,{name:"multiselect",options:S,onSelect:e=>M(e,"institutionUsers"),allSelection:!0,onRemoveItem:e=>M(e,"institutionUsers"),value:i.institutionUsers,selectedOptions:E}),label:(0,hn.jsx)(z.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!==te&&(0,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)(X.Multiselect,{name:"multiselect",options:g,onSelect:e=>M(e,"institutions"),allSelection:!0,onRemoveItem:e=>M(e,"institutions"),value:i.institutions,selectedOptions:E}),label:(0,hn.jsx)(z.FormattedMessage,{id:"my_documents.filter.label.institution"}),labelCol:{sm:20,md:8,lg:8}}),e.isKov&&e.documentType===Q&&(0,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)(X.Multiselect,{name:"multiselect",options:S,onSelect:e=>M(e,"institutionUsers"),allSelection:!0,onRemoveItem:e=>M(e,"institutionUsers"),value:i.institutionUsers,selectedOptions:E}),label:(0,hn.jsx)(z.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,hn.jsxs)(X.Row,{children:[(0,hn.jsx)(X.Col,{children:(0,hn.jsx)(X.Button,{onClick:()=>(_([]),void a(o)),colourScheme:"light",squared:!0,children:(0,hn.jsx)(z.FormattedMessage,{id:"button.epmty_fields"})})}),(0,hn.jsx)(X.Col,{children:(0,hn.jsx)(X.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!(r&&d),squared:!0,children:(0,hn.jsx)(z.FormattedMessage,{id:"button.search"})})})]})]})},Ss=["11566","11567","11569","11576","11577"],Is=[Ie,Te,ve,Ee],Ts=e=>{const[t,n]=(0,q.useState)(!1),[s,o]=(0,q.useState)(""),[i,a]=(0,q.useState)(!1),[r,l]=(0,q.useState)([]),d=(0,_n.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,q.useEffect)((()=>{if(d){const e=d.filter((e=>!Ss.includes(e.code)&&!Is.includes(e.code)));l(e.map((e=>({code:e.code,texts:e.value}))))}}),[d]);return(0,hn.jsx)(X.ControlledPopover,{maxWidth:900,open:t,content:(0,hn.jsx)("div",{style:{width:"600px"},children:(0,hn.jsxs)(X.Form,{onSubmit:()=>{a(!0)},children:[(0,hn.jsx)("h2",{children:(0,hn.jsx)(z.FormattedMessage,{id:"my_documents.popover.title.composing_new_document"})}),(0,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)(X.Select,{filterable:!0,placeholder:"placeholder.choose",name:"role",onChange:e=>o(e),options:r,value:s}),errorMessage:i&&c(s)&&(0,hn.jsx)(X.Text,{raw:"common.select.required"}),label:(0,hn.jsx)(X.Text,{raw:"my_documents.popover.label.new_document_type"}),name:"documentType",info:{content:"my_documents.popover.tooltip.document_type"}}),(0,hn.jsxs)("div",{className:"d-flex justify-content-between mt-2",children:[(0,hn.jsx)(X.Button,{colourScheme:"light",onClick:()=>{a(!1),o("")},children:(0,hn.jsx)(z.FormattedMessage,{id:"button.cancel"})}),(0,hn.jsx)(X.Button,{className:"float-right",colourScheme:"success",onClick:t=>{c(s)||(e.linkGen(!0,t,"DOCUMENT","",{doty:s}),n(!1))},children:(0,hn.jsx)(z.FormattedMessage,{id:"my_documents.popover.button.compose_new_document"})})]})]})}),placement:"bottom-end",toggle:()=>{n(!t)},children:(0,hn.jsx)(X.Button,{withPlus:!0,colourScheme:"info",onClick:()=>{n(!t)},children:(0,hn.jsx)(z.FormattedMessage,{id:"my_documents.button.start_new_document"})})})},vs=["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"],Es=["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"],_s=["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"],ys=e=>{var t,n,s,o,i,a,r;let{linkGen:l,userInfo:d}=e;const c=(0,_n.useDispatch)(),[u,p]=(0,q.useState)({signingDocs:!1,workingDocs:!1,finishedDocs:!1}),[h,S]=(0,q.useState)(!1),[I,T]=(0,q.useState)(!0),[D,x]=(0,q.useState)(!0),[M,N]=(0,q.useState)([]),[O,A]=(0,q.useState)([]),[U,w]=(0,q.useState)([]),[j,C]=(0,q.useState)({}),[L,P]=(0,q.useState)({}),[R,K]=(0,q.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:vs,states:[Pn.DO_DOKUSEIS_ESITATUD,Pn.DO_DOKUSEIS_KOOSTAMISEL,Pn.DO_DOKUSEIS_EELNOU_AKTIIVNE,Pn.DO_DOKUSEIS_ALLKIRJASTAMISEL,Pn.DO_DOKUSEIS_MENETLUSES,Pn.DO_DOKUSEIS_TAIENDAMISEL,Pn.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:Es,states:[Pn.DO_DOKUSEIS_KEHTETU,Pn.DO_DOKUSEIS_TUNNIST_KEHTETUKS,Pn.DO_DOKUSEIS_REG_KANTUD,"DO_DOKUSEIS_TAGASTATUD",Pn.DO_DOKUSEIS_KEELDUTUD,Pn.DO_DOKUSEIS_TYHISTATUD,Pn.DO_DOKUSEIS_LOOBUTUD,Pn.DO_DOKUSEIS_ALLKIRJASTATUD,Pn.DO_DOKUSEIS_MENETLETUD,Pn.DO_DOKUSEIS_LUBATUD,Pn.DO_DOKUSEIS_LUB_TEAV,Pn.DO_DOKUSEIS_TEAVITATUD,Pn.DO_DOKUSEIS_ANTUD,Pn.DO_DOKUSEIS_KEHTIV]},B={userId:null===(a=d.activeRole)||void 0===a?void 0:a.userId,personId:null===(r=d.activeRole)||void 0===r?void 0:r.businessId,roles:["DO_DOKU_ISIK_ROLL_ALLAK"],dotys:_s,states:[Pn.DO_DOKUSEIS_ALLKIRJASTAMISEL]};return(0,q.useEffect)((()=>{var e,t;pn.classifierApiService.getAllDocumentTypes().then((e=>{c(m(e.data))})).catch((e=>{console.log(e)})),pn.institutionKovEndpointApi.getJurKovPersons().then((e=>{c(f(e.data))})).catch((e=>{console.log(e)})),F&&pn.userApiService.getJurUsers(null!==(e=null===(t=d.activeRole)||void 0===t?void 0:t.businessId)&&void 0!==e?e:0).then((e=>{c(g(e.data))})).catch((e=>{console.log(e)})),pn.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(b(t))})).catch((e=>{console.log("Following error occured:",e)}))}),[d]),(0,q.useEffect)((()=>{(()=>{const e=k;u.workingDocs&&(e.userId=void 0),T(!0),pn.myDocumentBaseApiService.findWorkingDocuments(e).then((e=>{c(v(e.data)),T(!1),A(e.data)})).catch((e=>{console.log("Following error occured:",e),T(!1)}))})()}),[u.workingDocs,d]),(0,q.useEffect)((()=>{!function(){const e=Y;u.finishedDocs&&(e.userId=void 0),x(!0),pn.myDocumentBaseApiService.findWorkingDocuments(e).then((e=>{c(_(e.data)),x(!1),w(e.data)})).catch((e=>{console.log("Following error occured:",e),x(!1)}))}()}),[u.finishedDocs,d]),(0,q.useEffect)((()=>{!function(){const e=B;u.signingDocs&&(e.userId=void 0),S(!0),pn.myDocumentBaseApiService.findWorkingDocuments(e).then((e=>{c(E(e.data)),S(!1),N(e.data)})).catch((e=>{console.log("Following error occured:",e),S(!1)}))}()}),[u.signingDocs,d]),(0,hn.jsxs)("div",{children:[(0,hn.jsx)(os,{}),(0,hn.jsx)("div",{className:"d-flex justify-content-end mt-2",children:(0,hn.jsx)(Ts,{linkGen:l})}),F&&(0,hn.jsx)(X.Section,{collapsed:!1,title:"my_documents.my_documents_to_sign",showSettings:!0,filterContents:(0,hn.jsx)(fs,{documentType:Q,filterState:j,onSubmit:e=>C(e),isKov:F}),children:h?(0,hn.jsx)(X.SectionLoader,{}):0===M.length?(0,hn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,hn.jsx)(X.Text,{raw:"my_documents.signing_documents.no_docs"})}):(0,hn.jsx)(ls,{linkGen:l,userInfo:d,documentType:Q,onAllUsersChecked:e=>{p({signingDocs:e,workingDocs:u.workingDocs,finishedDocs:u.finishedDocs})},isAllUsersChecked:u.signingDocs,filter:j,fileApi:pn.fileApiService,hidePresenter:!0})}),(0,hn.jsx)(X.Section,{collapsed:!1,title:"my_documents.working_documents",showSettings:!0,filterContents:(0,hn.jsx)(fs,{documentType:Z,filterState:L,onSubmit:e=>P(e),isKov:F}),children:I?(0,hn.jsx)(X.SectionLoader,{}):0===O.length?(0,hn.jsxs)("div",{children:[(0,hn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,hn.jsx)(X.Text,{raw:"my_documents.working_documents.no_docs"})}),F&&(0,hn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,hn.jsx)(X.Link,{text:"my_documents.view_all_institution_documents",onClick:()=>{p({signingDocs:u.signingDocs,workingDocs:!0,finishedDocs:u.finishedDocs})}})}),(0,hn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,hn.jsx)(Ts,{linkGen:l})})]}):(0,hn.jsx)(ls,{linkGen:l,userInfo:d,documentType:Z,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);pn.documentApiService.deleteApplicationByNumber(t,n),c(y(e))}(e),fileApi:pn.fileApiService})}),(0,hn.jsx)(X.Section,{collapsed:!1,title:"my_documents.finished_documents",showSettings:!0,filterContents:(0,hn.jsx)(fs,{documentType:ee,filterState:R,onSubmit:e=>K(e),isKov:F}),children:D?(0,hn.jsx)(X.SectionLoader,{}):0===U.length?(0,hn.jsxs)("div",{children:[(0,hn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,hn.jsx)(X.Text,{raw:"my_documents.finished_documents.no_docs"})}),F&&(0,hn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,hn.jsx)(X.Link,{text:"my_documents.view_all_institution_documents",onClick:()=>{p({signingDocs:u.signingDocs,workingDocs:u.workingDocs,finishedDocs:!0})}})}),(0,hn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,hn.jsx)(Ts,{linkGen:l})})]}):(0,hn.jsx)(ls,{linkGen:l,userInfo:d,documentType:ee,onAllUsersChecked:e=>{p({signingDocs:u.signingDocs,workingDocs:u.workingDocs,finishedDocs:e}),x(!0)},isAllUsersChecked:u.finishedDocs,filter:R,fileApi:pn.fileApiService})})]})},bs={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 Ds(e){return Gn(bs,e)}function xs(e){const t=Ds(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 Ms=[{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 Ns(){return Ms.map((e=>({id:e.code+"",label:e.value,level:2,children:[],selectable:!0,value:!1})))}function Os(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(Ds(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((0,yn.default)(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((0,yn.default)(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((0,yn.default)(e.dateStart,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n&&new Date((0,yn.default)(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((0,yn.default)(e.lastEventDate).format("YYYY-MM-DD")).getTime()<=n))}return e}function As(){return Ms.filter((e=>"MENSEIS_TAIENDAMISEL"!==e.code&&"MENSEIS_MUUTMISEL"!==e.code&&"MENSEIS_LOPETATUD"!==e.code&&"MENSEIS_PEATATUD"!==e.code)).map((e=>({id:e.code})))}let Us=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 ws=e=>e?(e=>[..._e,...ye].includes(e))(e)?Us.AdminProceeding:Us.Proceeding:Us.NotFound,js=e=>{const t=(0,z.useIntl)(),[n,s]=(0,q.useState)({offset:0,limit:50}),[o,i]=(0,q.useState)([]),[a,r]=(0,q.useState)({column:5,direction:Un}),[l,d]=(0,q.useState)(!1),[c,u]=(0,q.useState)(!1),[p,h]=(0,q.useState)(!1),m=(0,_n.useSelector)((e=>e.myViewsPage.myProceedings.myProceedings)),g=[e=>Bn(e.dateStart)?new Date((0,yn.default)(e.dateStart,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>Bn(e.deadline)?new Date((0,yn.default)(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=>Bn(e.innerCommentDeadline)?new Date(e.innerCommentDeadline).getTime():Number.MAX_SAFE_INTEGER,e=>Bn(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,q.useEffect)((()=>{if(m){const e=5,t=jn(e,a);t.direction===An&&(t.direction=Un),r(t),i(On(m,g[e],t.direction))}}),[m]),(0,q.useEffect)((()=>{m&&Object.keys(e.filter).length>0&&(a.direction===An?i(Os(m,e.filter)):i(On(Os(m,e.filter),g[a.column],a.direction)),s({offset:0,limit:50}))}),[e.filter,m]),(0,q.useEffect)((()=>{a&&a.direction!==An&&0!==o.length&&i(On(o,g[a.column],a.direction))}),[a]);const f=["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,hn.jsxs)(X.Section,{form:!0,children:[o&&(0,hn.jsx)(X.CollapseTable,{content:(t=>{const s=t,{linkGen:o}=e;return s.slice(n.offset,n.offset+n.limit).map((t=>{var n,s,i,a,r,m;let g={addresses:[],ehrCodes:[],buildingNames:[]};t.address&&(null===(n=t.address)||void 0===n?void 0:n.length)>1&&(g=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 a=[];o.forEach((e=>{const t=e.county;a.includes(t)||a.push(t)}));let r=[];o.forEach((e=>{const t=e.city;r.includes(t)||r.push(t)})),a.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=[];a.forEach((e=>{r.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));const f=ws(t.doty);return(0,hn.jsx)(X.CollapseTableRow,{fields:[t.dateStart,(0,yn.default)(t.deadline,"DD.MM.YYYY").valueOf()<(0,yn.default)().valueOf()?(0,hn.jsx)("div",{className:"red-text",children:null===(s=t.deadline)||void 0===s?void 0:s.toString()}):t.deadline,(0,hn.jsx)(X.Tooltip,{content:(0,hn.jsx)(X.Text,{raw:"my_proceedings.tooltip.open_proceeding"}),placement:"bottom",theme:"dark",children:(0,hn.jsx)(X.Link,{onClick:e=>{o(!0,e,f,t.proceedingNr)},text:t.proceedingNr,href:o(!1,void 0,f,t.proceedingNr)})},t.proceedingNr),t.stateCode?(0,hn.jsx)(X.Status,{type:xs(t.stateCode).type,children:xs(t.stateCode).name}):"",t.proceedingCircleNr,t.operationsCount,t.innerCommentDeadline?(0,yn.default)(t.innerCommentDeadline).valueOf()<=(0,yn.default)().valueOf()?(0,hn.jsx)("div",{style:{color:"#00b649"},children:(0,yn.default)(t.innerCommentDeadline).format("DD.MM.YYYY")}):(0,yn.default)(t.innerCommentDeadline).format("DD.MM.YYYY"):"",t.lastEventDate?(0,yn.default)(t.lastEventDate).format("DD.MM.YYYY"):"",(0,hn.jsx)(Sn,{linkName:t.document,tooltipText:"my_proceedings.tooltip.open_document",functionCall:n=>{e.linkGen(!0,n,"DOCUMENT",t.document)}}),t.documentType,t.buildingName&&(null===(i=t.buildingName)||void 0===i?void 0:i.length)>0?(0,hn.jsx)("div",{children:p?(0,hn.jsxs)("div",{children:[g.buildingNames.map((e=>(0,hn.jsxs)(hn.Fragment,{children:[e,";",(0,hn.jsx)("br",{})]}))),t.buildingName.length>5&&(0,hn.jsx)(X.Link,{type:"hide",onClick:e=>{e.preventDefault(),h(!p)},text:(0,hn.jsx)(z.FormattedMessage,{id:"my_proceedings.link.view_less_building_names"})})]}):1===t.buildingName.length?t.buildingName:(0,hn.jsxs)("div",{children:[null===(a=g.buildingNames)||void 0===a?void 0:a.slice(0,4).map((e=>(0,hn.jsxs)(hn.Fragment,{children:[e,";",(0,hn.jsx)("br",{})]}))),null===(r=g.buildingNames)||void 0===r?void 0:r.slice(4,5),t.buildingName.length>5?" ...":"",t.buildingName.length>5&&(0,hn.jsx)("div",{className:"pr-3",children:(0,hn.jsx)(X.Link,{type:"show",onClick:e=>{e.preventDefault(),h(!p)},text:(0,hn.jsx)(z.FormattedMessage,{id:"my_proceedings.link.view_all_building_names"})})})]})}):"",t.ehrCode?(0,hn.jsx)("div",{children:c?(0,hn.jsxs)("div",{children:[g.ehrCodes.map((t=>(0,hn.jsxs)(hn.Fragment,{children:[(0,hn.jsx)(Sn,{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,hn.jsx)("br",{})]}))),t.ehrCode.length>5&&(0,hn.jsx)(X.Link,{type:"hide",onClick:e=>{e.preventDefault(),u(!c)},text:(0,hn.jsx)(z.FormattedMessage,{id:"my_proceedings.link.view_less_ehrCodes"})})]}):1===t.ehrCode.length?(0,hn.jsx)(Sn,{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,hn.jsxs)("div",{children:[g.ehrCodes.slice(0,4).map(((t,n)=>(0,hn.jsxs)(q.default.Fragment,{children:[(0,hn.jsx)(Sn,{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,hn.jsx)("br",{})]},n))),g.ehrCodes.slice(4,5).map((t=>(0,hn.jsx)(Sn,{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,hn.jsx)("div",{className:"pr-3",children:(0,hn.jsx)(X.Link,{type:"show",onClick:e=>{e.preventDefault(),u(!c)},text:(0,hn.jsx)(z.FormattedMessage,{id:"my_proceedings.link.view_all_ehrCodes"})})})]})}):"",t.address?(0,hn.jsx)("div",{style:{width:125},children:l?(0,hn.jsxs)("div",{children:[g.addresses.map((e=>(0,hn.jsxs)(hn.Fragment,{children:[e,";",(0,hn.jsx)("br",{})]}))),t.address.length>5&&(0,hn.jsx)(X.Link,{type:"hide",onClick:e=>{e.preventDefault(),d(!l)},text:(0,hn.jsx)(z.FormattedMessage,{id:"my_proceedings.link.view_less_addresses"})})]}):1===t.address.length?t.address:(0,hn.jsxs)("div",{children:[g.addresses.slice(0,4).map((e=>(0,hn.jsxs)(hn.Fragment,{children:[e,";",(0,hn.jsx)("br",{})]}))),null===(m=g.addresses)||void 0===m?void 0:m.slice(4,5),t.address.length>5?" ...":"",t.address.length>5&&(0,hn.jsx)("div",{className:"pr-3",children:(0,hn.jsx)(X.Link,{type:"show",onClick:e=>{e.preventDefault(),d(!l)},text:(0,hn.jsx)(z.FormattedMessage,{id:"my_proceedings.link.view_all_addresses"})})})]})}):"",t.proceedingName,t.supervisor,t.documentPresenter,t.archived,t.proceedingLength]},t.id)}))})(o),headers:f.map(((e,n)=>(0,hn.jsxs)("div",{children:[(0,hn.jsx)("a",{className:"link-gray",style:{paddingRight:"2px"},onClick:()=>{const e=jn(n,a);r(e)},children:a.column===n?(0,hn.jsx)(Cn,{sortDirection:a.direction}):(0,hn.jsx)(Cn,{sortDirection:An})}),t.formatMessage({id:e})]}))),paginationEnabled:!0,pager:{offset:n.offset,limit:n.limit,total:o.length},onPaginationReload:s}),(0,hn.jsx)(hn.Fragment,{children:e.isKov?(0,hn.jsx)("div",{className:"d-flex justify-content-start",children:(0,hn.jsx)(X.Checkbox,{name:"checkbox",onChange:t=>e.onAllUsersChecked(t),text:(0,hn.jsx)(X.Text,{raw:"my_proceedings.view_all_institution_proceedings"}),checked:e.isAllUsersChecked})}):null})]})},Cs={documentTypes:[],ehrCode:"",buildingName:"",wordInAddress:"",proceedingNumber:"",cadastralNumber:"",proceedingStates:["MENSEIS_ALGATATUD","MENSEIS_KAIMASOLEV"],connectedPerson:"",showProceedingInArchive:!1,supervisors:[],proceedingDate:{from:"",to:""},lastEventDate:""},Ls=e=>{let{onSubmit:t,isKov:n,filterState:s}=e;const o=(0,z.useIntl)(),i=/^[\\s0-9]{0,9}$/,a=/^([\\s0-9]{5}:[\\s0-9]{3}:[\\s0-9]{1,4}|[\\s0-9]{5}:[\\s0-9]{1,3}|[\\s0-9]{1,5})$/,[r,l]=(0,q.useState)(s),[d,c]=(0,q.useState)(!0),[u,p]=(0,q.useState)(!0),[h,m]=(0,q.useState)(""),[g,f]=(0,q.useState)(""),[S,I]=(0,q.useState)([]),[T,v]=(0,q.useState)([]),[E]=(0,q.useState)(Ns()),[_,y]=(0,q.useState)([]),[b,D]=(0,q.useState)(As()),x=(0,_n.useSelector)((e=>e.myViewsPage.filter.documentTypes)),M=(0,_n.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||a.test(n))&&p(!0),l((n=>({...n,[t]:e})))}(0,q.useEffect)((()=>{if(x){const e=ps(x);I(e)}if(M&&n){const e=hs([...M]);v(e)}}),[x,M]);return(0,hn.jsxs)(X.Form,{onSubmit:()=>t(r),children:[(0,hn.jsxs)(X.Row,{className:"align-items-start",children:[(0,hn.jsxs)(X.Col,{sm:10,className:"mx-0 px-0",children:[(0,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)(X.Multiselect,{name:"multiselect",options:S,onSelect:e=>O(e,"documentTypes"),allSelection:!0,onRemoveItem:e=>O(e,"documentTypes"),value:r.documentTypes,selectedOptions:_}),label:(0,hn.jsx)(z.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,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)(X.Input,{name:"input",onChange:e=>A(e,"proceedingNumber"),placeholder:o.formatMessage({id:"placeholder.writing"}),value:r.proceedingNumber}),label:(0,hn.jsx)(z.FormattedMessage,{id:"my_proceedings.filter.label.proceeding_number"}),labelCol:{sm:20,md:8,lg:8}}),(0,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)(X.Multiselect,{name:"multiselect",options:E,onSelect:e=>{O(e,"proceedingStates")},allSelection:!0,onRemoveItem:e=>O(e,"proceedingStates"),value:r.proceedingStates,selectedOptions:b}),label:(0,hn.jsx)(z.FormattedMessage,{id:"my_proceedings.filter.label.proceeding_state"}),labelCol:{sm:20,md:8,lg:8}}),cs(r.showProceedingInArchive,(function(e){l((t=>({...t,showProceedingInArchive:e})))}),"my_proceedings.filter.label.show_archived_proceedings"),(0,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)("div",{className:"daterange_in_form",children:(0,hn.jsx)(X.DateRange,{name:"daterange",onChange:e=>(e=>{""!==e.from&&!(0,yn.default)(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!(0,yn.default)(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:r.proceedingDate})}),errorMessage:h.length>0?h:null,label:(0,hn.jsx)(z.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,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)(X.DatePicker,{name:"datepicker-field",value:r.lastEventDate,onChange:e=>function(e){""===e||(0,yn.default)(e,"YYYY-MM-DD",!0).isValid()?f(""):f(o.formatMessage({id:"filter.invalid_date_format"})),l((t=>({...t,lastEventDate:e})))}(e)}),errorMessage:g.length>0?g:null,label:(0,hn.jsx)(z.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,hn.jsxs)(X.Col,{sm:10,className:"mx-0 px-0",children:[(0,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)(X.Input,{name:"input",onChange:e=>A(e,"ehrCode"),onBlur:e=>c(N(e.trim())),placeholder:o.formatMessage({id:"placeholder.writing"}),value:r.ehrCode}),errorMessage:!d&&(0,hn.jsx)(X.Text,{raw:"filter.invalid_building_code"}),label:(0,hn.jsx)(z.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,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)(X.Input,{name:"input",onChange:e=>A(e,"buildingName"),placeholder:o.formatMessage({id:"placeholder.writing"}),value:r.buildingName}),label:(0,hn.jsx)(z.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,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)(X.Input,{name:"input",onChange:e=>A(e,"wordInAddress"),placeholder:o.formatMessage({id:"placeholder.writing"}),value:r.wordInAddress}),label:(0,hn.jsx)(z.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,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)(X.Input,{name:"input",onChange:e=>A(e,"connectedPerson"),placeholder:o.formatMessage({id:"placeholder.writing"}),value:r.connectedPerson}),label:(0,hn.jsx)(z.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,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)(X.Multiselect,{name:"multiselect",options:T,onSelect:e=>O(e,"supervisors"),allSelection:!0,onRemoveItem:e=>O(e,"supervisors"),value:r.supervisors,selectedOptions:_}),label:(0,hn.jsx)(z.FormattedMessage,{id:"my_proceedings.filter.label.supervisor"}),labelCol:{sm:20,md:8,lg:8}})]})]}),(0,hn.jsxs)(X.Row,{children:[(0,hn.jsx)(X.Col,{children:(0,hn.jsx)(X.Button,{onClick:()=>(y([]),l(Cs),void D(As())),colourScheme:"light",squared:!0,children:(0,hn.jsx)(z.FormattedMessage,{id:"button.epmty_fields"})})}),(0,hn.jsx)(X.Col,{children:(0,hn.jsx)(X.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!(d&&u),squared:!0,children:(0,hn.jsx)(z.FormattedMessage,{id:"button.search"})})})]})]})},Ps={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 Rs=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 Ks(e){return Gn(Ps,e)}const Fs={[Rs.MENTOIMSEIS_OOTEL]:"info",[Rs.MENTOIMSEIS_TEOSTAMISEL]:"info",[Rs.MENTOIMSEIS_TYHISTATUD]:"default",[Rs.MENTOIMSEIS_TEOSTATUD]:"success",[Rs.MENTOIMSEIS_LOOBUTUD]:"default",[Rs.MENTOIMSEIS_TAHTAEG_MOODUNUD]:"default"},ks={[Rs.MENTOIMSEIS_OOTEL]:"my_operations.operation.state.idle",[Rs.MENTOIMSEIS_TEOSTAMISEL]:"my_operations.operation.state.in_process",[Rs.MENTOIMSEIS_TYHISTATUD]:"my_operations.operation.state.cancelled",[Rs.MENTOIMSEIS_TEOSTATUD]:"my_operations.operation.state.done",[Rs.MENTOIMSEIS_LOOBUTUD]:"my_operations.operation.state.abandoned",[Rs.MENTOIMSEIS_TAHTAEG_MOODUNUD]:"my_operations.operation.state.expired"};function Ys(e,t){return((e,t)=>({state:Object.keys(ks).includes(e)?t.formatMessage({id:ks[e]}):e,type:Object.keys(Fs).includes(e)?Fs[e]:"default"}))(Ks(e),t)}const Bs=(e,t)=>({code:e,value:t.formatMessage({id:ks[e]})});function Gs(e,t){let n;return n=e===oe?[Rs.MENTOIMSEIS_OOTEL,Rs.MENTOIMSEIS_TEOSTAMISEL,Rs.MENTOIMSEIS_TYHISTATUD,Rs.MENTOIMSEIS_TEOSTATUD,Rs.MENTOIMSEIS_LOOBUTUD,Rs.MENTOIMSEIS_TAHTAEG_MOODUNUD].map((e=>Bs(e,t))):e===re?[Rs.MENTOIMSEIS_OOTEL,Rs.MENTOIMSEIS_TEOSTAMISEL,Rs.MENTOIMSEIS_TYHISTATUD,Rs.MENTOIMSEIS_LOOBUTUD,Rs.MENTOIMSEIS_TAHTAEG_MOODUNUD].map((e=>Bs(e,t))):e===le?[Rs.MENTOIMSEIS_OOTEL,Rs.MENTOIMSEIS_TEOSTAMISEL,Rs.MENTOIMSEIS_TEOSTATUD,Rs.MENTOIMSEIS_LOOBUTUD].map((e=>Bs(e,t))):[Rs.MENTOIMSEIS_OOTEL,Rs.MENTOIMSEIS_TEOSTAMISEL,Rs.MENTOIMSEIS_TEOSTATUD,Rs.MENTOIMSEIS_LOOBUTUD,Rs.MENTOIMSEIS_TAHTAEG_MOODUNUD].map((e=>Bs(e,t))),function(e){return e.map((e=>({id:e.code+"",label:e.value,level:2,children:[],selectable:!0,value:!1})))}(n)}function Vs(){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 Hs(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(Ks(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((0,yn.default)(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((0,yn.default)(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((0,yn.default)(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((0,yn.default)(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((0,yn.default)(e.invitationDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n&&new Date((0,yn.default)(e.invitationDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()<=s))}return e}function Js(e){return[{id:Rs.MENTOIMSEIS_OOTEL},{id:Rs.MENTOIMSEIS_TEOSTAMISEL},{id:Rs.MENTOIMSEIS_TEOSTATUD},{id:Rs.MENTOIMSEIS_LOOBUTUD}].filter((t=>e.includes(t.id)))}let Ws=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"],qs=e=>{const t=(0,z.useIntl)(),[n,s]=(0,q.useState)({offset:0,limit:10}),[o,i]=(0,q.useState)([]),[a,r]=(0,q.useState)({column:1,direction:wn}),[l,d]=(0,q.useState)(!1),[c,u]=(0,q.useState)(!1),[p,h]=(0,q.useState)(!1),m=(0,_n.useSelector)((e=>e.myViewsPage.myOperations.myOperations)),g=(0,_n.useSelector)((e=>e.myViewsPage.myOperations.toCommentOperations)),f=(0,_n.useSelector)((e=>e.myViewsPage.myOperations.operationInvitations)),S=(0,_n.useSelector)((e=>e.myViewsPage.myProceedings.proceedingsToComment)),I=(0,_n.useSelector)((e=>e.myViewsPage.filter.institutions)),T=(0,_n.useSelector)((e=>e.myViewsPage.filter.documentTypes)),v=[e=>Bn(e.invitationDate)?new Date((0,yn.default)(e.invitationDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>Bn(e.deadline)?new Date((0,yn.default)(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&&Bn(e.buildingName[0])?e.buildingName[0]:"",e=>void 0!==e.ehrCode&&null!==e.ehrCode&&Bn(e.ehrCode[0])?e.ehrCode[0]:"",e=>void 0!==e.address&&null!==e.address&&Bn(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,q.useEffect)((()=>{!m||e.viewType!==se&&e.viewType!==ne||(i(Hs(m,e.filter)),s({offset:0,limit:10}))}),[m,e.filter]),(0,q.useEffect)((()=>{m&&e.viewType===oe&&(i(On(Hs(m,e.filter),v[0],wn)),s({offset:0,limit:10}))}),[m,e.filter]),(0,q.useEffect)((()=>{g&&e.viewType===ae&&(a.direction===An?i(Hs(g,e.filter)):i(On(Hs(g,e.filter),v[a.column],a.direction)),s({offset:0,limit:10}))}),[g,e.filter]),(0,q.useEffect)((()=>{f&&e.viewType===re&&(i(Hs(f,e.filter)),s({offset:0,limit:10}))}),[f,e.filter]),(0,q.useEffect)((()=>{S&&e.viewType===le&&(a.direction===An?i(Hs(S,e.filter)):i(On(Hs(S,e.filter),v[a.column],a.direction)))}),[S,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=>Bn(e.deadline)?new Date((0,yn.default)(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&&Bn(e.address[0])?e.address[0]:""];const b=t=>{let n=Ws.Operation;return e.viewType===le?(n=t.doty&&$s.includes(t.doty)?Ws.AdminProceeding:Ws.Proceeding,e.linkGen(!1,void 0,n,t.proceedingNr)):((t.doty&&$s.includes(t.doty)||t.typeCode===ge.MENTOIMLIIK_KAAS_TAGASISIDE)&&(n=Ws.AdminOperation),e.linkGen(!1,void 0,n,t.id))};return(0,hn.jsxs)(X.Section,{form:!0,children:[o&&(0,hn.jsx)(X.CollapseTable,{content:(s=>s.slice(n.offset,n.offset+n.limit).map((n=>{var s,o,i,a,r,m,g,f;const S=[n.invitationDate,(0,yn.default)(n.deadline,"DD.MM.YYYY").valueOf()<(0,yn.default)().valueOf()?(0,hn.jsx)("div",{className:"red-text",children:n.deadline}):n.deadline,(0,hn.jsx)(X.Tooltip,{content:(0,hn.jsx)(X.Text,{raw:"my_operations.tooltip.open_proceeding"}),placement:"bottom",theme:"dark",children:(0,hn.jsx)(X.Link,{text:n.proceedingNr,href:b(n)})},n.proceedingNr),n.stateCode?(0,hn.jsx)(X.Status,{type:Ys(n.stateCode,t).type,children:Ys(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,hn.jsx)("div",{children:p?(0,hn.jsxs)("div",{children:[n.buildingName.map(((e,t)=>(0,hn.jsxs)(q.default.Fragment,{children:[e,";",(0,hn.jsx)("br",{})]},t))),n.buildingName.length>5&&(0,hn.jsx)(X.Link,{type:"hide",onClick:e=>{e.preventDefault(),h(!p)},text:(0,hn.jsx)(z.FormattedMessage,{id:"my_operations.link.view_less_building_names"})})]}):1===n.buildingName.length?n.buildingName:(0,hn.jsxs)("div",{children:[null===(o=n.buildingName)||void 0===o?void 0:o.slice(0,4).map(((e,t)=>(0,hn.jsxs)(q.default.Fragment,{children:[e,";",(0,hn.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,hn.jsx)("div",{className:"pr-3",children:(0,hn.jsx)(X.Link,{type:"show",onClick:e=>{e.preventDefault(),h(!p)},text:(0,hn.jsx)(z.FormattedMessage,{id:"my_operations.link.view_all_building_names"})})})]})}):"",n.ehrCode?(0,hn.jsx)("div",{children:c?(0,hn.jsxs)("div",{children:[n.ehrCode.map(((t,n)=>(0,hn.jsxs)(q.default.Fragment,{children:[(0,hn.jsx)(Sn,{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,hn.jsx)("br",{})]},n))),n.ehrCode.length>5&&(0,hn.jsx)(X.Link,{type:"hide",onClick:e=>{e.preventDefault(),u(!c)},text:(0,hn.jsx)(z.FormattedMessage,{id:"my_operations.link.view_less_ehrCodes"})})]}):(0,hn.jsxs)("div",{children:[null===(a=n.ehrCode)||void 0===a?void 0:a.slice(0,4).map(((t,n)=>(0,hn.jsxs)(q.default.Fragment,{children:[(0,hn.jsx)(Sn,{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,hn.jsx)("br",{})]},n))),null===(r=n.ehrCode)||void 0===r?void 0:r.slice(4,5).map((t=>(0,hn.jsx)(Sn,{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,hn.jsx)("div",{className:"pr-3",children:(0,hn.jsx)(X.Link,{type:"show",onClick:e=>{e.preventDefault(),u(!c)},text:(0,hn.jsx)(z.FormattedMessage,{id:"my_operations.link.view_all_ehrCodes"})})})]})}):"",n.address?(0,hn.jsx)("div",{children:l?(0,hn.jsxs)("div",{children:[n.address.map(((e,t)=>(0,hn.jsxs)(q.default.Fragment,{children:[e,";",(0,hn.jsx)("br",{})]},t))),n.address.length>5&&(0,hn.jsx)(X.Link,{type:"hide",onClick:e=>{e.preventDefault(),d(!l)},text:(0,hn.jsx)(z.FormattedMessage,{id:"my_operations.link.view_less_addresses"})})]}):1===n.address.length?n.address:(0,hn.jsxs)("div",{children:[null===(m=n.address)||void 0===m?void 0:m.slice(0,4).map(((e,t)=>(0,hn.jsxs)(q.default.Fragment,{children:[e,";",(0,hn.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,hn.jsx)("div",{className:"pr-3",children:(0,hn.jsx)(X.Link,{type:"show",onClick:e=>{e.preventDefault(),d(!l)},text:(0,hn.jsx)(z.FormattedMessage,{id:"my_operations.link.view_all_addresses"})})})]})}):"",n.supervisorJurId?null===(f=I.find((e=>e.id===n.supervisorJurId)))||void 0===f?void 0:f.regName:"",n.supervisor],v=[...S];v.splice(4,1);const E=[...S].slice(1,4).concat(S[10]).concat(S[5]).concat(S[8]);return(0,hn.jsx)(X.CollapseTableRow,{fields:e.viewType===oe?v:e.viewType===le?E:S},n.id)})))(o),headers:function(){const n=[...E];n.splice(4,1);const s=e.viewType===oe?n:e.viewType===le?_:E,l=[...v];l.splice(4,1);const d=e.viewType===oe?l:e.viewType===le?y:v;return s.map(((e,n)=>(0,hn.jsxs)("div",{children:[(0,hn.jsx)("a",{className:"link-gray",style:{paddingRight:"2px"},onClick:()=>{const e=jn(n,a);r(e),e.direction!==An&&i(On(o,d[n],e.direction))},children:a.column===n?(0,hn.jsx)(Cn,{sortDirection:a.direction}):(0,hn.jsx)(Cn,{sortDirection:An})}),t.formatMessage({id:e})]})))}(),paginationEnabled:!0,pager:{offset:n.offset,limit:n.limit,total:o.length},onPaginationReload:s}),(e.viewType===ne||e.viewType===se)&&(0,hn.jsx)("div",{className:"d-flex justify-content-start",children:(0,hn.jsx)(X.Checkbox,{name:"checkbox",onChange:t=>e.onAllUsersChecked(t),text:e.viewType===ne?(0,hn.jsx)(X.Text,{raw:"my_approvals.view_all_institution_approvals"}):(0,hn.jsx)(X.Text,{raw:"my_opinions.view_all_institution_opinions"}),checked:e.isAllUsersChecked})})]})},zs=e=>{var t;const n=(0,z.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:""}},a={...i,operationStates:[Rs.MENTOIMSEIS_TEOSTAMISEL]},r={...i,operationStates:[Rs.MENTOIMSEIS_OOTEL,Rs.MENTOIMSEIS_TEOSTAMISEL,Rs.MENTOIMSEIS_JATKAMINE]},l={...i,operationStates:[Rs.MENTOIMSEIS_OOTEL]},[d,c]=(0,q.useState)(e.filterState),[u,p]=(0,q.useState)(Js(d.operationStates)),[h,m]=(0,q.useState)(!0),[g,f]=(0,q.useState)(!0),[S,I]=(0,q.useState)(""),[T,v]=(0,q.useState)(""),E=(0,q.useMemo)((()=>Vs()),[]),[_,y]=(0,q.useState)([]),[b,D]=(0,q.useState)([]),x=(0,q.useMemo)((()=>Gs(e.viewType,n)),[e.viewType]),[M,N]=(0,q.useState)([]),O=(0,_n.useSelector)((e=>e.myViewsPage.filter.institutionUsers)),A=(0,_n.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))&&f(!0),c((e=>({...e})))}(0,q.useEffect)((()=>{if(O){const e=hs(O?[...O]:[]);D(e)}if(A){const e=ms([...A]);y(e)}}),[O,A]);return(0,hn.jsxs)(X.Form,{onSubmit:()=>e.onSubmit(d),children:[(0,hn.jsx)(X.Row,{className:"align-items-start",children:(0,hn.jsx)(X.Col,{sm:10,className:"mx-0 px-0",children:(0,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)(X.Multiselect,{name:"multiselect",options:E,onSelect:e=>w(e,"documentTypes"),allSelection:!0,onRemoveItem:e=>w(e,"documentTypes"),value:d.documentTypes,selectedOptions:M}),label:(0,hn.jsx)(z.FormattedMessage,{id:"my_operations.filter.label.document_type"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})})}),(0,hn.jsx)(X.Row,{className:"align-items-start",children:(0,hn.jsx)(X.Col,{sm:10,className:"mx-0 px-0",children:(0,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)(X.Input,{name:"input",onChange:e=>j(e,"ehrCode"),onBlur:e=>f(U(e.trim())),placeholder:n.formatMessage({id:"placeholder.writing"}),value:d.ehrCode}),errorMessage:!h&&(0,hn.jsx)(X.Text,{raw:"filter.invalid_building_code"}),label:(0,hn.jsx)(z.FormattedMessage,{id:"my_operations.filter.label.ehrCode"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})})}),(0,hn.jsxs)(X.Row,{className:"align-items-start",children:[(0,hn.jsxs)(X.Col,{sm:10,className:"mx-0 px-0",children:[(0,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)(X.Multiselect,{name:"multiselect",options:_,onSelect:e=>w(e,"institutions"),allSelection:!0,onRemoveItem:e=>w(e,"institutions"),value:d.institutions,selectedOptions:M}),label:(0,hn.jsx)(z.FormattedMessage,{id:"my_operations.filter.label.institution"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)(X.Input,{name:"input",onChange:e=>j(e,"proceedingNumber"),placeholder:n.formatMessage({id:"placeholder.writing"}),value:d.proceedingNumber}),label:(0,hn.jsx)(z.FormattedMessage,{id:"my_operations.filter.label.proceeding_number"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)(X.Multiselect,{name:"multiselect",options:x,onSelect:e=>w(e,"operationStates"),allSelection:!0,onRemoveItem:e=>w(e,"operationStates"),value:d.operationStates,selectedOptions:u}),label:(0,hn.jsx)(z.FormattedMessage,{id:"my_operations.filter.label.operation_state"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)(gs,{onChange:e=>(e=>{""!==e.from&&!(0,yn.default)(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!(0,yn.default)(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:S.length>0?S:null,label:(0,hn.jsx)(z.FormattedMessage,{id:"my_operations.filter.label.operation_date"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})]}),(0,hn.jsxs)(X.Col,{sm:10,className:"mx-0 px-0",children:[(0,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)(X.Input,{name:"input",onChange:e=>j(e,"wordInAddress"),placeholder:n.formatMessage({id:"placeholder.writing"}),value:d.wordInAddress}),label:(0,hn.jsx)(z.FormattedMessage,{id:"my_operations.filter.label.word_in_address"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)(X.Multiselect,{name:"multiselect",options:b,onSelect:e=>w(e,"institutionUsers"),allSelection:!0,onRemoveItem:e=>w(e,"institutionUsers"),value:d.institutionUsers,selectedOptions:M}),label:(0,hn.jsx)(z.FormattedMessage,{id:"my_operations.filter.label.institution_users"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)(gs,{onChange:e=>(e=>{""!==e.from&&!(0,yn.default)(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!(0,yn.default)(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,hn.jsx)(z.FormattedMessage,{id:"my_operations.filter.label.operation_deadline"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})]})]}),(0,hn.jsxs)(X.Row,{children:[(0,hn.jsx)(X.Col,{children:(0,hn.jsx)(X.Button,{onClick:()=>function(){let t;switch(N([]),e.viewType){case ie:t=a;break;case ae:case le:t=r;break;case re:t=l;break;default:t=i}c(t),p(Js(t.operationStates))}(),colourScheme:"light",squared:!0,children:(0,hn.jsx)(z.FormattedMessage,{id:"button.epmty_fields"})})}),(0,hn.jsx)(X.Col,{children:(0,hn.jsx)(X.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!(h&&g),squared:!0,children:(0,hn.jsx)(z.FormattedMessage,{id:"button.search"})})})]})]})},Xs=e=>{var t,n,s,o;let{classifierApiEndpoint:i,fileUploadApiEndpoint:a,linkGen:r,myViewsApiEndpoint:l,userInfo:d,userApiEndpoint:c}=e;const u=(0,_n.useDispatch)(),[p,h]=(0,q.useState)({proceedings:!1}),[f,S]=(0,q.useState)(!0),[I,T]=(0,q.useState)(!0),[v,E]=(0,q.useState)(!0),[_,y]=(0,q.useState)([]),[b,D]=(0,q.useState)([]),[x,A]=(0,q.useState)([]),U=new Re(new yt({basePath:i})),w=new nt(new yt({basePath:c})),j=new _t(new yt({basePath:l})),C=new ft(new yt({basePath:l})),L=new vt(new yt({basePath:l})),P=new qt(new zt({basePath:a})),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,q.useState)({documentTypes:[],ehrCode:"",buildingName:"",wordInAddress:"",proceedingNumber:"",cadastralNumber:"",proceedingStates:["MENSEIS_ALGATATUD","MENSEIS_KAIMASOLEV"],connectedPerson:"",showProceedingInArchive:!1,supervisors:[],proceedingDate:{from:"",to:""},lastEventDate:""}),[B,G]=(0,q.useState)(F),[V,H]=(0,q.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","11274","11275"],states:[Pn.DO_DOKUSEIS_ESITATUD,Pn.DO_DOKUSEIS_MENETLUSES]};return(0,q.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:[ge.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,q.useEffect)((()=>{(()=>{const e=J;p.proceedings&&(e.userId=void 0),S(!0),j.findProceedings(e).then((e=>{u(M(e.data)),y(e.data),S(!1)})).catch((e=>{console.log("Following error occured:",e),S(!1)}))})()}),[p.proceedings]),(0,q.useEffect)((()=>{!function(){const e=J;e.userId=void 0,E(!0),C.findIncomingBaseDocuments(e).then((e=>{u(O(e.data)),E(!1),A(e.data)})).catch((e=>{console.log("Following error occured:",e),E(!1)}))}()}),[d]),(0,q.useEffect)((()=>{var e,t;U.getAllDocumentTypes().then((e=>{u(m(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(g(e.data))})).catch((e=>{console.log(e)}))}),[d]),(0,hn.jsxs)("div",{children:[(0,hn.jsx)(X.Section,{collapsed:!1,title:"my_proceedings.my_proceedings",showSettings:!0,filterContents:(0,hn.jsx)(Ls,{onSubmit:e=>{Y(e)},isKov:R,filterState:k}),children:f?(0,hn.jsx)(X.SectionLoader,{}):0===_.length?(0,hn.jsxs)("div",{children:[(0,hn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,hn.jsx)(X.Text,{raw:"my_proceedings.no_proceedings"})}),R&&(0,hn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,hn.jsx)(X.Link,{text:"my_proceedings.view_all_institution_proceedings",onClick:()=>{h({proceedings:!0})}})})]}):(0,hn.jsx)(js,{linkGen:r,isKov:R,onAllUsersChecked:e=>{h({proceedings:e})},isAllUsersChecked:p.proceedings,filter:k})}),R&&(0,hn.jsx)(X.Section,{collapsed:!1,title:"my_proceedings.section_title.proceedings_to_comment",showSettings:!0,filterContents:(0,hn.jsx)(zs,{viewType:le,initialFilter:F,filterState:B,onSubmit:e=>G(e)}),children:I?(0,hn.jsx)(X.SectionLoader,{}):0===b.length?(0,hn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,hn.jsx)(X.Text,{raw:"my_proceedings.proceedings_to_comment.no_proceedings"})}):(0,hn.jsx)(qs,{linkGen:r,viewType:le,filter:B})}),R&&(0,hn.jsx)(X.Section,{collapsed:!1,title:"my_documents.incoming_documents",showSettings:!0,filterContents:(0,hn.jsx)(fs,{documentType:te,filterState:V,onSubmit:e=>H(e),isKov:R}),children:v?(0,hn.jsx)(X.SectionLoader,{}):0===x.length?(0,hn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,hn.jsx)(X.Text,{raw:"my_documents.incoming_documents.no_docs"})}):(0,hn.jsx)(ls,{linkGen:r,userInfo:d,documentType:te,filter:V,fileApi:P})})]})},Qs=e=>{let{classifierApiEndpoint:t,linkGen:n,myViewsApiEndpoint:s,userApiEndpoint:o,userInfo:{activeRole:i}}=e;const a=(0,_n.useDispatch)(),[r,l]=(0,q.useState)(!0),[d,c]=(0,q.useState)(!1),[u,p]=(0,q.useState)(!1),[h,S]=(0,q.useState)(null),[I,T]=(0,q.useState)(null),[v,E]=(0,q.useState)(null),_={documentTypes:[],ehrCode:"",institutions:[],wordInAddress:"",proceedingNumber:"",cadastralNumber:"",operationStates:[],institutionUsers:[],operationDate:{from:"",to:""},operationDeadline:{from:"",to:""}},y={..._,operationStates:[Rs.MENTOIMSEIS_TEOSTAMISEL]},b={..._,operationStates:[Rs.MENTOIMSEIS_OOTEL,Rs.MENTOIMSEIS_TEOSTAMISEL,Rs.MENTOIMSEIS_JATKAMINE]},D={..._,operationStates:[Rs.MENTOIMSEIS_OOTEL]},[x,M]=(0,q.useState)(y),[N,O]=(0,q.useState)(b),[A,U]=(0,q.useState)(D),[L,P]=(0,q.useState)(!1),R=new ze(new yt({basePath:o})),K=new nt(new yt({basePath:o})),F=new vt(new yt({basePath:s})),k=new Re(new yt({basePath:t}));return(0,q.useEffect)((()=>{var e;R.getJurKovPersons().then((e=>{a(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=>{a(g(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)})),k.getAllDocumentTypes().then((e=>{a(m(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)}))}),[]),(0,q.useEffect)((()=>{!function(){const e={userId:null==i?void 0:i.userId,personId:null==i?void 0:i.businessId,type:[ge.MENTOIMLIIK_VALINE_KOOSK],states:Ps.MENTOIMSEIS_TEOSTAMISEL.concat(Ps.MENTOIMSEIS_TEOSTATUD,Ps.MENTOIMSEIS_LOOBUTUD,Ps.MENTOIMSEIS_TAHTAEG_MOODUNUD)};L&&(e.userId=void 0),l(!0),F.findOperations(e).then((e=>{a(w(e.data)),S(e.data),l(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),l(!1)}))}()}),[L]),(0,q.useEffect)((()=>{c(!0),F.findOperationsToComment({userId:null==i?void 0:i.userId,type:[ge.MENTOIMLIIK_VALINE_KOOSK],states:Ps.MENTOIMSEIS_TEOSTAMISEL.concat(Ps.MENTOIMSEIS_TEOSTATUD,Ps.MENTOIMSEIS_LOOBUTUD,Ps.MENTOIMSEIS_TAHTAEG_MOODUNUD)}).then((e=>{a(j(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:[ge.MENTOIMLIIK_VALINE_KOOSK],states:Ps.MENTOIMSEIS_OOTEL.concat(Ps.MENTOIMSEIS_TEOSTAMISEL,Ps.MENTOIMSEIS_TYHISTATUD,Ps.MENTOIMSEIS_LOOBUTUD,Ps.MENTOIMSEIS_TAHTAEG_MOODUNUD)}).then((e=>{a(C(e.data)),E(e.data),p(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),p(!1)}))}),[]),(0,hn.jsxs)("div",{children:[(0,hn.jsxs)(X.Section,{collapsed:!1,title:"my_approvals.my_approvals",showSettings:!0,filterContents:(0,hn.jsx)(zs,{viewType:ie,filterState:x,onSubmit:e=>M(e)}),children:[r&&(0,hn.jsx)(X.SectionLoader,{}),r||h?(0,hn.jsx)(qs,{linkGen:n,viewType:ne,filter:x,isAllUsersChecked:L,onAllUsersChecked:e=>{P(e)}}):(0,hn.jsxs)("div",{children:[(0,hn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,hn.jsx)(X.Text,{raw:"my_approvals.no_approvals"})}),(0,hn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,hn.jsx)(X.Link,{text:"my_approvals.view_all_institution_approvals",onClick:()=>{P(!0)}})})]})]}),(0,hn.jsxs)(X.Section,{collapsed:!1,title:"my_approvals.approvals_to_comment",showSettings:!0,filterContents:(0,hn.jsx)(zs,{viewType:ae,filterState:N,onSubmit:e=>O(e)}),children:[d&&(0,hn.jsx)(X.SectionLoader,{}),d||I?(0,hn.jsx)(qs,{linkGen:n,viewType:ae,filter:N}):(0,hn.jsx)("div",{children:(0,hn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,hn.jsx)(X.Text,{raw:"my_approvals.no_approvals_to_comment"})})})]}),(0,hn.jsxs)(X.Section,{collapsed:!1,title:"my_approvals.approval_invitations",showSettings:!0,filterContents:(0,hn.jsx)(zs,{viewType:re,filterState:A,onSubmit:e=>U(e)}),children:[u&&(0,hn.jsx)(X.SectionLoader,{}),u||v?(0,hn.jsx)(qs,{linkGen:n,viewType:re,filter:A}):(0,hn.jsx)("div",{children:(0,hn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,hn.jsx)(X.Text,{raw:"my_approvals.no_approval_invitations"})})})]})]})},Zs=e=>{let{classifierApiEndpoint:t,linkGen:n,myViewsApiEndpoint:s,userApiEndpoint:o,userInfo:{activeRole:i}}=e;const a=(0,_n.useDispatch)(),[r,l]=(0,q.useState)(!1),[d,c]=(0,q.useState)(!1),[u,p]=(0,q.useState)(!1),[h,S]=(0,q.useState)(null),[I,T]=(0,q.useState)(null),[v,E]=(0,q.useState)(null),_={documentTypes:[],ehrCode:"",institutions:[],wordInAddress:"",proceedingNumber:"",cadastralNumber:"",operationStates:[],institutionUsers:[],operationDate:{from:"",to:""},operationDeadline:{from:"",to:""}},y={..._,operationStates:[Rs.MENTOIMSEIS_TEOSTAMISEL]},b={..._,operationStates:[Rs.MENTOIMSEIS_OOTEL,Rs.MENTOIMSEIS_TEOSTAMISEL,Rs.MENTOIMSEIS_JATKAMINE]},D={..._,operationStates:[Rs.MENTOIMSEIS_OOTEL]},[x,M]=(0,q.useState)(y),[N,O]=(0,q.useState)(b),[A,U]=(0,q.useState)(D),[L,P]=(0,q.useState)(!1),R=new ze(new yt({basePath:o})),K=new nt(new yt({basePath:o})),F=new vt(new yt({basePath:s})),k=new Re(new yt({basePath:t}));return(0,q.useEffect)((()=>{var e;R.getJurKovPersons().then((e=>{a(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=>{a(g(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)})),k.getAllDocumentTypes().then((e=>{a(m(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)}))}),[]),(0,q.useEffect)((()=>{!function(){const e=L?null==i?void 0:i.businessId:null==i?void 0:i.userId;l(!0),F.findOperations({personId:L?e:void 0,userId:L?void 0:e,type:[ge.MENTOIMLIIK_ARVAMUS],states:Ps.MENTOIMSEIS_TEOSTAMISEL.concat(Ps.MENTOIMSEIS_TEOSTATUD,Ps.MENTOIMSEIS_LOOBUTUD,Ps.MENTOIMSEIS_TAHTAEG_MOODUNUD)}).then((e=>{a(w(e.data)),S(e.data),l(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),l(!1)}))}()}),[L]),(0,q.useEffect)((()=>{c(!0),F.findOperationsToComment({userId:null==i?void 0:i.userId,type:[ge.MENTOIMLIIK_ARVAMUS],states:Ps.MENTOIMSEIS_TEOSTAMISEL.concat(Ps.MENTOIMSEIS_TEOSTATUD,Ps.MENTOIMSEIS_LOOBUTUD,Ps.MENTOIMSEIS_TAHTAEG_MOODUNUD)}).then((e=>{a(j(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:[ge.MENTOIMLIIK_ARVAMUS],states:Ps.MENTOIMSEIS_OOTEL.concat(Ps.MENTOIMSEIS_TEOSTAMISEL,Ps.MENTOIMSEIS_TYHISTATUD,Ps.MENTOIMSEIS_LOOBUTUD,Ps.MENTOIMSEIS_TAHTAEG_MOODUNUD)}).then((e=>{a(C(e.data)),E(e.data),p(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),p(!1)}))}),[]),(0,hn.jsxs)("div",{children:[(0,hn.jsxs)(X.Section,{collapsed:!1,title:"my_opinions.my_opinions",showSettings:!0,filterContents:(0,hn.jsx)(zs,{viewType:ie,filterState:x,onSubmit:e=>M(e)}),children:[r&&(0,hn.jsx)(X.SectionLoader,{}),r||h?(0,hn.jsx)(qs,{linkGen:n,viewType:se,filter:x,isAllUsersChecked:L,onAllUsersChecked:e=>{P(e)}}):(0,hn.jsxs)("div",{children:[(0,hn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,hn.jsx)(X.Text,{raw:"my_opinions.no_opinions"})}),(0,hn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,hn.jsx)(X.Link,{text:"my_opinions.view_all_institution_opinions",onClick:()=>{P(!0)}})})]})]}),(0,hn.jsxs)(X.Section,{collapsed:!1,title:"my_opinions.opinions_to_comment",showSettings:!0,filterContents:(0,hn.jsx)(zs,{viewType:ae,filterState:N,onSubmit:e=>O(e)}),children:[d&&(0,hn.jsx)(X.SectionLoader,{}),d||I?(0,hn.jsx)(qs,{linkGen:n,viewType:ae,filter:N}):(0,hn.jsx)("div",{children:(0,hn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,hn.jsx)(X.Text,{raw:"my_opinions.no_opinions_to_comment"})})})]}),(0,hn.jsxs)(X.Section,{collapsed:!1,title:"my_opinions.opinion_invitations",showSettings:!0,filterContents:(0,hn.jsx)(zs,{viewType:re,filterState:A,onSubmit:e=>U(e)}),children:[u&&(0,hn.jsx)(X.SectionLoader,{}),u||v?(0,hn.jsx)(qs,{linkGen:n,viewType:re,filter:A}):(0,hn.jsx)("div",{children:(0,hn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,hn.jsx)(X.Text,{raw:"my_opinions.no_opinion_invitations"})})})]})]})},eo=e=>{const t=(0,z.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:[Rs.MENTOIMSEIS_OOTEL,Rs.MENTOIMSEIS_TEOSTAMISEL,Rs.MENTOIMSEIS_TEOSTATUD,Rs.MENTOIMSEIS_LOOBUTUD],operationDate:{from:"",to:""},operationDeadline:{from:"",to:""}},[i,a]=(0,q.useState)(e.filterState),[r,l]=(0,q.useState)(Js(i.operationStates)),[d,c]=(0,q.useState)(!0),[u,p]=(0,q.useState)(!0),[h,m]=(0,q.useState)(""),g=(0,q.useMemo)((()=>Vs()),[]),[f,S]=(0,q.useState)([]),I=(0,q.useMemo)((()=>Gs(oe,t)),[]),[T,v]=(0,q.useState)([]),E=(0,_n.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,a((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),a((e=>({...e})))}(0,q.useEffect)((()=>{if(E){const e=ms([...E]);S(e)}}),[E]);return(0,hn.jsxs)(X.Form,{onSubmit:()=>e.onSubmit(i),children:[(0,hn.jsxs)(X.Row,{children:[(0,hn.jsx)(X.Col,{children:(0,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)(X.Multiselect,{name:"multiselect",options:g,onSelect:e=>y(e,"documentTypes"),allSelection:!0,onRemoveItem:e=>y(e,"documentTypes"),value:i.documentTypes,selectedOptions:T}),label:(0,hn.jsx)(z.FormattedMessage,{id:"my_operations.filter.label.document_type"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,hn.jsx)(X.Col,{})]}),(0,hn.jsxs)(X.Row,{children:[(0,hn.jsx)(X.Col,{children:(0,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)(X.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,hn.jsx)(X.Text,{raw:"filter.invalid_building_code"}),label:(0,hn.jsx)(z.FormattedMessage,{id:"my_operations.filter.label.ehrCode"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,hn.jsx)(X.Col,{children:(0,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)(X.Input,{name:"input",onChange:e=>b(e,"wordInAddress"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.wordInAddress}),label:(0,hn.jsx)(z.FormattedMessage,{id:"my_operations.filter.label.word_in_address"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})})]}),(0,hn.jsxs)(X.Row,{children:[(0,hn.jsx)(X.Col,{children:(0,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)(X.Multiselect,{name:"multiselect",options:f,onSelect:e=>y(e,"institutions"),allSelection:!0,onRemoveItem:e=>y(e,"institutions"),value:i.institutions,selectedOptions:T}),label:(0,hn.jsx)(z.FormattedMessage,{id:"my_operations.filter.label.institution"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,hn.jsx)(X.Col,{})]}),(0,hn.jsxs)(X.Row,{children:[(0,hn.jsx)(X.Col,{children:(0,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)(X.Input,{name:"input",onChange:e=>b(e,"proceedingNumber"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.proceedingNumber}),label:(0,hn.jsx)(z.FormattedMessage,{id:"my_operations.filter.label.proceeding_number"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,hn.jsx)(X.Col,{children:(0,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)(X.Multiselect,{name:"multiselect",options:I,onSelect:e=>y(e,"operationStates"),allSelection:!0,onRemoveItem:e=>y(e,"operationStates"),value:i.operationStates,selectedOptions:r}),label:(0,hn.jsx)(z.FormattedMessage,{id:"my_involvements.filter.label.involvement_state"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})})]}),(0,hn.jsxs)(X.Row,{children:[(0,hn.jsx)(X.Col,{children:(0,hn.jsx)(X.FieldWrapper,{component:(0,hn.jsx)(gs,{onChange:e=>(e=>{""!==e.from&&!(0,yn.default)(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!(0,yn.default)(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(""),a((t=>({...t,operationDate:e})))})(e),value:i.operationDate}),errorMessage:h.length>0?h:null,label:(0,hn.jsx)(z.FormattedMessage,{id:"my_involvements.filter.label.involvement_date"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,hn.jsx)(X.Col,{})]}),(0,hn.jsxs)(X.Row,{children:[(0,hn.jsx)(X.Col,{children:(0,hn.jsx)(X.Button,{onClick:()=>(v([]),a(o),void l(Js(o.operationStates))),colourScheme:"light",squared:!0,children:(0,hn.jsx)(z.FormattedMessage,{id:"button.epmty_fields"})})}),(0,hn.jsx)(X.Col,{children:(0,hn.jsx)(X.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!(d&&u),squared:!0,children:(0,hn.jsx)(z.FormattedMessage,{id:"button.search"})})})]})]})},to=e=>{var t;let{classifierApiEndpoint:n,linkGen:s,myViewsApiEndpoint:o,userInfo:i,userApiEndpoint:a}=e;const r=(0,_n.useDispatch)(),[l,d]=(0,q.useState)(!1),[c,u]=(0,q.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:[Rs.MENTOIMSEIS_OOTEL,Rs.MENTOIMSEIS_TEOSTAMISEL,Rs.MENTOIMSEIS_TEOSTATUD,Rs.MENTOIMSEIS_LOOBUTUD],operationDate:{from:"",to:""},operationDeadline:{from:"",to:""}},[g,S]=(0,q.useState)(h),I=new ze(new yt({basePath:a})),T=new vt(new yt({basePath:o})),v=new Re(new yt({basePath:n}));return(0,q.useEffect)((()=>{var e;I.getJurKovPersons().then((e=>{r(f(e.data))})).catch((e=>{console.log(e)})),v.getAllDocumentTypes().then((e=>{r(m(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:[ge.MENTOIMLIIK_KAASAMINE,ge.MENTOIMLIIK_KAAS_TAGASISIDE],states:[Rs.MENTOIMSEIS_OOTEL,Rs.MENTOIMSEIS_TEOSTAMISEL,Rs.MENTOIMSEIS_TEOSTATUD,Rs.MENTOIMSEIS_VALMIS,Rs.MENTOIMSEIS_JATKAMINE,Rs.MENTOIMSEIS_TYHISTATUD,Rs.MENTOIMSEIS_LOOBUTUD,Rs.MENTOIMSEIS_KEELDUTUD,Rs.MENTOIMSEIS_TAGASI_LYKATUD,Rs.MENTOIMSEIS_TAHTAEG_MOODUNUD]}).then((e=>{r(w(e.data)),u(e.data),d(!1)})).catch((e=>{console.log("Following error occured:",e),d(!1)}))}),[i]),(0,hn.jsx)("div",{children:(0,hn.jsx)(X.Section,{collapsed:!1,title:"my_involvements.my_involvements",showSettings:!0,filterContents:(0,hn.jsx)(eo,{filterState:g,onSubmit:e=>S(e)}),children:l?(0,hn.jsx)(X.SectionLoader,{}):0===c.length?(0,hn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,hn.jsx)(X.Text,{raw:"my_involvements.no_involvements"})}):(0,hn.jsx)(qs,{linkGen:s,viewType:oe,filter:g})})})};function no(e){return e.map((e=>({id:e.code+"",label:e.value,level:2,children:[],selectable:!0,value:!1})))}function so(e){let t=no([{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 oo=[{code:"EHITIS_OMANDI_LIIK_KINNIS",value:"Kinnisasi"},{code:"EHITIS_OMANDI_LIIK_VALLAS",value:"Vallasasi"},{code:"EHITIS_OMANDI_LIIK_VALLASRO",value:"Reaalosa kui vallasasi"}];function io(){return no(oo)}function ao(e){let t=[];for(let n of e)t.push(n.id),t.push(...ao(n.children?n.children:[]));return t}const ro=e=>{const t=(0,z.useIntl)(),n={buildingLocation:"",buildingName:"",buildingStates:[],firstUseDate:{from:"",to:""},firstUseMissing:!1,buildingType:[],purposeOfUse:[],ownershipType:[],owner:void 0,isPrivatePerson:!1,searchType:de},s=(0,_n.useSelector)((e=>e.myViewsPage.filter.usageClassifierTypes)),o=(0,_n.useSelector)((e=>e.myViewsPage.detailSearch.buildings)),[i,a]=(0,q.useState)(n),[r,l]=(0,q.useState)([]),[d,c]=(0,q.useState)(so(e.isAdminRole)),[u]=(0,q.useState)(no([{code:"H",value:"Hoone"},{code:"R",value:"Rajatis"}])),[p]=(0,q.useState)(io()),[h,m]=(0,q.useState)([]),[g,f]=(0,q.useState)({}),[S,I]=(0,q.useState)(""),[T,v]=(0,q.useState)({}),[E,_]=(0,q.useState)(""),[y,b]=(0,q.useState)(!1),[D,x]=(0,q.useState)({code:"",value:""}),M=(0,q.useRef)(),[N,O]=(0,q.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,a((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,a((e=>({...e})))}function w(e,t){i[t]=e,a((e=>({...e})))}(0,q.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,""),a=i.slice(0,i.length-1),r=t;for(let e=2;e<=a.length;e++)if(r.children){let t=r.children.find((t=>t.id.replace(/0/g,"")===a.slice(0,e)));t&&(r=t)}if(r.children){const t=`${e} ${s}${null!=o&&o.trim()?` (kuni ${o})`:""}`;r.children.push({id:n.id+"",parentId:r.id,label:t,level:r.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,q.useEffect)((()=>{c(so(e.isAdminRole))}),[e.isAdminRole]);const j={sm:20,md:8,lg:8};return(0,hn.jsxs)(X.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,hn.jsx)(X.MessageBlock,{dismissible:!0,header:(0,hn.jsx)(z.FormattedMessage,{id:T.header}),onDismiss:()=>v({header:"",message:""}),theme:"danger",messages:[(0,hn.jsx)(z.FormattedMessage,{id:T.message})]}),o&&o.length>=500&&(0,hn.jsx)(X.MessageBlock,{dismissible:!0,header:(0,hn.jsx)(z.FormattedMessage,{id:"detailsearch.empty_filter_error.header"}),theme:"warning",messages:[(0,hn.jsx)(z.FormattedMessage,{id:"detailsearch.filter_error_message.more_than_500_results"})]}),(0,hn.jsxs)(X.Row,{className:"align-items-start",children:[(0,hn.jsxs)(X.Col,{xs:20,md:20,lg:10,className:"px-0",children:[(0,hn.jsx)(X.FieldWrapper,{labelCol:j,component:(0,hn.jsx)(X.Input,{name:"input",onChange:e=>w(e,"buildingLocation"),placeholder:t.formatMessage({id:"detailssearch.filter.placeholder.address"}),value:i.buildingLocation}),label:(0,hn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.building_location"}),info:{content:"detailsearch.filter.tooltip.building_location",placement:"top-start"}}),(0,hn.jsx)(X.FieldWrapper,{labelCol:j,component:(0,hn.jsx)(X.Input,{name:"input",onChange:e=>w(e,"buildingName"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.buildingName}),label:(0,hn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.building_name"}),info:{content:"detailsearch.filter.tooltip.building_name",placement:"top-start"}}),(0,hn.jsx)(X.FieldWrapper,{labelCol:j,component:(0,hn.jsx)(X.Multiselect,{name:"multiselect",options:d,onSelect:e=>A(e,"buildingStates"),allSelection:!0,onRemoveItem:e=>A(e,"buildingStates"),value:i.buildingStates,selectedOptions:r}),label:(0,hn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.building_state"}),info:{content:"detailsearch.filter.tooltip.building_state",placement:"top-start"}}),(0,hn.jsx)(X.FieldWrapper,{labelCol:j,component:(0,hn.jsx)("div",{className:"daterange_in_form",children:(0,hn.jsx)(X.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:"";a((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:S,label:(0,hn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.first_use"}),info:{content:"detailsearch.filter.tooltip.first_use",placement:"top-start"}}),(0,hn.jsx)(hn.Fragment,{children:cs(i.firstUseMissing,(function(e){a((t=>({...t,firstUseMissing:e})))}),"detailsearch.filter.label.checkbox.first_use_missing","detailsearch.filter.tooltip.checkbox.first_use_missing",j)})]}),(0,hn.jsxs)(X.Col,{xs:20,md:20,lg:10,className:"px-0",children:[(0,hn.jsx)(X.FieldWrapper,{labelCol:j,component:(0,hn.jsx)(X.Multiselect,{name:"multiselect",options:u,onSelect:e=>A(e,"buildingType"),allSelection:!0,onRemoveItem:e=>A(e,"buildingType"),value:i.buildingType,selectedOptions:r}),label:(0,hn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.building_type"}),info:{content:"detailsearch.filter.tooltip.building_type",placement:"top-start"}}),(0,hn.jsx)(X.FieldWrapper,{labelCol:j,component:(0,hn.jsx)(X.Multiselect,{name:"multiselect",options:h,onSelect:e=>U(e,"purposeOfUse"),allSelection:!0,onRemoveItem:e=>U(e,"purposeOfUse"),value:i.purposeOfUse,selectedOptions:r,isSearchExactMatch:!0}),label:(0,hn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.purpose_of_use"}),info:{content:"detailsearch.filter.tooltip.purpose_of_use",placement:"top-start"}}),(0,hn.jsx)(X.FieldWrapper,{labelCol:j,component:(0,hn.jsx)(X.Multiselect,{name:"multiselect",options:p,onSelect:e=>A(e,"ownershipType"),allSelection:!0,onRemoveItem:e=>A(e,"ownershipType"),value:i.ownershipType,selectedOptions:r}),label:(0,hn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.ownershiptype"}),info:{content:"detailsearch.filter.tooltip.ownershiptype",placement:"top-start"}})]}),e.isAdminPlusRole&&(0,hn.jsx)(hn.Fragment,{children:(0,hn.jsxs)(X.Row,{className:"align-items-center w-100",children:[(0,hn.jsx)(X.Col,{xs:20,md:20,lg:10,className:"px-0",children:(0,hn.jsx)(X.FieldWrapper,{labelCol:j,component:(0,hn.jsx)(X.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(f(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(),a((e=>({...e})));else if(e||E.substring(4)!==(null===(n=N.id)||void 0===n?void 0:n.toString()))e||(i.owner=void 0,a((e=>({...e}))));else{var o;i.owner=null===(o=N.id)||void 0===o?void 0:o.toString(),a((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,hn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.owner"}),info:{content:"detailsearch.filter.tooltip.owner.extended",placement:"top-start"}})}),(0,hn.jsx)(X.Col,{xs:20,md:20,lg:10,children:cs(i.isPrivatePerson,(function(e){a((t=>({...t,isPrivatePerson:e})))}),"detailsearch.filter.label.checkbox.owner.private","",{xs:20,md:1})})]})})]}),(0,hn.jsxs)(X.Row,{children:[(0,hn.jsx)(X.Col,{children:(0,hn.jsx)(X.Button,{onClick:()=>(l([]),a(n),M.current.clearTypeahead(),void f({})),colourScheme:"light",squared:!0,children:(0,hn.jsx)(z.FormattedMessage,{id:"button.epmty_fields"})})}),(0,hn.jsx)(X.Col,{children:(0,hn.jsx)(X.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!!(S.length>0||y),squared:!0,children:(0,hn.jsx)(z.FormattedMessage,{id:"button.search"})})})]})]})},lo=e=>{const t=(0,z.useIntl)(),n={buildingLocation:"",buildingName:"",institutions:[],documentDate:{from:"",to:""},documentType:[],documentNr:"",documentState:[],connectedPerson:void 0},[s,o]=(0,q.useState)(n),[i,a]=(0,q.useState)(""),[r,l]=(0,q.useState)([]),[d,c]=(0,q.useState)([]),[u,p]=(0,q.useState)([]),[h]=(0,q.useState)(no([{code:Pn.DO_DOKUSEIS_ESITATUD,value:"Esitatud"},{code:Pn.DO_DOKUSEIS_KOOSTAMISEL,value:"Koostamisel"},{code:Pn.DO_DOKUSEIS_MENETLUSES,value:"Menetluses"},{code:Pn.DO_DOKUSEIS_MUUTMISEL,value:"Muutmisel"},{code:Pn.DO_DOKUSEIS_TAIENDAMISEL,value:"Täiendamisel"},{code:Pn.DO_DOKUSEIS_KEHTETU,value:"Kehtetu"},{code:Pn.DO_DOKUSEIS_REG_KANTUD,value:"Registrisse kantud"},{code:Pn.DO_DOKUSEIS_TYHISTATUD,value:"Tühistatud"},{code:Pn.DO_DOKUSEIS_LOOBUTUD,value:"Tagasi võetud"},{code:Pn.DO_DOKUSEIS_ALLKIRJASTAMISEL,value:"Allkirjastamisel"},{code:Pn.DO_DOKUSEIS_VANA_VERSIOON,value:"Vana versioon"}].sort(((e,t)=>e.value.localeCompare(t.value))))),[m,g]=(0,q.useState)({}),[f,S]=(0,q.useState)(""),[I,T]=(0,q.useState)(!1),[v,E]=(0,q.useState)({code:"",value:""}),[_,y]=(0,q.useState)({}),[b,D]=(0,q.useState)(!1),x=(0,q.useRef)(),M=(0,_n.useSelector)((e=>e.myViewsPage.filter.documentTypes)),N=(0,_n.useSelector)((e=>e.myViewsPage.filter.institutions)),O=(0,_n.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!(!(0,yn.default)(e,"YYYY-MM-DD",!0).isValid()&&!(0,yn.default)(e,"D.M.YYYY",!0).isValid())}(0,q.useEffect)((()=>{if(M){const e=ps(M);c(e)}if(N){const e=ms([...N]);p(e)}}),[M,N]);const j={sm:20,md:8,lg:8};return(0,hn.jsxs)(X.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,hn.jsx)(X.MessageBlock,{dismissible:!0,header:(0,hn.jsx)(z.FormattedMessage,{id:_.header}),onDismiss:()=>y({header:"",message:""}),theme:"danger",messages:[(0,hn.jsx)(z.FormattedMessage,{id:_.message})]}),O&&O.length>500&&(0,hn.jsx)(X.MessageBlock,{dismissible:!0,header:(0,hn.jsx)(z.FormattedMessage,{id:"detailsearch.empty_filter_error.header"}),theme:"warning",messages:[(0,hn.jsx)(z.FormattedMessage,{id:"detailsearch.filter_error_message.more_than_500_results"})]}),(0,hn.jsxs)(X.Row,{className:"align-items-start",children:[(0,hn.jsxs)(X.Col,{xs:20,md:20,lg:10,className:"px-0",children:[(0,hn.jsx)(X.FieldWrapper,{labelCol:j,component:(0,hn.jsx)(X.Input,{name:"input",onChange:e=>U(e,"buildingLocation"),placeholder:t.formatMessage({id:"detailsearch.filter.placeholder.address_catastralUnit_ehrCode"}),value:s.buildingLocation}),label:(0,hn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.building_location"}),info:{content:"detailsearch.filter.tooltip.address_catastralUnit_ehrCode.extended",placement:"top-start"}}),(0,hn.jsx)(X.FieldWrapper,{labelCol:j,component:(0,hn.jsx)(X.Input,{name:"input",onChange:e=>U(e,"buildingName"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:s.buildingName}),label:(0,hn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.building_name"}),info:{content:"detailsearch.filter.tooltip.building_name",placement:"top-start"}}),(0,hn.jsx)(X.FieldWrapper,{labelCol:j,component:(0,hn.jsx)(X.Multiselect,{name:"multiselect",options:u,onSelect:e=>A(e,"institutions"),allSelection:!0,onRemoveItem:e=>A(e,"institutions"),value:s.institutions,selectedOptions:r}),label:(0,hn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.institution"})}),(0,hn.jsx)(X.FieldWrapper,{labelCol:j,component:(0,hn.jsx)("div",{className:"daterange_in_form",children:(0,hn.jsx)(X.DateRange,{onBlur:()=>{D(!0)},value:s.documentDate,onChange:e=>(e=>{""!==e.from&&!w(e.from)||""!==e.to&&!w(e.to)?a(t.formatMessage({id:"filter.invalid_date_format"})):""!==e.from&&""!==e.to&&(0,yn.default)(e.from)>(0,yn.default)(e.to)?a(t.formatMessage({id:"filter.invalid_date_range"})):""!==e.from&&((0,yn.default)(e.from)<(0,yn.default)("01.01.1990")||(0,yn.default)(e.from)>(0,yn.default)())||""!==e.to&&((0,yn.default)(e.to)<(0,yn.default)("01.01.1990")||(0,yn.default)(e.to)>(0,yn.default)())?a(t.formatMessage({id:"detailsearch.document.date_range_error.message"},{dateToday:(0,yn.default)().format("DD.MM.YYYY")})):(0,yn.default)(e.to).diff((0,yn.default)(e.from),"days")>367?a(t.formatMessage({id:"detailsearch.filter_error_message.date_range_too_long"})):(a(""),D(!1)),o((t=>({...t,documentDate:e})))})(e)})}),errorMessage:b&&i.length>0?i:null,label:(0,hn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.document_date"}),info:{content:"detailsearch.filter.tooltip.document_date",placement:"top-start"}})]}),(0,hn.jsxs)(X.Col,{xs:20,md:20,lg:10,className:"px-0",children:[(0,hn.jsx)(X.FieldWrapper,{labelCol:j,component:(0,hn.jsx)(X.Multiselect,{name:"multiselect",options:d,onSelect:e=>A(e,"documentType"),allSelection:!0,onRemoveItem:e=>A(e,"documentType"),value:s.documentType,selectedOptions:r}),label:(0,hn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.document_type"}),info:{content:"detailsearch.filter.tooltip.document_type",placement:"top-start"}}),(0,hn.jsx)(X.FieldWrapper,{labelCol:j,component:(0,hn.jsx)(X.Input,{name:"input",onChange:e=>U(e,"documentNr"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:s.documentNr}),label:(0,hn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.document_nr"}),info:{content:"detailsearch.filter.tooltip.document_nr",placement:"top-start"}}),(0,hn.jsx)(X.FieldWrapper,{labelCol:j,component:(0,hn.jsx)(X.Multiselect,{name:"multiselect",options:h,onSelect:e=>A(e,"documentState"),allSelection:!0,onRemoveItem:e=>A(e,"documentState"),value:s.documentState,selectedOptions:r}),label:(0,hn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.document_state"})})]})]}),!e.isNonAuthenticatedUser&&(0,hn.jsx)(X.Row,{children:(0,hn.jsx)(X.Col,{xs:20,md:20,lg:10,className:"px-0",children:(0,hn.jsx)(X.FieldWrapper,{labelCol:j,component:(0,hn.jsx)(X.PersonSearchPageExtended,{person:m,disabled:!1,labelKey:"code",valueKey:"value",onInputChange:e=>{!function(e){S(e),v.code.length>0&&E({code:"",value:""})}(e)},updatedFromAR:()=>{},onPersonUpdate:e=>function(e){var t;g(e),e&&(f===e.idCode||f===(null===(t=e.id)||void 0===t?void 0:t.toString())||f===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,hn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.connected_person"}),info:{content:"detailsearch.filter.tooltip.connected_person.extended",placement:"top-start"}})})}),(0,hn.jsxs)(X.Row,{children:[(0,hn.jsx)(X.Col,{children:(0,hn.jsx)(X.Button,{onClick:()=>(l([]),o(n),x.current.clearTypeahead(),void g({})),colourScheme:"light",squared:!0,children:(0,hn.jsx)(z.FormattedMessage,{id:"button.epmty_fields"})})}),(0,hn.jsx)(X.Col,{children:(0,hn.jsx)(X.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!!(b&&i.length>0||I),squared:!0,children:(0,hn.jsx)(z.FormattedMessage,{id:"button.search"})})})]})]})},co=e=>{const t=(0,z.useIntl)(),n={documentType:[],documentNr:"",proceedingDate:{from:"",to:""},proceedingNr:"",institutions:[]},[s,o]=(0,q.useState)(n),[i,a]=(0,q.useState)([]),[r,l]=(0,q.useState)([]),[d,c]=(0,q.useState)([]),[u,p]=(0,q.useState)(""),[h,m]=(0,q.useState)({}),[g,f]=(0,q.useState)(!1),S=(0,_n.useSelector)((e=>e.myViewsPage.filter.documentTypes)),I=(0,_n.useSelector)((e=>e.myViewsPage.filter.institutions)),T=(0,_n.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!(!(0,yn.default)(e,"YYYY-MM-DD",!0).isValid()&&!(0,yn.default)(e,"D.M.YYYY",!0).isValid())}(0,q.useEffect)((()=>{if(S){const e=ps(S);l(e)}if(I){const e=ms([...I]);c(e)}}),[S,I]);const y={sm:20,md:8,lg:8};return(0,hn.jsxs)(X.Form,{onSubmit:()=>{u.length>0?f(!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,hn.jsx)(X.MessageBlock,{dismissible:!0,header:(0,hn.jsx)(z.FormattedMessage,{id:h.header}),onDismiss:()=>m({header:"",message:""}),theme:"danger",messages:[(0,hn.jsx)(z.FormattedMessage,{id:h.message})]}),T&&T.length>500&&(0,hn.jsx)(X.MessageBlock,{dismissible:!0,header:(0,hn.jsx)(z.FormattedMessage,{id:"detailsearch.empty_filter_error.header"}),theme:"warning",messages:[(0,hn.jsx)(z.FormattedMessage,{id:"detailsearch.filter_error_message.more_than_500_results"})]}),(0,hn.jsxs)(X.Row,{className:"align-items-start",children:[(0,hn.jsxs)(X.Col,{xs:20,md:20,lg:10,className:"px-0",children:[(0,hn.jsx)(X.FieldWrapper,{labelCol:y,component:(0,hn.jsx)(X.Multiselect,{name:"multiselect",options:r,onSelect:e=>v(e,"documentType"),allSelection:!0,onRemoveItem:e=>v(e,"documentType"),value:s.documentType,selectedOptions:i}),label:(0,hn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.document_type"}),info:{content:"detailsearch.filter.tooltip.document_type",placement:"top-start"}}),(0,hn.jsx)(X.FieldWrapper,{labelCol:y,component:(0,hn.jsx)(X.Input,{name:"input",onChange:e=>E(e,"documentNr"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:s.documentNr}),label:(0,hn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.document_nr"}),info:{content:"detailsearch.filter.tooltip.document_nr",placement:"top-start"}}),(0,hn.jsx)(X.FieldWrapper,{labelCol:y,component:(0,hn.jsx)("div",{className:"daterange_in_form",children:(0,hn.jsx)(X.DateRange,{onChange:e=>(e=>{""!==e.from&&!_(e.from)||""!==e.to&&!_(e.to)?p(t.formatMessage({id:"filter.invalid_date_format"})):""!==e.from&&""!==e.to&&(0,yn.default)(e.from)>(0,yn.default)(e.to)?p(t.formatMessage({id:"filter.invalid_date_range"})):""!==e.from&&((0,yn.default)(e.from)<(0,yn.default)("01.01.1990")||(0,yn.default)(e.from)>(0,yn.default)())||""!==e.to&&((0,yn.default)(e.to)<(0,yn.default)("01.01.1990")||(0,yn.default)(e.to)>(0,yn.default)())?p(t.formatMessage({id:"detailsearch.proceeding.date_range_error.message"},{dateToday:(0,yn.default)().format("DD.MM.YYYY")})):(0,yn.default)(e.to).diff((0,yn.default)(e.from),"days")>367?p(t.formatMessage({id:"detailsearch.filter_error_message.date_range_too_long"})):(p(""),f(!1)),o((t=>({...t,proceedingDate:e})))})(e),value:s.proceedingDate,onBlur:()=>{f(!0)}})}),errorMessage:g&&u.length>0?u:null,label:(0,hn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.proceeding_date"}),info:{content:"detailsearch.filter.tooltip.proceeding_date",placement:"top-start"}})]}),(0,hn.jsxs)(X.Col,{xs:20,md:20,lg:10,className:"px-0",children:[(0,hn.jsx)(X.FieldWrapper,{labelCol:y,component:(0,hn.jsx)(X.Input,{name:"input",onChange:e=>E(e,"proceedingNr"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:s.proceedingNr}),label:(0,hn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.proceeding_nr"})}),(0,hn.jsx)(X.FieldWrapper,{labelCol:y,component:(0,hn.jsx)(X.Multiselect,{name:"multiselect",options:d,onSelect:e=>v(e,"institutions"),allSelection:!0,onRemoveItem:e=>v(e,"institutions"),value:s.institutions,selectedOptions:i}),label:(0,hn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.institution"})})]})]}),(0,hn.jsxs)(X.Row,{children:[(0,hn.jsx)(X.Col,{children:(0,hn.jsx)(X.Button,{onClick:()=>(a([]),void o(n)),colourScheme:"light",squared:!0,children:(0,hn.jsx)(z.FormattedMessage,{id:"button.epmty_fields"})})}),(0,hn.jsx)(X.Col,{children:(0,hn.jsx)(X.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!!(g&&u.length>0),squared:!0,children:(0,hn.jsx)(z.FormattedMessage,{id:"button.search"})})})]})]})},uo={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 po(e){const t=function(e){return Gn(uo,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 ho=e=>{const t=(0,z.useIntl)(),[n,s]=(0,q.useState)([]),o=(0,_n.useSelector)((e=>e.myViewsPage.detailSearch.buildings));(0,q.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(ue,String(t.ehrCode),null,!1,!1,null):null;return t.ehrCode&&null!==t.ehrCode?(0,hn.jsx)(Sn,{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,hn.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,hn.jsx)(X.Status,{type:po(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,hn.jsxs)(hn.Fragment,{children:[(0,hn.jsx)("br",{}),"IK "+e.isikukood]}):void 0,o=null!==e.regKood,i=null!==(t=e.jiNimi)&&void 0!==t?t:"";return!0===o?(0,hn.jsx)("div",{children:i}):n?(0,hn.jsxs)("div",{children:[n,null!=s?s:""]}):""}(e))):""}];return(0,hn.jsx)("div",{children:(0,hn.jsx)(X.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:fn,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})})},mo="DD.MM.YYYY",go="YYYY-MM-DD";class fo{static dateToStr(e){return fo.formatDate(mo,e)}static dateToStrForDatepicker(e){return fo.formatDate(go,e)}static dateWithTimeToStr(e){return fo.formatDate("DD.MM.YYYY HH:mm",e)}static formatDate(e,t){return t?(0,yn.default)(t).format(e):""}static dateToMs(e,t){const n=(0,yn.default)(t,e);return t&&n.isValid()?n.valueOf():void 0}}const So=e=>{var t,n,s,o,i,a;const r=(0,z.useIntl)(),[l,d]=(0,q.useState)([]),c=(0,_n.useSelector)((e=>e.myViewsPage.detailSearch.documents)),u=(0,_n.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===(a=i.activeRole)||void 0===a?void 0:a.businessId)&&void 0!==o?o:0;(0,q.useEffect)((()=>{c&&c.length>0&&d(c)}),[c]);const m=e.filterStateDocumentsSearch.buildingLocation,g=e.filterStateDocumentsSearch.buildingName;const f=m?m.toString().toLowerCase().replace(/[&|=;~!$>*%_()?.+:'"\\]/g,"").replace(/\t/g," ").replace(/\s{2,}/g," ").replace(/\s?-\s?/g,"-"):"";function S(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=>S(e,t.toLowerCase())));return!!s&&s.indexOf(!0)>-1}(f,e)));return I.some((e=>function(e){return!new RegExp(`\\b${e}\\b`,"gi").test(e)}(e)))?t.filter((e=>T(f,e))):t}function E(){return!Number.isNaN(Number(f))}function _(){if(f&&f.indexOf(", ")>-1){return f.split(", ").reverse().join(", ")}return f}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=f.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${f}\\b(?![\\/\\-])`,"i"),x=new RegExp(`\\b${_()}\\b(?![\\/\\-])`,"i"),M=f.replace(",","").split(/(?:\/|\s)+/g);function N(e){const t=e.buildingAddress;return t?t.findIndex((e=>e.toLowerCase()===f||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(he,String(t.docNr),null,!1,!1,{docId:t.docId,ehrCode:t.ehrCode}):null;return t.docNr&&null!==t.docNr?(0,hn.jsx)(Sn,{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,hn.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(ue,String(e),null,!1,!1,null):null;return(0,hn.jsxs)(hn.Fragment,{children:[(0,hn.jsx)(Sn,{linkName:e,tooltipText:"detailsearch.tooltip.open_building",href:o||void 0}),s!==t.ehrCode.length-1?(0,hn.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,hn.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,hn.jsx)(X.Status,{type:Fn(e.stateCode).type,children:Fn(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=ws(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===me.MKM||t.institutionId&&h===t.institutionId?(0,hn.jsx)(Sn,{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,hn.jsxs)("div",{children:[t,n!==e.presenter.length-1?(0,hn.jsx)("span",{children:", "}):""]}))):""},{id:"institution",property:"institutionName",size:130,getValue:e=>{var t;return null!==(t=e.institutionName)&&void 0!==t?t:""}}];return(0,hn.jsx)(X.TableComponent,{config:{thead:{headers:U.map((e=>({id:e.id,size:e.size,className:"table-header-field text-align-left",label:r.formatMessage({id:"detailsearch.documents.table.header."+e.id}),tooltip:{text:r.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:fn,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()||f.length<2?n:A(n)}else t=E()||f.length<2?e:A(e);const n=t.map((e=>{var t,n,s,o;return{docId:e.docId,docDate:null!==(t=fo.dateToMs(mo,e.docDate))&&void 0!==t?t:"",regDate:null!==(n=fo.dateToMs(mo,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})},Io=e=>{var t,n,s,o;const i=(0,z.useIntl)(),[a,r]=(0,q.useState)([]),l=(0,_n.useSelector)((e=>e.myViewsPage.detailSearch.proceedings)),d=(0,_n.useSelector)((e=>e.myViewsPage.filter.documentTypes)),c=(0,_n.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,q.useEffect)((()=>{l&&l.length>0&&r(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=ws(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,hn.jsx)(Sn,{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,hn.jsx)(X.Status,{type:xs(e.proceedingStateCode).type,children:xs(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(he,String(t.docNr),null,!1,!1,null):null;return t.docNr&&null!==t.docNr?(0,hn.jsx)(Sn,{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,hn.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(ue,String(e),null,!1,!1,null):null;return(0,hn.jsxs)(hn.Fragment,{children:[(0,hn.jsx)(Sn,{linkName:e,tooltipText:"detailsearch.tooltip.open_building",href:o||void 0}),s!==t.ehrCode.length-1?(0,hn.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,hn.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,hn.jsx)(X.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:fn,expandableRow:!1,isFilter:!1}},data:function(e){const t=e.map((e=>{var t,n,s,o,i,a;return{proceedingId:e.proceedingId,dateStart:null!==(t=fo.dateToMs(mo,e.dateStart))&&void 0!==t?t:"",dateEnd:null!==(n=fo.dateToMs(mo,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===(a=c.find((t=>t.id===e.institutionId)))||void 0===a?void 0:a.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}(a),handleEvent:()=>!0})},To="https://devkluster.ehr.ee/api/building/v2".replace(/\/+$/,"");class vo{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:To,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Me.default;this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class Eo extends Error{constructor(e,t){super(t),this.name="RequiredError",this.field=e}}const _o="https://example.com",yo=function(e,t,n){if(null==n)throw new Eo(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},bo=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()},Do=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||""},xo=function(e){return e.pathname+e.search+e.hash},Mo=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 a={...e.options,url:((null==s?void 0:s.basePath)||i)+e.url};return o.request(a)}},No=function(e){const t=function(e){return{buildingChangesGet:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};yo("buildingChangesGet","ehrCode",t),yo("buildingChangesGet","dokNr",n);const o=new URL("/buildingChanges",_o);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...s},r={};void 0!==t&&(r.ehr_code=t),void 0!==n&&(r.dok_nr=n),bo(o,r,s.query);let l=i&&i.headers?i.headers:{};return a.headers={...l,...s.headers},{url:xo(o),options:a}},buildingCompareGet:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};yo("buildingCompareGet","doEhitisId1",t),yo("buildingCompareGet","doEhitisId2",n);const o=new URL("/buildingCompare",_o);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...s},r={};void 0!==t&&(r.do_ehitis_id1=t),void 0!==n&&(r.do_ehitis_id2=n),bo(o,r,s.query);let l=i&&i.headers?i.headers:{};return a.headers={...l,...s.headers},{url:xo(o),options:a}},buildingDataGet:async function(t,n,s,o){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const a=new URL("/buildingData",_o);let r;e&&(r=e.baseOptions);const l={method:"GET",...r,...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),bo(a,d,i.query);let c=r&&r.headers?r.headers:{};return l.headers={...c,...i.headers},{url:xo(a),options:l}},buildingDeepCopyPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};yo("buildingDeepCopyPost","deepCopyPostRequest",t);const s=new URL("/buildingDeepCopy",_o);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};bo(s,{},n.query);let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=Do(t,i,e),{url:xo(s),options:i}},buildingOwnerSearchPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};yo("buildingOwnerSearchPost","bSearchOPostRequest",t);const s=new URL("/buildingOwnerSearch",_o);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};bo(s,{},n.query);let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=Do(t,i,e),{url:xo(s),options:i}},buildingSearchPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};yo("buildingSearchPost","bSearchPostRequest",t);const s=new URL("/buildingSearch",_o);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};bo(s,{},n.query);let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=Do(t,i,e),{url:xo(s),options:i}},buildingSecureDataArrayPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};yo("buildingSecureDataArrayPost","requestBody",t);const s=new URL("/buildingSecureDataArray",_o);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};bo(s,{},n.query);let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=Do(t,i,e),{url:xo(s),options:i}},buildingSecureDataGet:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const o=new URL("/buildingSecureData",_o);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...s},r={};void 0!==t&&(r.ehr_code=t),void 0!==n&&(r.ehr_id=n),bo(o,r,s.query);let l=i&&i.headers?i.headers:{};return a.headers={...l,...s.headers},{url:xo(o),options:a}},buildingVersionsGet:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};yo("buildingVersionsGet","ehrCode",t);const s=new URL("/buildingVersions",_o);let o;e&&(o=e.baseOptions);const i={method:"GET",...o,...n},a={};void 0!==t&&(a.ehr_code=t),bo(s,a,n.query);let r=o&&o.headers?o.headers:{};return i.headers={...r,...n.headers},{url:xo(s),options:i}},buildingsDataPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};yo("buildingsDataPost","ehrCodesPostRequest",t);const s=new URL("/buildingsData",_o);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};bo(s,{},n.query);let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=Do(t,i,e),{url:xo(s),options:i}},findEhrcodesDateafterGet:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};yo("findEhrcodesDateafterGet","timestamp",t);const o=new URL("/find/ehrcodes/dateafter",_o);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...s},r={};void 0!==t&&(r.timestamp=t instanceof Date?t.toISOString():t),void 0!==n&&(r.offset=n),bo(o,r,s.query);let l=i&&i.headers?i.headers:{};return a.headers={...l,...s.headers},{url:xo(o),options:a}},findEhrcodesDocIdGet:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};yo("findEhrcodesDocIdGet","id",t);const s=new URL("/find/ehrcodes/docId",_o);let o;e&&(o=e.baseOptions);const i={method:"GET",...o,...n},a={};void 0!==t&&(a.id=t),bo(s,a,n.query);let r=o&&o.headers?o.headers:{};return i.headers={...r,...n.headers},{url:xo(s),options:i}}}}(e);return{async buildingChangesGet(n,s,o){const i=await t.buildingChangesGet(n,s,o);return Mo(i,Me.default,To,e)},async buildingCompareGet(n,s,o){const i=await t.buildingCompareGet(n,s,o);return Mo(i,Me.default,To,e)},async buildingDataGet(n,s,o,i,a){const r=await t.buildingDataGet(n,s,o,i,a);return Mo(r,Me.default,To,e)},async buildingDeepCopyPost(n,s){const o=await t.buildingDeepCopyPost(n,s);return Mo(o,Me.default,To,e)},async buildingOwnerSearchPost(n,s){const o=await t.buildingOwnerSearchPost(n,s);return Mo(o,Me.default,To,e)},async buildingSearchPost(n,s){const o=await t.buildingSearchPost(n,s);return Mo(o,Me.default,To,e)},async buildingSecureDataArrayPost(n,s){const o=await t.buildingSecureDataArrayPost(n,s);return Mo(o,Me.default,To,e)},async buildingSecureDataGet(n,s,o){const i=await t.buildingSecureDataGet(n,s,o);return Mo(i,Me.default,To,e)},async buildingVersionsGet(n,s){const o=await t.buildingVersionsGet(n,s);return Mo(o,Me.default,To,e)},async buildingsDataPost(n,s){const o=await t.buildingsDataPost(n,s);return Mo(o,Me.default,To,e)},async findEhrcodesDateafterGet(n,s,o){const i=await t.findEhrcodesDateafterGet(n,s,o);return Mo(i,Me.default,To,e)},async findEhrcodesDocIdGet(n,s){const o=await t.findEhrcodesDocIdGet(n,s);return Mo(o,Me.default,To,e)}}};class Oo extends vo{buildingChangesGet(e,t,n){return No(this.configuration).buildingChangesGet(e,t,n).then((e=>e(this.axios,this.basePath)))}buildingCompareGet(e,t,n){return No(this.configuration).buildingCompareGet(e,t,n).then((e=>e(this.axios,this.basePath)))}buildingDataGet(e,t,n,s,o){return No(this.configuration).buildingDataGet(e,t,n,s,o).then((e=>e(this.axios,this.basePath)))}buildingDeepCopyPost(e,t){return No(this.configuration).buildingDeepCopyPost(e,t).then((e=>e(this.axios,this.basePath)))}buildingOwnerSearchPost(e,t){return No(this.configuration).buildingOwnerSearchPost(e,t).then((e=>e(this.axios,this.basePath)))}buildingSearchPost(e,t){return No(this.configuration).buildingSearchPost(e,t).then((e=>e(this.axios,this.basePath)))}buildingSecureDataArrayPost(e,t){return No(this.configuration).buildingSecureDataArrayPost(e,t).then((e=>e(this.axios,this.basePath)))}buildingSecureDataGet(e,t,n){return No(this.configuration).buildingSecureDataGet(e,t,n).then((e=>e(this.axios,this.basePath)))}buildingVersionsGet(e,t){return No(this.configuration).buildingVersionsGet(e,t).then((e=>e(this.axios,this.basePath)))}buildingsDataPost(e,t){return No(this.configuration).buildingsDataPost(e,t).then((e=>e(this.axios,this.basePath)))}findEhrcodesDateafterGet(e,t,n){return No(this.configuration).findEhrcodesDateafterGet(e,t,n).then((e=>e(this.axios,this.basePath)))}findEhrcodesDocIdGet(e,t){return No(this.configuration).findEhrcodesDocIdGet(e,t).then((e=>e(this.axios,this.basePath)))}}const Ao=e=>{var t,n,s,o;let{buildingsActualDataApiEndpoint:i,classifierApiEndpoint:a,linkGen:r,generateLink:l,myViewsApiEndpoint:d,searchType:c,userApiEndpoint:u,userInfo:p}=e;const h=(0,_n.useDispatch)(),g=["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:""),I=["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,q.useState)({}),[_,y]=(0,q.useState)({}),[b,D]=(0,q.useState)({}),[x,M]=(0,q.useState)([]),[N,O]=(0,q.useState)([]),[A,U]=(0,q.useState)([]),[w,j]=(0,q.useState)(!1),[C,L]=(0,q.useState)(!1),[P,k]=(0,q.useState)(!1),Y=new Re(new yt({basePath:a})),B=new ze(new st({basePath:u})),G=new It(new yt({basePath:d})),V=new et(new st({basePath:u})),H=new Oo(new yt({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,q.useEffect)((()=>{Y.getAllDocumentTypes().then((e=>{h(m(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(S(e.data))})).catch((e=>{console.log(e)}))}),[]),(0,q.useEffect)((()=>{if(Object.keys(b).length>0){k(!0);G.searchDetailProceedings(b).then((e=>{h(F(e.data)),U(e.data),k(!1)})).catch((e=>{console.log(e),k(!1)}))}}),[b]),(0,q.useEffect)((()=>{if(Object.keys(_).length>0){L(!0);G.searchDetailDocuments(_).then((e=>{h(K(e.data)),O(e.data),L(!1)})).catch((e=>{console.log(e),L(!1)}))}}),[_]),(0,q.useEffect)((()=>{if(Object.keys(v).length>0){let e;j(!0),e=I?H.buildingOwnerSearchPost(v):H.buildingSearchPost(v),e.then((e=>{h(R(e.data)),M(e.data),j(!1)})).catch((e=>{console.log(e),j(!1)}))}}),[v,I]),(0,hn.jsxs)("div",{children:[(0,hn.jsx)(X.Section,{collapsed:c!==de,title:"detailsearch.buildings_detail_search",children:(0,hn.jsxs)("div",{children:[(0,hn.jsx)("div",{className:"filter-block",style:{paddingBottom:20},children:(0,hn.jsx)(ro,{onSubmit:e=>{E(e)},isAdminRole:g,isAdminPlusRole:I,callSearchPerson:J})}),Object.keys(v).length>0&&0===x.length&&!w?(0,hn.jsx)("div",{style:{height:210},className:"d-flex justify-content-center align-items-center",children:(0,hn.jsx)(X.Text,{raw:"detailsearch.empty_search_result"})}):w?(0,hn.jsx)(X.SectionLoader,{}):(0,hn.jsx)(ho,{linkGen:r,generateLink:l,isAdminRole:g,isAdminPlusRole:I})]})}),(0,hn.jsx)(X.Section,{collapsed:"DOCUMENTS_SEARCH"!==c,title:"detailsearch.documents_detail_search",children:(0,hn.jsxs)("div",{children:[(0,hn.jsx)("div",{className:"filter-block",style:{paddingBottom:20},children:(0,hn.jsx)(lo,{onSubmit:e=>{y(e)},callSearchPerson:J,isNonAuthenticatedUser:T})}),Object.keys(_).length>0&&0===N.length&&!C?(0,hn.jsx)("div",{style:{height:210},className:"d-flex justify-content-center align-items-center",children:(0,hn.jsx)(X.Text,{raw:"detailsearch.empty_search_result"})}):C?(0,hn.jsx)(X.SectionLoader,{}):(0,hn.jsx)(So,{linkGen:r,generateLink:l,userInfo:p,filterStateDocumentsSearch:_})]})}),g&&(0,hn.jsx)(X.Section,{collapsed:"PROCEEDINGS_SEARCH"!==c,title:"detailsearch.proceedings_detail_search",children:(0,hn.jsxs)("div",{children:[(0,hn.jsx)("div",{className:"filter-block",style:{paddingBottom:20},children:(0,hn.jsx)(co,{onSubmit:e=>{D(e)}})}),Object.keys(b).length>0&&0===A.length&&!P?(0,hn.jsx)("div",{style:{height:210},className:"d-flex justify-content-center align-items-center",children:(0,hn.jsx)(X.Text,{raw:"detailsearch.empty_search_result"})}):P?(0,hn.jsx)(X.SectionLoader,{}):(0,hn.jsx)(Io,{linkGen:r,userInfo:p,generateLink:l})]})})]})};export{Ao as DetailSearch,En as MyAdministrativeProceedings,Qs as MyApprovals,ys as MyDocuments,to as MyInvolvements,Zs as MyOpinions,Xs as MyProceedings,D as documentsReducer,I as filterReducer,L as myOperationsReducer,A as proceedingsReducer,$ as rootReducer};
|
|
2
|
+
import*as e from"react";import*as t from"@reduxjs/toolkit";import*as n from"react-intl";import*as s from"ehr-components";import*as o from"axios";import*as i from"react-redux";import*as a from"moment";import*as r from"reactstrap";var l={20:(e,t,n)=>{var s=n(649),o=Symbol.for("react.element"),i=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,r=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)a.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:r.current}}t.Fragment=i,t.jsx=d,t.jsxs=d},649:t=>{t.exports=e},848:(e,t,n)=>{e.exports=n(20)}},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.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);const u=(e=>{var t={};return c.d(t,e),t})({combineReducers:()=>t.combineReducers,createAsyncThunk:()=>t.createAsyncThunk,createSelector:()=>t.createSelector,createSlice:()=>t.createSlice});const p=(0,u.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:h,documentTypesLoaded:m,institutionUsersLoaded:g,institutionsLoaded:f,usageClassifierTypesLoaded:S}=p.actions,I=p.reducer;const T=(0,u.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:v,deleteDocument:y,allowedDocumentTypesLoaded:b}=T.actions,D=T.reducer;const x=(0,u.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:M,proceedingsToCommentLoaded:N,incomingDocumentsLoaded:O}=x.actions,A=x.reducer;const U=(0,u.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:w,toCommentOperationsLoaded:j,operationInvitationsLoaded:C}=U.actions,L=U.reducer;const P=(0,u.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:R,documentsLoaded:K,proceedingsLoaded:F}=P.actions,k=P.reducer,Y={notices:[]},B=(0,u.createSlice)({name:"notification",initialState:Y,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=>Y}}),G=(0,u.createSelector)((e=>e.myViewsPage.notifications.notices),(e=>e)),{cleanState:V,setNotifications:H,removeNotification:J}=B.actions,W=B.reducer,$=(0,u.combineReducers)({filter:I,myDocuments:D,myProceedings:A,myOperations:L,detailSearch:k,notifications:W});var q=c(649);const z=(e=>{var t={};return c.d(t,e),t})({FormattedMessage:()=>n.FormattedMessage,useIntl:()=>n.useIntl});const X=(e=>{var t={};return c.d(t,e),t})({Button:()=>s.Button,Checkbox:()=>s.Checkbox,Col:()=>s.Col,CollapseTable:()=>s.CollapseTable,CollapseTableRow:()=>s.CollapseTableRow,ControlledPopover:()=>s.ControlledPopover,DatePicker:()=>s.DatePicker,DateRange:()=>s.DateRange,FieldWrapper:()=>s.FieldWrapper,Form:()=>s.Form,Icon:()=>s.Icon,Info:()=>s.Info,Input:()=>s.Input,Link:()=>s.Link,Loader:()=>s.Loader,MessageBlock:()=>s.MessageBlock,Multiselect:()=>s.Multiselect,NumberRangeExtended:()=>s.NumberRangeExtended,PersonSearchPageExtended:()=>s.PersonSearchPageExtended,RichTextEditor:()=>s.RichTextEditor,Row:()=>s.Row,Section:()=>s.Section,SectionLoader:()=>s.SectionLoader,Select:()=>s.Select,Status:()=>s.Status,TableComponent:()=>s.TableComponent,Text:()=>s.Text,Tooltip:()=>s.Tooltip}),Q="SIGNING_DOCUMENTS",Z="WORKING_DOCUMENTS",ee="FINISHED_DOCUMENTS",te="INCOMING_DOCUMENTS",ne="MY_APPROVALS",se="MY_OPINIONS",oe="MY_INVOLVEMENTS",ie="MY_OPERATIONS",ae="OPERATIONS_TO_COMMENT",re="OPERATION_INVITATIONS",le="PROCEEDINGS_TO_COMMENT",de="BUILDINGS_SEARCH";let ce=function(e){return e.DEFAULT="default",e.INFO="info",e.SUCCESS="success",e.WARNING="warning",e.DANGER="danger",e}({});const ue="BUILDING",pe="PROCEEDING",he="DOCUMENT";let me=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 ge=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 fe="12975",Se="12976",Ie="11274",Te="11275",Ee="12977",_e="12978",ve=["11272","12972",fe,"12974",_e,Te],ye=["11273","12973",Se,"12971",Ee,Ie],be=[fe,Se],De={[Se]:Ee,[fe]:_e},xe={[Se]:Ie,[fe]:Te};const Me=(e=>{var t={};return c.d(t,e),t})({default:()=>o.default}),Ne="https://devkluster.ehr.ee".replace(/\/+$/,"");class Oe{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ne,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Me.default;this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class Ae extends Error{constructor(e,t){super(t),this.name="RequiredError",this.field=e}}const Ue="https://example.com",we=function(e,t,n){if(null==n)throw new Ae(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},je=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()},Ce=function(e){return e.pathname+e.search+e.hash},Le=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 a={...e.options,url:((null==s?void 0:s.basePath)||i)+e.url};return o.request(a)}},Pe=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",Ue);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};je(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Ce(n),options:o}},getBusinessTypesList:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/businesstypelist",Ue);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};je(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Ce(n),options:o}},getClassifierByType:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};we("getClassifierByType","classifierType",t);const s="/classifier/{classifierType}".replace("{classifierType}",encodeURIComponent(String(t))),o=new URL(s,Ue);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n};je(o,{},n.query);let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:Ce(o),options:a}},getClassifiersByRelatedType:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};we("getClassifiersByRelatedType","relatedClassifierType",t);const s="/classifier/related-type/{relatedClassifierType}".replace("{relatedClassifierType}",encodeURIComponent(String(t))),o=new URL(s,Ue);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n};je(o,{},n.query);let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:Ce(o),options:a}},getClassifiersByType:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};we("getClassifiersByType","classifierTypesCommaSeparated",t);const s="/classifiers/{classifierTypesCommaSeparated}".replace("{classifierTypesCommaSeparated}",encodeURIComponent(String(t))),o=new URL(s,Ue);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n};je(o,{},n.query);let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:Ce(o),options:a}},getDocumentTypes:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/documenttypes",Ue);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};je(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Ce(n),options:o}},getFileTypes:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/filetypes",Ue);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};je(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Ce(n),options:o}},getHealth:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/health",Ue);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};je(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Ce(n),options:o}},getUsageClassifierTypes:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/classifier/usage",Ue);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};je(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Ce(n),options:o}},getUserRolesList:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/userroleslist",Ue);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};je(n,{},t.query);let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:Ce(n),options:o}}}}(e);return{async getAllDocumentTypes(n){const s=await t.getAllDocumentTypes(n);return Le(s,Me.default,Ne,e)},async getBusinessTypesList(n){const s=await t.getBusinessTypesList(n);return Le(s,Me.default,Ne,e)},async getClassifierByType(n,s){const o=await t.getClassifierByType(n,s);return Le(o,Me.default,Ne,e)},async getClassifiersByRelatedType(n,s){const o=await t.getClassifiersByRelatedType(n,s);return Le(o,Me.default,Ne,e)},async getClassifiersByType(n,s){const o=await t.getClassifiersByType(n,s);return Le(o,Me.default,Ne,e)},async getDocumentTypes(n){const s=await t.getDocumentTypes(n);return Le(s,Me.default,Ne,e)},async getFileTypes(n){const s=await t.getFileTypes(n);return Le(s,Me.default,Ne,e)},async getHealth(n){const s=await t.getHealth(n);return Le(s,Me.default,Ne,e)},async getUsageClassifierTypes(n){const s=await t.getUsageClassifierTypes(n);return Le(s,Me.default,Ne,e)},async getUserRolesList(n){const s=await t.getUserRolesList(n);return Le(s,Me.default,Ne,e)}}};class Re extends Oe{getAllDocumentTypes(e){return Pe(this.configuration).getAllDocumentTypes(e).then((e=>e(this.axios,this.basePath)))}getBusinessTypesList(e){return Pe(this.configuration).getBusinessTypesList(e).then((e=>e(this.axios,this.basePath)))}getClassifierByType(e,t){return Pe(this.configuration).getClassifierByType(e,t).then((e=>e(this.axios,this.basePath)))}getClassifiersByRelatedType(e,t){return Pe(this.configuration).getClassifiersByRelatedType(e,t).then((e=>e(this.axios,this.basePath)))}getClassifiersByType(e,t){return Pe(this.configuration).getClassifiersByType(e,t).then((e=>e(this.axios,this.basePath)))}getDocumentTypes(e){return Pe(this.configuration).getDocumentTypes(e).then((e=>e(this.axios,this.basePath)))}getFileTypes(e){return Pe(this.configuration).getFileTypes(e).then((e=>e(this.axios,this.basePath)))}getHealth(e){return Pe(this.configuration).getHealth(e).then((e=>e(this.axios,this.basePath)))}getUsageClassifierTypes(e){return Pe(this.configuration).getUsageClassifierTypes(e).then((e=>e(this.axios,this.basePath)))}getUserRolesList(e){return Pe(this.configuration).getUserRolesList(e).then((e=>e(this.axios,this.basePath)))}}class Ke{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 Fe="http://localhost:8080".replace(/\/+$/,"");class ke{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Fe,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Me.default;this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class Ye extends Error{constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const Be="https://example.com",Ge=function(e,t,n){if(null==n)throw new Ye(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function Ve(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>Ve(e,t,n))):Object.keys(t).forEach((s=>Ve(e,t[s],`${n}${""!==n?".":""}${s}`))):e.has(n)?e.append(n,t):e.set(n,t))}const He=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];Ve(t,s),e.search=t.toString()},Je=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||""},We=function(e){return e.pathname+e.search+e.hash},$e=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 a={...e.options,url:((null==s?void 0:s.basePath)||i)+e.url};return o.request(a)}};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",Be);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};He(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:We(n),options:o}},getJurPersonCoordRelJurs:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ge("getJurPersonCoordRelJurs","personId",t);const s="/person/jur/{personId}/coord".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Be);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n};He(o,{});let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:We(o),options:a}},getUserPossibleProceedingSupervisorsByEHAKCode:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ge("getUserPossibleProceedingSupervisorsByEHAKCode","eHAKCode",t);const s="/user/possiblesupervisors/{EHAKCode}".replace("{EHAKCode}",encodeURIComponent(String(t))),o=new URL(s,Be);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n};He(o,{});let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:We(o),options:a}},getUserPossibleProceedingSupervisorsByIdAndEHAKCode:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ge("getUserPossibleProceedingSupervisorsByIdAndEHAKCode","id",t),Ge("getUserPossibleProceedingSupervisorsByIdAndEHAKCode","eHAKCode",n);const o="/user/possiblesupervisors/{id}/{EHAKCode}".replace("{id}",encodeURIComponent(String(t))).replace("{EHAKCode}",encodeURIComponent(String(n))),i=new URL(o,Be);let a;e&&(a=e.baseOptions);const r={method:"GET",...a,...s};He(i,{});let l=a&&a.headers?a.headers:{};return r.headers={...l,...s.headers},{url:We(i),options:r}},getUserPossibleProceedingSupervisorsByJurId:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ge("getUserPossibleProceedingSupervisorsByJurId","personId",t);const s="/user/jur/possiblesupervisors/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Be);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n};He(o,{});let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:We(o),options:a}}}}(e);return{async getJurKovPersons(n){const s=await t.getJurKovPersons(n);return $e(s,Me.default,Fe,e)},async getJurPersonCoordRelJurs(n,s){const o=await t.getJurPersonCoordRelJurs(n,s);return $e(o,Me.default,Fe,e)},async getUserPossibleProceedingSupervisorsByEHAKCode(n,s){const o=await t.getUserPossibleProceedingSupervisorsByEHAKCode(n,s);return $e(o,Me.default,Fe,e)},async getUserPossibleProceedingSupervisorsByIdAndEHAKCode(n,s,o){const i=await t.getUserPossibleProceedingSupervisorsByIdAndEHAKCode(n,s,o);return $e(i,Me.default,Fe,e)},async getUserPossibleProceedingSupervisorsByJurId(n,s){const o=await t.getUserPossibleProceedingSupervisorsByJurId(n,s);return $e(o,Me.default,Fe,e)}}};class ze extends ke{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 Xe=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",Be);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};He(s,{});let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=Je(t,i,e),{url:We(s),options:i}},addPerson:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/person",Be);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};He(s,{});let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=Je(t,i,e),{url:We(s),options:i}},deletePerson:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ge("deletePerson","personId",t);const s="/person/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Be);let i;e&&(i=e.baseOptions);const a={method:"DELETE",...i,...n};He(o,{});let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:We(o),options:a}},findKovsAndJurPersonsInTheSameAdministrativeDivision:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Ge("findKovsAndJurPersonsInTheSameAdministrativeDivision","regNameOrCode",t);const i="/person/kovs-and-institutions/{regNameOrCode}".replace("{regNameOrCode}",encodeURIComponent(String(t))),a=new URL(i,Be);let r;e&&(r=e.baseOptions);const l={method:"PUT",...r,...o},d={},c={};void 0!==n&&(c.searchFromAll=n),d["Content-Type"]="application/json",He(a,c);let u=r&&r.headers?r.headers:{};return l.headers={...d,...u,...o.headers},l.data=Je(s,l,e),{url:We(a),options:l}},findPublicSectorInstitutions:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ge("findPublicSectorInstitutions","regNameOrCode",t);const o="/person/public-sector-institutions/{regNameOrCode}".replace("{regNameOrCode}",encodeURIComponent(String(t))),i=new URL(o,Be);let a;e&&(a=e.baseOptions);const r={method:"PUT",...a,...s},l={"Content-Type":"application/json"};He(i,{});let d=a&&a.headers?a.headers:{};return r.headers={...l,...d,...s.headers},r.data=Je(n,r,e),{url:We(i),options:r}},findRolesByDbName:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/person/personroles",Be);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};He(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:We(n),options:o}},getAllActiveInstitutions:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/person/jur",Be);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};He(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:We(n),options:o}},getAllClassifierBusinessTypeDtos:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/person/jur/businessTypes",Be);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};He(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:We(n),options:o}},getJurPerson:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ge("getJurPerson","personId",t);const s="/person/jur/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Be);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n};He(o,{});let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:We(o),options:a}},getJurPersonAncestors:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ge("getJurPersonAncestors","jurPersonId",t);const s="/person/jur/ancestor/{jurPersonId}".replace("{jurPersonId}",encodeURIComponent(String(t))),o=new URL(s,Be);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n};He(o,{});let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:We(o),options:a}},getJurPersonSuccessors:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ge("getJurPersonSuccessors","jurPersonId",t);const s="/person/jur/successor/{jurPersonId}".replace("{jurPersonId}",encodeURIComponent(String(t))),o=new URL(s,Be);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n};He(o,{});let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:We(o),options:a}},getJurPersonsByEhakCode:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ge("getJurPersonsByEhakCode","ehakCode",t);const s="/person/jur/byEhakCode/{ehakCode}".replace("{ehakCode}",encodeURIComponent(String(t))),o=new URL(s,Be);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n};He(o,{});let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:We(o),options:a}},getPerson:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ge("getPerson","personId",t);const s="/person/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Be);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n};He(o,{});let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:We(o),options:a}},getPersonDetails:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/person/details",Be);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};He(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:We(n),options:o}},refreshUpdateArPersonFromAR:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ge("refreshUpdateArPersonFromAR","regCode",t);const s="/person/jur/refresh/{regCode}".replace("{regCode}",encodeURIComponent(String(t))),o=new URL(s,Be);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n};He(o,{});let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:We(o),options:a}},removeYlemyksusReference:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ge("removeYlemyksusReference","allyksusId",t);const s="/person/jur/removeYlemyksusReference/{allyksusId}".replace("{allyksusId}",encodeURIComponent(String(t))),o=new URL(s,Be);let i;e&&(i=e.baseOptions);const a={method:"PUT",...i,...n};He(o,{});let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:We(o),options:a}},updatePerson:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ge("updatePerson","personId",t);const o="/person/{personId}".replace("{personId}",encodeURIComponent(String(t))),i=new URL(o,Be);let a;e&&(a=e.baseOptions);const r={method:"PUT",...a,...s},l={"Content-Type":"application/json"};He(i,{});let d=a&&a.headers?a.headers:{};return r.headers={...l,...d,...s.headers},r.data=Je(n,r,e),{url:We(i),options:r}}}}(e);return{async addAllyksusToJurPerson(n,s){const o=await t.addAllyksusToJurPerson(n,s);return $e(o,Me.default,Fe,e)},async addPerson(n,s){const o=await t.addPerson(n,s);return $e(o,Me.default,Fe,e)},async deletePerson(n,s){const o=await t.deletePerson(n,s);return $e(o,Me.default,Fe,e)},async findKovsAndJurPersonsInTheSameAdministrativeDivision(n,s,o,i){const a=await t.findKovsAndJurPersonsInTheSameAdministrativeDivision(n,s,o,i);return $e(a,Me.default,Fe,e)},async findPublicSectorInstitutions(n,s,o){const i=await t.findPublicSectorInstitutions(n,s,o);return $e(i,Me.default,Fe,e)},async findRolesByDbName(n){const s=await t.findRolesByDbName(n);return $e(s,Me.default,Fe,e)},async getAllActiveInstitutions(n){const s=await t.getAllActiveInstitutions(n);return $e(s,Me.default,Fe,e)},async getAllClassifierBusinessTypeDtos(n){const s=await t.getAllClassifierBusinessTypeDtos(n);return $e(s,Me.default,Fe,e)},async getJurPerson(n,s){const o=await t.getJurPerson(n,s);return $e(o,Me.default,Fe,e)},async getJurPersonAncestors(n,s){const o=await t.getJurPersonAncestors(n,s);return $e(o,Me.default,Fe,e)},async getJurPersonSuccessors(n,s){const o=await t.getJurPersonSuccessors(n,s);return $e(o,Me.default,Fe,e)},async getJurPersonsByEhakCode(n,s){const o=await t.getJurPersonsByEhakCode(n,s);return $e(o,Me.default,Fe,e)},async getPerson(n,s){const o=await t.getPerson(n,s);return $e(o,Me.default,Fe,e)},async getPersonDetails(n){const s=await t.getPersonDetails(n);return $e(s,Me.default,Fe,e)},async refreshUpdateArPersonFromAR(n,s){const o=await t.refreshUpdateArPersonFromAR(n,s);return $e(o,Me.default,Fe,e)},async removeYlemyksusReference(n,s){const o=await t.removeYlemyksusReference(n,s);return $e(o,Me.default,Fe,e)},async updatePerson(n,s,o){const i=await t.updatePerson(n,s,o);return $e(i,Me.default,Fe,e)}}};class Qe extends ke{addAllyksusToJurPerson(e,t){return Xe(this.configuration).addAllyksusToJurPerson(e,t).then((e=>e(this.axios,this.basePath)))}addPerson(e,t){return Xe(this.configuration).addPerson(e,t).then((e=>e(this.axios,this.basePath)))}deletePerson(e,t){return Xe(this.configuration).deletePerson(e,t).then((e=>e(this.axios,this.basePath)))}findKovsAndJurPersonsInTheSameAdministrativeDivision(e,t,n,s){return Xe(this.configuration).findKovsAndJurPersonsInTheSameAdministrativeDivision(e,t,n,s).then((e=>e(this.axios,this.basePath)))}findPublicSectorInstitutions(e,t,n){return Xe(this.configuration).findPublicSectorInstitutions(e,t,n).then((e=>e(this.axios,this.basePath)))}findRolesByDbName(e){return Xe(this.configuration).findRolesByDbName(e).then((e=>e(this.axios,this.basePath)))}getAllActiveInstitutions(e){return Xe(this.configuration).getAllActiveInstitutions(e).then((e=>e(this.axios,this.basePath)))}getAllClassifierBusinessTypeDtos(e){return Xe(this.configuration).getAllClassifierBusinessTypeDtos(e).then((e=>e(this.axios,this.basePath)))}getJurPerson(e,t){return Xe(this.configuration).getJurPerson(e,t).then((e=>e(this.axios,this.basePath)))}getJurPersonAncestors(e,t){return Xe(this.configuration).getJurPersonAncestors(e,t).then((e=>e(this.axios,this.basePath)))}getJurPersonSuccessors(e,t){return Xe(this.configuration).getJurPersonSuccessors(e,t).then((e=>e(this.axios,this.basePath)))}getJurPersonsByEhakCode(e,t){return Xe(this.configuration).getJurPersonsByEhakCode(e,t).then((e=>e(this.axios,this.basePath)))}getPerson(e,t){return Xe(this.configuration).getPerson(e,t).then((e=>e(this.axios,this.basePath)))}getPersonDetails(e){return Xe(this.configuration).getPersonDetails(e).then((e=>e(this.axios,this.basePath)))}refreshUpdateArPersonFromAR(e,t){return Xe(this.configuration).refreshUpdateArPersonFromAR(e,t).then((e=>e(this.axios,this.basePath)))}removeYlemyksusReference(e,t){return Xe(this.configuration).removeYlemyksusReference(e,t).then((e=>e(this.axios,this.basePath)))}updatePerson(e,t,n){return Xe(this.configuration).updatePerson(e,t,n).then((e=>e(this.axios,this.basePath)))}}const Ze=function(e){const t=function(e){return{searchPerson:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Ge("searchPerson","input",t);const i=new URL("/search/searchPerson",Be);let a;e&&(a=e.baseOptions);const r={method:"GET",...a,...o},l={};void 0!==t&&(l.input=t),void 0!==n&&(l.xRoad=n),void 0!==s&&(l.isPrivate=s),He(i,l);let d=a&&a.headers?a.headers:{};return r.headers={...d,...o.headers},{url:We(i),options:r}}}}(e);return{async searchPerson(n,s,o,i){const a=await t.searchPerson(n,s,o,i);return $e(a,Me.default,Fe,e)}}};class et extends ke{searchPerson(e,t,n,s){return Ze(this.configuration).searchPerson(e,t,n,s).then((e=>e(this.axios,this.basePath)))}}const tt=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",Be);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};He(s,{});let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=Je(t,i,e),{url:We(s),options:i}},addUser:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/user",Be);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};He(s,{});let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=Je(t,i,e),{url:We(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",Be);let o;e&&(o=e.baseOptions);const i={method:"PUT",...o,...n},a={"Content-Type":"application/json"};He(s,{});let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=Je(t,i,e),{url:We(s),options:i}},deleteUser:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ge("deleteUser","userId",t);const s="/user/{userId}".replace("{userId}",encodeURIComponent(String(t))),o=new URL(s,Be);let i;e&&(i=e.baseOptions);const a={method:"DELETE",...i,...n};He(o,{});let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:We(o),options:a}},deleteUserRole:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ge("deleteUserRole","userRoleRelId",t);const s="/user/role/{userRoleRelId}".replace("{userRoleRelId}",encodeURIComponent(String(t))),o=new URL(s,Be);let i;e&&(i=e.baseOptions);const a={method:"DELETE",...i,...n};He(o,{});let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:We(o),options:a}},findUsersByRoleId:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ge("findUsersByRoleId","roleId",t);const s="/user/byroleid/{roleId}".replace("{roleId}",encodeURIComponent(String(t))),o=new URL(s,Be);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n};He(o,{});let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:We(o),options:a}},getAllClassifierUserRoleDtos:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/user/roles/all",Be);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};He(n,{});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",Be);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};He(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:We(n),options:o}},getJurUsers:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ge("getJurUsers","personId",t);const s="/jur/user/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Be);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n};He(o,{});let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:We(o),options:a}},getJurUsersWithoutGivenRole:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ge("getJurUsersWithoutGivenRole","personId",t),Ge("getJurUsersWithoutGivenRole","roleId",n);const o="/jur/user/withoutrole/{personId}/{roleId}".replace("{personId}",encodeURIComponent(String(t))).replace("{roleId}",encodeURIComponent(String(n))),i=new URL(o,Be);let a;e&&(a=e.baseOptions);const r={method:"GET",...a,...s};He(i,{});let l=a&&a.headers?a.headers:{};return r.headers={...l,...s.headers},{url:We(i),options:r}},getUser:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ge("getUser","userId",t);const s="/user/{userId}".replace("{userId}",encodeURIComponent(String(t))),o=new URL(s,Be);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n};He(o,{});let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:We(o),options:a}},getUserPossibleRecipients:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new URL("/user/possiblerecipients",Be);let o;e&&(o=e.baseOptions);const i={method:"GET",...o,...n},a={};void 0!==t&&(a.searchInput=t),He(s,a);let r=o&&o.headers?o.headers:{};return i.headers={...r,...n.headers},{url:We(s),options:i}},getUsers:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Ge("getUsers","personId",t);const s="/user/usersByPersonId/{personId}".replace("{personId}",encodeURIComponent(String(t))),o=new URL(s,Be);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n};He(o,{});let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:We(o),options:a}},getUsersJurPerson:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ge("getUsersJurPerson","userId",t);const o="/user/jur/{userId}".replace("{userId}",encodeURIComponent(String(t))),i=new URL(o,Be);let a;e&&(a=e.baseOptions);const r={method:"GET",...a,...s},l={};void 0!==n&&(l.valid=n),He(i,l);let d=a&&a.headers?a.headers:{};return r.headers={...d,...s.headers},{url:We(i),options:r}},updateUser:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ge("updateUser","userId",t);const o="/user/{userId}".replace("{userId}",encodeURIComponent(String(t))),i=new URL(o,Be);let a;e&&(a=e.baseOptions);const r={method:"PUT",...a,...s},l={"Content-Type":"application/json"};He(i,{});let d=a&&a.headers?a.headers:{};return r.headers={...l,...d,...s.headers},r.data=Je(n,r,e),{url:We(i),options:r}},updateUserRole:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Ge("updateUserRole","userRoleRelId",t);const o="/user/modifyrole/{userRoleRelId}".replace("{userRoleRelId}",encodeURIComponent(String(t))),i=new URL(o,Be);let a;e&&(a=e.baseOptions);const r={method:"PUT",...a,...s},l={"Content-Type":"application/json"};He(i,{});let d=a&&a.headers?a.headers:{};return r.headers={...l,...d,...s.headers},r.data=Je(n,r,e),{url:We(i),options:r}}}}(e);return{async addRoleToUser(n,s){const o=await t.addRoleToUser(n,s);return $e(o,Me.default,Fe,e)},async addUser(n,s){const o=await t.addUser(n,s);return $e(o,Me.default,Fe,e)},async appointSubstituteUser(n,s){const o=await t.appointSubstituteUser(n,s);return $e(o,Me.default,Fe,e)},async deleteUser(n,s){const o=await t.deleteUser(n,s);return $e(o,Me.default,Fe,e)},async deleteUserRole(n,s){const o=await t.deleteUserRole(n,s);return $e(o,Me.default,Fe,e)},async findUsersByRoleId(n,s){const o=await t.findUsersByRoleId(n,s);return $e(o,Me.default,Fe,e)},async getAllClassifierUserRoleDtos(n){const s=await t.getAllClassifierUserRoleDtos(n);return $e(s,Me.default,Fe,e)},async getHealth(n){const s=await t.getHealth(n);return $e(s,Me.default,Fe,e)},async getJurUsers(n,s){const o=await t.getJurUsers(n,s);return $e(o,Me.default,Fe,e)},async getJurUsersWithoutGivenRole(n,s,o){const i=await t.getJurUsersWithoutGivenRole(n,s,o);return $e(i,Me.default,Fe,e)},async getUser(n,s){const o=await t.getUser(n,s);return $e(o,Me.default,Fe,e)},async getUserPossibleRecipients(n,s){const o=await t.getUserPossibleRecipients(n,s);return $e(o,Me.default,Fe,e)},async getUsers(n,s){const o=await t.getUsers(n,s);return $e(o,Me.default,Fe,e)},async getUsersJurPerson(n,s,o){const i=await t.getUsersJurPerson(n,s,o);return $e(i,Me.default,Fe,e)},async updateUser(n,s,o){const i=await t.updateUser(n,s,o);return $e(i,Me.default,Fe,e)},async updateUserRole(n,s,o){const i=await t.updateUserRole(n,s,o);return $e(i,Me.default,Fe,e)}}};class nt extends ke{addRoleToUser(e,t){return tt(this.configuration).addRoleToUser(e,t).then((e=>e(this.axios,this.basePath)))}addUser(e,t){return tt(this.configuration).addUser(e,t).then((e=>e(this.axios,this.basePath)))}appointSubstituteUser(e,t){return tt(this.configuration).appointSubstituteUser(e,t).then((e=>e(this.axios,this.basePath)))}deleteUser(e,t){return tt(this.configuration).deleteUser(e,t).then((e=>e(this.axios,this.basePath)))}deleteUserRole(e,t){return tt(this.configuration).deleteUserRole(e,t).then((e=>e(this.axios,this.basePath)))}findUsersByRoleId(e,t){return tt(this.configuration).findUsersByRoleId(e,t).then((e=>e(this.axios,this.basePath)))}getAllClassifierUserRoleDtos(e){return tt(this.configuration).getAllClassifierUserRoleDtos(e).then((e=>e(this.axios,this.basePath)))}getHealth(e){return tt(this.configuration).getHealth(e).then((e=>e(this.axios,this.basePath)))}getJurUsers(e,t){return tt(this.configuration).getJurUsers(e,t).then((e=>e(this.axios,this.basePath)))}getJurUsersWithoutGivenRole(e,t,n){return tt(this.configuration).getJurUsersWithoutGivenRole(e,t,n).then((e=>e(this.axios,this.basePath)))}getUser(e,t){return tt(this.configuration).getUser(e,t).then((e=>e(this.axios,this.basePath)))}getUserPossibleRecipients(e,t){return tt(this.configuration).getUserPossibleRecipients(e,t).then((e=>e(this.axios,this.basePath)))}getUsers(e,t){return tt(this.configuration).getUsers(e,t).then((e=>e(this.axios,this.basePath)))}getUsersJurPerson(e,t,n){return tt(this.configuration).getUsersJurPerson(e,t,n).then((e=>e(this.axios,this.basePath)))}updateUser(e,t,n){return tt(this.configuration).updateUser(e,t,n).then((e=>e(this.axios,this.basePath)))}updateUserRole(e,t,n){return tt(this.configuration).updateUserRole(e,t,n).then((e=>e(this.axios,this.basePath)))}}class st{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 ot="http://localhost:8080".replace(/\/+$/,"");class it{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ot,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Me.default;this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class at extends Error{constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const rt="https://example.com",lt=function(e,t,n){if(null==n)throw new at(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function dt(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>dt(e,t,n))):Object.keys(t).forEach((s=>dt(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];dt(t,s),e.search=t.toString()},ut=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},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 a={...e.options,url:((null==s?void 0:s.basePath)||o.defaults.baseURL||i)+e.url};return o.request(a)}},mt=function(e){const t=function(e){return{findIncomingDocuments:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};lt("findIncomingDocuments","documentBaseQueryDto",t);const s=new URL("/documents/incomingdocuments",rt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};ct(s,{});let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=ut(t,i,e),{url:pt(s),options:i}},findWorkingDocuments1:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};lt("findWorkingDocuments1","documentBaseQueryDto",t);const s=new URL("/documents/basedocuments",rt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};ct(s,{});let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=ut(t,i,e),{url:pt(s),options:i}}}}(e);return{async findIncomingDocuments(n,s){const o=await t.findIncomingDocuments(n,s);return ht(o,Me.default,ot,e)},async findWorkingDocuments1(n,s){const o=await t.findWorkingDocuments1(n,s);return ht(o,Me.default,ot,e)}}};class gt extends it{findIncomingDocuments(e,t){return mt(this.configuration).findIncomingDocuments(e,t).then((e=>e(this.axios,this.basePath)))}findWorkingDocuments1(e,t){return mt(this.configuration).findWorkingDocuments1(e,t).then((e=>e(this.axios,this.basePath)))}}const ft=function(e){const t=function(e){return{searchDetailBuildings:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};lt("searchDetailBuildings","buildingSearchDto",t);const s=new URL("/search/buildings",rt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};ct(s,{});let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=ut(t,i,e),{url:pt(s),options:i}},searchDetailDocuments:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};lt("searchDetailDocuments","documentSearchDto",t);const s=new URL("/search/documents",rt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};ct(s,{});let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=ut(t,i,e),{url:pt(s),options:i}},searchDetailProceedings:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};lt("searchDetailProceedings","proceedingSearchDto",t);const s=new URL("/search/proceedings",rt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};ct(s,{});let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=ut(t,i,e),{url:pt(s),options:i}}}}(e);return{async searchDetailBuildings(n,s){const o=await t.searchDetailBuildings(n,s);return ht(o,Me.default,ot,e)},async searchDetailDocuments(n,s){const o=await t.searchDetailDocuments(n,s);return ht(o,Me.default,ot,e)},async searchDetailProceedings(n,s){const o=await t.searchDetailProceedings(n,s);return ht(o,Me.default,ot,e)}}};class St extends it{searchDetailBuildings(e,t){return ft(this.configuration).searchDetailBuildings(e,t).then((e=>e(this.axios,this.basePath)))}searchDetailDocuments(e,t){return ft(this.configuration).searchDetailDocuments(e,t).then((e=>e(this.axios,this.basePath)))}searchDetailProceedings(e,t){return ft(this.configuration).searchDetailProceedings(e,t).then((e=>e(this.axios,this.basePath)))}}const It=function(e){const t=function(e){return{findOperationInvitations:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};lt("findOperationInvitations","operationQueryDto",t);const s=new URL("/myoperations/operationinvitations",rt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};ct(s,{});let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=ut(t,i,e),{url:pt(s),options:i}},findOperations:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};lt("findOperations","operationQueryDto",t);const s=new URL("/myoperations/myoperations",rt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};ct(s,{});let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=ut(t,i,e),{url:pt(s),options:i}},findOperationsToComment:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};lt("findOperationsToComment","operationQueryDto",t);const s=new URL("/myoperations/operationstocomment",rt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};ct(s,{});let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=ut(t,i,e),{url:pt(s),options:i}}}}(e);return{async findOperationInvitations(n,s){const o=await t.findOperationInvitations(n,s);return ht(o,Me.default,ot,e)},async findOperations(n,s){const o=await t.findOperations(n,s);return ht(o,Me.default,ot,e)},async findOperationsToComment(n,s){const o=await t.findOperationsToComment(n,s);return ht(o,Me.default,ot,e)}}};class Tt extends it{findOperationInvitations(e,t){return It(this.configuration).findOperationInvitations(e,t).then((e=>e(this.axios,this.basePath)))}findOperations(e,t){return It(this.configuration).findOperations(e,t).then((e=>e(this.axios,this.basePath)))}findOperationsToComment(e,t){return It(this.configuration).findOperationsToComment(e,t).then((e=>e(this.axios,this.basePath)))}}const Et=function(e){const t=function(e){return{findAreaProceedings:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};lt("findAreaProceedings","proceedingQueryDto",t);const s=new URL("/myproceedings/my-area-proceedings",rt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};ct(s,{});let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=ut(t,i,e),{url:pt(s),options:i}},findProceedings:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};lt("findProceedings","myProceedingsRequestDto",t);const s=new URL("/myproceedings/myproceedings",rt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};ct(s,{});let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=ut(t,i,e),{url:pt(s),options:i}}}}(e);return{async findAreaProceedings(n,s){const o=await t.findAreaProceedings(n,s);return ht(o,Me.default,ot,e)},async findProceedings(n,s){const o=await t.findProceedings(n,s);return ht(o,Me.default,ot,e)}}};class _t extends it{findAreaProceedings(e,t){return Et(this.configuration).findAreaProceedings(e,t).then((e=>e(this.axios,this.basePath)))}findProceedings(e,t){return Et(this.configuration).findProceedings(e,t).then((e=>e(this.axios,this.basePath)))}}class vt{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="http://localhost:8080".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]:Me.default;this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class Dt extends Error{constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const xt="https://example.com",Mt=function(e,t,n){if(null==n)throw new Dt(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},Nt=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 At=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()},Ut=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||""},wt=function(e){return e.pathname+e.search+e.hash},jt=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 a={...e.options,url:((null==s?void 0:s.basePath)||o.defaults.baseURL||i)+e.url};return o.request(a)}};const Ct=function(e){const t=function(e){return{addAuthz:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Mt("addAuthz","documentType",t),Mt("addAuthz","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/addAuthz".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,xt);let a;e&&(a=e.baseOptions);const r={method:"GET",...a,...s};At(i,{});let l=a&&a.headers?a.headers:{};return r.headers={...l,...s.headers},{url:wt(i),options:r}},apiVersion:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/version",xt);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};At(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:wt(n),options:o}},autoUpdateOwnershipType:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/document/updateOwnershipType",xt);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};At(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:wt(n),options:o}},createDoDokuDokuRel:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Mt("createDoDokuDokuRel","documentId",t),Mt("createDoDokuDokuRel","addEntityDto",n);const o="/document/{documentId}/createDoDokuDokuRel".replace("{documentId}",encodeURIComponent(String(t))),i=new URL(o,xt);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},l={};await Nt(l,e),l["Content-Type"]="application/json",At(i,{});let d=a&&a.headers?a.headers:{};return r.headers={...l,...d,...s.headers},r.data=Ut(n,r,e),{url:wt(i),options:r}},createDocument:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Mt("createDocument","documentType",t);const o="/document/{documentType}".replace("{documentType}",encodeURIComponent(String(t))),i=new URL(o,xt);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},l={};await Nt(l,e),l["Content-Type"]="application/json",At(i,{});let d=a&&a.headers?a.headers:{};return r.headers={...l,...d,...s.headers},r.data=Ut(n,r,e),{url:wt(i),options:r}},createNewVersion:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Mt("createNewVersion","documentType",t),Mt("createNewVersion","applicationNumber",n),Mt("createNewVersion","versionDto",s);const i="/document/{documentType}/{applicationNumber}/version/new".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),a=new URL(i,xt);let r;e&&(r=e.baseOptions);const l={method:"POST",...r,...o},d={};await Nt(d,e),d["Content-Type"]="application/json",At(a,{});let c=r&&r.headers?r.headers:{};return l.headers={...d,...c,...o.headers},l.data=Ut(s,l,e),{url:wt(a),options:l}},deleteApplicationByNumber:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Mt("deleteApplicationByNumber","documentType",t),Mt("deleteApplicationByNumber","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,xt);let a;e&&(a=e.baseOptions);const r={method:"DELETE",...a,...s},l={};await Nt(l,e),At(i,{});let d=a&&a.headers?a.headers:{};return r.headers={...l,...d,...s.headers},{url:wt(i),options:r}},endProceedingCircleDocuments:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Mt("endProceedingCircleDocuments","documentType",t),Mt("endProceedingCircleDocuments","applicationNumber",n),Mt("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))),a=new URL(i,xt);let r;e&&(r=e.baseOptions);const l={method:"POST",...r,...o},d={};await Nt(d,e),At(a,{});let c=r&&r.headers?r.headers:{};return l.headers={...d,...c,...o.headers},{url:wt(a),options:l}},getAccessRights:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Mt("getAccessRights","documentType",t),Mt("getAccessRights","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/rights".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,xt);let a;e&&(a=e.baseOptions);const r={method:"GET",...a,...s},l={};await Nt(l,e),At(i,{});let d=a&&a.headers?a.headers:{};return r.headers={...l,...d,...s.headers},{url:wt(i),options:r}},getApplicationById:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Mt("getApplicationById","documentId",t);const s="/document/{documentId}".replace("{documentId}",encodeURIComponent(String(t))),o=new URL(s,xt);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n},r={};await Nt(r,e),At(o,{});let l=i&&i.headers?i.headers:{};return a.headers={...r,...l,...n.headers},{url:wt(o),options:a}},getApplicationByNumber:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Mt("getApplicationByNumber","documentType",t),Mt("getApplicationByNumber","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,xt);let a;e&&(a=e.baseOptions);const r={method:"GET",...a,...s},l={};await Nt(l,e),At(i,{});let d=a&&a.headers?a.headers:{};return r.headers={...l,...d,...s.headers},{url:wt(i),options:r}},getApplicationByNumberOld:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Mt("getApplicationByNumberOld","ehrCode",t),Mt("getApplicationByNumberOld","applicationNumber",n);const o="/document/old/{ehrCode}/{applicationNumber}".replace("{ehrCode}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,xt);let a;e&&(a=e.baseOptions);const r={method:"GET",...a,...s},l={};await Nt(l,e),At(i,{});let d=a&&a.headers?a.headers:{};return r.headers={...l,...d,...s.headers},{url:wt(i),options:r}},getApplicationByNumberWithVersion:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Mt("getApplicationByNumberWithVersion","documentType",t),Mt("getApplicationByNumberWithVersion","applicationNumber",n),Mt("getApplicationByNumberWithVersion","version",s);const i="/document/{documentType}/{applicationNumber}/{version}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))).replace("{version}",encodeURIComponent(String(s))),a=new URL(i,xt);let r;e&&(r=e.baseOptions);const l={method:"GET",...r,...o},d={};await Nt(d,e),At(a,{});let c=r&&r.headers?r.headers:{};return l.headers={...d,...c,...o.headers},{url:wt(a),options:l}},getApplicationStateFee:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Mt("getApplicationStateFee","documentType",t),Mt("getApplicationStateFee","applicationNumber",n),Mt("getApplicationStateFee","applicationDto",s);const i="/document/{documentType}/{applicationNumber}/stateFee".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),a=new URL(i,xt);let r;e&&(r=e.baseOptions);const l={method:"POST",...r,...o},d={};await Nt(d,e),d["Content-Type"]="application/json",At(a,{});let c=r&&r.headers?r.headers:{};return l.headers={...d,...c,...o.headers},l.data=Ut(s,l,e),{url:wt(a),options:l}},getApplicationStateFeeOfVersion:async function(t,n,s,o){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};Mt("getApplicationStateFeeOfVersion","documentType",t),Mt("getApplicationStateFeeOfVersion","applicationNumber",n),Mt("getApplicationStateFeeOfVersion","version",s),Mt("getApplicationStateFeeOfVersion","applicationDto",o);const a="/document/{documentType}/{applicationNumber}/{version}/stateFee".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))).replace("{version}",encodeURIComponent(String(s))),r=new URL(a,xt);let l;e&&(l=e.baseOptions);const d={method:"POST",...l,...i},c={};await Nt(c,e),c["Content-Type"]="application/json",At(r,{});let u=l&&l.headers?l.headers:{};return d.headers={...c,...u,...i.headers},d.data=Ut(o,d,e),{url:wt(r),options:d}},getDocumentFileRels:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Mt("getDocumentFileRels","docNr",t);const s=new URL("/document/fileRels",xt);let o;e&&(o=e.baseOptions);const i={method:"GET",...o,...n},a={},r={};await Nt(a,e),void 0!==t&&(r.docNr=t),At(s,r);let l=o&&o.headers?o.headers:{};return i.headers={...a,...l,...n.headers},{url:wt(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",xt);let o;e&&(o=e.baseOptions);const i={method:"GET",...o,...n},a={};void 0!==t&&(a.ehrCode=t),At(s,a);let r=o&&o.headers?o.headers:{};return i.headers={...r,...n.headers},{url:wt(s),options:i}},getHealth:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/health",xt);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};At(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:wt(n),options:o}},getLastStateHistory:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Mt("getLastStateHistory","documentType",t),Mt("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,xt);let a;e&&(a=e.baseOptions);const r={method:"GET",...a,...s};At(i,{});let l=a&&a.headers?a.headers:{};return r.headers={...l,...s.headers},{url:wt(i),options:r}},initializeAds:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Mt("initializeAds","documentType",t),Mt("initializeAds","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/initAds".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,xt);let a;e&&(a=e.baseOptions);const r={method:"GET",...a,...s};At(i,{});let l=a&&a.headers?a.headers:{};return r.headers={...l,...s.headers},{url:wt(i),options:r}},mergeInstitutions:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Mt("mergeInstitutions","mergeInstitutionsDTO",t);const s=new URL("/document/merge",xt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};At(s,{});let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=Ut(t,i,e),{url:wt(s),options:i}},reSubmit:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Mt("reSubmit","documentType",t),Mt("reSubmit","applicationNumber",n),Mt("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))),a=new URL(i,xt);let r;e&&(r=e.baseOptions);const l={method:"POST",...r,...o},d={};await Nt(d,e),At(a,{});let c=r&&r.headers?r.headers:{};return l.headers={...d,...c,...o.headers},{url:wt(a),options:l}},recalculatestate:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Mt("recalculatestate","documentType",t),Mt("recalculatestate","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/recalculatedetailstate".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,xt);let a;e&&(a=e.baseOptions);const r={method:"GET",...a,...s};At(i,{});let l=a&&a.headers?a.headers:{};return r.headers={...l,...s.headers},{url:wt(i),options:r}},revertCreateNewVersion:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Mt("revertCreateNewVersion","documentType",t),Mt("revertCreateNewVersion","applicationNumber",n),Mt("revertCreateNewVersion","versionDto",s);const i="/document/{documentType}/{applicationNumber}/version/revert".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),a=new URL(i,xt);let r;e&&(r=e.baseOptions);const l={method:"POST",...r,...o},d={};await Nt(d,e),d["Content-Type"]="application/json",At(a,{});let c=r&&r.headers?r.headers:{};return l.headers={...d,...c,...o.headers},l.data=Ut(s,l,e),{url:wt(a),options:l}},saveAndValidate:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Mt("saveAndValidate","documentType",t),Mt("saveAndValidate","applicationNumber",n),Mt("saveAndValidate","applicationDto",s);const i="/document/{documentType}/{applicationNumber}/saveAndValidate".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),a=new URL(i,xt);let r;e&&(r=e.baseOptions);const l={method:"POST",...r,...o},d={};await Nt(d,e),d["Content-Type"]="application/json",At(a,{});let c=r&&r.headers?r.headers:{};return l.headers={...d,...c,...o.headers},l.data=Ut(s,l,e),{url:wt(a),options:l}},saveApplicationByNumber:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Mt("saveApplicationByNumber","documentType",t),Mt("saveApplicationByNumber","applicationNumber",n),Mt("saveApplicationByNumber","applicationDto",s);const i="/document/{documentType}/{applicationNumber}".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),a=new URL(i,xt);let r;e&&(r=e.baseOptions);const l={method:"PUT",...r,...o},d={};await Nt(d,e),d["Content-Type"]="application/json",At(a,{});let c=r&&r.headers?r.headers:{};return l.headers={...d,...c,...o.headers},l.data=Ut(s,l,e),{url:wt(a),options:l}},setWaterExtractionPointsTestDates:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Mt("setWaterExtractionPointsTestDates","documentType",t),Mt("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,xt);let a;e&&(a=e.baseOptions);const r={method:"PUT",...a,...s},l={};await Nt(l,e),At(i,{});let d=a&&a.headers?a.headers:{};return r.headers={...l,...d,...s.headers},{url:wt(i),options:r}},setWaterExtractionPointsTestDatesForBuilding:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Mt("setWaterExtractionPointsTestDatesForBuilding","documentType",t),Mt("setWaterExtractionPointsTestDatesForBuilding","applicationNumber",n),Mt("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))),a=new URL(i,xt);let r;e&&(r=e.baseOptions);const l={method:"PUT",...r,...o},d={};await Nt(d,e),At(a,{});let c=r&&r.headers?r.headers:{};return l.headers={...d,...c,...o.headers},{url:wt(a),options:l}},submitStraightToRegistry:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Mt("submitStraightToRegistry","documentType",t),Mt("submitStraightToRegistry","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/submitToRegistry".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,xt);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},l={};await Nt(l,e),At(i,{});let d=a&&a.headers?a.headers:{};return r.headers={...l,...d,...s.headers},{url:wt(i),options:r}},submitToProcessing:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Mt("submitToProcessing","documentType",t),Mt("submitToProcessing","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/submitToProcessing".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,xt);let a;e&&(a=e.baseOptions);const r={method:"PUT",...a,...s},l={};await Nt(l,e),At(i,{});let d=a&&a.headers?a.headers:{};return r.headers={...l,...d,...s.headers},{url:wt(i),options:r}},submitToSigning:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Mt("submitToSigning","documentType",t),Mt("submitToSigning","applicationNumber",n),Mt("submitToSigning","applicationDto",s);const i="/document/{documentType}/{applicationNumber}/submitToSigning".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),a=new URL(i,xt);let r;e&&(r=e.baseOptions);const l={method:"PUT",...r,...o},d={};await Nt(d,e),d["Content-Type"]="application/json",At(a,{});let c=r&&r.headers?r.headers:{};return l.headers={...d,...c,...o.headers},l.data=Ut(s,l,e),{url:wt(a),options:l}},submitToSupervisorProcessing:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Mt("submitToSupervisorProcessing","documentType",t),Mt("submitToSupervisorProcessing","applicationNumber",n),Mt("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))),a=new URL(i,xt);let r;e&&(r=e.baseOptions);const l={method:"POST",...r,...o},d={};await Nt(d,e),At(a,{});let c=r&&r.headers?r.headers:{};return l.headers={...d,...c,...o.headers},{url:wt(a),options:l}},validateSavedDocument:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Mt("validateSavedDocument","documentType",t),Mt("validateSavedDocument","applicationNumber",n);const o="/document/{documentType}/{applicationNumber}/completeApplicationChecks".replace("{documentType}",encodeURIComponent(String(t))).replace("{applicationNumber}",encodeURIComponent(String(n))),i=new URL(o,xt);let a;e&&(a=e.baseOptions);const r={method:"GET",...a,...s};At(i,{});let l=a&&a.headers?a.headers:{};return r.headers={...l,...s.headers},{url:wt(i),options:r}}}}(e);return{async addAuthz(n,s,o){const i=await t.addAuthz(n,s,o);return jt(i,Me.default,yt,e)},async apiVersion(n){const s=await t.apiVersion(n);return jt(s,Me.default,yt,e)},async autoUpdateOwnershipType(n){const s=await t.autoUpdateOwnershipType(n);return jt(s,Me.default,yt,e)},async createDoDokuDokuRel(n,s,o){const i=await t.createDoDokuDokuRel(n,s,o);return jt(i,Me.default,yt,e)},async createDocument(n,s,o){const i=await t.createDocument(n,s,o);return jt(i,Me.default,yt,e)},async createNewVersion(n,s,o,i){const a=await t.createNewVersion(n,s,o,i);return jt(a,Me.default,yt,e)},async deleteApplicationByNumber(n,s,o){const i=await t.deleteApplicationByNumber(n,s,o);return jt(i,Me.default,yt,e)},async endProceedingCircleDocuments(n,s,o,i){const a=await t.endProceedingCircleDocuments(n,s,o,i);return jt(a,Me.default,yt,e)},async getAccessRights(n,s,o){const i=await t.getAccessRights(n,s,o);return jt(i,Me.default,yt,e)},async getApplicationById(n,s){const o=await t.getApplicationById(n,s);return jt(o,Me.default,yt,e)},async getApplicationByNumber(n,s,o){const i=await t.getApplicationByNumber(n,s,o);return jt(i,Me.default,yt,e)},async getApplicationByNumberOld(n,s,o){const i=await t.getApplicationByNumberOld(n,s,o);return jt(i,Me.default,yt,e)},async getApplicationByNumberWithVersion(n,s,o,i){const a=await t.getApplicationByNumberWithVersion(n,s,o,i);return jt(a,Me.default,yt,e)},async getApplicationStateFee(n,s,o,i){const a=await t.getApplicationStateFee(n,s,o,i);return jt(a,Me.default,yt,e)},async getApplicationStateFeeOfVersion(n,s,o,i,a){const r=await t.getApplicationStateFeeOfVersion(n,s,o,i,a);return jt(r,Me.default,yt,e)},async getDocumentFileRels(n,s){const o=await t.getDocumentFileRels(n,s);return jt(o,Me.default,yt,e)},async getDotysBasedOnUserRights(n,s){const o=await t.getDotysBasedOnUserRights(n,s);return jt(o,Me.default,yt,e)},async getHealth(n){const s=await t.getHealth(n);return jt(s,Me.default,yt,e)},async getLastStateHistory(n,s,o){const i=await t.getLastStateHistory(n,s,o);return jt(i,Me.default,yt,e)},async initializeAds(n,s,o){const i=await t.initializeAds(n,s,o);return jt(i,Me.default,yt,e)},async mergeInstitutions(n,s){const o=await t.mergeInstitutions(n,s);return jt(o,Me.default,yt,e)},async reSubmit(n,s,o,i){const a=await t.reSubmit(n,s,o,i);return jt(a,Me.default,yt,e)},async recalculatestate(n,s,o){const i=await t.recalculatestate(n,s,o);return jt(i,Me.default,yt,e)},async revertCreateNewVersion(n,s,o,i){const a=await t.revertCreateNewVersion(n,s,o,i);return jt(a,Me.default,yt,e)},async saveAndValidate(n,s,o,i){const a=await t.saveAndValidate(n,s,o,i);return jt(a,Me.default,yt,e)},async saveApplicationByNumber(n,s,o,i){const a=await t.saveApplicationByNumber(n,s,o,i);return jt(a,Me.default,yt,e)},async setWaterExtractionPointsTestDates(n,s,o){const i=await t.setWaterExtractionPointsTestDates(n,s,o);return jt(i,Me.default,yt,e)},async setWaterExtractionPointsTestDatesForBuilding(n,s,o,i){const a=await t.setWaterExtractionPointsTestDatesForBuilding(n,s,o,i);return jt(a,Me.default,yt,e)},async submitStraightToRegistry(n,s,o){const i=await t.submitStraightToRegistry(n,s,o);return jt(i,Me.default,yt,e)},async submitToProcessing(n,s,o){const i=await t.submitToProcessing(n,s,o);return jt(i,Me.default,yt,e)},async submitToSigning(n,s,o,i){const a=await t.submitToSigning(n,s,o,i);return jt(a,Me.default,yt,e)},async submitToSupervisorProcessing(n,s,o,i){const a=await t.submitToSupervisorProcessing(n,s,o,i);return jt(a,Me.default,yt,e)},async validateSavedDocument(n,s,o){const i=await t.validateSavedDocument(n,s,o);return jt(i,Me.default,yt,e)}}};class Lt extends bt{addAuthz(e,t,n){return Ct(this.configuration).addAuthz(e,t,n).then((e=>e(this.axios,this.basePath)))}apiVersion(e){return Ct(this.configuration).apiVersion(e).then((e=>e(this.axios,this.basePath)))}autoUpdateOwnershipType(e){return Ct(this.configuration).autoUpdateOwnershipType(e).then((e=>e(this.axios,this.basePath)))}createDoDokuDokuRel(e,t,n){return Ct(this.configuration).createDoDokuDokuRel(e,t,n).then((e=>e(this.axios,this.basePath)))}createDocument(e,t,n){return Ct(this.configuration).createDocument(e,t,n).then((e=>e(this.axios,this.basePath)))}createNewVersion(e,t,n,s){return Ct(this.configuration).createNewVersion(e,t,n,s).then((e=>e(this.axios,this.basePath)))}deleteApplicationByNumber(e,t,n){return Ct(this.configuration).deleteApplicationByNumber(e,t,n).then((e=>e(this.axios,this.basePath)))}endProceedingCircleDocuments(e,t,n,s){return Ct(this.configuration).endProceedingCircleDocuments(e,t,n,s).then((e=>e(this.axios,this.basePath)))}getAccessRights(e,t,n){return Ct(this.configuration).getAccessRights(e,t,n).then((e=>e(this.axios,this.basePath)))}getApplicationById(e,t){return Ct(this.configuration).getApplicationById(e,t).then((e=>e(this.axios,this.basePath)))}getApplicationByNumber(e,t,n){return Ct(this.configuration).getApplicationByNumber(e,t,n).then((e=>e(this.axios,this.basePath)))}getApplicationByNumberOld(e,t,n){return Ct(this.configuration).getApplicationByNumberOld(e,t,n).then((e=>e(this.axios,this.basePath)))}getApplicationByNumberWithVersion(e,t,n,s){return Ct(this.configuration).getApplicationByNumberWithVersion(e,t,n,s).then((e=>e(this.axios,this.basePath)))}getApplicationStateFee(e,t,n,s){return Ct(this.configuration).getApplicationStateFee(e,t,n,s).then((e=>e(this.axios,this.basePath)))}getApplicationStateFeeOfVersion(e,t,n,s,o){return Ct(this.configuration).getApplicationStateFeeOfVersion(e,t,n,s,o).then((e=>e(this.axios,this.basePath)))}getDocumentFileRels(e,t){return Ct(this.configuration).getDocumentFileRels(e,t).then((e=>e(this.axios,this.basePath)))}getDotysBasedOnUserRights(e,t){return Ct(this.configuration).getDotysBasedOnUserRights(e,t).then((e=>e(this.axios,this.basePath)))}getHealth(e){return Ct(this.configuration).getHealth(e).then((e=>e(this.axios,this.basePath)))}getLastStateHistory(e,t,n){return Ct(this.configuration).getLastStateHistory(e,t,n).then((e=>e(this.axios,this.basePath)))}initializeAds(e,t,n){return Ct(this.configuration).initializeAds(e,t,n).then((e=>e(this.axios,this.basePath)))}mergeInstitutions(e,t){return Ct(this.configuration).mergeInstitutions(e,t).then((e=>e(this.axios,this.basePath)))}reSubmit(e,t,n,s){return Ct(this.configuration).reSubmit(e,t,n,s).then((e=>e(this.axios,this.basePath)))}recalculatestate(e,t,n){return Ct(this.configuration).recalculatestate(e,t,n).then((e=>e(this.axios,this.basePath)))}revertCreateNewVersion(e,t,n,s){return Ct(this.configuration).revertCreateNewVersion(e,t,n,s).then((e=>e(this.axios,this.basePath)))}saveAndValidate(e,t,n,s){return Ct(this.configuration).saveAndValidate(e,t,n,s).then((e=>e(this.axios,this.basePath)))}saveApplicationByNumber(e,t,n,s){return Ct(this.configuration).saveApplicationByNumber(e,t,n,s).then((e=>e(this.axios,this.basePath)))}setWaterExtractionPointsTestDates(e,t,n){return Ct(this.configuration).setWaterExtractionPointsTestDates(e,t,n).then((e=>e(this.axios,this.basePath)))}setWaterExtractionPointsTestDatesForBuilding(e,t,n,s){return Ct(this.configuration).setWaterExtractionPointsTestDatesForBuilding(e,t,n,s).then((e=>e(this.axios,this.basePath)))}submitStraightToRegistry(e,t,n){return Ct(this.configuration).submitStraightToRegistry(e,t,n).then((e=>e(this.axios,this.basePath)))}submitToProcessing(e,t,n){return Ct(this.configuration).submitToProcessing(e,t,n).then((e=>e(this.axios,this.basePath)))}submitToSigning(e,t,n,s){return Ct(this.configuration).submitToSigning(e,t,n,s).then((e=>e(this.axios,this.basePath)))}submitToSupervisorProcessing(e,t,n,s){return Ct(this.configuration).submitToSupervisorProcessing(e,t,n,s).then((e=>e(this.axios,this.basePath)))}validateSavedDocument(e,t,n){return Ct(this.configuration).validateSavedDocument(e,t,n).then((e=>e(this.axios,this.basePath)))}}class Pt{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 Rt="https://devkluster.ehr.ee/api/file-upload-api/v1".replace(/\/+$/,"");class Kt{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Rt,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Me.default;this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class Ft extends Error{constructor(e,t){super(t),this.name="RequiredError",this.field=e}}const kt="https://example.com",Yt=function(e,t,n){if(null==n)throw new Ft(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},Bt=async function(e,t){if(t&&t.accessToken){const n="function"==typeof t.accessToken?await t.accessToken():await t.accessToken;e.Authorization="Bearer "+n}},Gt=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||""},Ht=function(e){return e.pathname+e.search+e.hash},Jt=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 a={...e.options,url:((null==s?void 0:s.basePath)||i)+e.url};return o.request(a)}},Wt=function(e){const t=function(e){return{cloneFilesAndCreateRels:async function(t,n,s){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};Yt("cloneFilesAndCreateRels","fileIds",t);const i=new URL("/fileClone",kt);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...o},l={},d={};await Bt(l,e),t&&(d.fileIds=t),void 0!==n&&(d.docNr=n),void 0!==s&&(d.relType=s),Gt(i,d);let c=a&&a.headers?a.headers:{};return r.headers={...l,...c,...o.headers},{url:Ht(i),options:r}},deleteFile:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Yt("deleteFile","fileId",t);const s="/file/{fileId}".replace("{fileId}",encodeURIComponent(String(t))),o=new URL(s,kt);let i;e&&(i=e.baseOptions);const a={method:"DELETE",...i,...n},r={};await Bt(r,e),Gt(o,{});let l=i&&i.headers?i.headers:{};return a.headers={...r,...l,...n.headers},{url:Ht(o),options:a}},downloadFile:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Yt("downloadFile","fileId",t);const s="/file/{fileId}".replace("{fileId}",encodeURIComponent(String(t))),o=new URL(s,kt);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n},r={};await Bt(r,e),Gt(o,{});let l=i&&i.headers?i.headers:{};return a.headers={...r,...l,...n.headers},{url:Ht(o),options:a}},updateFile:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Yt("updateFile","fileId",t);const o="/file/{fileId}".replace("{fileId}",encodeURIComponent(String(t))),i=new URL(o,kt);let a;e&&(a=e.baseOptions);const r={method:"PUT",...a,...s},l={};await Bt(l,e),l["Content-Type"]="application/json",Gt(i,{});let d=a&&a.headers?a.headers:{};return r.headers={...l,...d,...s.headers},r.data=Vt(n,r,e),{url:Ht(i),options:r}},updateFileInfo:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Yt("updateFileInfo","doFail",t);const s=new URL("/file/info",kt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={};await Bt(a,e),a["Content-Type"]="application/json",Gt(s,{});let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=Vt(t,i,e),{url:Ht(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},a={},r=new(e&&e.formDataCtor||FormData);await Bt(a,e),void 0!==t&&r.append("file",t),a["Content-Type"]="multipart/form-data",Gt(s,{});let l=o&&o.headers?o.headers:{};return i.headers={...a,...l,...n.headers},i.data=r,{url:Ht(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 a={method:"POST",...i,...s},r={},l=new(e&&e.formDataCtor||FormData);await Bt(r,e),void 0!==t&&l.append("file",t),void 0!==n&&l.append("fileInfo",new Blob([JSON.stringify(n)],{type:"application/json"})),r["Content-Type"]="multipart/form-data",Gt(o,{});let d=i&&i.headers?i.headers:{};return a.headers={...r,...d,...s.headers},a.data=l,{url:Ht(o),options:a}},uploadFileWithFileInfoAndDocRel:async function(t,n,s,o){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const a=new URL("/fileWithInfoAndDocRel",kt);let r;e&&(r=e.baseOptions);const l={method:"POST",...r,...i},d={},c=new(e&&e.formDataCtor||FormData);await Bt(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",Gt(a,{});let u=r&&r.headers?r.headers:{};return l.headers={...d,...u,...i.headers},l.data=c,{url:Ht(a),options:l}}}}(e);return{async cloneFilesAndCreateRels(n,s,o,i){const a=await t.cloneFilesAndCreateRels(n,s,o,i);return Jt(a,Me.default,Rt,e)},async deleteFile(n,s){const o=await t.deleteFile(n,s);return Jt(o,Me.default,Rt,e)},async downloadFile(n,s){const o=await t.downloadFile(n,s);return Jt(o,Me.default,Rt,e)},async updateFile(n,s,o){const i=await t.updateFile(n,s,o);return Jt(i,Me.default,Rt,e)},async updateFileInfo(n,s){const o=await t.updateFileInfo(n,s);return Jt(o,Me.default,Rt,e)},async uploadFile(n,s){const o=await t.uploadFile(n,s);return Jt(o,Me.default,Rt,e)},async uploadFileWithFileInfo(n,s,o){const i=await t.uploadFileWithFileInfo(n,s,o);return Jt(i,Me.default,Rt,e)},async uploadFileWithFileInfoAndDocRel(n,s,o,i,a){const r=await t.uploadFileWithFileInfoAndDocRel(n,s,o,i,a);return Jt(r,Me.default,Rt,e)}}};class $t extends Kt{cloneFilesAndCreateRels(e,t,n,s){return Wt(this.configuration).cloneFilesAndCreateRels(e,t,n,s).then((e=>e(this.axios,this.basePath)))}deleteFile(e,t){return Wt(this.configuration).deleteFile(e,t).then((e=>e(this.axios,this.basePath)))}downloadFile(e,t){return Wt(this.configuration).downloadFile(e,t).then((e=>e(this.axios,this.basePath)))}updateFile(e,t,n){return Wt(this.configuration).updateFile(e,t,n).then((e=>e(this.axios,this.basePath)))}updateFileInfo(e,t){return Wt(this.configuration).updateFileInfo(e,t).then((e=>e(this.axios,this.basePath)))}uploadFile(e,t){return Wt(this.configuration).uploadFile(e,t).then((e=>e(this.axios,this.basePath)))}uploadFileWithFileInfo(e,t,n){return Wt(this.configuration).uploadFileWithFileInfo(e,t,n).then((e=>e(this.axios,this.basePath)))}uploadFileWithFileInfoAndDocRel(e,t,n,s,o){return Wt(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 zt="https://devkluster.ehr.ee/api/yld-esi/v1".replace(/\/+$/,"");class Xt{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:zt,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Me.default;this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class Qt extends Error{constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const Zt="https://example.com",en=function(e,t,n){if(null==n)throw new Qt(t,`Required parameter ${t} was null or undefined when calling ${e}.`)};function tn(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>tn(e,t,n))):Object.keys(t).forEach((s=>tn(e,t[s],`${n}${""!==n?".":""}${s}`))):e.has(n)?e.append(n,t):e.set(n,t))}const nn=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];tn(t,s),e.search=t.toString()},sn=function(e){return e.pathname+e.search+e.hash},on=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 a={...e.options,url:((null==s?void 0:s.basePath)||o.defaults.baseURL||i)+e.url};return o.request(a)}};const an=function(e){return{esileht:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};en("esileht","id",t),en("esileht","language",n);const o="/public/page/{id}/{language}".replace("{id}",encodeURIComponent(String(t))).replace("{language}",encodeURIComponent(String(n))),i=new URL(o,Zt);let a;e&&(a=e.baseOptions);const r={method:"GET",...a,...s};nn(i,{});let l=a&&a.headers?a.headers:{};return r.headers={...l,...s.headers},{url:sn(i),options:r}},lehed:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/api/pages",Zt);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};nn(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:sn(n),options:o}},lehedId:async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=new URL("/api/pages/dotyid",Zt);let s;e&&(s=e.baseOptions);const o={method:"GET",...s,...t};nn(n,{});let i=s&&s.headers?s.headers:{};return o.headers={...i,...t.headers},{url:sn(n),options:o}},leht:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};en("leht","id",t);const s="/api/pages/{id}".replace("{id}",encodeURIComponent(String(t))),o=new URL(s,Zt);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...n};nn(o,{});let r=i&&i.headers?i.headers:{};return a.headers={...r,...n.headers},{url:sn(o),options:a}},lehtdSave:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};en("lehtdSave","esileht",t);const s=new URL("/api/pages",Zt);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={};a["Content-Type"]="application/json",nn(s,{});let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...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:sn(s),options:i}}}},rn=function(e){const t=an(e);return{async esileht(n,s,o){const i=await t.esileht(n,s,o);return on(i,Me.default,zt,e)},async lehed(n){const s=await t.lehed(n);return on(s,Me.default,zt,e)},async lehedId(n){const s=await t.lehedId(n);return on(s,Me.default,zt,e)},async leht(n,s){const o=await t.leht(n,s);return on(o,Me.default,zt,e)},async lehtdSave(n,s){const o=await t.lehtdSave(n,s);return on(o,Me.default,zt,e)}}};class ln extends Xt{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 dn{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 cn={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},un={proceedingApiService:new _t(new vt({basePath:cn.myViewsApiEndpoint})),classifierApiService:new Re(new Ke({basePath:cn.classifierApiEndpoint})),personApiService:new Qe(new st({basePath:cn.userApiEndpoint})),userApiService:new nt(new st({basePath:cn.userApiEndpoint})),myDocumentBaseApiService:new gt(new vt({basePath:cn.myViewsApiEndpoint})),documentApiService:new Lt(new Pt({basePath:cn.documentApiEndpoint})),fileApiService:new $t(new qt({basePath:cn.fileUploadApiEndpoint})),frontPageApi:new ln(new dn({basePath:cn.frontPageApiEndpoint})),institutionKovEndpointApi:new ze(new st({basePath:cn.userApiEndpoint}))};var pn=c(848);const hn=11272,mn=e=>{var t;let{userInfo:n}=e;const s=(0,z.useIntl)(),[o,i]=(0,q.useState)(!0),[a,r]=(0,q.useState)(""),[l,d]=(0,q.useState)(""),c=(null===(t=n.activeRole)||void 0===t?void 0:t.businessType)===me.MKM;(0,q.useEffect)((()=>{c?u():p()}),[]);const u=async()=>{un.frontPageApi.leht(hn).then((e=>{const t=e.data;t[0].body&&(r(t[0].body),d(t[0].body))}))},p=async()=>{un.frontPageApi.esileht(hn,"ee").then((e=>{const t=e.data;t.body&&(r(t.body),d(t.body))}))};return(0,pn.jsx)(X.Section,{collapsed:!1,title:"my_admin_proceedings.admin_proceedings_reminder",showSettings:!0,children:(0,pn.jsxs)("div",{className:o?"d-flex justify-content-between":"",children:[(0,pn.jsx)(X.RichTextEditor,{placeholder:o?"":s.formatMessage({id:"placeholder.writing"}),onChange:e=>d(e),value:l,readOnly:o,view:o}),c&&o&&(0,pn.jsx)(X.Link,{onClick:()=>i(!1),type:"edit"}),!o&&(0,pn.jsxs)("div",{className:"pt-2",children:[(0,pn.jsx)(X.Button,{colourScheme:"light",squared:!0,onClick:()=>{d(a),i(!0)},children:s.formatMessage({id:"button.cancel"})}),(0,pn.jsx)(X.Button,{className:"float-right",colourScheme:"success",squared:!0,onClick:()=>(async()=>{i(!o),r(l),un.frontPageApi.lehtdSave({id:hn,body:l,language:"ee"})})(),children:s.formatMessage({id:"button.save"})})]})]})})},gn={default:"header-arrow-up-down-icon",des:"header-arrow-down-icon",asc:"header-arrow-up-icon"},fn=e=>(0,pn.jsx)(X.Tooltip,{content:(0,pn.jsx)(X.Text,{raw:e.tooltipText}),placement:"bottom",theme:"dark",children:e.functionCall?(0,pn.jsx)(X.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,pn.jsx)(X.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,z.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,pn.jsx)(fn,{linkName:t.proceedingNr,tooltipText:"detailsearch.tooltip.open_proceeding",functionCall:e=>{n(!0,e,void 0,`administrativeActProceeding/${t.proceedingNr}`)}}):(0,pn.jsx)(pn.Fragment,{children:"-"});var t}},{id:"doty",property:"document",size:160,getValue:e=>e.document&&null!==e.document?(0,pn.jsx)(fn,{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,pn.jsxs)(pn.Fragment,{children:[(0,pn.jsx)(fn,{linkName:t,tooltipText:"detailsearch.tooltip.open_building",functionCall:e=>{n(!0,e,"BUILDING",t)}}),s!==e.ehrCode.length-1?(0,pn.jsx)("span",{children:", "}):""]}))):""},{id:"proceeding_state",property:"state",size:130,getValue:e=>e.state}];return(0,pn.jsx)(X.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:gn,expandableRow:!1,isFilter:!1}},data:t,handleEvent:()=>!0})},In=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const[n,s]=(0,q.useState)(!1),[o,i]=(0,q.useState)(void 0),[a,r]=(0,q.useState)([]);(0,q.useEffect)((()=>{i(void 0),l()}),[e,t]);const l=async()=>{var n;if((null===(n=e.activeRole)||void 0===n?void 0:n.businessType)===me.TJA){s(!0);try{var o;const n=t?{institutionId:e.activeRole.businessId}:{userId:e.userId},s=await un.proceedingApiService.findAreaProceedings(n);r(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 r([])};return{loading:n,proceedings:a,error:o}},Tn=e=>{let{userInfo:t,linkGen:n}=e;const s=(0,z.useIntl)(),[o,i]=(0,q.useState)(!1),{loading:a,error:r,proceedings:l}=In(t,o);return(0,pn.jsxs)(X.Section,{collapsed:!1,title:"my_admin_proceedings.my_proceedings",showSettings:!0,children:[r&&(0,pn.jsx)(X.MessageBlock,{dismissible:!1,theme:"danger",children:s.formatMessage({id:r})}),a&&(0,pn.jsxs)(X.Row,{className:"mb-4 justify-content-center",children:[(0,pn.jsx)("br",{}),(0,pn.jsx)(X.Loader,{}),(0,pn.jsx)("br",{})]}),!a&&!(null==l||!l.length)&&!r&&(0,pn.jsx)(Sn,{proceedings:l,linkGen:n}),(0,pn.jsx)("div",{className:"d-flex justify-content-start my-2",children:(0,pn.jsx)(X.Checkbox,{name:"checkbox",onChange:e=>i(e),text:s.formatMessage({id:"my_proceedings.view_all_institution_admin_proceedings"}),checked:o})})]})},En=e=>{var t;let{userInfo:n,linkGen:s}=e;const o=(0,z.useIntl)(),i=(null===(t=n.activeRole)||void 0===t?void 0:t.businessType)===me.TJA;return(0,pn.jsxs)("div",{children:[(0,pn.jsx)("h2",{children:o.formatMessage({id:"my_admin_proceedings.page_title"})}),i&&(0,pn.jsx)("div",{className:"d-flex justify-content-end mt-2",children:(0,pn.jsx)(X.Button,{withPlus:!0,type:"submit",onClick:()=>{s(!0,void 0,"","/administrativeActProceeding")},children:o.formatMessage({id:"my_admin_proceedings.new_proceeding"})})}),(0,pn.jsx)(mn,{userInfo:n}),i&&(0,pn.jsx)(Tn,{userInfo:n,linkGen:s})]})};const _n=(e=>{var t={};return c.d(t,e),t})({useDispatch:()=>i.useDispatch,useSelector:()=>i.useSelector});const vn=(e=>{var t={};return c.d(t,e),t})({default:()=>a.default});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),a=Dn(o);return a===i?0:i>a?1:-1}function Mn(e,t,n){const s=n(e),o=n(t);return s===o?0:s>o?1:-1}function Nn(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 On=0,An=1,Un=-1;function wn(e,t){return{column:e,direction:e===t.column?function(e){switch(e){case On:return An;case An:return Un;case Un:return An}}(t.direction):An}}const jn=e=>-1===e.sortDirection?(0,pn.jsx)("svg",{width:"10",height:"8",viewBox:"0 8 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,pn.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,pn.jsx)("svg",{width:"10",height:"8",viewBox:"0 0 10 8",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,pn.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,pn.jsx)("svg",{width:"10",height:"16",viewBox:"0 0 10 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,pn.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,q.useState)(!1);return(0,pn.jsx)(pn.Fragment,{children:e.fileId&&(0,pn.jsx)(X.ControlledPopover,{content:(0,pn.jsxs)("div",{style:{width:"250px"},children:[(0,pn.jsx)("h4",{children:(0,pn.jsx)(z.FormattedMessage,{id:"download.file"})}),(0,pn.jsx)("br",{}),(0,pn.jsxs)("div",{className:"d-flex justify-content-between mt-2",children:[(0,pn.jsx)(X.Button,{colourScheme:"light",type:"reset",squared:!0,children:(0,pn.jsx)(z.FormattedMessage,{id:"button.cancel"})}),(0,pn.jsx)(X.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],{}),a=document.createElement("a");a.download=o,a.href=URL.createObjectURL(i),a.addEventListener("click",(()=>{setTimeout((()=>URL.revokeObjectURL(a.href)),3e4)})),a.click(),n(!t)})).catch((e=>console.log(e)))},squared:!0,type:"submit",children:(0,pn.jsx)(z.FormattedMessage,{id:"button.download"})})]})]}),open:t,placement:"bottom-end",toggle:()=>n(!t),children:(0,pn.jsx)(X.Icon,{tooltipText:(0,pn.jsx)(z.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",ce.INFO);case Ln.DO_DOKUSEIS_KEHTETU:return t("Kehtetu",ce.DEFAULT);case Ln.DO_DOKUSEIS_KOOSTAMISEL:case Ln.DO_DOKUSEIS_EELNOU_AKTIIVNE:return t("Koostamisel",ce.INFO);case Ln.DO_DOKUSEIS_ALLKIRJASTAMISEL:return t("Allkirjastamisel",ce.INFO);case Ln.DO_DOKUSEIS_MENETLUSES:return t("Menetluses",ce.INFO);case Ln.DO_DOKUSEIS_MUUTMISEL:return t("Muutmisel",ce.INFO);case Ln.DO_DOKUSEIS_TAIENDAMISEL:return t("Täiendamisel",ce.WARNING);case Ln.DO_DOKUSEIS_TYHISTATUD:return t("Tühistatud",ce.DEFAULT);case Ln.DO_DOKUSEIS_VANA_VERSIOON:return t("Vana versioon",ce.DEFAULT);case Ln.DO_DOKUSEIS_LOOBUTUD:return t("Tagasi võetud",ce.DEFAULT);case Ln.DO_DOKUSEIS_ALLKIRJASTATUD:return t("Allkirjastatud",ce.INFO);case Ln.DO_DOKUSEIS_MENETLETUD:return t("Menetletud",ce.SUCCESS);case Ln.DO_DOKUSEIS_LUBATUD:return t("Lubatud/Teavitatud",ce.SUCCESS);case Ln.DO_DOKUSEIS_LUB_TEAV:return t("Lubatud/Teavitatud",ce.WARNING);case Ln.DO_DOKUSEIS_KEELDUTUD:return t("Keelatud/Tagasi lükatud",ce.DANGER);case Ln.DO_DOKUSEIS_TEAVITATUD:return t("Teavitatud",ce.SUCCESS);case Ln.DO_DOKUSEIS_REG_KANTUD:return t("Registrisse kantud",ce.SUCCESS);case Ln.DO_DOKUSEIS_ANTUD:return t("Antud",ce.SUCCESS);case Ln.DO_DOKUSEIS_EM_KINNITATUD_AKTUAL:case Ln.DO_DOKUSEIS_KEHTIV:return t("Kehtiv",ce.SUCCESS);case Ln.DO_DOKUSEIS_TUNNIST_KEHTETUKS:return t("Tunnistatud kehtetuks",ce.DEFAULT);case Ln.DO_DOKUSEIS_KOOSK_RINGIL:return t("Kooskõlastusringil",ce.INFO);default:return t(e,ce.DEFAULT)}}function Fn(e){let t=[];e===Z?t=Pn:e===ee&&(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 kn(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((0,vn.default)(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((0,vn.default)(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((0,vn.default)(e.docDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n&&new Date((0,vn.default)(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 Gn(e){var t,n,s,o;const[i,a]=(0,q.useState)(!1);function r(){a(!i)}const l=(0,pn.jsxs)("div",{children:[(0,pn.jsx)("h4",{children:(0,pn.jsx)(z.FormattedMessage,{defaultMessage:"Kas olete kindel, et soovite selle rea kustutada?",id:null!==(t=e.titleText)&&void 0!==t?t:"common.confirmation.modal.header"})}),(0,pn.jsx)("p",{children:(0,pn.jsx)(z.FormattedMessage,{defaultMessage:"Kustutatud ridu ei ole võimalik hiljem taastada",id:null!==(n=e.messageText)&&void 0!==n?n:"common.confirmation.modal.description"})}),(0,pn.jsxs)("div",{children:[(0,pn.jsx)(X.Button,{colourScheme:"light",squared:!0,type:"reset",children:(0,pn.jsx)(z.FormattedMessage,{defaultMessage:"Loobun",id:"common.confirmation.modal.no"})}),(0,pn.jsx)(X.Button,{className:"float-right",colourScheme:"danger",onClick:()=>(e.onConfirm(),void r()),squared:!0,type:"submit",children:(0,pn.jsx)(z.FormattedMessage,{defaultMessage:"Kustutan",id:"common.confirmation.modal.yes"})})]})]});return(0,pn.jsx)(X.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:()=>r(),wrapperClassName:null!==(o=e.wrapperClassName)&&void 0!==o?o:"",children:e.children})}function Vn(e){return(0,pn.jsx)(Gn,{titleText:e.titleText,messageText:e.messageText,onConfirm:e.onConfirm,children:(0,pn.jsx)(X.Icon,{tooltipText:(0,pn.jsx)(z.FormattedMessage,{id:"tooltip.delete"}),type:"delete"})})}const Hn=e=>{let{linkName:t,functionCall:n,tooltipText:s}=e;return(0,pn.jsxs)(pn.Fragment,{children:[(0,pn.jsx)(X.Link,{onClick:e=>null==n?void 0:n(e),text:(0,pn.jsx)(X.Text,{raw:t})}),(0,pn.jsx)(X.Info,{tooltipText:s})]})};var Jn,Wn=new Uint8Array(16);function $n(){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 qn=/^(?:[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&&qn.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||$n)();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:a,customBody:r}=e;const l=(0,z.useIntl)(),d=null!=r?r:(0,pn.jsxs)("div",{children:[(0,pn.jsx)("h3",{className:"alert-heading",children:n}),(0,pn.jsx)("p",{className:"alert-body mb-0",children:o}),s&&(0,pn.jsx)("div",{className:"mx-2",children:(0,pn.jsx)(X.Link,{onClick:s.onClick,text:l.formatMessage({id:s.text})})})]});return a?(0,pn.jsx)("div",{id:"danger-toast",className:`alert ${t}`,children:d}):(0,pn.jsxs)("div",{id:"danger-toast",className:`alert alert-toast-box ${t}`,children:[(0,pn.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,z.useIntl)(),t=(0,_n.useDispatch)(),n=(0,_n.useSelector)(G),[s,o]=(0,q.useState)();(0,q.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,pn.jsx)(pn.Fragment,{children:(0,pn.jsx)("div",{className:"notification-alert-box",children:(0,pn.jsx)("ul",{children:(null==s?void 0:s.length)>0&&s.map((e=>{var n;return(0,pn.jsx)("li",{children:e.theme&&(0,pn.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(J(n));var n},link:e.link})},e.id)}))})})})},os=(0,u.createAsyncThunk)("globalUI/handleNotification",(async(e,t)=>{let{dispatch:n,getState:s}=t;const o=s().myViewsPage.notifications.notices,i=es(),a={...e,id:i};n(H([...o,a])),e.theme!==ns.Danger&&setTimeout((()=>{n(J(i))}),7e3)})),is=(0,u.createAsyncThunk)("document/createDocument",(async(e,t)=>{let{addEntityDto:n,successCallback:s}=e,{dispatch:o}=t;try{const e=await un.documentApiService.createDocument(n.documentType,n);return s&&s(e.data),o(V()),e.data}catch(e){o(os({header:"request.error.create_document.title",body:"request.error.create_document.message",theme:ns.Danger}))}})),as=e=>{var t;let{doty:n,documentId:s,linkGen:o,userInfo:i}=e;const a=(0,_n.useDispatch)(),[r,l]=(0,q.useState)(!1),d=(null==i||null===(t=i.activeRole)||void 0===t?void 0:t.businessType)===me.TJA,c=(e,t)=>{if(!t)return;a(is({addEntityDto:{documentType:t,baseDocumentId:s},successCallback:t=>((e,t)=>{const n=`${e.documentTypeWithYear}/${e.documentNumber}`;e&&o(!0,t,he,n)})(t,e)}))};return(0,pn.jsx)(X.ControlledPopover,{content:(()=>{const e=n,t=De[e],s=xe[e];return(0,pn.jsxs)("div",{children:[(0,pn.jsxs)("ul",{children:[(0,pn.jsx)("li",{className:"d-flex justify-content-between",children:(0,pn.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(!r)}})}),d&&(0,pn.jsx)("li",{className:"d-flex justify-content-between",children:(0,pn.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(!r)}})})]}),(0,pn.jsx)(X.Button,{onClick:()=>{l(!1)},squared:!0,colourScheme:"light",children:(0,pn.jsx)(z.FormattedMessage,{id:"button.cancel"})})]})})(),open:r,placement:"bottom-end",toggle:()=>l(!r),children:(0,pn.jsx)("div",{className:"pl-2",children:(0,pn.jsx)(X.Icon,{tooltipText:(0,pn.jsx)(z.FormattedMessage,{id:"tooltip.more_actions"}),type:"more"})})})},rs=e=>{var t;let{linkGen:n,userInfo:s,documentType:o,onAllUsersChecked:i,isAllUsersChecked:a,filter:r,onDocumentDelete:l,fileApi:d,hidePresenter:c}=e;const u=(0,z.useIntl)(),[p,h]=(0,q.useState)({offset:0,limit:10}),[m,g]=(0,q.useState)([]),[f,S]=(0,q.useState)({column:0,direction:On}),[I,T]=(0,q.useState)(!1),[E,_]=(0,q.useState)(!1),[v,y]=(0,q.useState)(!1),b=(0,_n.useSelector)((e=>e.myViewsPage.myDocuments.workingDocuments)),D=(0,_n.useSelector)((e=>e.myViewsPage.myDocuments.signingDocuments)),x=(0,_n.useSelector)((e=>e.myViewsPage.myDocuments.finishedDocuments)),M=(0,_n.useSelector)((e=>e.myViewsPage.myProceedings.incomingDocuments)),N=(null===(t=s.activeRole)||void 0===t?void 0:t.businessType)!==me.A;(0,q.useEffect)((()=>{b&&o===Z&&(Object.keys(r).length>0?(g(kn(b,r)),h({offset:0,limit:10})):g(b))}),[b,r]),(0,q.useEffect)((()=>{D&&o===Q&&(Object.keys(r).length>0?(g(kn(D,r)),h({offset:0,limit:10})):g(D))}),[D,r]),(0,q.useEffect)((()=>{x&&o===ee&&(Object.keys(r).length>0?(g(kn(x,r)),h({offset:0,limit:10})):g(x))}),[x,r]),(0,q.useEffect)((()=>{M&&o===te&&(Object.keys(r).length>0?(g(kn(M,r)),h({offset:0,limit:10})):g(M))}),[M,r]);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=>Yn(e.docDate)?new Date((0,vn.default)(e.docDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>o===te?Yn(e.deadlineDate)?new Date((0,vn.default)(e.deadlineDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER:Yn(e.regDate)?new Date((0,vn.default)(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,pn.jsx)(Cn,{fileApi:d,fileId:e.generatedFileId,docNr:null!==(t=e.docNr)&&void 0!==t?t:""},e.docId+"download")];return o===Z&&e.stateCode===Ln.DO_DOKUSEIS_KOOSTAMISEL?i.push((0,pn.jsx)(Vn,{onConfirm:()=>{l(e.docNr)},titleText:"my_documents.delete_document_confirmation.modal.header",messageText:"my_documents.delete_document_confirmation.modal.message"},e.docNr)):o===ee&&e.doty&&be.includes(e.doty)&&![Ln.DO_DOKUSEIS_TYHISTATUD,Ln.DO_DOKUSEIS_TUNNIST_KEHTETUKS].includes(e.stateCode)&&i.push((0,pn.jsx)(as,{doty:e.doty,documentId:e.docId,linkGen:n,userInfo:s})),i};return(0,pn.jsxs)(X.Section,{form:!0,children:[m&&(0,pn.jsx)(X.CollapseTable,{content:m.slice(p.offset,p.offset+p.limit).map((e=>{var t,s,i,a,r,l,d;return(0,pn.jsx)(X.CollapseTableRow,{fields:[e.docDate,o===te?(0,vn.default)(e.deadlineDate,"DD.MM.YYYY").valueOf()<(0,vn.default)().valueOf()?(0,pn.jsx)("div",{className:"red-text",children:null===(t=e.deadlineDate)||void 0===t?void 0:t.toString()}):e.deadlineDate:e.regDate,(0,pn.jsx)(X.Tooltip,{content:(0,pn.jsx)(X.Text,{raw:"my_documents.tooltip.open_document"}),placement:"bottom",theme:"dark",children:(0,pn.jsx)(X.Link,{onClick:t=>{n(!0,t,he,e.docNr)},text:e.docNr,href:n(!1,void 0,he,e.docNr)})},e.docNr),e.documentType,e.buildingName?(0,pn.jsx)("div",{children:v?(0,pn.jsxs)("div",{children:[e.buildingName.map(((e,t)=>(0,pn.jsxs)(q.default.Fragment,{children:[e,";",(0,pn.jsx)("br",{})]},t))),e.buildingName.length>5&&(0,pn.jsx)(X.Link,{type:"hide",onClick:e=>{e.preventDefault(),y(!v)},text:(0,pn.jsx)(z.FormattedMessage,{id:"my_documents.link.view_less_building_names"})})]}):1===e.buildingName.length?e.buildingName:(0,pn.jsxs)("div",{children:[null===(s=e.buildingName)||void 0===s?void 0:s.slice(0,4).map(((e,t)=>(0,pn.jsxs)(q.default.Fragment,{children:[e,";",(0,pn.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,pn.jsx)("div",{className:"pr-3",children:(0,pn.jsx)(X.Link,{type:"show",onClick:e=>{e.preventDefault(),y(!v)},text:(0,pn.jsx)(z.FormattedMessage,{id:"my_documents.link.view_all_building_names"})})})]})}):"",e.ehrCode?(0,pn.jsx)("div",{children:E?(0,pn.jsxs)("div",{children:[e.ehrCode.map(((e,t)=>(0,pn.jsxs)(q.default.Fragment,{children:[(0,pn.jsx)(fn,{linkName:e,tooltipText:"my_documents.tooltip.open_building",functionCall:t=>{n(!0,t,ue,e)},href:n(!1,void 0,ue,e)}),(0,pn.jsx)("br",{})]},t))),e.ehrCode.length>5&&(0,pn.jsx)(X.Link,{type:"hide",onClick:e=>{e.preventDefault(),_(!E)},text:(0,pn.jsx)(z.FormattedMessage,{id:"my_documents.link.view_less_ehrCodes"})})]}):(0,pn.jsxs)("div",{children:[null===(a=e.ehrCode)||void 0===a?void 0:a.slice(0,4).map(((e,t)=>(0,pn.jsxs)(q.default.Fragment,{children:[(0,pn.jsx)(fn,{linkName:e,tooltipText:"my_documents.tooltip.open_building",functionCall:t=>{n(!0,t,ue,e)},href:n(!1,void 0,ue,e)}),(0,pn.jsx)("br",{})]},t))),null===(r=e.ehrCode)||void 0===r?void 0:r.slice(4,5).map((e=>(0,pn.jsx)(fn,{linkName:e,tooltipText:"my_documents.tooltip.open_building",functionCall:t=>{n(!0,t,ue,e)},href:n(!1,void 0,ue,e)}))),e.ehrCode.length>5?" ...":"",e.ehrCode.length>5&&(0,pn.jsx)("div",{className:"pr-3",children:(0,pn.jsx)(X.Link,{type:"show",onClick:e=>{e.preventDefault(),_(!E)},text:(0,pn.jsx)(z.FormattedMessage,{id:"my_documents.link.view_all_ehrCodes"})})})]})}):"",e.buildingAddress?(0,pn.jsx)("div",{children:I?(0,pn.jsxs)("div",{children:[e.buildingAddress.map(((e,t)=>(0,pn.jsxs)(q.default.Fragment,{children:[e,";",(0,pn.jsx)("br",{})]},t))),e.buildingAddress.length>5&&(0,pn.jsx)(X.Link,{type:"hide",onClick:e=>{e.preventDefault(),T(!I)},text:(0,pn.jsx)(z.FormattedMessage,{id:"my_documents.link.view_less_addresses"})})]}):1===e.buildingAddress.length?e.buildingAddress:(0,pn.jsxs)("div",{children:[null===(l=e.buildingAddress)||void 0===l?void 0:l.slice(0,4).map(((e,t)=>(0,pn.jsxs)(q.default.Fragment,{children:[e,";",(0,pn.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,pn.jsx)("div",{className:"pr-3",children:(0,pn.jsx)(X.Link,{type:"show",onClick:e=>{e.preventDefault(),T(!I)},text:(0,pn.jsx)(z.FormattedMessage,{id:"my_documents.link.view_all_addresses"})})})]})}):"",e.stateCode?(0,pn.jsx)(X.Status,{type:Kn(e.stateCode).type,children:Kn(e.stateCode).name}):"",o===Q?(0,pn.jsx)(X.Tooltip,{content:(0,pn.jsx)(X.Text,{raw:"my_documents.tooltip.open_proceeding"}),placement:"bottom",theme:"dark",children:(0,pn.jsx)(X.Link,{onClick:t=>{n(!0,t,pe,e.proceedingNr)},text:e.proceedingNr,href:n(!1,void 0,pe,e.proceedingNr)})},e.proceedingNr):e.proceedingNr,e.presenter?e.presenter.map(((t,n)=>(0,pn.jsxs)("div",{children:[t,n!==e.presenter.length-1?(0,pn.jsx)("span",{children:", "}):""]}))):""],tools:U(e),editable:!0},e.docId)})),headers:function(){const e=[...O];return e[1]="my_documents.deadline",(o===te?e:O).map(((e,t)=>(0,pn.jsxs)("div",{children:[(0,pn.jsx)("a",{className:"link-gray",style:{paddingRight:"2px"},onClick:()=>{const e=wn(t,f);S(e),e.direction!==On&&g(Nn(m,A[t],e.direction))},children:f.column===t?(0,pn.jsx)(jn,{sortDirection:f.direction}):(0,pn.jsx)(jn,{sortDirection:On})}),u.formatMessage({id:e})]})))}(),paginationEnabled:!0,pager:{offset:p.offset,limit:p.limit,total:m.length},onPaginationReload:h,editable:!0}),(0,pn.jsx)(X.Row,{children:N&&o!==te?(0,pn.jsx)(X.Col,{children:(0,pn.jsx)(X.Checkbox,{name:"checkbox",onChange:e=>i(e),text:(0,pn.jsx)(X.Text,{raw:"my_documents.view_all_institution_documents"}),checked:a})}):(0,pn.jsx)(X.Col,{})})]})};const ls=(e=>{var t={};return c.d(t,e),t})({Col:()=>r.Col,Row:()=>r.Row});function ds(e,t,n,s,o){return s?(0,pn.jsx)(X.FieldWrapper,{labelCol:o,component:(0,pn.jsxs)(ls.Row,{className:"w-100 px-0 mx-0",children:[(0,pn.jsx)(ls.Col,{xs:"auto",md:1.5,className:"pl-0 px-0",children:(0,pn.jsx)(X.Checkbox,{"data-testid":"checkbox",info:{content:s,placement:"top-start"},name:"checkbox",text:"",checked:e})}),(0,pn.jsx)(ls.Col,{className:"px-0",children:(0,pn.jsx)(X.Text,{raw:(0,pn.jsx)(z.FormattedMessage,{id:n})})})]}),label:(0,pn.jsx)(z.FormattedMessage,{id:"label.empty"})}):(0,pn.jsx)(X.FieldWrapper,{labelCol:o,component:(0,pn.jsx)(X.Checkbox,{"data-testid":"checkbox",name:"checkbox",onChange:e=>t(e),text:(0,pn.jsx)(X.Text,{raw:(0,pn.jsx)(z.FormattedMessage,{id:n})}),checked:e}),label:(0,pn.jsx)(z.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&&(0,vn.default)(n.validTo).isBefore((0,vn.default)(new Date))?" (kuni "+(0,vn.default)(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,pn.jsxs)("div",{className:"d-flex align-items-center",children:[(0,pn.jsx)("div",{className:"range--from",style:{flexGrow:1},children:(0,pn.jsx)(X.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,pn.jsx)("span",{className:"px-1",children:"—"}),(0,pn.jsx)("div",{className:"range--to",style:{flexGrow:1},children:(0,pn.jsx)(X.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,z.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,a]=(0,q.useState)(o);(0,q.useEffect)((()=>{Object.keys(e.filterState).length>0&&a(e.filterState)}),[e.documentType]);const[r,l]=(0,q.useState)(!0),[d,c]=(0,q.useState)(!0),[u,p]=(0,q.useState)(""),[h,m]=(0,q.useState)([]),[g,f]=(0,q.useState)([]),[S,I]=(0,q.useState)([]),[T,E]=(0,q.useState)(Fn(e.documentType)),[_,v]=(0,q.useState)([]),y=(0,_n.useSelector)((e=>e.myViewsPage.filter.documentTypes)),b=(0,_n.useSelector)((e=>e.myViewsPage.filter.institutionUsers)),D=(0,_n.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,a((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),a((e=>({...e})))}(0,q.useEffect)((()=>{E(Fn(e.documentType))}),[e.documentType]),(0,q.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]);f(e)}}),[y,b,D]);return(0,pn.jsxs)(X.Form,{onSubmit:()=>e.onSubmit(i),children:[(0,pn.jsxs)(X.Row,{className:"align-items-start",children:[(0,pn.jsxs)(X.Col,{sm:10,className:"mx-0 px-0",children:[(0,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)(X.Multiselect,{name:"multiselect",options:h,onSelect:e=>M(e,"documentTypes"),allSelection:!0,onRemoveItem:e=>M(e,"documentTypes"),value:i.documentTypes,selectedOptions:_}),label:(0,pn.jsx)(z.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,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)(X.Input,{name:"input",onChange:e=>N(e,"buildingName"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.buildingName}),label:(0,pn.jsx)(z.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,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)(X.Input,{name:"input",onChange:e=>N(e,"documentNumber"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.documentNumber}),label:(0,pn.jsx)(z.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!==te&&e.documentType!==Q&&(0,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)(X.Multiselect,{name:"multiselect",options:T,onSelect:e=>M(e,"documentStates"),allSelection:!0,onRemoveItem:e=>M(e,"documentStates"),value:i.documentStates,selectedOptions:_}),label:(0,pn.jsx)(z.FormattedMessage,{id:"my_documents.filter.label.document_state"}),labelCol:{sm:20,md:8,lg:8}}),(0,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)(X.Input,{name:"input",onChange:e=>N(e,"proceedingNumber"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.proceedingNumber}),label:(0,pn.jsx)(z.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){a((t=>({...t,proceedingMissing:e})))}),"my_documents.filter.label.proceeding_missing","my_documents.filter.tooltip.proceeding_missing"),(0,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)(ms,{onChange:e=>(e=>{""!==e.from&&!(0,vn.default)(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!(0,vn.default)(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(""),a((t=>({...t,documentDate:e})))})(e),value:i.documentDate}),errorMessage:u.length>0?u:null,label:(0,pn.jsx)(z.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,pn.jsxs)(X.Col,{sm:10,className:"mx-0 px-0",children:[(0,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)(X.Input,{name:"input",onChange:e=>N(e,"ehrCode"),onBlur:e=>l(x(e.trim())),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.ehrCode}),errorMessage:!r&&(0,pn.jsx)(X.Text,{raw:"filter.invalid_building_code"}),label:(0,pn.jsx)(z.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,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)(X.Input,{name:"input",onChange:e=>N(e,"wordInAddress"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.wordInAddress}),label:(0,pn.jsx)(z.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!==te&&e.documentType!==Q&&e.isKov&&(0,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)(X.Multiselect,{name:"multiselect",options:S,onSelect:e=>M(e,"institutionUsers"),allSelection:!0,onRemoveItem:e=>M(e,"institutionUsers"),value:i.institutionUsers,selectedOptions:_}),label:(0,pn.jsx)(z.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!==te&&(0,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)(X.Multiselect,{name:"multiselect",options:g,onSelect:e=>M(e,"institutions"),allSelection:!0,onRemoveItem:e=>M(e,"institutions"),value:i.institutions,selectedOptions:_}),label:(0,pn.jsx)(z.FormattedMessage,{id:"my_documents.filter.label.institution"}),labelCol:{sm:20,md:8,lg:8}}),e.isKov&&e.documentType===Q&&(0,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)(X.Multiselect,{name:"multiselect",options:S,onSelect:e=>M(e,"institutionUsers"),allSelection:!0,onRemoveItem:e=>M(e,"institutionUsers"),value:i.institutionUsers,selectedOptions:_}),label:(0,pn.jsx)(z.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,pn.jsxs)(X.Row,{children:[(0,pn.jsx)(X.Col,{children:(0,pn.jsx)(X.Button,{onClick:()=>(v([]),void a(o)),colourScheme:"light",squared:!0,children:(0,pn.jsx)(z.FormattedMessage,{id:"button.epmty_fields"})})}),(0,pn.jsx)(X.Col,{children:(0,pn.jsx)(X.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!(r&&d),squared:!0,children:(0,pn.jsx)(z.FormattedMessage,{id:"button.search"})})})]})]})},fs=["11566","11567","11569","11576","11577"],Ss=[Ie,Te,Ee,_e],Is=e=>{const[t,n]=(0,q.useState)(!1),[s,o]=(0,q.useState)(""),[i,a]=(0,q.useState)(!1),[r,l]=(0,q.useState)([]),d=(0,_n.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,q.useEffect)((()=>{if(d){const e=d.filter((e=>!fs.includes(e.code)&&!Ss.includes(e.code)));l(e.map((e=>({code:e.code,texts:e.value}))))}}),[d]);return(0,pn.jsx)(X.ControlledPopover,{maxWidth:900,open:t,content:(0,pn.jsx)("div",{style:{width:"600px"},children:(0,pn.jsxs)(X.Form,{onSubmit:()=>{a(!0)},children:[(0,pn.jsx)("h2",{children:(0,pn.jsx)(z.FormattedMessage,{id:"my_documents.popover.title.composing_new_document"})}),(0,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)(X.Select,{filterable:!0,placeholder:"placeholder.choose",name:"role",onChange:e=>o(e),options:r,value:s}),errorMessage:i&&c(s)&&(0,pn.jsx)(X.Text,{raw:"common.select.required"}),label:(0,pn.jsx)(X.Text,{raw:"my_documents.popover.label.new_document_type"}),name:"documentType",info:{content:"my_documents.popover.tooltip.document_type"}}),(0,pn.jsxs)("div",{className:"d-flex justify-content-between mt-2",children:[(0,pn.jsx)(X.Button,{colourScheme:"light",onClick:()=>{a(!1),o("")},children:(0,pn.jsx)(z.FormattedMessage,{id:"button.cancel"})}),(0,pn.jsx)(X.Button,{className:"float-right",colourScheme:"success",onClick:t=>{c(s)||(e.linkGen(!0,t,"DOCUMENT","",{doty:s}),n(!1))},children:(0,pn.jsx)(z.FormattedMessage,{id:"my_documents.popover.button.compose_new_document"})})]})]})}),placement:"bottom-end",toggle:()=>{n(!t)},children:(0,pn.jsx)(X.Button,{withPlus:!0,colourScheme:"info",onClick:()=>{n(!t)},children:(0,pn.jsx)(z.FormattedMessage,{id:"my_documents.button.start_new_document"})})})},Ts=["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"],Es=["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"],_s=["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"],vs=e=>{var t,n,s,o,i,a,r;let{linkGen:l,userInfo:d}=e;const c=(0,_n.useDispatch)(),[u,p]=(0,q.useState)({signingDocs:!1,workingDocs:!1,finishedDocs:!1}),[h,S]=(0,q.useState)(!1),[I,T]=(0,q.useState)(!0),[D,x]=(0,q.useState)(!0),[M,N]=(0,q.useState)([]),[O,A]=(0,q.useState)([]),[U,w]=(0,q.useState)([]),[j,C]=(0,q.useState)({}),[L,P]=(0,q.useState)({}),[R,K]=(0,q.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:Ts,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:Es,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===(a=d.activeRole)||void 0===a?void 0:a.userId,personId:null===(r=d.activeRole)||void 0===r?void 0:r.businessId,roles:["DO_DOKU_ISIK_ROLL_ALLAK"],dotys:_s,states:[Ln.DO_DOKUSEIS_ALLKIRJASTAMISEL]};return(0,q.useEffect)((()=>{var e,t;un.classifierApiService.getAllDocumentTypes().then((e=>{c(m(e.data))})).catch((e=>{console.log(e)})),un.institutionKovEndpointApi.getJurKovPersons().then((e=>{c(f(e.data))})).catch((e=>{console.log(e)})),F&&un.userApiService.getJurUsers(null!==(e=null===(t=d.activeRole)||void 0===t?void 0:t.businessId)&&void 0!==e?e:0).then((e=>{c(g(e.data))})).catch((e=>{console.log(e)})),un.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(b(t))})).catch((e=>{console.log("Following error occured:",e)}))}),[d]),(0,q.useEffect)((()=>{(()=>{const e=k;u.workingDocs&&(e.userId=void 0),T(!0),un.myDocumentBaseApiService.findWorkingDocuments1(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,q.useEffect)((()=>{!function(){const e=Y;u.finishedDocs&&(e.userId=void 0),x(!0),un.myDocumentBaseApiService.findWorkingDocuments1(e).then((e=>{c(v(e.data)),x(!1),w(e.data)})).catch((e=>{console.log("Following error occured:",e),x(!1)}))}()}),[u.finishedDocs,d]),(0,q.useEffect)((()=>{!function(){const e=B;u.signingDocs&&(e.userId=void 0),S(!0),un.myDocumentBaseApiService.findWorkingDocuments1(e).then((e=>{c(_(e.data)),S(!1),N(e.data)})).catch((e=>{console.log("Following error occured:",e),S(!1)}))}()}),[u.signingDocs,d]),(0,pn.jsxs)("div",{children:[(0,pn.jsx)(ss,{}),(0,pn.jsx)("div",{className:"d-flex justify-content-end mt-2",children:(0,pn.jsx)(Is,{linkGen:l})}),F&&(0,pn.jsx)(X.Section,{collapsed:!1,title:"my_documents.my_documents_to_sign",showSettings:!0,filterContents:(0,pn.jsx)(gs,{documentType:Q,filterState:j,onSubmit:e=>C(e),isKov:F}),children:h?(0,pn.jsx)(X.SectionLoader,{}):0===M.length?(0,pn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,pn.jsx)(X.Text,{raw:"my_documents.signing_documents.no_docs"})}):(0,pn.jsx)(rs,{linkGen:l,userInfo:d,documentType:Q,onAllUsersChecked:e=>{p({signingDocs:e,workingDocs:u.workingDocs,finishedDocs:u.finishedDocs})},isAllUsersChecked:u.signingDocs,filter:j,fileApi:un.fileApiService,hidePresenter:!0})}),(0,pn.jsx)(X.Section,{collapsed:!1,title:"my_documents.working_documents",showSettings:!0,filterContents:(0,pn.jsx)(gs,{documentType:Z,filterState:L,onSubmit:e=>P(e),isKov:F}),children:I?(0,pn.jsx)(X.SectionLoader,{}):0===O.length?(0,pn.jsxs)("div",{children:[(0,pn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,pn.jsx)(X.Text,{raw:"my_documents.working_documents.no_docs"})}),F&&(0,pn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,pn.jsx)(X.Link,{text:"my_documents.view_all_institution_documents",onClick:()=>{p({signingDocs:u.signingDocs,workingDocs:!0,finishedDocs:u.finishedDocs})}})}),(0,pn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,pn.jsx)(Is,{linkGen:l})})]}):(0,pn.jsx)(rs,{linkGen:l,userInfo:d,documentType:Z,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);un.documentApiService.deleteApplicationByNumber(t,n),c(y(e))}(e),fileApi:un.fileApiService})}),(0,pn.jsx)(X.Section,{collapsed:!1,title:"my_documents.finished_documents",showSettings:!0,filterContents:(0,pn.jsx)(gs,{documentType:ee,filterState:R,onSubmit:e=>K(e),isKov:F}),children:D?(0,pn.jsx)(X.SectionLoader,{}):0===U.length?(0,pn.jsxs)("div",{children:[(0,pn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,pn.jsx)(X.Text,{raw:"my_documents.finished_documents.no_docs"})}),F&&(0,pn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,pn.jsx)(X.Link,{text:"my_documents.view_all_institution_documents",onClick:()=>{p({signingDocs:u.signingDocs,workingDocs:u.workingDocs,finishedDocs:!0})}})}),(0,pn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,pn.jsx)(Is,{linkGen:l})})]}):(0,pn.jsx)(rs,{linkGen:l,userInfo:d,documentType:ee,onAllUsersChecked:e=>{p({signingDocs:u.signingDocs,workingDocs:u.workingDocs,finishedDocs:e}),x(!0)},isAllUsersChecked:u.finishedDocs,filter:R,fileApi:un.fileApiService})})]})},ys={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 bs(e){return Bn(ys,e)}function Ds(e){const t=bs(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 xs=[{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 Ms(){return xs.map((e=>({id:e.code+"",label:e.value,level:2,children:[],selectable:!0,value:!1})))}function Ns(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(bs(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((0,vn.default)(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((0,vn.default)(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((0,vn.default)(e.dateStart,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n&&new Date((0,vn.default)(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((0,vn.default)(e.lastEventDate).format("YYYY-MM-DD")).getTime()<=n))}return e}function Os(){return xs.filter((e=>"MENSEIS_TAIENDAMISEL"!==e.code&&"MENSEIS_MUUTMISEL"!==e.code&&"MENSEIS_LOPETATUD"!==e.code&&"MENSEIS_PEATATUD"!==e.code)).map((e=>({id:e.code})))}let As=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 Us=e=>e?(e=>[...ve,...ye].includes(e))(e)?As.AdminProceeding:As.Proceeding:As.NotFound,ws=e=>{const t=(0,z.useIntl)(),[n,s]=(0,q.useState)({offset:0,limit:50}),[o,i]=(0,q.useState)([]),[a,r]=(0,q.useState)({column:5,direction:An}),[l,d]=(0,q.useState)(!1),[c,u]=(0,q.useState)(!1),[p,h]=(0,q.useState)(!1),m=(0,_n.useSelector)((e=>e.myViewsPage.myProceedings.myProceedings)),g=[e=>Yn(e.dateStart)?new Date((0,vn.default)(e.dateStart,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>Yn(e.deadline)?new Date((0,vn.default)(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,q.useEffect)((()=>{if(m){const e=5,t=wn(e,a);t.direction===On&&(t.direction=An),r(t),i(Nn(m,g[e],t.direction))}}),[m]),(0,q.useEffect)((()=>{m&&Object.keys(e.filter).length>0&&(a.direction===On?i(Ns(m,e.filter)):i(Nn(Ns(m,e.filter),g[a.column],a.direction)),s({offset:0,limit:50}))}),[e.filter,m]),(0,q.useEffect)((()=>{a&&a.direction!==On&&0!==o.length&&i(Nn(o,g[a.column],a.direction))}),[a]);const f=["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,pn.jsxs)(X.Section,{form:!0,children:[o&&(0,pn.jsx)(X.CollapseTable,{content:(t=>{const s=t,{linkGen:o}=e;return s.slice(n.offset,n.offset+n.limit).map((t=>{var n,s,i,a,r,m;let g={addresses:[],ehrCodes:[],buildingNames:[]};t.address&&(null===(n=t.address)||void 0===n?void 0:n.length)>1&&(g=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 a=[];o.forEach((e=>{const t=e.county;a.includes(t)||a.push(t)}));let r=[];o.forEach((e=>{const t=e.city;r.includes(t)||r.push(t)})),a.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=[];a.forEach((e=>{r.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));const f=Us(t.doty);return(0,pn.jsx)(X.CollapseTableRow,{fields:[t.dateStart,(0,vn.default)(t.deadline,"DD.MM.YYYY").valueOf()<(0,vn.default)().valueOf()?(0,pn.jsx)("div",{className:"red-text",children:null===(s=t.deadline)||void 0===s?void 0:s.toString()}):t.deadline,(0,pn.jsx)(X.Tooltip,{content:(0,pn.jsx)(X.Text,{raw:"my_proceedings.tooltip.open_proceeding"}),placement:"bottom",theme:"dark",children:(0,pn.jsx)(X.Link,{onClick:e=>{o(!0,e,f,t.proceedingNr)},text:t.proceedingNr,href:o(!1,void 0,f,t.proceedingNr)})},t.proceedingNr),t.stateCode?(0,pn.jsx)(X.Status,{type:Ds(t.stateCode).type,children:Ds(t.stateCode).name}):"",t.proceedingCircleNr,t.operationsCount,t.innerCommentDeadline?(0,vn.default)(t.innerCommentDeadline).valueOf()<=(0,vn.default)().valueOf()?(0,pn.jsx)("div",{style:{color:"#00b649"},children:(0,vn.default)(t.innerCommentDeadline).format("DD.MM.YYYY")}):(0,vn.default)(t.innerCommentDeadline).format("DD.MM.YYYY"):"",t.lastEventDate?(0,vn.default)(t.lastEventDate).format("DD.MM.YYYY"):"",(0,pn.jsx)(fn,{linkName:t.document,tooltipText:"my_proceedings.tooltip.open_document",functionCall:n=>{e.linkGen(!0,n,"DOCUMENT",t.document)}}),t.documentType,t.buildingName&&(null===(i=t.buildingName)||void 0===i?void 0:i.length)>0?(0,pn.jsx)("div",{children:p?(0,pn.jsxs)("div",{children:[g.buildingNames.map((e=>(0,pn.jsxs)(pn.Fragment,{children:[e,";",(0,pn.jsx)("br",{})]}))),t.buildingName.length>5&&(0,pn.jsx)(X.Link,{type:"hide",onClick:e=>{e.preventDefault(),h(!p)},text:(0,pn.jsx)(z.FormattedMessage,{id:"my_proceedings.link.view_less_building_names"})})]}):1===t.buildingName.length?t.buildingName:(0,pn.jsxs)("div",{children:[null===(a=g.buildingNames)||void 0===a?void 0:a.slice(0,4).map((e=>(0,pn.jsxs)(pn.Fragment,{children:[e,";",(0,pn.jsx)("br",{})]}))),null===(r=g.buildingNames)||void 0===r?void 0:r.slice(4,5),t.buildingName.length>5?" ...":"",t.buildingName.length>5&&(0,pn.jsx)("div",{className:"pr-3",children:(0,pn.jsx)(X.Link,{type:"show",onClick:e=>{e.preventDefault(),h(!p)},text:(0,pn.jsx)(z.FormattedMessage,{id:"my_proceedings.link.view_all_building_names"})})})]})}):"",t.ehrCode?(0,pn.jsx)("div",{children:c?(0,pn.jsxs)("div",{children:[g.ehrCodes.map((t=>(0,pn.jsxs)(pn.Fragment,{children:[(0,pn.jsx)(fn,{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,pn.jsx)("br",{})]}))),t.ehrCode.length>5&&(0,pn.jsx)(X.Link,{type:"hide",onClick:e=>{e.preventDefault(),u(!c)},text:(0,pn.jsx)(z.FormattedMessage,{id:"my_proceedings.link.view_less_ehrCodes"})})]}):1===t.ehrCode.length?(0,pn.jsx)(fn,{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,pn.jsxs)("div",{children:[g.ehrCodes.slice(0,4).map(((t,n)=>(0,pn.jsxs)(q.default.Fragment,{children:[(0,pn.jsx)(fn,{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,pn.jsx)("br",{})]},n))),g.ehrCodes.slice(4,5).map((t=>(0,pn.jsx)(fn,{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,pn.jsx)("div",{className:"pr-3",children:(0,pn.jsx)(X.Link,{type:"show",onClick:e=>{e.preventDefault(),u(!c)},text:(0,pn.jsx)(z.FormattedMessage,{id:"my_proceedings.link.view_all_ehrCodes"})})})]})}):"",t.address?(0,pn.jsx)("div",{style:{width:125},children:l?(0,pn.jsxs)("div",{children:[g.addresses.map((e=>(0,pn.jsxs)(pn.Fragment,{children:[e,";",(0,pn.jsx)("br",{})]}))),t.address.length>5&&(0,pn.jsx)(X.Link,{type:"hide",onClick:e=>{e.preventDefault(),d(!l)},text:(0,pn.jsx)(z.FormattedMessage,{id:"my_proceedings.link.view_less_addresses"})})]}):1===t.address.length?t.address:(0,pn.jsxs)("div",{children:[g.addresses.slice(0,4).map((e=>(0,pn.jsxs)(pn.Fragment,{children:[e,";",(0,pn.jsx)("br",{})]}))),null===(m=g.addresses)||void 0===m?void 0:m.slice(4,5),t.address.length>5?" ...":"",t.address.length>5&&(0,pn.jsx)("div",{className:"pr-3",children:(0,pn.jsx)(X.Link,{type:"show",onClick:e=>{e.preventDefault(),d(!l)},text:(0,pn.jsx)(z.FormattedMessage,{id:"my_proceedings.link.view_all_addresses"})})})]})}):"",t.proceedingName,t.supervisor,t.documentPresenter,t.archived,t.proceedingLength]},t.id)}))})(o),headers:f.map(((e,n)=>(0,pn.jsxs)("div",{children:[(0,pn.jsx)("a",{className:"link-gray",style:{paddingRight:"2px"},onClick:()=>{const e=wn(n,a);r(e)},children:a.column===n?(0,pn.jsx)(jn,{sortDirection:a.direction}):(0,pn.jsx)(jn,{sortDirection:On})}),t.formatMessage({id:e})]}))),paginationEnabled:!0,pager:{offset:n.offset,limit:n.limit,total:o.length},onPaginationReload:s}),(0,pn.jsx)(pn.Fragment,{children:e.isKov?(0,pn.jsx)("div",{className:"d-flex justify-content-start",children:(0,pn.jsx)(X.Checkbox,{name:"checkbox",onChange:t=>e.onAllUsersChecked(t),text:(0,pn.jsx)(X.Text,{raw:"my_proceedings.view_all_institution_proceedings"}),checked:e.isAllUsersChecked})}):null})]})},js={documentTypes:[],ehrCode:"",buildingName:"",wordInAddress:"",proceedingNumber:"",cadastralNumber:"",proceedingStates:["MENSEIS_ALGATATUD","MENSEIS_KAIMASOLEV"],connectedPerson:"",showProceedingInArchive:!1,supervisors:[],proceedingDate:{from:"",to:""},lastEventDate:""},Cs=e=>{let{onSubmit:t,isKov:n,filterState:s}=e;const o=(0,z.useIntl)(),i=/^[\\s0-9]{0,9}$/,a=/^([\\s0-9]{5}:[\\s0-9]{3}:[\\s0-9]{1,4}|[\\s0-9]{5}:[\\s0-9]{1,3}|[\\s0-9]{1,5})$/,[r,l]=(0,q.useState)(s),[d,c]=(0,q.useState)(!0),[u,p]=(0,q.useState)(!0),[h,m]=(0,q.useState)(""),[g,f]=(0,q.useState)(""),[S,I]=(0,q.useState)([]),[T,E]=(0,q.useState)([]),[_]=(0,q.useState)(Ms()),[v,y]=(0,q.useState)([]),[b,D]=(0,q.useState)(Os()),x=(0,_n.useSelector)((e=>e.myViewsPage.filter.documentTypes)),M=(0,_n.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||a.test(n))&&p(!0),l((n=>({...n,[t]:e})))}(0,q.useEffect)((()=>{if(x){const e=us(x);I(e)}if(M&&n){const e=ps([...M]);E(e)}}),[x,M]);return(0,pn.jsxs)(X.Form,{onSubmit:()=>t(r),children:[(0,pn.jsxs)(X.Row,{className:"align-items-start",children:[(0,pn.jsxs)(X.Col,{sm:10,className:"mx-0 px-0",children:[(0,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)(X.Multiselect,{name:"multiselect",options:S,onSelect:e=>O(e,"documentTypes"),allSelection:!0,onRemoveItem:e=>O(e,"documentTypes"),value:r.documentTypes,selectedOptions:v}),label:(0,pn.jsx)(z.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,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)(X.Input,{name:"input",onChange:e=>A(e,"proceedingNumber"),placeholder:o.formatMessage({id:"placeholder.writing"}),value:r.proceedingNumber}),label:(0,pn.jsx)(z.FormattedMessage,{id:"my_proceedings.filter.label.proceeding_number"}),labelCol:{sm:20,md:8,lg:8}}),(0,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)(X.Multiselect,{name:"multiselect",options:_,onSelect:e=>{O(e,"proceedingStates")},allSelection:!0,onRemoveItem:e=>O(e,"proceedingStates"),value:r.proceedingStates,selectedOptions:b}),label:(0,pn.jsx)(z.FormattedMessage,{id:"my_proceedings.filter.label.proceeding_state"}),labelCol:{sm:20,md:8,lg:8}}),ds(r.showProceedingInArchive,(function(e){l((t=>({...t,showProceedingInArchive:e})))}),"my_proceedings.filter.label.show_archived_proceedings"),(0,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)("div",{className:"daterange_in_form",children:(0,pn.jsx)(X.DateRange,{name:"daterange",onChange:e=>(e=>{""!==e.from&&!(0,vn.default)(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!(0,vn.default)(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:r.proceedingDate})}),errorMessage:h.length>0?h:null,label:(0,pn.jsx)(z.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,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)(X.DatePicker,{name:"datepicker-field",value:r.lastEventDate,onChange:e=>function(e){""===e||(0,vn.default)(e,"YYYY-MM-DD",!0).isValid()?f(""):f(o.formatMessage({id:"filter.invalid_date_format"})),l((t=>({...t,lastEventDate:e})))}(e)}),errorMessage:g.length>0?g:null,label:(0,pn.jsx)(z.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,pn.jsxs)(X.Col,{sm:10,className:"mx-0 px-0",children:[(0,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)(X.Input,{name:"input",onChange:e=>A(e,"ehrCode"),onBlur:e=>c(N(e.trim())),placeholder:o.formatMessage({id:"placeholder.writing"}),value:r.ehrCode}),errorMessage:!d&&(0,pn.jsx)(X.Text,{raw:"filter.invalid_building_code"}),label:(0,pn.jsx)(z.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,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)(X.Input,{name:"input",onChange:e=>A(e,"buildingName"),placeholder:o.formatMessage({id:"placeholder.writing"}),value:r.buildingName}),label:(0,pn.jsx)(z.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,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)(X.Input,{name:"input",onChange:e=>A(e,"wordInAddress"),placeholder:o.formatMessage({id:"placeholder.writing"}),value:r.wordInAddress}),label:(0,pn.jsx)(z.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,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)(X.Input,{name:"input",onChange:e=>A(e,"connectedPerson"),placeholder:o.formatMessage({id:"placeholder.writing"}),value:r.connectedPerson}),label:(0,pn.jsx)(z.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,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)(X.Multiselect,{name:"multiselect",options:T,onSelect:e=>O(e,"supervisors"),allSelection:!0,onRemoveItem:e=>O(e,"supervisors"),value:r.supervisors,selectedOptions:v}),label:(0,pn.jsx)(z.FormattedMessage,{id:"my_proceedings.filter.label.supervisor"}),labelCol:{sm:20,md:8,lg:8}})]})]}),(0,pn.jsxs)(X.Row,{children:[(0,pn.jsx)(X.Col,{children:(0,pn.jsx)(X.Button,{onClick:()=>(y([]),l(js),void D(Os())),colourScheme:"light",squared:!0,children:(0,pn.jsx)(z.FormattedMessage,{id:"button.epmty_fields"})})}),(0,pn.jsx)(X.Col,{children:(0,pn.jsx)(X.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!(d&&u),squared:!0,children:(0,pn.jsx)(z.FormattedMessage,{id:"button.search"})})})]})]})},Ls={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 Ps=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 Rs(e){return Bn(Ls,e)}const Ks={[Ps.MENTOIMSEIS_OOTEL]:"info",[Ps.MENTOIMSEIS_TEOSTAMISEL]:"info",[Ps.MENTOIMSEIS_TYHISTATUD]:"default",[Ps.MENTOIMSEIS_TEOSTATUD]:"success",[Ps.MENTOIMSEIS_LOOBUTUD]:"default",[Ps.MENTOIMSEIS_TAHTAEG_MOODUNUD]:"default"},Fs={[Ps.MENTOIMSEIS_OOTEL]:"my_operations.operation.state.idle",[Ps.MENTOIMSEIS_TEOSTAMISEL]:"my_operations.operation.state.in_process",[Ps.MENTOIMSEIS_TYHISTATUD]:"my_operations.operation.state.cancelled",[Ps.MENTOIMSEIS_TEOSTATUD]:"my_operations.operation.state.done",[Ps.MENTOIMSEIS_LOOBUTUD]:"my_operations.operation.state.abandoned",[Ps.MENTOIMSEIS_TAHTAEG_MOODUNUD]:"my_operations.operation.state.expired"};function ks(e,t){return((e,t)=>({state:Object.keys(Fs).includes(e)?t.formatMessage({id:Fs[e]}):e,type:Object.keys(Ks).includes(e)?Ks[e]:"default"}))(Rs(e),t)}const Ys=(e,t)=>({code:e,value:t.formatMessage({id:Fs[e]})});function Bs(e,t){let n;return n=e===oe?[Ps.MENTOIMSEIS_OOTEL,Ps.MENTOIMSEIS_TEOSTAMISEL,Ps.MENTOIMSEIS_TYHISTATUD,Ps.MENTOIMSEIS_TEOSTATUD,Ps.MENTOIMSEIS_LOOBUTUD,Ps.MENTOIMSEIS_TAHTAEG_MOODUNUD].map((e=>Ys(e,t))):e===re?[Ps.MENTOIMSEIS_OOTEL,Ps.MENTOIMSEIS_TEOSTAMISEL,Ps.MENTOIMSEIS_TYHISTATUD,Ps.MENTOIMSEIS_LOOBUTUD,Ps.MENTOIMSEIS_TAHTAEG_MOODUNUD].map((e=>Ys(e,t))):e===le?[Ps.MENTOIMSEIS_OOTEL,Ps.MENTOIMSEIS_TEOSTAMISEL,Ps.MENTOIMSEIS_TEOSTATUD,Ps.MENTOIMSEIS_LOOBUTUD].map((e=>Ys(e,t))):[Ps.MENTOIMSEIS_OOTEL,Ps.MENTOIMSEIS_TEOSTAMISEL,Ps.MENTOIMSEIS_TEOSTATUD,Ps.MENTOIMSEIS_LOOBUTUD,Ps.MENTOIMSEIS_TAHTAEG_MOODUNUD].map((e=>Ys(e,t))),function(e){return e.map((e=>({id:e.code+"",label:e.value,level:2,children:[],selectable:!0,value:!1})))}(n)}function Gs(){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 Vs(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(Rs(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((0,vn.default)(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((0,vn.default)(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((0,vn.default)(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((0,vn.default)(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((0,vn.default)(e.invitationDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()>=n&&new Date((0,vn.default)(e.invitationDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime()<=s))}return e}function Hs(e){return[{id:Ps.MENTOIMSEIS_OOTEL},{id:Ps.MENTOIMSEIS_TEOSTAMISEL},{id:Ps.MENTOIMSEIS_TEOSTATUD},{id:Ps.MENTOIMSEIS_LOOBUTUD}].filter((t=>e.includes(t.id)))}let Js=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 Ws=["11273","11272"],$s=e=>{const t=(0,z.useIntl)(),[n,s]=(0,q.useState)({offset:0,limit:10}),[o,i]=(0,q.useState)([]),[a,r]=(0,q.useState)({column:1,direction:Un}),[l,d]=(0,q.useState)(!1),[c,u]=(0,q.useState)(!1),[p,h]=(0,q.useState)(!1),m=(0,_n.useSelector)((e=>e.myViewsPage.myOperations.myOperations)),g=(0,_n.useSelector)((e=>e.myViewsPage.myOperations.toCommentOperations)),f=(0,_n.useSelector)((e=>e.myViewsPage.myOperations.operationInvitations)),S=(0,_n.useSelector)((e=>e.myViewsPage.myProceedings.proceedingsToComment)),I=(0,_n.useSelector)((e=>e.myViewsPage.filter.institutions)),T=(0,_n.useSelector)((e=>e.myViewsPage.filter.documentTypes)),E=[e=>Yn(e.invitationDate)?new Date((0,vn.default)(e.invitationDate,"DD.MM.YYYY").format("YYYY-MM-DD")).getTime():Number.MAX_SAFE_INTEGER,e=>Yn(e.deadline)?new Date((0,vn.default)(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,q.useEffect)((()=>{!m||e.viewType!==se&&e.viewType!==ne||(i(Vs(m,e.filter)),s({offset:0,limit:10}))}),[m,e.filter]),(0,q.useEffect)((()=>{m&&e.viewType===oe&&(i(Nn(Vs(m,e.filter),E[0],Un)),s({offset:0,limit:10}))}),[m,e.filter]),(0,q.useEffect)((()=>{g&&e.viewType===ae&&(a.direction===On?i(Vs(g,e.filter)):i(Nn(Vs(g,e.filter),E[a.column],a.direction)),s({offset:0,limit:10}))}),[g,e.filter]),(0,q.useEffect)((()=>{f&&e.viewType===re&&(i(Vs(f,e.filter)),s({offset:0,limit:10}))}),[f,e.filter]),(0,q.useEffect)((()=>{S&&e.viewType===le&&(a.direction===On?i(Vs(S,e.filter)):i(Nn(Vs(S,e.filter),E[a.column],a.direction)))}),[S,e.filter]);const _=["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"],v=["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((0,vn.default)(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=Js.Operation;return e.viewType===le?(n=t.doty&&Ws.includes(t.doty)?Js.AdminProceeding:Js.Proceeding,e.linkGen(!1,void 0,n,t.proceedingNr)):((t.doty&&Ws.includes(t.doty)||t.typeCode===ge.MENTOIMLIIK_KAAS_TAGASISIDE)&&(n=Js.AdminOperation),e.linkGen(!1,void 0,n,t.id))};return(0,pn.jsxs)(X.Section,{form:!0,children:[o&&(0,pn.jsx)(X.CollapseTable,{content:(s=>s.slice(n.offset,n.offset+n.limit).map((n=>{var s,o,i,a,r,m,g,f;const S=[n.invitationDate,(0,vn.default)(n.deadline,"DD.MM.YYYY").valueOf()<(0,vn.default)().valueOf()?(0,pn.jsx)("div",{className:"red-text",children:n.deadline}):n.deadline,(0,pn.jsx)(X.Tooltip,{content:(0,pn.jsx)(X.Text,{raw:"my_operations.tooltip.open_proceeding"}),placement:"bottom",theme:"dark",children:(0,pn.jsx)(X.Link,{text:n.proceedingNr,href:b(n)})},n.proceedingNr),n.stateCode?(0,pn.jsx)(X.Status,{type:ks(n.stateCode,t).type,children:ks(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,pn.jsx)("div",{children:p?(0,pn.jsxs)("div",{children:[n.buildingName.map(((e,t)=>(0,pn.jsxs)(q.default.Fragment,{children:[e,";",(0,pn.jsx)("br",{})]},t))),n.buildingName.length>5&&(0,pn.jsx)(X.Link,{type:"hide",onClick:e=>{e.preventDefault(),h(!p)},text:(0,pn.jsx)(z.FormattedMessage,{id:"my_operations.link.view_less_building_names"})})]}):1===n.buildingName.length?n.buildingName:(0,pn.jsxs)("div",{children:[null===(o=n.buildingName)||void 0===o?void 0:o.slice(0,4).map(((e,t)=>(0,pn.jsxs)(q.default.Fragment,{children:[e,";",(0,pn.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,pn.jsx)("div",{className:"pr-3",children:(0,pn.jsx)(X.Link,{type:"show",onClick:e=>{e.preventDefault(),h(!p)},text:(0,pn.jsx)(z.FormattedMessage,{id:"my_operations.link.view_all_building_names"})})})]})}):"",n.ehrCode?(0,pn.jsx)("div",{children:c?(0,pn.jsxs)("div",{children:[n.ehrCode.map(((t,n)=>(0,pn.jsxs)(q.default.Fragment,{children:[(0,pn.jsx)(fn,{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,pn.jsx)("br",{})]},n))),n.ehrCode.length>5&&(0,pn.jsx)(X.Link,{type:"hide",onClick:e=>{e.preventDefault(),u(!c)},text:(0,pn.jsx)(z.FormattedMessage,{id:"my_operations.link.view_less_ehrCodes"})})]}):(0,pn.jsxs)("div",{children:[null===(a=n.ehrCode)||void 0===a?void 0:a.slice(0,4).map(((t,n)=>(0,pn.jsxs)(q.default.Fragment,{children:[(0,pn.jsx)(fn,{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,pn.jsx)("br",{})]},n))),null===(r=n.ehrCode)||void 0===r?void 0:r.slice(4,5).map((t=>(0,pn.jsx)(fn,{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,pn.jsx)("div",{className:"pr-3",children:(0,pn.jsx)(X.Link,{type:"show",onClick:e=>{e.preventDefault(),u(!c)},text:(0,pn.jsx)(z.FormattedMessage,{id:"my_operations.link.view_all_ehrCodes"})})})]})}):"",n.address?(0,pn.jsx)("div",{children:l?(0,pn.jsxs)("div",{children:[n.address.map(((e,t)=>(0,pn.jsxs)(q.default.Fragment,{children:[e,";",(0,pn.jsx)("br",{})]},t))),n.address.length>5&&(0,pn.jsx)(X.Link,{type:"hide",onClick:e=>{e.preventDefault(),d(!l)},text:(0,pn.jsx)(z.FormattedMessage,{id:"my_operations.link.view_less_addresses"})})]}):1===n.address.length?n.address:(0,pn.jsxs)("div",{children:[null===(m=n.address)||void 0===m?void 0:m.slice(0,4).map(((e,t)=>(0,pn.jsxs)(q.default.Fragment,{children:[e,";",(0,pn.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,pn.jsx)("div",{className:"pr-3",children:(0,pn.jsx)(X.Link,{type:"show",onClick:e=>{e.preventDefault(),d(!l)},text:(0,pn.jsx)(z.FormattedMessage,{id:"my_operations.link.view_all_addresses"})})})]})}):"",n.supervisorJurId?null===(f=I.find((e=>e.id===n.supervisorJurId)))||void 0===f?void 0:f.regName:"",n.supervisor],E=[...S];E.splice(4,1);const _=[...S].slice(1,4).concat(S[10]).concat(S[5]).concat(S[8]);return(0,pn.jsx)(X.CollapseTableRow,{fields:e.viewType===oe?E:e.viewType===le?_:S},n.id)})))(o),headers:function(){const n=[..._];n.splice(4,1);const s=e.viewType===oe?n:e.viewType===le?v:_,l=[...E];l.splice(4,1);const d=e.viewType===oe?l:e.viewType===le?y:E;return s.map(((e,n)=>(0,pn.jsxs)("div",{children:[(0,pn.jsx)("a",{className:"link-gray",style:{paddingRight:"2px"},onClick:()=>{const e=wn(n,a);r(e),e.direction!==On&&i(Nn(o,d[n],e.direction))},children:a.column===n?(0,pn.jsx)(jn,{sortDirection:a.direction}):(0,pn.jsx)(jn,{sortDirection:On})}),t.formatMessage({id:e})]})))}(),paginationEnabled:!0,pager:{offset:n.offset,limit:n.limit,total:o.length},onPaginationReload:s}),(e.viewType===ne||e.viewType===se)&&(0,pn.jsx)("div",{className:"d-flex justify-content-start",children:(0,pn.jsx)(X.Checkbox,{name:"checkbox",onChange:t=>e.onAllUsersChecked(t),text:e.viewType===ne?(0,pn.jsx)(X.Text,{raw:"my_approvals.view_all_institution_approvals"}):(0,pn.jsx)(X.Text,{raw:"my_opinions.view_all_institution_opinions"}),checked:e.isAllUsersChecked})})]})},qs=e=>{var t;const n=(0,z.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:""}},a={...i,operationStates:[Ps.MENTOIMSEIS_TEOSTAMISEL]},r={...i,operationStates:[Ps.MENTOIMSEIS_OOTEL,Ps.MENTOIMSEIS_TEOSTAMISEL,Ps.MENTOIMSEIS_JATKAMINE]},l={...i,operationStates:[Ps.MENTOIMSEIS_OOTEL]},[d,c]=(0,q.useState)(e.filterState),[u,p]=(0,q.useState)(Hs(d.operationStates)),[h,m]=(0,q.useState)(!0),[g,f]=(0,q.useState)(!0),[S,I]=(0,q.useState)(""),[T,E]=(0,q.useState)(""),_=(0,q.useMemo)((()=>Gs()),[]),[v,y]=(0,q.useState)([]),[b,D]=(0,q.useState)([]),x=(0,q.useMemo)((()=>Bs(e.viewType,n)),[e.viewType]),[M,N]=(0,q.useState)([]),O=(0,_n.useSelector)((e=>e.myViewsPage.filter.institutionUsers)),A=(0,_n.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))&&f(!0),c((e=>({...e})))}(0,q.useEffect)((()=>{if(O){const e=ps(O?[...O]:[]);D(e)}if(A){const e=hs([...A]);y(e)}}),[O,A]);return(0,pn.jsxs)(X.Form,{onSubmit:()=>e.onSubmit(d),children:[(0,pn.jsx)(X.Row,{className:"align-items-start",children:(0,pn.jsx)(X.Col,{sm:10,className:"mx-0 px-0",children:(0,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)(X.Multiselect,{name:"multiselect",options:_,onSelect:e=>w(e,"documentTypes"),allSelection:!0,onRemoveItem:e=>w(e,"documentTypes"),value:d.documentTypes,selectedOptions:M}),label:(0,pn.jsx)(z.FormattedMessage,{id:"my_operations.filter.label.document_type"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})})}),(0,pn.jsx)(X.Row,{className:"align-items-start",children:(0,pn.jsx)(X.Col,{sm:10,className:"mx-0 px-0",children:(0,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)(X.Input,{name:"input",onChange:e=>j(e,"ehrCode"),onBlur:e=>f(U(e.trim())),placeholder:n.formatMessage({id:"placeholder.writing"}),value:d.ehrCode}),errorMessage:!h&&(0,pn.jsx)(X.Text,{raw:"filter.invalid_building_code"}),label:(0,pn.jsx)(z.FormattedMessage,{id:"my_operations.filter.label.ehrCode"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})})}),(0,pn.jsxs)(X.Row,{className:"align-items-start",children:[(0,pn.jsxs)(X.Col,{sm:10,className:"mx-0 px-0",children:[(0,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)(X.Multiselect,{name:"multiselect",options:v,onSelect:e=>w(e,"institutions"),allSelection:!0,onRemoveItem:e=>w(e,"institutions"),value:d.institutions,selectedOptions:M}),label:(0,pn.jsx)(z.FormattedMessage,{id:"my_operations.filter.label.institution"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)(X.Input,{name:"input",onChange:e=>j(e,"proceedingNumber"),placeholder:n.formatMessage({id:"placeholder.writing"}),value:d.proceedingNumber}),label:(0,pn.jsx)(z.FormattedMessage,{id:"my_operations.filter.label.proceeding_number"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)(X.Multiselect,{name:"multiselect",options:x,onSelect:e=>w(e,"operationStates"),allSelection:!0,onRemoveItem:e=>w(e,"operationStates"),value:d.operationStates,selectedOptions:u}),label:(0,pn.jsx)(z.FormattedMessage,{id:"my_operations.filter.label.operation_state"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)(ms,{onChange:e=>(e=>{""!==e.from&&!(0,vn.default)(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!(0,vn.default)(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:S.length>0?S:null,label:(0,pn.jsx)(z.FormattedMessage,{id:"my_operations.filter.label.operation_date"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})]}),(0,pn.jsxs)(X.Col,{sm:10,className:"mx-0 px-0",children:[(0,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)(X.Input,{name:"input",onChange:e=>j(e,"wordInAddress"),placeholder:n.formatMessage({id:"placeholder.writing"}),value:d.wordInAddress}),label:(0,pn.jsx)(z.FormattedMessage,{id:"my_operations.filter.label.word_in_address"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)(X.Multiselect,{name:"multiselect",options:b,onSelect:e=>w(e,"institutionUsers"),allSelection:!0,onRemoveItem:e=>w(e,"institutionUsers"),value:d.institutionUsers,selectedOptions:M}),label:(0,pn.jsx)(z.FormattedMessage,{id:"my_operations.filter.label.institution_users"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}}),(0,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)(ms,{onChange:e=>(e=>{""!==e.from&&!(0,vn.default)(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!(0,vn.default)(e.to,"YYYY-MM-DD",!0).isValid()?E(n.formatMessage({id:"filter.invalid_date_format"})):""!==e.from&&""!==e.to&&e.from>e.to?E(n.formatMessage({id:"filter.invalid_date_range"})):E(""),c((t=>({...t,operationDeadline:e})))})(e),value:d.operationDeadline}),errorMessage:T.length>0?T:null,label:(0,pn.jsx)(z.FormattedMessage,{id:"my_operations.filter.label.operation_deadline"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})]})]}),(0,pn.jsxs)(X.Row,{children:[(0,pn.jsx)(X.Col,{children:(0,pn.jsx)(X.Button,{onClick:()=>function(){let t;switch(N([]),e.viewType){case ie:t=a;break;case ae:case le:t=r;break;case re:t=l;break;default:t=i}c(t),p(Hs(t.operationStates))}(),colourScheme:"light",squared:!0,children:(0,pn.jsx)(z.FormattedMessage,{id:"button.epmty_fields"})})}),(0,pn.jsx)(X.Col,{children:(0,pn.jsx)(X.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!(h&&g),squared:!0,children:(0,pn.jsx)(z.FormattedMessage,{id:"button.search"})})})]})]})},zs=e=>{var t,n,s,o;let{classifierApiEndpoint:i,fileUploadApiEndpoint:a,linkGen:r,myViewsApiEndpoint:l,userInfo:d,userApiEndpoint:c}=e;const u=(0,_n.useDispatch)(),[p,h]=(0,q.useState)({proceedings:!1}),[f,S]=(0,q.useState)(!0),[I,T]=(0,q.useState)(!0),[E,_]=(0,q.useState)(!0),[v,y]=(0,q.useState)([]),[b,D]=(0,q.useState)([]),[x,A]=(0,q.useState)([]),U=new Re(new vt({basePath:i})),w=new nt(new vt({basePath:c})),j=new _t(new vt({basePath:l})),C=new gt(new vt({basePath:l})),L=new Tt(new vt({basePath:l})),P=new $t(new qt({basePath:a})),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,q.useState)({documentTypes:[],ehrCode:"",buildingName:"",wordInAddress:"",proceedingNumber:"",cadastralNumber:"",proceedingStates:["MENSEIS_ALGATATUD","MENSEIS_KAIMASOLEV"],connectedPerson:"",showProceedingInArchive:!1,supervisors:[],proceedingDate:{from:"",to:""},lastEventDate:""}),[B,G]=(0,q.useState)(F),[V,H]=(0,q.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","11274","11275"],states:[Ln.DO_DOKUSEIS_ESITATUD,Ln.DO_DOKUSEIS_MENETLUSES]};return(0,q.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:[ge.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,q.useEffect)((()=>{(()=>{const e=J;p.proceedings&&(e.userId=void 0),S(!0),j.findProceedings(e).then((e=>{u(M(e.data)),y(e.data),S(!1)})).catch((e=>{console.log("Following error occured:",e),S(!1)}))})()}),[p.proceedings]),(0,q.useEffect)((()=>{!function(){const e=J;e.userId=void 0,_(!0),C.findIncomingDocuments(e).then((e=>{u(O(e.data)),_(!1),A(e.data)})).catch((e=>{console.log("Following error occured:",e),_(!1)}))}()}),[d]),(0,q.useEffect)((()=>{var e,t;U.getAllDocumentTypes().then((e=>{u(m(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(g(e.data))})).catch((e=>{console.log(e)}))}),[d]),(0,pn.jsxs)("div",{children:[(0,pn.jsx)(X.Section,{collapsed:!1,title:"my_proceedings.my_proceedings",showSettings:!0,filterContents:(0,pn.jsx)(Cs,{onSubmit:e=>{Y(e)},isKov:R,filterState:k}),children:f?(0,pn.jsx)(X.SectionLoader,{}):0===v.length?(0,pn.jsxs)("div",{children:[(0,pn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,pn.jsx)(X.Text,{raw:"my_proceedings.no_proceedings"})}),R&&(0,pn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,pn.jsx)(X.Link,{text:"my_proceedings.view_all_institution_proceedings",onClick:()=>{h({proceedings:!0})}})})]}):(0,pn.jsx)(ws,{linkGen:r,isKov:R,onAllUsersChecked:e=>{h({proceedings:e})},isAllUsersChecked:p.proceedings,filter:k})}),R&&(0,pn.jsx)(X.Section,{collapsed:!1,title:"my_proceedings.section_title.proceedings_to_comment",showSettings:!0,filterContents:(0,pn.jsx)(qs,{viewType:le,initialFilter:F,filterState:B,onSubmit:e=>G(e)}),children:I?(0,pn.jsx)(X.SectionLoader,{}):0===b.length?(0,pn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,pn.jsx)(X.Text,{raw:"my_proceedings.proceedings_to_comment.no_proceedings"})}):(0,pn.jsx)($s,{linkGen:r,viewType:le,filter:B})}),R&&(0,pn.jsx)(X.Section,{collapsed:!1,title:"my_documents.incoming_documents",showSettings:!0,filterContents:(0,pn.jsx)(gs,{documentType:te,filterState:V,onSubmit:e=>H(e),isKov:R}),children:E?(0,pn.jsx)(X.SectionLoader,{}):0===x.length?(0,pn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,pn.jsx)(X.Text,{raw:"my_documents.incoming_documents.no_docs"})}):(0,pn.jsx)(rs,{linkGen:r,userInfo:d,documentType:te,filter:V,fileApi:P})})]})},Xs=e=>{let{classifierApiEndpoint:t,linkGen:n,myViewsApiEndpoint:s,userApiEndpoint:o,userInfo:{activeRole:i}}=e;const a=(0,_n.useDispatch)(),[r,l]=(0,q.useState)(!0),[d,c]=(0,q.useState)(!1),[u,p]=(0,q.useState)(!1),[h,S]=(0,q.useState)(null),[I,T]=(0,q.useState)(null),[E,_]=(0,q.useState)(null),v={documentTypes:[],ehrCode:"",institutions:[],wordInAddress:"",proceedingNumber:"",cadastralNumber:"",operationStates:[],institutionUsers:[],operationDate:{from:"",to:""},operationDeadline:{from:"",to:""}},y={...v,operationStates:[Ps.MENTOIMSEIS_TEOSTAMISEL]},b={...v,operationStates:[Ps.MENTOIMSEIS_OOTEL,Ps.MENTOIMSEIS_TEOSTAMISEL,Ps.MENTOIMSEIS_JATKAMINE]},D={...v,operationStates:[Ps.MENTOIMSEIS_OOTEL]},[x,M]=(0,q.useState)(y),[N,O]=(0,q.useState)(b),[A,U]=(0,q.useState)(D),[L,P]=(0,q.useState)(!1),R=new ze(new vt({basePath:o})),K=new nt(new vt({basePath:o})),F=new Tt(new vt({basePath:s})),k=new Re(new vt({basePath:t}));return(0,q.useEffect)((()=>{var e;R.getJurKovPersons().then((e=>{a(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=>{a(g(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)})),k.getAllDocumentTypes().then((e=>{a(m(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)}))}),[]),(0,q.useEffect)((()=>{!function(){const e={userId:null==i?void 0:i.userId,personId:null==i?void 0:i.businessId,type:[ge.MENTOIMLIIK_VALINE_KOOSK],states:Ls.MENTOIMSEIS_TEOSTAMISEL.concat(Ls.MENTOIMSEIS_TEOSTATUD,Ls.MENTOIMSEIS_LOOBUTUD,Ls.MENTOIMSEIS_TAHTAEG_MOODUNUD)};L&&(e.userId=void 0),l(!0),F.findOperations(e).then((e=>{a(w(e.data)),S(e.data),l(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),l(!1)}))}()}),[L]),(0,q.useEffect)((()=>{c(!0),F.findOperationsToComment({userId:null==i?void 0:i.userId,type:[ge.MENTOIMLIIK_VALINE_KOOSK],states:Ls.MENTOIMSEIS_TEOSTAMISEL.concat(Ls.MENTOIMSEIS_TEOSTATUD,Ls.MENTOIMSEIS_LOOBUTUD,Ls.MENTOIMSEIS_TAHTAEG_MOODUNUD)}).then((e=>{a(j(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:[ge.MENTOIMLIIK_VALINE_KOOSK],states:Ls.MENTOIMSEIS_OOTEL.concat(Ls.MENTOIMSEIS_TEOSTAMISEL,Ls.MENTOIMSEIS_TYHISTATUD,Ls.MENTOIMSEIS_LOOBUTUD,Ls.MENTOIMSEIS_TAHTAEG_MOODUNUD)}).then((e=>{a(C(e.data)),_(e.data),p(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),p(!1)}))}),[]),(0,pn.jsxs)("div",{children:[(0,pn.jsxs)(X.Section,{collapsed:!1,title:"my_approvals.my_approvals",showSettings:!0,filterContents:(0,pn.jsx)(qs,{viewType:ie,filterState:x,onSubmit:e=>M(e)}),children:[r&&(0,pn.jsx)(X.SectionLoader,{}),r||h?(0,pn.jsx)($s,{linkGen:n,viewType:ne,filter:x,isAllUsersChecked:L,onAllUsersChecked:e=>{P(e)}}):(0,pn.jsxs)("div",{children:[(0,pn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,pn.jsx)(X.Text,{raw:"my_approvals.no_approvals"})}),(0,pn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,pn.jsx)(X.Link,{text:"my_approvals.view_all_institution_approvals",onClick:()=>{P(!0)}})})]})]}),(0,pn.jsxs)(X.Section,{collapsed:!1,title:"my_approvals.approvals_to_comment",showSettings:!0,filterContents:(0,pn.jsx)(qs,{viewType:ae,filterState:N,onSubmit:e=>O(e)}),children:[d&&(0,pn.jsx)(X.SectionLoader,{}),d||I?(0,pn.jsx)($s,{linkGen:n,viewType:ae,filter:N}):(0,pn.jsx)("div",{children:(0,pn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,pn.jsx)(X.Text,{raw:"my_approvals.no_approvals_to_comment"})})})]}),(0,pn.jsxs)(X.Section,{collapsed:!1,title:"my_approvals.approval_invitations",showSettings:!0,filterContents:(0,pn.jsx)(qs,{viewType:re,filterState:A,onSubmit:e=>U(e)}),children:[u&&(0,pn.jsx)(X.SectionLoader,{}),u||E?(0,pn.jsx)($s,{linkGen:n,viewType:re,filter:A}):(0,pn.jsx)("div",{children:(0,pn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,pn.jsx)(X.Text,{raw:"my_approvals.no_approval_invitations"})})})]})]})},Qs=e=>{let{classifierApiEndpoint:t,linkGen:n,myViewsApiEndpoint:s,userApiEndpoint:o,userInfo:{activeRole:i}}=e;const a=(0,_n.useDispatch)(),[r,l]=(0,q.useState)(!1),[d,c]=(0,q.useState)(!1),[u,p]=(0,q.useState)(!1),[h,S]=(0,q.useState)(null),[I,T]=(0,q.useState)(null),[E,_]=(0,q.useState)(null),v={documentTypes:[],ehrCode:"",institutions:[],wordInAddress:"",proceedingNumber:"",cadastralNumber:"",operationStates:[],institutionUsers:[],operationDate:{from:"",to:""},operationDeadline:{from:"",to:""}},y={...v,operationStates:[Ps.MENTOIMSEIS_TEOSTAMISEL]},b={...v,operationStates:[Ps.MENTOIMSEIS_OOTEL,Ps.MENTOIMSEIS_TEOSTAMISEL,Ps.MENTOIMSEIS_JATKAMINE]},D={...v,operationStates:[Ps.MENTOIMSEIS_OOTEL]},[x,M]=(0,q.useState)(y),[N,O]=(0,q.useState)(b),[A,U]=(0,q.useState)(D),[L,P]=(0,q.useState)(!1),R=new ze(new vt({basePath:o})),K=new nt(new vt({basePath:o})),F=new Tt(new vt({basePath:s})),k=new Re(new vt({basePath:t}));return(0,q.useEffect)((()=>{var e;R.getJurKovPersons().then((e=>{a(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=>{a(g(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)})),k.getAllDocumentTypes().then((e=>{a(m(e.data))})).catch((e=>{console.error(`Following error occured: ${e}`)}))}),[]),(0,q.useEffect)((()=>{!function(){const e=L?null==i?void 0:i.businessId:null==i?void 0:i.userId;l(!0),F.findOperations({personId:L?e:void 0,userId:L?void 0:e,type:[ge.MENTOIMLIIK_ARVAMUS],states:Ls.MENTOIMSEIS_TEOSTAMISEL.concat(Ls.MENTOIMSEIS_TEOSTATUD,Ls.MENTOIMSEIS_LOOBUTUD,Ls.MENTOIMSEIS_TAHTAEG_MOODUNUD)}).then((e=>{a(w(e.data)),S(e.data),l(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),l(!1)}))}()}),[L]),(0,q.useEffect)((()=>{c(!0),F.findOperationsToComment({userId:null==i?void 0:i.userId,type:[ge.MENTOIMLIIK_ARVAMUS],states:Ls.MENTOIMSEIS_TEOSTAMISEL.concat(Ls.MENTOIMSEIS_TEOSTATUD,Ls.MENTOIMSEIS_LOOBUTUD,Ls.MENTOIMSEIS_TAHTAEG_MOODUNUD)}).then((e=>{a(j(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:[ge.MENTOIMLIIK_ARVAMUS],states:Ls.MENTOIMSEIS_OOTEL.concat(Ls.MENTOIMSEIS_TEOSTAMISEL,Ls.MENTOIMSEIS_TYHISTATUD,Ls.MENTOIMSEIS_LOOBUTUD,Ls.MENTOIMSEIS_TAHTAEG_MOODUNUD)}).then((e=>{a(C(e.data)),_(e.data),p(!1)})).catch((e=>{console.error(`Following error occured: ${e}`),p(!1)}))}),[]),(0,pn.jsxs)("div",{children:[(0,pn.jsxs)(X.Section,{collapsed:!1,title:"my_opinions.my_opinions",showSettings:!0,filterContents:(0,pn.jsx)(qs,{viewType:ie,filterState:x,onSubmit:e=>M(e)}),children:[r&&(0,pn.jsx)(X.SectionLoader,{}),r||h?(0,pn.jsx)($s,{linkGen:n,viewType:se,filter:x,isAllUsersChecked:L,onAllUsersChecked:e=>{P(e)}}):(0,pn.jsxs)("div",{children:[(0,pn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,pn.jsx)(X.Text,{raw:"my_opinions.no_opinions"})}),(0,pn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,pn.jsx)(X.Link,{text:"my_opinions.view_all_institution_opinions",onClick:()=>{P(!0)}})})]})]}),(0,pn.jsxs)(X.Section,{collapsed:!1,title:"my_opinions.opinions_to_comment",showSettings:!0,filterContents:(0,pn.jsx)(qs,{viewType:ae,filterState:N,onSubmit:e=>O(e)}),children:[d&&(0,pn.jsx)(X.SectionLoader,{}),d||I?(0,pn.jsx)($s,{linkGen:n,viewType:ae,filter:N}):(0,pn.jsx)("div",{children:(0,pn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,pn.jsx)(X.Text,{raw:"my_opinions.no_opinions_to_comment"})})})]}),(0,pn.jsxs)(X.Section,{collapsed:!1,title:"my_opinions.opinion_invitations",showSettings:!0,filterContents:(0,pn.jsx)(qs,{viewType:re,filterState:A,onSubmit:e=>U(e)}),children:[u&&(0,pn.jsx)(X.SectionLoader,{}),u||E?(0,pn.jsx)($s,{linkGen:n,viewType:re,filter:A}):(0,pn.jsx)("div",{children:(0,pn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,pn.jsx)(X.Text,{raw:"my_opinions.no_opinion_invitations"})})})]})]})},Zs=e=>{const t=(0,z.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:[Ps.MENTOIMSEIS_OOTEL,Ps.MENTOIMSEIS_TEOSTAMISEL,Ps.MENTOIMSEIS_TEOSTATUD,Ps.MENTOIMSEIS_LOOBUTUD],operationDate:{from:"",to:""},operationDeadline:{from:"",to:""}},[i,a]=(0,q.useState)(e.filterState),[r,l]=(0,q.useState)(Hs(i.operationStates)),[d,c]=(0,q.useState)(!0),[u,p]=(0,q.useState)(!0),[h,m]=(0,q.useState)(""),g=(0,q.useMemo)((()=>Gs()),[]),[f,S]=(0,q.useState)([]),I=(0,q.useMemo)((()=>Bs(oe,t)),[]),[T,E]=(0,q.useState)([]),_=(0,_n.useSelector)((e=>e.myViewsPage.filter.institutions));function v(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,a((e=>({...e})))}function b(e,t){var n;i[t]=e,"ehrCode"===t&&v(e)?c(!0):"cadastralNumber"===t&&(0===(n=e).length||s.test(n))&&p(!0),a((e=>({...e})))}(0,q.useEffect)((()=>{if(_){const e=hs([..._]);S(e)}}),[_]);return(0,pn.jsxs)(X.Form,{onSubmit:()=>e.onSubmit(i),children:[(0,pn.jsxs)(X.Row,{children:[(0,pn.jsx)(X.Col,{children:(0,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)(X.Multiselect,{name:"multiselect",options:g,onSelect:e=>y(e,"documentTypes"),allSelection:!0,onRemoveItem:e=>y(e,"documentTypes"),value:i.documentTypes,selectedOptions:T}),label:(0,pn.jsx)(z.FormattedMessage,{id:"my_operations.filter.label.document_type"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,pn.jsx)(X.Col,{})]}),(0,pn.jsxs)(X.Row,{children:[(0,pn.jsx)(X.Col,{children:(0,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)(X.Input,{name:"input",onChange:e=>b(e,"ehrCode"),onBlur:e=>c(v(e.trim())),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.ehrCode}),errorMessage:!d&&(0,pn.jsx)(X.Text,{raw:"filter.invalid_building_code"}),label:(0,pn.jsx)(z.FormattedMessage,{id:"my_operations.filter.label.ehrCode"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,pn.jsx)(X.Col,{children:(0,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)(X.Input,{name:"input",onChange:e=>b(e,"wordInAddress"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.wordInAddress}),label:(0,pn.jsx)(z.FormattedMessage,{id:"my_operations.filter.label.word_in_address"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})})]}),(0,pn.jsxs)(X.Row,{children:[(0,pn.jsx)(X.Col,{children:(0,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)(X.Multiselect,{name:"multiselect",options:f,onSelect:e=>y(e,"institutions"),allSelection:!0,onRemoveItem:e=>y(e,"institutions"),value:i.institutions,selectedOptions:T}),label:(0,pn.jsx)(z.FormattedMessage,{id:"my_operations.filter.label.institution"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,pn.jsx)(X.Col,{})]}),(0,pn.jsxs)(X.Row,{children:[(0,pn.jsx)(X.Col,{children:(0,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)(X.Input,{name:"input",onChange:e=>b(e,"proceedingNumber"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.proceedingNumber}),label:(0,pn.jsx)(z.FormattedMessage,{id:"my_operations.filter.label.proceeding_number"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,pn.jsx)(X.Col,{children:(0,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)(X.Multiselect,{name:"multiselect",options:I,onSelect:e=>y(e,"operationStates"),allSelection:!0,onRemoveItem:e=>y(e,"operationStates"),value:i.operationStates,selectedOptions:r}),label:(0,pn.jsx)(z.FormattedMessage,{id:"my_involvements.filter.label.involvement_state"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})})]}),(0,pn.jsxs)(X.Row,{children:[(0,pn.jsx)(X.Col,{children:(0,pn.jsx)(X.FieldWrapper,{component:(0,pn.jsx)(ms,{onChange:e=>(e=>{""!==e.from&&!(0,vn.default)(e.from,"YYYY-MM-DD",!0).isValid()||""!==e.to&&!(0,vn.default)(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(""),a((t=>({...t,operationDate:e})))})(e),value:i.operationDate}),errorMessage:h.length>0?h:null,label:(0,pn.jsx)(z.FormattedMessage,{id:"my_involvements.filter.label.involvement_date"}),labelCol:{sm:20,md:8,lg:8},info:{content:"...",placement:"top-start"}})}),(0,pn.jsx)(X.Col,{})]}),(0,pn.jsxs)(X.Row,{children:[(0,pn.jsx)(X.Col,{children:(0,pn.jsx)(X.Button,{onClick:()=>(E([]),a(o),void l(Hs(o.operationStates))),colourScheme:"light",squared:!0,children:(0,pn.jsx)(z.FormattedMessage,{id:"button.epmty_fields"})})}),(0,pn.jsx)(X.Col,{children:(0,pn.jsx)(X.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!(d&&u),squared:!0,children:(0,pn.jsx)(z.FormattedMessage,{id:"button.search"})})})]})]})},eo=e=>{var t;let{classifierApiEndpoint:n,linkGen:s,myViewsApiEndpoint:o,userInfo:i,userApiEndpoint:a}=e;const r=(0,_n.useDispatch)(),[l,d]=(0,q.useState)(!1),[c,u]=(0,q.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:[Ps.MENTOIMSEIS_OOTEL,Ps.MENTOIMSEIS_TEOSTAMISEL,Ps.MENTOIMSEIS_TEOSTATUD,Ps.MENTOIMSEIS_LOOBUTUD],operationDate:{from:"",to:""},operationDeadline:{from:"",to:""}},[g,S]=(0,q.useState)(h),I=new ze(new vt({basePath:a})),T=new Tt(new vt({basePath:o})),E=new Re(new vt({basePath:n}));return(0,q.useEffect)((()=>{var e;I.getJurKovPersons().then((e=>{r(f(e.data))})).catch((e=>{console.log(e)})),E.getAllDocumentTypes().then((e=>{r(m(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:[ge.MENTOIMLIIK_KAASAMINE,ge.MENTOIMLIIK_KAAS_TAGASISIDE],states:[Ps.MENTOIMSEIS_OOTEL,Ps.MENTOIMSEIS_TEOSTAMISEL,Ps.MENTOIMSEIS_TEOSTATUD,Ps.MENTOIMSEIS_VALMIS,Ps.MENTOIMSEIS_JATKAMINE,Ps.MENTOIMSEIS_TYHISTATUD,Ps.MENTOIMSEIS_LOOBUTUD,Ps.MENTOIMSEIS_KEELDUTUD,Ps.MENTOIMSEIS_TAGASI_LYKATUD,Ps.MENTOIMSEIS_TAHTAEG_MOODUNUD]}).then((e=>{r(w(e.data)),u(e.data),d(!1)})).catch((e=>{console.log("Following error occured:",e),d(!1)}))}),[i]),(0,pn.jsx)("div",{children:(0,pn.jsx)(X.Section,{collapsed:!1,title:"my_involvements.my_involvements",showSettings:!0,filterContents:(0,pn.jsx)(Zs,{filterState:g,onSubmit:e=>S(e)}),children:l?(0,pn.jsx)(X.SectionLoader,{}):0===c.length?(0,pn.jsx)("div",{className:"d-flex justify-content-center mb-1",children:(0,pn.jsx)(X.Text,{raw:"my_involvements.no_involvements"})}):(0,pn.jsx)($s,{linkGen:s,viewType:oe,filter:g})})})};function to(e){return e.map((e=>({id:e.code+"",label:e.value,level:2,children:[],selectable:!0,value:!1})))}function no(e){let t=to([{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 so=[{code:"EHITIS_OMANDI_LIIK_KINNIS",value:"Kinnisasi"},{code:"EHITIS_OMANDI_LIIK_VALLAS",value:"Vallasasi"},{code:"EHITIS_OMANDI_LIIK_VALLASRO",value:"Reaalosa kui vallasasi"}];function oo(){return to(so)}function io(e){let t=[];for(let n of e)t.push(n.id),t.push(...io(n.children?n.children:[]));return t}const ao=e=>{const t=(0,z.useIntl)(),n={buildingLocation:"",buildingName:"",buildingStates:[],firstUseDate:{from:"",to:""},firstUseMissing:!1,buildingType:[],purposeOfUse:[],ownershipType:[],owner:void 0,isPrivatePerson:!1,searchType:de},s=(0,_n.useSelector)((e=>e.myViewsPage.filter.usageClassifierTypes)),o=(0,_n.useSelector)((e=>e.myViewsPage.detailSearch.buildings)),[i,a]=(0,q.useState)(n),[r,l]=(0,q.useState)([]),[d,c]=(0,q.useState)(no(e.isAdminRole)),[u]=(0,q.useState)(to([{code:"H",value:"Hoone"},{code:"R",value:"Rajatis"}])),[p]=(0,q.useState)(oo()),[h,m]=(0,q.useState)([]),[g,f]=(0,q.useState)({}),[S,I]=(0,q.useState)(""),[T,E]=(0,q.useState)({}),[_,v]=(0,q.useState)(""),[y,b]=(0,q.useState)(!1),[D,x]=(0,q.useState)({code:"",value:""}),M=(0,q.useRef)(),[N,O]=(0,q.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,a((e=>({...e})))}function U(e,t){let n;if(e.selectedData.length>0){n=io(void 0===e.selectedData[0].data?e.selectedData:e.selectedData[0].data)}else n=[];i[t]=n,a((e=>({...e})))}function w(e,t){i[t]=e,a((e=>({...e})))}(0,q.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,""),a=i.slice(0,i.length-1),r=t;for(let e=2;e<=a.length;e++)if(r.children){let t=r.children.find((t=>t.id.replace(/0/g,"")===a.slice(0,e)));t&&(r=t)}if(r.children){const t=`${e} ${s}${null!=o&&o.trim()?` (kuni ${o})`:""}`;r.children.push({id:n.id+"",parentId:r.id,label:t,level:r.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,q.useEffect)((()=>{c(no(e.isAdminRole))}),[e.isAdminRole]);const j={sm:20,md:8,lg:8};return(0,pn.jsxs)(X.Form,{onSubmit:()=>function(){if(JSON.stringify(n)===JSON.stringify(i))E({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 E({header:"",message:""}),e.onSubmit(i)}(),children:[T.header&&T.header.length>0&&T.message&&T.message.length>0&&(0,pn.jsx)(X.MessageBlock,{dismissible:!0,header:(0,pn.jsx)(z.FormattedMessage,{id:T.header}),onDismiss:()=>E({header:"",message:""}),theme:"danger",messages:[(0,pn.jsx)(z.FormattedMessage,{id:T.message})]}),o&&o.length>=500&&(0,pn.jsx)(X.MessageBlock,{dismissible:!0,header:(0,pn.jsx)(z.FormattedMessage,{id:"detailsearch.empty_filter_error.header"}),theme:"warning",messages:[(0,pn.jsx)(z.FormattedMessage,{id:"detailsearch.filter_error_message.more_than_500_results"})]}),(0,pn.jsxs)(X.Row,{className:"align-items-start",children:[(0,pn.jsxs)(X.Col,{xs:20,md:20,lg:10,className:"px-0",children:[(0,pn.jsx)(X.FieldWrapper,{labelCol:j,component:(0,pn.jsx)(X.Input,{name:"input",onChange:e=>w(e,"buildingLocation"),placeholder:t.formatMessage({id:"detailssearch.filter.placeholder.address"}),value:i.buildingLocation}),label:(0,pn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.building_location"}),info:{content:"detailsearch.filter.tooltip.building_location",placement:"top-start"}}),(0,pn.jsx)(X.FieldWrapper,{labelCol:j,component:(0,pn.jsx)(X.Input,{name:"input",onChange:e=>w(e,"buildingName"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:i.buildingName}),label:(0,pn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.building_name"}),info:{content:"detailsearch.filter.tooltip.building_name",placement:"top-start"}}),(0,pn.jsx)(X.FieldWrapper,{labelCol:j,component:(0,pn.jsx)(X.Multiselect,{name:"multiselect",options:d,onSelect:e=>A(e,"buildingStates"),allSelection:!0,onRemoveItem:e=>A(e,"buildingStates"),value:i.buildingStates,selectedOptions:r}),label:(0,pn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.building_state"}),info:{content:"detailsearch.filter.tooltip.building_state",placement:"top-start"}}),(0,pn.jsx)(X.FieldWrapper,{labelCol:j,component:(0,pn.jsx)("div",{className:"daterange_in_form",children:(0,pn.jsx)(X.NumberRangeExtended,{value:{from:i.firstUseDate.from,to:i.firstUseDate.to},onChange:e=>function(e){I(""),E({header:"",message:""});let t=null!==e.from?e.from:"",n=null!==e.to?e.to:"";a((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(""),E({header:"",message:""}))}(e),onlyPositive:!0,disabled:i.firstUseMissing})}),errorMessage:S,label:(0,pn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.first_use"}),info:{content:"detailsearch.filter.tooltip.first_use",placement:"top-start"}}),(0,pn.jsx)(pn.Fragment,{children:ds(i.firstUseMissing,(function(e){a((t=>({...t,firstUseMissing:e})))}),"detailsearch.filter.label.checkbox.first_use_missing","detailsearch.filter.tooltip.checkbox.first_use_missing",j)})]}),(0,pn.jsxs)(X.Col,{xs:20,md:20,lg:10,className:"px-0",children:[(0,pn.jsx)(X.FieldWrapper,{labelCol:j,component:(0,pn.jsx)(X.Multiselect,{name:"multiselect",options:u,onSelect:e=>A(e,"buildingType"),allSelection:!0,onRemoveItem:e=>A(e,"buildingType"),value:i.buildingType,selectedOptions:r}),label:(0,pn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.building_type"}),info:{content:"detailsearch.filter.tooltip.building_type",placement:"top-start"}}),(0,pn.jsx)(X.FieldWrapper,{labelCol:j,component:(0,pn.jsx)(X.Multiselect,{name:"multiselect",options:h,onSelect:e=>U(e,"purposeOfUse"),allSelection:!0,onRemoveItem:e=>U(e,"purposeOfUse"),value:i.purposeOfUse,selectedOptions:r,isSearchExactMatch:!0}),label:(0,pn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.purpose_of_use"}),info:{content:"detailsearch.filter.tooltip.purpose_of_use",placement:"top-start"}}),(0,pn.jsx)(X.FieldWrapper,{labelCol:j,component:(0,pn.jsx)(X.Multiselect,{name:"multiselect",options:p,onSelect:e=>A(e,"ownershipType"),allSelection:!0,onRemoveItem:e=>A(e,"ownershipType"),value:i.ownershipType,selectedOptions:r}),label:(0,pn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.ownershiptype"}),info:{content:"detailsearch.filter.tooltip.ownershiptype",placement:"top-start"}})]}),e.isAdminPlusRole&&(0,pn.jsx)(pn.Fragment,{children:(0,pn.jsxs)(X.Row,{className:"align-items-center w-100",children:[(0,pn.jsx)(X.Col,{xs:20,md:20,lg:10,className:"px-0",children:(0,pn.jsx)(X.FieldWrapper,{labelCol:j,component:(0,pn.jsx)(X.PersonSearchPageExtended,{person:g,disabled:!1,labelKey:"code",valueKey:"value",onInputChange:e=>{!function(e){v(e)}(e)},updatedFromAR:()=>{},onPersonUpdate:e=>function(e){var t,n,s;if(f(e),e&&e.id&&e.id>0&&O(e),e&&(_===e.idCode||_===(null===(t=e.id)||void 0===t?void 0:t.toString())||_===e.regCode)||e&&D.code===e.regCode)i.owner=null===(s=e.id)||void 0===s?void 0:s.toString(),a((e=>({...e})));else if(e||_.substring(4)!==(null===(n=N.id)||void 0===n?void 0:n.toString()))e||(i.owner=void 0,a((e=>({...e}))));else{var o;i.owner=null===(o=N.id)||void 0===o?void 0:o.toString(),a((e=>({...e})))}}(e),searchPerson:e.callSearchPerson,handlePersonSelection:e=>x(e),isShowError:e=>{b(e),e||E({header:"",message:""})},searchOnBlur:!0,ref:M,isOptionalField:!0,isPrivateOwner:i.isPrivatePerson}),label:(0,pn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.owner"}),info:{content:"detailsearch.filter.tooltip.owner.extended",placement:"top-start"}})}),(0,pn.jsx)(X.Col,{xs:20,md:20,lg:10,children:ds(i.isPrivatePerson,(function(e){a((t=>({...t,isPrivatePerson:e})))}),"detailsearch.filter.label.checkbox.owner.private","",{xs:20,md:1})})]})})]}),(0,pn.jsxs)(X.Row,{children:[(0,pn.jsx)(X.Col,{children:(0,pn.jsx)(X.Button,{onClick:()=>(l([]),a(n),M.current.clearTypeahead(),void f({})),colourScheme:"light",squared:!0,children:(0,pn.jsx)(z.FormattedMessage,{id:"button.epmty_fields"})})}),(0,pn.jsx)(X.Col,{children:(0,pn.jsx)(X.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!!(S.length>0||y),squared:!0,children:(0,pn.jsx)(z.FormattedMessage,{id:"button.search"})})})]})]})},ro=e=>{const t=(0,z.useIntl)(),n={buildingLocation:"",buildingName:"",institutions:[],documentDate:{from:"",to:""},documentType:[],documentNr:"",documentState:[],connectedPerson:void 0},[s,o]=(0,q.useState)(n),[i,a]=(0,q.useState)(""),[r,l]=(0,q.useState)([]),[d,c]=(0,q.useState)([]),[u,p]=(0,q.useState)([]),[h]=(0,q.useState)(to([{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,q.useState)({}),[f,S]=(0,q.useState)(""),[I,T]=(0,q.useState)(!1),[E,_]=(0,q.useState)({code:"",value:""}),[v,y]=(0,q.useState)({}),[b,D]=(0,q.useState)(!1),x=(0,q.useRef)(),M=(0,_n.useSelector)((e=>e.myViewsPage.filter.documentTypes)),N=(0,_n.useSelector)((e=>e.myViewsPage.filter.institutions)),O=(0,_n.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!(!(0,vn.default)(e,"YYYY-MM-DD",!0).isValid()&&!(0,vn.default)(e,"D.M.YYYY",!0).isValid())}(0,q.useEffect)((()=>{if(M){const e=us(M);c(e)}if(N){const e=hs([...N]);p(e)}}),[M,N]);const j={sm:20,md:8,lg:8};return(0,pn.jsxs)(X.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:[v.header&&v.header.length>0&&v.message&&v.message.length>0&&(0,pn.jsx)(X.MessageBlock,{dismissible:!0,header:(0,pn.jsx)(z.FormattedMessage,{id:v.header}),onDismiss:()=>y({header:"",message:""}),theme:"danger",messages:[(0,pn.jsx)(z.FormattedMessage,{id:v.message})]}),O&&O.length>500&&(0,pn.jsx)(X.MessageBlock,{dismissible:!0,header:(0,pn.jsx)(z.FormattedMessage,{id:"detailsearch.empty_filter_error.header"}),theme:"warning",messages:[(0,pn.jsx)(z.FormattedMessage,{id:"detailsearch.filter_error_message.more_than_500_results"})]}),(0,pn.jsxs)(X.Row,{className:"align-items-start",children:[(0,pn.jsxs)(X.Col,{xs:20,md:20,lg:10,className:"px-0",children:[(0,pn.jsx)(X.FieldWrapper,{labelCol:j,component:(0,pn.jsx)(X.Input,{name:"input",onChange:e=>U(e,"buildingLocation"),placeholder:t.formatMessage({id:"detailsearch.filter.placeholder.address_catastralUnit_ehrCode"}),value:s.buildingLocation}),label:(0,pn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.building_location"}),info:{content:"detailsearch.filter.tooltip.address_catastralUnit_ehrCode.extended",placement:"top-start"}}),(0,pn.jsx)(X.FieldWrapper,{labelCol:j,component:(0,pn.jsx)(X.Input,{name:"input",onChange:e=>U(e,"buildingName"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:s.buildingName}),label:(0,pn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.building_name"}),info:{content:"detailsearch.filter.tooltip.building_name",placement:"top-start"}}),(0,pn.jsx)(X.FieldWrapper,{labelCol:j,component:(0,pn.jsx)(X.Multiselect,{name:"multiselect",options:u,onSelect:e=>A(e,"institutions"),allSelection:!0,onRemoveItem:e=>A(e,"institutions"),value:s.institutions,selectedOptions:r}),label:(0,pn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.institution"})}),(0,pn.jsx)(X.FieldWrapper,{labelCol:j,component:(0,pn.jsx)("div",{className:"daterange_in_form",children:(0,pn.jsx)(X.DateRange,{onBlur:()=>{D(!0)},value:s.documentDate,onChange:e=>(e=>{""!==e.from&&!w(e.from)||""!==e.to&&!w(e.to)?a(t.formatMessage({id:"filter.invalid_date_format"})):""!==e.from&&""!==e.to&&(0,vn.default)(e.from)>(0,vn.default)(e.to)?a(t.formatMessage({id:"filter.invalid_date_range"})):""!==e.from&&((0,vn.default)(e.from)<(0,vn.default)("01.01.1990")||(0,vn.default)(e.from)>(0,vn.default)())||""!==e.to&&((0,vn.default)(e.to)<(0,vn.default)("01.01.1990")||(0,vn.default)(e.to)>(0,vn.default)())?a(t.formatMessage({id:"detailsearch.document.date_range_error.message"},{dateToday:(0,vn.default)().format("DD.MM.YYYY")})):(0,vn.default)(e.to).diff((0,vn.default)(e.from),"days")>367?a(t.formatMessage({id:"detailsearch.filter_error_message.date_range_too_long"})):(a(""),D(!1)),o((t=>({...t,documentDate:e})))})(e)})}),errorMessage:b&&i.length>0?i:null,label:(0,pn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.document_date"}),info:{content:"detailsearch.filter.tooltip.document_date",placement:"top-start"}})]}),(0,pn.jsxs)(X.Col,{xs:20,md:20,lg:10,className:"px-0",children:[(0,pn.jsx)(X.FieldWrapper,{labelCol:j,component:(0,pn.jsx)(X.Multiselect,{name:"multiselect",options:d,onSelect:e=>A(e,"documentType"),allSelection:!0,onRemoveItem:e=>A(e,"documentType"),value:s.documentType,selectedOptions:r}),label:(0,pn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.document_type"}),info:{content:"detailsearch.filter.tooltip.document_type",placement:"top-start"}}),(0,pn.jsx)(X.FieldWrapper,{labelCol:j,component:(0,pn.jsx)(X.Input,{name:"input",onChange:e=>U(e,"documentNr"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:s.documentNr}),label:(0,pn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.document_nr"}),info:{content:"detailsearch.filter.tooltip.document_nr",placement:"top-start"}}),(0,pn.jsx)(X.FieldWrapper,{labelCol:j,component:(0,pn.jsx)(X.Multiselect,{name:"multiselect",options:h,onSelect:e=>A(e,"documentState"),allSelection:!0,onRemoveItem:e=>A(e,"documentState"),value:s.documentState,selectedOptions:r}),label:(0,pn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.document_state"})})]})]}),!e.isNonAuthenticatedUser&&(0,pn.jsx)(X.Row,{children:(0,pn.jsx)(X.Col,{xs:20,md:20,lg:10,className:"px-0",children:(0,pn.jsx)(X.FieldWrapper,{labelCol:j,component:(0,pn.jsx)(X.PersonSearchPageExtended,{person:m,disabled:!1,labelKey:"code",valueKey:"value",onInputChange:e=>{!function(e){S(e),E.code.length>0&&_({code:"",value:""})}(e)},updatedFromAR:()=>{},onPersonUpdate:e=>function(e){var t;g(e),e&&(f===e.idCode||f===(null===(t=e.id)||void 0===t?void 0:t.toString())||f===e.regCode)||e&&E.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),isShowError:e=>{T(e),e||y({header:"",message:""})},searchOnBlur:!0,ref:x,isOptionalField:!0}),label:(0,pn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.connected_person"}),info:{content:"detailsearch.filter.tooltip.connected_person.extended",placement:"top-start"}})})}),(0,pn.jsxs)(X.Row,{children:[(0,pn.jsx)(X.Col,{children:(0,pn.jsx)(X.Button,{onClick:()=>(l([]),o(n),x.current.clearTypeahead(),void g({})),colourScheme:"light",squared:!0,children:(0,pn.jsx)(z.FormattedMessage,{id:"button.epmty_fields"})})}),(0,pn.jsx)(X.Col,{children:(0,pn.jsx)(X.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!!(b&&i.length>0||I),squared:!0,children:(0,pn.jsx)(z.FormattedMessage,{id:"button.search"})})})]})]})},lo=e=>{const t=(0,z.useIntl)(),n={documentType:[],documentNr:"",proceedingDate:{from:"",to:""},proceedingNr:"",institutions:[]},[s,o]=(0,q.useState)(n),[i,a]=(0,q.useState)([]),[r,l]=(0,q.useState)([]),[d,c]=(0,q.useState)([]),[u,p]=(0,q.useState)(""),[h,m]=(0,q.useState)({}),[g,f]=(0,q.useState)(!1),S=(0,_n.useSelector)((e=>e.myViewsPage.filter.documentTypes)),I=(0,_n.useSelector)((e=>e.myViewsPage.filter.institutions)),T=(0,_n.useSelector)((e=>e.myViewsPage.detailSearch.proceedings));function E(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,t){s[t]=e,o((e=>({...e})))}function v(e){return!(!(0,vn.default)(e,"YYYY-MM-DD",!0).isValid()&&!(0,vn.default)(e,"D.M.YYYY",!0).isValid())}(0,q.useEffect)((()=>{if(S){const e=us(S);l(e)}if(I){const e=hs([...I]);c(e)}}),[S,I]);const y={sm:20,md:8,lg:8};return(0,pn.jsxs)(X.Form,{onSubmit:()=>{u.length>0?f(!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,pn.jsx)(X.MessageBlock,{dismissible:!0,header:(0,pn.jsx)(z.FormattedMessage,{id:h.header}),onDismiss:()=>m({header:"",message:""}),theme:"danger",messages:[(0,pn.jsx)(z.FormattedMessage,{id:h.message})]}),T&&T.length>500&&(0,pn.jsx)(X.MessageBlock,{dismissible:!0,header:(0,pn.jsx)(z.FormattedMessage,{id:"detailsearch.empty_filter_error.header"}),theme:"warning",messages:[(0,pn.jsx)(z.FormattedMessage,{id:"detailsearch.filter_error_message.more_than_500_results"})]}),(0,pn.jsxs)(X.Row,{className:"align-items-start",children:[(0,pn.jsxs)(X.Col,{xs:20,md:20,lg:10,className:"px-0",children:[(0,pn.jsx)(X.FieldWrapper,{labelCol:y,component:(0,pn.jsx)(X.Multiselect,{name:"multiselect",options:r,onSelect:e=>E(e,"documentType"),allSelection:!0,onRemoveItem:e=>E(e,"documentType"),value:s.documentType,selectedOptions:i}),label:(0,pn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.document_type"}),info:{content:"detailsearch.filter.tooltip.document_type",placement:"top-start"}}),(0,pn.jsx)(X.FieldWrapper,{labelCol:y,component:(0,pn.jsx)(X.Input,{name:"input",onChange:e=>_(e,"documentNr"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:s.documentNr}),label:(0,pn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.document_nr"}),info:{content:"detailsearch.filter.tooltip.document_nr",placement:"top-start"}}),(0,pn.jsx)(X.FieldWrapper,{labelCol:y,component:(0,pn.jsx)("div",{className:"daterange_in_form",children:(0,pn.jsx)(X.DateRange,{onChange:e=>(e=>{""!==e.from&&!v(e.from)||""!==e.to&&!v(e.to)?p(t.formatMessage({id:"filter.invalid_date_format"})):""!==e.from&&""!==e.to&&(0,vn.default)(e.from)>(0,vn.default)(e.to)?p(t.formatMessage({id:"filter.invalid_date_range"})):""!==e.from&&((0,vn.default)(e.from)<(0,vn.default)("01.01.1990")||(0,vn.default)(e.from)>(0,vn.default)())||""!==e.to&&((0,vn.default)(e.to)<(0,vn.default)("01.01.1990")||(0,vn.default)(e.to)>(0,vn.default)())?p(t.formatMessage({id:"detailsearch.proceeding.date_range_error.message"},{dateToday:(0,vn.default)().format("DD.MM.YYYY")})):(0,vn.default)(e.to).diff((0,vn.default)(e.from),"days")>367?p(t.formatMessage({id:"detailsearch.filter_error_message.date_range_too_long"})):(p(""),f(!1)),o((t=>({...t,proceedingDate:e})))})(e),value:s.proceedingDate,onBlur:()=>{f(!0)}})}),errorMessage:g&&u.length>0?u:null,label:(0,pn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.proceeding_date"}),info:{content:"detailsearch.filter.tooltip.proceeding_date",placement:"top-start"}})]}),(0,pn.jsxs)(X.Col,{xs:20,md:20,lg:10,className:"px-0",children:[(0,pn.jsx)(X.FieldWrapper,{labelCol:y,component:(0,pn.jsx)(X.Input,{name:"input",onChange:e=>_(e,"proceedingNr"),placeholder:t.formatMessage({id:"placeholder.writing"}),value:s.proceedingNr}),label:(0,pn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.proceeding_nr"})}),(0,pn.jsx)(X.FieldWrapper,{labelCol:y,component:(0,pn.jsx)(X.Multiselect,{name:"multiselect",options:d,onSelect:e=>E(e,"institutions"),allSelection:!0,onRemoveItem:e=>E(e,"institutions"),value:s.institutions,selectedOptions:i}),label:(0,pn.jsx)(z.FormattedMessage,{id:"detailsearch.filter.label.institution"})})]})]}),(0,pn.jsxs)(X.Row,{children:[(0,pn.jsx)(X.Col,{children:(0,pn.jsx)(X.Button,{onClick:()=>(a([]),void o(n)),colourScheme:"light",squared:!0,children:(0,pn.jsx)(z.FormattedMessage,{id:"button.epmty_fields"})})}),(0,pn.jsx)(X.Col,{children:(0,pn.jsx)(X.Button,{className:"float-right",colourScheme:"success",type:"submit",disabled:!!(g&&u.length>0),squared:!0,children:(0,pn.jsx)(z.FormattedMessage,{id:"button.search"})})})]})]})},co={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 uo(e){const t=function(e){return Bn(co,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 po=e=>{const t=(0,z.useIntl)(),[n,s]=(0,q.useState)([]),o=(0,_n.useSelector)((e=>e.myViewsPage.detailSearch.buildings));(0,q.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(ue,String(t.ehrCode),null,!1,!1,null):null;return t.ehrCode&&null!==t.ehrCode?(0,pn.jsx)(fn,{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,pn.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,pn.jsx)(X.Status,{type:uo(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,pn.jsxs)(pn.Fragment,{children:[(0,pn.jsx)("br",{}),"IK "+e.isikukood]}):void 0,o=null!==e.regKood,i=null!==(t=e.jiNimi)&&void 0!==t?t:"";return!0===o?(0,pn.jsx)("div",{children:i}):n?(0,pn.jsxs)("div",{children:[n,null!=s?s:""]}):""}(e))):""}];return(0,pn.jsx)("div",{children:(0,pn.jsx)(X.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:gn,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})})},ho="DD.MM.YYYY",mo="YYYY-MM-DD";class go{static dateToStr(e){return go.formatDate(ho,e)}static dateToStrForDatepicker(e){return go.formatDate(mo,e)}static dateWithTimeToStr(e){return go.formatDate("DD.MM.YYYY HH:mm",e)}static formatDate(e,t){return t?(0,vn.default)(t).format(e):""}static dateToMs(e,t){const n=(0,vn.default)(t,e);return t&&n.isValid()?n.valueOf():void 0}}const fo=e=>{var t,n,s,o,i,a;const r=(0,z.useIntl)(),[l,d]=(0,q.useState)([]),c=(0,_n.useSelector)((e=>e.myViewsPage.detailSearch.documents)),u=(0,_n.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===(a=i.activeRole)||void 0===a?void 0:a.businessId)&&void 0!==o?o:0;(0,q.useEffect)((()=>{c&&c.length>0&&d(c)}),[c]);const m=e.filterStateDocumentsSearch.buildingLocation,g=e.filterStateDocumentsSearch.buildingName;const f=m?m.toString().toLowerCase().replace(/[&|=;~!$>*%_()?.+:'"\\]/g,"").replace(/\t/g," ").replace(/\s{2,}/g," ").replace(/\s?-\s?/g,"-"):"";function S(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 E(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=>S(e,t.toLowerCase())));return!!s&&s.indexOf(!0)>-1}(f,e)));return I.some((e=>function(e){return!new RegExp(`\\b${e}\\b`,"gi").test(e)}(e)))?t.filter((e=>T(f,e))):t}function _(){return!Number.isNaN(Number(f))}function v(){if(f&&f.indexOf(", ")>-1){return f.split(", ").reverse().join(", ")}return f}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=f.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${f}\\b(?![\\/\\-])`,"i"),x=new RegExp(`\\b${v()}\\b(?![\\/\\-])`,"i"),M=f.replace(",","").split(/(?:\/|\s)+/g);function N(e){const t=e.buildingAddress;return t?t.findIndex((e=>e.toLowerCase()===f||e.toLowerCase()===v()))>-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=>go.dateToStr(e.docDate),isFrozen:!0},{id:"reg_date",property:"regDate",size:130,getValue:e=>go.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(he,String(t.docNr),null,!1,!1,{docId:t.docId,ehrCode:t.ehrCode}):null;return t.docNr&&null!==t.docNr?(0,pn.jsx)(fn,{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,pn.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(ue,String(e),null,!1,!1,null):null;return(0,pn.jsxs)(pn.Fragment,{children:[(0,pn.jsx)(fn,{linkName:e,tooltipText:"detailsearch.tooltip.open_building",href:o||void 0}),s!==t.ehrCode.length-1?(0,pn.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,pn.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,pn.jsx)(X.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=>{var n;const{generateLink:s}=e,o=Us(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===me.MKM||t.institutionId&&h===t.institutionId?(0,pn.jsx)(fn,{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,pn.jsxs)("div",{children:[t,n!==e.presenter.length-1?(0,pn.jsx)("span",{children:", "}):""]}))):""},{id:"institution",property:"institutionName",size:130,getValue:e=>{var t;return null!==(t=e.institutionName)&&void 0!==t?t:""}}];return(0,pn.jsx)(X.TableComponent,{config:{thead:{headers:U.map((e=>({id:e.id,size:e.size,className:"table-header-field text-align-left",label:r.formatMessage({id:"detailsearch.documents.table.header."+e.id}),tooltip:{text:r.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:gn,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=E(e);t=_()||f.length<2?n:A(n)}else t=_()||f.length<2?e:A(e);const n=t.map((e=>{var t,n,s,o;return{docId:e.docId,docDate:null!==(t=go.dateToMs(ho,e.docDate))&&void 0!==t?t:"",regDate:null!==(n=go.dateToMs(ho,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})},So=e=>{var t,n,s,o;const i=(0,z.useIntl)(),[a,r]=(0,q.useState)([]),l=(0,_n.useSelector)((e=>e.myViewsPage.detailSearch.proceedings)),d=(0,_n.useSelector)((e=>e.myViewsPage.filter.documentTypes)),c=(0,_n.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,q.useEffect)((()=>{l&&l.length>0&&r(l)}),[l]);const h=[{id:"date_start",property:"dateStart",size:130,getValue:e=>go.dateToStr(e.dateStart),isFrozen:!0},{id:"date_end",property:"dateEnd",size:130,getValue:e=>go.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=Us(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,pn.jsx)(fn,{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,pn.jsx)(X.Status,{type:Ds(e.proceedingStateCode).type,children:Ds(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(he,String(t.docNr),null,!1,!1,null):null;return t.docNr&&null!==t.docNr?(0,pn.jsx)(fn,{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,pn.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(ue,String(e),null,!1,!1,null):null;return(0,pn.jsxs)(pn.Fragment,{children:[(0,pn.jsx)(fn,{linkName:e,tooltipText:"detailsearch.tooltip.open_building",href:o||void 0}),s!==t.ehrCode.length-1?(0,pn.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,pn.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,pn.jsx)(X.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:gn,expandableRow:!1,isFilter:!1}},data:function(e){const t=e.map((e=>{var t,n,s,o,i,a;return{proceedingId:e.proceedingId,dateStart:null!==(t=go.dateToMs(ho,e.dateStart))&&void 0!==t?t:"",dateEnd:null!==(n=go.dateToMs(ho,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===(a=c.find((t=>t.id===e.institutionId)))||void 0===a?void 0:a.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}(a),handleEvent:()=>!0})},Io="https://devkluster.ehr.ee/api/building/v2".replace(/\/+$/,"");class To{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Io,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Me.default;this.basePath=t,this.axios=n,e&&(this.configuration=e,this.basePath=e.basePath||this.basePath)}}class Eo extends Error{constructor(e,t){super(t),this.name="RequiredError",this.field=e}}const _o="https://example.com",vo=function(e,t,n){if(null==n)throw new Eo(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},yo=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()},bo=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||""},Do=function(e){return e.pathname+e.search+e.hash},xo=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 a={...e.options,url:((null==s?void 0:s.basePath)||i)+e.url};return o.request(a)}},Mo=function(e){const t=function(e){return{buildingChangesGet:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};vo("buildingChangesGet","ehrCode",t),vo("buildingChangesGet","dokNr",n);const o=new URL("/buildingChanges",_o);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...s},r={};void 0!==t&&(r.ehr_code=t),void 0!==n&&(r.dok_nr=n),yo(o,r,s.query);let l=i&&i.headers?i.headers:{};return a.headers={...l,...s.headers},{url:Do(o),options:a}},buildingCompareGet:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};vo("buildingCompareGet","doEhitisId1",t),vo("buildingCompareGet","doEhitisId2",n);const o=new URL("/buildingCompare",_o);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...s},r={};void 0!==t&&(r.do_ehitis_id1=t),void 0!==n&&(r.do_ehitis_id2=n),yo(o,r,s.query);let l=i&&i.headers?i.headers:{};return a.headers={...l,...s.headers},{url:Do(o),options:a}},buildingDataGet:async function(t,n,s,o){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const a=new URL("/buildingData",_o);let r;e&&(r=e.baseOptions);const l={method:"GET",...r,...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),yo(a,d,i.query);let c=r&&r.headers?r.headers:{};return l.headers={...c,...i.headers},{url:Do(a),options:l}},buildingDeepCopyPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};vo("buildingDeepCopyPost","deepCopyPostRequest",t);const s=new URL("/buildingDeepCopy",_o);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};yo(s,{},n.query);let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=bo(t,i,e),{url:Do(s),options:i}},buildingOwnerSearchPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};vo("buildingOwnerSearchPost","bSearchOPostRequest",t);const s=new URL("/buildingOwnerSearch",_o);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};yo(s,{},n.query);let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=bo(t,i,e),{url:Do(s),options:i}},buildingSearchPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};vo("buildingSearchPost","bSearchPostRequest",t);const s=new URL("/buildingSearch",_o);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};yo(s,{},n.query);let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=bo(t,i,e),{url:Do(s),options:i}},buildingSecureDataArrayPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};vo("buildingSecureDataArrayPost","requestBody",t);const s=new URL("/buildingSecureDataArray",_o);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};yo(s,{},n.query);let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=bo(t,i,e),{url:Do(s),options:i}},buildingSecureDataGet:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const o=new URL("/buildingSecureData",_o);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...s},r={};void 0!==t&&(r.ehr_code=t),void 0!==n&&(r.ehr_id=n),yo(o,r,s.query);let l=i&&i.headers?i.headers:{};return a.headers={...l,...s.headers},{url:Do(o),options:a}},buildingVersionsGet:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};vo("buildingVersionsGet","ehrCode",t);const s=new URL("/buildingVersions",_o);let o;e&&(o=e.baseOptions);const i={method:"GET",...o,...n},a={};void 0!==t&&(a.ehr_code=t),yo(s,a,n.query);let r=o&&o.headers?o.headers:{};return i.headers={...r,...n.headers},{url:Do(s),options:i}},buildingsDataPost:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};vo("buildingsDataPost","ehrCodesPostRequest",t);const s=new URL("/buildingsData",_o);let o;e&&(o=e.baseOptions);const i={method:"POST",...o,...n},a={"Content-Type":"application/json"};yo(s,{},n.query);let r=o&&o.headers?o.headers:{};return i.headers={...a,...r,...n.headers},i.data=bo(t,i,e),{url:Do(s),options:i}},findEhrcodesDateafterGet:async function(t,n){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};vo("findEhrcodesDateafterGet","timestamp",t);const o=new URL("/find/ehrcodes/dateafter",_o);let i;e&&(i=e.baseOptions);const a={method:"GET",...i,...s},r={};void 0!==t&&(r.timestamp=t instanceof Date?t.toISOString():t),void 0!==n&&(r.offset=n),yo(o,r,s.query);let l=i&&i.headers?i.headers:{};return a.headers={...l,...s.headers},{url:Do(o),options:a}},findEhrcodesDocIdGet:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};vo("findEhrcodesDocIdGet","id",t);const s=new URL("/find/ehrcodes/docId",_o);let o;e&&(o=e.baseOptions);const i={method:"GET",...o,...n},a={};void 0!==t&&(a.id=t),yo(s,a,n.query);let r=o&&o.headers?o.headers:{};return i.headers={...r,...n.headers},{url:Do(s),options:i}}}}(e);return{async buildingChangesGet(n,s,o){const i=await t.buildingChangesGet(n,s,o);return xo(i,Me.default,Io,e)},async buildingCompareGet(n,s,o){const i=await t.buildingCompareGet(n,s,o);return xo(i,Me.default,Io,e)},async buildingDataGet(n,s,o,i,a){const r=await t.buildingDataGet(n,s,o,i,a);return xo(r,Me.default,Io,e)},async buildingDeepCopyPost(n,s){const o=await t.buildingDeepCopyPost(n,s);return xo(o,Me.default,Io,e)},async buildingOwnerSearchPost(n,s){const o=await t.buildingOwnerSearchPost(n,s);return xo(o,Me.default,Io,e)},async buildingSearchPost(n,s){const o=await t.buildingSearchPost(n,s);return xo(o,Me.default,Io,e)},async buildingSecureDataArrayPost(n,s){const o=await t.buildingSecureDataArrayPost(n,s);return xo(o,Me.default,Io,e)},async buildingSecureDataGet(n,s,o){const i=await t.buildingSecureDataGet(n,s,o);return xo(i,Me.default,Io,e)},async buildingVersionsGet(n,s){const o=await t.buildingVersionsGet(n,s);return xo(o,Me.default,Io,e)},async buildingsDataPost(n,s){const o=await t.buildingsDataPost(n,s);return xo(o,Me.default,Io,e)},async findEhrcodesDateafterGet(n,s,o){const i=await t.findEhrcodesDateafterGet(n,s,o);return xo(i,Me.default,Io,e)},async findEhrcodesDocIdGet(n,s){const o=await t.findEhrcodesDocIdGet(n,s);return xo(o,Me.default,Io,e)}}};class No extends To{buildingChangesGet(e,t,n){return Mo(this.configuration).buildingChangesGet(e,t,n).then((e=>e(this.axios,this.basePath)))}buildingCompareGet(e,t,n){return Mo(this.configuration).buildingCompareGet(e,t,n).then((e=>e(this.axios,this.basePath)))}buildingDataGet(e,t,n,s,o){return Mo(this.configuration).buildingDataGet(e,t,n,s,o).then((e=>e(this.axios,this.basePath)))}buildingDeepCopyPost(e,t){return Mo(this.configuration).buildingDeepCopyPost(e,t).then((e=>e(this.axios,this.basePath)))}buildingOwnerSearchPost(e,t){return Mo(this.configuration).buildingOwnerSearchPost(e,t).then((e=>e(this.axios,this.basePath)))}buildingSearchPost(e,t){return Mo(this.configuration).buildingSearchPost(e,t).then((e=>e(this.axios,this.basePath)))}buildingSecureDataArrayPost(e,t){return Mo(this.configuration).buildingSecureDataArrayPost(e,t).then((e=>e(this.axios,this.basePath)))}buildingSecureDataGet(e,t,n){return Mo(this.configuration).buildingSecureDataGet(e,t,n).then((e=>e(this.axios,this.basePath)))}buildingVersionsGet(e,t){return Mo(this.configuration).buildingVersionsGet(e,t).then((e=>e(this.axios,this.basePath)))}buildingsDataPost(e,t){return Mo(this.configuration).buildingsDataPost(e,t).then((e=>e(this.axios,this.basePath)))}findEhrcodesDateafterGet(e,t,n){return Mo(this.configuration).findEhrcodesDateafterGet(e,t,n).then((e=>e(this.axios,this.basePath)))}findEhrcodesDocIdGet(e,t){return Mo(this.configuration).findEhrcodesDocIdGet(e,t).then((e=>e(this.axios,this.basePath)))}}const Oo=e=>{var t,n,s,o;let{buildingsActualDataApiEndpoint:i,classifierApiEndpoint:a,linkGen:r,generateLink:l,myViewsApiEndpoint:d,searchType:c,userApiEndpoint:u,userInfo:p}=e;const h=(0,_n.useDispatch)(),g=["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:""),I=["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,[E,_]=(0,q.useState)({}),[v,y]=(0,q.useState)({}),[b,D]=(0,q.useState)({}),[x,M]=(0,q.useState)([]),[N,O]=(0,q.useState)([]),[A,U]=(0,q.useState)([]),[w,j]=(0,q.useState)(!1),[C,L]=(0,q.useState)(!1),[P,k]=(0,q.useState)(!1),Y=new Re(new vt({basePath:a})),B=new ze(new st({basePath:u})),G=new St(new vt({basePath:d})),V=new et(new st({basePath:u})),H=new No(new vt({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,q.useEffect)((()=>{Y.getAllDocumentTypes().then((e=>{h(m(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(S(e.data))})).catch((e=>{console.log(e)}))}),[]),(0,q.useEffect)((()=>{if(Object.keys(b).length>0){k(!0);G.searchDetailProceedings(b).then((e=>{h(F(e.data)),U(e.data),k(!1)})).catch((e=>{console.log(e),k(!1)}))}}),[b]),(0,q.useEffect)((()=>{if(Object.keys(v).length>0){L(!0);G.searchDetailDocuments(v).then((e=>{h(K(e.data)),O(e.data),L(!1)})).catch((e=>{console.log(e),L(!1)}))}}),[v]),(0,q.useEffect)((()=>{if(Object.keys(E).length>0){let e;j(!0),e=I?H.buildingOwnerSearchPost(E):H.buildingSearchPost(E),e.then((e=>{h(R(e.data)),M(e.data),j(!1)})).catch((e=>{console.log(e),j(!1)}))}}),[E,I]),(0,pn.jsxs)("div",{children:[(0,pn.jsx)(X.Section,{collapsed:c!==de,title:"detailsearch.buildings_detail_search",children:(0,pn.jsxs)("div",{children:[(0,pn.jsx)("div",{className:"filter-block",style:{paddingBottom:20},children:(0,pn.jsx)(ao,{onSubmit:e=>{_(e)},isAdminRole:g,isAdminPlusRole:I,callSearchPerson:J})}),Object.keys(E).length>0&&0===x.length&&!w?(0,pn.jsx)("div",{style:{height:210},className:"d-flex justify-content-center align-items-center",children:(0,pn.jsx)(X.Text,{raw:"detailsearch.empty_search_result"})}):w?(0,pn.jsx)(X.SectionLoader,{}):(0,pn.jsx)(po,{linkGen:r,generateLink:l,isAdminRole:g,isAdminPlusRole:I})]})}),(0,pn.jsx)(X.Section,{collapsed:"DOCUMENTS_SEARCH"!==c,title:"detailsearch.documents_detail_search",children:(0,pn.jsxs)("div",{children:[(0,pn.jsx)("div",{className:"filter-block",style:{paddingBottom:20},children:(0,pn.jsx)(ro,{onSubmit:e=>{y(e)},callSearchPerson:J,isNonAuthenticatedUser:T})}),Object.keys(v).length>0&&0===N.length&&!C?(0,pn.jsx)("div",{style:{height:210},className:"d-flex justify-content-center align-items-center",children:(0,pn.jsx)(X.Text,{raw:"detailsearch.empty_search_result"})}):C?(0,pn.jsx)(X.SectionLoader,{}):(0,pn.jsx)(fo,{linkGen:r,generateLink:l,userInfo:p,filterStateDocumentsSearch:v})]})}),g&&(0,pn.jsx)(X.Section,{collapsed:"PROCEEDINGS_SEARCH"!==c,title:"detailsearch.proceedings_detail_search",children:(0,pn.jsxs)("div",{children:[(0,pn.jsx)("div",{className:"filter-block",style:{paddingBottom:20},children:(0,pn.jsx)(lo,{onSubmit:e=>{D(e)}})}),Object.keys(b).length>0&&0===A.length&&!P?(0,pn.jsx)("div",{style:{height:210},className:"d-flex justify-content-center align-items-center",children:(0,pn.jsx)(X.Text,{raw:"detailsearch.empty_search_result"})}):P?(0,pn.jsx)(X.SectionLoader,{}):(0,pn.jsx)(So,{linkGen:r,userInfo:p,generateLink:l})]})})]})};export{Oo as DetailSearch,En as MyAdministrativeProceedings,Xs as MyApprovals,vs as MyDocuments,eo as MyInvolvements,Qs as MyOpinions,zs as MyProceedings,D as documentsReducer,I as filterReducer,L as myOperationsReducer,A as proceedingsReducer,$ as rootReducer};
|