@luigi-project/core
Version:
Javascript library supporting consumers of the Luigi framework
1 lines • 577 kB
JavaScript
var e=Object.defineProperty,t=(t,n,i)=>((t,n,i)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[n]=i)(t,"symbol"!=typeof n?n+"":n,i);function n(){}function i(e){return e()}function r(){return Object.create(null)}function o(e){e.forEach(i)}function a(e){return"function"==typeof e}function l(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}let s;function c(e,t){return e===t||(s||(s=document.createElement("a")),s.href=t,e===s.href)}function d(e,...t){if(null==e){for(const e of t)e(void 0);return n}const i=e.subscribe(...t);return i.unsubscribe?()=>i.unsubscribe():i}function u(e){let t;return d(e,e=>t=e)(),t}function f(e,t,n){e.$$.on_destroy.push(d(t,n))}function p(e,t,n,i){if(e){const r=g(e,t,n,i);return e[0](r)}}function g(e,t,n,i){return e[1]&&i?function(e,t){for(const n in t)e[n]=t[n];return e}(n.ctx.slice(),e[1](i(t))):n.ctx}function h(e,t,n,i){return e[2],t.dirty}function m(e,t,n,i,r,o){if(r){const a=g(t,n,i,o);e.p(a,r)}}function v(e){if(e.ctx.length>32){const t=[],n=e.ctx.length/32;for(let e=0;e<n;e++)t[e]=-1;return t}return-1}function b(e){return null==e?"":e}function _(e){return e&&a(e.destroy)?e.destroy:n}const w="undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:global;function y(e,t){e.appendChild(t)}function C(e,t,n){e.insertBefore(t,n||null)}function S(e){e.parentNode&&e.parentNode.removeChild(e)}function x(e,t){for(let n=0;n<e.length;n+=1)e[n]&&e[n].d(t)}function N(e){return document.createElement(e)}function k(e){return document.createTextNode(e)}function P(){return k(" ")}function I(){return k("")}function T(e,t,n,i){return e.addEventListener(t,n,i),()=>e.removeEventListener(t,n,i)}function L(e){return function(t){return t.preventDefault(),e.call(this,t)}}function A(e){return function(t){return t.stopPropagation(),e.call(this,t)}}function E(e,t,n){null==n?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function V(e,t){t=""+t,e.data!==t&&(e.data=t)}function R(e,t){e.value=null==t?"":t}function D(e,t,n,i){null==n?e.style.removeProperty(t):e.style.setProperty(t,n,"")}function O(e,t,n){e.classList.toggle(t,!!n)}class F{constructor(e=!1){t(this,"is_svg",!1),t(this,"e"),t(this,"n"),t(this,"t"),t(this,"a"),this.is_svg=e,this.e=this.n=null}c(e){this.h(e)}m(e,t,n=null){var i;this.e||(this.is_svg?this.e=(i=t.nodeName,document.createElementNS("http://www.w3.org/2000/svg",i)):this.e=N(11===t.nodeType?"TEMPLATE":t.nodeName),this.t="TEMPLATE"!==t.tagName?t:t.content,this.c(e)),this.i(n)}h(e){this.e.innerHTML=e,this.n=Array.from("TEMPLATE"===this.e.nodeName?this.e.content.childNodes:this.e.childNodes)}i(e){for(let t=0;t<this.n.length;t+=1)C(this.t,this.n[t],e)}p(e){this.d(),this.h(e),this.i(this.a)}d(){this.n.forEach(S)}}let M;function U(e){M=e}function z(){if(!M)throw new Error("Function called outside component initialization");return M}function B(e){z().$$.before_update.push(e)}function j(e){z().$$.on_mount.push(e)}function H(e){z().$$.after_update.push(e)}function W(e){z().$$.on_destroy.push(e)}function q(){const e=z();return(t,n,{cancelable:i=!1}={})=>{const r=e.$$.callbacks[t];if(r){const o=function(e,t,{bubbles:n=!1,cancelable:i=!1}={}){return new CustomEvent(e,{detail:t,bubbles:n,cancelable:i})}(t,n,{cancelable:i});return r.slice().forEach(t=>{t.call(e,o)}),!o.defaultPrevented}return!0}}function G(e,t){return z().$$.context.set(e,t),t}function K(e){return z().$$.context.get(e)}function J(e,t){const n=e.$$.callbacks[t.type];n&&n.slice().forEach(e=>e.call(this,t))}const Y=[],Q=[];let Z=[];const X=[],ee=Promise.resolve();let te=!1;function ne(e){Z.push(e)}function ie(e){X.push(e)}const re=new Set;let oe=0;function ae(){if(0!==oe)return;const e=M;do{try{for(;oe<Y.length;){const e=Y[oe];oe++,U(e),le(e.$$)}}catch(t){throw Y.length=0,oe=0,t}for(U(null),Y.length=0,oe=0;Q.length;)Q.pop()();for(let e=0;e<Z.length;e+=1){const t=Z[e];re.has(t)||(re.add(t),t())}Z.length=0}while(Y.length);for(;X.length;)X.pop()();te=!1,re.clear(),U(e)}function le(e){if(null!==e.fragment){e.update(),o(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(ne)}}const se=new Set;let ce;function de(){ce={r:0,c:[],p:ce}}function ue(){ce.r||o(ce.c),ce=ce.p}function fe(e,t){e&&e.i&&(se.delete(e),e.i(t))}function pe(e,t,n,i){if(e&&e.o){if(se.has(e))return;se.add(e),ce.c.push(()=>{se.delete(e),i&&(n&&e.d(1),i())}),e.o(t)}else i&&i()}function ge(e,t){const n=t.token={};function i(e,i,r,o){if(t.token!==n)return;t.resolved=o;let a=t.ctx;void 0!==r&&(a=a.slice(),a[r]=o);const l=e&&(t.current=e)(a);let s=!1;t.block&&(t.blocks?t.blocks.forEach((e,n)=>{n!==i&&e&&(de(),pe(e,1,1,()=>{t.blocks[n]===e&&(t.blocks[n]=null)}),ue())}):t.block.d(1),l.c(),fe(l,1),l.m(t.mount(),t.anchor),s=!0),t.block=l,t.blocks&&(t.blocks[i]=l),s&&ae()}if(!(r=e)||"object"!=typeof r&&"function"!=typeof r||"function"!=typeof r.then){if(t.current!==t.then)return i(t.then,1,t.value,e),!0;t.resolved=e}else{const n=z();if(e.then(e=>{U(n),i(t.then,1,t.value,e),U(null)},e=>{if(U(n),i(t.catch,2,t.error,e),U(null),!t.hasCatch)throw e}),t.current!==t.pending)return i(t.pending,0),!0}var r}function he(e,t,n){const i=t.slice(),{resolved:r}=e;e.current===e.then&&(i[e.value]=r),e.current===e.catch&&(i[e.error]=r),e.block.p(i,n)}function me(e){return void 0!==(null==e?void 0:e.length)?e:Array.from(e)}function ve(e,t,n){const i=e.$$.props[t];void 0!==i&&(e.$$.bound[i]=n,n(e.$$.ctx[i]))}function be(e){e&&e.c()}function _e(e,t,n){const{fragment:r,after_update:l}=e.$$;r&&r.m(t,n),ne(()=>{const t=e.$$.on_mount.map(i).filter(a);e.$$.on_destroy?e.$$.on_destroy.push(...t):o(t),e.$$.on_mount=[]}),l.forEach(ne)}function we(e,t){const n=e.$$;null!==n.fragment&&(!function(e){const t=[],n=[];Z.forEach(i=>-1===e.indexOf(i)?t.push(i):n.push(i)),n.forEach(e=>e()),Z=t}(n.after_update),o(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function ye(e,t){-1===e.$$.dirty[0]&&(Y.push(e),te||(te=!0,ee.then(ae)),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function Ce(e,t,i,a,l,s,c=null,d=[-1]){const u=M;U(e);const f=e.$$={fragment:null,ctx:[],props:s,update:n,not_equal:l,bound:r(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(u?u.$$.context:[])),callbacks:r(),dirty:d,skip_bound:!1,root:t.target||u.$$.root};c&&c(f.root);let p=!1;if(f.ctx=i?i(e,t.props||{},(t,n,...i)=>{const r=i.length?i[0]:n;return f.ctx&&l(f.ctx[t],f.ctx[t]=r)&&(!f.skip_bound&&f.bound[t]&&f.bound[t](r),p&&ye(e,t)),n}):[],f.update(),p=!0,o(f.before_update),f.fragment=!!a&&a(f.ctx),t.target){if(t.hydrate){const e=(g=t.target,Array.from(g.childNodes));f.fragment&&f.fragment.l(e),e.forEach(S)}else f.fragment&&f.fragment.c();t.intro&&fe(e.$$.fragment),_e(e,t.target,t.anchor),ae()}var g;U(u)}class Se{constructor(){t(this,"$$"),t(this,"$$set")}$destroy(){we(this,1),this.$destroy=n}$on(e,t){if(!a(t))return n;const i=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return i.push(t),()=>{const e=i.indexOf(t);-1!==e&&i.splice(e,1)}}$set(e){var t;this.$$set&&(t=e,0!==Object.keys(t).length)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}"undefined"!=typeof window&&(window.__svelte||(window.__svelte={v:new Set})).v.add("4");const xe=new class{constructor(){this.handles={},this.keyExistencyTimeout=2e4,this.keyExistencyCheckInterval=50}wrapAsPromise(e){return new Promise(t=>{t(e)})}applyFunctionPromisified(e,t){return e=e.apply(this,t),Et.isPromise(e)?e:this.wrapAsPromise(e)}getConfigValueFromObjectAsync(e,t,...n){let i=Et.getConfigValueFromObject(e,t);return Et.isFunction(i)?this.applyFunctionPromisified(i,n):this.wrapAsPromise(i)}};const $e=new class{convertCustomMessageInternalToUser(e){return e.data}convertCustomMessageUserToInternal(e){return{msg:"custom",data:e}}};const Ne=new class{constructor(){this.dataManagement=new Map}setChildren(e,t){this.dataManagement.set(e,t),this.navPath=""}getChildren(e){return e?this.dataManagement.get(e):{}}hasChildren(e){const t=this.getChildren(e);return t&&t.hasOwnProperty("children")}setRootNode(e){this.dataManagement.set("_luigiRootNode",{node:e})}getRootNode(){return this.dataManagement.get("_luigiRootNode")}hasRootNode(){return!!this.getRootNode()}deleteCache(){this.dataManagement.clear()}deleteNodesRecursively(e){if(this.hasChildren(e)){let t=this.getChildren(e).children;for(let e=0;e<t.length;e++)this.deleteNodesRecursively(t[e])}this.dataManagement.delete(e)}};const ke=new class{constructor(){this.configReadyCallback=function(){},this.initialized=!1,this.USER_SETTINGS_KEY="luigi.preferences.userSettings"}setConfigCallbacks(e){this.configReadyCallback=e}async setConfig(e){this.config=e,window.Luigi._store.update(()=>({config:e})),this._configModificationTimestamp=new Date,this.initialized||(this.initialized=!0,this.configReadyCallback().then(async()=>{Nt.luigiAfterInit(),await this.executeConfigFnAsync("lifecycleHooks.luigiAfterInit")}))}getConfig(){return this.config}configChanged(...e){const t=Dt.optimizeScope(e);t.length>0?t.forEach(e=>{window.Luigi._store.fire(e,{current:window.Luigi._store})}):window.Luigi._store.update(e=>e)}setErrorMessage(e){var t=document.createTextNode(e),n=document.createElement("div");n.setAttribute("class","fd-ui"),n.setAttribute("style","text-align: center;");var i=document.createElement("div");i.setAttribute("class","fd-message-strip fd-message-strip--error"),i.setAttribute("style","max-width: 800px; display: inline-block; margin-top: 40px;"),i.appendChild(t),n.appendChild(i),Ye.getLuigiContainer().appendChild(n)}getConfigValue(e){return Et.getConfigValueFromObject(this.getConfig(),e)}getConfigBooleanValue(e){const t=Et.getConfigValueFromObject(this.getConfig(),e);return!0===t||"true"===t}getConfigValueAsync(e,...t){return xe.getConfigValueFromObjectAsync(this.getConfig(),e,t)}async executeConfigFnAsync(e,t=!1,...n){const i=this.getConfigValue(e);if(Et.isFunction(i))try{return await xe.applyFunctionPromisified(i,n)}catch(r){if(t)return Promise.reject(r)}return Promise.resolve(void 0)}isAuthorizationEnabled(){return Je.isAuthorizationEnabled()}unload(){this.initialized=!1,window.Luigi._store.clear(),Pt.unload(),Ot.removeAllEventListeners();const e=Ye.getLuigiContainer();for(;e.firstChild;)e.removeChild(e.lastChild)}async readUserSettings(){const e=await this.getConfigValueAsync("userSettings"),t=e||await this.getConfigValueAsync("settings.userSettings");if(t&&Et.isFunction(t.readUserSettings))return t.readUserSettings();const n=localStorage.getItem(this.USER_SETTINGS_KEY);return n&&JSON.parse(n)}async storeUserSettings(e,t){const n=await this.getConfigValueAsync("userSettings"),i=n||await this.getConfigValueAsync("settings.userSettings");if(i&&Et.isFunction(i.storeUserSettings))return i.storeUserSettings(e,t);localStorage.setItem(this.USER_SETTINGS_KEY,JSON.stringify(e)),this.configChanged()}reset(){const e=this.getConfig();this.unload(),this.setConfig(e)}clearNavigationCache(){Ne.deleteCache();const e=t=>{t&&t.forEach&&t.forEach(t=>{t.titleResolver&&t.titleResolver._cache&&(t.titleResolver._cache=void 0),t.children&&e(t.children)})};e(this.getConfig().navigation.nodes)}setGlobalContext(e,t){this.config&&this.config.navigation&&(this.config.navigation.globalContext=e,t||this.configChanged("navigation"))}getGlobalContext(){var e,t;return(null==(t=null==(e=this.config)?void 0:e.navigation)?void 0:t.globalContext)||{}}updateContextValues(e){const t=At.getMicrofrontendIframes();if(t&&t.length>0&&t.forEach(t=>{t.luigi&&At.sendMessageToIframe(t,{msg:"luigi.navigate",context:JSON.stringify(Object.assign({},JSON.parse(t.luigi._lastUpdatedMessage.context),e)),nodeParams:t.luigi._lastUpdatedMessage.nodeParams,pathParams:JSON.stringify(Object.assign({},t.luigi.pathParams)),searchParams:JSON.stringify(Object.assign({},Rt.prepareSearchParamsForClient(t.luigi.currentNode))),internal:At.applyCoreStateData(JSON.parse(t.luigi._lastUpdatedMessage.internal))})}),document.querySelector(".wcContainer")){document.querySelectorAll("[lui_web_component=true]").forEach(t=>{t.context=Object.assign({},t.context,e)})}}};const Pe=new class{constructor(){}isAuthorizationEnabled(){return!!Ke.getConfigValue("auth.use")}login(){this.isAuthorizationEnabled()&&Pt.startAuthorization()}logout(){this.isAuthorizationEnabled()&&Pt.logout()}async handleAuthEvent(e,t,n,i){const r=await Ke.executeConfigFnAsync("auth.events."+e,!1,t,n);let o=void 0===r||!!r;if(!o||!i)return o;window.location.href=i}get store(){return Ke.initialized||console.warn("Luigi Core is not initialized yet. Consider moving your code to the luigiAfterInit lifecycle hook. Documentation: https://docs.luigi-project.io/docs/lifecycle-hooks"),{getStorageKey:()=>kt.getStorageKey(),getStorageType:()=>kt.getStorageType(),getAuthData:()=>kt.getAuthData(),setAuthData:e=>kt.setAuthData(e),removeAuthData:()=>kt.removeAuthData(),setNewlyAuthorized:()=>{kt.setNewlyAuthorized(),Pt.resetExpirationChecks()}}}},Ie=600,Te=[{type:"main",selector:".iframeContainer iframe"},{type:"split-view",selector:".iframeSplitViewCnt iframe"},{type:"modal",selector:".iframeModalCtn._modal iframe"},{type:"drawer",selector:".iframeModalCtn._drawer iframe"},{type:"user-settings",selector:".iframeUserSettingsCtn iframe"}],Le="[luigi-app-root]",Ae="[luigi-app-loading-indicator]";const Ee=new class{getLuigiContainer(){return this.getCustomLuigiContainer()||this.getDefaultLuigiContainer()}isCustomLuigiContainer(){return Boolean(this.getLuigiContainer()===this.getCustomLuigiContainer())}getCustomLuigiContainer(){return document.querySelector(Le)}getDefaultLuigiContainer(){return document.querySelector("body")}getShellbar(){return document.getElementsByClassName("lui-shellbar-wrapper")[0]}getShellbarActions(){return document.getElementsByClassName("lui-shellbar_group--actions")[0]}getMicrofrontends(){return At.getMicrofrontendsInDom()}getMicrofrontendIframes(){return At.getMicrofrontendIframes()}getCurrentMicrofrontendIframe(){return At.getCurrentMicrofrontendIframe()}getNavFooterContainer(){return document.getElementsByClassName("lui-side-nav__footer")[0]}};class Ve{constructor(){this.promises={}}setPromise(e,t){this.promises[e]=t}getPromise(e){return this.promises[e]}}class Re extends Ve{constructor(e){super(),Object.assign(this,e),this.options={preserveView:!1,nodeParams:{},errorSkipNavigation:!1,fromContext:null,fromParent:!1,fromClosestContext:!1,relative:!1,link:""}}async navigate(e,t,n,i,r){if(this.options.errorSkipNavigation)return this.options.errorSkipNavigation=!1,Promise.reject(new Error("navigation skipped"));this.options.preserveView=t;const o="/"!==e[0];if("/"===e&&(n||i||r))return console.warn("Navigation with an absolute path prevented."),Promise.reject(new Error("Navigation with an absolute path prevented."));const a=Et.createRemotePromise(),l={msg:"luigi.navigation.open",params:Object.assign(this.options,{link:e,relative:o,modal:n,splitView:i,drawer:r}),remotePromiseId:a.id};return this.sendPostMessageToLuigiCore(l),a}navigateToIntent(e,t={}){var n;let i="#?intent=";if(i+=e,t&&(null==(n=Object.keys(t))?void 0:n.length)){const e=Object.entries(t);if(e.length>0){i+="?";for(const[t,n]of e)i+=t+"="+n+"&";i=i.slice(0,-1)}}this.navigate(i)}openAsModal(e,t={},n){if(Et.isFunction(n)){const e=Et.createRemotePromise();e.then(e=>{n(e)}),t.onClosePromiseId=e.id}return this.navigate(e,!0,t)}openAsDrawer(e,t={}){return this.navigate(e,!0,void 0,void 0,t)}openAsSplitView(e,t={}){return this.navigate(e,!0,void 0,t),Luigi.splitView.splitViewHandle}fromContext(e){return this.options.fromContext=e,this}fromClosestContext(){return this.options.fromContext=null,this.options.fromClosestContext=!0,this.options.fromParent=!1,this}fromVirtualTreeRoot(){return this.options.fromContext=null,this.options.fromClosestContext=!1,this.options.fromVirtualTreeRoot=!0,this.options.fromParent=!1,this}fromParent(){return this.options.fromContext=null,this.options.fromClosestContext=!1,this.options.fromVirtualTreeRoot=!1,this.options.fromParent=!0,this}withParams(e){return e&&Object.assign(this.options.nodeParams,e),this}pathExists(e){if(Et.isFunction(Luigi.pathExists))return Luigi.pathExists(e);console.error("Luigi.navigation().pathExists(path) is only available inside your configuration, after the configuration was initialized with Luigi.setConfig().")}hasBack(){return Luigi.hasBack()}goBack(e){this.sendPostMessageToLuigiCore({msg:"luigi.navigation.back",goBackContext:e&&JSON.stringify(e)})}getCurrentRoute(){return Luigi._app.ctx[Luigi._app.props.buildPathForGetCurrentRoute](this.options)}sendPostMessageToLuigiCore(e){window.postMessage(e,"*")}}const De=new class{constructor(){}updateTopNavigation(){window.postMessage({msg:"luigi.navigation.update-badge-counters"},"*")}navigate(e,t,n,i,r){return(new Re).navigate(e,t,n,i,r)}navigateToIntent(e,t){return(new Re).navigateToIntent(e,t)}openAsModal(e,t,n){return(new Re).openAsModal(e,t,n)}openAsSplitView(e,t={}){if("/"!==e)return(new Re).openAsSplitView(e,t);console.warn("Navigation with an absolute path prevented.")}openAsDrawer(e,t){return(new Re).openAsDrawer(e,t)}fromContext(e){return(new Re).fromContext(e)}fromClosestContext(){return(new Re).fromClosestContext()}fromVirtualTreeRoot(){return(new Re).fromVirtualTreeRoot()}fromParent(){return(new Re).fromParent()}getCurrentRoute(){return(new Re).getCurrentRoute()}withParams(e){return(new Re).withParams(e)}pathExists(e){return(new Re).pathExists(e)}hasBack(){return(new Re).hasBack()}goBack(e){return(new Re).goBack(e)}},Oe={luigi:{unsavedChangesAlert:{header:"Unsaved changes detected",body:"Unsaved changes will be lost. Do you want to continue?"},confirmationModal:{header:"Confirmation",body:"Are you sure you want to do this?"},button:{dismiss:"No",confirm:"Yes"},requestedRouteNotFound:"Could not find the requested route {route}.",notExactTargetNode:"Could not map the exact target node for the requested route {route}.",navigation:{up:"Up"}}};const Fe=new class{constructor(){this.currentLocaleStorageKey="luigi.currentLocale",this.defaultLocale="en",this.translationTable=Oe,this.listeners={}}_init(){Dt.doOnStoreChange(window.Luigi._store,()=>{this._initCustomImplementation()},["settings"])}getCurrentLocale(){return sessionStorage.getItem(this.currentLocaleStorageKey)||this.defaultLocale}setCurrentLocale(e){e&&(sessionStorage.setItem(this.currentLocaleStorageKey,e),this._notifyLocaleChange(e))}addCurrentLocaleChangeListener(e){if(Et.isFunction(e)){const t=Et.getRandomId();return this.listeners[t]=e,t}console.error("Provided locale change listener is not a function.")}removeCurrentLocaleChangeListener(e){e&&this.listeners[e]?delete this.listeners[e]:console.error("Unable to remove locale change listener - no listener registered for given ID.")}_notifyLocaleChange(e){Object.getOwnPropertyNames(this.listeners).forEach(t=>{this.listeners[t](e)}),ke.configChanged()}_initCustomImplementation(){this.translationImpl=ke.getConfigValue("settings.customTranslationImplementation"),Et.isFunction(this.translationImpl)&&(this.translationImpl=this.translationImpl())}getTranslation(e,t=void 0,n=void 0){if(!e)return"";if(this.translationImpl){const i=this.translationImpl.getTranslation(e,t,n);if(i!==e)return i}const i=this.findTranslation(e,this.translationTable,t);return i||e}findTranslation(e,t,n){let i=e.split(".");for(let r=0;r<i.length;r++){let e=i[r];if(!t.hasOwnProperty(e)||"object"!=typeof t[e])return n?this.findInterpolations(t[e],n):t[e];t=t[e]}}findInterpolations(e,t){return"string"==typeof e&&e.trim()?(Object.keys(t).forEach(n=>{e=e.replace(new RegExp("{"+Lt.escapeKeyForRegexp(n)+"}","gi"),t[n])}),e):e}};const Me=new class{sendToAll(e){const t=$e.convertCustomMessageUserToInternal(e);At.getMicrofrontendsInDom().map(e=>e.container).map(e=>At.sendMessageToIframe(e,t))}send(e,t){const n=$e.convertCustomMessageUserToInternal(t);At.getMicrofrontendsInDom().filter(t=>t.id===e).map(e=>e.container).map(e=>At.sendMessageToIframe(e,n))}},Ue=[];function ze(e,t=n){let i;const r=new Set;function o(t){if(l(e,t)&&(e=t,i)){const t=!Ue.length;for(const n of r)n[1](),Ue.push(n,e);if(t){for(let e=0;e<Ue.length;e+=2)Ue[e][0](Ue[e+1]);Ue.length=0}}}function a(t){o(t(e))}return{set:o,update:a,subscribe:function(l,s=n){const c=[l,s];return r.add(c),1===r.size&&(i=t(o,a)||n),l(e),()=>{r.delete(c),0===r.size&&i&&(i(),i=null)}}}}const Be=new class{initial(){this.responsiveNavSetting=Ke.getConfigValue("settings.responsiveNavigation");const e="semiCollapsible"===this.responsiveNavSetting||"Fiori3"===this.responsiveNavSetting;!1!==JSON.parse(localStorage.getItem(Vt.COL_NAV_KEY))&&e&&(this.isSemiCollapsed=this.getCollapsed()),this.semiCollapsible=!!e;let t=void 0===this.isSemiCollapsed;return this.semiCollapsible&&0!==window.innerWidth&&window.innerWidth<Ie?this.isSemiCollapsed=!!t||this.getCollapsed():this.isSemiCollapsed=!t&&this.getCollapsed(),this.setCollapsed(this.isSemiCollapsed),this.previousWindowWidth=window.innerWidth,{isSemiCollapsed:this.isSemiCollapsed,semiCollapsible:this.semiCollapsible}}onValueChanged(e){this.valueChangedFns?this.valueChangedFns.push(e):this.valueChangedFns=[e]}onResize(e){const t=0!==window.innerWidth&&window.innerWidth<Ie&&this.previousWindowWidth>=Ie,n=0!==window.innerWidth&&window.innerWidth>Ie&&this.previousWindowWidth>=Ie;return t&&this.setCollapsed(!0,!1),!this.isStoredCollapsed()&&n&&this.setCollapsed(!1,!1),e=this.closePopupMenu(e),{isSemiCollapsed:this.isSemiCollapsed,selectedCategory:e}}setCollapsed(e,t=!0){document.body.classList.remove("semiCollapsed"),e&&document.body.classList.add("semiCollapsed"),this.isSemiCollapsed=e,t&&localStorage.setItem(Vt.COL_NAV_KEY,e),this.valueChangedFns instanceof Array&&this.valueChangedFns.forEach(e=>e({isSemiCollapsed:this.isSemiCollapsed}))}isStoredCollapsed(){return JSON.parse(localStorage.getItem(Vt.COL_NAV_KEY))}getCollapsed(){return!!this.isStoredCollapsed()||this.isSemiCollapsed}closePopupMenu(e){var t;return e&&(e=null,null==(t=document.getElementsByClassName("fd-app__sidebar")[0])||t.classList.remove("isBlocked")),e}buttonClicked(e){return this.closePopupMenu(),this.getCollapsed()?this.setCollapsed(!1):(this.setCollapsed(!0),document.getElementsByClassName("lui-fd-side-nav-wrapper")[0]&&(document.getElementsByClassName("lui-fd-side-nav-wrapper")[0].setAttribute("style","overflow-y:hidden;"),window.setTimeout(function(){document.getElementsByClassName("lui-fd-side-nav-wrapper")[0].setAttribute("style","overflow-y:auto;")}))),this.isSemiCollapsed}};const je=new class{constructor(){this.documentTitle=ze()}hideAppLoadingIndicator(){const e=document.querySelector(Ae);e&&(e.classList.add("hidden"),setTimeout(()=>{e.parentNode&&e.parentNode.removeChild(e)},500))}showAlert(e){if(Et.isFunction(Luigi.showAlert))return Luigi.showAlert(e);console.error("Luigi.ux().showAlert() is only available inside your configuration, after the configuration was initialized with Luigi.setConfig().")}showConfirmationModal(e){if(Et.isFunction(Luigi.showConfirmationModal))return Luigi.showConfirmationModal(e);console.error("Luigi.ux().showConfirmationModal() is only available inside your configuration, after the configuration was initialized with Luigi.setConfig().")}setDocumentTitle(e){this.documentTitle.set(e),Luigi.configChanged("settings.header")}getDocumentTitle(){return u(this.documentTitle)}collapseLeftSideNav(e){Be.setCollapsed(e)}openUserSettings(){Luigi.openUserSettings()}closeUserSettings(){Luigi.closeUserSettings()}removeBackdrop(){(new Re).sendPostMessageToLuigiCore({msg:"luigi.remove-backdrop"})}getDirtyStatus(){return Luigi.getDirtyStatus()}getCurrentTheme(){return Luigi.theming().getCurrentTheme()}};const He=new class{openSearchField(){Luigi.openSearchField()}closeSearchField(){Luigi.closeSearchField()}clearSearchField(){Luigi.clearSearchField()}showSearchResult(e){Luigi.showSearchResult(e)}closeSearchResult(){Luigi.closeSearchResult()}getSearchString(){return Luigi.getGlobalSearchString()}setSearchString(e){Luigi.setGlobalSearchString(e)}setSearchInputPlaceholder(e){Luigi.setSearchInputPlaceholder(e)}};const We=new class{constructor(){this.currentTheme}async getAvailableThemes(){return await Ke.getConfigValueAsync("settings.theming.themes")}setCurrentTheme(e){this.currentTheme=e,window.Luigi.__cssVars=void 0}async getThemeObject(e){const t=await this.getAvailableThemes();return t&&t.find(t=>t.id===e)}getCurrentTheme(){if(!this.isThemingAvailable())return!1;if(this.currentTheme)return this.currentTheme;const e=Ke.getConfigValue("settings.theming");return e.defaultTheme||console.error("[Theming] getCurrentTheme() error. No theme set and no defaultTheme found in configuration",e),e.defaultTheme}isThemingAvailable(){return!!Ke.getConfigValue("settings.theming")}async getCSSVariables(){if(!window.Luigi.__cssVars){const t=Ke.getConfigValue("settings.theming.variables.file");if(t)try{const e=await fetch(t);window.Luigi.__cssVars=(await e.json()).root,Object.keys(window.Luigi.__cssVars).forEach(e=>{const t=getComputedStyle(document.documentElement).getPropertyValue("--"+e);t&&(window.Luigi.__cssVars[e]=t)})}catch(e){Et.isFunction(Ke.getConfigValue("settings.theming.variables.errorHandling"))?Ke.getConfigValue("settings.theming.variables.errorHandling")(e):console.error("CSS variables file error: ",e)}else"fiori"===Ke.getConfigValue("settings.theming.variables")&&window.__luigiThemeVars?(window.Luigi.__cssVars={},window.__luigiThemeVars.forEach(e=>{window.Luigi.__cssVars[e]=getComputedStyle(document.documentElement).getPropertyValue("--"+e)})):window.Luigi.__cssVars={}}return window.Luigi.__cssVars}_init(){const e=()=>{const e=Ke.getConfigValue("settings.theming");e&&e.nodeViewURLDecorator&&e.nodeViewURLDecorator.queryStringParameter&&It.add({type:"queryString",uid:"theming",key:e.nodeViewURLDecorator.queryStringParameter.keyName,valueFn:()=>{const t=this.getCurrentTheme(),n=e.nodeViewURLDecorator.queryStringParameter.value;return n?n(t):t}}),e&&!0===e.useFioriScrollbars&&document.body.classList.add("fioriScrollbars")};Dt.doOnStoreChange(window.Luigi._store,()=>{e()},["settings.theming"])}};const qe=new class{constructor(){this.featureToggleList=ze([])}setFeatureToggle(e,t=!1){this.isValid(e)&&(e.startsWith("!")&&!t||this.isDuplicatedOrDisabled(e)||u(this.featureToggleList).push(e))}unsetFeatureToggle(e){if(!this.isValid(e))return;const t=u(this.featureToggleList).indexOf(e);-1!==t?u(this.featureToggleList).splice(t,1):console.warn("Feature toggle name is not in the list.")}getActiveFeatureToggleList(){return[...u(this.featureToggleList)].filter(e=>!e.startsWith("!"))}isValid(e){return!!Et.isString(e)||(console.warn("Feature toggle name is not valid or not of type 'string'"),!1)}isDuplicatedOrDisabled(e){return u(this.featureToggleList).includes(e)?(console.warn("Feature toggle name already exists"),!0):!!u(this.featureToggleList).includes(`!${e}`)&&(console.warn("Disabled feature toggle can not be activated"),!0)}};const Ge=new class{constructor(){}getSearchParams(){const e={},t=["__proto__","constructor","prototype"],n=new URL(location.href);let i;if(Ke.getConfigValue("routing.useHashRouting")){const e=n.hash.split("?")[1];i=e?new URLSearchParams(e).entries():[]}else i=n.searchParams.entries();for(const[r,o]of i)t.some(e=>r===e)?console.warn(`Blocked because of potentially dangerous query param: ${r}`):e[r]=o;return e}addSearchParams(e,t){if(!Et.isObject(e))return void console.log("Params argument must be an object");const n=new URL(location);Ke.getConfigValue("routing.useHashRouting")?n.hash=Rt.addParamsOnHashRouting(e,n.hash):Rt.modifySearchParams(e,n.searchParams),this.handleBrowserHistory(t,n),Ke.configChanged()}addNodeParams(e,t){if(!Et.isObject(e))return void console.log("Params argument must be an object");const n=Rt.getContentViewParamPrefix(),i=new URL(location);Ke.getConfigValue("routing.useHashRouting")?i.hash=Rt.addParamsOnHashRouting(e,i.hash,n):Rt.modifySearchParams(e,i.searchParams,n),this.handleBrowserHistory(t,i),Ke.configChanged()}sanitizeUrl(e){return new URL(location).origin===new URL(e).origin?e:void 0}handleBrowserHistory(e,t){const n=this.sanitizeUrl(t.href);n?e?window.history.pushState({},"",n):window.history.replaceState({},"",n):console.warn("invalid url: "+n)}getAnchor(){const{hash:e}=new URL(location);return Ke.getConfigValue("routing.useHashRouting")&&2===e.split("#").length?"":e.split("#").pop()}setAnchor(e){if(Ke.getConfigValue("routing.useHashRouting")){const{hash:t}=new URL(location),n=t.split("#"),i=n.length>2?n.slice(0,-1):n;window.location.hash=[...i,e].join("#")}else window.location.hash=e}},Ke=ke,Je=Pe,Ye=Ee,Qe=De,Ze=Fe,Xe=je,et=He,tt=We,nt=qe,it=Ge;window.Luigi=ke,window.Luigi.auth=()=>Pe,window.Luigi.elements=()=>Ee,window.Luigi.navigation=()=>De,window.Luigi.i18n=()=>Fe,window.Luigi.customMessages=()=>Me,window.Luigi.ux=()=>je,window.Luigi.globalSearch=()=>He,window.Luigi.theming=()=>We,window.Luigi.featureToggles=()=>qe,window.Luigi.routing=()=>Ge;const rt=new class{constructor(){this.iframeNavFallbackTimeout=2e3,this.timeoutHandle}getActiveIframe(e){return[...e.children].filter(e=>"IFRAME"===e.tagName).find(Et.isElementVisible)}setActiveIframeToPrevious(e){const t=At.getMainIframes(),n=this.getPreservedViewsInDom(t);if(0===n.length)return;const i=this.getActiveIframe(e);At.hideElementChildren(e),i&&e.removeChild(i),n[0].pv=void 0,n[0].style.display="block"}removeInactiveIframes(e){Array.from(e.children).forEach(t=>{Et.isElementVisible(t)||t.vg||"IFRAME"!==t.tagName||e.removeChild(t)})}hasIsolatedView(e,t,n){return e||n&&!(!1===e)&&!t}getPreservedViewsInDom(e){return e.filter(e=>e.pv)}canCache(e){const t=Vt.getViewGroupSettings(e);return t&&t.preloadUrl}notifyInactiveIframes(){const e={msg:"luigi-client.inactive-microfrontend",context:JSON.stringify({}),nodeParams:JSON.stringify({}),pathParams:JSON.stringify({}),internal:JSON.stringify({currentLocale:Ze.getCurrentLocale()})};At.sendMessageToVisibleIframes(e)}switchActiveIframe(e,t,n){const i=this.getActiveIframe(e);if(i!==t){let r=!1;Array.from(e.children).forEach(o=>{if(o===i)if(n)e.removeChild(o);else{const e=Vt.getViewGroupSettings(o.vg);if(e&&this.notifyInactiveIframes(),o.style.display="none",e.preloadUrl){const t={msg:"luigi.navigate",viewUrl:e.preloadUrl,context:JSON.stringify({}),nodeParams:JSON.stringify({}),pathParams:JSON.stringify({}),internal:JSON.stringify({currentLocale:Ze.getCurrentLocale()})};At.sendMessageToIframe(o,t)}}o===t&&(r=!0)}),t&&(t.style.display="block",r||e.insertBefore(t,e.firstChild))}return t}setOkResponseHandler(e,t,n){var i,r;(null==(r=Vt.getViewGroupSettings(null==(i=e.iframe)?void 0:i.vg))?void 0:r.noClientCheck)||(this.timeoutHandle=setTimeout(async()=>{e.navigateOk?e.navigateOk=void 0:(At.removeIframe(e.iframe,n),e.iframe=void 0,e.isFallbackFrame=!0,console.info("navigate: luigi-client did not respond, using fallback by replacing iframe"),await this.navigateIframe(e,t,n))},this.iframeNavFallbackTimeout))}checkIframe(e,t,n,i,r){this.timeoutHandle=setTimeout(()=>{t.get().showLoadingIndicator&&(e.viewUrl?(n=e.viewUrl,t.set({viewUrl:n}),this.iframeNavFallbackTimeout=0,this.setOkResponseHandler(i,t,r)):Vt.handleUnresponsiveClient(e))},e.timeout)}initHandshakeFailed(e){var t;if(!(e&&e.iframe&&e.iframe.luigi))return!0;const n=e.iframe.luigi.clientVersion;return!(null==(t=Vt.getViewGroupSettings(e.iframe.vg))?void 0:t.noClientCheck)&&(void 0===e.iframe.luigi.initOk||!(!n||-1!==Et.semverCompare("1.1.1",n))&&!e.iframe.luigi.initOk)}async navigateIframe(e,t,n){clearTimeout(this.timeoutHandle);const i=t.get();let r=i.viewUrl;r&&(r=Rt.substituteViewUrl(r,i));const o=At.isSameViewGroup(e,t),a=this.hasIsolatedView(i.previousNodeValues.isolateView,o,e.isolateAllViews),l=this.hasIsolatedView(i.isolateView,o,e.isolateAllViews),s=At.canReuseIframe(e,t);let c=this.getActiveIframe(n);const d=At.getMainIframes(),u=this.getPreservedViewsInDom(d);let f,p=!1;if(u.length>0&&(f=u.shift(),f===c&&(p=!0,c=void 0,e.iframe=void 0)),!p&&!t.get().isNavigateBack){let t;if(c&&a&&(c=this.switchActiveIframe(n,void 0,!0)),c&&l&&(c=this.switchActiveIframe(n,void 0,!c.vg)),!l&&i.viewGroup){const e=At.getMainIframes().filter(e=>e.vg===i.viewGroup);e.length>0&&(t=e[0],c=this.switchActiveIframe(n,t,c&&!c.vg))}c&&!t&&(c.vg?c=this.switchActiveIframe(n,void 0,!1):s||(c=this.switchActiveIframe(n,void 0,!0))),e.iframe=c}if(!e.iframe||this.initHandshakeFailed(e)){if(e.iframe&&n.removeChild(e.iframe),p?(this.notifyInactiveIframes(),At.hideElementChildren(n)):At.removeElementChildren(n),i.viewUrl){!1!==Et.getConfigValueFromObject(i,"currentNode.loadingIndicator.enabled")?t.set({showLoadingIndicator:!0}):t.set({showLoadingIndicator:!1}),e.navigateOk=void 0;const o=i.viewGroup&&!l&&this.canCache(i.viewGroup);if(e.iframe=At.createIframe(r,o?i.viewGroup:void 0,t.get().currentNode,"main",i),n.insertBefore(e.iframe,n.firstChild),e.builderCompatibilityMode)e.iframe.addEventListener("load",()=>{e.iframe._ready=!0;const t=["init",JSON.stringify(i.context)];At.sendMessageToIframe(e.iframe,t)});else{const t=e.iframe;t.addEventListener("load",()=>{t._ready=!0})}const a=i.currentNode.pageErrorHandler;a?this.checkIframe(a,t,r,e,n):e.defaultPageErrorHandler&&this.checkIframe(e.defaultPageErrorHandler,t,r,e,n)}}else{t.set({showLoadingIndicator:!1});const o=t.get().goBackContext;e.iframe.style.display="block",e.iframe.luigi.nextViewUrl=r,e.iframe.luigi.nextClientPermissions=t.get().currentNode.clientPermissions,e.iframe.vg=this.canCache(i.viewGroup)?i.viewGroup:void 0,e.iframe.luigi.currentNode=i.currentNode;const a=await t.prepareInternalData(e),l={msg:"luigi.navigate",viewUrl:r,context:JSON.stringify(Object.assign({},i.context,{goBackContext:o})),nodeParams:JSON.stringify(Object.assign({},i.nodeParams)),pathParams:JSON.stringify(Object.assign({},i.pathParams)),searchParams:JSON.stringify(Object.assign({},Rt.prepareSearchParamsForClient(e.iframe.luigi.currentNode))),internal:JSON.stringify(a)};i.isNavigationSyncEnabled?(At.getVisibleIframes().forEach(t=>{t!==e.iframe&&(t.userSettingsGroup?Luigi.readUserSettings().then(e=>{At.sendMessageToIframe(t,{msg:"luigi.navigate",context:{userSettingsData:e[t.userSettingsGroup]},internal:At.applyCoreStateData(t.luigi._lastUpdatedMessage.internal)})}):At.sendMessageToIframe(t,{msg:"luigi.navigate",context:t.luigi._lastUpdatedMessage.context,nodeParams:t.luigi._lastUpdatedMessage.nodeParams,pathParams:JSON.stringify(Object.assign({},t.luigi.pathParams)),searchParams:JSON.stringify(Object.assign({},Rt.prepareSearchParamsForClient(e.iframe.luigi.currentNode))),internal:At.applyCoreStateData(t.luigi._lastUpdatedMessage.internal)}))}),At.sendMessageToIframe(e.iframe,l),this.setOkResponseHandler(e,t,n)):t.set({isNavigationSyncEnabled:!0}),t.set({goBackContext:void 0,isNavigateBack:!1})}}};const ot=new class{constructor(){this.preloadBatchSize=1,this.shouldPreload=!1}preloadViewGroups(e=3,t){if(!1===Ke.getConfigValue("navigation.preloadViewGroups"))return;const n=Vt.getAllViewGroupSettings();if(!n)return;const i=At.getIframeContainer(),r=At.getMainIframes(),o=(new Date).getTime();if(r.filter(e=>e.luigi&&e.luigi.preloading&&o-e.luigi.createdAt<3e4).length>0)return void console.debug("skipping view group preloading (busy)");const a=r.map(e=>e.vg).filter(Boolean),l=Object.entries(n).filter(([e,t])=>!a.includes(e)).filter(([e,t])=>t&&t.preloadUrl);t&&l.forEach(([e,t])=>{t.loadOnStartup&&this.preloadIframeOnBackground(t,e,i)}),!t&&l.filter((t,n)=>n<e).forEach(([e,t])=>{console.debug("preloading view group "+e+" - "+t.preloadUrl),this.preloadIframeOnBackground(t,e,i)})}preloadIframeOnBackground(e,t,n){const i=At.createIframe(e.preloadUrl,t,null,"main");i.style.display="none",i.luigi.preloading=!0,n.appendChild(i)}preload(e){this.shouldPreload&&setTimeout(()=>{this.preloadViewGroups(this.preloadBatchSize,e)},e),this.shouldPreload=!0}viewGroupLoaded(e){if(e.luigi.preloading){const t=(new Date).getTime()-e.luigi.createdAt;let n=1;t<500?n=3:t<1e3&&(n=2),this.preloadBatchSize=n,console.debug("preload batch size: "+this.preloadBatchSize),setTimeout(()=>{e.luigi.preloading=!1},this.preloadBatchSize>2?500:1e3)}}};const at=new class{async getNavigationPath(e,t=""){try{const n=Et.getTrimmedUrl(t);if(!e)return console.error("No navigation nodes provided in the configuration."),[{}];let i;if(Ne.hasRootNode()&&(i=Ne.getRootNode().node),!i){const t=await e;Et.isObject(t)?(i=t,i.pathSegment&&(i.pathSegment="",console.warn("Root node must have an empty path segment. Provided path segment will be ignored."))):i={children:t},i.children=await this.getChildren(i),Ne.setRootNode(i)}const r=n.split("/"),o={...Ke.getConfigValue("navigation.globalContext")||{},...i.context||{}},a=await this.buildNode(r,[i],i.children,o),l=a.navigationPath.filter(e=>e.pathSegment).map(e=>e.pathSegment);a.isExistingRoute=!n||r.length===l.length;const s=n.split("/");return a.matchedPath=s.filter((e,t)=>l[t]&&l[t].startsWith(":")||l[t]===e).join("/"),a}catch(n){console.error("Failed to load top navigation nodes.",n)}}async getChildren(e,t){if(!e)return[];let n=[];if(Ne.hasChildren(e)){let t=Ne.getChildren(e);t&&(n=t.children)}else try{n=await xe.getConfigValueFromObjectAsync(e,"children",t||e.context),null==n&&(n=[]),n=n.map(e=>this.getExpandStructuralPathSegment(e)).map(t=>this.bindChildToParent(t,e))||[]}catch(r){console.error("Could not lazy-load children for node",r)}let i=this.getAccessibleNodes(e,n,t);return Ne.setChildren(e,{children:n,filteredChildren:i}),i}async getFilteredChildren(e){return Ne.hasChildren(e)?at.getChildrenFromCache(e):await at.getChildren(e)}getChildrenFromCache(e){let t=Ne.getChildren(e);return t?t.filteredChildren:[]}getAccessibleNodes(e,t,n){return t?t.filter(t=>Vt.isNodeAccessPermitted(t,e,n)):[]}bindChildToParent(e,t){return t&&t.pathSegment&&(e.parent=t),e}getExpandStructuralPathSegment(e){if(e&&e.pathSegment&&-1!==e.pathSegment.indexOf("/")){const t=e.pathSegment.split("/"),n={...e},i=(e,t)=>{const r=e.shift();let o={};return e.length?(o.pathSegment=r,t.hideFromNav&&(o.hideFromNav=t.hideFromNav),o.children=[i(e,t)]):(o=n,o.pathSegment=r),o};return i(t,e)}return e}async buildNode(e,t,n,i,r={}){i.parentNavigationContexts||(i.parentNavigationContexts=[]);let o={navigationPath:t,context:i,pathParams:r};if(e.length>0&&n&&n.length>0){const l=e[0],s=this.findMatchingNode(l,n);if(s){t.push(s);let n=Vt.applyContext(i,s.context,s.navigationContext);s.pathSegment.startsWith(":")&&(r[s.pathSegment.replace(":","")]=Lt.sanitizeParam(l)),n=Rt.substituteDynamicParamsInObject(n,r);try{this.buildVirtualTree(s,e,r);let i=await this.getChildren(s,n);const a=e.slice(1);o=this.buildNode(a,t,i,n,r)}catch(a){console.error("Error getting nodes children",a)}}}return o}buildVirtualViewUrl(e,t,n){let i="";for(const r in t)r.startsWith("virtualSegment")&&(i+=":"+r+"/");return n?(i+=":virtualSegment_"+n+"/",e+"/"+i):e}buildVirtualTree(e,t,n){const i=e.virtualTree,r=e._virtualTree,o=e._virtualViewUrl||e.viewUrl;if((i||r)&&t[0]){let t=e._virtualPathIndex;i&&(t=0,e.keepSelectedForChildren=!0);if(t>50)return;t++;const r=["_*","virtualTree","parent","children","keepSelectedForChildren","navigationContext"],a=Et.removeProperties(e,r);Object.assign(a,{pathSegment:":virtualSegment_"+t,label:":virtualSegment_"+t,viewUrl:Et.trimTrailingSlash(this.buildVirtualViewUrl(o,n,t)),_virtualTree:!0,_virtualPathIndex:t,_virtualViewUrl:o});const l=!!(Array.isArray(e.children)&&e.children.length>0)&&e.children[0]._virtualTree;e.children&&!l&&console.warn("Found both virtualTree and children nodes defined on a navigation node. \nChildren nodes are redundant and ignored when virtualTree is enabled. \nPlease refer to documentation"),e.children=[a]}}findMatchingNode(e,t){let n=null;const i=t.filter(e=>!!e.pathSegment).length,r=t.filter(e=>e.pathSegment&&e.pathSegment.startsWith(":")).length;return e=e.includes("#")?e.split("#").shift():e,i>1&&(1===r&&(console.warn("Invalid node setup detected. \nStatic and dynamic nodes cannot be used together on the same level. Static node gets cleaned up. \nRemove the static node from the configuration to resolve this warning. \nAffected pathSegment:",e,"Children:",t),t=t.filter(e=>e.pathSegment&&e.pathSegment.startsWith(":"))),r>1)?(console.error("Invalid node setup detected. \nMultiple dynamic nodes are not allowed on the same level. Stopped navigation. \nInvalid Children:",t),null):(t.some(t=>{if(t.pathSegment===e||t.pathSegment&&t.pathSegment.startsWith(":"))return n=t,!0}),n)}onNodeChange(e,t){const n=Ke.getConfigValue("navigation.nodeChangeHook");"function"==typeof n?n(e,t):void 0!==n&&console.warn("nodeChangeHook is not a function!")}getNodesToDisplay(e,t){if(e&&e.length>0)return{children:e};if(t.length>1&&(!1===t[0].topNav||t.length>2)){const e=t[t.length-2];if(Ne.hasChildren(e))return{children:this.getChildrenFromCache(e),parent:e}}return{children:[]}}getGroupedChildren(e,t){const n=this.getNodesToDisplay(e,t.pathData);return Array.isArray(n)?Vt.groupNodesBy(n,"category",!0):{children:Vt.groupNodesBy(n.children,"category",!0),parent:n.parent}}getTruncatedChildren(e){let t=!1,n=!1,i=[];return e.slice().reverse().forEach(e=>{t&&!e.tabNav||(!1===e.tabNav&&(n=!0),!1===e.keepSelectedForChildren?t=!0:(e.keepSelectedForChildren||e.tabNav&&!n&&!Rt.isDynamicNode(e))&&(t=!0,i=[])),i.push(e)}),i.reverse()}async getLeftNavData(e,t){var n;const i={};if(e.pathData&&e.pathData.length>0&&(!1===e.pathData[0].topNav||e.pathData.length>1)){const r=this.getTruncatedChildren(t.pathData);let o,a=[...r].pop();(a.keepSelectedForChildren||a.tabNav)&&(o=a,r.pop(),a=[...r].pop());const l=await this.getChildren(a,null==(n=t.pathData)?void 0:n._context),s=this.getGroupedChildren(l,e);i.navParent=s.parent||a,i.context=e.pathData._context,i.hasCategoriesWithIcon=!1;const c=s.children;Object.values(c).forEach(e=>{!i.hasCategoriesWithIcon&&e&&e.metaInfo&&e.metaInfo.icon&&(i.hasCategoriesWithIcon=!0)}),i.selectedNode=o||a,i.children=c;Ke.getConfigValue("settings.expandCategoryByNavigation")&&this.expandCategoriesByNavigationFn(i.children,i.selectedNode,Vt.getSideNavAccordionMode(i.selectedNode))}return i}expandCategoriesByNavigationFn(e,t,n){if(e)for(const[i,r]of Object.entries(e))r.forEach(e=>{e===t&&r.metaInfo&&r.metaInfo.collapsible&&Vt.storeExpandedState(r.metaInfo.categoryUid,!0,n)})}getTruncatedChildrenForTabNav(e){for(let t=e.length-1;t>=0;t--)if(e[t].tabNav)return e.slice(0,t+2);return[]}async getTabNavData(e,t){var n;const i={};if(e.pathData&&e.pathData.length>0&&(!1===e.pathData[0].topNav||e.pathData.length>1)){const r=[...this.getTruncatedChildrenForTabNav(t.pathData)].pop(),o=await this.getChildren(r.tabNav?r:Vt.getParentNode(r,e.pathData),null==(n=e.pathData)?void 0:n._context),a=this.getGroupedChildren(o,e).children;i.selectedNode=r,i.selectedNodeForTabNav=r,i.children=a}return i}async extractDataFromPath(e){const t=await this.getNavigationPath(Ke.getConfigValueAsync("navigation.nodes"),e);return{nodeObject:Rt.getLastNodeObject(t),pathData:t}}async shouldPreventNavigation(e){return!(!e||!Et.isFunction(e.onNodeActivation)&&!Et.isAsyncFunction(e.onNodeActivation)||!1!==await e.onNodeActivation(e))}},lt={label:"Sign Out",icon:"log"},st={label:"Settings",icon:"settings"},ct={dialogHeader:"User Settings",saveBtn:"Save",dismissBtn:"Cancel"},dt="Cancel",ut={sameWindow:!1};class ft{constructor(e){e?(this.rendererObject=e,this.config=e.config||{}):this.config={}}createCompoundContainer(){return document.createElement("div")}createCompoundItemContainer(){return document.createElement("div")}attachCompoundItem(e,t){e.appendChild(t)}}class pt extends ft{constructor(e){super(e||{use:{}}),e&&e.use&&e.use.extends&&(this.superRenderer=ht({use:e.use.extends,config:e.config}))}createCompoundContainer(){return this.rendererObject.use.createCompoundContainer?this.rendererObject.use.createCompoundContainer(this.config,this.superRenderer):this.superRenderer?this.superRenderer.createCompoundContainer():super.createCompoundContainer()}createCompoundItemContainer(e){return this.rendererObject.use.createCompoundItemContainer?this.rendererObject.use.createCompoundItemContainer(e,this.config,this.superRenderer):this.superRenderer?this.superRenderer.createCompoundItemContainer(e):super.createCompoundItemContainer(e)}attachCompoundItem(e,t){this.rendererObject.use.attachCompoundItem?this.rendererObject.use.attachCompoundItem(e,t,this.superRenderer):this.superRenderer?this.superRenderer.attachCompoundItem(e,t):super.attachCompoundItem(e,t)}}class gt extends ft{createCompoundContainer(){const e="__lui_compound_"+(new Date).getTime(),t=document.createElement("div");t.classList.add(e);let n="";return this.config.layouts&&this.config.layouts.forEach(t=>{if(t.minWidth||t.maxWidth){let i="@media only screen ";null!=t.minWidth&&(i+=`and (min-width: ${t.minWidth}px) `),null!=t.maxWidth&&(i+=`and (max-width: ${t.maxWidth}px) `),i+=`{\n .${e} {\n grid-template-columns: ${t.columns||"auto"};\n grid-template-rows: ${t.rows||"auto"};\n grid-gap: ${t.gap||"0"};\n }\n }\n `,n+=i}}),t.innerHTML=`\n <style scoped>\n .${e} {\n display: grid;\n grid-template-columns: ${this.config.columns||"auto"};\n grid-template-rows: ${this.config.rows||"auto"};\n grid-gap: ${this.config.gap||"0"};\n min-height: ${this.config.minHeight||"auto"};\n }\n ${n}\n </style>\n `,t}createCompoundItemContainer(e){const t=e||{},n=document.createElement("div");return n.setAttribute("style",`grid-row: ${t.row||"auto"}; grid-column: ${t.column||"auto"}`),n}}const ht=e=>{const t=e.use;return t?"grid"===t?new gt(e):t.createCompoundContainer||t.createCompoundItemContainer||t.attachCompoundItem?new pt(e):new ft(e):new ft(e)},mt=(e,t,n,i)=>{t.eventListeners&&t.eventListeners.forEach(t=>{const r=t.source+"."+t.name,o=e[r],a={wcElementId:n,wcElement:i,action:t.action,converter:t.dataConverter};o?o.push(a):e[r]=[a]})},vt=(e="")=>String(e).replaceAll("<","<").replaceAll(">",">").replaceAll(""",'"').replaceAll("'","'").replaceAll("/","/");const bt=new class{constructor(){t(this,"wcContainerData",new WeakMap)}dynamicImport(e){return import(/* webpackIgnore: true */e)}attachWC(e,t,n,i,r,o,a,l){if(n&&n.contains(t)){const s=document.createElement(e);o&&s.setAttribute("nodeId",o),s.setAttribute("lui_web_component",!0),this.initWC(s,e,n,r,i,o,a),n.replaceChild(s,t),l&&(this.removeTemporaryHeightFromCompoundItemContainer(n),this.wcContainerData.delete(n))}}initWC(e,t,n,i,r,o,a){const l=r.context;e.extendedContext=r,e.extendedContext.currentNode&&(e.extendedContext.clientPermissions=e.extendedContext.currentNode.clientPermissions);const s={linkManager:()=>{const e=window.Luigi.navigation();return new Proxy(e,{get:(e,t)=>t===e.getCurrentRoute.name?()=>{const t=new Promise(t=>{t(e.getCurrentRoute())});return t.toString=()=>e.getCurrentRoute(),t}:e[t]})},uxManager:window.Luigi.ux,getCurrentLocale:()=>window.Luigi.i18n().getCurrentLocale(),publishEvent:e=>{n.eventBus&&n.eventBus.onPublishEvent(e,o,t)},getActiveFeatureToggleList:()=>window.Luigi.featureToggles().getActiveFeatureToggleList(),getActiveFeatureToggles:()=>window.Luigi.featureToggles().getActiveFeatureToggleList(),getPathParams:()=>{var t;return(null==(t=e.extendedContext)?void 0:t.pathParams)?e.extendedContext.pathParams:{}},getCoreSearchParams:()=>{const t={clientPermissions:e.extendedContext.clientPermissions};return Rt.prepareSearchParamsForClient(t)},getClientPermissions:()=>{var t;return(null==(t=e.extendedContext)?void 0:t.clientPermissions)?e.extendedContext.clientPermissions:{}},addNodeParams:(e,t)=>{a||window.Luigi.routing().addNodeParams(e,t)},getNodeParams:t=>{var n;if(a)return{};const i=(null==(n=e.extendedContext)?void 0:n.nodeParams)?e.extendedContext.nodeParams:{};return t?(r=i,Object.entries(r).reduce((e,t)=>(e[vt(t[0])]=vt(t[1]),e),{})):e.extendedContext.nodeParams;var r},setAnchor:e=>{a||window.Luigi.routing().setAnchor(e)},getAnchor:()=>window.Luigi.routing().getAnchor(),getUserSettings:async()=>await this.getUserSettingsForWc(n._luigi_node),setViewGroupData:e=>{const t=Vt.findViewGroup(n._luigi_node);if(t){Vt.getViewGroupSettings(t)._liveCustomData=e,Ke.configChanged("navigation.viewgroupdata")}}};if(e.__postProcess){const t=new URL(document.baseURI).origin===new URL(i,document.baseURI).origin?new URL(i,document.baseURI):new URL("./",i);e.__postProcess(l,s,t.origin+t.pathname)}else e.context=l,e.nodeParams=r.nodeParams,e.LuigiClient=s;const c=Ke.getConfigValue("settings.webcomponentCreationInterceptor");Et.isFunction(c)&&c(e,r.currentNode,r,o,a)}generateWCId(e){let t="",n=new URL(e,encodeURI(location.href)).href;for(let i=0;i<n.length;i++)t+=n.charCodeAt(i).toString(16);return"luigi-wc-"+t}registerWCFromUrl(e,t){const n=Rt.getI18nViewUrl(e);return new Promise((e,i)=>{this.checkWCUrl(n)?this.dynamicImport(n).then(n=>{try{if(!window.customElements.get(t)){let e=n.default;if(!HTMLElement.isPrototypeOf(e)){let t=Object.keys(n);for(let i=0;i<t.length&&(e=n[t[i]],!HTMLElement.isPrototypeOf(e));i++);}window.customElements.define(t,e)}e()}catch(r){i(r)}}).catch(e=>i(e)):(console.warn(`View URL '${n}' not allowed to be included`),i(`View URL '${n}' not allowed`))})}includeSelfRegisteredWCFromUrl(e,t,n){if(this.checkWCUrl(t)){window.Luigi._registerWebcomponent||(window.Luigi._registerWebcomponent=(e,t)=>{const n=this.generateWCId(e);window.customElements.get(n)||window.customElements.define(n,t)});let i=document.createElement("script");i.setAttribute("src",t),"module"===e.webcomponent.type&&i.setAttribute("type","module"),i.setAttribute("defer",!0),i.addEventListener("load",()=>{n()}),document.body.appendChild(i)}else console.warn(`View URL '${t}' not allowed to be included`)}checkWCUrl(e){if(e.indexOf("://")>0||0===e.trim().indexOf("//")){if(new URL(e).host===window.location.host)return!0;const n=Ke.getConfigValue("navigation.validWebcomponentUrls");if(n&&n.length>0)for(let i of n)try{if(new RegExp(i).test(e))return!0}catch(t){console.error(t)}return!1}return!0}