eservices-core 1.3.76 → 1.3.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode('*{--extra-fast:.1s;--fast:.2s;--medium:.3s;box-sizing:border-box;--primary: #3949ab }html,body,#app{height:100%}body{margin:0}ul{text-align:left}.flex{display:flex}.flex_column{display:flex;flex-direction:column}.flex_center{display:flex;align-items:center;justify-content:center}.flex_full,.flex_grow{flex-grow:1}.flex-align_center{align-items:center}.grid{display:grid}.grid-center{display:grid;place-content:center}.link{text-decoration:var(--link-decoration);color:var(--link-color)}.link_hover-underline:hover,.link_hover_underline:hover{text-decoration:underline}.link_full{position:absolute;height:100%;width:100%;left:0;top:0}.text_sm{font-weight:400;font-size:12px;line-height:16px}.text_md{font-size:14px;line-height:20px}.text_lg{font-size:16px;line-height:24px}.text_size_xxl{font-size:18px;line-height:25px}.text_bold{font-weight:600}.text_nowrap{white-space:nowrap}.text_right{text-align:right}.text_center{text-align:center}.text_size_sm{font-size:12px;line-height:130%}.text_size_md{font-size:14px;line-height:140%}.text_error{color:red}.text_overflow{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.title_sm{font-weight:600;font-size:16px;line-height:24px}.title_md{font-weight:600;font-size:24px;line-height:32px}.title_lg{font-weight:700;font-size:32px;line-height:48px}.title_xxl,.title_xl{font-weight:700;font-size:48px;line-height:64px}.cursor_pointer{cursor:pointer}.cursor_default{cursor:default}button{outline:none;-webkit-user-select:none;user-select:none;transition:background-color .2s}.button{display:flex;align-items:center;justify-content:center;outline:none}.button_main{background-color:var(--button-background);color:var(--button-color)}.button_main:focus{background-color:var(--button-background-active)}.button_main:active{background-color:var(--button-background-active)}.button_white{background-color:var(--white);color:var(--main)}.button_sm{height:30px;width:130px}.button_shadow{box-shadow:0 2px 4px #00000040}.button_lg{font-weight:600;font-size:16px;line-height:24px;padding:12px 0;height:50px;width:200px}.button_disabled{background-color:var(--gray-1)}.button_resolve{background-color:var(--main);color:var(--white);border-radius:2px}.button_reject{border:1px solid var(--color-dark);border-radius:2px}.button_md{height:30px;padding:0 10px;min-width:80px}.button_disabled{background-color:var(--button-disabled-background-color);cursor:pointer!important}.color_main,.color__text_main{color:var(--main)}.color__text_black{color:var(--black-1)}.color__text_gray{color:var(--text-gray)}.color__text_red,.color_red{color:var(--red)}.color__text_white{color:var(--white)}.background_orange{background-color:var(--orange)}.background_red{background-color:var(--red)}.color_dark{color:var(--dark)}.color_light{color:var(--light)}.move-vertical-enter-active,.move-vertical-leave-active{transition:transform .5s ease}.move-vertical-enter-from,.move-vertical-leave-to{transform:translateY(-10px)}.move-horizontal-enter-active,.move-horizontal-leave-active{transition:transform .5s}.move-horizontal-enter-from,.move-horizontal-leave-to{transform:translate(-40px)}.modal-vertical-enter-active,.modal-vertical-leave-active,.modal-default{transition:transform var(--medium)}.modal-vertical-enter-active .modal-default,.modal-vertical-leave-active .modal-default{transform:translateY(-100px)}.move-vertical-fast-enter-active,.move-vertical-fast-leave-active{transition:transform var(--fast) ease}.move-vertical-fast-enter-from,.move-vertical-fast-leave-to{transform:translateY(-20px)}.slide-up-enter-active,.slide-up-leave-active{transition:transform var(--fast) ease,opacity var(--fast)}.slide-up-enter-from,.slide-up-leave-to{transform:translateY(20px);opacity:0}.opacity-enter-active,.opacity-leave-active{transition:opacity var(--fast) ease}.opacity-enter-from,.opacity-leave-to{opacity:0}.list-move,.list-enter-active,.list-leave-active{transition:all .5s ease}.list-enter-from,.list-leave-to{opacity:0;transform:translate(30px)}.list-leave-active{position:absolute}.modal-default{background-color:var(--white);position:relative;z-index:1;width:auto;background:var(--white);border-radius:var(--border-radius)}.modal-default__head{background-color:var(--black-1);text-align:center;padding:5px 0;border-radius:6px 6px 0 0}.modal-default__body{gap:20px;padding:0 15px}.modal-default__foot{padding:30px 0;display:flex;justify-content:center}.hint-tooltip{display:block;z-index:222;margin:auto;pointer-events:none;box-shadow:0 0 0 9999px #00000080}.tooltip-help-circle-in,.tooltip-help-circle-out{border-radius:50%}.tooltip-help-undefined{border-radius:50px}.tooltip-card{position:fixed;z-index:315;display:flex;flex-direction:column;width:480px;height:fit-content;margin:auto;border-radius:10px;background-color:var(--hint-background);cursor:default}.tooltip-card__foot{display:flex;justify-content:space-between;align-items:center;background-color:var(--hint-background-navigation);border-radius:10px;padding:20px}.tooltip-card__foot-current{font-weight:600;font-size:20px;line-height:24px;color:var(--white)}.tooltip-card__body{position:relative;display:flex;flex-direction:column;gap:8px;padding:20px 20px 10px}.tooltip-card__body-title{font-weight:700;font-size:20px;line-height:24px;color:var(--white)}.tooltip-card__body-text{font-size:16px;line-height:24px;color:var(--white)}.tooltip-card__foot-button_back{background-color:var(--main-1)}.tooltip-card__foot-button_next{background-color:var(--hint)}.tooltip-card__body-close{position:absolute;right:22px;top:12px;width:20px;height:16px;opacity:.3;cursor:pointer}.tooltip-card__body-close:hover{opacity:1}.tooltip-card__body-close:before,.tooltip-card__body-close:after{position:absolute;left:15px;content:" ";height:21px;width:2px;background-color:#fff}.tooltip-card__body-close:before{transform:rotate(45deg)}.tooltip-card__body-close:after{transform:rotate(-45deg)}.tooltip-card-container-wrap{pointer-events:none;position:absolute;left:0;top:0;z-index:123132;height:100%;width:100%}.tooltip-card-container-wrap>div{height:100%;width:100%;display:flex;justify-content:center;align-items:center}.tester-box-tooltip{pointer-events:all}.position_relative{position:relative}.position_absolute{position:absolute}.gap_5{gap:5px}.gap_10{gap:10px}.gap_15{gap:15px}.gap_20{gap:20px}.margin-0,.margin_0{margin:0}.widget-input{background-color:var(--input-background);border:var(--input-border);border-radius:var(--input-border-radius);color:var(--input-color)}.widget-input:disabled{background-color:var(--input-background-disabled);border:var(--input-border-disabled)}.widget-input[error=true]{border:var(--input-border-error)}.widget-input::placeholder{color:var(--input-placeholder-color)}.widget-input:disabled::placeholder{color:var(--input-placeholder-color-disabled)}.input_error{border:1px solid red!important}.input_size_md{height:var(--input-height)}.input-title{font-size:12px;line-height:16px;color:#667085;margin:4px 0}.widget-table{border-collapse:collapse}.widget-table_mini p{margin:0}.list-cell-link>a{position:absolute;left:0;top:0;z-index:1;height:100%;width:100%;cursor:pointer}.list-cell-link>p{font-weight:500}.widget-table__cell{padding:0 20px;font-weight:400;font-size:14px;line-height:19px;color:#4f4f4f}.widget-table-cell_use{cursor:pointer}.widget-table-cell_select{width:min-content}.table-cell-toggle{--border-color: black;position:relative;display:grid;place-content:center;border:1px solid var(--border-color);height:15px;aspect-ratio:1 / 1;border-radius:50%}.table-cell-toggle_active:after{content:"";border-radius:50%;background-color:var(--border-color);height:9px;aspect-ratio:1/1}.widget-table-cell_number{text-align:right}.overflow_auto{overflow:auto}.overflow_hidden{overflow:hidden}.padding_5{padding:5px}.padding_10{padding:10px}.padding_0{padding:0}.padding_15{padding:15px}.padding_20{padding:20px}.es-list-container{overflow:auto}.radius_5{border-radius:5px}.radius_10{border-radius:10px}.radius_15{border-radius:15px}.radius_20{border-radius:20px}.widget-table__head-cell[data-v-25198f4a]{padding:18px;text-align:start}.widget-table__head-label[data-v-25198f4a]{font-weight:600;font-size:14px;line-height:19px}[dir=rtl] .icon[data-v-e287c8d9]{transform:scaleX(-1)}.widget-spinner[data-v-0ef9ae88],.widget-spinner[data-v-0ef9ae88]:after{border-radius:50%;width:14px;height:14px}.widget-spinner[data-v-0ef9ae88]{font-size:2px;position:relative;text-indent:-9999em;border-top:1.1em solid rgba(255,255,255,.2);border-right:1.1em solid rgba(255,255,255,.2);border-bottom:1.1em solid rgba(255,255,255,.2);border-left:1.1em solid #ffffff;transform:translateZ(0);animation:spinnerAnimation-0ef9ae88 1.1s infinite linear}@keyframes spinnerAnimation-0ef9ae88{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.widget-button[data-v-450dc564]{position:relative}.widget-button-spinner[data-v-450dc564]{position:absolute;top:0;bottom:0;left:5px;margin:auto}.widget-multi-button-wrap[data-v-a8d711d1]{--button-size: 40px;max-height:var(--button-size);z-index:1;width:fit-content}.widget-multi-button[data-v-a8d711d1]{grid-template-columns:1fr var(--button-size);background-color:var(--primary);grid-template-rows:var(--button-size);transition:var(--fast)}.widget-multi-button_active[data-v-a8d711d1]{grid-template-rows:calc(var(--button-size) * var(--7025434e))}.widget-multi-button-body[data-v-a8d711d1]{min-width:80px}.widget-multi-button-body-label[data-v-a8d711d1]{padding:10px 10px 10px 20px;color:#fff;transition:background-color var(--fast)}.widget-multi-button-body-label[data-v-a8d711d1]:hover{background-color:#223296}.widget-multi-button-side[data-v-a8d711d1]{height:var(--button-size);transition:transform var(--fast),background-color var(--fast);color:#fff}.widget-multi-button-side_active[data-v-a8d711d1]{transform:rotate(180deg)}.widget-multi-button-side[data-v-a8d711d1]:hover{background-color:#223296}tr[data-v-344a8cc1]{border:1px solid #F3F4FC;height:30px}th[data-v-344a8cc1],td[data-v-344a8cc1]{position:relative;padding:0 11px}th[data-v-344a8cc1]{text-align:left}p[data-v-344a8cc1]{margin:0;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.widget-list-head-cell[data-v-bf495d6a]{padding:0 0 0 10px;display:flex}.widget-list-head-cell[data-v-bf495d6a]:hover{box-shadow:0 -1px #e7f2ff}.list-head-cell-label[data-v-bf495d6a]{padding:5px 0;white-space:nowrap;cursor:pointer}.head-cell-order[data-v-bf495d6a]{position:absolute;inset-inline-end:22px;inset-block:0 0;margin:auto;font-size:14px;height:14px}.head-cell-order_down[data-v-bf495d6a]{transform:rotate(180deg)}.head-cell-resize[data-v-bf495d6a]{padding:3px 10px;cursor:col-resize;transition:background-color .1s}.head-cell-resize[data-v-bf495d6a]:hover{background-color:#f5f5f5}.head-cell-resize[data-v-bf495d6a]:after{content:"";margin:auto;width:1px;height:100%;display:block;background-color:#d2d2d2}.widget-list-head[data-v-ccffc6bd]{position:sticky;top:-1px;z-index:1}.test-block[data-v-ccffc6bd]{position:absolute;z-index:2;display:none;height:calc(100% + 1px);place-content:center;inset-block-start:-1px;padding-inline:10px;background-color:#e7f2ff;-webkit-user-select:none;user-select:none;white-space:nowrap}.widget-list-head th[data-v-ccffc6bd]{position:sticky;top:0;z-index:2;-webkit-user-select:none;user-select:none}')),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
2
|
"use strict";/*!
|
|
3
|
-
* eservices-core v1.3.
|
|
3
|
+
* eservices-core v1.3.78
|
|
4
4
|
* (c) 2024 ESERVICES
|
|
5
5
|
*/Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("vue"),O=require("jenesius-vue-form"),ot=require("vue-router"),Be=require("debug"),It=require("date-and-time"),Te=require("jenesius-vue-modal");function Ot(n,e){return!!n&&n===e||"password is not equal"}function st(n){return Number(n.replace(/[^0-9.]/g,""))}function Rt(n,e=null){let r=String(st(n)).split(".");return r[0]=r[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),r.length>1&&e!==null&&r[1].length>e&&(r[1]=r[1].substring(0,e)),r.join(".")}const Lt=Object.freeze(Object.defineProperty({__proto__:null,numeric:st,prettyNumeric:Rt,validPassword:Ot},Symbol.toStringTag,{value:"Module"})),Pt={inputs:Lt};function ke(n,e){if(typeof n!="object"||n===null)return;if(e in n)return n[e];let t=e.indexOf(".");if(t>-1){const r=e.substring(0,t);return r in n?ke(n[r],e.substr(t+1)):void 0}return n[e]}function be(n,e){if(!n)return console.warn("Element is not provided.");function t(i,s){return i==s.target||i.contains(s.target)}const r=i=>{t(n,i)||(e(),window.removeEventListener("click",r))};window.addEventListener("click",r)}function at(n){return n.reduce((e,t)=>e.then(r=>t==null?void 0:t(r)),Promise.resolve())}const ct=class v extends Error{constructor(e,t=null){super(),this.message=e,this.details=t,this.id=v.ID++}static ParentFormNotFound(){return new v("Can't found parent form.")}static UndefinedNameOfCompositeFormController(e){return new v("Composite object name is undefined",e)}static EntityWithoutName(e){return new v("'Entity doesn't have a name",e)}static NotResolvedNameEventEmitter(e){return new v(`'${e}' is not a valid Event emitter name`)}static FormIsNotValidated(e){return new v("Form is not validated",e)}static ListWorkerIsRunningOrEnd(e){return new v("List data request is running or already done",e)}static ObjectIdNotNumber(e){return new v(`${e} (id) is not a number`)}static UndefinedErrorId(e,t){return v.ApiNotAvailable()}static ApiError(e){return new v("Request error",e)}static ApiNotAvailable(){return new v(`Sorry, we experience difficulties here.
|
|
6
|
-
Please try again later or submit a feedback if problem doesn't go.`)}static AuthServiceError(e,t){return!e&&!t?v.ApiNotAvailable():new v(e||"Authorization Error",t)}static ApiResponseParseFailed(){return v.ApiNotAvailable()}static MissingIdInValuesEntity(e){return new v("Object doesn't have id",e)}static ObjectWithIdNotFound(e,t){return new v(`Can't find object with id: ${e}`,t)}static ObjectWithoutConnectToPresentArray(e,t){return new v("Object is not found.",{object:e,array:t})}static EntityWithoutId(e){return new v("Entity doesn't have id.",e)}static NotFoundedTableIndex(e,t){return new v(`Can't find the element with tableIndex ${e}`,t)}static UndefinedError(e,t=[]){return new v(e,t)}static TableArrayAlreadyIncludeProvidedIndexValue(e,t,r){return new v(`Array already includes the element with value ${e}`,{array:t,table:r})}static MetadataEntityIsNotAvailable(e){return new v(`Metadata for the ${e} is not currently available.`)}static RequestTookToLong(){return new v("The request took too long to complete. Try again later.")}};ct.ID=0;let Y=ct;const $t="Please try again later or submit a feedback if problem doesn't go.";class lt{static getClientData(){return y("/close-api/client-content")}static getNavigation(){return y("/close-api/client/navigation")}}const Dt=new class{constructor(){this.store=o.reactive([])}add(e,t,{children:r,timeout:i=10,click:s=()=>{}}={}){const
|
|
6
|
+
Please try again later or submit a feedback if problem doesn't go.`)}static AuthServiceError(e,t){return!e&&!t?v.ApiNotAvailable():new v(e||"Authorization Error",t)}static ApiResponseParseFailed(){return v.ApiNotAvailable()}static MissingIdInValuesEntity(e){return new v("Object doesn't have id",e)}static ObjectWithIdNotFound(e,t){return new v(`Can't find object with id: ${e}`,t)}static ObjectWithoutConnectToPresentArray(e,t){return new v("Object is not found.",{object:e,array:t})}static EntityWithoutId(e){return new v("Entity doesn't have id.",e)}static NotFoundedTableIndex(e,t){return new v(`Can't find the element with tableIndex ${e}`,t)}static UndefinedError(e,t=[]){return new v(e,t)}static TableArrayAlreadyIncludeProvidedIndexValue(e,t,r){return new v(`Array already includes the element with value ${e}`,{array:t,table:r})}static MetadataEntityIsNotAvailable(e){return new v(`Metadata for the ${e} is not currently available.`)}static RequestTookToLong(){return new v("The request took too long to complete. Try again later.")}};ct.ID=0;let Y=ct;const $t="Please try again later or submit a feedback if problem doesn't go.";class lt{static getClientData(){return y("/close-api/client-content")}static getNavigation(){return y("/close-api/client/navigation")}}const Dt=new class{constructor(){this.store=o.reactive([])}add(e,t,{children:r,timeout:i=10,click:s=()=>{}}={}){const l=new xt(e,t,i,r||[],s);return this.store.push(l),i&&setTimeout(this.remove.bind(this,l.id),i*1e3),l}remove(e){const t=this.store.findIndex(r=>r.id===e);if(t===-1)return!1;this.store.splice(t,1)}removeChild(e,t){throw new Error("Removing children error.")}},ut=class dt{constructor(e,t,r,i,s){this.type=e,this.msg=t,this.timeout=r,this.children=i,this.click=s,this.id=dt.cardId++}};ut.cardId=1;let xt=ut;/*!
|
|
7
7
|
* jenesius-event-emitter v1.0.2
|
|
8
8
|
* (c) 2022 Jenesius
|
|
9
9
|
* @license MIT
|
|
10
|
-
*/const Je=function(n,e){return n in this.events||(this.events[n]=[]),this.events[n].push(e),this.off.bind(this,n,e)},He=function(n,e){n in this.events&&this.events[n].forEach(t=>t(e))},Xe=function(n,e){const t=this.events[n];if(!t)return;const r=t.indexOf(e);r!==-1&&t.splice(r,1)},Qe=function(){this.events={}};class x{constructor(){this.events={}}on(e,t){return Je.call(this,e,t)}emit(e,t){return He.call(this,e,t)}off(e,t){return Xe.call(this,e,t)}cleanEvents(){Qe.call(this)}static on(e,t){return Je.call(x,e,t)}static emit(e,t){return He.call(x,e,t)}static off(e,t){return Xe.call(x,e,t)}static cleanEvents(){Qe.call(x)}}x.events={};var ft=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},pe=(n,e,t)=>(ft(n,e,"read from private field"),t?t.call(n):e.get(n)),$e=(n,e,t)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,t)},De=(n,e,t,r)=>(ft(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),re,he,ge;const J=class b extends x{constructor(){super(...arguments),$e(this,re,void 0),$e(this,he,"front"),this.organizations=[],$e(this,ge,!1)}set language(e){localStorage.setItem(b.LOCALSTORAGE_LANGUAGE_KEY,e)}get language(){return localStorage.getItem(b.LOCALSTORAGE_LANGUAGE_KEY)||b.DEFAULT_LANGUAGE}checkLanguageInStorage(){return!!localStorage.getItem(b.LOCALSTORAGE_LANGUAGE_KEY)}get contextType(){var e;if(this.contextId)return((e=this.person)==null?void 0:e.id)===this.contextId?"person":"organization"}set router(e){De(this,re,e)}get router(){if(!pe(this,re))throw new Error("Router was not founded. Please set router: Manager.router = router: VueRouter");return pe(this,re)}set type(e){De(this,he,e)}get type(){return pe(this,he)}get isBack(){return this.type==="back"}get isFront(){return this.type==="front"}set ready(e){De(this,ge,e),this.emit(b.EVENT_READY_UPDATE,e)}get ready(){return pe(this,ge)}onReady(e){return this.on(b.EVENT_READY_UPDATE,e)}onupdateContext(e){return this.on(b.EVENT_CONTEXT_UPDATE,e)}onupdateData(e){return this.on(b.EVENT_DATA_UPDATE,e)}setCurrentContext(e){if(this.contextId===e)return console.log("[application-manager] The current context has already been installed.");this.contextId=Number(e),localStorage.setItem(b.CURRENT_CONTEXT_KEY,String(e)),this.emit(b.EVENT_CONTEXT_UPDATE,e),console.log(`Current context id %c${e}`,"color: purple")}get context(){var e;return this.contextId?this.contextId===((e=this.person)==null?void 0:e.id)?this.person:this.organizations.find(t=>t.id===this.contextId)||null:null}async init(){try{const e=await this.loadCustomerData();this.person=e,this.organizations=e.organizations,this.user=e.user,this.ready=!0;const t=Number.parseInt(localStorage.getItem(b.CURRENT_CONTEXT_KEY)||"");!Number.isNaN(t)&&this.validateContextId(Number(t))?this.setCurrentContext(t):this.setCurrentContext(Number(e.id))}catch{Dt.add("error",Y.ApiNotAvailable().message)}}loadCustomerData(){return lt.getClientData()}async updateFullClientData(){return this.init()}validateContextId(e){var t;return((t=this.person)==null?void 0:t.id)==e?!0:!!this.organizations.find(r=>r.id===e)}getListKeyById(e){return console.log("DEPRECATED"),`list-information-${e}`}getListInformationFromLocalStorage(e){console.log("DEPRECATED");const t=localStorage.getItem(this.getListKeyById(e));return t&&JSON.parse(t)}setListInformationToLocalStorage(e,t){console.log("DEPRECATED"),localStorage.setItem(this.getListKeyById(e),JSON.stringify(t))}};re=new WeakMap;he=new WeakMap;ge=new WeakMap;J.DEFAULT_LANGUAGE="en";J.LOCALSTORAGE_LANGUAGE_KEY="CurrentLanguage";J.EVENT_CONTEXT_UPDATE="event:context-update";J.EVENT_READY_UPDATE="event:ready-update";J.EVENT_DATA_UPDATE="event:data-update";J.CURRENT_CONTEXT_KEY="CurrentContext";let Mt=J;const Ze=new Mt;function Vt(n){return n.text().then(e=>{try{return JSON.parse(e)}catch{return $t}})}function y(n,e={}){return Ze.isFront&&(e.headers||(e.headers={}),e.headers["Context-Id"]=Ze.contextId),e.redirect="manual",fetch(n,e).then(t=>t.type==="opaqueredirect"?void window.location.replace("/auth"):t).catch(()=>{throw Y.ApiNotAvailable()}).then(t=>Vt(t).then(r=>{if(!t.ok)throw r;return r}))}class Ne{constructor(){}static parseNamesFromListConfig(e){let t=Ne.parseFieldsToGraphQL(e.reduce((i,s)=>(s.name&&i.push(s.name),i),[]));function r(i){let s="";for(let u in i)typeof i[u]=="boolean"?s+=` ${u} `:s+=` ${u} { ${r(i[u])} }`;return s}return r(t)}static parseSortFromListConfig(e){let t={};for(let r in e)t[r]=e[r]?"ASC":"DESC";return t}static parseFieldsToGraphQL(e){function t(r,i){if(i.includes(".")){const s=i.indexOf("."),u=i.substring(s+1),a=i.substring(0,s);a in r||(r[a]={}),t(r[a],u)}else r[i]=!0;return r}return e.reduce(t,{})}}class Bt{constructor(){this.public=!1,this.errors=new Proxy([],{set:(e,t,r)=>(t!=="length"&&this.public&&console.log(`Journal [Error] ${JSON.stringify(r)}`),e[t]=r,!0)}),window._journal=this}get error(){return{add:(...e)=>{this.errors.push(e)},clean:()=>{this.errors.splice(0,this.errors.length)},console:()=>{console.log(this.errors)}}}welcome(){console.log("The journal has been initialized. To get access check %c_journal in console.","background: blue; color: white")}}const Ft=new Bt;function pt(n){return n&&n[0].toLowerCase()+n.slice(1)}function Fe(n){return Object.keys(n).reduce((e,t)=>{let r=n[t];const i=t.charAt(0).toUpperCase()+t.slice(1);return typeof r=="object"&&!(r==null||Array.isArray(r))&&(r=Fe(r)),e[i]=r,e},{})}function Ut(n,e=2){if(!(typeof n=="string"||typeof n=="number"))return"";let r=String(n).split(".");return r[0]=r[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),r.length<2&&(r[1]=""),r[1]=r[1].padEnd(e,"0"),r[1].length>e&&(r[1]=r[1].substring(0,e)),r.join(".")}const jt={Request:y,clickOutside:be,getPropFromObject:ke,runPromiseQueue:at,GraphQL:Ne,firstChapterToLowerCase:pt,valuesToUpperCase:Fe,prettyMoney:Ut},Wt=Object.freeze(Object.defineProperty({__proto__:null,GraphQL:Ne,Journal:Ft,Request:y,clickOutside:be,default:jt,firstChapterToLowerCase:pt,getPropFromObject:ke,runPromiseQueue:at,valuesToUpperCase:Fe},Symbol.toStringTag,{value:"Module"})),qt=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));class Gt{static readHistoryById(e,t){return y(`/close-api/audits/history/${e}/${t}`,{method:"GET",headers:{"Content-Type":"application/json"}}).then(r=>{const i=r.history.map(s=>{if(!s.changes)return s;const u=s.changes.map(a=>({...a,oldValue:a.originalValue,name:a.fieldName}));return{...s,changes:u}});return{...r,history:i}})}}class zt{static getDictionary(e){if(!e)throw new Error(`Can't get dictionary for ${e}.`);return y(`/open-api/internationalization/language/${e}`)}}let K={};function Z(n,...e){if(typeof n!="string")return console.trace(`Label is not provided for translation: ${n}`),"undefined";let t=O.utils.getPropFromObject((this==null?void 0:this.vocabulary)||K,n);if(typeof t=="string")return et(t,e);const r=O.utils.getPropFromObject(K==null?void 0:K.root,n);return typeof r=="string"?et(r,e):(typeof t===void 0&&console.warn(`Translation for label "${n}" is not founded.`),n)}function et(n,e){return e.forEach((t,r)=>{n=n.replaceAll(new RegExp(`\\{${r}}`,"g"),t)}),n}Z.setGlobalVocabulary=function(n){K=n};Z.getScope=function(n){const e=typeof n=="string"?n:"root";return typeof n!="string"&&console.warn(`SCOPE ${n} for translate is not string.`),Z.bind({vocabulary:O.utils.getPropFromObject(K,e.toLowerCase())})};Z.setVocabulary=function(n){return typeof n=="string"&&(n=O.utils.getPropFromObject(K,n)),Z.bind({vocabulary:n})};const Kt=function(){let n=!1;const e=[];function t(){return n}function r(l,d){t()&&console[l](...d),e.push(d)}function i(...l){r("log",l)}function s(...l){r("warn",l)}function u(...l){r("error",l)}function a(l=!0){n=l}return{info:i,warn:s,history:e,display:a,error:u}}();function Yt(){return Kt}function Jt(n){return Array.isArray(n)&&n.length===2&&typeof n[0]=="string"&&typeof n[1]=="number"}const Ht="masterId",Xt="masterEntity";function Me(n,e){if(!Array.isArray(e))return;if(Jt(e))return t(e);e.forEach(t);function t(r){n.append(Xt,r[0]),n.append(Ht,r[1].toString())}}class ce{static async anonymousGetList(e){return await y(`/open-api/data/${e}`,{method:"GET",headers:{"Content-Type":"application/json"}})}static getSearchParamsForEntityListRead(e){const t=(i,s)=>r.append(i,s),r=new URLSearchParams;if(e.fields){const i=e.fields;typeof i=="string"?t("fields",i):Array.isArray(i)?t("fields",i.join(" ")):typeof i=="object"&&t("fields",Object.keys(i).join(" "))}if(e.order){let i=e.order;const u=(Array.isArray(i)?[i]:Object.entries(i)).map(([a,l="desc"])=>`@${a} ${l}`).join(",");t("order",u)}return e.limit&&t("limit",e.limit.toString()),e.offset&&t("offset",e.offset.toString()),e.filter&&t("filter",e.filter.toString()),e.useUsageContext&&r.append("useUsageContext",e.useUsageContext.toString()),r}static async getList(e,t){const r=ce.getSearchParamsForEntityListRead(t||{});return await y(`/close-api/data/${e}?${r.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"}})}static getCount(e,t){const r=ce.getSearchParamsForEntityListRead(t||{});return y(`/close-api/data/entities/${e}/count?${r.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"}})}static create(e,t,r){const i=new URLSearchParams;return Me(i,r==null?void 0:r.masterEntities),y(`/close-api/data/${e}?${i.toString()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({values:t})})}static update(e,t,r,i={}){return y(`/close-api/data/entities/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({values:r})})}static readById(e,t,r={}){const i=new URLSearchParams;if(r.fields){let s=r.fields;typeof s=="string"&&(s=[s]),i.append("fields",s.join(" "))}return y(`/close-api/data/entities/${e}/id/${t}?${i.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"}})}static updateById(e,t,r,i){const s=new URLSearchParams;return Me(s,i==null?void 0:i.masterEntities),y(`/close-api/data/entities/${e}/id/${t}?${s.toString()}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({values:r,version:i==null?void 0:i.version})})}static removeById(e,t,r){const i=typeof t=="number"?{Id:t}:t;return ce.removeByKeys(e,i,r)}static removeByKeys(e,t,r){return y(`/close-api/data/entities/${e}`,{method:"delete",headers:{"Content-Type":"application/json"},body:JSON.stringify({keys:t,version:r})})}}const ht=class ie{static async create(e){return y(ie.url,{method:"post",body:JSON.stringify(e),headers:{"Content-Type":"application/json"}})}static async read(e){const t=new URLSearchParams({targetCode:String(e.targetCode),entityName:e.entity.name,entityCatalogId:e.entity.catalogId});return y(ie.url+"?"+t.toString(),{method:"get"})}static async readMessages(e){return y(`${ie.url}/${e}/messages`,{method:"get"})}static async createMessage(e){return y(`${ie.url}/${e.talkId}/messages`,{method:"post",body:JSON.stringify({text:e.text}),headers:{"Content-Type":"application/json"}})}};ht.url="/close-api/communications";let Qt=ht;function tt(n){return{...n,createdEntities:n.createdEntites}}const gt=class ye{static async getStartConfig(e,t){return y([ye.url,e,t].join("/"),{method:"GET",headers:{"Content-Type":"application/json"}})}static async startProcess(e,t){return y([ye.url,e,t].join("/"),{method:"POST",headers:{"Content-Type":"application/json"}}).then(tt)}static async runStep(e,t,r,i,s){return y([ye.url,e,t].join("/"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({stepName:r,token:i,values:s})}).then(tt)}};gt.url="/close-api/views/process-wizard";let me=gt;class Zt{static async upload(e,t){const r=new FormData;r.append("file",e);const i=`/close-api/files?entityName=${t}`;return await fetch(i,{method:"POST",body:r}).then(s=>s.json()).then(s=>(s.filename=e.name,s))}}class en{static invite(e,t,r){return y("/close-api/accounts/invitePerson",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({organizationId:e,personKey:t,relatedRoleCode:r})})}static accept(e,t){return y("/close-api/accounts/markInvite",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({invitationId:e,version:t,mark:!0})})}static decline(e,t){return y("/close-api/accounts/markInvite",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({invitationId:e,version:t,mark:!1})})}}class Ue{static get url(){return"/close-api/rules-validation/"}static validate(e,t){return y(Ue.url+e,{method:"POST",body:JSON.stringify(t)})}}class tn{static getConfiguration(){return y("/open-api/webserver-configuration",{method:"GET",headers:{"Content-Type":"application/json"}})}}const nn={class:"widget-table__head"},rn={class:"widget-table__head-label margin_0 text_overflow"},on=o.defineComponent({__name:"widget-table-head",props:{config:{}},setup(n){return(e,t)=>(o.openBlock(),o.createElementBlock("tr",nn,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.config,(r,i)=>(o.openBlock(),o.createElementBlock("th",{class:"widget-table__head-cell",key:i},[o.createElementVNode("p",rn,o.toDisplayString(r.label),1)]))),128))]))}});const U=(n,e)=>{const t=n.__vccOpts||n;for(const[r,i]of e)t[r]=i;return t},sn=U(on,[["__scopeId","data-v-25198f4a"]]);function yt(n){return typeof n.name=="string"?n.name:Array.isArray(n.name)?n.name[0]:null}function mt(n,e){const t=yt(n);let r=t?O.utils.getPropFromObject(e,t):null;return r===void 0&&(r=null),n.value?n.value(r,e):n.value===null?null:r}function je(n){return["eservices-core",n].join(":")}function Et(n){return We(n,"YYYY/MM/DD HH:mm:ss")}function We(n,e="YYYY/MM/DD"){if(!n)return"";try{const t=new Date(n);return It.format(t,e)}catch(t){return console.log(t),"Invalid date"}}const an={props:{name:String},setup(n,e){let t="unknown";try{t=e.slots.default()[0].children}catch{t=n.name}typeof t!="string"&&console.warn(`Name for Icon.vue is not string. ${t}`);try{t=t.replace(/\s+/g,"")}catch{}return()=>o.h("i",{class:`icon icon-${t}`})}},le=U(an,[["__scopeId","data-v-e287c8d9"]]),cn=Be(je("setup-list-row"));function ln(n,e){const t=n.config.map(r=>un(r,n,e));return o.h("tr",{class:"widget-table__row widget-table-row"},t)}function un(n,e,t){const r=e.values;let i=mt(n,r);const s={onClick:[],class:["widget-table__cell widget-table-cell"]};function u(p){s.onClick.push(()=>p(r))}function a(p){Array.isArray(p)?s.class.push(...p):s.class.push(p)}const l=[],d=[];if(n.hide&&n.hide(r))return[o.h("td")];if(n.type)switch(a(`widget-table-cell_${n.type}`),n.type){case"number":{typeof i=="number"&&(i=new Intl.NumberFormat().format(i));break}case"date":{i=We(typeof i=="string"?i:null);break}case"dateTime":case"dateWithTime":{i=Et(typeof i=="string"?i:null);break}case"money":{i=wt(i);break}case"multi-select":{d.push(o.h(O.FormField,{type:"single-checkbox",modelValue:e.selected})),u(nt.bind(null,t,!0));break}case"select":{d.push(o.h(O.FormField,{type:"single-radio",modelValue:e.selected})),u(nt.bind(null,t,!1));break}}if(n.onClick&&u(n.onClick),n.link)try{const p=n.link(r);if(p){const T=o.h(ot.RouterLink,{to:p});d.push(T),a("widget-table-cell_link")}}catch(p){cn("Can't add router link",p)}if(n.href&&(d.push(o.h("a",{href:n.href(r),target:"_blank"})),a("widget-table-cell_link")),typeof i=="boolean"&&(i=i?"✓":"—"),(typeof i=="string"||typeof i=="number")&&d.push(o.h("p",{class:"widget-list-cell-text"},i)),n.icon&&(typeof n.icon=="string"&&d.push(o.h(le,{name:n.icon})),typeof n.icon=="function")){const p=n.icon(r);p!==null&&d.push(o.h(le,{name:p}))}return n.class&&(typeof n.class=="function"?a(n.class(r)):a(n.class)),l.push(o.h("td",s,d)),l}function nt(n,e){n.emit("select",e)}function vt(n,e){return()=>{try{return ln(n,e)}catch(t){return console.warn(t),null}}}const dn={props:{values:Object,config:Object,selected:Boolean},setup:vt},fn=["colspan"],rt=o.defineComponent({__name:"widget-table-form",props:{rowLength:{},component:{},values:{},isNew:{type:Boolean}},emits:["save","close"],setup(n,{emit:e}){const t=o.ref();return o.onMounted(()=>{setTimeout(()=>{t.value&&t.value.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})},250)}),(r,i)=>(o.openBlock(),o.createElementBlock("tr",{class:"widget-table-form",ref_key:"refTableForm",ref:t},[o.createElementVNode("td",{colspan:r.rowLength},[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(r.component),o.mergeProps(r.$attrs,{values:r.values,new:r.isNew,onClose:i[0]||(i[0]=s=>e("close")),onSave:i[1]||(i[1]=s=>e("save",s))}),null,16,["values","new"]))],8,fn)],512))}}),_={LIST_ACTIVE_NEW:"list-active-new",DEFAULT_ERROR_MESSAGE:"Please try again later or submit a feedback if problem doesn't go.",LOCALSTORAGE_CURRENT_CONTEXT_KEY:"CurrentContext",LOCALSTORAGE_LANGUAGE_KEY:"CurrentLanguage",DELAY_SOCKET_RECONNECT:1e3,PROVIDE_NAME_METADATA:"provide-metadata-config",PROVIDE_NAME_USAGE_CONTEXT:"provide-usage-context-config",PROVIDE_NAME_ACTIONS:"provide-actions",TIME_TO_LIVE_SOCKET_REQUEST:15e3,MODAL_VALIDATION_EFFECT:"validation-effect",MODAL_CONFIRM:"confirm"},pn={class:"widget-table"},it="update:selectedRows",hn=o.defineComponent({__name:"widget-table",props:{array:{},config:{},activeRow:{default:null},selectedRows:{default:()=>[]},classCallback:{}},emits:["update:activeRow","save"],setup(n,{emit:e}){const t=n,r=o.useSlots(),i=o.computed(()=>{var a;return(a=r==null?void 0:r.default)==null?void 0:a.call(r)[0]});function s(a,l=!0){if(!t.selectedRows)return;if(!l)return e(it,t.selectedRows.includes(a)?[]:[a]);const d=[...t.selectedRows],p=d.indexOf(a);return p===-1?d.push(a):d.splice(p,1),e(it,d)}function u(a){e("save",a),e("update:activeRow",null)}return(a,l)=>(o.openBlock(),o.createElementBlock("div",null,[o.createElementVNode("table",pn,[o.createVNode(sn,{config:a.config},null,8,["config"]),o.createElementVNode("tbody",null,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(a.array,(d,p)=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:p},[o.createVNode(dn,{config:a.config,values:d,selected:a.selectedRows.includes(d),onSelect:T=>s(d,T),class:o.normalizeClass(a.classCallback?a.classCallback(d):"")},null,8,["config","values","selected","onSelect","class"]),i.value&&a.activeRow===d?(o.openBlock(),o.createBlock(rt,{key:0,component:i.value,"row-length":a.config.length,values:d,onClose:l[0]||(l[0]=T=>e("update:activeRow",null)),onSave:u,"is-new":!1},null,8,["component","row-length","values"])):o.createCommentVNode("",!0)],64))),128)),a.activeRow===o.unref(_).LIST_ACTIVE_NEW?(o.openBlock(),o.createBlock(rt,{key:0,component:i.value,"row-length":a.config.length,onClose:l[1]||(l[1]=d=>e("update:activeRow",null)),onSave:u,"is-new":!0},null,8,["component","row-length"])):o.createCommentVNode("",!0)])])]))}}),gn=o.defineComponent({__name:"widget-spinner",props:{color:{default:"#fff"}},setup(n){return(e,t)=>(o.openBlock(),o.createElementBlock("div",{class:"widget-spinner",style:o.normalizeStyle({"border-left":`1.1em solid ${e.color}`})},null,4))}});const Ie=U(gn,[["__scopeId","data-v-0ef9ae88"]]),yn={class:"widget-button"},mn=o.defineComponent({__name:"widget-button",props:{wait:{type:Boolean}},setup(n){return(e,t)=>(o.openBlock(),o.createElementBlock("button",yn,[e.wait?(o.openBlock(),o.createBlock(Ie,{key:0,class:"widget-button-spinner"})):o.createCommentVNode("",!0),o.renderSlot(e.$slots,"default",{},void 0,!0)]))}});const En=U(mn,[["__scopeId","data-v-450dc564"]]),vn={class:"widget-multi-button-wrap position_relative cursor_pointer"},wn={class:"widget-multi-button-body grid"},_n=["onClick"],Tn={class:"widget-multi-button-side-wrap"},Cn=o.defineComponent({__name:"widget-multi-button",props:{label:{},array:{default:()=>[]}},setup(n){const e=n;o.useCssVars(u=>({"7025434e":r.value}));const t=o.reactive({active:!1,wait:!1}),r=o.computed(()=>e.array.length+(e.label?1:0));function i(u){if(!(typeof u!="function"||t.wait))return t.wait=!0,Promise.resolve().then(u).finally(()=>{t.wait=!1})}function s(u=!t.active){t.active=u}return(u,a)=>(o.openBlock(),o.createElementBlock("div",vn,[o.createElementVNode("div",{class:o.normalizeClass(["overflow_hidden radius_20 widget-multi-button grid",t.active?"widget-multi-button_active":null])},[o.createElementVNode("div",wn,[u.label?(o.openBlock(),o.createElementBlock("p",{key:0,class:"text_md margin_0 text_nowrap widget-multi-button-body-label",onClick:a[0]||(a[0]=l=>s())},o.toDisplayString(u.label),1)):o.createCommentVNode("",!0),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(u.array,(l,d)=>(o.openBlock(),o.createElementBlock("p",{class:"text_md margin_0 text_nowrap widget-multi-button-body-label",key:d,onClick:p=>{i(l.callback),s(!1)}},o.toDisplayString(l.label),9,_n))),128))]),o.createElementVNode("div",Tn,[o.createElementVNode("div",{class:o.normalizeClass(["grid-center widget-multi-button-side",t.active?"widget-multi-button-side_active":null]),onClick:a[1]||(a[1]=l=>s())},[t.wait?(o.openBlock(),o.createBlock(o.unref(Ie),{key:0,class:"widget-multi-button-side-spinner"})):u.array.length>1?(o.openBlock(),o.createBlock(o.unref(le),{key:1,class:"widget-multi-button-side-icon"},{default:o.withCtx(()=>[o.createTextVNode("angle-small-down")]),_:1})):o.createCommentVNode("",!0)],2)])],2)]))}});const Sn=U(Cn,[["__scopeId","data-v-a8d711d1"]]),An={class:"widget-loader flex flex-align_center gap_10 padding_15"},kn={class:"text_md"},bn=o.defineComponent({__name:"widget-loader",props:{label:{}},setup(n){return(e,t)=>(o.openBlock(),o.createElementBlock("div",An,[o.createVNode(Ie,{color:"var(--primary)",class:"padding_10"}),o.createElementVNode("span",kn,o.toDisplayString(e.label),1)]))}}),Nn=["alt","src"],In=o.defineComponent({__name:"widget-image",props:{src:{},alt:{},default:{}},setup(n){const e=n,t=o.ref();return o.onMounted(()=>{t.value&&(t.value.src=e.src),t.value.onerror=function(){e.default&&(t.value.src=e.default)}}),(r,i)=>(o.openBlock(),o.createElementBlock("img",{alt:r.alt,ref_key:"refImage",ref:t,src:r.src||r.$props.default},null,8,Nn))}}),On={props:{config:Array,values:Object,selected:Boolean},setup:vt};const Rn=U(On,[["__scopeId","data-v-344a8cc1"]]),Ln=n=>(o.pushScopeId("data-v-bf495d6a"),n=n(),o.popScopeId(),n),Pn={class:"widget-list-head-cell"},$n=Ln(()=>o.createElementVNode("div",{class:"head-cell-resize"},null,-1)),Dn=o.defineComponent({__name:"widget-list-head-cell",props:{title:{},label:{},name:{},type:{},minWidth:{},maxWidth:{},width:{},order:{}},emits:["select","order"],setup(n,{emit:e}){const t=n;return t.title&&console.warn(`For cell ${t.name} using title,it should be replaced with label.`),(r,i)=>(o.openBlock(),o.createElementBlock("th",null,[o.createElementVNode("div",Pn,[o.createElementVNode("div",{class:"head-cell-content flex_grow",style:o.normalizeStyle({"min-width":r.minWidth,"max-width":r.maxWidth,width:r.width})},[r.type==="multi-select"?(o.openBlock(),o.createBlock(o.unref(O.FormField),{key:0,type:"single-checkbox",onClick:i[0]||(i[0]=o.withModifiers(s=>e("select"),["stop","prevent"]))})):(o.openBlock(),o.createElementBlock("p",{key:1,class:"widget-list-head-label head-cell-label list-head-cell-label text_md margin-0",onClick:i[1]||(i[1]=s=>e("order"))},o.toDisplayString(r.title||r.label),1))],4),r.name&&r.order.length&&r.order[0]===r.name?(o.openBlock(),o.createBlock(o.unref(le),{key:0,class:o.normalizeClass(["head-cell-order",{"head-cell-order_down":r.order.length>1&&r.order[1]==="desc"}])},{default:o.withCtx(()=>[o.createTextVNode("core-arrow-up")]),_:1},8,["class"])):o.createCommentVNode("",!0),$n])]))}});const xn=U(Dn,[["__scopeId","data-v-bf495d6a"]]),Mn=o.defineComponent({__name:"widget-list-head",props:{config:{},order:{}},emits:["update:config","update:order","select"],setup(n,{emit:e}){const t=n,r=o.ref(),i=o.ref();o.onMounted(()=>{function l(E,w){let f=-1;do f++,w-=E[f];while(w>0&&f<E.length);return f}function d(E,w){let f=0;for(;w>0&&w>E[f]&&f<E.length;)w-=E[f],f++;return console.log(w,f),f>0?f:0}function p(E){try{i.value.style.insetInlineStart=E+"px"}catch(w){console.log(w)}}function T(E){try{i.value.style.width=E+"px",i.value.style.minWidth=E+"px",i.value.style.maxWidth=E+"px"}catch(w){console.log(w)}}function R(E){return E===null?!1:E.classList.contains("head-cell-resize")}r.value.addEventListener("pointerdown",function(w){var Ye;function f(k){return k.screenX+h-A}const m=r.value,c=[...m.children].filter(k=>k.localName==="th"),h=((Ye=m.offsetParent)==null?void 0:Ye.scrollLeft)||0,g=c.map(k=>k.clientWidth),$=R(w.target),A=m.getBoundingClientRect().left,H=f(w),C=l(g,H),j=g.slice(0,C).reduce((k,D)=>k+D,0),ee=H-j,Le=m.offsetWidth,te=c[C].clientWidth;if(t.config[C].type==="multi-select")return;console.group("START"),console.log(),console.log("Start screenX",w.screenX),console.log("Widths",g),console.log("max width",Le),console.log("Start Position",H),console.log("Position From",C),console.log("Start Position",C),console.log("Global offset (Отступ самой таблицы от края экрана)",A),console.log("Del",ee),console.groupEnd(),i.value.innerText=c[C].textContent||"",i.value.style.display="grid",i.value.style.width=te+"px",i.value.style.cursor="grabbing",p(j),T(te),document.addEventListener("pointermove",Ke,{passive:!0}),document.addEventListener("pointerup",ze);function ze(k){if(console.group("END"),document.removeEventListener("pointermove",Ke),document.removeEventListener("pointerup",ze),$&&(t.config[C].width=i.value.style.width,t.config[C].minWidth=i.value.style.width,t.config[C].maxWidth=i.value.style.width,s(t.config)),!$){const D=k.screenX+h-A;console.log("ENP Position",D);const fe=d(g,D);if(console.log(C,"->",fe),fe!==C){const ne=t.config[C],Pe=t.config;Pe.splice(C,1),Pe.splice(fe,0,ne),s(Pe)}else{const ne=t.config[C].name;u(ne)}}i.value.style.display="none",document.body.style.cursor="unset",console.groupEnd()}function Ke(k){if($){const ne=f(k)-H+te;T(ne);return}let D=k.screenX+h-A-ee;D<0&&(D=0),D+te>Le&&(D=Le-te),p(D)}})});function s(l){e("update:config",l)}function u(l){if(!l)return;if(Array.isArray(l)){if(l.length<1)return;l=l[0]}if(t.order.length===0||t.order[0]!==l)return void a([l]);const d=t.order.length===1||t.order[1]==="asc"?"asc":"desc";a([l,d==="asc"?"desc":"asc"])}function a(l){e("update:order",l)}return(l,d)=>(o.openBlock(),o.createElementBlock("tr",{class:"widget-list-head",ref_key:"refHead",ref:r},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(l.config,(p,T)=>(o.openBlock(),o.createBlock(xn,o.mergeProps({key:p},p,{onOrder:R=>u(p.name),onSelect:d[0]||(d[0]=R=>e("select")),order:l.order}),null,16,["onOrder","order"]))),128)),o.createElementVNode("div",{class:"test-block text_md",ref_key:"refDisplayPosition",ref:i},"test",512)],512))}});const Vn=U(Mn,[["__scopeId","data-v-ccffc6bd"]]),Bn={class:"widget-list"},Fn={class:"widget-list-body position_relative"},Un=50,jn=o.defineComponent({__name:"widget-list",props:{array:{},config:{default:()=>[]},selectedRows:{default:()=>[]},order:{default:()=>[]}},emits:["scrollEnd","update:selectedRows","update:order","update:config"],setup(n,{emit:e}){const t=n;function r(a,l=!0){if(t.selectedRows)if(!l)s(t.selectedRows.includes(a)?[]:[a]);else{const d=[...t.selectedRows],p=d.indexOf(a);p===-1?d.push(a):d==null||d.splice(p,1),s(d)}}function i(){var a;if(((a=t.selectedRows)==null?void 0:a.length)!==t.array.length)return s([...t.array]);s([])}function s(a){e("update:selectedRows",a)}function u(a){if(!a)return;const l=a.target;l.scrollTop+l.clientHeight+Un>l.scrollHeight&&e("scrollEnd")}return(a,l)=>(o.openBlock(),o.createElementBlock("div",{class:"es-list-container",onScrollPassive:u},[o.createElementVNode("table",Bn,[o.createElementVNode("thead",null,[o.createVNode(Vn,{onSelect:l[0]||(l[0]=d=>i()),"onUpdate:order":l[1]||(l[1]=d=>e("update:order",d)),"onUpdate:config":l[2]||(l[2]=d=>e("update:config",d)),config:a.config,order:a.order},null,8,["config","order"])]),o.createElementVNode("tbody",Fn,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(a.array,(d,p)=>{var T;return o.openBlock(),o.createBlock(Rn,{key:p,class:"widget-list-row",values:d,config:a.config,selected:(T=a.selectedRows)==null?void 0:T.includes(d),onSelect:R=>r(d,R)},null,8,["values","config","selected","onSelect"])}),128))])])],32))}}),B={};function Wn(n){for(let e in n)B[e]=n[e];console.log("The config has been initialized. To get access check %c_config in console.","background: purple; color: white")}function qn(n){function e(...r){return t.wait?Promise.reject("The process has already started."):(t.wait=!0,Promise.resolve().then(()=>n(...r)).finally(()=>{t.wait=!1}))}const t=o.reactive({wait:!1,call:e});return t}function Ce(n){return typeof n=="string"?xe(n):Gn(n)?xe(n.message):xe(_.DEFAULT_ERROR_MESSAGE)}function Gn(n){return!!(typeof n=="object"&&n!==null&&Object.hasOwnProperty.call(n,"message"))}function xe(n){return{message:n}}function L(n="error"){return function(e){const{message:t}=Ce(e);ue.add(n,t)}}function Se(n,e={}){return S().emit("entity:read",{...e,entity:n})}function qe(n,e){return S().emit("entity:update",{...e,entity:n})}function zn(n){return n.reduce((e,t)=>(t.name&&(typeof t.name=="string"?e.push(t.name):e.push(...t.name)),e),[])}function wt(n,e=2){if(!(typeof n=="string"||typeof n=="number"))return"";let r=String(n).split(".");return r[0]=r[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),r.length<2&&(r[1]=""),r[1]=r[1].padEnd(e,"0"),r[1].length>e&&(r[1]=r[1].substring(0,e)),r.join(".")}function Ge(n){return Object.keys(n).reduce((e,t)=>{let r=n[t];const i=t.charAt(0).toUpperCase()+t.slice(1);return typeof r=="object"&&!(r==null||Array.isArray(r))&&(r=Ge(r)),e[i]=r,e},{})}function Kn(n,e){const t=new Map;return n.forEach(r=>{var s;const i=e(r);t.has(i)||t.set(i,[]),(s=t.get(i))==null||s.push(r)}),t}function Yn(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,n=>(n^crypto.getRandomValues(new Uint8Array(1))[0]&15>>n/4).toString(16))}function Jn(n){return n.text().then(e=>{try{return JSON.parse(e)}catch{return _.DEFAULT_ERROR_MESSAGE}})}function F(n,e={}){return I.isFront&&(e.headers||(e.headers={}),e.headers["Context-Id"]=I.contextId),e.redirect="manual",fetch(n,e).then(t=>t.type==="opaqueredirect"?void window.location.replace("/auth"):t).catch(()=>{throw new Error(_.DEFAULT_ERROR_MESSAGE)}).then(t=>Jn(t).then(r=>{if(!t.ok)throw r;return r}))}function Hn(n,e=1e3){let t=0;return(...r)=>{clearTimeout(t),t=setTimeout(()=>n(...r),e)}}function Xn(n,e){let t=!1;return(...r)=>{if(!t)return t=!0,setTimeout(()=>t=!1,e),n(...r)}}const Qn=Be(je("pretty-value-field-by-entity"));function Zn(n,e,t){try{const r=Ae.get(n);if(!r)throw new Error("For entity metadata is not loaded");const i=r.fieldsByName[e];if(!i)throw new Error(`For entity ${n} can't found fieldMetadata for field ${e}`);return i.dataType==="DateTime"&&typeof t=="string"?new Date(t).toLocaleString():t}catch(r){return Qn('Error by parse pretty value for entity %o "%s", field "%s" with value "%s"',r,n,e,t),t}}const er=1,tr=5e3,W=Be(je("use-socket"));function S(){return rr}function nr(n){return typeof n=="object"&&Object.prototype.toString.call(n)==="[object Blob]"}const rr=function(){let n=1,e,t;const r=new Set;let i=0;const s=new Set;function u(){if(e)i&&(clearTimeout(i),i=0);else return;i=setTimeout(()=>{e.close()},tr*2);const c=new Uint8Array(1);c[0]=er,e.send(c)}setInterval(()=>{Array.from(r).forEach(c=>{m(c)&&(W("Handler for event %s requestId %d was expired",c.event,c.requestId),c.requestId?l({requestId:c.requestId,event:"request-error",data:{message:Y.RequestTookToLong().message}}):r.delete(c))})},1e3),setInterval(()=>{(!e||e.readyState===3)&&d()},_.DELAY_SOCKET_RECONNECT);function a(){return{safeQueue:s,requestId:n,handlers:r,socketInstance:e}}function l(c){const h=[...r.values()];W("Handlers array length is %d. Response event: %s. Request id: %d",r.size,c.event,c.requestId),h.forEach(g=>{const $=c.requestId;(g.requestId&&g.requestId===$||!g.requestId&&g.event===c.event)&&(W("Find appropriated handler: %d, event: %s",n,g.event),g.callback(c.data,c),g.once&&(r.delete(g),W("Handler was removed by *once* params was passed. %o",g)))})}function d(){if(typeof t!="string"){console.log("Please initialize use-socket");return}console.log(`%cInitializing sockets: %c${t}`,"color: purple","color: black"),e=new WebSocket(t),e.onclose=function(c){W("Connection to server was stopped: %d %s",c.code,c.reason),Array.from(r).forEach(h=>{h.guaranteedAnswer&&h.serializeString&&s.add(h.serializeString)})},e.onopen=function(){console.log("Socket was %cconnected.","color: green"),[...s.values()].forEach(c=>{p(c),s.delete(c)})},e.onerror=function(c){console.warn(c)},e.onmessage=c=>{var h;try{if(nr(c.data)){u();return}const g=JSON.parse(c.data);if(!_t(g)){console.warn("Data is %cnot correct %csocket answer.","color: red","color: black"),console.log(g);return}(h=g==null?void 0:g.data)!=null&&h.refresh&&location.reload(),l(g)}catch(g){console.warn("Socket handle %conmessage%c error.","color: red","color: black"),console.log(g)}}}function p(c){e.send(c)}function T(c,h){f({event:c,callback:h})}function R(c,h){f({event:c,callback:h,once:!0})}function E(){return e&&(e==null?void 0:e.readyState)===1}function w(c,h,g){const $=++n,A=JSON.stringify({requestId:$,event:c,data:h,contextId:I.contextId,url:window.location.href});return E()?p(A):(s.add(A),W("Socket is not connected. Message was send to save-queue")),new Promise((H,C)=>{f({event:c,requestId:$,once:!0,guaranteedAnswer:!0,serializeString:A,callback:(j,ee)=>{if(W("Promise was resolve with next data:",j),ir(ee))return void C(j);g&&g(j,ee),H(j)},timeToLive:_.TIME_TO_LIVE_SOCKET_REQUEST})})}function f(c){const h={timeToLive:0,...c,created:new Date().getTime()};r.add(h)}function m(c){return c.timeToLive===0||typeof c.timeToLive!="number"?!1:new Date().getTime()-c.created>c.timeToLive}return{get socket(){return e},on:T,once:R,emit:w,initialization(c){t=c},getDevInfo:a}}(),ir=n=>!!_t(n)&&n.event==="request-error",_t=n=>typeof n=="object"&&n!==null&&"event"in n&&typeof n.event=="string"&&"requestId"in n&&typeof n.requestId=="number"&&"data"in n;function or(n,e){return S().emit("list-setting:read",{entity:n,mark:e})}function sr(n,e){return S().emit("metadata-field:treat",{entity:n,fieldName:e})}function Tt(n,e){return S().emit("entity:create",{...e,entity:n})}function Ct(n,e){return S().emit("entity:delete",{...e,entity:n})}function ar(n,e){return S().emit("usage-context:read",{...e,entity:n})}function St(n={}){return S().emit("tool:read",n)}function cr(n,e={},t={}){const r=Array.isArray(n)?n:o.inject(_.PROVIDE_NAME_ACTIONS),i=typeof n=="string"?n:e,s=typeof e=="string"?t:e;return o.computed(()=>{const u=(o.unref(r)||[]).find(a=>a.action.name===i);return u?{...u,...s}:null})}function lr(){const n=o.ref(null);function e(t){n.value=t}return{activeRow:n,activateRow:e}}function ur(n,e){const t=o.reactive([]);let r=0;const i=o.ref(!1);function s(){if(i.value)return Promise.reject("The process has already started.");const f=E();return i.value=!0,typeof f.limit!="number"&&(f.limit=100),f.offset=r,Se(n,f).then(m=>(r+=m.length,m)).finally(()=>{i.value=!1})}function u(f,m){var h;return typeof f.Version=="number"?f.Version:(h=t.find(g=>g.Id===m))==null?void 0:h.Version}function a(f,m){const c=t.findIndex(h=>h.Id===f);if(c===-1)throw new Error(`Can't found item with Id ${f}`);t.splice(c,1,m)}function l(f){const m=t.findIndex(c=>c.Id===f);if(m===-1)throw new Error(`Can't found item with Id ${f}`);t.splice(m,1)}async function d(f,m){try{const c=E(),h=u(m,f);delete m.Version,await qe(n,{id:f,values:m,version:h});const g=await Se(n,{fields:c.fields||"",id:f});a(f,g)}catch(c){L()(c)}}async function p(f,m){try{const c=E(),h=u(m,f);delete m.Version,await Ct(n,{id:f,version:h}),l(f)}catch(c){L()(c)}}async function T(f){try{await Tt(n,{values:f}),await w()}catch(m){L()(m)}}async function R(){try{const f=await s();t.push(...f)}catch(f){L()(f)}}function E(){return typeof e=="function"?e():e}async function w(){try{r=0;const f=await s();t.splice(0,t.length,...f)}catch(f){L()(f)}}return{array:t,updateById:d,next:R,reload:w,wait:i,create:T,deleteById:p}}function dr(){function n(){return{organizations:I.organizations,currentContextId:I.contextId,person:I.person,context:I.context,contextType:I.contextType,userId:I.userId}}const e=o.reactive(n());return I.onupdateContext(()=>{Object.assign(e,n())}),e}function fr(n,e,t){return S().emit("communication:create",{entityName:n,entityCatalogId:e,targetCode:t})}function pr(n,e,t){return S().emit("communication:read",{entityName:n,entityCatalogId:e,targetCode:t})}function hr(n,e){return S().emit("communication-message:create",{communicationId:n,text:e})}function gr(n){return S().emit("communication-message:read",{communicationId:n})}function yr(n){const e=O.Form.getParentForm(),t=o.reactive([]);return e&&e.subscribe(n),n.read=()=>gr(n.id).then(r=>(t.splice(0,t.length,...r),r)),{array:t}}function mr(n,e){n.read=()=>{const r=t();return Promise.resolve().then(()=>{if(!n.name)throw Y.EntityWithoutName(n);return Se(n.name,r)}).then(Ge).then(i=>(i.hasOwnProperty("Version")&&(n.version=i.Version),n.setValues(i),i)).catch(L())},n.save=()=>{const r=t();return Promise.resolve().then(()=>{if(!n.name)throw Y.EntityWithoutName(n);return qe(n.name,{id:r.id,values:n.changes,version:n.version})}).then(i=>{n.version=i.version}).catch(i=>{throw L()(i),i})};function t(){return typeof e=="function"?e():e}}function Er(n){if(!n)return o.inject(_.PROVIDE_NAME_METADATA);Ae.initEntity(n);const e=o.computed(()=>Ae.state[n]);return o.provide(_.PROVIDE_NAME_METADATA,e),e}function vr(n,e={}){if(!n)return o.inject(_.PROVIDE_NAME_USAGE_CONTEXT);const t=o.ref(null);return o.provide(_.PROVIDE_NAME_USAGE_CONTEXT,t),{state:t,update:async function(){t.value=await ar(n,wr(e||{}))}}}function wr(n){return typeof n=="function"?n():n}function _r(n={}){const e=o.reactive([]),t=o.computed(()=>e.map(s=>i(s)));o.provide(_.PROVIDE_NAME_ACTIONS,t),n.router=ot.useRouter(),n.handleConfirmation||(n.handleConfirmation=Cr),n.handleAffectedEntity||(n.handleAffectedEntity=Ar),n.handleCloseForm||(n.handleCloseForm=kr),n.handleValidationResult||(n.handleValidationResult=Sr);function r(s={}){return e.splice(0,e.length),St(s).then(u=>e.splice(0,0,...u)).catch(L("error"))}function i(s){return{...s,label:s.title,callback(){const u=typeof n.values=="function"?n.values():n.values,a=()=>F(s.url,{method:"POST",body:JSON.stringify({keys:u,contextId:I.contextId}),headers:{"Content-Type":"application/json"}}).then(async l=>{if(!br(l))throw new Error("It is impossible to process the result of calls.");if(Array.isArray(n.handlers))for await(const d of n.handlers)await d(s,l,n);if(!l.success)throw n.handleValidationResult&&l.validationEffect&&n.handleValidationResult(s,l.validationEffect,n),new Error(l.message);return l.message&&ue.add("info",l.message),Array.isArray(l.affectedEntities)&&n.handleAffectedEntity&&l.affectedEntities.forEach(d=>{var p;return(p=n.handleAffectedEntity)==null?void 0:p.call(n,s,d,n)}),s.closeHostForm&&n.handleCloseForm&&n.handleCloseForm(s,n),l}).catch(L("error"));return!s.confirmation||!n.handleConfirmation?a():n.handleConfirmation(s,a)}}}return{actions:t,update:r}}function Tr(n){const e="Are you sure?";return n===!0||typeof n=="string"&&n.toLowerCase()==="true"||n==="1"?e:typeof n=="string"?n:e}function Cr(n,e){const t=Tr(n.confirmation),r=_.MODAL_CONFIRM;if(!Te.getComponentFromStore(r))throw new Error("The 'confirm' modal window is not installed. It provided inside 'constants.MODAL_CONFIRM'");return new Promise((i,s)=>{Te.pushModal(r,{message:t,resolve:()=>Promise.resolve().then(e).then(i),reject:s})})}function Sr(n,e){const t=_.MODAL_VALIDATION_EFFECT;if(!Te.getComponentFromStore(t))throw new Error("The 'validation-effect' modal window is not installed. It provided inside 'constants.MODAL_VALIDATION_EFFECT'");return new Promise(()=>{Te.pushModal(t,e)})}function Ar(n,e,t){var a;const{router:r,form:i,emits:s}=t,u=(a=e.primaryKey)==null?void 0:a.Id;if(s&&s("affectEntity",e),r&&e&&e.name===n.redirectEntity)return r.push({name:e.name,params:{id:u}});i&&e.name===i.name&&e.updated&&u===i.id&&i.read()}function kr(n,e){const{router:t}=e;t&&n.closeHostForm&&t.back()}function br(n){return!!(n&&typeof n=="object"&&"affectedEntities"in n&&"success"in n)}const ue=new class{constructor(){this.store=o.reactive([])}add(e,t,r={}){const i=Nr(r),s=new Ir(e,t,i.timeout,i.children,i.click);return this.store.push(s),i.timeout&&setTimeout(this.remove.bind(this,s.id),i.timeout*1e3),s}remove(e){const t=this.store.findIndex(r=>r.id===e);if(t===-1)return!1;this.store.splice(t,1)}};function Nr(n){function e(r){return!!r&&typeof r=="object"}const t={timeout:10,click:()=>null,children:[]};return e(n)?{timeout:n.timeout||t.timeout,click:n.click||t.click,children:n.children||t.children}:t}const At=class kt{constructor(e,t,r,i,s){this.type=e,this.message=t,this.timeout=r,this.children=i,this.click=s,this.id=kt.cardId++}};At.cardId=1;let Ir=At;class Or extends x{constructor(e){super(),this.name="Communication",this.read=()=>{},this.id=e}sendMessage(e){return hr(this.id,e)}static checkAndGenerate(e,t,r){return pr(e,t,r).then(i=>i.length===0?fr(e,t,r):i[0])}}function Rr(){return S().emit("client:read",{})}var bt=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},Lr=(n,e,t)=>(bt(n,e,"read from private field"),t?t.call(n):e.get(n)),Pr=(n,e,t)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,t)},$r=(n,e,t,r)=>(bt(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),Ee;const Oe=class X extends x{constructor(){super(...arguments),this.type="front",this.organizations=[],Pr(this,Ee,!1)}set language(e){localStorage.setItem(_.LOCALSTORAGE_LANGUAGE_KEY,e)}get language(){return localStorage.getItem(_.LOCALSTORAGE_LANGUAGE_KEY)||X.DEFAULT_LANGUAGE}get contextType(){var e;if(this.contextId)return((e=this.person)==null?void 0:e.id)===this.contextId?"person":"organization"}get isBack(){return this.type==="back"}get isFront(){return this.type==="front"}set ready(e){$r(this,Ee,e),this.emit(X.EVENT_READY_UPDATE,e)}get ready(){return Lr(this,Ee)}onReady(e){return this.on(X.EVENT_READY_UPDATE,e)}onupdateContext(e){return this.on(X.EVENT_CONTEXT_UPDATE,e)}setCurrentContext(e){if(this.contextId===e)return console.warn("[application-manager] The current context has already been installed.");this.contextId=Number(e),localStorage.setItem(_.LOCALSTORAGE_CURRENT_CONTEXT_KEY,String(e)),this.emit(X.EVENT_CONTEXT_UPDATE,e),console.log(`Current context id %c${e}`,"color: purple")}get context(){var e;return this.contextId?this.contextId===((e=this.person)==null?void 0:e.id)?this.person:this.organizations.find(t=>t.id===this.contextId)||null:null}async init(){try{const e=await this.loadCustomerData();this.person=e,this.organizations=e.organizations,this.userId=e.userId,this.restoreCurrentContext(),this.ready=!0}catch(e){L()(e)}}restoreCurrentContext(){const e=Number.parseInt(localStorage.getItem(_.LOCALSTORAGE_CURRENT_CONTEXT_KEY)||"");if(!Number.isNaN(e)&&this.validateContextId(Number(e)))this.setCurrentContext(e);else{if(!this.person)return console.warn("Make sure you call ID recovery after saving user data");this.setCurrentContext(this.person.id)}}loadCustomerData(){return Rr()}validateContextId(e){var t;try{return((t=this.person)==null?void 0:t.id)==e?!0:!!this.organizations.find(r=>r.id===e)}catch{return!1}}};Ee=new WeakMap;Oe.DEFAULT_LANGUAGE="en";Oe.EVENT_CONTEXT_UPDATE="event:context-update";Oe.EVENT_READY_UPDATE="event:ready-update";let Dr=Oe;function xr(n){return S().emit("metadata:read",{entity:n})}const Ae=function(){const e=o.reactive({}),t=new Map;function r(a){return e[a]}async function i(a){if(t.has(a)&&await t.get(a),e[a])return;const l=await s(a);u(a,l)}function s(a){const l=xr(a).finally(()=>{t.delete(a)});return t.set(a,l),l}function u(a,l){e[a]=l}return{state:e,initEntity:i,get:r}}();class N{static login(e){return F(B.identityServerURL+"/api/Authenticate/Login",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({...e,AppName:B.applicationName})})}static parseProcessAnswer(e){if(e.statusCode>4)throw new Error(e.statusName.replace(/([A-Z][a-z])/g," $1").replace(/(\d)/g," $1"));return e}static startRegistrationProcess(e){return N.requestStepRegistrationProcess("StartRegistration",e)}static confirmPhoneRegistrationProcess(e){return N.requestStepRegistrationProcess("ConfirmPhoneNumberByRegistration",e)}static confirmEmailRegistrationProcess(e){return N.requestStepRegistrationProcess("ConfirmEmailByRegistration",e)}static finishEmailRegistrationProcess(e){return N.requestStepRegistrationProcess("FinishRegistration",e)}static requestStepRegistrationProcess(e,t){return F(`${B.identityServerURL}/api/Authenticate/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(t)})}static startLoginProcess(e){return N.requestStepLoginProcess("StartLogin",e)}static loginWithPassword(e){return N.requestStepLoginProcess("LoginWithPassword",e)}static loginWithOtpCode(e){return N.requestStepLoginProcess("LoginWithOtpCode",e)}static requestStepLoginProcess(e,t){return F(`${B.identityServerURL}/api/Authenticate/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(t)}).then(N.parseLoginProcessAnswer)}static parseLoginProcessAnswer(e){if(e.statusCode>3)throw Error(e.statusName.replace(/([A-Z][a-z])/g," $1").replace(/(\d)/g," $1"));return e}static startPasswordReset(e){return F(`${B.identityServerURL}/api/Authenticate/StartPasswordReset`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({UserId:e})})}static verifyPasswordResetBySMS(e,t){return N.verifyPasswordReset("SMS",e,t)}static verifyPasswordResetByEmail(e,t){return N.verifyPasswordReset("Email",e,t)}static verifyPasswordReset(e,t,r){return F(`${B.identityServerURL}/api/Authenticate/VerifyPasswordReset`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({Token:t,Code:r,Channel:e})})}static resolvePasswordReset(e,t){return F(`${B.identityServerURL}/api/Authenticate/ResetPassword`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({Token:e,NewPassword:t})})}}function Mr(n){return typeof n!="object"||n===null?!1:!!(n.hasOwnProperty("start")||n.hasOwnProperty("end"))}function P(n){return Object.keys(n).reduce((e,t)=>{const r=n[t];if(Array.isArray(r)){const i=r.map(s=>typeof s=="string"?`'${s}'`:s).join(", ");return r.length&&e.push(`@${t} in (${i})`),e}if(Mr(r)){let i=function(s){var u;return((u=s.match(/([^Z]*)/))==null?void 0:u[0])+"0000Z"};return r.start&&e.push(`@${t} ge ${i(r.start)}`),r.end&&e.push(`@${t} le ${i(r.end)}`),e}return typeof r=="number"?(e.push(`@${t} eq ${r}`),e):typeof r=="string"?(r.length!==0&&e.push(`@${t} eq '${r}'`),e):(r===null&&e.push(P.is(t,r)),e)},[]).join(" and ")}function de(n){return typeof n=="string"?`'${n}'`:`${n}`}P.includes=function(e,t){return`@${e} Contains ${de(t)}`};P.beginWith=function(e,t){return`@${e} BeginWith ${de(t)}`};P.notEq=function(e,t){return`@${e} nq ${de(t)}`};P.eq=function(e,t){return Array.isArray(t)?P.in(e,t):`@${e} eq ${de(t)}`};P.in=function(e,t){const r=t.map(de).join(", ");return`@${e} in (${r})`};P.and=function(...e){return e.filter(t=>typeof t!="string"||t.trim().length===0?!1:t).map(t=>`(${t})`).join(" and ")};P.is=function(e,t){return`@${e} is ${t}`};P.or=function(...e){return e.join(" or ")};const I=new Dr;class Vr{static url(){return"/close-api/actions"}static async get({criterion:e}){const t=new URLSearchParams;return e&&t.append("criterion",e),await fetch(this.url()+`?${t.toString()}`,{method:"GET"}).then(r=>r.json())}static getById(e,t,r=[]){const i=new URLSearchParams;return Me(i,r),F([this.url(),e,t].join("/")+`?${i.toString()}`,{method:"GET"})}}function Br(n,e="images"){return`/static-folder/${e}/${n}`}class Fr{static getRequiredDocuments(e,t,r){const i=new URLSearchParams({entity:e,primaryKey:t,statusCode:r});return fetch(`/close-api/views/required-documents?${i.toString()}`).then(s=>s.json())}}class Q{static url(){return"close-api/billing"}static getBillingMetadata(e){return fetch(`/${Q.url()}/calculator/${e}`)}static calculate(e,t){return y(`/${Q.url()}/calculator`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({entity:e,values:t})}).then(r=>{if(r&&r.status===1)return r;throw Array.isArray(r.notes)?new Error(r.notes[0]):Y.ApiNotAvailable()})}static parseMetadataField(e){function t(r){switch(r.type){case"ValueType":switch(r.dataType){case"Integer":return"number";default:return r.dataType}case"EntityReference":return r.dataType}}return{name:e.name,label:e.title,required:e.required,type:t(e)}}static createOnlinePayment(e,t){return y(`/${Q.url()}/online-payment`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paymentId:e,returnURL:t})})}static applyOnlinePayment(e){return y(`/${Q.url()}/online-payment`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({response:e})})}}var Nt=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},M=(n,e,t)=>(Nt(n,e,"read from private field"),t?t.call(n):e.get(n)),q=(n,e,t)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,t)},G=(n,e,t,r)=>(Nt(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),ve,oe,we,_e,se,ae,Ve;const z="_______LIST_______ROW_______INDEX________NAME_______",Re=class V extends x{constructor(e){super(),this.LIST_ROW_KEY=1,q(this,ve,void 0),this.array=[],q(this,oe,[]),q(this,we,[]),q(this,_e,new Proxy({},{set:(t,r,i,s)=>(t[r]=i,this.emit(V.EVENT_FILTERS_UPDATE,t),!0),deleteProperty:(t,r)=>(delete t[r],this.emit(V.EVENT_FILTERS_UPDATE,t),!0)})),q(this,se,!1),q(this,ae,(...t)=>Promise),q(this,Ve,()=>{}),G(this,ve,e.primaryKeys||[]),this.name=e.name||void 0,e.config&&G(this,oe,e.config)}set config(e){G(this,oe,e.map(O.utils.copyObject)),this.emitUpdateConfig()}get config(){return M(this,oe)}emitUpdateConfig(){this.emit(V.EVENT_CONFIG_UPDATE,this.config)}get order(){return M(this,we)}set order(e){G(this,we,e),this.emit(V.EVENT_ORDER_UPDATE,this.order)}get filters(){return M(this,_e)}set filters(e){jr(M(this,_e),e)}set wait(e){G(this,se,e),this.emit(O.Form.EVENT_WAIT,M(this,se))}get wait(){return M(this,se)}get primaryKeys(){return M(this,ve)}at(e){return this.array[e%this.array.length]}atByKey(e){return this.array.find(t=>t[z]===e)}indexByKey(e){return this.array.findIndex(t=>t[z]===e)}static getKey(e){return e[z]}static hasKey(e){return typeof e!="object"||e===null?!1:Object.prototype.hasOwnProperty.call(e,z)}add(...e){const t=this.wrapArray(e);this.array.push(...t),this.emit(V.EVENT_DATA,this.array)}set(e){this.array=[],this.add(...e)}removeByKey(e){const t=this.indexByKey(e);t!==-1&&(this.array.splice(t,1),this.emit(V.EVENT_DATA,this.array))}updateByKey(e,t){const r=this.atByKey(e);r&&(Object.assign(r,t),this.emit(V.EVENT_DATA,this.array))}wrapArray(e){return e.map(this.wrapItem.bind(this))}wrapItem(e){return this.isWrapped(e)?e:{...e,[z]:this.LIST_ROW_KEY++}}isWrapped(e){return Object.prototype.hasOwnProperty.call(e,z)}set read(e){G(this,ae,e)}get read(){return(...e)=>Promise.resolve().then(()=>{const t=M(this,ae).call(this,...e);return this.wait=!0,t}).finally(()=>this.wait=!1)}set save(e){G(this,ae,e)}get save(){return()=>Promise.resolve().then(()=>this.wait=!0).then(()=>M(this,Ve).call(this)).finally(()=>this.wait=!1)}static GetFieldNames(e){return e.reduce((t,r)=>(r.name&&(typeof r.name=="string"?t.push(r.name):t.push(...r.name)),t),[])}static mergeWithKey(e,t){return{...e,[z]:t}}static getCellName(e){return typeof e.name=="string"?e.name:Array.isArray(e.name)?e.name[0]:null}static getCellInfo(e,t){const r=V.getCellName(e),i=(()=>{let s=r?ke(t,r):null;return s===void 0&&(s=null),e.value?e.value(s,t):s})();return{name:r,value:i}}};ve=new WeakMap;oe=new WeakMap;we=new WeakMap;_e=new WeakMap;se=new WeakMap;ae=new WeakMap;Ve=new WeakMap;Re.EVENT_DATA="list-data: update";Re.EVENT_CONFIG_UPDATE="list-config:update";Re.EVENT_ORDER_UPDATE="list-order:update";Re.EVENT_FILTERS_UPDATE="list-filters:update";function Ur(n){const e=o.ref(""),t=o.computed(()=>{const r=e.value.toLowerCase();return o.unref(n).filter(i=>e.value.length?Object.values(i).join().toLowerCase().includes(r):!0)});return{search:e,searchArray:t}}function jr(n,e){Object.keys(n).forEach(t=>delete n[t]),Object.entries(e).forEach(([t,r])=>{n[t]=r})}function Wr(n){const e=o.reactive([]);function t(a){return e.includes(a)}function r(a){t(a)||e.push(a)}function i(a){const l=e.findIndex(d=>d===a);l!==-1&&e.splice(l,1)}function s(a){const l=o.unref(n);if(a===void 0){e.length===0?l.forEach(r):l.forEach(i);return}t(a)?i(a):r(a)}const u=o.computed(()=>{const a=o.unref(n);return e.length===a.length&&a.length!==0});return[e,s,u,r,i]}function qr(n){return n.statusName==="Completed"}function Gr(n){return n.statusName==="FinalStepWithConfirmation"}function zr(n){return n.statusName==="ValidationError"}function Kr(n,e,t){let r=null;const i=o.reactive({wait:null});let s=[],u=null;const a=o.ref(null);function l(){a.value=s.find(c=>c.name===u)||null}function d(){var c;return u?((c=s.find(h=>h.name===u))==null?void 0:c.fields)||[]:[]}function p(c){if(l(),zr(c))return void t.onValidation(c.validationResults);if((c.statusName==="FinalStep"||c.statusName==="NextStep")&&(!d().length||Yr(d(),t.presets)))return m(t.presets||{});qr(c)&&t.onCompleted(c),Gr(c)&&t.onConfirmation(c)}async function T(){try{await R(),await f()}catch(c){const{message:h}=Ce(c);ue.add("error",h)}}function R(){return i.wait="Loading process information.",me.getStartConfig(e,n).then(c=>{s=c.steps.map(h=>({label:h.title,name:h.stepName,number:h.number,fields:h.frontendEntity.objectTypes.reduce((g,$)=>($.properties.forEach(A=>{g.push({name:A.name,label:A.title,type:A.refEntityName||A.dataType})}),g),[])}))}).then(c=>(i.wait=!1,c))}function E(c){return u=c.nextStepName,r=c.token,c}function w(c){const h=Ce(c);ue.add("error",h.message)}function f(){return i.wait="Starting process",me.startProcess(e,n).then(E).then(p).catch(w).finally(()=>{i.wait=null})}function m(c={}){return!r||!u?Promise.reject("Not step or token."):(i.wait="Waiting for result...",me.runStep(e,n,u,r,c).then(E).then(p).catch(w).finally(()=>{i.wait=!1}))}return{initialize:T,state:i,currentStepConfig:o.readonly(a),next:m}}function Yr(n,e){for(let t=0;t<n.length;t++){const r=n[t];if(!O.utils.getPropFromObject(e,r.name))return!1}return!0}const Jr="close-api/proxy/Equipment/Search";class Hr{static search(e,t,r,i,s){const u=new URLSearchParams;u.append("pattern",e||""),t&&u.append("categoryId",t),r&&u.append("useType",String(r)),i&&u.append("statusCode",i),s&&(u.append("limit",String(s.limit)),u.append("offset",String(s.offset)));const a=`/${Jr}?${u.toString()}`;return y(a,{method:"GET",headers:{"Content-Type":"application/json"}})}}const Xr={clickOutside:be,staticLink:Br},Qr={usage:Pt,utils:Wt,types:qt};exports.Communication=Or;exports.CoreError=Y;exports.Filter=P;exports.Manager=I;exports.MetadataStore=Ae;exports.NotificationSystem=ue;exports.WidgetButton=En;exports.WidgetIcon=le;exports.WidgetImage=In;exports.WidgetList=jn;exports.WidgetLoader=bn;exports.WidgetMultiButton=Sn;exports.WidgetSpinner=Ie;exports.WidgetTable=hn;exports.actionService=Vr;exports.asyncProcess=qn;exports.authService=N;exports.billingService=Q;exports.catchUniversal=L;exports.clickOutside=be;exports.clientService=lt;exports.communicationService=Qt;exports.config=Wn;exports.configuration=B;exports.constants=_;exports.dataService=ce;exports.debounce=Hn;exports.default=Qr;exports.documentsService=Fr;exports.equipmentService=Hr;exports.fileService=Zt;exports.getCellName=yt;exports.getCellValue=mt;exports.getNamesFromListConfig=zn;exports.groupArrayByField=Kn;exports.historyService=Gt;exports.injectAction=cr;exports.internationalizationService=zt;exports.invitationService=en;exports.openService=tn;exports.parseError=Ce;exports.prettyDate=We;exports.prettyDateWithTime=Et;exports.prettyMoney=wt;exports.prettyValueFieldByEntity=Zn;exports.processWizardService=me;exports.request=F;exports.ruleValidationService=Ue;exports.t=Z;exports.throttle=Xn;exports.universalEntityCreate=Tt;exports.universalEntityDelete=Ct;exports.universalEntityRead=Se;exports.universalEntityUpdate=qe;exports.universalListSettingRead=or;exports.universalMetadataFieldTreat=sr;exports.universalToolRead=St;exports.useActions=_r;exports.useCommunication=yr;exports.useFormEntity=mr;exports.useListActiveRow=lr;exports.useListEntity=ur;exports.useListSearch=Ur;exports.useListSelect=Wr;exports.useLogger=Yt;exports.useManagerState=dr;exports.useMetadata=Er;exports.useSocket=S;exports.useUsageContext=vr;exports.useWizard=Kr;exports.utils=Xr;exports.uuidv4=Yn;exports.valuesToUpperCase=Ge;
|
|
10
|
+
*/const Je=function(n,e){return n in this.events||(this.events[n]=[]),this.events[n].push(e),this.off.bind(this,n,e)},He=function(n,e){n in this.events&&this.events[n].forEach(t=>t(e))},Xe=function(n,e){const t=this.events[n];if(!t)return;const r=t.indexOf(e);r!==-1&&t.splice(r,1)},Qe=function(){this.events={}};class x{constructor(){this.events={}}on(e,t){return Je.call(this,e,t)}emit(e,t){return He.call(this,e,t)}off(e,t){return Xe.call(this,e,t)}cleanEvents(){Qe.call(this)}static on(e,t){return Je.call(x,e,t)}static emit(e,t){return He.call(x,e,t)}static off(e,t){return Xe.call(x,e,t)}static cleanEvents(){Qe.call(x)}}x.events={};var ft=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},pe=(n,e,t)=>(ft(n,e,"read from private field"),t?t.call(n):e.get(n)),$e=(n,e,t)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,t)},De=(n,e,t,r)=>(ft(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),re,he,ge;const J=class b extends x{constructor(){super(...arguments),$e(this,re,void 0),$e(this,he,"front"),this.organizations=[],$e(this,ge,!1)}set language(e){localStorage.setItem(b.LOCALSTORAGE_LANGUAGE_KEY,e)}get language(){return localStorage.getItem(b.LOCALSTORAGE_LANGUAGE_KEY)||b.DEFAULT_LANGUAGE}checkLanguageInStorage(){return!!localStorage.getItem(b.LOCALSTORAGE_LANGUAGE_KEY)}get contextType(){var e;if(this.contextId)return((e=this.person)==null?void 0:e.id)===this.contextId?"person":"organization"}set router(e){De(this,re,e)}get router(){if(!pe(this,re))throw new Error("Router was not founded. Please set router: Manager.router = router: VueRouter");return pe(this,re)}set type(e){De(this,he,e)}get type(){return pe(this,he)}get isBack(){return this.type==="back"}get isFront(){return this.type==="front"}set ready(e){De(this,ge,e),this.emit(b.EVENT_READY_UPDATE,e)}get ready(){return pe(this,ge)}onReady(e){return this.on(b.EVENT_READY_UPDATE,e)}onupdateContext(e){return this.on(b.EVENT_CONTEXT_UPDATE,e)}onupdateData(e){return this.on(b.EVENT_DATA_UPDATE,e)}setCurrentContext(e){if(this.contextId===e)return console.log("[application-manager] The current context has already been installed.");this.contextId=Number(e),localStorage.setItem(b.CURRENT_CONTEXT_KEY,String(e)),this.emit(b.EVENT_CONTEXT_UPDATE,e),console.log(`Current context id %c${e}`,"color: purple")}get context(){var e;return this.contextId?this.contextId===((e=this.person)==null?void 0:e.id)?this.person:this.organizations.find(t=>t.id===this.contextId)||null:null}async init(){try{const e=await this.loadCustomerData();this.person=e,this.organizations=e.organizations,this.user=e.user,this.ready=!0;const t=Number.parseInt(localStorage.getItem(b.CURRENT_CONTEXT_KEY)||"");!Number.isNaN(t)&&this.validateContextId(Number(t))?this.setCurrentContext(t):this.setCurrentContext(Number(e.id))}catch{Dt.add("error",Y.ApiNotAvailable().message)}}loadCustomerData(){return lt.getClientData()}async updateFullClientData(){return this.init()}validateContextId(e){var t;return((t=this.person)==null?void 0:t.id)==e?!0:!!this.organizations.find(r=>r.id===e)}getListKeyById(e){return console.log("DEPRECATED"),`list-information-${e}`}getListInformationFromLocalStorage(e){console.log("DEPRECATED");const t=localStorage.getItem(this.getListKeyById(e));return t&&JSON.parse(t)}setListInformationToLocalStorage(e,t){console.log("DEPRECATED"),localStorage.setItem(this.getListKeyById(e),JSON.stringify(t))}};re=new WeakMap;he=new WeakMap;ge=new WeakMap;J.DEFAULT_LANGUAGE="en";J.LOCALSTORAGE_LANGUAGE_KEY="CurrentLanguage";J.EVENT_CONTEXT_UPDATE="event:context-update";J.EVENT_READY_UPDATE="event:ready-update";J.EVENT_DATA_UPDATE="event:data-update";J.CURRENT_CONTEXT_KEY="CurrentContext";let Mt=J;const Ze=new Mt;function Vt(n){return n.text().then(e=>{try{return JSON.parse(e)}catch{return $t}})}function y(n,e={}){return Ze.isFront&&(e.headers||(e.headers={}),e.headers["Context-Id"]=Ze.contextId),e.redirect="manual",fetch(n,e).then(t=>t.type==="opaqueredirect"?void window.location.replace("/auth"):t).catch(()=>{throw Y.ApiNotAvailable()}).then(t=>Vt(t).then(r=>{if(!t.ok)throw r;return r}))}class Ne{constructor(){}static parseNamesFromListConfig(e){let t=Ne.parseFieldsToGraphQL(e.reduce((i,s)=>(s.name&&i.push(s.name),i),[]));function r(i){let s="";for(let l in i)typeof i[l]=="boolean"?s+=` ${l} `:s+=` ${l} { ${r(i[l])} }`;return s}return r(t)}static parseSortFromListConfig(e){let t={};for(let r in e)t[r]=e[r]?"ASC":"DESC";return t}static parseFieldsToGraphQL(e){function t(r,i){if(i.includes(".")){const s=i.indexOf("."),l=i.substring(s+1),a=i.substring(0,s);a in r||(r[a]={}),t(r[a],l)}else r[i]=!0;return r}return e.reduce(t,{})}}class Bt{constructor(){this.public=!1,this.errors=new Proxy([],{set:(e,t,r)=>(t!=="length"&&this.public&&console.log(`Journal [Error] ${JSON.stringify(r)}`),e[t]=r,!0)}),window._journal=this}get error(){return{add:(...e)=>{this.errors.push(e)},clean:()=>{this.errors.splice(0,this.errors.length)},console:()=>{console.log(this.errors)}}}welcome(){console.log("The journal has been initialized. To get access check %c_journal in console.","background: blue; color: white")}}const Ft=new Bt;function pt(n){return n&&n[0].toLowerCase()+n.slice(1)}function Fe(n){return Object.keys(n).reduce((e,t)=>{let r=n[t];const i=t.charAt(0).toUpperCase()+t.slice(1);return typeof r=="object"&&!(r==null||Array.isArray(r))&&(r=Fe(r)),e[i]=r,e},{})}function Ut(n,e=2){if(!(typeof n=="string"||typeof n=="number"))return"";let r=String(n).split(".");return r[0]=r[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),r.length<2&&(r[1]=""),r[1]=r[1].padEnd(e,"0"),r[1].length>e&&(r[1]=r[1].substring(0,e)),r.join(".")}const jt={Request:y,clickOutside:be,getPropFromObject:ke,runPromiseQueue:at,GraphQL:Ne,firstChapterToLowerCase:pt,valuesToUpperCase:Fe,prettyMoney:Ut},Wt=Object.freeze(Object.defineProperty({__proto__:null,GraphQL:Ne,Journal:Ft,Request:y,clickOutside:be,default:jt,firstChapterToLowerCase:pt,getPropFromObject:ke,runPromiseQueue:at,valuesToUpperCase:Fe},Symbol.toStringTag,{value:"Module"})),qt=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));class Gt{static readHistoryById(e,t){return y(`/close-api/audits/history/${e}/${t}`,{method:"GET",headers:{"Content-Type":"application/json"}}).then(r=>{const i=r.history.map(s=>{if(!s.changes)return s;const l=s.changes.map(a=>({...a,oldValue:a.originalValue,name:a.fieldName}));return{...s,changes:l}});return{...r,history:i}})}}class zt{static getDictionary(e){if(!e)throw new Error(`Can't get dictionary for ${e}.`);return y(`/open-api/internationalization/language/${e}`)}}let K={};function Z(n,...e){if(typeof n!="string")return console.trace(`Label is not provided for translation: ${n}`),"undefined";let t=O.utils.getPropFromObject((this==null?void 0:this.vocabulary)||K,n);if(typeof t=="string")return et(t,e);const r=O.utils.getPropFromObject(K==null?void 0:K.root,n);return typeof r=="string"?et(r,e):(typeof t===void 0&&console.warn(`Translation for label "${n}" is not founded.`),n)}function et(n,e){return e.forEach((t,r)=>{n=n.replaceAll(new RegExp(`\\{${r}}`,"g"),t)}),n}Z.setGlobalVocabulary=function(n){K=n};Z.getScope=function(n){const e=typeof n=="string"?n:"root";return typeof n!="string"&&console.warn(`SCOPE ${n} for translate is not string.`),Z.bind({vocabulary:O.utils.getPropFromObject(K,e.toLowerCase())})};Z.setVocabulary=function(n){return typeof n=="string"&&(n=O.utils.getPropFromObject(K,n)),Z.bind({vocabulary:n})};const Kt=function(){let n=!1;const e=[];function t(){return n}function r(u,d){t()&&console[u](...d),e.push(d)}function i(...u){r("log",u)}function s(...u){r("warn",u)}function l(...u){r("error",u)}function a(u=!0){n=u}return{info:i,warn:s,history:e,display:a,error:l}}();function Yt(){return Kt}function Jt(n){return Array.isArray(n)&&n.length===2&&typeof n[0]=="string"&&typeof n[1]=="number"}const Ht="masterId",Xt="masterEntity";function Me(n,e){if(!Array.isArray(e))return;if(Jt(e))return t(e);e.forEach(t);function t(r){n.append(Xt,r[0]),n.append(Ht,r[1].toString())}}class ce{static async anonymousGetList(e){return await y(`/open-api/data/${e}`,{method:"GET",headers:{"Content-Type":"application/json"}})}static getSearchParamsForEntityListRead(e){const t=(i,s)=>r.append(i,s),r=new URLSearchParams;if(e.fields){const i=e.fields;typeof i=="string"?t("fields",i):Array.isArray(i)?t("fields",i.join(" ")):typeof i=="object"&&t("fields",Object.keys(i).join(" "))}if(e.order){let i=e.order;const l=(Array.isArray(i)?[i]:Object.entries(i)).map(([a,u="desc"])=>`@${a} ${u}`).join(",");t("order",l)}return e.limit&&t("limit",e.limit.toString()),e.offset&&t("offset",e.offset.toString()),e.filter&&t("filter",e.filter.toString()),e.useUsageContext&&r.append("useUsageContext",e.useUsageContext.toString()),r}static async getList(e,t){const r=ce.getSearchParamsForEntityListRead(t||{});return await y(`/close-api/data/${e}?${r.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"}})}static getCount(e,t){const r=ce.getSearchParamsForEntityListRead(t||{});return y(`/close-api/data/entities/${e}/count?${r.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"}})}static create(e,t,r){const i=new URLSearchParams;return Me(i,r==null?void 0:r.masterEntities),y(`/close-api/data/${e}?${i.toString()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({values:t})})}static update(e,t,r,i={}){return y(`/close-api/data/entities/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({values:r})})}static readById(e,t,r={}){const i=new URLSearchParams;if(r.fields){let s=r.fields;typeof s=="string"&&(s=[s]),i.append("fields",s.join(" "))}return y(`/close-api/data/entities/${e}/id/${t}?${i.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"}})}static updateById(e,t,r,i){const s=new URLSearchParams;return Me(s,i==null?void 0:i.masterEntities),y(`/close-api/data/entities/${e}/id/${t}?${s.toString()}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({values:r,version:i==null?void 0:i.version})})}static removeById(e,t,r){const i=typeof t=="number"?{Id:t}:t;return ce.removeByKeys(e,i,r)}static removeByKeys(e,t,r){return y(`/close-api/data/entities/${e}`,{method:"delete",headers:{"Content-Type":"application/json"},body:JSON.stringify({keys:t,version:r})})}}const ht=class ie{static async create(e){return y(ie.url,{method:"post",body:JSON.stringify(e),headers:{"Content-Type":"application/json"}})}static async read(e){const t=new URLSearchParams({targetCode:String(e.targetCode),entityName:e.entity.name,entityCatalogId:e.entity.catalogId});return y(ie.url+"?"+t.toString(),{method:"get"})}static async readMessages(e){return y(`${ie.url}/${e}/messages`,{method:"get"})}static async createMessage(e){return y(`${ie.url}/${e.talkId}/messages`,{method:"post",body:JSON.stringify({text:e.text}),headers:{"Content-Type":"application/json"}})}};ht.url="/close-api/communications";let Qt=ht;function tt(n){return{...n,createdEntities:n.createdEntites}}const gt=class ye{static async getStartConfig(e,t){return y([ye.url,e,t].join("/"),{method:"GET",headers:{"Content-Type":"application/json"}})}static async startProcess(e,t){return y([ye.url,e,t].join("/"),{method:"POST",headers:{"Content-Type":"application/json"}}).then(tt)}static async runStep(e,t,r,i,s){return y([ye.url,e,t].join("/"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({stepName:r,token:i,values:s})}).then(tt)}};gt.url="/close-api/views/process-wizard";let me=gt;class Zt{static async upload(e,t){const r=new FormData;r.append("file",e);const i=`/close-api/files?entityName=${t}`;return await fetch(i,{method:"POST",body:r}).then(s=>s.json()).then(s=>(s.filename=e.name,s))}}class en{static invite(e,t,r){return y("/close-api/accounts/invitePerson",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({organizationId:e,personKey:t,relatedRoleCode:r})})}static accept(e,t){return y("/close-api/accounts/markInvite",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({invitationId:e,version:t,mark:!0})})}static decline(e,t){return y("/close-api/accounts/markInvite",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({invitationId:e,version:t,mark:!1})})}}class Ue{static get url(){return"/close-api/rules-validation/"}static validate(e,t){return y(Ue.url+e,{method:"POST",body:JSON.stringify(t)})}}class tn{static getConfiguration(){return y("/open-api/webserver-configuration",{method:"GET",headers:{"Content-Type":"application/json"}})}}const nn={class:"widget-table__head"},rn={class:"widget-table__head-label margin_0 text_overflow"},on=o.defineComponent({__name:"widget-table-head",props:{config:{}},setup(n){return(e,t)=>(o.openBlock(),o.createElementBlock("tr",nn,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.config,(r,i)=>(o.openBlock(),o.createElementBlock("th",{class:"widget-table__head-cell",key:i},[o.createElementVNode("p",rn,o.toDisplayString(r.label),1)]))),128))]))}});const U=(n,e)=>{const t=n.__vccOpts||n;for(const[r,i]of e)t[r]=i;return t},sn=U(on,[["__scopeId","data-v-25198f4a"]]);function yt(n){return typeof n.name=="string"?n.name:Array.isArray(n.name)?n.name[0]:null}function mt(n,e){const t=yt(n);let r=t?O.utils.getPropFromObject(e,t):null;return r===void 0&&(r=null),n.value?n.value(r,e):n.value===null?null:r}function je(n){return["eservices-core",n].join(":")}function Et(n){return We(n,"YYYY/MM/DD HH:mm:ss")}function We(n,e="YYYY/MM/DD"){if(!n)return"";try{const t=new Date(n);return It.format(t,e)}catch(t){return console.log(t),"Invalid date"}}const an={props:{name:String},setup(n,e){let t="unknown";try{t=e.slots.default()[0].children}catch{t=n.name}typeof t!="string"&&console.warn(`Name for Icon.vue is not string. ${t}`);try{t=t.replace(/\s+/g,"")}catch{}return()=>o.h("i",{class:`icon icon-${t}`})}},le=U(an,[["__scopeId","data-v-e287c8d9"]]),cn=Be(je("setup-list-row"));function ln(n,e){const t=n.config.map(r=>un(r,n,e));return o.h("tr",{class:"widget-table__row widget-table-row"},t)}function un(n,e,t){const r=e.values;let i=mt(n,r);const s={onClick:[],class:["widget-table__cell widget-table-cell"]};function l(h){s.onClick.push(()=>h(r))}function a(h){Array.isArray(h)?s.class.push(...h):s.class.push(h)}const u=[],d=[];if(n.hide&&n.hide(r))return[o.h("td")];if(n.type)switch(a(`widget-table-cell_${n.type}`),n.type){case"number":{typeof i=="number"&&(i=new Intl.NumberFormat().format(i));break}case"date":{i=We(typeof i=="string"?i:null);break}case"dateTime":case"dateWithTime":{i=Et(typeof i=="string"?i:null);break}case"money":{i=wt(i);break}case"multi-select":{d.push(o.h(O.FormField,{type:"single-checkbox",modelValue:e.selected})),l(nt.bind(null,t,!0));break}case"select":{d.push(o.h(O.FormField,{type:"single-radio",modelValue:e.selected})),l(nt.bind(null,t,!1));break}}if(n.onClick&&l(n.onClick),n.link)try{const h=n.link(r);if(h){const T=o.h(ot.RouterLink,{to:h});d.push(T),a("widget-table-cell_link")}}catch(h){cn("Can't add router link",h)}if(n.href&&(d.push(o.h("a",{href:n.href(r),target:"_blank"})),a("widget-table-cell_link")),typeof i=="boolean"&&(i=i?"✓":"—"),(typeof i=="string"||typeof i=="number")&&d.push(o.h("p",{class:"widget-list-cell-text"},i)),n.icon&&(typeof n.icon=="string"&&d.push(o.h(le,{name:n.icon})),typeof n.icon=="function")){const h=n.icon(r);h!==null&&d.push(o.h(le,{name:h}))}return n.class&&(typeof n.class=="function"?a(n.class(r)):a(n.class)),u.push(o.h("td",s,d)),u}function nt(n,e){n.emit("select",e)}function vt(n,e){return()=>{try{return ln(n,e)}catch(t){return console.warn(t),null}}}const dn={props:{values:Object,config:Object,selected:Boolean},setup:vt},fn=["colspan"],rt=o.defineComponent({__name:"widget-table-form",props:{rowLength:{},component:{},values:{},isNew:{type:Boolean}},emits:["save","close"],setup(n,{emit:e}){const t=o.ref();return o.onMounted(()=>{setTimeout(()=>{t.value&&t.value.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})},250)}),(r,i)=>(o.openBlock(),o.createElementBlock("tr",{class:"widget-table-form",ref_key:"refTableForm",ref:t},[o.createElementVNode("td",{colspan:r.rowLength},[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(r.component),o.mergeProps(r.$attrs,{values:r.values,new:r.isNew,onClose:i[0]||(i[0]=s=>e("close")),onSave:i[1]||(i[1]=s=>e("save",s))}),null,16,["values","new"]))],8,fn)],512))}}),_={LIST_ACTIVE_NEW:"list-active-new",DEFAULT_ERROR_MESSAGE:"Please try again later or submit a feedback if problem doesn't go.",LOCALSTORAGE_CURRENT_CONTEXT_KEY:"CurrentContext",LOCALSTORAGE_LANGUAGE_KEY:"CurrentLanguage",DELAY_SOCKET_RECONNECT:1e3,PROVIDE_NAME_METADATA:"provide-metadata-config",PROVIDE_NAME_USAGE_CONTEXT:"provide-usage-context-config",PROVIDE_NAME_ACTIONS:"provide-actions",TIME_TO_LIVE_SOCKET_REQUEST:15e3,MODAL_VALIDATION_EFFECT:"validation-effect",MODAL_CONFIRM:"confirm"},pn={class:"widget-table"},it="update:selectedRows",hn=o.defineComponent({__name:"widget-table",props:{array:{},config:{},activeRow:{default:null},selectedRows:{default:()=>[]},classCallback:{}},emits:["update:activeRow","save"],setup(n,{emit:e}){const t=n,r=o.useSlots(),i=o.computed(()=>{var a;return(a=r==null?void 0:r.default)==null?void 0:a.call(r)[0]});function s(a,u=!0){if(!t.selectedRows)return;if(!u)return e(it,t.selectedRows.includes(a)?[]:[a]);const d=[...t.selectedRows],h=d.indexOf(a);return h===-1?d.push(a):d.splice(h,1),e(it,d)}function l(a){e("save",a),e("update:activeRow",null)}return(a,u)=>(o.openBlock(),o.createElementBlock("div",null,[o.createElementVNode("table",pn,[o.createVNode(sn,{config:a.config},null,8,["config"]),o.createElementVNode("tbody",null,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(a.array,(d,h)=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:h},[o.createVNode(dn,{config:a.config,values:d,selected:a.selectedRows.includes(d),onSelect:T=>s(d,T),class:o.normalizeClass(a.classCallback?a.classCallback(d):"")},null,8,["config","values","selected","onSelect","class"]),i.value&&a.activeRow===d?(o.openBlock(),o.createBlock(rt,{key:0,component:i.value,"row-length":a.config.length,values:d,onClose:u[0]||(u[0]=T=>e("update:activeRow",null)),onSave:l,"is-new":!1},null,8,["component","row-length","values"])):o.createCommentVNode("",!0)],64))),128)),a.activeRow===o.unref(_).LIST_ACTIVE_NEW?(o.openBlock(),o.createBlock(rt,{key:0,component:i.value,"row-length":a.config.length,onClose:u[1]||(u[1]=d=>e("update:activeRow",null)),onSave:l,"is-new":!0},null,8,["component","row-length"])):o.createCommentVNode("",!0)])])]))}}),gn=o.defineComponent({__name:"widget-spinner",props:{color:{default:"#fff"}},setup(n){return(e,t)=>(o.openBlock(),o.createElementBlock("div",{class:"widget-spinner",style:o.normalizeStyle({"border-left":`1.1em solid ${e.color}`})},null,4))}});const Ie=U(gn,[["__scopeId","data-v-0ef9ae88"]]),yn={class:"widget-button"},mn=o.defineComponent({__name:"widget-button",props:{wait:{type:Boolean}},setup(n){return(e,t)=>(o.openBlock(),o.createElementBlock("button",yn,[e.wait?(o.openBlock(),o.createBlock(Ie,{key:0,class:"widget-button-spinner"})):o.createCommentVNode("",!0),o.renderSlot(e.$slots,"default",{},void 0,!0)]))}});const En=U(mn,[["__scopeId","data-v-450dc564"]]),vn={class:"widget-multi-button-wrap position_relative cursor_pointer"},wn={class:"widget-multi-button-body grid"},_n=["onClick"],Tn={class:"widget-multi-button-side-wrap"},Cn=o.defineComponent({__name:"widget-multi-button",props:{label:{},array:{default:()=>[]}},setup(n){const e=n;o.useCssVars(l=>({"7025434e":r.value}));const t=o.reactive({active:!1,wait:!1}),r=o.computed(()=>e.array.length+(e.label?1:0));function i(l){if(!(typeof l!="function"||t.wait))return t.wait=!0,Promise.resolve().then(l).finally(()=>{t.wait=!1})}function s(l=!t.active){t.active=l}return(l,a)=>(o.openBlock(),o.createElementBlock("div",vn,[o.createElementVNode("div",{class:o.normalizeClass(["overflow_hidden radius_20 widget-multi-button grid",t.active?"widget-multi-button_active":null])},[o.createElementVNode("div",wn,[l.label?(o.openBlock(),o.createElementBlock("p",{key:0,class:"text_md margin_0 text_nowrap widget-multi-button-body-label",onClick:a[0]||(a[0]=u=>s())},o.toDisplayString(l.label),1)):o.createCommentVNode("",!0),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(l.array,(u,d)=>(o.openBlock(),o.createElementBlock("p",{class:"text_md margin_0 text_nowrap widget-multi-button-body-label",key:d,onClick:h=>{i(u.callback),s(!1)}},o.toDisplayString(u.label),9,_n))),128))]),o.createElementVNode("div",Tn,[o.createElementVNode("div",{class:o.normalizeClass(["grid-center widget-multi-button-side",t.active?"widget-multi-button-side_active":null]),onClick:a[1]||(a[1]=u=>s())},[t.wait?(o.openBlock(),o.createBlock(o.unref(Ie),{key:0,class:"widget-multi-button-side-spinner"})):l.array.length>1?(o.openBlock(),o.createBlock(o.unref(le),{key:1,class:"widget-multi-button-side-icon"},{default:o.withCtx(()=>[o.createTextVNode("angle-small-down")]),_:1})):o.createCommentVNode("",!0)],2)])],2)]))}});const Sn=U(Cn,[["__scopeId","data-v-a8d711d1"]]),An={class:"widget-loader flex flex-align_center gap_10 padding_15"},kn={class:"text_md"},bn=o.defineComponent({__name:"widget-loader",props:{label:{}},setup(n){return(e,t)=>(o.openBlock(),o.createElementBlock("div",An,[o.createVNode(Ie,{color:"var(--primary)",class:"padding_10"}),o.createElementVNode("span",kn,o.toDisplayString(e.label),1)]))}}),Nn=["alt","src"],In=o.defineComponent({__name:"widget-image",props:{src:{},alt:{},default:{}},setup(n){const e=n,t=o.ref();return o.onMounted(()=>{t.value&&(t.value.src=e.src),t.value.onerror=function(){e.default&&(t.value.src=e.default)}}),(r,i)=>(o.openBlock(),o.createElementBlock("img",{alt:r.alt,ref_key:"refImage",ref:t,src:r.src||r.$props.default},null,8,Nn))}}),On={props:{config:Array,values:Object,selected:Boolean},setup:vt};const Rn=U(On,[["__scopeId","data-v-344a8cc1"]]),Ln=n=>(o.pushScopeId("data-v-bf495d6a"),n=n(),o.popScopeId(),n),Pn={class:"widget-list-head-cell"},$n=Ln(()=>o.createElementVNode("div",{class:"head-cell-resize"},null,-1)),Dn=o.defineComponent({__name:"widget-list-head-cell",props:{title:{},label:{},name:{},type:{},minWidth:{},maxWidth:{},width:{},order:{}},emits:["select","order"],setup(n,{emit:e}){const t=n;return t.title&&console.warn(`For cell ${t.name} using title,it should be replaced with label.`),(r,i)=>(o.openBlock(),o.createElementBlock("th",null,[o.createElementVNode("div",Pn,[o.createElementVNode("div",{class:"head-cell-content flex_grow",style:o.normalizeStyle({"min-width":r.minWidth,"max-width":r.maxWidth,width:r.width})},[r.type==="multi-select"?(o.openBlock(),o.createBlock(o.unref(O.FormField),{key:0,type:"single-checkbox",onClick:i[0]||(i[0]=o.withModifiers(s=>e("select"),["stop","prevent"]))})):(o.openBlock(),o.createElementBlock("p",{key:1,class:"widget-list-head-label head-cell-label list-head-cell-label text_md margin-0",onClick:i[1]||(i[1]=s=>e("order"))},o.toDisplayString(r.title||r.label),1))],4),r.name&&r.order.length&&r.order[0]===r.name?(o.openBlock(),o.createBlock(o.unref(le),{key:0,class:o.normalizeClass(["head-cell-order",{"head-cell-order_down":r.order.length>1&&r.order[1]==="desc"}])},{default:o.withCtx(()=>[o.createTextVNode("core-arrow-up")]),_:1},8,["class"])):o.createCommentVNode("",!0),$n])]))}});const xn=U(Dn,[["__scopeId","data-v-bf495d6a"]]),Mn=o.defineComponent({__name:"widget-list-head",props:{config:{},order:{}},emits:["update:config","update:order","select"],setup(n,{emit:e}){const t=n,r=o.ref(),i=o.ref();o.onMounted(()=>{function u(E,w){let f=-1;do f++,w-=E[f];while(w>0&&f<E.length);return f}function d(E,w){let f=0;for(;w>0&&w>E[f]&&f<E.length;)w-=E[f],f++;return console.log(w,f),f>0?f:0}function h(E){try{i.value.style.insetInlineStart=E+"px"}catch(w){console.log(w)}}function T(E){try{i.value.style.width=E+"px",i.value.style.minWidth=E+"px",i.value.style.maxWidth=E+"px"}catch(w){console.log(w)}}function R(E){return E===null?!1:E.classList.contains("head-cell-resize")}r.value.addEventListener("pointerdown",function(w){var Ye;function f(k){return k.screenX+p-A}const m=r.value,c=[...m.children].filter(k=>k.localName==="th"),p=((Ye=m.offsetParent)==null?void 0:Ye.scrollLeft)||0,g=c.map(k=>k.clientWidth),$=R(w.target),A=m.getBoundingClientRect().left,H=f(w),C=u(g,H),j=g.slice(0,C).reduce((k,D)=>k+D,0),ee=H-j,Le=m.offsetWidth,te=c[C].clientWidth;if(t.config[C].type==="multi-select")return;console.group("START"),console.log(),console.log("Start screenX",w.screenX),console.log("Widths",g),console.log("max width",Le),console.log("Start Position",H),console.log("Position From",C),console.log("Start Position",C),console.log("Global offset (Отступ самой таблицы от края экрана)",A),console.log("Del",ee),console.groupEnd(),i.value.innerText=c[C].textContent||"",i.value.style.display="grid",i.value.style.width=te+"px",i.value.style.cursor="grabbing",h(j),T(te),document.addEventListener("pointermove",Ke,{passive:!0}),document.addEventListener("pointerup",ze);function ze(k){if(console.group("END"),document.removeEventListener("pointermove",Ke),document.removeEventListener("pointerup",ze),$&&(t.config[C].width=i.value.style.width,t.config[C].minWidth=i.value.style.width,t.config[C].maxWidth=i.value.style.width,s(t.config)),!$){const D=k.screenX+p-A;console.log("ENP Position",D);const fe=d(g,D);if(console.log(C,"->",fe),fe!==C){const ne=t.config[C],Pe=t.config;Pe.splice(C,1),Pe.splice(fe,0,ne),s(Pe)}else{const ne=t.config[C].name;l(ne)}}i.value.style.display="none",document.body.style.cursor="unset",console.groupEnd()}function Ke(k){if($){const ne=f(k)-H+te;T(ne);return}let D=k.screenX+p-A-ee;D<0&&(D=0),D+te>Le&&(D=Le-te),h(D)}})});function s(u){e("update:config",u)}function l(u){if(!u)return;if(Array.isArray(u)){if(u.length<1)return;u=u[0]}if(t.order.length===0||t.order[0]!==u)return void a([u]);const d=t.order.length===1||t.order[1]==="asc"?"asc":"desc";a([u,d==="asc"?"desc":"asc"])}function a(u){e("update:order",u)}return(u,d)=>(o.openBlock(),o.createElementBlock("tr",{class:"widget-list-head",ref_key:"refHead",ref:r},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(u.config,(h,T)=>(o.openBlock(),o.createBlock(xn,o.mergeProps({key:h},h,{onOrder:R=>l(h.name),onSelect:d[0]||(d[0]=R=>e("select")),order:u.order}),null,16,["onOrder","order"]))),128)),o.createElementVNode("div",{class:"test-block text_md",ref_key:"refDisplayPosition",ref:i},"test",512)],512))}});const Vn=U(Mn,[["__scopeId","data-v-ccffc6bd"]]),Bn={class:"widget-list"},Fn={class:"widget-list-body position_relative"},Un=50,jn=o.defineComponent({__name:"widget-list",props:{array:{},config:{default:()=>[]},selectedRows:{default:()=>[]},order:{default:()=>[]}},emits:["scrollEnd","update:selectedRows","update:order","update:config"],setup(n,{emit:e}){const t=n;function r(a,u=!0){if(t.selectedRows)if(!u)s(t.selectedRows.includes(a)?[]:[a]);else{const d=[...t.selectedRows],h=d.indexOf(a);h===-1?d.push(a):d==null||d.splice(h,1),s(d)}}function i(){var a;if(((a=t.selectedRows)==null?void 0:a.length)!==t.array.length)return s([...t.array]);s([])}function s(a){e("update:selectedRows",a)}function l(a){if(!a)return;const u=a.target;u.scrollTop+u.clientHeight+Un>u.scrollHeight&&e("scrollEnd")}return(a,u)=>(o.openBlock(),o.createElementBlock("div",{class:"es-list-container",onScrollPassive:l},[o.createElementVNode("table",Bn,[o.createElementVNode("thead",null,[o.createVNode(Vn,{onSelect:u[0]||(u[0]=d=>i()),"onUpdate:order":u[1]||(u[1]=d=>e("update:order",d)),"onUpdate:config":u[2]||(u[2]=d=>e("update:config",d)),config:a.config,order:a.order},null,8,["config","order"])]),o.createElementVNode("tbody",Fn,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(a.array,(d,h)=>{var T;return o.openBlock(),o.createBlock(Rn,{key:h,class:"widget-list-row",values:d,config:a.config,selected:(T=a.selectedRows)==null?void 0:T.includes(d),onSelect:R=>r(d,R)},null,8,["values","config","selected","onSelect"])}),128))])])],32))}}),B={};function Wn(n){for(let e in n)B[e]=n[e];console.log("The config has been initialized. To get access check %c_config in console.","background: purple; color: white")}function qn(n){function e(...r){return t.wait?Promise.reject("The process has already started."):(t.wait=!0,Promise.resolve().then(()=>n(...r)).finally(()=>{t.wait=!1}))}const t=o.reactive({wait:!1,call:e});return t}function Ce(n){return typeof n=="string"?xe(n):Gn(n)?xe(n.message):xe(_.DEFAULT_ERROR_MESSAGE)}function Gn(n){return!!(typeof n=="object"&&n!==null&&Object.hasOwnProperty.call(n,"message"))}function xe(n){return{message:n}}function L(n="error"){return function(e){const{message:t}=Ce(e);ue.add(n,t)}}function Se(n,e={}){return S().emit("entity:read",{...e,entity:n})}function qe(n,e){return S().emit("entity:update",{...e,entity:n})}function zn(n){return n.reduce((e,t)=>(t.name&&(typeof t.name=="string"?e.push(t.name):e.push(...t.name)),e),[])}function wt(n,e=2){if(!(typeof n=="string"||typeof n=="number"))return"";let r=String(n).split(".");return r[0]=r[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),r.length<2&&(r[1]=""),r[1]=r[1].padEnd(e,"0"),r[1].length>e&&(r[1]=r[1].substring(0,e)),r.join(".")}function Ge(n){return Object.keys(n).reduce((e,t)=>{let r=n[t];const i=t.charAt(0).toUpperCase()+t.slice(1);return typeof r=="object"&&!(r==null||Array.isArray(r))&&(r=Ge(r)),e[i]=r,e},{})}function Kn(n,e){const t=new Map;return n.forEach(r=>{var s;const i=e(r);t.has(i)||t.set(i,[]),(s=t.get(i))==null||s.push(r)}),t}function Yn(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,n=>(n^crypto.getRandomValues(new Uint8Array(1))[0]&15>>n/4).toString(16))}function Jn(n){return n.text().then(e=>{try{return JSON.parse(e)}catch{return _.DEFAULT_ERROR_MESSAGE}})}function F(n,e={}){return I.isFront&&(e.headers||(e.headers={}),e.headers["Context-Id"]=I.contextId),e.redirect="manual",fetch(n,e).then(t=>t.type==="opaqueredirect"?void window.location.replace("/auth"):t).catch(()=>{throw new Error(_.DEFAULT_ERROR_MESSAGE)}).then(t=>Jn(t).then(r=>{if(!t.ok)throw r;return r}))}function Hn(n,e=1e3){let t=0;return(...r)=>{clearTimeout(t),t=setTimeout(()=>n(...r),e)}}function Xn(n,e){let t=!1;return(...r)=>{if(!t)return t=!0,setTimeout(()=>t=!1,e),n(...r)}}const Qn=Be(je("pretty-value-field-by-entity"));function Zn(n,e,t){try{const r=Ae.get(n);if(!r)throw new Error("For entity metadata is not loaded");const i=r.fieldsByName[e];if(!i)throw new Error(`For entity ${n} can't found fieldMetadata for field ${e}`);return i.dataType==="DateTime"&&typeof t=="string"?new Date(t).toLocaleString():t}catch(r){return Qn('Error by parse pretty value for entity %o "%s", field "%s" with value "%s"',r,n,e,t),t}}const er=1,tr=5e3,W=Be(je("use-socket"));function S(){return rr}function nr(n){return typeof n=="object"&&Object.prototype.toString.call(n)==="[object Blob]"}const rr=function(){let n=1,e,t;const r=new Set;let i=0;const s=new Set;function l(){if(e)i&&(clearTimeout(i),i=0);else return;i=setTimeout(()=>{e.close()},tr*2);const c=new Uint8Array(1);c[0]=er,e.send(c)}setInterval(()=>{Array.from(r).forEach(c=>{m(c)&&(W("Handler for event %s requestId %d was expired",c.event,c.requestId),c.requestId?u({requestId:c.requestId,event:"request-error",data:{message:Y.RequestTookToLong().message}}):r.delete(c))})},1e3),setInterval(()=>{(!e||e.readyState===3)&&d()},_.DELAY_SOCKET_RECONNECT);function a(){return{safeQueue:s,requestId:n,handlers:r,socketInstance:e}}function u(c){const p=[...r.values()];W("Handlers array length is %d. Response event: %s. Request id: %d",r.size,c.event,c.requestId),p.forEach(g=>{const $=c.requestId;(g.requestId&&g.requestId===$||!g.requestId&&g.event===c.event)&&(W("Find appropriated handler: %d, event: %s",n,g.event),g.callback(c.data,c),g.once&&(r.delete(g),W("Handler was removed by *once* params was passed. %o",g)))})}function d(){if(typeof t!="string"){console.log("Please initialize use-socket");return}console.log(`%cInitializing sockets: %c${t}`,"color: purple","color: black"),e=new WebSocket(t),e.onclose=function(c){W("Connection to server was stopped: %d %s",c.code,c.reason),Array.from(r).forEach(p=>{p.guaranteedAnswer&&p.serializeString&&s.add(p.serializeString)})},e.onopen=function(){console.log("Socket was %cconnected.","color: green"),[...s.values()].forEach(c=>{h(c),s.delete(c)})},e.onerror=function(c){console.warn(c)},e.onmessage=c=>{var p;try{if(nr(c.data)){l();return}const g=JSON.parse(c.data);if(!_t(g)){console.warn("Data is %cnot correct %csocket answer.","color: red","color: black"),console.log(g);return}(p=g==null?void 0:g.data)!=null&&p.refresh&&location.reload(),u(g)}catch(g){console.warn("Socket handle %conmessage%c error.","color: red","color: black"),console.log(g)}}}function h(c){e.send(c)}function T(c,p){f({event:c,callback:p})}function R(c,p){f({event:c,callback:p,once:!0})}function E(){return e&&(e==null?void 0:e.readyState)===1}function w(c,p,g){const $=++n,A=JSON.stringify({requestId:$,event:c,data:p,contextId:I.contextId,url:window.location.href});return E()?h(A):(s.add(A),W("Socket is not connected. Message was send to save-queue")),new Promise((H,C)=>{f({event:c,requestId:$,once:!0,guaranteedAnswer:!0,serializeString:A,callback:(j,ee)=>{if(W("Promise was resolve with next data:",j),ir(ee))return void C(j);g&&g(j,ee),H(j)},timeToLive:_.TIME_TO_LIVE_SOCKET_REQUEST})})}function f(c){const p={timeToLive:0,...c,created:new Date().getTime()};r.add(p)}function m(c){return c.timeToLive===0||typeof c.timeToLive!="number"?!1:new Date().getTime()-c.created>c.timeToLive}return{get socket(){return e},on:T,once:R,emit:w,initialization(c){t=c},getDevInfo:a}}(),ir=n=>!!_t(n)&&n.event==="request-error",_t=n=>typeof n=="object"&&n!==null&&"event"in n&&typeof n.event=="string"&&"requestId"in n&&typeof n.requestId=="number"&&"data"in n;function or(n,e){return S().emit("list-setting:read",{entity:n,mark:e})}function sr(n,e){return S().emit("metadata-field:treat",{entity:n,fieldName:e})}function Tt(n,e){return S().emit("entity:create",{...e,entity:n})}function Ct(n,e){return S().emit("entity:delete",{...e,entity:n})}function ar(n,e){return S().emit("usage-context:read",{...e,entity:n})}function St(n={}){return S().emit("tool:read",n)}function cr(n,e={},t={}){const r=o.inject(_.PROVIDE_NAME_ACTIONS,null),i=typeof n=="string"?n:e,s=typeof e=="string"?t:e;return o.computed(()=>{const l=(Array.isArray(n)?o.unref(n):r?r.actions.value:[]).find(a=>a.action.name===i);return l?{...l,...s}:null})}function lr(){const n=o.ref(null);function e(t){n.value=t}return{activeRow:n,activateRow:e}}function ur(n,e){const t=o.reactive([]);let r=0;const i=o.ref(!1);function s(){if(i.value)return Promise.reject("The process has already started.");const f=E();return i.value=!0,typeof f.limit!="number"&&(f.limit=100),f.offset=r,Se(n,f).then(m=>(r+=m.length,m)).finally(()=>{i.value=!1})}function l(f,m){var p;return typeof f.Version=="number"?f.Version:(p=t.find(g=>g.Id===m))==null?void 0:p.Version}function a(f,m){const c=t.findIndex(p=>p.Id===f);if(c===-1)throw new Error(`Can't found item with Id ${f}`);t.splice(c,1,m)}function u(f){const m=t.findIndex(c=>c.Id===f);if(m===-1)throw new Error(`Can't found item with Id ${f}`);t.splice(m,1)}async function d(f,m){try{const c=E(),p=l(m,f);delete m.Version,await qe(n,{id:f,values:m,version:p});const g=await Se(n,{fields:c.fields||"",id:f});a(f,g)}catch(c){L()(c)}}async function h(f,m){try{const c=E(),p=l(m,f);delete m.Version,await Ct(n,{id:f,version:p}),u(f)}catch(c){L()(c)}}async function T(f){try{await Tt(n,{values:f}),await w()}catch(m){L()(m)}}async function R(){try{const f=await s();t.push(...f)}catch(f){L()(f)}}function E(){return typeof e=="function"?e():e}async function w(){try{r=0;const f=await s();t.splice(0,t.length,...f)}catch(f){L()(f)}}return{array:t,updateById:d,next:R,reload:w,wait:i,create:T,deleteById:h}}function dr(){function n(){return{organizations:I.organizations,currentContextId:I.contextId,person:I.person,context:I.context,contextType:I.contextType,userId:I.userId}}const e=o.reactive(n());return I.onupdateContext(()=>{Object.assign(e,n())}),e}function fr(n,e,t){return S().emit("communication:create",{entityName:n,entityCatalogId:e,targetCode:t})}function pr(n,e,t){return S().emit("communication:read",{entityName:n,entityCatalogId:e,targetCode:t})}function hr(n,e){return S().emit("communication-message:create",{communicationId:n,text:e})}function gr(n){return S().emit("communication-message:read",{communicationId:n})}function yr(n){const e=O.Form.getParentForm(),t=o.reactive([]);return e&&e.subscribe(n),n.read=()=>gr(n.id).then(r=>(t.splice(0,t.length,...r),r)),{array:t}}function mr(n,e){n.read=()=>{const r=t();return Promise.resolve().then(()=>{if(!n.name)throw Y.EntityWithoutName(n);return Se(n.name,r)}).then(Ge).then(i=>(i.hasOwnProperty("Version")&&(n.version=i.Version),n.setValues(i),i)).catch(L())},n.save=()=>{const r=t();return Promise.resolve().then(()=>{if(!n.name)throw Y.EntityWithoutName(n);return qe(n.name,{id:r.id,values:n.changes,version:n.version})}).then(i=>{n.version=i.version}).catch(i=>{throw L()(i),i})};function t(){return typeof e=="function"?e():e}}function Er(n){if(!n)return o.inject(_.PROVIDE_NAME_METADATA);Ae.initEntity(n);const e=o.computed(()=>Ae.state[n]);return o.provide(_.PROVIDE_NAME_METADATA,e),e}function vr(n,e={}){if(!n)return o.inject(_.PROVIDE_NAME_USAGE_CONTEXT);const t=o.ref(null);return o.provide(_.PROVIDE_NAME_USAGE_CONTEXT,t),{state:t,update:async function(){t.value=await ar(n,wr(e||{}))}}}function wr(n){return typeof n=="function"?n():n}function _r(n){if(!n)return o.inject(_.PROVIDE_NAME_ACTIONS);const e=o.reactive([]),t=o.computed(()=>e.map(s=>Tr(n,s))),r={actions:t,update:i};o.provide(_.PROVIDE_NAME_ACTIONS,r),n.router=ot.useRouter(),n.handleConfirmation||(n.handleConfirmation=Sr),n.handleAffectedEntity||(n.handleAffectedEntity=kr),n.handleCloseForm||(n.handleCloseForm=br),n.handleValidationResult||(n.handleValidationResult=Ar);function i(s={}){return e.splice(0,e.length),St(s).then(l=>e.splice(0,0,...l)).catch(L("error"))}return{actions:t,update:i}}function Tr(n,e){return{...e,label:e.title,callback(){const t=typeof n.values=="function"?n.values():n.values,r=()=>F(e.url,{method:"POST",body:JSON.stringify({keys:t,contextId:I.contextId}),headers:{"Content-Type":"application/json"}}).then(async i=>{if(!Nr(i))throw new Error("It is impossible to process the result of calls.");if(Array.isArray(n.handlers))for await(const s of n.handlers)await s(e,i,n);if(!i.success)throw n.handleValidationResult&&i.validationEffect&&n.handleValidationResult(e,i.validationEffect,n),new Error(i.message);return i.message&&ue.add("info",i.message),Array.isArray(i.affectedEntities)&&n.handleAffectedEntity&&i.affectedEntities.forEach(s=>{var l;return(l=n.handleAffectedEntity)==null?void 0:l.call(n,e,s,n)}),e.closeHostForm&&n.handleCloseForm&&n.handleCloseForm(e,n),i}).catch(L("error"));return!e.confirmation||!n.handleConfirmation?r():n.handleConfirmation(e,r)}}}function Cr(n){const e="Are you sure?";return n===!0||typeof n=="string"&&n.toLowerCase()==="true"||n==="1"?e:typeof n=="string"?n:e}function Sr(n,e){const t=Cr(n.confirmation),r=_.MODAL_CONFIRM;if(!Te.getComponentFromStore(r))throw new Error("The 'confirm' modal window is not installed. It provided inside 'constants.MODAL_CONFIRM'");return new Promise((i,s)=>{Te.pushModal(r,{message:t,resolve:()=>Promise.resolve().then(e).then(i),reject:s})})}function Ar(n,e){const t=_.MODAL_VALIDATION_EFFECT;if(!Te.getComponentFromStore(t))throw new Error("The 'validation-effect' modal window is not installed. It provided inside 'constants.MODAL_VALIDATION_EFFECT'");return new Promise(()=>{Te.pushModal(t,e)})}function kr(n,e,t){var l;const{router:r,form:i}=t,s=(l=e.primaryKey)==null?void 0:l.Id;if(r&&e&&e.name===n.redirectEntity)return r.push({name:e.name,params:{id:s}});i&&e.name===i.name&&e.updated&&s===i.id&&i.read()}function br(n,e){const{router:t}=e;t&&n.closeHostForm&&t.back()}function Nr(n){return!!(n&&typeof n=="object"&&"affectedEntities"in n&&"success"in n)}const ue=new class{constructor(){this.store=o.reactive([])}add(e,t,r={}){const i=Ir(r),s=new Or(e,t,i.timeout,i.children,i.click);return this.store.push(s),i.timeout&&setTimeout(this.remove.bind(this,s.id),i.timeout*1e3),s}remove(e){const t=this.store.findIndex(r=>r.id===e);if(t===-1)return!1;this.store.splice(t,1)}};function Ir(n){function e(r){return!!r&&typeof r=="object"}const t={timeout:10,click:()=>null,children:[]};return e(n)?{timeout:n.timeout||t.timeout,click:n.click||t.click,children:n.children||t.children}:t}const At=class kt{constructor(e,t,r,i,s){this.type=e,this.message=t,this.timeout=r,this.children=i,this.click=s,this.id=kt.cardId++}};At.cardId=1;let Or=At;class Rr extends x{constructor(e){super(),this.name="Communication",this.read=()=>{},this.id=e}sendMessage(e){return hr(this.id,e)}static checkAndGenerate(e,t,r){return pr(e,t,r).then(i=>i.length===0?fr(e,t,r):i[0])}}function Lr(){return S().emit("client:read",{})}var bt=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},Pr=(n,e,t)=>(bt(n,e,"read from private field"),t?t.call(n):e.get(n)),$r=(n,e,t)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,t)},Dr=(n,e,t,r)=>(bt(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),Ee;const Oe=class X extends x{constructor(){super(...arguments),this.type="front",this.organizations=[],$r(this,Ee,!1)}set language(e){localStorage.setItem(_.LOCALSTORAGE_LANGUAGE_KEY,e)}get language(){return localStorage.getItem(_.LOCALSTORAGE_LANGUAGE_KEY)||X.DEFAULT_LANGUAGE}get contextType(){var e;if(this.contextId)return((e=this.person)==null?void 0:e.id)===this.contextId?"person":"organization"}get isBack(){return this.type==="back"}get isFront(){return this.type==="front"}set ready(e){Dr(this,Ee,e),this.emit(X.EVENT_READY_UPDATE,e)}get ready(){return Pr(this,Ee)}onReady(e){return this.on(X.EVENT_READY_UPDATE,e)}onupdateContext(e){return this.on(X.EVENT_CONTEXT_UPDATE,e)}setCurrentContext(e){if(this.contextId===e)return console.warn("[application-manager] The current context has already been installed.");this.contextId=Number(e),localStorage.setItem(_.LOCALSTORAGE_CURRENT_CONTEXT_KEY,String(e)),this.emit(X.EVENT_CONTEXT_UPDATE,e),console.log(`Current context id %c${e}`,"color: purple")}get context(){var e;return this.contextId?this.contextId===((e=this.person)==null?void 0:e.id)?this.person:this.organizations.find(t=>t.id===this.contextId)||null:null}async init(){try{const e=await this.loadCustomerData();this.person=e,this.organizations=e.organizations,this.userId=e.userId,this.restoreCurrentContext(),this.ready=!0}catch(e){L()(e)}}restoreCurrentContext(){const e=Number.parseInt(localStorage.getItem(_.LOCALSTORAGE_CURRENT_CONTEXT_KEY)||"");if(!Number.isNaN(e)&&this.validateContextId(Number(e)))this.setCurrentContext(e);else{if(!this.person)return console.warn("Make sure you call ID recovery after saving user data");this.setCurrentContext(this.person.id)}}loadCustomerData(){return Lr()}validateContextId(e){var t;try{return((t=this.person)==null?void 0:t.id)==e?!0:!!this.organizations.find(r=>r.id===e)}catch{return!1}}};Ee=new WeakMap;Oe.DEFAULT_LANGUAGE="en";Oe.EVENT_CONTEXT_UPDATE="event:context-update";Oe.EVENT_READY_UPDATE="event:ready-update";let xr=Oe;function Mr(n){return S().emit("metadata:read",{entity:n})}const Ae=function(){const e=o.reactive({}),t=new Map;function r(a){return e[a]}async function i(a){if(t.has(a)&&await t.get(a),e[a])return;const u=await s(a);l(a,u)}function s(a){const u=Mr(a).finally(()=>{t.delete(a)});return t.set(a,u),u}function l(a,u){e[a]=u}return{state:e,initEntity:i,get:r}}();class N{static login(e){return F(B.identityServerURL+"/api/Authenticate/Login",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({...e,AppName:B.applicationName})})}static parseProcessAnswer(e){if(e.statusCode>4)throw new Error(e.statusName.replace(/([A-Z][a-z])/g," $1").replace(/(\d)/g," $1"));return e}static startRegistrationProcess(e){return N.requestStepRegistrationProcess("StartRegistration",e)}static confirmPhoneRegistrationProcess(e){return N.requestStepRegistrationProcess("ConfirmPhoneNumberByRegistration",e)}static confirmEmailRegistrationProcess(e){return N.requestStepRegistrationProcess("ConfirmEmailByRegistration",e)}static finishEmailRegistrationProcess(e){return N.requestStepRegistrationProcess("FinishRegistration",e)}static requestStepRegistrationProcess(e,t){return F(`${B.identityServerURL}/api/Authenticate/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(t)})}static startLoginProcess(e){return N.requestStepLoginProcess("StartLogin",e)}static loginWithPassword(e){return N.requestStepLoginProcess("LoginWithPassword",e)}static loginWithOtpCode(e){return N.requestStepLoginProcess("LoginWithOtpCode",e)}static requestStepLoginProcess(e,t){return F(`${B.identityServerURL}/api/Authenticate/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(t)}).then(N.parseLoginProcessAnswer)}static parseLoginProcessAnswer(e){if(e.statusCode>3)throw Error(e.statusName.replace(/([A-Z][a-z])/g," $1").replace(/(\d)/g," $1"));return e}static startPasswordReset(e){return F(`${B.identityServerURL}/api/Authenticate/StartPasswordReset`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({UserId:e})})}static verifyPasswordResetBySMS(e,t){return N.verifyPasswordReset("SMS",e,t)}static verifyPasswordResetByEmail(e,t){return N.verifyPasswordReset("Email",e,t)}static verifyPasswordReset(e,t,r){return F(`${B.identityServerURL}/api/Authenticate/VerifyPasswordReset`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({Token:t,Code:r,Channel:e})})}static resolvePasswordReset(e,t){return F(`${B.identityServerURL}/api/Authenticate/ResetPassword`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({Token:e,NewPassword:t})})}}function Vr(n){return typeof n!="object"||n===null?!1:!!(n.hasOwnProperty("start")||n.hasOwnProperty("end"))}function P(n){return Object.keys(n).reduce((e,t)=>{const r=n[t];if(Array.isArray(r)){const i=r.map(s=>typeof s=="string"?`'${s}'`:s).join(", ");return r.length&&e.push(`@${t} in (${i})`),e}if(Vr(r)){let i=function(s){var l;return((l=s.match(/([^Z]*)/))==null?void 0:l[0])+"0000Z"};return r.start&&e.push(`@${t} ge ${i(r.start)}`),r.end&&e.push(`@${t} le ${i(r.end)}`),e}return typeof r=="number"?(e.push(`@${t} eq ${r}`),e):typeof r=="string"?(r.length!==0&&e.push(`@${t} eq '${r}'`),e):(r===null&&e.push(P.is(t,r)),e)},[]).join(" and ")}function de(n){return typeof n=="string"?`'${n}'`:`${n}`}P.includes=function(e,t){return`@${e} Contains ${de(t)}`};P.beginWith=function(e,t){return`@${e} BeginWith ${de(t)}`};P.notEq=function(e,t){return`@${e} nq ${de(t)}`};P.eq=function(e,t){return Array.isArray(t)?P.in(e,t):`@${e} eq ${de(t)}`};P.in=function(e,t){const r=t.map(de).join(", ");return`@${e} in (${r})`};P.and=function(...e){return e.filter(t=>typeof t!="string"||t.trim().length===0?!1:t).map(t=>`(${t})`).join(" and ")};P.is=function(e,t){return`@${e} is ${t}`};P.or=function(...e){return e.join(" or ")};const I=new xr;class Br{static url(){return"/close-api/actions"}static async get({criterion:e}){const t=new URLSearchParams;return e&&t.append("criterion",e),await fetch(this.url()+`?${t.toString()}`,{method:"GET"}).then(r=>r.json())}static getById(e,t,r=[]){const i=new URLSearchParams;return Me(i,r),F([this.url(),e,t].join("/")+`?${i.toString()}`,{method:"GET"})}}function Fr(n,e="images"){return`/static-folder/${e}/${n}`}class Ur{static getRequiredDocuments(e,t,r){const i=new URLSearchParams({entity:e,primaryKey:t,statusCode:r});return fetch(`/close-api/views/required-documents?${i.toString()}`).then(s=>s.json())}}class Q{static url(){return"close-api/billing"}static getBillingMetadata(e){return fetch(`/${Q.url()}/calculator/${e}`)}static calculate(e,t){return y(`/${Q.url()}/calculator`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({entity:e,values:t})}).then(r=>{if(r&&r.status===1)return r;throw Array.isArray(r.notes)?new Error(r.notes[0]):Y.ApiNotAvailable()})}static parseMetadataField(e){function t(r){switch(r.type){case"ValueType":switch(r.dataType){case"Integer":return"number";default:return r.dataType}case"EntityReference":return r.dataType}}return{name:e.name,label:e.title,required:e.required,type:t(e)}}static createOnlinePayment(e,t){return y(`/${Q.url()}/online-payment`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paymentId:e,returnURL:t})})}static applyOnlinePayment(e){return y(`/${Q.url()}/online-payment`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({response:e})})}}var Nt=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},M=(n,e,t)=>(Nt(n,e,"read from private field"),t?t.call(n):e.get(n)),q=(n,e,t)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,t)},G=(n,e,t,r)=>(Nt(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),ve,oe,we,_e,se,ae,Ve;const z="_______LIST_______ROW_______INDEX________NAME_______",Re=class V extends x{constructor(e){super(),this.LIST_ROW_KEY=1,q(this,ve,void 0),this.array=[],q(this,oe,[]),q(this,we,[]),q(this,_e,new Proxy({},{set:(t,r,i,s)=>(t[r]=i,this.emit(V.EVENT_FILTERS_UPDATE,t),!0),deleteProperty:(t,r)=>(delete t[r],this.emit(V.EVENT_FILTERS_UPDATE,t),!0)})),q(this,se,!1),q(this,ae,(...t)=>Promise),q(this,Ve,()=>{}),G(this,ve,e.primaryKeys||[]),this.name=e.name||void 0,e.config&&G(this,oe,e.config)}set config(e){G(this,oe,e.map(O.utils.copyObject)),this.emitUpdateConfig()}get config(){return M(this,oe)}emitUpdateConfig(){this.emit(V.EVENT_CONFIG_UPDATE,this.config)}get order(){return M(this,we)}set order(e){G(this,we,e),this.emit(V.EVENT_ORDER_UPDATE,this.order)}get filters(){return M(this,_e)}set filters(e){Wr(M(this,_e),e)}set wait(e){G(this,se,e),this.emit(O.Form.EVENT_WAIT,M(this,se))}get wait(){return M(this,se)}get primaryKeys(){return M(this,ve)}at(e){return this.array[e%this.array.length]}atByKey(e){return this.array.find(t=>t[z]===e)}indexByKey(e){return this.array.findIndex(t=>t[z]===e)}static getKey(e){return e[z]}static hasKey(e){return typeof e!="object"||e===null?!1:Object.prototype.hasOwnProperty.call(e,z)}add(...e){const t=this.wrapArray(e);this.array.push(...t),this.emit(V.EVENT_DATA,this.array)}set(e){this.array=[],this.add(...e)}removeByKey(e){const t=this.indexByKey(e);t!==-1&&(this.array.splice(t,1),this.emit(V.EVENT_DATA,this.array))}updateByKey(e,t){const r=this.atByKey(e);r&&(Object.assign(r,t),this.emit(V.EVENT_DATA,this.array))}wrapArray(e){return e.map(this.wrapItem.bind(this))}wrapItem(e){return this.isWrapped(e)?e:{...e,[z]:this.LIST_ROW_KEY++}}isWrapped(e){return Object.prototype.hasOwnProperty.call(e,z)}set read(e){G(this,ae,e)}get read(){return(...e)=>Promise.resolve().then(()=>{const t=M(this,ae).call(this,...e);return this.wait=!0,t}).finally(()=>this.wait=!1)}set save(e){G(this,ae,e)}get save(){return()=>Promise.resolve().then(()=>this.wait=!0).then(()=>M(this,Ve).call(this)).finally(()=>this.wait=!1)}static GetFieldNames(e){return e.reduce((t,r)=>(r.name&&(typeof r.name=="string"?t.push(r.name):t.push(...r.name)),t),[])}static mergeWithKey(e,t){return{...e,[z]:t}}static getCellName(e){return typeof e.name=="string"?e.name:Array.isArray(e.name)?e.name[0]:null}static getCellInfo(e,t){const r=V.getCellName(e),i=(()=>{let s=r?ke(t,r):null;return s===void 0&&(s=null),e.value?e.value(s,t):s})();return{name:r,value:i}}};ve=new WeakMap;oe=new WeakMap;we=new WeakMap;_e=new WeakMap;se=new WeakMap;ae=new WeakMap;Ve=new WeakMap;Re.EVENT_DATA="list-data: update";Re.EVENT_CONFIG_UPDATE="list-config:update";Re.EVENT_ORDER_UPDATE="list-order:update";Re.EVENT_FILTERS_UPDATE="list-filters:update";function jr(n){const e=o.ref(""),t=o.computed(()=>{const r=e.value.toLowerCase();return o.unref(n).filter(i=>e.value.length?Object.values(i).join().toLowerCase().includes(r):!0)});return{search:e,searchArray:t}}function Wr(n,e){Object.keys(n).forEach(t=>delete n[t]),Object.entries(e).forEach(([t,r])=>{n[t]=r})}function qr(n){const e=o.reactive([]);function t(a){return e.includes(a)}function r(a){t(a)||e.push(a)}function i(a){const u=e.findIndex(d=>d===a);u!==-1&&e.splice(u,1)}function s(a){const u=o.unref(n);if(a===void 0){e.length===0?u.forEach(r):u.forEach(i);return}t(a)?i(a):r(a)}const l=o.computed(()=>{const a=o.unref(n);return e.length===a.length&&a.length!==0});return[e,s,l,r,i]}function Gr(n){return n.statusName==="Completed"}function zr(n){return n.statusName==="FinalStepWithConfirmation"}function Kr(n){return n.statusName==="ValidationError"}function Yr(n,e,t){let r=null;const i=o.reactive({wait:null});let s=[],l=null;const a=o.ref(null);function u(){a.value=s.find(c=>c.name===l)||null}function d(){var c;return l?((c=s.find(p=>p.name===l))==null?void 0:c.fields)||[]:[]}function h(c){if(u(),Kr(c))return void t.onValidation(c.validationResults);if((c.statusName==="FinalStep"||c.statusName==="NextStep")&&(!d().length||Jr(d(),t.presets)))return m(t.presets||{});Gr(c)&&t.onCompleted(c),zr(c)&&t.onConfirmation(c)}async function T(){try{await R(),await f()}catch(c){const{message:p}=Ce(c);ue.add("error",p)}}function R(){return i.wait="Loading process information.",me.getStartConfig(e,n).then(c=>{s=c.steps.map(p=>({label:p.title,name:p.stepName,number:p.number,fields:p.frontendEntity.objectTypes.reduce((g,$)=>($.properties.forEach(A=>{g.push({name:A.name,label:A.title,type:A.refEntityName||A.dataType})}),g),[])}))}).then(c=>(i.wait=!1,c))}function E(c){return l=c.nextStepName,r=c.token,c}function w(c){const p=Ce(c);ue.add("error",p.message)}function f(){return i.wait="Starting process",me.startProcess(e,n).then(E).then(h).catch(w).finally(()=>{i.wait=null})}function m(c={}){return!r||!l?Promise.reject("Not step or token."):(i.wait="Waiting for result...",me.runStep(e,n,l,r,c).then(E).then(h).catch(w).finally(()=>{i.wait=!1}))}return{initialize:T,state:i,currentStepConfig:o.readonly(a),next:m}}function Jr(n,e){for(let t=0;t<n.length;t++){const r=n[t];if(!O.utils.getPropFromObject(e,r.name))return!1}return!0}const Hr="close-api/proxy/Equipment/Search";class Xr{static search(e,t,r,i,s){const l=new URLSearchParams;l.append("pattern",e||""),t&&l.append("categoryId",t),r&&l.append("useType",String(r)),i&&l.append("statusCode",i),s&&(l.append("limit",String(s.limit)),l.append("offset",String(s.offset)));const a=`/${Hr}?${l.toString()}`;return y(a,{method:"GET",headers:{"Content-Type":"application/json"}})}}const Qr={clickOutside:be,staticLink:Fr},Zr={usage:Pt,utils:Wt,types:qt};exports.Communication=Rr;exports.CoreError=Y;exports.Filter=P;exports.Manager=I;exports.MetadataStore=Ae;exports.NotificationSystem=ue;exports.WidgetButton=En;exports.WidgetIcon=le;exports.WidgetImage=In;exports.WidgetList=jn;exports.WidgetLoader=bn;exports.WidgetMultiButton=Sn;exports.WidgetSpinner=Ie;exports.WidgetTable=hn;exports.actionService=Br;exports.asyncProcess=qn;exports.authService=N;exports.billingService=Q;exports.catchUniversal=L;exports.clickOutside=be;exports.clientService=lt;exports.communicationService=Qt;exports.config=Wn;exports.configuration=B;exports.constants=_;exports.dataService=ce;exports.debounce=Hn;exports.default=Zr;exports.documentsService=Ur;exports.equipmentService=Xr;exports.fileService=Zt;exports.getCellName=yt;exports.getCellValue=mt;exports.getNamesFromListConfig=zn;exports.groupArrayByField=Kn;exports.historyService=Gt;exports.injectAction=cr;exports.internationalizationService=zt;exports.invitationService=en;exports.openService=tn;exports.parseError=Ce;exports.prettyDate=We;exports.prettyDateWithTime=Et;exports.prettyMoney=wt;exports.prettyValueFieldByEntity=Zn;exports.processWizardService=me;exports.request=F;exports.ruleValidationService=Ue;exports.t=Z;exports.throttle=Xn;exports.universalEntityCreate=Tt;exports.universalEntityDelete=Ct;exports.universalEntityRead=Se;exports.universalEntityUpdate=qe;exports.universalListSettingRead=or;exports.universalMetadataFieldTreat=sr;exports.universalToolRead=St;exports.useActions=_r;exports.useCommunication=yr;exports.useFormEntity=mr;exports.useListActiveRow=lr;exports.useListEntity=ur;exports.useListSearch=jr;exports.useListSelect=qr;exports.useLogger=Yt;exports.useManagerState=dr;exports.useMetadata=Er;exports.useSocket=S;exports.useUsageContext=vr;exports.useWizard=Yr;exports.utils=Qr;exports.uuidv4=Yn;exports.valuesToUpperCase=Ge;
|
|
11
11
|
//# sourceMappingURL=eservices-core.cjs.js.map
|