1/*! For license information please see 5096.5fa37bf8b8ae7dd077fd.js.LICENSE.txt */ 2(self.webpackChunk_web_channels_ebank_domain_application=self.webpackChunk_web_channels_ebank_domain_application||[]).push([[5096],{5096:(e,t,n)=>{"use strict";n.r(t),n.d(t,{MicroAppIntentHandler:()=>M,MicroAppOutlet:()=>U,SimpleChannelEventsProvider:()=>d,addStyleInjectionRoot:()=>$,channelData:()=>P,default:()=>U,events:()=>f,isCancelIntentResult:()=>L,isErrorIntentResult:()=>k,isOkIntentResult:()=>V,useAllEventPayloads:()=>E,useEmit:()=>h,useEventListener:()=>v,useEventPayload:()=>m,useProvideFeatures:()=>A,useSendIntent:()=>D});var r=n(1556),o=n.n(r),s=n(1121),i=n(269);function c(e,t,n,r){return new(n||(n=Promise))(function(o,s){function i(e){try{a(r.next(e))}catch(e){s(e)}}function c(e){try{a(r.throw(e))}catch(e){s(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(i,c)}a((r=r.apply(e,t||[])).next())})}const a=e=>{const t=(0,r.useRef)(()=>{});return(0,r.useLayoutEffect)(()=>{t.current=e}),(0,r.useCallback)((...e)=>(0,t.current)(...e),[])},u=o().createContext(void 0),l=()=>{let e={},t=0;return{emit:(t,n)=>{void 0!==e[t]&&Object.values(e[t]).forEach(e=>e(n))},listen:(n,r)=>{t++;const o=t;return e=Object.assign(Object.assign({},e),{[n]:Object.assign(Object.assign({},e[n]),{[o]:r})}),()=>{const t=e[n],r=o;t[r];const s=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(t,["symbol"==typeof r?r:r+""]);e=Object.assign(Object.assign({},e),{[n]:s})}}}},d=({children:e})=>{const[t]=(0,r.useState)(l);return(0,i.jsx)(u.Provider,Object.assign({value:t},{children:e}))},f={id:s.EVENTS_FEATURE_ID,useValue:()=>(0,r.useContext)(u)};function p(e){const t=(0,r.useContext)(u);if(void 0===t&&void 0!==e)throw new Error(e);return t}const h=()=>p("useEmit is supposed to be used in a channel that provides a ChannelEventsContext.").emit,v=(e,t)=>{const n=a(t),o=p("useEventListener is supposed to be used in a channel that provides a ChannelEventsContext."),{listen:s}=o;(0,r.useEffect)(()=>{const t=s(e,(...e)=>{n(...e)});return()=>t()},[e])};function m(e){const[t,n]=(0,r.useState)();return v(e,e=>n(e)),t}function E(e){const[t,n]=(0,r.useState)();return v(e,e=>n(void 0===t?[e]:t.concat(e))),t}var y=n(603),_=n.n(y),b=n(2947),g=n(8500);class I extends Error{constructor(e,t){super(`Could not find remote container by name "${t}" nor by its deprecared name "${e}".`),this.containerName=e,this.newRemoteContainerName=t}}class O extends Error{constructor(e,t,n){super(`Could not load module ${n} in micro app ${t.name}. ${O.getReasonDescription(e,t)}`),this.cause=e,this.config=t,this.modulePath=n}static getReasonDescription(e,t){return e instanceof I?`Make sure the micro app name "${t.name}" matches with the name specified in the micro app manifest file.`:e instanceof Error?e.message:`${e}`}}class T extends Error{constructor(e){super(`Micro app code doesn't seem to be loaded properly. Make sure the micro app source URL ${e.sourceUrl} is correct (should end with '/remoteEntry.js'), \n or look for the execution errors in the console.`),this.config=e}}function x(e,t){return c(this,void 0,void 0,function*(){return yield _()(e.sourceUrl),function(e,t){return c(this,void 0,void 0,function*(){yield n.I("default");const r=window[`MicroApp_${e}`];if(!r)throw new I(e,`MicroApp_${e}`);return yield r.init(n.S.default),(yield r.get(t))()})}(e.name,t).catch(n=>{if(n instanceof I)throw new O(n,e,t);throw n})})}function C(e){return c(this,void 0,void 0,function*(){return x(e,"./index")})}function N(e){return c(this,void 0,void 0,function*(){return x(e,"./manifest")})}function w(e){return c(this,void 0,void 0,function*(){return x(e,"./bootstrap").catch(()=>null).then(e=>e&&("default"in e?e.default:e.bootstrap))})}const R=()=>Object.keys(window).filter(e=>e.startsWith("MicroApp_"));function A(e=[]){const t=e.map(e=>({feature:e,value:S(e.useValue())})),[n]=(0,r.useState)(()=>t.map(({feature:e,value:t})=>({id:e.id,type:"observable",value:t})));return n}function S(e){const[[t,n]]=(0,r.useState)(()=>(0,b.createSubject)({initial:e})),o=t;return(0,r.useEffect)(()=>{o.value=e,n.next(e)},[e]),o}const j=({config:e,features:t=[],renderError:o=e=>`${e}`,renderLoading:u=()=>"Loading...",elementType:l="span"})=>{const d=(0,r.useRef)(null),f=(0,r.useRef)(null),[p,h]=(0,r.useState)(null),[v,m]=(0,r.useState)(!0),E=(0,r.useRef)(void 0),y=(0,r.useRef)(0),_=function({config:e}){return function(e,t){const[n,o]=(0,r.useState)({state:"loading"}),s=(0,r.useRef)(void 0),i=a(e),c=(0,r.useCallback)(()=>{o({state:"loading"});const e=i();s.current=e,e.then(t=>{s.current===e&&o({state:"resolved",value:t})}).catch(t=>{s.current===e&&o({state:"error",retry:c,error:t})})},[]);return(0,r.useEffect)(c,t),n}(()=>function(e){return c(this,void 0,void 0,function*(){const t=R(),[n,r,o]=yield Promise.all([C(e),N(e),w(e)]).c
2atch(n=>{const r=t.length===R().length;if(n instanceof O&&r)throw new T(e);throw n});return{index:n,manifest:r,bootstrap:o}})}(e),[e.sourceUrl,e.name])}({config:e}),b=A(t.concat((()=>{try{const e=n(6903),{focusContexts:t,overlaysContexts:o}=e;if(t&&o){const e={focusContexts:t,overlaysContexts:o};return{id:s.SAPPHIRE_FEATURE_ID,useValue:()=>({focusContextValues:e.focusContexts.map(e=>(0,r.useContext)(e)),overlayContextValues:e.overlaysContexts.map(e=>(0,r.useContext)(e))})}}return console.warn('In order for Sapphire to work as expected in micro apps, you should build your channel and micro app with "@channel-devkit/[email protected]" or higher.'),null}catch(e){return null}})()||[])),g=p||("error"===_.state?_.error:null),I=()=>c(void 0,void 0,void 0,function*(){var t,n;if(h(null),m(!0),"resolved"===_.state){null===(t=E.current)||void 0===t||t.call(E);const{bootstrap:r,index:o}=_.value,s=f.current;if(f.current=document.createElement(l),f.current.dataset.microAppRoot=e.name,null===(n=d.current)||void 0===n||n.after(f.current),null==s||s.remove(),!r){const t="@channel-devkit/[react|angular]-scripts";return void h(new Error(`Could not find micro app's bootstrap function for micro app ${e.name}. Make sure it's built with the latest version of ${t}.`))}const i=++y.current;try{const e=yield Promise.resolve(r({microAppModule:o,providedFeatures:b,root:f.current,onError:e=>h(e)}));if(y.current!==i)return void(null==e||e());E.current=()=>{var t;E.current=void 0,null==e||e(),null===(t=f.current)||void 0===t||t.remove(),f.current=null}}catch(e){y.current===i&&h(e)}finally{y.current===i&&m(!1)}}});return(0,r.useEffect)(()=>()=>{var e,t;y.current++,null===(e=E.current)||void 0===e||e.call(E),null===(t=f.current)||void 0===t||t.remove(),f.current=null},[]),(0,r.useEffect)(()=>{"error"===_.state&&console.error(_.error),I()},[_.state]),(0,r.useEffect)(()=>{var e;g&&(null===(e=E.current)||void 0===e||e.call(E))},[g]),(0,i.jsx)("span",Object.assign({ref:d},{children:g?o(g,()=>{"error"===_.state&&_.retry(),I()}):"loading"===_.state||v?u():null}))},P=e=>({id:s.CHANNEL_DATA_FEATURE_ID,useValue:()=>e}),M=({microAppConfigs:e,onMissingHandler:t=e=>{console.error("No intent handler found for intent:",e)},renderMicroAppOverlay:n,microAppProps:l,hasTransition:d=!1,closeTransitionTimeout:f=1e3})=>{const[p,h]=function(){const[e,t]=(0,r.useState)([]),n=(0,r.useRef)(!1);return(0,r.useEffect)(()=>(n.current=!1,()=>{n.current=!0}),[]),[e,(0,r.useCallback)(e=>{n.current||t(e)},[t])]}(),[v,m]=(0,r.useState)(),E=(0,r.useRef)({});(0,r.useEffect)(()=>{m(Promise.all(e.map(e=>(E.current[e.name]||(E.current[e.name]=N(e).then(t=>({manifest:t,config:e})).catch(()=>null)),E.current[e.name]))).then(e=>e.filter(e=>Boolean(e))))},e.map(e=>e.name));const y=(0,r.useContext)(u);if(!y)throw new Error("MicroAppIntentHandler requires ChannelEventsContext. You need to render SimpleChannelEventsProvider (or another implementation) in a parent component, in your channel");const{emit:_,listen:b}=y,g=a(e=>c(void 0,void 0,void 0,function*(){if(!v)throw Error("Unexpected state. Intent event received before starting to fetch micro app manifests");const n=yield v,{config:r}=n.find(({manifest:t})=>{var n;return null===(n=t.handledIntents)||void 0===n?void 0:n.includes(e.intent.name)})||{};if(r){const t={config:r,sentIntent:e,isOpen:!d};h(e=>e.concat([t])),d&&setTimeout(()=>{h(e=>e.map(e=>e===t?Object.assign(Object.assign({},e),{isOpen:!0}):e))},0)}else _(s.INTENT_RESULT_EVENT_NAME,{sentIntent:e,result:(0,s.errorIntentResult)(`No handler found for intent: ${e.intent.name}`)}),t(e.intent)})),I=e=>{h(t=>t.every(t=>t.sentIntent.senderId!==e)?t:t.filter(({sentIntent:t})=>t.senderId!==e))},O=a(({sentIntent:e})=>{d?(h(t=>t.map(t=>t.sentIntent.senderId!==e.senderId?t:Object.assign(Object.assign({},t),{isOpen:!1}))),setTimeout(()=>{I(e.senderId)},f)):I(e.senderId)});return(0,r.useEffect)(()=>{const e=[b(s.INTENT_SEND_EVENT_NAME,g),b(s.INTENT_RESULT_EVENT_NAME,O)];return()=>{e.map(e=>e())}},[]),(0,i.jsx)(i.Fragment,{children:p.map(({config:e,sentIntent:t,isOpen:r},c)=>{const a=l?l(e):{},u=(d=t,{id:s.STARTING_INTENT_FEATURE_ID,useValue:()=>d});var d;return(0,i.jsx)(o().Fragment,{children:n({isOpen:r,onCloseTransitionDone:()=>{I(t.senderId)},onClose:()=>{(e=>{_(s.INTENT_RESULT_EVENT_NAME,{sentIntent:e,result:(0,s.cancelIntentResult)()})})(t)},renderedMicroApp:(0,i.jsx)(j,Object.assign({},a,{config:e,features:Array.isArray(a.features)?a.features.concat(u):[u]})),microAppConfig:e,index:c})},t.senderId)})})},k=e=>"ERROR"===e.code,L=e=>"CANCEL"===e.code,V=e=>"OK"===e.code,D=()=>{const e=h(),t=(0,r.useRef)({});return v(s.INTENT_RESULT_EVENT_NAME,e=>{const n=t.current[e.sentIntent.senderId];n&&(n.resolve(e.result),delete t.current[e.sentIntent.senderId])}),(0,r.useEffect)(()=>()=>{Object.values(t.current).forEach(({intent:e})=>{console.warn("Didn't receive any result for intent: ",e)})},[]),(n,r)=>{const o=(0,g.A)(),i={name:n,payload:r};return e(s.INTENT_SEND_EVENT_NAME,{intent:i,senderId:o}),new Promise(e=>{t.current[o]={resolve:e,intent:i}})}};function $({rootElementName:e,rootElement:t}){const n=window,r={[e]:t};n.STYLE_INJECTION_ROOTS=Object.assign(Object.assign({},r),n.STYLE_INJECTION_ROOTS)}const U=function(e){const t=n=>t.__DEV_TOOLS_WRAPPER__?(0,i.jsx)(t.__DEV_TOOLS_WRAPPER__,{props:n,original:e}):(0,i.jsx)(e,Object.assign({},n));return t.__DEV_TOOLS_WRAPPER__=null,t.displayName=`WithDevTools(${e.displayName||e.name})`,t}(j)},6903:(e,t,n)=>{"use strict";n.r(t),n.d(t,{focusContexts:()=>r,overlaysContexts:()=>s});const r=n(8208).Qz;var o=n(8699);n(3799);const s=[o.createContext(null)]},1494:e=>{function t(e,t){e.onload=function(){this.onerror=this.onload=null,t(null,e)},e.onerror=function(){this.onerror=this.onload=null,t(new Error("Failed to load "+this.src),e)}}function n(e,t){e.onreadystatechange=function(){"complete"!=this.readyState&&"loaded"!=this.readyState||(this.onreadystatechange=null,t(null,e))}}e.exports=function(e,r,o){var s=document.head||document.getElementsByTagName("head")[0],i=document.createElement("script");"function"==typeof r&&(o=r,r={}),r=r||{},o=o||function(){},i.type=r.type||"text/javascript",i.charset=r.charset||"utf8",i.async=!("async"in r)||!!r.async,i.src=e,r.attrs&&function(e,t){for(var n in t)e.setAttribute(n,t[n])}(i,r.attrs),r.text&&(i.text=""+r.text),("onload"in i?t:n)(i,o),i.onload||t(i,o),s.appendChild(i)}},603:(e,t,n)=>{"use strict";var r=n(1494),o={};e.exports=function(e,t){var n=o[e];return n||(n=o[e]=function(e){return new Promise(function(t,n){r(e,function(e){if(e)return n(e);t()})})}(e),n.catch(function(){delete o[e]})),t&&n.then(t,t),n}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.