@uxland/primary-shell 5.1.1 → 5.1.2

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.
@@ -5981,7 +5981,7 @@ Registered bindings:`,re.forEach(function(ne){var oe="Object";ne.implementationT
5981
5981
  </div>
5982
5982
  <primaria-error-view .error=${J.error} view=${shellViews.error}></primaria-error-view>
5983
5983
  </primaria-content-switcher>
5984
- `;class ExitShell{}const styles$f=":host{min-height:1px;height:100%;width:100%}.wrapper{position:relative;min-height:1px;height:100%;display:flex;flex-direction:row}.wrapper #widgets-sidebar-region{width:25%;border-left:1px solid rgb(189,189,189)}.wrapper .content{flex:1;display:flex;flex-direction:column}.wrapper .content #header-widgets-region{display:grid;grid-template-columns:repeat(3,1fr);gap:24px;padding:24px 40px;z-index:1}.wrapper .content #content-widgets-region{flex:1;min-height:1px;height:100%;padding-inline:40px;padding-bottom:24px;z-index:2}",template$f=J=>ke$1`
5984
+ `;class ExitShell{}const styles$f=":host{min-height:1px;height:100%;width:100%}.wrapper{position:relative;min-height:1px;height:100%;display:flex;flex-direction:row}.wrapper #widgets-sidebar-region{width:25%;border-left:1px solid rgb(189,189,189)}.wrapper .content{flex:1;display:flex;flex-direction:column}.wrapper .content #header-widgets-region{display:grid;grid-template-columns:repeat(3,1fr);gap:24px;padding:24px 40px}.wrapper .content #content-widgets-region{flex:1;min-height:1px;height:100%;padding-inline:40px;padding-bottom:24px}",template$f=J=>ke$1`
5985
5985
  <div class="wrapper">
5986
5986
  <div class="content">
5987
5987
  <div id="header-widgets-region"></div>
@@ -5989,7 +5989,7 @@ Registered bindings:`,re.forEach(function(ne){var oe="Object";ne.implementationT
5989
5989
  </div>
5990
5990
  <div id="widgets-sidebar-region"></div>
5991
5991
  </div>
5992
- `;var __defProp$n=Object.defineProperty,__getOwnPropDesc$n=Object.getOwnPropertyDescriptor,__decorateClass$n=(J,W,X,te)=>{for(var re=te>1?void 0:te?__getOwnPropDesc$n(W,X):W,ne=J.length-1,oe;ne>=0;ne--)(oe=J[ne])&&(re=(te?oe(W,X,re):oe(re))||re);return te&&re&&__defProp$n(W,X,re),re};let ClinicalMonitoring=class extends PrimariaRegionHost(h$q){render(){return ke$1`${template$f()}`}};ClinicalMonitoring.styles=i$y`
5992
+ `;var __defProp$n=Object.defineProperty,__getOwnPropDesc$n=Object.getOwnPropertyDescriptor,__decorateClass$n=(J,W,X,te)=>{for(var re=te>1?void 0:te?__getOwnPropDesc$n(W,X):W,ne=J.length-1,oe;ne>=0;ne--)(oe=J[ne])&&(re=(te?oe(W,X,re):oe(re))||re);return te&&re&&__defProp$n(W,X,re),re};let ClinicalMonitoring=class extends PrimariaRegionHost(h$q){render(){return ke$1`${template$f()}`}firstUpdated(){this._observeMaximizedState()}_observeMaximizedState(){const J=this.renderRoot.querySelector("#content-widgets-region");if(!J)return;new MutationObserver(()=>{const X=J.querySelector("activity-history-main");if(!X)return;const te=X.hasAttribute("maximized")||X.maximized;this._toggleWidgetsVisibility(!te)}).observe(J,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["maximized"]})}_toggleWidgetsVisibility(J){const W=this.renderRoot.querySelector("#widgets-sidebar-region"),X=this.renderRoot.querySelector("#header-widgets-region");W&&(W.style.display=J?"":"none"),X&&(X.style.display=J?"":"none")}};ClinicalMonitoring.styles=i$y`
5993
5993
  ${r$H(styles$f)}
5994
5994
  `,__decorateClass$n([s$w({targetId:"widgets-sidebar-region",name:clinicalMonitoringRegions.sidebar})],ClinicalMonitoring.prototype,"sidebarRegion",2),__decorateClass$n([s$w({targetId:"header-widgets-region",name:clinicalMonitoringRegions.header})],ClinicalMonitoring.prototype,"headerRegion",2),__decorateClass$n([s$w({targetId:"content-widgets-region",name:clinicalMonitoringRegions.content})],ClinicalMonitoring.prototype,"contentRegion",2),ClinicalMonitoring=__decorateClass$n([t$j("clinical-monitoring")],ClinicalMonitoring);const styles$e=":host{min-height:1px;height:100%;width:100%;display:flex}iframe{border:none;flex:1;height:100%}.pdf-container{display:flex;justify-content:center;align-items:center;height:100%;flex:1;border:1px solid #ccc}.no-pdf{text-align:center;color:#666;font-size:1.2rem;font-weight:700}",TYPES$1={primaryApi:Symbol.for("primaryApi"),store:Symbol.for("store"),localeManager:Symbol.for("localeManager")};var INJECTION=Symbol.for("INJECTION");function _proxyGetter(J,W,X,te){function re(){return Reflect.hasMetadata(INJECTION,this,W)?Reflect.getMetadata(INJECTION,this,W):X()}function ne(oe){Reflect.defineMetadata(INJECTION,oe,this,W)}Object.defineProperty(J,W,{configurable:!0,enumerable:!0,get:re,set:ne})}function makePropertyInjectDecorator(J,W){return function(X){return function(te,re){var ne=function(){return J.get(X)};_proxyGetter(te,re,ne)}}}function makePropertyInjectNamedDecorator(J,W){return function(X,te){return function(re,ne){var oe=function(){return J.getNamed(X,te)};_proxyGetter(re,ne,oe)}}}function makePropertyInjectTaggedDecorator(J,W){return function(X,te,re){return function(ne,oe){var de=function(){return J.getTagged(X,te,re)};_proxyGetter(ne,oe,de)}}}function makePropertyMultiInjectDecorator(J,W){return function(X){return function(te,re){var ne=function(){return J.getAll(X)};_proxyGetter(te,re,ne)}}}function getDecorators(J,W){var X=makePropertyInjectDecorator(J),te=makePropertyInjectNamedDecorator(J),re=makePropertyInjectTaggedDecorator(J),ne=makePropertyMultiInjectDecorator(J);return{lazyInject:X,lazyInjectNamed:te,lazyInjectTagged:re,lazyMultiInject:ne}}const container$1=new Container,{lazyInject:lazyInject$1}=getDecorators(container$1),registerDep=J=>{container$1.bind(J).toSelf()},unregisterDep=J=>{container$1.isBound(J)&&container$1.unbind(J)};function base64ToBlob(J,W="application/octet-stream"){const X=window.atob(J),te=X.length,re=new Uint8Array(te);for(let ne=0;ne<te;ne++)re[ne]=X.charCodeAt(ne);return new Blob([re],{type:W})}const createUrlFromBase64=(J,W)=>{if(J){const X=base64ToBlob(J,"application/pdf");return URL.createObjectURL(X)}};var __defProp$m=Object.defineProperty,__getOwnPropDesc$m=Object.getOwnPropertyDescriptor,__decorateClass$m=(J,W,X,te)=>{for(var re=te>1?void 0:te?__getOwnPropDesc$m(W,X):W,ne=J.length-1,oe;ne>=0;ne--)(oe=J[ne])&&(re=(te?oe(W,X,re):oe(re))||re);return te&&re&&__defProp$m(W,X,re),re};let PdfVisor=class extends h$q{constructor(){super(...arguments),this.pdfList=[],this.activePdfs=[],this.subscriptions=[]}async connectedCallback(){super.connectedCallback(),this._initializePdfState(),this._subscribeEvents()}disconnectedCallback(){super.disconnectedCallback(),this._unsubscribeEvents()}_initializePdfState(){var W,X;const J=((X=(W=this.api.pdfViewerManager).getPdfs)==null?void 0:X.call(W))||[];this.pdfList=[...J],J.length===1?this.activePdfs=[J[0]]:J.length>=2&&(this.activePdfs=J.slice(-2))}_getPdfSrc(J){return J.data.url?J.data.url:J.data.b64?createUrlFromBase64(J.data.b64):""}_subscribeEvents(){[this.api.broker.subscribe(pdfViwerEvents.added,W=>this._onPdfAdded(W)),this.api.broker.subscribe(pdfViwerEvents.deleted,({id:W})=>this._onPdfDeleted({id:W}))].forEach(W=>this.subscriptions.push(W))}_unsubscribeEvents(){this.subscriptions.forEach(J=>J.dispose())}_onPdfAdded(J){this.pdfList=[...this.pdfList,J],this._updateActivePdfs(J.id)}_onPdfDeleted({id:J}){this.pdfList=this.pdfList.filter(W=>W.id!==J),this.activePdfs=this.activePdfs.filter(W=>W.id!==J),this.requestUpdate()}_removePdf(J){this.api.pdfViewerManager.delete(J),this.activePdfs=this.activePdfs.filter(W=>W.id!==J)}_updateActivePdfs(J){if(this.activePdfs.some(X=>X.id===J))this.activePdfs=this.activePdfs.filter(X=>X.id!==J);else{const X=this.pdfList.find(te=>te.id===J);if(!X)return;this.activePdfs.length===2?this.activePdfs=[this.activePdfs[1],X]:this.activePdfs=[...this.activePdfs,X]}this.requestUpdate()}render(){return ke$1`
5995
5995
  <div class="pdf-container">
@@ -6272,7 +6272,7 @@ Registered bindings:`,re.forEach(function(ne){var oe="Object";ne.implementationT
6272
6272
  </div>
6273
6273
  `;var __defProp$a=Object.defineProperty,__getOwnPropDesc$a=Object.getOwnPropertyDescriptor,__decorateClass$a=(J,W,X,te)=>{for(var re=te>1?void 0:te?__getOwnPropDesc$a(W,X):W,ne=J.length-1,oe;ne>=0;ne--)(oe=J[ne])&&(re=(te?oe(W,X,re):oe(re))||re);return te&&re&&__defProp$a(W,X,re),re};let ActivityHistoryMain=class extends PrimariaRegionHost(h$q){constructor(){super(...arguments),this.subscriptions=[],this.maximized=!1,this.searchQuery=""}render(){return ke$1`${template$5(this)}`}connectedCallback(){super.connectedCallback(),this._subscribeEvents()}disconnectedCallback(){super.disconnectedCallback(),this._unsubscribeEvents()}_maximize(){this.maximized=!0}_minimize(){this.maximized=!1}_subscribeEvents(){const J=this.api.broker.subscribe(shellEvents.openClinicalMonitoringRequested,()=>{this.maximized=!1});this.subscriptions.push(J)}_unsubscribeEvents(){this.subscriptions.forEach(J=>J.dispose())}_handleSelectDate(J){const W=parse(J,"dd/MM/yyyy",new Date);this.scrollToClosestDate(W)}_handleSearchChange(J){typeof J.detail=="string"&&(this.searchQuery=J.detail,this.api.broker.send(new SearchActivityHistoryItems(this.searchQuery)))}async _raiseEcapCronogramEvent(){const J=await this.api.broker.send("get_patient_cip");this.api.ecapEventManager.publish("CRONOGRAMA","NO_TANCAR",{CIP:J})}scrollToClosestDate(J){const W=J.getTime();this.shadowRoot.querySelector("activity-history-timeline")._scrollIntoDate(W)}};ActivityHistoryMain.styles=i$y`
6274
6274
  ${r$H(styles$4)}
6275
- `,__decorateClass$a([n$v({type:Boolean})],ActivityHistoryMain.prototype,"maximized",2),__decorateClass$a([lazyInject(TYPES.primaryApi)],ActivityHistoryMain.prototype,"api",2),__decorateClass$a([connectedProperty(activityHistoryCollectionsSelector)],ActivityHistoryMain.prototype,"historyItems",2),__decorateClass$a([n$v()],ActivityHistoryMain.prototype,"searchQuery",2),ActivityHistoryMain=__decorateClass$a([t$j("activity-history-main")],ActivityHistoryMain);const registerViews=J=>{J.regionManager.registerView(clinicalMonitoringRegions.content,{id:J.pluginInfo.pluginId,factory:()=>Promise.resolve(new ActivityHistoryMain)})},unregisterViews=()=>{const J=container.get(TYPES.primaryApi);J.regionManager.removeView(clinicalMonitoringRegions.content,J.pluginInfo.pluginId)},bootstrapFeatures$1=J=>{bootstrapActivityHistoryItem(J)},teardownFeatures$1=()=>{teardownActivityHistoryItem()},initialize=async J=>(registerViews(J),await initializeLocalization(J),bindDeps(J),bootstrapFeatures$1(J),Promise.resolve()),dispose=()=>(teardownFeatures$1(),unregisterViews(),unbindDeps(),Promise.resolve());let bootstrappedPlugins=[];const internalPlugins=[{pluginId:"activity-history",importer:()=>Promise.resolve({initialize,dispose})}],bootstrapPlugins=async J=>{const W=internalPlugins.concat(J||[]);bootstrappedPlugins=await v$b(W,primariaApiFactory)},disposePlugins=async()=>Promise.all(bootstrappedPlugins.map(J=>J.dispose())),styles$3=".container{display:flex;flex-direction:column;gap:4px;align-items:center}.title{font-size:15px;line-height:24px;font-weight:600;color:var(--color-red-600)}.list{display:flex;flex-direction:column;gap:8px}",template$4=J=>{var W,X;return ke$1`
6275
+ `,__decorateClass$a([n$v({type:Boolean,reflect:!0})],ActivityHistoryMain.prototype,"maximized",2),__decorateClass$a([lazyInject(TYPES.primaryApi)],ActivityHistoryMain.prototype,"api",2),__decorateClass$a([connectedProperty(activityHistoryCollectionsSelector)],ActivityHistoryMain.prototype,"historyItems",2),__decorateClass$a([n$v()],ActivityHistoryMain.prototype,"searchQuery",2),ActivityHistoryMain=__decorateClass$a([t$j("activity-history-main")],ActivityHistoryMain);const registerViews=J=>{J.regionManager.registerView(clinicalMonitoringRegions.content,{id:J.pluginInfo.pluginId,factory:()=>Promise.resolve(new ActivityHistoryMain)})},unregisterViews=()=>{const J=container.get(TYPES.primaryApi);J.regionManager.removeView(clinicalMonitoringRegions.content,J.pluginInfo.pluginId)},bootstrapFeatures$1=J=>{bootstrapActivityHistoryItem(J)},teardownFeatures$1=()=>{teardownActivityHistoryItem()},initialize=async J=>(registerViews(J),await initializeLocalization(J),bindDeps(J),bootstrapFeatures$1(J),Promise.resolve()),dispose=()=>(teardownFeatures$1(),unregisterViews(),unbindDeps(),Promise.resolve());let bootstrappedPlugins=[];const internalPlugins=[{pluginId:"activity-history",importer:()=>Promise.resolve({initialize,dispose})}],bootstrapPlugins=async J=>{const W=internalPlugins.concat(J||[]);bootstrappedPlugins=await v$b(W,primariaApiFactory)},disposePlugins=async()=>Promise.all(bootstrappedPlugins.map(J=>J==null?void 0:J.dispose())),styles$3=".container{display:flex;flex-direction:column;gap:4px;align-items:center}.title{font-size:15px;line-height:24px;font-weight:600;color:var(--color-red-600)}.list{display:flex;flex-direction:column;gap:8px}",template$4=J=>{var W,X;return ke$1`
6276
6276
  <div class="container">
6277
6277
  <div class="title">${translate$1("busyManager.title")}</div>
6278
6278
  <div class="list">
@@ -6281,7 +6281,7 @@ Registered bindings:`,re.forEach(function(ne){var oe="Object";ne.implementationT
6281
6281
  </div>
6282
6282
  `};var __defProp$9=Object.defineProperty,__getOwnPropDesc$9=Object.getOwnPropertyDescriptor,__decorateClass$9=(J,W,X,te)=>{for(var re=te>1?void 0:te?__getOwnPropDesc$9(W,X):W,ne=J.length-1,oe;ne>=0;ne--)(oe=J[ne])&&(re=(te?oe(W,X,re):oe(re))||re);return te&&re&&__defProp$9(W,X,re),re};let PluginBusyList=class extends h$q{render(){return ke$1`${template$4(this)}`}};PluginBusyList.styles=i$y`
6283
6283
  ${r$H(styles$3)}
6284
- `,PluginBusyList=__decorateClass$9([t$j("plugin-busy-list")],PluginBusyList);var __defProp$8=Object.defineProperty,__getOwnPropDesc$8=Object.getOwnPropertyDescriptor,__decorateClass$8=(J,W,X,te)=>{for(var re=te>1?void 0:te?__getOwnPropDesc$8(W,X):W,ne=J.length-1,oe;ne>=0;ne--)(oe=J[ne])&&(re=(te?oe(W,X,re):oe(re))||re);return te&&re&&__defProp$8(W,X,re),re},__decorateParam$2=(J,W)=>(X,te)=>W(X,te,J);let ExitShellHandler=class{constructor(J){this.api=J}async handle(J){try{const W=this.api.pluginBusyManager.getBusyPluginTasks();if(W.length>0){const{confirmed:X}=await this.askForClose(W);if(!X)return}disposeShell(),await Promise.race([disposePlugins(),this.timeout(5e3)]),raiseCloseEvent()}catch(W){this.api.notificationService.error(W.message)}}askForClose(J){return this.api.interactionService.confirm({busyTasks:J},PluginBusyList,{title:translate$1("actions.askExit"),state:"error",confirmButtonText:"Sí",cancelButtonText:"No"})}timeout(J){return new Promise(W=>setTimeout(W,J))}};ExitShellHandler=__decorateClass$8([__decorateParam$2(0,inject(TYPES$1.primaryApi))],ExitShellHandler);let request$1;const bootstrapExitShell=()=>{teardownExitShell(),request$1=registerRequest(shellApi,container$1)(ExitShell,ExitShellHandler)},teardownExitShell=()=>{request$1==null||request$1.dispose()};var __defProp$7=Object.defineProperty,__getOwnPropDesc$7=Object.getOwnPropertyDescriptor,__decorateClass$7=(J,W,X,te)=>{for(var re=te>1?void 0:te?__getOwnPropDesc$7(W,X):W,ne=J.length-1,oe;ne>=0;ne--)(oe=J[ne])&&(re=(te?oe(W,X,re):oe(re))||re);return te&&re&&__defProp$7(W,X,re),re},__decorateParam$1=(J,W)=>(X,te)=>W(X,te,J);let GetUserInfoBackendAdapter=class{constructor(J){this.api=J}getUserInfo(){var X;const J=jwtDecode(this.api.tokenManager.getToken()),W={userId:J.access_info.trace_user_id,firstName:J.access_info.trace_user_given_name,familyName:J.access_info.trace_user_family_name,lastName:J.access_info.trace_user_last_name,registrationNumber:(X=J.access_info.identifier.find(te=>te.type==="NUMCOL"))==null?void 0:X.value,workCenter:J.access_info.center_code,role:J.access_info.role_type,speciality:J.access_info.professional_category};return Promise.resolve(W)}};GetUserInfoBackendAdapter=__decorateClass$7([injectable(),__decorateParam$1(0,inject(TYPES$1.primaryApi))],GetUserInfoBackendAdapter);var __defProp$6=Object.defineProperty,__getOwnPropDesc$6=Object.getOwnPropertyDescriptor,__decorateClass$6=(J,W,X,te)=>{for(var re=te>1?void 0:te?__getOwnPropDesc$6(W,X):W,ne=J.length-1,oe;ne>=0;ne--)(oe=J[ne])&&(re=(te?oe(W,X,re):oe(re))||re);return te&&re&&__defProp$6(W,X,re),re},__decorateParam=(J,W)=>(X,te)=>W(X,te,J);let GetUserInfoHandler=class{constructor(J,W){this.api=J,this.backendAdapter=W}async handle(J){try{const W=await this.backendAdapter.getUserInfo();return this.api.globalStateManager.setData("userInfo",W),W}catch(W){this.api.notificationService.error(W.message)}}};GetUserInfoHandler=__decorateClass$6([__decorateParam(0,inject(TYPES$1.primaryApi)),__decorateParam(1,inject(GetUserInfoBackendAdapter))],GetUserInfoHandler);class GetUserInfo{}let request;const bootstrapGetUserInfo=()=>{teardownGetUserInfo(),request=registerRequest(shellApi,container$1)(GetUserInfo,GetUserInfoHandler),registerDep(GetUserInfoBackendAdapter)},teardownGetUserInfo=()=>{request==null||request.dispose(),unregisterDep(GetUserInfoBackendAdapter)},bootstrapFeatures=J=>{container$1.bind(TYPES$1.primaryApi).toConstantValue(J),bootstrapGetUserInfo(),bootstrapExitShell(),J.broker.send(new GetUserInfo)},teardownFeatures=J=>{teardownGetUserInfo(),teardownExitShell(),container$1.unbindAll(),J.regionManager._destroy(),mediatorSettings.resolver.clear()},disposeShell=()=>{teardownFeatures(shellApi)},raiseCloseEvent=()=>{shellApi.ecapEventManager.publish("CLOSE_FORM","",{})};var __defProp$5=Object.defineProperty,__getOwnPropDesc$5=Object.getOwnPropertyDescriptor,__decorateClass$5=(J,W,X,te)=>{for(var re=te>1?void 0:te?__getOwnPropDesc$5(W,X):W,ne=J.length-1,oe;ne>=0;ne--)(oe=J[ne])&&(re=(te?oe(W,X,re):oe(re))||re);return te&&re&&__defProp$5(W,X,re),re};let PrimariaShell=class extends PrimariaRegionHost(h$q){constructor(){super(...arguments),this.sidebarExpanded=!1,this.viewSelected=shellViews.shell,this.quickActionBusy=!1,this.subscriptions=[]}render(){return ke$1`${template$g(this)}`}connectedCallback(){super.connectedCallback(),this._subscribeEvents()}disconnectedCallback(){super.disconnectedCallback(),this._unsubscribeEvents()}firstUpdated(){super.firstUpdated(),setTimeout(()=>{activateDefaultView()},300)}_toggleSidebar(){this.sidebarExpanded=!this.sidebarExpanded}_subscribeEvents(){this.subscriptions.push(shellApi.broker.subscribe(shellEvents.appCrashed,J=>{this._handleError(J)})),this.subscriptions.push(shellApi.broker.subscribe(shellEvents.refreshTokenFailed,J=>{this._handleError({message:translate$1("errors.session")})})),this.subscriptions.push(shellApi.broker.subscribe(shellEvents.mpidHeaderInvalid,J=>{this._handleError({message:translate$1("errors.invalidPatient")})})),this.subscriptions.push(shellApi.broker.subscribe(shellEvents.quickActionBusyChanged,J=>{this.quickActionBusy=J.busy}))}_handleError(J){this.viewSelected=shellViews.error,this.error=J,disposeShell()}_unsubscribeEvents(){this.subscriptions.forEach(J=>J.dispose())}};PrimariaShell.styles=i$y`
6284
+ `,PluginBusyList=__decorateClass$9([t$j("plugin-busy-list")],PluginBusyList);var __defProp$8=Object.defineProperty,__getOwnPropDesc$8=Object.getOwnPropertyDescriptor,__decorateClass$8=(J,W,X,te)=>{for(var re=te>1?void 0:te?__getOwnPropDesc$8(W,X):W,ne=J.length-1,oe;ne>=0;ne--)(oe=J[ne])&&(re=(te?oe(W,X,re):oe(re))||re);return te&&re&&__defProp$8(W,X,re),re},__decorateParam$2=(J,W)=>(X,te)=>W(X,te,J);let ExitShellHandler=class{constructor(J){this.api=J}async handle(J){try{const W=this.api.pluginBusyManager.getBusyPluginTasks();if(W.length>0){const{confirmed:X}=await this.askForClose(W);if(!X)return}await Promise.race([disposePlugins(),this.timeout(5e3)]),disposeShell(),raiseCloseEvent()}catch(W){this.api.notificationService.error(W.message),raiseCloseEvent()}}askForClose(J){return this.api.interactionService.confirm({busyTasks:J},PluginBusyList,{title:translate$1("actions.askExit"),state:"error",confirmButtonText:"Sí",cancelButtonText:"No"})}timeout(J){return new Promise(W=>setTimeout(W,J))}};ExitShellHandler=__decorateClass$8([__decorateParam$2(0,inject(TYPES$1.primaryApi))],ExitShellHandler);let request$1;const bootstrapExitShell=()=>{teardownExitShell(),request$1=registerRequest(shellApi,container$1)(ExitShell,ExitShellHandler)},teardownExitShell=()=>{request$1==null||request$1.dispose()};var __defProp$7=Object.defineProperty,__getOwnPropDesc$7=Object.getOwnPropertyDescriptor,__decorateClass$7=(J,W,X,te)=>{for(var re=te>1?void 0:te?__getOwnPropDesc$7(W,X):W,ne=J.length-1,oe;ne>=0;ne--)(oe=J[ne])&&(re=(te?oe(W,X,re):oe(re))||re);return te&&re&&__defProp$7(W,X,re),re},__decorateParam$1=(J,W)=>(X,te)=>W(X,te,J);let GetUserInfoBackendAdapter=class{constructor(J){this.api=J}getUserInfo(){var X;const J=jwtDecode(this.api.tokenManager.getToken()),W={userId:J.access_info.trace_user_id,firstName:J.access_info.trace_user_given_name,familyName:J.access_info.trace_user_family_name,lastName:J.access_info.trace_user_last_name,registrationNumber:(X=J.access_info.identifier.find(te=>te.type==="NUMCOL"))==null?void 0:X.value,workCenter:J.access_info.center_code,role:J.access_info.role_type,speciality:J.access_info.professional_category};return Promise.resolve(W)}};GetUserInfoBackendAdapter=__decorateClass$7([injectable(),__decorateParam$1(0,inject(TYPES$1.primaryApi))],GetUserInfoBackendAdapter);var __defProp$6=Object.defineProperty,__getOwnPropDesc$6=Object.getOwnPropertyDescriptor,__decorateClass$6=(J,W,X,te)=>{for(var re=te>1?void 0:te?__getOwnPropDesc$6(W,X):W,ne=J.length-1,oe;ne>=0;ne--)(oe=J[ne])&&(re=(te?oe(W,X,re):oe(re))||re);return te&&re&&__defProp$6(W,X,re),re},__decorateParam=(J,W)=>(X,te)=>W(X,te,J);let GetUserInfoHandler=class{constructor(J,W){this.api=J,this.backendAdapter=W}async handle(J){try{const W=await this.backendAdapter.getUserInfo();return this.api.globalStateManager.setData("userInfo",W),W}catch(W){this.api.notificationService.error(W.message)}}};GetUserInfoHandler=__decorateClass$6([__decorateParam(0,inject(TYPES$1.primaryApi)),__decorateParam(1,inject(GetUserInfoBackendAdapter))],GetUserInfoHandler);class GetUserInfo{}let request;const bootstrapGetUserInfo=()=>{teardownGetUserInfo(),request=registerRequest(shellApi,container$1)(GetUserInfo,GetUserInfoHandler),registerDep(GetUserInfoBackendAdapter)},teardownGetUserInfo=()=>{request==null||request.dispose(),unregisterDep(GetUserInfoBackendAdapter)},bootstrapFeatures=J=>{container$1.bind(TYPES$1.primaryApi).toConstantValue(J),bootstrapGetUserInfo(),bootstrapExitShell(),J.broker.send(new GetUserInfo)},teardownFeatures=J=>{teardownGetUserInfo(),teardownExitShell(),container$1.unbindAll(),J.regionManager._destroy(),mediatorSettings.resolver.clear()},disposeShell=()=>{teardownFeatures(shellApi)},raiseCloseEvent=()=>{shellApi.ecapEventManager.publish("CLOSE_FORM","",{})};var __defProp$5=Object.defineProperty,__getOwnPropDesc$5=Object.getOwnPropertyDescriptor,__decorateClass$5=(J,W,X,te)=>{for(var re=te>1?void 0:te?__getOwnPropDesc$5(W,X):W,ne=J.length-1,oe;ne>=0;ne--)(oe=J[ne])&&(re=(te?oe(W,X,re):oe(re))||re);return te&&re&&__defProp$5(W,X,re),re};let PrimariaShell=class extends PrimariaRegionHost(h$q){constructor(){super(...arguments),this.sidebarExpanded=!1,this.viewSelected=shellViews.shell,this.quickActionBusy=!1,this.subscriptions=[]}render(){return ke$1`${template$g(this)}`}connectedCallback(){super.connectedCallback(),this._subscribeEvents()}disconnectedCallback(){super.disconnectedCallback(),this._unsubscribeEvents()}firstUpdated(){super.firstUpdated(),setTimeout(()=>{activateDefaultView()},300)}_toggleSidebar(){this.sidebarExpanded=!this.sidebarExpanded}_subscribeEvents(){this.subscriptions.push(shellApi.broker.subscribe(shellEvents.appCrashed,J=>{this._handleError(J)})),this.subscriptions.push(shellApi.broker.subscribe(shellEvents.refreshTokenFailed,J=>{this._handleError({message:translate$1("errors.session")})})),this.subscriptions.push(shellApi.broker.subscribe(shellEvents.mpidHeaderInvalid,J=>{this._handleError({message:translate$1("errors.invalidPatient")})})),this.subscriptions.push(shellApi.broker.subscribe(shellEvents.quickActionBusyChanged,J=>{this.quickActionBusy=J.busy}))}_handleError(J){this.viewSelected=shellViews.error,this.error=J,disposeShell()}_unsubscribeEvents(){this.subscriptions.forEach(J=>J.dispose())}};PrimariaShell.styles=i$y`
6285
6285
  ${r$H(styles$g)}
6286
6286
  `,__decorateClass$5([s$w({targetId:"menu-region-container",name:shellRegions.navigationMenu})],PrimariaShell.prototype,"navigationMenuRegion",2),__decorateClass$5([s$w({targetId:"main-region-container",name:shellRegions.main})],PrimariaShell.prototype,"mainRegion",2),__decorateClass$5([s$w({targetId:"quick-actions-region-container",name:shellRegions.quickActions})],PrimariaShell.prototype,"quickActionsRegion",2),__decorateClass$5([s$w({targetId:"floating-region-container",name:shellRegions.floating})],PrimariaShell.prototype,"floatingRegion",2),__decorateClass$5([s$w({targetId:"navigation-menu-lower-region-container",name:shellRegions.navigationLowerLeftMenu})],PrimariaShell.prototype,"navLowerLeftMenu",2),__decorateClass$5([r$E()],PrimariaShell.prototype,"sidebarExpanded",2),__decorateClass$5([r$E()],PrimariaShell.prototype,"viewSelected",2),__decorateClass$5([r$E()],PrimariaShell.prototype,"error",2),__decorateClass$5([r$E()],PrimariaShell.prototype,"quickActionBusy",2),PrimariaShell=__decorateClass$5([t$j("primaria-shell")],PrimariaShell);const initializeShell=J=>{initializeLocalization$1(shellApi),p$h.registerAdapterFactory("primaria-content-switcher",d$v);const W=new PrimariaShell;J.appendChild(W),registerInternalViews(),bootstrapFeatures(shellApi)};var __defProp$4=Object.defineProperty,__getOwnPropDesc$4=Object.getOwnPropertyDescriptor,__decorateClass$4=(J,W,X,te)=>{for(var re=te>1?void 0:te?__getOwnPropDesc$4(W,X):W,ne=J.length-1,oe;ne>=0;ne--)(oe=J[ne])&&(re=(te?oe(W,X,re):oe(re))||re);return te&&re&&__defProp$4(W,X,re),re};const isSelected=(J,W,X)=>J[W]===X||Array.from(J.attributes).some(te=>te.name===W&&te.value===X);exports.PrimariaContentSwitcher=class extends h$q{constructor(){super(...arguments),this.animation="fade"}render(){return ke$1` <slot></slot> `}updated(W){this.select()}get items(){return this.children}selectIndex(){return this.selected||this.selected===0?this.attrForSelected?Array.from(this.items).findIndex(W=>isSelected(W,this.attrForSelected,this.selected)):Number.parseInt(this.selected):-1}select(){var W;if(this.items.length){const X=this.selectIndex();if(X!==-1){const te=Array.from(this.items);te.forEach(re=>re.classList.remove("selected")),(W=te[X])==null||W.classList.add("selected")}}}doAnimation(W){switch(this.animation){case"fade":return W==null?void 0:W.classList.add("fade-in");case"slideDown":return W==null?void 0:W.classList.add("slide-down");case"slideLeft":return W==null?void 0:W.classList.add("slide-left");case"slideRight":return W==null?void 0:W.classList.add("slide-right");case"disabled":return;default:return W==null?void 0:W.classList.add("fade-in")}}},exports.PrimariaContentSwitcher.styles=i$y`
6287
6287
  :host {