eservices-core 1.3.21 → 1.3.22
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}.head-cell[data-v-4e1d87c8]{padding:0 15px 0 10px;display:flex}.head-cell[data-v-4e1d87c8]:hover{box-shadow:0 -1px #e7f2ff}.list-head-cell-label[data-v-4e1d87c8]{padding:5px 0;white-space:nowrap;cursor:pointer}.head-cell-order[data-v-4e1d87c8]{position:absolute;inset-inline-end:4px;inset-block:0 0;margin:auto;font-size:14px;height:14px}.head-cell-order_down[data-v-4e1d87c8]{transform:rotate(180deg)}.head-cell-resize[data-v-4e1d87c8]{padding:3px 10px;cursor:col-resize;transition:background-color .1s}.head-cell-resize[data-v-4e1d87c8]:hover{background-color:#f5f5f5}.head-cell-resize[data-v-4e1d87c8]: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.22
|
|
4
4
|
* (c) 2023 ESERVICES
|
|
5
|
-
*/Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("vue"),S=require("jenesius-vue-form"),Vt=require("jenesius-vue-modal"),ut=require("vue-router"),Mt=require("date-and-time");function Ut(n,e){return!!n&&n===e||"password is not equal"}function dt(n){return Number(n.replace(/[^0-9.]/g,""))}function jt(n,e=null){let r=String(dt(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 Wt=Object.freeze(Object.defineProperty({__proto__:null,numeric:dt,prettyNumeric:jt,validPassword:Ut},Symbol.toStringTag,{value:"Module"})),qt={inputs:Wt};function
|
|
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.`)}};pt.ID=0;let F=pt;const ht="Please try again later or submit a feedback if problem doesn't go.";function Qe(n){return typeof n=="string"?
|
|
5
|
+
*/Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("vue"),S=require("jenesius-vue-form"),Vt=require("jenesius-vue-modal"),ut=require("vue-router"),Mt=require("date-and-time");function Ut(n,e){return!!n&&n===e||"password is not equal"}function dt(n){return Number(n.replace(/[^0-9.]/g,""))}function jt(n,e=null){let r=String(dt(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 Wt=Object.freeze(Object.defineProperty({__proto__:null,numeric:dt,prettyNumeric:jt,validPassword:Ut},Symbol.toStringTag,{value:"Module"})),qt={inputs:Wt};function Ae(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?Ae(n[r],e.substr(t+1)):void 0}return n[e]}function Ne(n,e){if(!n)return console.warn("Element is not provided.");function t(o,s){return o==s.target||o.contains(s.target)}const r=o=>{t(n,o)||(e(),window.removeEventListener("click",r))};window.addEventListener("click",r)}function ft(n){return n.reduce((e,t)=>e.then(r=>t==null?void 0:t(r)),Promise.resolve())}const pt=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.`)}};pt.ID=0;let F=pt;const ht="Please try again later or submit a feedback if problem doesn't go.";function Qe(n){return typeof n=="string"?De(n):Gt(n)?De(n.message):De(ht)}function Gt(n){return!!(typeof n=="object"&&Object.hasOwnProperty.call(n,"message")&&n!==null)}function De(n,e=[]){return{message:n,details:e}}class gt{static getClientData(){return m("/close-api/client-content")}static getNavigation(){return m("/close-api/client/navigation")}}const H=new class{constructor(){this.store=i.reactive([])}add(e,t,{children:r,timeout:o=10,click:s=()=>{}}={}){const d=new zt(e,t,o,r||[],s);return this.store.push(d),o&&setTimeout(this.remove.bind(this,d.id),o*1e3),d}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.")}},mt=class yt{constructor(e,t,r,o,s){this.type=e,this.msg=t,this.timeout=r,this.children=o,this.click=s,this.id=yt.cardId++}};mt.cardId=1;let zt=mt;/*!
|
|
7
7
|
* jenesius-event-emitter v1.0.2
|
|
8
8
|
* (c) 2022 Jenesius
|
|
9
9
|
* @license MIT
|
|
10
|
-
*/const et=function(n,e){return n in this.events||(this.events[n]=[]),this.events[n].push(e),this.off.bind(this,n,e)},tt=function(n,e){n in this.events&&this.events[n].forEach(t=>t(e))},nt=function(n,e){const t=this.events[n];if(!t)return;const r=t.indexOf(e);r!==-1&&t.splice(r,1)},rt=function(){this.events={}};class O{constructor(){this.events={}}on(e,t){return et.call(this,e,t)}emit(e,t){return tt.call(this,e,t)}off(e,t){return nt.call(this,e,t)}cleanEvents(){rt.call(this)}static on(e,t){return et.call(O,e,t)}static emit(e,t){return tt.call(O,e,t)}static off(e,t){return nt.call(O,e,t)}static cleanEvents(){rt.call(O)}}O.events={};var wt=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},pe=(n,e,t)=>(wt(n,e,"read from private field"),t?t.call(n):e.get(n)),Be=(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)},Ve=(n,e,t,r)=>(wt(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),te,he,ge;const z=class k extends O{constructor(){super(...arguments),Be(this,te,void 0),Be(this,he,"front"),this.organizations=[],Be(this,ge,!1)}set language(e){localStorage.setItem(k.LOCALSTORAGE_LANGUAGE_KEY,e)}get language(){return localStorage.getItem(k.LOCALSTORAGE_LANGUAGE_KEY)||k.DEFAULT_LANGUAGE}checkLanguageInStorage(){return!!localStorage.getItem(k.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){Ve(this,te,e)}get router(){if(!pe(this,te))throw new Error("Router was not founded. Please set router: Manager.router = router: VueRouter");return pe(this,te)}set type(e){Ve(this,he,e)}get type(){return pe(this,he)}get isBack(){return this.type==="back"}get isFront(){return this.type==="front"}set ready(e){Ve(this,ge,e),this.emit(k.EVENT_READY_UPDATE,e)}get ready(){return pe(this,ge)}onReady(e){return this.on(k.EVENT_READY_UPDATE,e)}onupdateContext(e){return this.on(k.EVENT_CONTEXT_UPDATE,e)}onupdateData(e){return this.on(k.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(k.CURRENT_CONTEXT_KEY,String(e)),this.emit(k.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(k.CURRENT_CONTEXT_KEY)||"");!Number.isNaN(t)&&this.validateContextId(Number(t))?this.setCurrentContext(t):this.setCurrentContext(Number(e.id))}catch{H.add("error",F.ApiNotAvailable().message)}}loadCustomerData(){return gt.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))}};te=new WeakMap;he=new WeakMap;ge=new WeakMap;z.DEFAULT_LANGUAGE="en";z.LOCALSTORAGE_LANGUAGE_KEY="CurrentLanguage";z.EVENT_CONTEXT_UPDATE="event:context-update";z.EVENT_READY_UPDATE="event:ready-update";z.EVENT_DATA_UPDATE="event:data-update";z.CURRENT_CONTEXT_KEY="CurrentContext";let Kt=z;const _e=new Kt;function Yt(n){return n.text().then(e=>{try{return JSON.parse(e)}catch{return ht}})}function m(n,e={}){return _e.isFront&&(e.headers||(e.headers={}),e.headers["Context-Id"]=_e.contextId),e.redirect="manual",fetch(n,e).then(t=>t.type==="opaqueredirect"?void window.location.replace("/auth"):t).catch(()=>{throw F.ApiNotAvailable()}).then(t=>Yt(t).then(r=>{if(!t.ok)throw r;return r}))}class Oe{constructor(){}static parseNamesFromListConfig(e){let t=Oe.parseFieldsToGraphQL(e.reduce((o,s)=>(s.name&&o.push(s.name),o),[]));function r(o){let s="";for(let d in o)typeof o[d]=="boolean"?s+=` ${d} `:s+=` ${d} { ${r(o[d])} }`;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,o){if(o.includes(".")){const s=o.indexOf("."),d=o.substring(s+1),l=o.substring(0,s);l in r||(r[l]={}),t(r[l],d)}else r[o]=!0;return r}return e.reduce(t,{})}}class Jt{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 Ct=new Jt;function vt(n){return n&&n[0].toLowerCase()+n.slice(1)}function Ge(n){return Object.keys(n).reduce((e,t)=>{let r=n[t];const o=t.charAt(0).toUpperCase()+t.slice(1);return typeof r=="object"&&!(r==null||Array.isArray(r))&&(r=Ge(r)),e[o]=r,e},{})}function Ht(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 ae={Request:m,clickOutside:ke,getPropFromObject:Ne,runPromiseQueue:ft,GraphQL:Oe,firstChapterToLowerCase:vt,valuesToUpperCase:Ge,prettyMoney:Ht},Xt=Object.freeze(Object.defineProperty({__proto__:null,GraphQL:Oe,Journal:Ct,Request:m,clickOutside:ke,default:ae,firstChapterToLowerCase:vt,getPropFromObject:Ne,runPromiseQueue:ft,valuesToUpperCase:Ge},Symbol.toStringTag,{value:"Module"}));function Et(n,e=""){for(let t in n){if(typeof n[t]=="object"){Et(n[t],(e.length?`${e}-`:"")+t);continue}let r="--"+((e.length?`${e}-`:"")+t).replace(/([A-Z])/g,o=>`-${o}`.toLowerCase());document.documentElement.style.setProperty(r,n[t])}}const B={};function Zt(n){for(let e in n)B[e]=n[e];n.styles&&Et(n.styles),Ct.welcome(),console.log("The config has been initialized. To get access check %c_config in console.","background: purple; color: white"),window._config=B}const Qt=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));const en=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));class tn{static readHistoryById(e,t){return m(`/close-api/audits/history/${e}/${t}`,{method:"GET",headers:{"Content-Type":"application/json"}}).then(r=>{const o=r.history.map(s=>{if(!s.changes)return s;const d=s.changes.map(l=>({...l,oldValue:l.originalValue,name:l.fieldName}));return{...s,changes:d}});return{...r,history:o}})}}class nn extends O{constructor(){super(),this.EVENT_NEW="event:new-metadata",this.store={}}get(e){return this.store[e]}async load(e){return this.store[e]||this.set(e,await this.loadEntityInformation(e)),this.store[e]}set(e,t){this.store[e]=t,this.emit(this.EVENT_NEW,{entityName:e})}async loadEntityInformation(e){return await ze.get(e)}}const ne=new nn;function rn(n){const e=i.ref(ne.get(n));return ne.on(ne.EVENT_NEW,t=>{n===t.entityName&&(e.value=ne.get(n))}),e}function on(n,e){try{return e.dataType==="DateTime"&&typeof n=="string"?new Date(n).toLocaleString():n}catch(t){_t().error("prettify value by metadata",n,t)}}class sn{static getDictionary(e){if(!e)throw new Error(`Can't get dictionary for ${e}.`);return m(`/open-api/internationalization/language/${e}`)}}let q={};function X(n,...e){if(typeof n!="string")return console.trace(`Label is not provided for translation: ${n}`),"undefined";let t=S.utils.getPropFromObject((this==null?void 0:this.vocabulary)||q,n);if(typeof t=="string")return ot(t,e);const r=S.utils.getPropFromObject(q==null?void 0:q.root,n);return typeof r=="string"?ot(r,e):(typeof t===void 0&&console.warn(`Translation for label "${n}" is not founded.`),n)}function ot(n,e){return e.forEach((t,r)=>{n=n.replaceAll(new RegExp(`\\{${r}}`,"g"),t)}),n}X.setGlobalVocabulary=function(n){q=n};X.getScope=function(n){const e=typeof n=="string"?n:"root";return typeof n!="string"&&console.warn(`SCOPE ${n} for translate is not string.`),X.bind({vocabulary:S.utils.getPropFromObject(q,e.toLowerCase())})};X.setVocabulary=function(n){return typeof n=="string"&&(n=S.utils.getPropFromObject(q,n)),X.bind({vocabulary:n})};const an=function(){let n=!1;const e=[];function t(){return n}function r(a,p){t()&&console[a](...p),e.push(p)}function o(...a){r("log",a)}function s(...a){r("warn",a)}function d(...a){r("error",a)}function l(a=!0){n=a}return{info:o,warn:s,history:e,display:l,error:d}}();function _t(){return an}class T{static parseError(e){let t=e.errors?Object.values(e.errors).map(r=>r[0]):null;throw F.AuthServiceError(e.title,t)}static login(e){return m(B.identityServerURL+"/api/Authenticate/Login",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({...e,AppName:B.applicationName})}).catch(T.parseError)}static registration(e){return e.AppName=B.applicationName,m(B.identityServerURL+"/api/Authenticate/Registration",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(e)}).catch(T.parseError)}static parseProcessAnswer(e){if(e.statusCode>4)throw F.UndefinedError(e.statusName.replace(/([A-Z][a-z])/g," $1").replace(/(\d)/g," $1"));return e}static startRegistrationProcess(e){return T.requestStepRegistrationProcess("StartRegistration",e)}static confirmPhoneRegistrationProcess(e){return T.requestStepRegistrationProcess("ConfirmPhoneNumberByRegistration",e)}static confirmEmailRegistrationProcess(e){return T.requestStepRegistrationProcess("ConfirmEmailByRegistration",e)}static finishEmailRegistrationProcess(e){return T.requestStepRegistrationProcess("FinishRegistration",e)}static requestStepRegistrationProcess(e,t){return m(`${B.identityServerURL}/api/Authenticate/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(t)}).catch(T.parseError)}static startLoginProcess(e){return T.requestStepLoginProcess("StartLogin",e)}static loginWithPassword(e){return T.requestStepLoginProcess("LoginWithPassword",e)}static loginWithOtpCode(e){return T.requestStepLoginProcess("LoginWithOtpCode",e)}static requestStepLoginProcess(e,t){return m(`${B.identityServerURL}/api/Authenticate/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(t)}).catch(T.parseError).then(T.parseLoginProcessAnswer)}static parseLoginProcessAnswer(e){if(e.statusCode>3)throw F.UndefinedError(e.statusName.replace(/([A-Z][a-z])/g," $1").replace(/(\d)/g," $1"));return e}}function cn(n){return Array.isArray(n)&&n.length===2&&typeof n[0]=="string"&&typeof n[1]=="number"}const ln="masterId",un="masterEntity";function Se(n,e){if(!Array.isArray(e))return;if(cn(e))return t(e);e.forEach(t);function t(r){n.append(un,r[0]),n.append(ln,r[1].toString())}}class D{static async anonymousGetList(e){return await m(`/open-api/data/${e}`,{method:"GET",headers:{"Content-Type":"application/json"}})}static getSearchParamsForEntityListRead(e){const t=(o,s)=>r.append(o,s),r=new URLSearchParams;if(e.fields){const o=e.fields;typeof o=="string"?t("fields",o):Array.isArray(o)?t("fields",o.join(" ")):typeof o=="object"&&t("fields",Object.keys(o).join(" "))}if(e.order){let o=e.order;const d=(Array.isArray(o)?[o]:Object.entries(o)).map(([l,a="desc"])=>`@${l} ${a}`).join(",");t("order",d)}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=D.getSearchParamsForEntityListRead(t||{});return await m(`/close-api/data/${e}?${r.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"}})}static getCount(e,t){const r=D.getSearchParamsForEntityListRead(t||{});return m(`/close-api/data/entities/${e}/count?${r.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"}})}static create(e,t,r){const o=new URLSearchParams;return Se(o,r==null?void 0:r.masterEntities),m(`/close-api/data/${e}?${o.toString()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({values:t})})}static update(e,t,r,o={}){return m(`/close-api/data/entities/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({values:r})})}static readById(e,t,r={}){const o=new URLSearchParams;if(r.fields){let s=r.fields;typeof s=="string"&&(s=[s]),o.append("fields",s.join(" "))}return m(`/close-api/data/entities/${e}/id/${t}?${o.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"}})}static updateById(e,t,r,o){const s=new URLSearchParams;return Se(s,o==null?void 0:o.masterEntities),m(`/close-api/data/entities/${e}/id/${t}?${s.toString()}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({values:r,version:o==null?void 0:o.version})})}static removeById(e,t,r){const o=typeof t=="number"?{Id:t}:t;return D.removeByKeys(e,o,r)}static removeByKeys(e,t,r){return m(`/close-api/data/entities/${e}`,{method:"delete",headers:{"Content-Type":"application/json"},body:JSON.stringify({keys:t,version:r})})}}const St=class re{static async create(e){return m(re.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 m(re.url+"?"+t.toString(),{method:"get"})}static async readMessages(e){return m(`${re.url}/${e}/messages`,{method:"get"})}static async createMessage(e){return m(`${re.url}/${e.talkId}/messages`,{method:"post",body:JSON.stringify({text:e.text}),headers:{"Content-Type":"application/json"}})}};St.url="/close-api/communications";let ce=St;class dn{static async getDefaultView(e){return m("/close-api/views/"+e,{method:"GET",headers:{"Content-Type":"application/json"}})}}function it(n){return{...n,createdEntities:n.createdEntites}}const bt=class me{static async getStartConfig(e,t){return m([me.url,e,t].join("/"),{method:"GET",headers:{"Content-Type":"application/json"}})}static async startProcess(e,t){return m([me.url,e,t].join("/"),{method:"POST",headers:{"Content-Type":"application/json"}}).then(it)}static async runStep(e,t,r,o,s){return m([me.url,e,t].join("/"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({stepName:r,token:o,values:s})}).then(it)}};bt.url="/close-api/views/process-wizard";let ye=bt;class ze{static get url(){return"/close-api/metadata"}static async get(e,t,r){console.warn("GETTING METADATA BY DEPRECATED METHOD."),console.trace();const o=new URLSearchParams;return t&&o.append("criteria",t),r&&o.append("id",String(r)),await fetch(this.url+`/${e}?${o.toString()}`,{method:"GET"}).then(s=>s.json())}static getById(e,t,r=[]){const o=new URLSearchParams;return Se(o,r),t&&o.append("id",t),m([this.url,e].join("/")+`?${o.toString()}`)}static getFieldInformation(e,t){return m(`/open-api/metadata/${e}/fields/${t}`)}static getTreatmentListField(e,t){return m(`/open-api/metadata/${e}/list-fields/${t}`)}}class fn{static async upload(e,t){const r=new FormData;r.append("file",e);const o=`/close-api/files?entityName=${t}`;return await fetch(o,{method:"POST",body:r}).then(s=>s.json()).then(s=>(s.filename=e.name,s))}}class pn{static invite(e,t,r){return m("/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 m("/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 m("/close-api/accounts/markInvite",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({invitationId:e,version:t,mark:!1})})}}class Ke{static get url(){return"/close-api/rules-validation/"}static validate(e,t){return m(Ke.url+e,{method:"POST",body:JSON.stringify(t)})}}class hn{static getConfiguration(){return m("/open-api/webserver-configuration",{method:"GET",headers:{"Content-Type":"application/json"}})}}class Tt{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 o=new URLSearchParams;return Se(o,r),m([this.url(),e,t].join("/")+`?${o.toString()}`,{method:"GET"})}}class gn extends O{constructor(e){super(),this.name="Communication",this.read=()=>{},this.id=e}sendMessage(e){return ce.createMessage({talkId:this.id,text:e})}static checkAndGenerate(e){return ce.read(e).then(t=>t.length===0?ce.create(e):t[0])}}function mn(n){const e=S.Form.getParentForm();e?e.subscribe(n):console.warn(F.ParentFormNotFound());const t=i.reactive([]);return n.read=()=>ce.readMessages(n.id).then(r=>(t.splice(0,t.length,...r),r)),{array:t}}function yn(n,e="images"){return`/static-folder/${e}/${n}`}function wn(n,e=1e3){let t=0;return(...r)=>{clearTimeout(t),t=setTimeout(()=>n(...r),e)}}function Cn(n,e){const t=i.ref(null);function r(){return n.name?ze.getById(n.name,e,[]).then(o=>{t.value=o,o.fields.forEach(s=>{s.canSet?n.enable(s.name):n.disable(s.name)})}).catch(()=>{t.value=null;const o=F.MetadataEntityIsNotAvailable(n.name||"FORM_WITHOUT_NAME");H.add("error",o.message)}):Promise.reject()}return n.on(S.Form.EVENT_READ,r),{metadata:t,update:r}}class Ye extends Error{static UndefinedStatus(){return new Ye("Status is undefined.")}}class vn extends Ye{}function En(n,e){const t=i.reactive([]);async function r(s,d){if(!s)throw vn.UndefinedStatus();const l=await Tt.get({criterion:s});t.splice(0,t.length),t.push(...l.map(a=>o(a,d)))}return{actions:t,update:r};function o(s,d){return{title:s.title,callback:()=>(()=>Promise.resolve().then(()=>{if(n.changed)return n.save()}).then(()=>fetch(s.url,{method:"POST",body:JSON.stringify({keys:{Id:d},contextId:_e.contextId}),headers:{"Content-Type":"application/json"}})).then(a=>a.json()).then(a=>{if(!a.success)throw e!=null&&e.ModalValidationResult&&a.validationEffect?Vt.openModal(e.ModalValidationResult,{rules:a.validationEffect.results}):H.add("error",a.message),new Error;return a}).then(a=>{a.message&&H.add("info",a.message),e!=null&&e.handleAffectedEntities&&e.handleAffectedEntities(a.affectedEntities)}).then(()=>n.read()))()}}}class be{static url(){return"/close-api/presentation"}static getStatuses(e,t){return fetch(`${be.url()}/status/${e}/${t}`).then(r=>r.json())}}function _n(n){const e=i.reactive({title:"Loading",type:"wait"});function t(r){if(n.name&&Number.isInteger(r))return be.getStatuses(n.name,r).then(o=>{e.type=o.type,e.title=o.name})}return n.on(S.Form.EVENT_READ,r=>{var d,l;const{code:o,name:s}={code:(d=r.Status)==null?void 0:d.Code,name:(l=r.Status)==null?void 0:l.Name};return n.name?!Number.isInteger(o)&&!s?void console.log("Undefined code or name is Status prop."):be.getStatuses(n.name,o).then(a=>{e.type=a.type,e.title=s}):void console.log("Form without name.")}),{label:e,update:t}}function Sn(n,e){const t=ut.useRoute(),r=i.computed(()=>Number(t.params.id)),o=i.reactive({ready:!1,show:!1});return i.watch(()=>r.value,()=>{o.ready=!1}),i.watch(()=>r.value,()=>{Number.isInteger(r.value)&&n.read()},{immediate:!0}),n.read=ae.requestHandler.bind(null,()=>Promise.resolve().then(()=>{if(!n.name)throw new Error("Form without entity name. Please set form.name");return D.readById(n.name,r.value,{fields:e.fields})}).then(ae.valuesToUpperCase).then(s=>(Number.isInteger(s.Version)&&(n.version=s.Version),n.setValues(s),o.show=!0,s)).catch(s=>{throw Object.prototype.hasOwnProperty.call(s,"status")&&[403,404].includes(s.status)&&(o.show=!1),s}).finally(()=>{o.ready=!0})),n.save=ae.requestHandler.bind(null,()=>Promise.resolve().then(()=>{if(!n.name)throw new Error("Form without entity name. Please set form.name");return D.updateById(n.name,r.value,n.changes,{version:n.version})}).then(s=>{n.version=s.version})),n.on(S.Form.EVENT_SAVE,n.read.bind(n)),{formShadowState:o}}function bn(n,e){const t=i.reactive({ready:!1,show:!1});function r(){t.ready=!1,t.show=!1}return n.read=()=>{let o=e();return Promise.resolve().then(()=>{if(!n.name)throw F.EntityWithoutName("Use Form Request");return D.readById(n.name,o.id,{fields:o.fields})}).then(ae.valuesToUpperCase).then(s=>(s.hasOwnProperty("Version")&&(n.version=Number(s.Version)),n.setValues(s),t.show=!0,s)).catch(s=>{const d=Qe(s);throw H.add("error",d.message),d}).finally(()=>{t.ready=!0})},n.save=()=>{let o=e();return Promise.resolve().then(()=>{if(!n.name)throw F.EntityWithoutName("Use Form Request");return D.updateById(n.name,o.id,n.changes,{version:n.version})}).then(s=>{n.version=s.version||s.Version}).catch(s=>{const d=Qe(s);throw H.add("error",d.message),d})},n.on(S.Form.EVENT_SAVE,n.read.bind(n)),{shadowFormState:t,initShadow:r}}class Tn{static getRequiredDocuments(e,t,r){const o=new URLSearchParams({entity:e,primaryKey:t,statusCode:r});return fetch(`/close-api/views/required-documents?${o.toString()}`).then(s=>s.json())}}class J{static url(){return"close-api/billing"}static getBillingMetadata(e){return fetch(`/${J.url()}/calculator/${e}`)}static calculate(e,t){return m(`/${J.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]):F.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 m(`/${J.url()}/online-payment`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paymentId:e,returnURL:t})})}static applyOnlinePayment(e){return m(`/${J.url()}/online-payment`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({response:e})})}}class An{static getListSettings(e,t){const r=new URLSearchParams;r.set("entity",e),t&&r.set("mark",t);const o=`/close-api/views/list/configs?${r.toString()}`;return m(o)}}var At=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},R=(n,e,t)=>(At(n,e,"read from private field"),t?t.call(n):e.get(n)),M=(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)},U=(n,e,t,r)=>(At(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),we,oe,Ce,ve,ie,se,je;const j="_______LIST_______ROW_______INDEX________NAME_______",Fe=class L extends O{constructor(e){super(),this.LIST_ROW_KEY=1,M(this,we,void 0),this.array=[],M(this,oe,[]),M(this,Ce,[]),M(this,ve,new Proxy({},{set:(t,r,o,s)=>(t[r]=o,this.emit(L.EVENT_FILTERS_UPDATE,t),!0),deleteProperty:(t,r)=>(delete t[r],this.emit(L.EVENT_FILTERS_UPDATE,t),!0)})),M(this,ie,!1),M(this,se,(...t)=>Promise),M(this,je,()=>{}),U(this,we,e.primaryKeys||[]),this.name=e.name||void 0,e.config&&U(this,oe,e.config)}set config(e){U(this,oe,e.map(S.utils.copyObject)),this.emitUpdateConfig()}get config(){return R(this,oe)}emitUpdateConfig(){this.emit(L.EVENT_CONFIG_UPDATE,this.config)}get order(){return R(this,Ce)}set order(e){U(this,Ce,e),this.emit(L.EVENT_ORDER_UPDATE,this.order)}get filters(){return R(this,ve)}set filters(e){kn(R(this,ve),e)}set wait(e){U(this,ie,e),this.emit(S.Form.EVENT_WAIT,R(this,ie))}get wait(){return R(this,ie)}get primaryKeys(){return R(this,we)}at(e){return this.array[e%this.array.length]}atByKey(e){return this.array.find(t=>t[j]===e)}indexByKey(e){return this.array.findIndex(t=>t[j]===e)}static getKey(e){return e[j]}static hasKey(e){return typeof e!="object"||e===null?!1:Object.prototype.hasOwnProperty.call(e,j)}add(...e){const t=this.wrapArray(e);this.array.push(...t),this.emit(L.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(L.EVENT_DATA,this.array))}updateByKey(e,t){const r=this.atByKey(e);r&&(Object.assign(r,t),this.emit(L.EVENT_DATA,this.array))}wrapArray(e){return e.map(this.wrapItem.bind(this))}wrapItem(e){return this.isWrapped(e)?e:{...e,[j]:this.LIST_ROW_KEY++}}isWrapped(e){return Object.prototype.hasOwnProperty.call(e,j)}set read(e){U(this,se,e)}get read(){return(...e)=>Promise.resolve().then(()=>{const t=R(this,se).call(this,...e);return this.wait=!0,t}).finally(()=>this.wait=!1)}set save(e){U(this,se,e)}get save(){return()=>Promise.resolve().then(()=>this.wait=!0).then(()=>R(this,je).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,[j]: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=L.getCellName(e),o=(()=>{let s=r?Ne(t,r):null;return s===void 0&&(s=null),e.value?e.value(s,t):s})();return{name:r,value:o}}};we=new WeakMap;oe=new WeakMap;Ce=new WeakMap;ve=new WeakMap;ie=new WeakMap;se=new WeakMap;je=new WeakMap;Fe.EVENT_DATA="list-data: update";Fe.EVENT_CONFIG_UPDATE="list-config:update";Fe.EVENT_ORDER_UPDATE="list-order:update";Fe.EVENT_FILTERS_UPDATE="list-filters:update";function Nn(n){const e=i.ref(""),t=i.computed(()=>{const r=e.value.toLowerCase();return i.unref(n).filter(o=>e.value.length?Object.values(o).join().toLowerCase().includes(r):!0)});return{search:e,searchArray:t}}function kn(n,e){Object.keys(n).forEach(t=>delete n[t]),Object.entries(e).forEach(([t,r])=>{n[t]=r})}function On(n){const e=i.reactive([]);function t(l){return e.includes(l)}function r(l){t(l)||e.push(l)}function o(l){const a=e.findIndex(p=>p===l);a!==-1&&e.splice(a,1)}function s(l){const a=i.unref(n);if(l===void 0){e.length===0?a.forEach(r):a.forEach(o);return}t(l)?o(l):r(l)}const d=i.computed(()=>{const l=i.unref(n);return e.length===l.length&&l.length!==0});return[e,s,d,r,o]}function Fn(n){return n.statusName==="Completed"}function In(n){return n.statusName==="FinalStepWithConfirmation"}function $n(n){return n.statusName==="ValidationError"}function Pn(n,e,t){let r=null;const o=i.reactive({wait:null});let s=[],d=null;const l=i.ref(null);function a(){l.value=s.find(y=>y.name===d)||null}function p(){var y;return d?((y=s.find(E=>E.name===d))==null?void 0:y.fields)||[]:[]}function c(y){if(a(),$n(y))return void t.onValidation(y.validationResults);if((y.statusName==="FinalStep"||y.statusName==="NextStep")&&(!p().length||Rn(p(),t.presets)))return C(t.presets||{});Fn(y)&&t.onCompleted(y),In(y)&&t.onConfirmation(y)}async function f(){try{await u(),await w()}catch(y){const{message:E}=Te(y);Ae.add("error",E)}}function u(){return o.wait="Loading process information.",ye.getStartConfig(e,n).then(y=>{s=y.steps.map(E=>({label:E.title,name:E.stepName,number:E.number,fields:E.frontendEntity.objectTypes.reduce((b,A)=>(A.properties.forEach($=>{b.push({name:$.name,label:$.title,type:$.refEntityName||$.dataType})}),b),[])}))}).then(y=>(o.wait=!1,y))}function h(y){return d=y.nextStepName,r=y.token,y}function g(y){const E=Te(y);Ae.add("error",E.message)}function w(){return o.wait="Starting process",ye.startProcess(e,n).then(h).then(c).catch(g).finally(()=>{o.wait=null})}function C(y={}){return!r||!d?Promise.reject("Not step or token."):(o.wait="Expect the result",ye.runStep(e,n,d,r,y).then(h).then(c).catch(g).finally(()=>{o.wait=!1}))}return{initialize:f,state:o,currentStepConfig:i.readonly(l),next:C}}function Rn(n,e){for(let t=0;t<n.length;t++){const r=n[t];if(!S.utils.getPropFromObject(e,r.name))return!1}return!0}const Ln="close-api/proxy/Equipment/Search";class Dn{static search(e,t,r,o,s){const d=new URLSearchParams;d.append("pattern",e||""),t&&d.append("categoryId",t),r&&d.append("useType",String(r)),o&&d.append("statusCode",o),s&&(d.append("limit",String(s.limit)),d.append("offset",String(s.offset)));const l=`/${Ln}?${d.toString()}`;return m(l,{method:"GET",headers:{"Content-Type":"application/json"}})}}const xn={class:"widget-table__head"},Bn={class:"widget-table__head-label margin_0 text_overflow"},Vn=i.defineComponent({__name:"widget-table-head",props:{config:{}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("tr",xn,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.config,(r,o)=>(i.openBlock(),i.createElementBlock("th",{class:"widget-table__head-cell",key:o},[i.createElementVNode("p",Bn,i.toDisplayString(r.label),1)]))),128))]))}});const V=(n,e)=>{const t=n.__vccOpts||n;for(const[r,o]of e)t[r]=o;return t},Mn=V(Vn,[["__scopeId","data-v-25198f4a"]]);function Un(n){return typeof n.name=="string"?n.name:Array.isArray(n.name)?n.name[0]:null}function Nt(n,e){const t=Un(n);let r=t?S.utils.getPropFromObject(e,t):null;return r===void 0&&(r=null),n.value?n.value(r,e):r}function jn(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var We={exports:{}},Me,st;function Wn(){if(st)return Me;st=1;var n=1e3,e=n*60,t=e*60,r=t*24,o=r*7,s=r*365.25;Me=function(c,f){f=f||{};var u=typeof c;if(u==="string"&&c.length>0)return d(c);if(u==="number"&&isFinite(c))return f.long?a(c):l(c);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(c))};function d(c){if(c=String(c),!(c.length>100)){var f=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(c);if(f){var u=parseFloat(f[1]),h=(f[2]||"ms").toLowerCase();switch(h){case"years":case"year":case"yrs":case"yr":case"y":return u*s;case"weeks":case"week":case"w":return u*o;case"days":case"day":case"d":return u*r;case"hours":case"hour":case"hrs":case"hr":case"h":return u*t;case"minutes":case"minute":case"mins":case"min":case"m":return u*e;case"seconds":case"second":case"secs":case"sec":case"s":return u*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return u;default:return}}}}function l(c){var f=Math.abs(c);return f>=r?Math.round(c/r)+"d":f>=t?Math.round(c/t)+"h":f>=e?Math.round(c/e)+"m":f>=n?Math.round(c/n)+"s":c+"ms"}function a(c){var f=Math.abs(c);return f>=r?p(c,f,r,"day"):f>=t?p(c,f,t,"hour"):f>=e?p(c,f,e,"minute"):f>=n?p(c,f,n,"second"):c+" ms"}function p(c,f,u,h){var g=f>=u*1.5;return Math.round(c/u)+" "+h+(g?"s":"")}return Me}function qn(n){t.debug=t,t.default=t,t.coerce=a,t.disable=s,t.enable=o,t.enabled=d,t.humanize=Wn(),t.destroy=p,Object.keys(n).forEach(c=>{t[c]=n[c]}),t.names=[],t.skips=[],t.formatters={};function e(c){let f=0;for(let u=0;u<c.length;u++)f=(f<<5)-f+c.charCodeAt(u),f|=0;return t.colors[Math.abs(f)%t.colors.length]}t.selectColor=e;function t(c){let f,u=null,h,g;function w(...C){if(!w.enabled)return;const y=w,E=Number(new Date),b=E-(f||E);y.diff=b,y.prev=f,y.curr=E,f=E,C[0]=t.coerce(C[0]),typeof C[0]!="string"&&C.unshift("%O");let A=0;C[0]=C[0].replace(/%([a-zA-Z%])/g,(x,_)=>{if(x==="%%")return"%";A++;const Z=t.formatters[_];if(typeof Z=="function"){const de=C[A];x=Z.call(y,de),C.splice(A,1),A--}return x}),t.formatArgs.call(y,C),(y.log||t.log).apply(y,C)}return w.namespace=c,w.useColors=t.useColors(),w.color=t.selectColor(c),w.extend=r,w.destroy=t.destroy,Object.defineProperty(w,"enabled",{enumerable:!0,configurable:!1,get:()=>u!==null?u:(h!==t.namespaces&&(h=t.namespaces,g=t.enabled(c)),g),set:C=>{u=C}}),typeof t.init=="function"&&t.init(w),w}function r(c,f){const u=t(this.namespace+(typeof f>"u"?":":f)+c);return u.log=this.log,u}function o(c){t.save(c),t.namespaces=c,t.names=[],t.skips=[];let f;const u=(typeof c=="string"?c:"").split(/[\s,]+/),h=u.length;for(f=0;f<h;f++)u[f]&&(c=u[f].replace(/\*/g,".*?"),c[0]==="-"?t.skips.push(new RegExp("^"+c.slice(1)+"$")):t.names.push(new RegExp("^"+c+"$")))}function s(){const c=[...t.names.map(l),...t.skips.map(l).map(f=>"-"+f)].join(",");return t.enable(""),c}function d(c){if(c[c.length-1]==="*")return!0;let f,u;for(f=0,u=t.skips.length;f<u;f++)if(t.skips[f].test(c))return!1;for(f=0,u=t.names.length;f<u;f++)if(t.names[f].test(c))return!0;return!1}function l(c){return c.toString().substring(2,c.toString().length-2).replace(/\.\*\?$/,"*")}function a(c){return c instanceof Error?c.stack||c.message:c}function p(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}var Gn=qn;(function(n,e){e.formatArgs=r,e.save=o,e.load=s,e.useColors=t,e.storage=d(),e.destroy=(()=>{let a=!1;return()=>{a||(a=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function t(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function r(a){if(a[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+a[0]+(this.useColors?"%c ":" ")+"+"+n.exports.humanize(this.diff),!this.useColors)return;const p="color: "+this.color;a.splice(1,0,p,"color: inherit");let c=0,f=0;a[0].replace(/%[a-zA-Z%]/g,u=>{u!=="%%"&&(c++,u==="%c"&&(f=c))}),a.splice(f,0,p)}e.log=console.debug||console.log||(()=>{});function o(a){try{a?e.storage.setItem("debug",a):e.storage.removeItem("debug")}catch{}}function s(){let a;try{a=e.storage.getItem("debug")}catch{}return!a&&typeof process<"u"&&"env"in process&&(a=process.env.DEBUG),a}function d(){try{return localStorage}catch{}}n.exports=Gn(e);const{formatters:l}=n.exports;l.j=function(a){try{return JSON.stringify(a)}catch(p){return"[UnexpectedJSONParseError]: "+p.message}}})(We,We.exports);var zn=We.exports;const kt=jn(zn);function Ot(n){return["eservices-core",n].join(":")}function Ft(n){return Je(n,"YYYY/MM/DD HH:mm:ss")}function Je(n,e="YYYY/MM/DD"){if(!n)return"";try{const t=new Date(n);return Mt.format(t,e)}catch(t){return console.log(t),"Invalid date"}}const Kn={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()=>i.h("i",{class:`icon icon-${t}`})}},Ie=V(Kn,[["__scopeId","data-v-e287c8d9"]]),Yn=kt(Ot("setup-list-row"));function Jn(n,e){const t=n.config.map(r=>Hn(r,n,e));return i.h("tr",{class:"widget-table__row widget-table-row"},t)}function Hn(n,e,t){const r=e.values;let o=Nt(n,r);const s={onClick:[],class:["widget-table__cell widget-table-cell"]};function d(c){s.onClick.push(()=>c(r))}function l(c){Array.isArray(c)?s.class.push(...c):s.class.push(c)}const a=[],p=[];if(n.hide&&n.hide(r))return[i.h("td")];if(n.type)switch(l(`widget-table-cell_${n.type}`),n.type){case"number":{typeof o=="number"&&(o=new Intl.NumberFormat().format(o));break}case"date":{o=Je(typeof o=="string"?o:null);break}case"dateTime":case"dateWithTime":{o=Ft(typeof o=="string"?o:null);break}case"money":{o=Pt(o);break}case"multi-select":{p.push(i.h(S.FormField,{type:"single-checkbox",modelValue:e.selected})),d(at.bind(null,t,!0));break}case"select":{p.push(i.h(S.FormField,{type:"single-radio",modelValue:e.selected})),d(at.bind(null,t,!1));break}}if(n.onClick&&d(n.onClick),n.link)try{const c=n.link(r);if(c){const f=i.h(ut.RouterLink,{to:c});p.push(f),l("widget-table-cell_link")}}catch(c){Yn("Can't add router link",c)}return n.href&&(p.push(i.h("a",{href:n.href(r),target:"_blank"})),l("widget-table-cell_link")),(typeof o=="string"||typeof o=="number")&&p.push(i.h("p",{class:"widget-list-cell-text"},o)),n.icon&&p.push(i.h(Ie,{name:n.icon})),n.class&&(typeof n.class=="function"?l(n.class(r)):l(n.class)),a.push(i.h("td",s,p)),a}function at(n,e){n.emit("select",e)}function It(n,e){return()=>{try{return Jn(n,e)}catch(t){return console.warn(t),null}}}const Xn={props:{values:Object,config:Object,selected:Boolean},setup:It},Zn=["colspan"],ct=i.defineComponent({__name:"widget-table-form",props:{rowLength:{},component:{},values:{},isNew:{type:Boolean}},emits:["save","close"],setup(n,{emit:e}){const t=i.ref();return i.onMounted(()=>{setTimeout(()=>{t.value&&t.value.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})},250)}),(r,o)=>(i.openBlock(),i.createElementBlock("tr",{class:"widget-table-form",ref_key:"refTableForm",ref:t},[i.createElementVNode("td",{colspan:r.rowLength},[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(r.component),i.mergeProps(r.$attrs,{values:r.values,new:r.isNew,onClose:o[0]||(o[0]=s=>e("close")),onSave:o[1]||(o[1]=s=>e("save",s))}),null,16,["values","new"]))],8,Zn)],512))}}),G={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"},Qn={class:"widget-table"},lt="update:selectedRows",er=i.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=i.useSlots(),o=i.computed(()=>{var l;return(l=r==null?void 0:r.default)==null?void 0:l.call(r)[0]});function s(l,a=!0){if(!t.selectedRows)return;if(!a)return e(lt,t.selectedRows.includes(l)?[]:[l]);const p=[...t.selectedRows],c=p.indexOf(l);return c===-1?p.push(l):p.splice(c,1),e(lt,p)}function d(l){e("save",l),e("update:activeRow",null)}return(l,a)=>(i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("table",Qn,[i.createVNode(Mn,{config:l.config},null,8,["config"]),i.createElementVNode("tbody",null,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.array,(p,c)=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:c},[i.createVNode(Xn,{config:l.config,values:p,selected:l.selectedRows.includes(p),onSelect:f=>s(p,f),class:i.normalizeClass(l.classCallback?l.classCallback(p):"")},null,8,["config","values","selected","onSelect","class"]),o.value&&l.activeRow===p?(i.openBlock(),i.createBlock(ct,{key:0,component:o.value,"row-length":l.config.length,values:p,onClose:a[0]||(a[0]=f=>e("update:activeRow",null)),onSave:d,"is-new":!1},null,8,["component","row-length","values"])):i.createCommentVNode("",!0)],64))),128)),l.activeRow===i.unref(G).LIST_ACTIVE_NEW?(i.openBlock(),i.createBlock(ct,{key:0,component:o.value,"row-length":l.config.length,onClose:a[1]||(a[1]=p=>e("update:activeRow",null)),onSave:d,"is-new":!0},null,8,["component","row-length"])):i.createCommentVNode("",!0)])])]))}}),tr=i.defineComponent({__name:"widget-spinner",props:{color:{default:"#fff"}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("div",{class:"widget-spinner",style:i.normalizeStyle({"border-left":`1.1em solid ${e.color}`})},null,4))}});const $e=V(tr,[["__scopeId","data-v-0ef9ae88"]]),nr={class:"widget-button"},rr=i.defineComponent({__name:"widget-button",props:{wait:{type:Boolean}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("button",nr,[e.wait?(i.openBlock(),i.createBlock($e,{key:0,class:"widget-button-spinner"})):i.createCommentVNode("",!0),i.renderSlot(e.$slots,"default",{},void 0,!0)]))}});const or=V(rr,[["__scopeId","data-v-450dc564"]]),ir={class:"widget-multi-button-wrap position_relative cursor_pointer"},sr={class:"widget-multi-button-body grid"},ar=["onClick"],cr={class:"widget-multi-button-side-wrap"},lr=i.defineComponent({__name:"widget-multi-button",props:{label:{},array:{default:()=>[]}},setup(n){const e=n;i.useCssVars(d=>({"7025434e":r.value}));const t=i.reactive({active:!1,wait:!1}),r=i.computed(()=>e.array.length+(e.label?1:0));function o(d){if(!(typeof d!="function"||t.wait))return t.wait=!0,Promise.resolve().then(d).finally(()=>{t.wait=!1})}function s(d=!t.active){t.active=d}return(d,l)=>(i.openBlock(),i.createElementBlock("div",ir,[i.createElementVNode("div",{class:i.normalizeClass(["overflow_hidden radius_20 widget-multi-button grid",t.active?"widget-multi-button_active":null])},[i.createElementVNode("div",sr,[d.label?(i.openBlock(),i.createElementBlock("p",{key:0,class:"text_md margin_0 text_nowrap widget-multi-button-body-label",onClick:l[0]||(l[0]=a=>s())},i.toDisplayString(d.label),1)):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(d.array,(a,p)=>(i.openBlock(),i.createElementBlock("p",{class:"text_md margin_0 text_nowrap widget-multi-button-body-label",key:p,onClick:c=>{o(a.callback),s(!1)}},i.toDisplayString(a.label),9,ar))),128))]),i.createElementVNode("div",cr,[i.createElementVNode("div",{class:i.normalizeClass(["grid-center widget-multi-button-side",t.active?"widget-multi-button-side_active":null]),onClick:l[1]||(l[1]=a=>s())},[t.wait?(i.openBlock(),i.createBlock(i.unref($e),{key:0,class:"widget-multi-button-side-spinner"})):d.array.length>1?(i.openBlock(),i.createBlock(i.unref(Ie),{key:1,class:"widget-multi-button-side-icon"},{default:i.withCtx(()=>[i.createTextVNode("angle-small-down")]),_:1})):i.createCommentVNode("",!0)],2)])],2)]))}});const ur=V(lr,[["__scopeId","data-v-a8d711d1"]]),dr={class:"widget-loader flex flex-align_center gap_10 padding_15"},fr={class:"text_md"},pr=i.defineComponent({__name:"widget-loader",props:{label:{}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("div",dr,[i.createVNode($e,{color:"var(--primary)",class:"padding_10"}),i.createElementVNode("span",fr,i.toDisplayString(e.label),1)]))}}),hr=["alt","src"],gr=i.defineComponent({__name:"widget-image",props:{src:{},alt:{},default:{}},setup(n){const e=n,t=i.ref();return i.onMounted(()=>{t.value&&(t.value.src=e.src),t.value.onerror=function(){e.default&&(t.value.src=e.default)}}),(r,o)=>(i.openBlock(),i.createElementBlock("img",{alt:r.alt,ref_key:"refImage",ref:t,src:r.src||r.$props.default},null,8,hr))}}),mr={props:{config:Array,values:Object,selected:Boolean},setup:It};const yr=V(mr,[["__scopeId","data-v-344a8cc1"]]),wr=n=>(i.pushScopeId("data-v-4e1d87c8"),n=n(),i.popScopeId(),n),Cr={class:"head-cell"},vr=wr(()=>i.createElementVNode("div",{class:"head-cell-resize"},null,-1)),Er=i.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,o)=>(i.openBlock(),i.createElementBlock("th",null,[i.createElementVNode("div",Cr,[i.createElementVNode("div",{class:"head-cell-content flex_grow",style:i.normalizeStyle({"min-width":r.minWidth,"max-width":r.maxWidth,width:r.width})},[r.type==="multi-select"?(i.openBlock(),i.createBlock(i.unref(S.FormField),{key:0,type:"single-checkbox",onClick:o[0]||(o[0]=i.withModifiers(s=>e("select"),["stop","prevent"]))})):(i.openBlock(),i.createElementBlock("p",{key:1,class:"widget-list-head-label head-cell-label list-head-cell-label text_md margin-0",onClick:o[1]||(o[1]=s=>e("order"))},i.toDisplayString(r.title||r.label),1))],4),r.name&&r.order.length&&r.order[0]===r.name?(i.openBlock(),i.createBlock(i.unref(Ie),{key:0,class:i.normalizeClass(["head-cell-order",{"head-cell-order_down":r.order.length>1&&r.order[1]==="desc"}])},{default:i.withCtx(()=>[i.createTextVNode("core-arrow-up")]),_:1},8,["class"])):i.createCommentVNode("",!0),vr])]))}});const _r=V(Er,[["__scopeId","data-v-4e1d87c8"]]),Sr=i.defineComponent({__name:"widget-list-head",props:{config:{},order:{}},emits:["update:config","update:order","select"],setup(n,{emit:e}){const t=n,r=i.ref(),o=i.ref();i.onMounted(()=>{function a(h,g){let w=-1;do w++,g-=h[w];while(g>0&&w<h.length);return w}function p(h,g){let w=0;for(;g>0&&g>h[w]&&w<h.length;)g-=h[w],w++;return console.log(g,w),w>0?w:0}function c(h){try{o.value.style.insetInlineStart=h+"px"}catch(g){console.log(g)}}function f(h){try{o.value.style.width=h+"px",o.value.style.minWidth=h+"px",o.value.style.maxWidth=h+"px"}catch(g){console.log(g)}}function u(h){return h===null?!1:h.classList.contains("head-cell-resize")}r.value.addEventListener("pointerdown",function(g){var Ze;function w(N){return N.screenX+E-$}const C=r.value,y=[...C.children].filter(N=>N.localName==="th"),E=((Ze=C.offsetParent)==null?void 0:Ze.scrollLeft)||0,b=y.map(N=>N.clientWidth),A=u(g.target),$=C.getBoundingClientRect().left,x=w(g),_=a(b,x),Z=b.slice(0,_).reduce((N,P)=>N+P,0),de=x-Z,Le=C.offsetWidth,Q=y[_].clientWidth;if(t.config[_].type==="multi-select")return;console.group("START"),console.log(),console.log("Start screenX",g.screenX),console.log("Widths",b),console.log("max width",Le),console.log("Start Position",x),console.log("Position From",_),console.log("Start Position",_),console.log("Global offset (Отступ самой таблицы от края экрана)",$),console.log("Del",de),console.groupEnd(),o.value.innerText=y[_].textContent||"",o.value.style.display="grid",o.value.style.width=Q+"px",o.value.style.cursor="grabbing",c(Z),f(Q),document.addEventListener("pointermove",Xe,{passive:!0}),document.addEventListener("pointerup",He);function He(N){if(console.group("END"),document.removeEventListener("pointermove",Xe),document.removeEventListener("pointerup",He),A&&(t.config[_].width=o.value.style.width,t.config[_].minWidth=o.value.style.width,t.config[_].maxWidth=o.value.style.width,s(t.config)),!A){const P=N.screenX+E-$;console.log("ENP Position",P);const fe=p(b,P);if(console.log(_,"->",fe),fe!==_){const ee=t.config[_],De=t.config;De.splice(_,1),De.splice(fe,0,ee),s(De)}else{const ee=t.config[_].name;d(ee)}}o.value.style.display="none",document.body.style.cursor="unset",console.groupEnd()}function Xe(N){if(A){const ee=w(N)-x+Q;f(ee);return}let P=N.screenX+E-$-de;P<0&&(P=0),P+Q>Le&&(P=Le-Q),c(P)}})});function s(a){e("update:config",a)}function d(a){if(!a)return;if(Array.isArray(a)){if(a.length<1)return;a=a[0]}if(t.order.length===0||t.order[0]!==a)return void l([a]);const p=t.order.length===1||t.order[1]==="asc"?"asc":"desc";l([a,p==="asc"?"desc":"asc"])}function l(a){e("update:order",a)}return(a,p)=>(i.openBlock(),i.createElementBlock("tr",{class:"widget-list-head",ref_key:"refHead",ref:r},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.config,(c,f)=>(i.openBlock(),i.createBlock(_r,i.mergeProps({key:c},c,{onOrder:u=>d(c.name),onSelect:p[0]||(p[0]=u=>e("select")),order:a.order}),null,16,["onOrder","order"]))),128)),i.createElementVNode("div",{class:"test-block text_md",ref_key:"refDisplayPosition",ref:o},"test",512)],512))}});const br=V(Sr,[["__scopeId","data-v-ccffc6bd"]]),Tr={class:"widget-list"},Ar={class:"widget-list-body position_relative"},Nr=50,kr=i.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(l,a=!0){if(t.selectedRows)if(!a)s(t.selectedRows.includes(l)?[]:[l]);else{const p=[...t.selectedRows],c=p.indexOf(l);c===-1?p.push(l):p==null||p.splice(c,1),s(p)}}function o(){var l;if(((l=t.selectedRows)==null?void 0:l.length)!==t.array.length)return s([...t.array]);s([])}function s(l){e("update:selectedRows",l)}function d(l){if(!l)return;const a=l.target;a.scrollTop+a.clientHeight+Nr>a.scrollHeight&&e("scrollEnd")}return(l,a)=>(i.openBlock(),i.createElementBlock("div",{class:"es-list-container",onScrollPassive:d},[i.createElementVNode("table",Tr,[i.createElementVNode("thead",null,[i.createVNode(br,{onSelect:a[0]||(a[0]=p=>o()),"onUpdate:order":a[1]||(a[1]=p=>e("update:order",p)),"onUpdate:config":a[2]||(a[2]=p=>e("update:config",p)),config:l.config,order:l.order},null,8,["config","order"])]),i.createElementVNode("tbody",Ar,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.array,(p,c)=>{var f;return i.openBlock(),i.createBlock(yr,{key:c,class:"widget-list-row",values:p,config:l.config,selected:(f=l.selectedRows)==null?void 0:f.includes(p),onSelect:u=>r(p,u)},null,8,["values","config","selected","onSelect"])}),128))])])],32))}});function Or(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=i.reactive({wait:!1,call:e});return t}function Te(n){return typeof n=="string"?Ue(n):Fr(n)?Ue(n.message):Ue(G.DEFAULT_ERROR_MESSAGE)}function Fr(n){return!!(typeof n=="object"&&n!==null&&Object.hasOwnProperty.call(n,"message"))}function Ue(n){return{message:n}}function le(n="error"){return function(e){const{message:t}=Te(e);Ae.add(n,t)}}function qe(n,e){return Pe().emit("entity:read",{...e,entity:n})}function $t(n,e){return Pe().emit("entity:update",{...e,entity:n})}function Ir(n){return n.reduce((e,t)=>(t.name&&(typeof t.name=="string"?e.push(t.name):e.push(...t.name)),e),[])}function Pt(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 Rt(n){return Object.keys(n).reduce((e,t)=>{let r=n[t];const o=t.charAt(0).toUpperCase()+t.slice(1);return typeof r=="object"&&!(r==null||Array.isArray(r))&&(r=Rt(r)),e[o]=r,e},{})}function $r(n,e){const t=new Map;return n.forEach(r=>{var s;const o=e(r);t.has(o)||t.set(o,[]),(s=t.get(o))==null||s.push(r)}),t}function Pr(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,n=>(n^crypto.getRandomValues(new Uint8Array(1))[0]&15>>n/4).toString(16))}function Rr(){const n=i.ref(null);function e(t){n.value=t}return{activeRow:n,activateRow:e}}const K=kt(Ot("use-socket"));function Pe(){return Lr}const Lr=function(){let n=1,e;const t=new Set,r=new Set;function o(){return{safeQueue:r,requestId:n,handlers:t}}function s(u){const h=[...t.values()];K("Handlers array length is %d. Response event: %s. Request id: %d",t.size,u.event,u.requestId),h.forEach(g=>{const w=u.requestId;(g.requestId&&g.requestId===w||!g.requestId&&g.event===u.event)&&(K("Find appropriated handler: %d, event: %s",n,g.event),g.callback(u.data,u),g.once&&(t.delete(g),K("Handler was removed by *once* params was passed. %o",g)))})}function d(u){console.log(`%cInitializing sockets: %c${u}`,"color: purple","color: black"),e=new WebSocket(u),e.onclose=function(h){K("Connection to server was stopped: %d %s",h.code,h.reason),setTimeout(()=>d(u))},e.onopen=function(){console.log("Socket was %cconnected.","color: green"),[...r.values()].forEach(h=>{l(h),r.delete(h)})},e.onerror=function(h){console.warn(h)},e.onmessage=h=>{try{const g=JSON.parse(h.data);if(!Lt(g)){console.warn("Data is %cnot correct %csocket answer.","color: red","color: black"),console.log(g);return}s(g)}catch(g){console.warn("Socket handle %conmessage%c error.","color: red","color: black"),console.log(g)}}}function l(u){e.send(u)}function a(u,h){t.add({event:u,callback:h})}function p(u,h){t.add({event:u,callback:h,once:!0})}function c(){return e&&(e==null?void 0:e.readyState)===1}function f(u,h,g){const w=++n,C=JSON.stringify({requestId:w,event:u,data:h,contextId:_e.contextId,url:window.location.href});return c()?l(C):(r.add(C),K("Socket is not connected. Message was send to save-queue. %s")),new Promise((y,E)=>{t.add({event:u,requestId:w,once:!0,callback:(b,A)=>{if(K("Promise was resolve with next data:",b),Dr(A))return void E(b);g&&g(b,A),y(b)}})})}return{get socket(){return e},on:a,once:p,emit:f,initialization:d,getDevInfo:o}}(),Dr=n=>!!Lt(n)&&n.event==="request-error",Lt=n=>!!n&&typeof n=="object"&&n!==null&&"event"in n&&typeof n.event=="string"&&"requestId"in n&&typeof n.requestId=="number"&&"data"in n;function xr(n,e){const t=i.reactive([]);let r=0;const o=i.ref(!1);function s(){if(o.value)return Promise.reject("The process has already started.");const u=c();return o.value=!0,typeof u.limit!="number"&&(u.limit=100),u.offset=r,qe(n,u).then(h=>(r+=h.length,h)).finally(()=>{o.value=!1})}function d(u,h){var w;const g=u.Version||((w=t.find(C=>C.Id===h))==null?void 0:w.Version);if(g===void 0)throw new Error("Object without version.");return g}function l(u,h){const g=t.findIndex(w=>w.Id===u);if(g===-1)throw new Error(`Can't found item with Id ${u}`);t.splice(g,1,h)}async function a(u,h){try{const g=c(),w=d(h,u);delete h.Version,await $t(n,{id:u,values:h,version:w});const C=await qe(n,{fields:g.fields||"",id:u});l(u,C)}catch(g){le()(g)}}async function p(){try{const u=await s();t.push(...u)}catch(u){le()(u)}}function c(){return typeof e=="function"?e():e}async function f(){try{r=0;const u=await s();t.splice(0,t.length,...u)}catch(u){le()(u)}}return{array:t,updateById:a,next:p,reload:f,wait:o}}function Br(){function n(){return{organizations:W.organizations,currentContextId:W.contextId,person:W.person,context:W.context,contextType:W.contextType}}const e=i.reactive(n());return W.onupdateContext(()=>{Object.assign(e,n())}),e}const Ae=new class{constructor(){this.store=i.reactive([])}add(e,t,r={}){const o=Vr(r),s=new Mr(e,t,o.timeout,o.children,o.click);return this.store.push(s),r.timeout&&setTimeout(this.remove.bind(this,s.id),r.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 Vr(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 Dt=class xt{constructor(e,t,r,o,s){this.type=e,this.message=t,this.timeout=r,this.children=o,this.click=s,this.id=xt.cardId++}};Dt.cardId=1;let Mr=Dt;function Ur(){return Pe().emit("client:read",{})}var Bt=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},jr=(n,e,t)=>(Bt(n,e,"read from private field"),t?t.call(n):e.get(n)),Wr=(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)},qr=(n,e,t,r)=>(Bt(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),Ee;const Re=class Y extends O{constructor(){super(...arguments),this.type="front",this.organizations=[],Wr(this,Ee,!1)}set language(e){localStorage.setItem(G.LOCALSTORAGE_LANGUAGE_KEY,e)}get language(){return localStorage.getItem(G.LOCALSTORAGE_LANGUAGE_KEY)||Y.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){qr(this,Ee,e),this.emit(Y.EVENT_READY_UPDATE,e)}get ready(){return jr(this,Ee)}onReady(e){return this.on(Y.EVENT_READY_UPDATE,e)}onupdateContext(e){return this.on(Y.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(G.LOCALSTORAGE_CURRENT_CONTEXT_KEY,String(e)),this.emit(Y.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.restoreCurrentContext(),this.ready=!0}catch(e){le()(e)}}restoreCurrentContext(){const e=Number.parseInt(localStorage.getItem(G.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 Ur()}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;Re.DEFAULT_LANGUAGE="en";Re.EVENT_CONTEXT_UPDATE="event:context-update";Re.EVENT_READY_UPDATE="event:ready-update";let Gr=Re;function zr(n){return typeof n!="object"||n===null?!1:!!(n.hasOwnProperty("start")||n.hasOwnProperty("end"))}function I(n){return Object.keys(n).reduce((e,t)=>{const r=n[t];if(Array.isArray(r)){const o=r.map(s=>typeof s=="string"?`'${s}'`:s).join(", ");return r.length&&e.push(`@${t} in (${o})`),e}if(zr(r)){let o=function(s){var d;return((d=s.match(/([^Z]*)/))==null?void 0:d[0])+"0000Z"};return r.start&&e.push(`@${t} ge ${o(r.start)}`),r.end&&e.push(`@${t} le ${o(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(I.is(t,r)),e)},[]).join(" and ")}function ue(n){return typeof n=="string"?`'${n}'`:`${n}`}I.includes=function(e,t){return`@${e} Contains ${ue(t)}`};I.beginWith=function(e,t){return`@${e} BeginWith ${ue(t)}`};I.notEq=function(e,t){return`@${e} nq ${ue(t)}`};I.eq=function(e,t){return Array.isArray(t)?I.in(e,t):`@${e} eq ${ue(t)}`};I.in=function(e,t){const r=t.map(ue).join(", ");return`@${e} in (${r})`};I.and=function(...e){return e.join(" and ")};I.is=function(e,t){return`@${e} is ${t}`};I.or=function(...e){return e.join(" or ")};const W=new Gr,Kr={clickOutside:ke,staticLink:yn,Request:m},Yr={usage:qt,utils:Xt,config:Zt,types:Qt};exports.Communication=gn;exports.ComputedMetadata=rn;exports.CoreError=F;exports.Filter=I;exports.Manager=W;exports.MetadataStore=ne;exports.NotificationSystem=Ae;exports.Request=m;exports.WidgetButton=or;exports.WidgetIcon=Ie;exports.WidgetImage=gr;exports.WidgetList=kr;exports.WidgetLoader=pr;exports.WidgetMultiButton=ur;exports.WidgetSpinner=$e;exports.WidgetTable=er;exports.actionService=Tt;exports.asyncProcess=Or;exports.authService=T;exports.billingService=J;exports.catchUniversal=le;exports.clickOutside=ke;exports.clientService=gt;exports.communicationService=ce;exports.configurationService=An;exports.constants=G;exports.dataService=D;exports.debounce=wn;exports.default=Yr;exports.documentsService=Tn;exports.equipmentService=Dn;exports.fileService=fn;exports.getCellValue=Nt;exports.getNamesFromListConfig=Ir;exports.groupArrayByField=$r;exports.historyService=tn;exports.internationalizationService=sn;exports.invitationService=pn;exports.metadataService=ze;exports.openService=hn;exports.parseError=Te;exports.prettifyValueByMetadata=on;exports.prettyDate=Je;exports.prettyDateWithTime=Ft;exports.prettyMoney=Pt;exports.processWizardService=ye;exports.ruleValidationService=Ke;exports.t=X;exports.testTypes=en;exports.universalEntityRead=qe;exports.universalEntityUpdate=$t;exports.useCommunication=mn;exports.useFormAction=En;exports.useFormLabel=_n;exports.useFormMetadata=Cn;exports.useFormRequest=bn;exports.useFormRequestData=Sn;exports.useListActiveRow=Rr;exports.useListEntity=xr;exports.useListSearch=Nn;exports.useListSelect=On;exports.useLogger=_t;exports.useManagerState=Br;exports.useSocket=Pe;exports.useWizard=Pn;exports.utils=Kr;exports.uuidv4=Pr;exports.valuesToUpperCase=Rt;exports.viewService=dn;
|
|
10
|
+
*/const et=function(n,e){return n in this.events||(this.events[n]=[]),this.events[n].push(e),this.off.bind(this,n,e)},tt=function(n,e){n in this.events&&this.events[n].forEach(t=>t(e))},nt=function(n,e){const t=this.events[n];if(!t)return;const r=t.indexOf(e);r!==-1&&t.splice(r,1)},rt=function(){this.events={}};class O{constructor(){this.events={}}on(e,t){return et.call(this,e,t)}emit(e,t){return tt.call(this,e,t)}off(e,t){return nt.call(this,e,t)}cleanEvents(){rt.call(this)}static on(e,t){return et.call(O,e,t)}static emit(e,t){return tt.call(O,e,t)}static off(e,t){return nt.call(O,e,t)}static cleanEvents(){rt.call(O)}}O.events={};var wt=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},pe=(n,e,t)=>(wt(n,e,"read from private field"),t?t.call(n):e.get(n)),xe=(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)},Be=(n,e,t,r)=>(wt(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),te,he,ge;const z=class k extends O{constructor(){super(...arguments),xe(this,te,void 0),xe(this,he,"front"),this.organizations=[],xe(this,ge,!1)}set language(e){localStorage.setItem(k.LOCALSTORAGE_LANGUAGE_KEY,e)}get language(){return localStorage.getItem(k.LOCALSTORAGE_LANGUAGE_KEY)||k.DEFAULT_LANGUAGE}checkLanguageInStorage(){return!!localStorage.getItem(k.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){Be(this,te,e)}get router(){if(!pe(this,te))throw new Error("Router was not founded. Please set router: Manager.router = router: VueRouter");return pe(this,te)}set type(e){Be(this,he,e)}get type(){return pe(this,he)}get isBack(){return this.type==="back"}get isFront(){return this.type==="front"}set ready(e){Be(this,ge,e),this.emit(k.EVENT_READY_UPDATE,e)}get ready(){return pe(this,ge)}onReady(e){return this.on(k.EVENT_READY_UPDATE,e)}onupdateContext(e){return this.on(k.EVENT_CONTEXT_UPDATE,e)}onupdateData(e){return this.on(k.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(k.CURRENT_CONTEXT_KEY,String(e)),this.emit(k.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(k.CURRENT_CONTEXT_KEY)||"");!Number.isNaN(t)&&this.validateContextId(Number(t))?this.setCurrentContext(t):this.setCurrentContext(Number(e.id))}catch{H.add("error",F.ApiNotAvailable().message)}}loadCustomerData(){return gt.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))}};te=new WeakMap;he=new WeakMap;ge=new WeakMap;z.DEFAULT_LANGUAGE="en";z.LOCALSTORAGE_LANGUAGE_KEY="CurrentLanguage";z.EVENT_CONTEXT_UPDATE="event:context-update";z.EVENT_READY_UPDATE="event:ready-update";z.EVENT_DATA_UPDATE="event:data-update";z.CURRENT_CONTEXT_KEY="CurrentContext";let Kt=z;const Ue=new Kt;function Yt(n){return n.text().then(e=>{try{return JSON.parse(e)}catch{return ht}})}function m(n,e={}){return Ue.isFront&&(e.headers||(e.headers={}),e.headers["Context-Id"]=Ue.contextId),e.redirect="manual",fetch(n,e).then(t=>t.type==="opaqueredirect"?void window.location.replace("/auth"):t).catch(()=>{throw F.ApiNotAvailable()}).then(t=>Yt(t).then(r=>{if(!t.ok)throw r;return r}))}class ke{constructor(){}static parseNamesFromListConfig(e){let t=ke.parseFieldsToGraphQL(e.reduce((o,s)=>(s.name&&o.push(s.name),o),[]));function r(o){let s="";for(let d in o)typeof o[d]=="boolean"?s+=` ${d} `:s+=` ${d} { ${r(o[d])} }`;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,o){if(o.includes(".")){const s=o.indexOf("."),d=o.substring(s+1),l=o.substring(0,s);l in r||(r[l]={}),t(r[l],d)}else r[o]=!0;return r}return e.reduce(t,{})}}class Jt{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 Ct=new Jt;function vt(n){return n&&n[0].toLowerCase()+n.slice(1)}function Ge(n){return Object.keys(n).reduce((e,t)=>{let r=n[t];const o=t.charAt(0).toUpperCase()+t.slice(1);return typeof r=="object"&&!(r==null||Array.isArray(r))&&(r=Ge(r)),e[o]=r,e},{})}function Ht(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 ae={Request:m,clickOutside:Ne,getPropFromObject:Ae,runPromiseQueue:ft,GraphQL:ke,firstChapterToLowerCase:vt,valuesToUpperCase:Ge,prettyMoney:Ht},Xt=Object.freeze(Object.defineProperty({__proto__:null,GraphQL:ke,Journal:Ct,Request:m,clickOutside:Ne,default:ae,firstChapterToLowerCase:vt,getPropFromObject:Ae,runPromiseQueue:ft,valuesToUpperCase:Ge},Symbol.toStringTag,{value:"Module"}));function Et(n,e=""){for(let t in n){if(typeof n[t]=="object"){Et(n[t],(e.length?`${e}-`:"")+t);continue}let r="--"+((e.length?`${e}-`:"")+t).replace(/([A-Z])/g,o=>`-${o}`.toLowerCase());document.documentElement.style.setProperty(r,n[t])}}const B={};function Zt(n){for(let e in n)B[e]=n[e];n.styles&&Et(n.styles),Ct.welcome(),console.log("The config has been initialized. To get access check %c_config in console.","background: purple; color: white"),window._config=B}const Qt=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));const en=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));class tn{static readHistoryById(e,t){return m(`/close-api/audits/history/${e}/${t}`,{method:"GET",headers:{"Content-Type":"application/json"}}).then(r=>{const o=r.history.map(s=>{if(!s.changes)return s;const d=s.changes.map(l=>({...l,oldValue:l.originalValue,name:l.fieldName}));return{...s,changes:d}});return{...r,history:o}})}}class nn extends O{constructor(){super(),this.EVENT_NEW="event:new-metadata",this.store={}}get(e){return this.store[e]}async load(e){return this.store[e]||this.set(e,await this.loadEntityInformation(e)),this.store[e]}set(e,t){this.store[e]=t,this.emit(this.EVENT_NEW,{entityName:e})}async loadEntityInformation(e){return await ze.get(e)}}const ne=new nn;function rn(n){const e=i.ref(ne.get(n));return ne.on(ne.EVENT_NEW,t=>{n===t.entityName&&(e.value=ne.get(n))}),e}function on(n,e){try{return e.dataType==="DateTime"&&typeof n=="string"?new Date(n).toLocaleString():n}catch(t){_t().error("prettify value by metadata",n,t)}}class sn{static getDictionary(e){if(!e)throw new Error(`Can't get dictionary for ${e}.`);return m(`/open-api/internationalization/language/${e}`)}}let q={};function X(n,...e){if(typeof n!="string")return console.trace(`Label is not provided for translation: ${n}`),"undefined";let t=S.utils.getPropFromObject((this==null?void 0:this.vocabulary)||q,n);if(typeof t=="string")return ot(t,e);const r=S.utils.getPropFromObject(q==null?void 0:q.root,n);return typeof r=="string"?ot(r,e):(typeof t===void 0&&console.warn(`Translation for label "${n}" is not founded.`),n)}function ot(n,e){return e.forEach((t,r)=>{n=n.replaceAll(new RegExp(`\\{${r}}`,"g"),t)}),n}X.setGlobalVocabulary=function(n){q=n};X.getScope=function(n){const e=typeof n=="string"?n:"root";return typeof n!="string"&&console.warn(`SCOPE ${n} for translate is not string.`),X.bind({vocabulary:S.utils.getPropFromObject(q,e.toLowerCase())})};X.setVocabulary=function(n){return typeof n=="string"&&(n=S.utils.getPropFromObject(q,n)),X.bind({vocabulary:n})};const an=function(){let n=!1;const e=[];function t(){return n}function r(a,p){t()&&console[a](...p),e.push(p)}function o(...a){r("log",a)}function s(...a){r("warn",a)}function d(...a){r("error",a)}function l(a=!0){n=a}return{info:o,warn:s,history:e,display:l,error:d}}();function _t(){return an}class T{static parseError(e){let t=e.errors?Object.values(e.errors).map(r=>r[0]):null;throw F.AuthServiceError(e.title,t)}static login(e){return m(B.identityServerURL+"/api/Authenticate/Login",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({...e,AppName:B.applicationName})}).catch(T.parseError)}static registration(e){return e.AppName=B.applicationName,m(B.identityServerURL+"/api/Authenticate/Registration",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(e)}).catch(T.parseError)}static parseProcessAnswer(e){if(e.statusCode>4)throw F.UndefinedError(e.statusName.replace(/([A-Z][a-z])/g," $1").replace(/(\d)/g," $1"));return e}static startRegistrationProcess(e){return T.requestStepRegistrationProcess("StartRegistration",e)}static confirmPhoneRegistrationProcess(e){return T.requestStepRegistrationProcess("ConfirmPhoneNumberByRegistration",e)}static confirmEmailRegistrationProcess(e){return T.requestStepRegistrationProcess("ConfirmEmailByRegistration",e)}static finishEmailRegistrationProcess(e){return T.requestStepRegistrationProcess("FinishRegistration",e)}static requestStepRegistrationProcess(e,t){return m(`${B.identityServerURL}/api/Authenticate/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(t)}).catch(T.parseError)}static startLoginProcess(e){return T.requestStepLoginProcess("StartLogin",e)}static loginWithPassword(e){return T.requestStepLoginProcess("LoginWithPassword",e)}static loginWithOtpCode(e){return T.requestStepLoginProcess("LoginWithOtpCode",e)}static requestStepLoginProcess(e,t){return m(`${B.identityServerURL}/api/Authenticate/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(t)}).catch(T.parseError).then(T.parseLoginProcessAnswer)}static parseLoginProcessAnswer(e){if(e.statusCode>3)throw F.UndefinedError(e.statusName.replace(/([A-Z][a-z])/g," $1").replace(/(\d)/g," $1"));return e}}function cn(n){return Array.isArray(n)&&n.length===2&&typeof n[0]=="string"&&typeof n[1]=="number"}const ln="masterId",un="masterEntity";function _e(n,e){if(!Array.isArray(e))return;if(cn(e))return t(e);e.forEach(t);function t(r){n.append(un,r[0]),n.append(ln,r[1].toString())}}class D{static async anonymousGetList(e){return await m(`/open-api/data/${e}`,{method:"GET",headers:{"Content-Type":"application/json"}})}static getSearchParamsForEntityListRead(e){const t=(o,s)=>r.append(o,s),r=new URLSearchParams;if(e.fields){const o=e.fields;typeof o=="string"?t("fields",o):Array.isArray(o)?t("fields",o.join(" ")):typeof o=="object"&&t("fields",Object.keys(o).join(" "))}if(e.order){let o=e.order;const d=(Array.isArray(o)?[o]:Object.entries(o)).map(([l,a="desc"])=>`@${l} ${a}`).join(",");t("order",d)}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=D.getSearchParamsForEntityListRead(t||{});return await m(`/close-api/data/${e}?${r.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"}})}static getCount(e,t){const r=D.getSearchParamsForEntityListRead(t||{});return m(`/close-api/data/entities/${e}/count?${r.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"}})}static create(e,t,r){const o=new URLSearchParams;return _e(o,r==null?void 0:r.masterEntities),m(`/close-api/data/${e}?${o.toString()}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({values:t})})}static update(e,t,r,o={}){return m(`/close-api/data/entities/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({values:r})})}static readById(e,t,r={}){const o=new URLSearchParams;if(r.fields){let s=r.fields;typeof s=="string"&&(s=[s]),o.append("fields",s.join(" "))}return m(`/close-api/data/entities/${e}/id/${t}?${o.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"}})}static updateById(e,t,r,o){const s=new URLSearchParams;return _e(s,o==null?void 0:o.masterEntities),m(`/close-api/data/entities/${e}/id/${t}?${s.toString()}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({values:r,version:o==null?void 0:o.version})})}static removeById(e,t,r){const o=typeof t=="number"?{Id:t}:t;return D.removeByKeys(e,o,r)}static removeByKeys(e,t,r){return m(`/close-api/data/entities/${e}`,{method:"delete",headers:{"Content-Type":"application/json"},body:JSON.stringify({keys:t,version:r})})}}const St=class re{static async create(e){return m(re.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 m(re.url+"?"+t.toString(),{method:"get"})}static async readMessages(e){return m(`${re.url}/${e}/messages`,{method:"get"})}static async createMessage(e){return m(`${re.url}/${e.talkId}/messages`,{method:"post",body:JSON.stringify({text:e.text}),headers:{"Content-Type":"application/json"}})}};St.url="/close-api/communications";let ce=St;class dn{static async getDefaultView(e){return m("/close-api/views/"+e,{method:"GET",headers:{"Content-Type":"application/json"}})}}function it(n){return{...n,createdEntities:n.createdEntites}}const bt=class me{static async getStartConfig(e,t){return m([me.url,e,t].join("/"),{method:"GET",headers:{"Content-Type":"application/json"}})}static async startProcess(e,t){return m([me.url,e,t].join("/"),{method:"POST",headers:{"Content-Type":"application/json"}}).then(it)}static async runStep(e,t,r,o,s){return m([me.url,e,t].join("/"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({stepName:r,token:o,values:s})}).then(it)}};bt.url="/close-api/views/process-wizard";let ye=bt;class ze{static get url(){return"/close-api/metadata"}static async get(e,t,r){console.warn("GETTING METADATA BY DEPRECATED METHOD."),console.trace();const o=new URLSearchParams;return t&&o.append("criteria",t),r&&o.append("id",String(r)),await fetch(this.url+`/${e}?${o.toString()}`,{method:"GET"}).then(s=>s.json())}static getById(e,t,r=[]){const o=new URLSearchParams;return _e(o,r),t&&o.append("id",t),m([this.url,e].join("/")+`?${o.toString()}`)}static getFieldInformation(e,t){return m(`/open-api/metadata/${e}/fields/${t}`)}static getTreatmentListField(e,t){return m(`/open-api/metadata/${e}/list-fields/${t}`)}}class fn{static async upload(e,t){const r=new FormData;r.append("file",e);const o=`/close-api/files?entityName=${t}`;return await fetch(o,{method:"POST",body:r}).then(s=>s.json()).then(s=>(s.filename=e.name,s))}}class pn{static invite(e,t,r){return m("/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 m("/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 m("/close-api/accounts/markInvite",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({invitationId:e,version:t,mark:!1})})}}class Ke{static get url(){return"/close-api/rules-validation/"}static validate(e,t){return m(Ke.url+e,{method:"POST",body:JSON.stringify(t)})}}class hn{static getConfiguration(){return m("/open-api/webserver-configuration",{method:"GET",headers:{"Content-Type":"application/json"}})}}class Tt{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 o=new URLSearchParams;return _e(o,r),m([this.url(),e,t].join("/")+`?${o.toString()}`,{method:"GET"})}}class gn extends O{constructor(e){super(),this.name="Communication",this.read=()=>{},this.id=e}sendMessage(e){return ce.createMessage({talkId:this.id,text:e})}static checkAndGenerate(e){return ce.read(e).then(t=>t.length===0?ce.create(e):t[0])}}function mn(n){const e=S.Form.getParentForm();e?e.subscribe(n):console.warn(F.ParentFormNotFound());const t=i.reactive([]);return n.read=()=>ce.readMessages(n.id).then(r=>(t.splice(0,t.length,...r),r)),{array:t}}function yn(n,e="images"){return`/static-folder/${e}/${n}`}function wn(n,e=1e3){let t=0;return(...r)=>{clearTimeout(t),t=setTimeout(()=>n(...r),e)}}function Cn(n,e){const t=i.ref(null);function r(){return n.name?ze.getById(n.name,e,[]).then(o=>{t.value=o,o.fields.forEach(s=>{s.canSet?n.enable(s.name):n.disable(s.name)})}).catch(()=>{t.value=null;const o=F.MetadataEntityIsNotAvailable(n.name||"FORM_WITHOUT_NAME");H.add("error",o.message)}):Promise.reject()}return n.on(S.Form.EVENT_READ,r),{metadata:t,update:r}}class Ye extends Error{static UndefinedStatus(){return new Ye("Status is undefined.")}}class vn extends Ye{}function En(n,e){const t=i.reactive([]);async function r(s,d){if(!s)throw vn.UndefinedStatus();const l=await Tt.get({criterion:s});t.splice(0,t.length),t.push(...l.map(a=>o(a,d)))}return{actions:t,update:r};function o(s,d){return{title:s.title,callback:()=>(()=>Promise.resolve().then(()=>{if(n.changed)return n.save()}).then(()=>fetch(s.url,{method:"POST",body:JSON.stringify({keys:{Id:d},contextId:Ue.contextId}),headers:{"Content-Type":"application/json"}})).then(a=>a.json()).then(a=>{if(!a.success)throw e!=null&&e.ModalValidationResult&&a.validationEffect?Vt.openModal(e.ModalValidationResult,{rules:a.validationEffect.results}):H.add("error",a.message),new Error;return a}).then(a=>{a.message&&H.add("info",a.message),e!=null&&e.handleAffectedEntities&&e.handleAffectedEntities(a.affectedEntities)}).then(()=>n.read()))()}}}class Se{static url(){return"/close-api/presentation"}static getStatuses(e,t){return fetch(`${Se.url()}/status/${e}/${t}`).then(r=>r.json())}}function _n(n){const e=i.reactive({title:"Loading",type:"wait"});function t(r){if(n.name&&Number.isInteger(r))return Se.getStatuses(n.name,r).then(o=>{e.type=o.type,e.title=o.name})}return n.on(S.Form.EVENT_READ,r=>{var d,l;const{code:o,name:s}={code:(d=r.Status)==null?void 0:d.Code,name:(l=r.Status)==null?void 0:l.Name};return n.name?!Number.isInteger(o)&&!s?void console.log("Undefined code or name is Status prop."):Se.getStatuses(n.name,o).then(a=>{e.type=a.type,e.title=s}):void console.log("Form without name.")}),{label:e,update:t}}function Sn(n,e){const t=ut.useRoute(),r=i.computed(()=>Number(t.params.id)),o=i.reactive({ready:!1,show:!1});return i.watch(()=>r.value,()=>{o.ready=!1}),i.watch(()=>r.value,()=>{Number.isInteger(r.value)&&n.read()},{immediate:!0}),n.read=ae.requestHandler.bind(null,()=>Promise.resolve().then(()=>{if(!n.name)throw new Error("Form without entity name. Please set form.name");return D.readById(n.name,r.value,{fields:e.fields})}).then(ae.valuesToUpperCase).then(s=>(Number.isInteger(s.Version)&&(n.version=s.Version),n.setValues(s),o.show=!0,s)).catch(s=>{throw Object.prototype.hasOwnProperty.call(s,"status")&&[403,404].includes(s.status)&&(o.show=!1),s}).finally(()=>{o.ready=!0})),n.save=ae.requestHandler.bind(null,()=>Promise.resolve().then(()=>{if(!n.name)throw new Error("Form without entity name. Please set form.name");return D.updateById(n.name,r.value,n.changes,{version:n.version})}).then(s=>{n.version=s.version})),n.on(S.Form.EVENT_SAVE,n.read.bind(n)),{formShadowState:o}}function bn(n,e){const t=i.reactive({ready:!1,show:!1});function r(){t.ready=!1,t.show=!1}return n.read=()=>{let o=e();return Promise.resolve().then(()=>{if(!n.name)throw F.EntityWithoutName("Use Form Request");return D.readById(n.name,o.id,{fields:o.fields})}).then(ae.valuesToUpperCase).then(s=>(s.hasOwnProperty("Version")&&(n.version=Number(s.Version)),n.setValues(s),t.show=!0,s)).catch(s=>{const d=Qe(s);throw H.add("error",d.message),d}).finally(()=>{t.ready=!0})},n.save=()=>{let o=e();return Promise.resolve().then(()=>{if(!n.name)throw F.EntityWithoutName("Use Form Request");return D.updateById(n.name,o.id,n.changes,{version:n.version})}).then(s=>{n.version=s.version||s.Version}).catch(s=>{const d=Qe(s);throw H.add("error",d.message),d})},n.on(S.Form.EVENT_SAVE,n.read.bind(n)),{shadowFormState:t,initShadow:r}}class Tn{static getRequiredDocuments(e,t,r){const o=new URLSearchParams({entity:e,primaryKey:t,statusCode:r});return fetch(`/close-api/views/required-documents?${o.toString()}`).then(s=>s.json())}}class J{static url(){return"close-api/billing"}static getBillingMetadata(e){return fetch(`/${J.url()}/calculator/${e}`)}static calculate(e,t){return m(`/${J.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]):F.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 m(`/${J.url()}/online-payment`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paymentId:e,returnURL:t})})}static applyOnlinePayment(e){return m(`/${J.url()}/online-payment`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({response:e})})}}class An{static getListSettings(e,t){const r=new URLSearchParams;r.set("entity",e),t&&r.set("mark",t);const o=`/close-api/views/list/configs?${r.toString()}`;return m(o)}}var At=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},R=(n,e,t)=>(At(n,e,"read from private field"),t?t.call(n):e.get(n)),U=(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)},j=(n,e,t,r)=>(At(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),we,oe,Ce,ve,ie,se,je;const W="_______LIST_______ROW_______INDEX________NAME_______",Oe=class L extends O{constructor(e){super(),this.LIST_ROW_KEY=1,U(this,we,void 0),this.array=[],U(this,oe,[]),U(this,Ce,[]),U(this,ve,new Proxy({},{set:(t,r,o,s)=>(t[r]=o,this.emit(L.EVENT_FILTERS_UPDATE,t),!0),deleteProperty:(t,r)=>(delete t[r],this.emit(L.EVENT_FILTERS_UPDATE,t),!0)})),U(this,ie,!1),U(this,se,(...t)=>Promise),U(this,je,()=>{}),j(this,we,e.primaryKeys||[]),this.name=e.name||void 0,e.config&&j(this,oe,e.config)}set config(e){j(this,oe,e.map(S.utils.copyObject)),this.emitUpdateConfig()}get config(){return R(this,oe)}emitUpdateConfig(){this.emit(L.EVENT_CONFIG_UPDATE,this.config)}get order(){return R(this,Ce)}set order(e){j(this,Ce,e),this.emit(L.EVENT_ORDER_UPDATE,this.order)}get filters(){return R(this,ve)}set filters(e){kn(R(this,ve),e)}set wait(e){j(this,ie,e),this.emit(S.Form.EVENT_WAIT,R(this,ie))}get wait(){return R(this,ie)}get primaryKeys(){return R(this,we)}at(e){return this.array[e%this.array.length]}atByKey(e){return this.array.find(t=>t[W]===e)}indexByKey(e){return this.array.findIndex(t=>t[W]===e)}static getKey(e){return e[W]}static hasKey(e){return typeof e!="object"||e===null?!1:Object.prototype.hasOwnProperty.call(e,W)}add(...e){const t=this.wrapArray(e);this.array.push(...t),this.emit(L.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(L.EVENT_DATA,this.array))}updateByKey(e,t){const r=this.atByKey(e);r&&(Object.assign(r,t),this.emit(L.EVENT_DATA,this.array))}wrapArray(e){return e.map(this.wrapItem.bind(this))}wrapItem(e){return this.isWrapped(e)?e:{...e,[W]:this.LIST_ROW_KEY++}}isWrapped(e){return Object.prototype.hasOwnProperty.call(e,W)}set read(e){j(this,se,e)}get read(){return(...e)=>Promise.resolve().then(()=>{const t=R(this,se).call(this,...e);return this.wait=!0,t}).finally(()=>this.wait=!1)}set save(e){j(this,se,e)}get save(){return()=>Promise.resolve().then(()=>this.wait=!0).then(()=>R(this,je).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,[W]: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=L.getCellName(e),o=(()=>{let s=r?Ae(t,r):null;return s===void 0&&(s=null),e.value?e.value(s,t):s})();return{name:r,value:o}}};we=new WeakMap;oe=new WeakMap;Ce=new WeakMap;ve=new WeakMap;ie=new WeakMap;se=new WeakMap;je=new WeakMap;Oe.EVENT_DATA="list-data: update";Oe.EVENT_CONFIG_UPDATE="list-config:update";Oe.EVENT_ORDER_UPDATE="list-order:update";Oe.EVENT_FILTERS_UPDATE="list-filters:update";function Nn(n){const e=i.ref(""),t=i.computed(()=>{const r=e.value.toLowerCase();return i.unref(n).filter(o=>e.value.length?Object.values(o).join().toLowerCase().includes(r):!0)});return{search:e,searchArray:t}}function kn(n,e){Object.keys(n).forEach(t=>delete n[t]),Object.entries(e).forEach(([t,r])=>{n[t]=r})}function On(n){const e=i.reactive([]);function t(l){return e.includes(l)}function r(l){t(l)||e.push(l)}function o(l){const a=e.findIndex(p=>p===l);a!==-1&&e.splice(a,1)}function s(l){const a=i.unref(n);if(l===void 0){e.length===0?a.forEach(r):a.forEach(o);return}t(l)?o(l):r(l)}const d=i.computed(()=>{const l=i.unref(n);return e.length===l.length&&l.length!==0});return[e,s,d,r,o]}function Fn(n){return n.statusName==="Completed"}function In(n){return n.statusName==="FinalStepWithConfirmation"}function $n(n){return n.statusName==="ValidationError"}function Pn(n,e,t){let r=null;const o=i.reactive({wait:null});let s=[],d=null;const l=i.ref(null);function a(){l.value=s.find(y=>y.name===d)||null}function p(){var y;return d?((y=s.find(E=>E.name===d))==null?void 0:y.fields)||[]:[]}function c(y){if(a(),$n(y))return void t.onValidation(y.validationResults);if((y.statusName==="FinalStep"||y.statusName==="NextStep")&&(!p().length||Rn(p(),t.presets)))return C(t.presets||{});Fn(y)&&t.onCompleted(y),In(y)&&t.onConfirmation(y)}async function f(){try{await u(),await w()}catch(y){const{message:E}=be(y);Te.add("error",E)}}function u(){return o.wait="Loading process information.",ye.getStartConfig(e,n).then(y=>{s=y.steps.map(E=>({label:E.title,name:E.stepName,number:E.number,fields:E.frontendEntity.objectTypes.reduce((b,A)=>(A.properties.forEach($=>{b.push({name:$.name,label:$.title,type:$.refEntityName||$.dataType})}),b),[])}))}).then(y=>(o.wait=!1,y))}function h(y){return d=y.nextStepName,r=y.token,y}function g(y){const E=be(y);Te.add("error",E.message)}function w(){return o.wait="Starting process",ye.startProcess(e,n).then(h).then(c).catch(g).finally(()=>{o.wait=null})}function C(y={}){return!r||!d?Promise.reject("Not step or token."):(o.wait="Expect the result",ye.runStep(e,n,d,r,y).then(h).then(c).catch(g).finally(()=>{o.wait=!1}))}return{initialize:f,state:o,currentStepConfig:i.readonly(l),next:C}}function Rn(n,e){for(let t=0;t<n.length;t++){const r=n[t];if(!S.utils.getPropFromObject(e,r.name))return!1}return!0}const Ln="close-api/proxy/Equipment/Search";class Dn{static search(e,t,r,o,s){const d=new URLSearchParams;d.append("pattern",e||""),t&&d.append("categoryId",t),r&&d.append("useType",String(r)),o&&d.append("statusCode",o),s&&(d.append("limit",String(s.limit)),d.append("offset",String(s.offset)));const l=`/${Ln}?${d.toString()}`;return m(l,{method:"GET",headers:{"Content-Type":"application/json"}})}}const xn={class:"widget-table__head"},Bn={class:"widget-table__head-label margin_0 text_overflow"},Vn=i.defineComponent({__name:"widget-table-head",props:{config:{}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("tr",xn,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.config,(r,o)=>(i.openBlock(),i.createElementBlock("th",{class:"widget-table__head-cell",key:o},[i.createElementVNode("p",Bn,i.toDisplayString(r.label),1)]))),128))]))}});const M=(n,e)=>{const t=n.__vccOpts||n;for(const[r,o]of e)t[r]=o;return t},Mn=M(Vn,[["__scopeId","data-v-25198f4a"]]);function Un(n){return typeof n.name=="string"?n.name:Array.isArray(n.name)?n.name[0]:null}function Nt(n,e){const t=Un(n);let r=t?S.utils.getPropFromObject(e,t):null;return r===void 0&&(r=null),n.value?n.value(r,e):r}function jn(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var We={exports:{}},Ve,st;function Wn(){if(st)return Ve;st=1;var n=1e3,e=n*60,t=e*60,r=t*24,o=r*7,s=r*365.25;Ve=function(c,f){f=f||{};var u=typeof c;if(u==="string"&&c.length>0)return d(c);if(u==="number"&&isFinite(c))return f.long?a(c):l(c);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(c))};function d(c){if(c=String(c),!(c.length>100)){var f=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(c);if(f){var u=parseFloat(f[1]),h=(f[2]||"ms").toLowerCase();switch(h){case"years":case"year":case"yrs":case"yr":case"y":return u*s;case"weeks":case"week":case"w":return u*o;case"days":case"day":case"d":return u*r;case"hours":case"hour":case"hrs":case"hr":case"h":return u*t;case"minutes":case"minute":case"mins":case"min":case"m":return u*e;case"seconds":case"second":case"secs":case"sec":case"s":return u*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return u;default:return}}}}function l(c){var f=Math.abs(c);return f>=r?Math.round(c/r)+"d":f>=t?Math.round(c/t)+"h":f>=e?Math.round(c/e)+"m":f>=n?Math.round(c/n)+"s":c+"ms"}function a(c){var f=Math.abs(c);return f>=r?p(c,f,r,"day"):f>=t?p(c,f,t,"hour"):f>=e?p(c,f,e,"minute"):f>=n?p(c,f,n,"second"):c+" ms"}function p(c,f,u,h){var g=f>=u*1.5;return Math.round(c/u)+" "+h+(g?"s":"")}return Ve}function qn(n){t.debug=t,t.default=t,t.coerce=a,t.disable=s,t.enable=o,t.enabled=d,t.humanize=Wn(),t.destroy=p,Object.keys(n).forEach(c=>{t[c]=n[c]}),t.names=[],t.skips=[],t.formatters={};function e(c){let f=0;for(let u=0;u<c.length;u++)f=(f<<5)-f+c.charCodeAt(u),f|=0;return t.colors[Math.abs(f)%t.colors.length]}t.selectColor=e;function t(c){let f,u=null,h,g;function w(...C){if(!w.enabled)return;const y=w,E=Number(new Date),b=E-(f||E);y.diff=b,y.prev=f,y.curr=E,f=E,C[0]=t.coerce(C[0]),typeof C[0]!="string"&&C.unshift("%O");let A=0;C[0]=C[0].replace(/%([a-zA-Z%])/g,(x,_)=>{if(x==="%%")return"%";A++;const Z=t.formatters[_];if(typeof Z=="function"){const de=C[A];x=Z.call(y,de),C.splice(A,1),A--}return x}),t.formatArgs.call(y,C),(y.log||t.log).apply(y,C)}return w.namespace=c,w.useColors=t.useColors(),w.color=t.selectColor(c),w.extend=r,w.destroy=t.destroy,Object.defineProperty(w,"enabled",{enumerable:!0,configurable:!1,get:()=>u!==null?u:(h!==t.namespaces&&(h=t.namespaces,g=t.enabled(c)),g),set:C=>{u=C}}),typeof t.init=="function"&&t.init(w),w}function r(c,f){const u=t(this.namespace+(typeof f>"u"?":":f)+c);return u.log=this.log,u}function o(c){t.save(c),t.namespaces=c,t.names=[],t.skips=[];let f;const u=(typeof c=="string"?c:"").split(/[\s,]+/),h=u.length;for(f=0;f<h;f++)u[f]&&(c=u[f].replace(/\*/g,".*?"),c[0]==="-"?t.skips.push(new RegExp("^"+c.slice(1)+"$")):t.names.push(new RegExp("^"+c+"$")))}function s(){const c=[...t.names.map(l),...t.skips.map(l).map(f=>"-"+f)].join(",");return t.enable(""),c}function d(c){if(c[c.length-1]==="*")return!0;let f,u;for(f=0,u=t.skips.length;f<u;f++)if(t.skips[f].test(c))return!1;for(f=0,u=t.names.length;f<u;f++)if(t.names[f].test(c))return!0;return!1}function l(c){return c.toString().substring(2,c.toString().length-2).replace(/\.\*\?$/,"*")}function a(c){return c instanceof Error?c.stack||c.message:c}function p(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}var Gn=qn;(function(n,e){e.formatArgs=r,e.save=o,e.load=s,e.useColors=t,e.storage=d(),e.destroy=(()=>{let a=!1;return()=>{a||(a=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function t(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function r(a){if(a[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+a[0]+(this.useColors?"%c ":" ")+"+"+n.exports.humanize(this.diff),!this.useColors)return;const p="color: "+this.color;a.splice(1,0,p,"color: inherit");let c=0,f=0;a[0].replace(/%[a-zA-Z%]/g,u=>{u!=="%%"&&(c++,u==="%c"&&(f=c))}),a.splice(f,0,p)}e.log=console.debug||console.log||(()=>{});function o(a){try{a?e.storage.setItem("debug",a):e.storage.removeItem("debug")}catch{}}function s(){let a;try{a=e.storage.getItem("debug")}catch{}return!a&&typeof process<"u"&&"env"in process&&(a=process.env.DEBUG),a}function d(){try{return localStorage}catch{}}n.exports=Gn(e);const{formatters:l}=n.exports;l.j=function(a){try{return JSON.stringify(a)}catch(p){return"[UnexpectedJSONParseError]: "+p.message}}})(We,We.exports);var zn=We.exports;const kt=jn(zn);function Ot(n){return["eservices-core",n].join(":")}function Ft(n){return Je(n,"YYYY/MM/DD HH:mm:ss")}function Je(n,e="YYYY/MM/DD"){if(!n)return"";try{const t=new Date(n);return Mt.format(t,e)}catch(t){return console.log(t),"Invalid date"}}const Kn={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()=>i.h("i",{class:`icon icon-${t}`})}},Fe=M(Kn,[["__scopeId","data-v-e287c8d9"]]),Yn=kt(Ot("setup-list-row"));function Jn(n,e){const t=n.config.map(r=>Hn(r,n,e));return i.h("tr",{class:"widget-table__row widget-table-row"},t)}function Hn(n,e,t){const r=e.values;let o=Nt(n,r);const s={onClick:[],class:["widget-table__cell widget-table-cell"]};function d(c){s.onClick.push(()=>c(r))}function l(c){Array.isArray(c)?s.class.push(...c):s.class.push(c)}const a=[],p=[];if(n.hide&&n.hide(r))return[i.h("td")];if(n.type)switch(l(`widget-table-cell_${n.type}`),n.type){case"number":{typeof o=="number"&&(o=new Intl.NumberFormat().format(o));break}case"date":{o=Je(typeof o=="string"?o:null);break}case"dateTime":case"dateWithTime":{o=Ft(typeof o=="string"?o:null);break}case"money":{o=Pt(o);break}case"multi-select":{p.push(i.h(S.FormField,{type:"single-checkbox",modelValue:e.selected})),d(at.bind(null,t,!0));break}case"select":{p.push(i.h(S.FormField,{type:"single-radio",modelValue:e.selected})),d(at.bind(null,t,!1));break}}if(n.onClick&&d(n.onClick),n.link)try{const c=n.link(r);if(c){const f=i.h(ut.RouterLink,{to:c});p.push(f),l("widget-table-cell_link")}}catch(c){Yn("Can't add router link",c)}return n.href&&(p.push(i.h("a",{href:n.href(r),target:"_blank"})),l("widget-table-cell_link")),(typeof o=="string"||typeof o=="number")&&p.push(i.h("p",{class:"widget-list-cell-text"},o)),n.icon&&p.push(i.h(Fe,{name:n.icon})),n.class&&(typeof n.class=="function"?l(n.class(r)):l(n.class)),a.push(i.h("td",s,p)),a}function at(n,e){n.emit("select",e)}function It(n,e){return()=>{try{return Jn(n,e)}catch(t){return console.warn(t),null}}}const Xn={props:{values:Object,config:Object,selected:Boolean},setup:It},Zn=["colspan"],ct=i.defineComponent({__name:"widget-table-form",props:{rowLength:{},component:{},values:{},isNew:{type:Boolean}},emits:["save","close"],setup(n,{emit:e}){const t=i.ref();return i.onMounted(()=>{setTimeout(()=>{t.value&&t.value.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})},250)}),(r,o)=>(i.openBlock(),i.createElementBlock("tr",{class:"widget-table-form",ref_key:"refTableForm",ref:t},[i.createElementVNode("td",{colspan:r.rowLength},[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(r.component),i.mergeProps(r.$attrs,{values:r.values,new:r.isNew,onClose:o[0]||(o[0]=s=>e("close")),onSave:o[1]||(o[1]=s=>e("save",s))}),null,16,["values","new"]))],8,Zn)],512))}}),G={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"},Qn={class:"widget-table"},lt="update:selectedRows",er=i.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=i.useSlots(),o=i.computed(()=>{var l;return(l=r==null?void 0:r.default)==null?void 0:l.call(r)[0]});function s(l,a=!0){if(!t.selectedRows)return;if(!a)return e(lt,t.selectedRows.includes(l)?[]:[l]);const p=[...t.selectedRows],c=p.indexOf(l);return c===-1?p.push(l):p.splice(c,1),e(lt,p)}function d(l){e("save",l),e("update:activeRow",null)}return(l,a)=>(i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("table",Qn,[i.createVNode(Mn,{config:l.config},null,8,["config"]),i.createElementVNode("tbody",null,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.array,(p,c)=>(i.openBlock(),i.createElementBlock(i.Fragment,{key:c},[i.createVNode(Xn,{config:l.config,values:p,selected:l.selectedRows.includes(p),onSelect:f=>s(p,f),class:i.normalizeClass(l.classCallback?l.classCallback(p):"")},null,8,["config","values","selected","onSelect","class"]),o.value&&l.activeRow===p?(i.openBlock(),i.createBlock(ct,{key:0,component:o.value,"row-length":l.config.length,values:p,onClose:a[0]||(a[0]=f=>e("update:activeRow",null)),onSave:d,"is-new":!1},null,8,["component","row-length","values"])):i.createCommentVNode("",!0)],64))),128)),l.activeRow===i.unref(G).LIST_ACTIVE_NEW?(i.openBlock(),i.createBlock(ct,{key:0,component:o.value,"row-length":l.config.length,onClose:a[1]||(a[1]=p=>e("update:activeRow",null)),onSave:d,"is-new":!0},null,8,["component","row-length"])):i.createCommentVNode("",!0)])])]))}}),tr=i.defineComponent({__name:"widget-spinner",props:{color:{default:"#fff"}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("div",{class:"widget-spinner",style:i.normalizeStyle({"border-left":`1.1em solid ${e.color}`})},null,4))}});const Ie=M(tr,[["__scopeId","data-v-0ef9ae88"]]),nr={class:"widget-button"},rr=i.defineComponent({__name:"widget-button",props:{wait:{type:Boolean}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("button",nr,[e.wait?(i.openBlock(),i.createBlock(Ie,{key:0,class:"widget-button-spinner"})):i.createCommentVNode("",!0),i.renderSlot(e.$slots,"default",{},void 0,!0)]))}});const or=M(rr,[["__scopeId","data-v-450dc564"]]),ir={class:"widget-multi-button-wrap position_relative cursor_pointer"},sr={class:"widget-multi-button-body grid"},ar=["onClick"],cr={class:"widget-multi-button-side-wrap"},lr=i.defineComponent({__name:"widget-multi-button",props:{label:{},array:{default:()=>[]}},setup(n){const e=n;i.useCssVars(d=>({"7025434e":r.value}));const t=i.reactive({active:!1,wait:!1}),r=i.computed(()=>e.array.length+(e.label?1:0));function o(d){if(!(typeof d!="function"||t.wait))return t.wait=!0,Promise.resolve().then(d).finally(()=>{t.wait=!1})}function s(d=!t.active){t.active=d}return(d,l)=>(i.openBlock(),i.createElementBlock("div",ir,[i.createElementVNode("div",{class:i.normalizeClass(["overflow_hidden radius_20 widget-multi-button grid",t.active?"widget-multi-button_active":null])},[i.createElementVNode("div",sr,[d.label?(i.openBlock(),i.createElementBlock("p",{key:0,class:"text_md margin_0 text_nowrap widget-multi-button-body-label",onClick:l[0]||(l[0]=a=>s())},i.toDisplayString(d.label),1)):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(d.array,(a,p)=>(i.openBlock(),i.createElementBlock("p",{class:"text_md margin_0 text_nowrap widget-multi-button-body-label",key:p,onClick:c=>{o(a.callback),s(!1)}},i.toDisplayString(a.label),9,ar))),128))]),i.createElementVNode("div",cr,[i.createElementVNode("div",{class:i.normalizeClass(["grid-center widget-multi-button-side",t.active?"widget-multi-button-side_active":null]),onClick:l[1]||(l[1]=a=>s())},[t.wait?(i.openBlock(),i.createBlock(i.unref(Ie),{key:0,class:"widget-multi-button-side-spinner"})):d.array.length>1?(i.openBlock(),i.createBlock(i.unref(Fe),{key:1,class:"widget-multi-button-side-icon"},{default:i.withCtx(()=>[i.createTextVNode("angle-small-down")]),_:1})):i.createCommentVNode("",!0)],2)])],2)]))}});const ur=M(lr,[["__scopeId","data-v-a8d711d1"]]),dr={class:"widget-loader flex flex-align_center gap_10 padding_15"},fr={class:"text_md"},pr=i.defineComponent({__name:"widget-loader",props:{label:{}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("div",dr,[i.createVNode(Ie,{color:"var(--primary)",class:"padding_10"}),i.createElementVNode("span",fr,i.toDisplayString(e.label),1)]))}}),hr=["alt","src"],gr=i.defineComponent({__name:"widget-image",props:{src:{},alt:{},default:{}},setup(n){const e=n,t=i.ref();return i.onMounted(()=>{t.value&&(t.value.src=e.src),t.value.onerror=function(){e.default&&(t.value.src=e.default)}}),(r,o)=>(i.openBlock(),i.createElementBlock("img",{alt:r.alt,ref_key:"refImage",ref:t,src:r.src||r.$props.default},null,8,hr))}}),mr={props:{config:Array,values:Object,selected:Boolean},setup:It};const yr=M(mr,[["__scopeId","data-v-344a8cc1"]]),wr=n=>(i.pushScopeId("data-v-4e1d87c8"),n=n(),i.popScopeId(),n),Cr={class:"head-cell"},vr=wr(()=>i.createElementVNode("div",{class:"head-cell-resize"},null,-1)),Er=i.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,o)=>(i.openBlock(),i.createElementBlock("th",null,[i.createElementVNode("div",Cr,[i.createElementVNode("div",{class:"head-cell-content flex_grow",style:i.normalizeStyle({"min-width":r.minWidth,"max-width":r.maxWidth,width:r.width})},[r.type==="multi-select"?(i.openBlock(),i.createBlock(i.unref(S.FormField),{key:0,type:"single-checkbox",onClick:o[0]||(o[0]=i.withModifiers(s=>e("select"),["stop","prevent"]))})):(i.openBlock(),i.createElementBlock("p",{key:1,class:"widget-list-head-label head-cell-label list-head-cell-label text_md margin-0",onClick:o[1]||(o[1]=s=>e("order"))},i.toDisplayString(r.title||r.label),1))],4),r.name&&r.order.length&&r.order[0]===r.name?(i.openBlock(),i.createBlock(i.unref(Fe),{key:0,class:i.normalizeClass(["head-cell-order",{"head-cell-order_down":r.order.length>1&&r.order[1]==="desc"}])},{default:i.withCtx(()=>[i.createTextVNode("core-arrow-up")]),_:1},8,["class"])):i.createCommentVNode("",!0),vr])]))}});const _r=M(Er,[["__scopeId","data-v-4e1d87c8"]]),Sr=i.defineComponent({__name:"widget-list-head",props:{config:{},order:{}},emits:["update:config","update:order","select"],setup(n,{emit:e}){const t=n,r=i.ref(),o=i.ref();i.onMounted(()=>{function a(h,g){let w=-1;do w++,g-=h[w];while(g>0&&w<h.length);return w}function p(h,g){let w=0;for(;g>0&&g>h[w]&&w<h.length;)g-=h[w],w++;return console.log(g,w),w>0?w:0}function c(h){try{o.value.style.insetInlineStart=h+"px"}catch(g){console.log(g)}}function f(h){try{o.value.style.width=h+"px",o.value.style.minWidth=h+"px",o.value.style.maxWidth=h+"px"}catch(g){console.log(g)}}function u(h){return h===null?!1:h.classList.contains("head-cell-resize")}r.value.addEventListener("pointerdown",function(g){var Ze;function w(N){return N.screenX+E-$}const C=r.value,y=[...C.children].filter(N=>N.localName==="th"),E=((Ze=C.offsetParent)==null?void 0:Ze.scrollLeft)||0,b=y.map(N=>N.clientWidth),A=u(g.target),$=C.getBoundingClientRect().left,x=w(g),_=a(b,x),Z=b.slice(0,_).reduce((N,P)=>N+P,0),de=x-Z,Re=C.offsetWidth,Q=y[_].clientWidth;if(t.config[_].type==="multi-select")return;console.group("START"),console.log(),console.log("Start screenX",g.screenX),console.log("Widths",b),console.log("max width",Re),console.log("Start Position",x),console.log("Position From",_),console.log("Start Position",_),console.log("Global offset (Отступ самой таблицы от края экрана)",$),console.log("Del",de),console.groupEnd(),o.value.innerText=y[_].textContent||"",o.value.style.display="grid",o.value.style.width=Q+"px",o.value.style.cursor="grabbing",c(Z),f(Q),document.addEventListener("pointermove",Xe,{passive:!0}),document.addEventListener("pointerup",He);function He(N){if(console.group("END"),document.removeEventListener("pointermove",Xe),document.removeEventListener("pointerup",He),A&&(t.config[_].width=o.value.style.width,t.config[_].minWidth=o.value.style.width,t.config[_].maxWidth=o.value.style.width,s(t.config)),!A){const P=N.screenX+E-$;console.log("ENP Position",P);const fe=p(b,P);if(console.log(_,"->",fe),fe!==_){const ee=t.config[_],Le=t.config;Le.splice(_,1),Le.splice(fe,0,ee),s(Le)}else{const ee=t.config[_].name;d(ee)}}o.value.style.display="none",document.body.style.cursor="unset",console.groupEnd()}function Xe(N){if(A){const ee=w(N)-x+Q;f(ee);return}let P=N.screenX+E-$-de;P<0&&(P=0),P+Q>Re&&(P=Re-Q),c(P)}})});function s(a){e("update:config",a)}function d(a){if(!a)return;if(Array.isArray(a)){if(a.length<1)return;a=a[0]}if(t.order.length===0||t.order[0]!==a)return void l([a]);const p=t.order.length===1||t.order[1]==="asc"?"asc":"desc";l([a,p==="asc"?"desc":"asc"])}function l(a){e("update:order",a)}return(a,p)=>(i.openBlock(),i.createElementBlock("tr",{class:"widget-list-head",ref_key:"refHead",ref:r},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.config,(c,f)=>(i.openBlock(),i.createBlock(_r,i.mergeProps({key:c},c,{onOrder:u=>d(c.name),onSelect:p[0]||(p[0]=u=>e("select")),order:a.order}),null,16,["onOrder","order"]))),128)),i.createElementVNode("div",{class:"test-block text_md",ref_key:"refDisplayPosition",ref:o},"test",512)],512))}});const br=M(Sr,[["__scopeId","data-v-ccffc6bd"]]),Tr={class:"widget-list"},Ar={class:"widget-list-body position_relative"},Nr=50,kr=i.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(l,a=!0){if(t.selectedRows)if(!a)s(t.selectedRows.includes(l)?[]:[l]);else{const p=[...t.selectedRows],c=p.indexOf(l);c===-1?p.push(l):p==null||p.splice(c,1),s(p)}}function o(){var l;if(((l=t.selectedRows)==null?void 0:l.length)!==t.array.length)return s([...t.array]);s([])}function s(l){e("update:selectedRows",l)}function d(l){if(!l)return;const a=l.target;a.scrollTop+a.clientHeight+Nr>a.scrollHeight&&e("scrollEnd")}return(l,a)=>(i.openBlock(),i.createElementBlock("div",{class:"es-list-container",onScrollPassive:d},[i.createElementVNode("table",Tr,[i.createElementVNode("thead",null,[i.createVNode(br,{onSelect:a[0]||(a[0]=p=>o()),"onUpdate:order":a[1]||(a[1]=p=>e("update:order",p)),"onUpdate:config":a[2]||(a[2]=p=>e("update:config",p)),config:l.config,order:l.order},null,8,["config","order"])]),i.createElementVNode("tbody",Ar,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.array,(p,c)=>{var f;return i.openBlock(),i.createBlock(yr,{key:c,class:"widget-list-row",values:p,config:l.config,selected:(f=l.selectedRows)==null?void 0:f.includes(p),onSelect:u=>r(p,u)},null,8,["values","config","selected","onSelect"])}),128))])])],32))}});function Or(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=i.reactive({wait:!1,call:e});return t}function be(n){return typeof n=="string"?Me(n):Fr(n)?Me(n.message):Me(G.DEFAULT_ERROR_MESSAGE)}function Fr(n){return!!(typeof n=="object"&&n!==null&&Object.hasOwnProperty.call(n,"message"))}function Me(n){return{message:n}}function le(n="error"){return function(e){const{message:t}=be(e);Te.add(n,t)}}function qe(n,e){return $e().emit("entity:read",{...e,entity:n})}function $t(n,e){return $e().emit("entity:update",{...e,entity:n})}function Ir(n){return n.reduce((e,t)=>(t.name&&(typeof t.name=="string"?e.push(t.name):e.push(...t.name)),e),[])}function Pt(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 Rt(n){return Object.keys(n).reduce((e,t)=>{let r=n[t];const o=t.charAt(0).toUpperCase()+t.slice(1);return typeof r=="object"&&!(r==null||Array.isArray(r))&&(r=Rt(r)),e[o]=r,e},{})}function $r(n,e){const t=new Map;return n.forEach(r=>{var s;const o=e(r);t.has(o)||t.set(o,[]),(s=t.get(o))==null||s.push(r)}),t}function Pr(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,n=>(n^crypto.getRandomValues(new Uint8Array(1))[0]&15>>n/4).toString(16))}function Rr(){const n=i.ref(null);function e(t){n.value=t}return{activeRow:n,activateRow:e}}const K=kt(Ot("use-socket"));function $e(){return Lr}const Lr=function(){let n=1,e;const t=new Set,r=new Set;function o(){return{safeQueue:r,requestId:n,handlers:t}}function s(u){const h=[...t.values()];K("Handlers array length is %d. Response event: %s. Request id: %d",t.size,u.event,u.requestId),h.forEach(g=>{const w=u.requestId;(g.requestId&&g.requestId===w||!g.requestId&&g.event===u.event)&&(K("Find appropriated handler: %d, event: %s",n,g.event),g.callback(u.data,u),g.once&&(t.delete(g),K("Handler was removed by *once* params was passed. %o",g)))})}function d(u){console.log(`%cInitializing sockets: %c${u}`,"color: purple","color: black"),e=new WebSocket(u),e.onclose=function(h){K("Connection to server was stopped: %d %s",h.code,h.reason),setTimeout(()=>d(u))},e.onopen=function(){console.log("Socket was %cconnected.","color: green"),[...r.values()].forEach(h=>{l(h),r.delete(h)})},e.onerror=function(h){console.warn(h)},e.onmessage=h=>{try{const g=JSON.parse(h.data);if(!Lt(g)){console.warn("Data is %cnot correct %csocket answer.","color: red","color: black"),console.log(g);return}s(g)}catch(g){console.warn("Socket handle %conmessage%c error.","color: red","color: black"),console.log(g)}}}function l(u){e.send(u)}function a(u,h){t.add({event:u,callback:h})}function p(u,h){t.add({event:u,callback:h,once:!0})}function c(){return e&&(e==null?void 0:e.readyState)===1}function f(u,h,g){const w=++n,C=JSON.stringify({requestId:w,event:u,data:h,contextId:V.contextId,url:window.location.href});return c()?l(C):(r.add(C),K("Socket is not connected. Message was send to save-queue. %s")),new Promise((y,E)=>{t.add({event:u,requestId:w,once:!0,callback:(b,A)=>{if(K("Promise was resolve with next data:",b),Dr(A))return void E(b);g&&g(b,A),y(b)}})})}return{get socket(){return e},on:a,once:p,emit:f,initialization:d,getDevInfo:o}}(),Dr=n=>!!Lt(n)&&n.event==="request-error",Lt=n=>!!n&&typeof n=="object"&&n!==null&&"event"in n&&typeof n.event=="string"&&"requestId"in n&&typeof n.requestId=="number"&&"data"in n;function xr(n,e){const t=i.reactive([]);let r=0;const o=i.ref(!1);function s(){if(o.value)return Promise.reject("The process has already started.");const u=c();return o.value=!0,typeof u.limit!="number"&&(u.limit=100),u.offset=r,qe(n,u).then(h=>(r+=h.length,h)).finally(()=>{o.value=!1})}function d(u,h){var w;const g=u.Version||((w=t.find(C=>C.Id===h))==null?void 0:w.Version);if(g===void 0)throw new Error("Object without version.");return g}function l(u,h){const g=t.findIndex(w=>w.Id===u);if(g===-1)throw new Error(`Can't found item with Id ${u}`);t.splice(g,1,h)}async function a(u,h){try{const g=c(),w=d(h,u);delete h.Version,await $t(n,{id:u,values:h,version:w});const C=await qe(n,{fields:g.fields||"",id:u});l(u,C)}catch(g){le()(g)}}async function p(){try{const u=await s();t.push(...u)}catch(u){le()(u)}}function c(){return typeof e=="function"?e():e}async function f(){try{r=0;const u=await s();t.splice(0,t.length,...u)}catch(u){le()(u)}}return{array:t,updateById:a,next:p,reload:f,wait:o}}function Br(){function n(){return{organizations:V.organizations,currentContextId:V.contextId,person:V.person,context:V.context,contextType:V.contextType}}const e=i.reactive(n());return V.onupdateContext(()=>{Object.assign(e,n())}),e}const Te=new class{constructor(){this.store=i.reactive([])}add(e,t,r={}){const o=Vr(r),s=new Mr(e,t,o.timeout,o.children,o.click);return this.store.push(s),r.timeout&&setTimeout(this.remove.bind(this,s.id),r.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 Vr(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 Dt=class xt{constructor(e,t,r,o,s){this.type=e,this.message=t,this.timeout=r,this.children=o,this.click=s,this.id=xt.cardId++}};Dt.cardId=1;let Mr=Dt;function Ur(){return $e().emit("client:read",{})}var Bt=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)},jr=(n,e,t)=>(Bt(n,e,"read from private field"),t?t.call(n):e.get(n)),Wr=(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)},qr=(n,e,t,r)=>(Bt(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),Ee;const Pe=class Y extends O{constructor(){super(...arguments),this.type="front",this.organizations=[],Wr(this,Ee,!1)}set language(e){localStorage.setItem(G.LOCALSTORAGE_LANGUAGE_KEY,e)}get language(){return localStorage.getItem(G.LOCALSTORAGE_LANGUAGE_KEY)||Y.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){qr(this,Ee,e),this.emit(Y.EVENT_READY_UPDATE,e)}get ready(){return jr(this,Ee)}onReady(e){return this.on(Y.EVENT_READY_UPDATE,e)}onupdateContext(e){return this.on(Y.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(G.LOCALSTORAGE_CURRENT_CONTEXT_KEY,String(e)),this.emit(Y.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.restoreCurrentContext(),this.ready=!0}catch(e){le()(e)}}restoreCurrentContext(){const e=Number.parseInt(localStorage.getItem(G.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 Ur()}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;Pe.DEFAULT_LANGUAGE="en";Pe.EVENT_CONTEXT_UPDATE="event:context-update";Pe.EVENT_READY_UPDATE="event:ready-update";let Gr=Pe;function zr(n){return typeof n!="object"||n===null?!1:!!(n.hasOwnProperty("start")||n.hasOwnProperty("end"))}function I(n){return Object.keys(n).reduce((e,t)=>{const r=n[t];if(Array.isArray(r)){const o=r.map(s=>typeof s=="string"?`'${s}'`:s).join(", ");return r.length&&e.push(`@${t} in (${o})`),e}if(zr(r)){let o=function(s){var d;return((d=s.match(/([^Z]*)/))==null?void 0:d[0])+"0000Z"};return r.start&&e.push(`@${t} ge ${o(r.start)}`),r.end&&e.push(`@${t} le ${o(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(I.is(t,r)),e)},[]).join(" and ")}function ue(n){return typeof n=="string"?`'${n}'`:`${n}`}I.includes=function(e,t){return`@${e} Contains ${ue(t)}`};I.beginWith=function(e,t){return`@${e} BeginWith ${ue(t)}`};I.notEq=function(e,t){return`@${e} nq ${ue(t)}`};I.eq=function(e,t){return Array.isArray(t)?I.in(e,t):`@${e} eq ${ue(t)}`};I.in=function(e,t){const r=t.map(ue).join(", ");return`@${e} in (${r})`};I.and=function(...e){return e.join(" and ")};I.is=function(e,t){return`@${e} is ${t}`};I.or=function(...e){return e.join(" or ")};const V=new Gr,Kr={clickOutside:Ne,staticLink:yn,Request:m},Yr={usage:qt,utils:Xt,config:Zt,types:Qt};exports.Communication=gn;exports.ComputedMetadata=rn;exports.CoreError=F;exports.Filter=I;exports.Manager=V;exports.MetadataStore=ne;exports.NotificationSystem=Te;exports.Request=m;exports.WidgetButton=or;exports.WidgetIcon=Fe;exports.WidgetImage=gr;exports.WidgetList=kr;exports.WidgetLoader=pr;exports.WidgetMultiButton=ur;exports.WidgetSpinner=Ie;exports.WidgetTable=er;exports.actionService=Tt;exports.asyncProcess=Or;exports.authService=T;exports.billingService=J;exports.catchUniversal=le;exports.clickOutside=Ne;exports.clientService=gt;exports.communicationService=ce;exports.configurationService=An;exports.constants=G;exports.dataService=D;exports.debounce=wn;exports.default=Yr;exports.documentsService=Tn;exports.equipmentService=Dn;exports.fileService=fn;exports.getCellValue=Nt;exports.getNamesFromListConfig=Ir;exports.groupArrayByField=$r;exports.historyService=tn;exports.internationalizationService=sn;exports.invitationService=pn;exports.metadataService=ze;exports.openService=hn;exports.parseError=be;exports.prettifyValueByMetadata=on;exports.prettyDate=Je;exports.prettyDateWithTime=Ft;exports.prettyMoney=Pt;exports.processWizardService=ye;exports.ruleValidationService=Ke;exports.t=X;exports.testTypes=en;exports.universalEntityRead=qe;exports.universalEntityUpdate=$t;exports.useCommunication=mn;exports.useFormAction=En;exports.useFormLabel=_n;exports.useFormMetadata=Cn;exports.useFormRequest=bn;exports.useFormRequestData=Sn;exports.useListActiveRow=Rr;exports.useListEntity=xr;exports.useListSearch=Nn;exports.useListSelect=On;exports.useLogger=_t;exports.useManagerState=Br;exports.useSocket=$e;exports.useWizard=Pn;exports.utils=Kr;exports.uuidv4=Pr;exports.valuesToUpperCase=Rt;exports.viewService=dn;
|
|
11
11
|
//# sourceMappingURL=eservices-core.cjs.js.map
|