UNPKG

@digital-blueprint/esign-app

Version:

[GitHub Repository](https://github.com/digital-blueprint/esign-app) | [npmjs package](https://www.npmjs.com/package/@digital-blueprint/esign-app) | [Unpkg CDN](https://unpkg.com/browse/@digital-blueprint/esign-app/) | [Esign Bundle](https://gitlab.tugraz.

441 lines (391 loc) 167 kB
let t,e,n,i,o,a,r,s,l,c,d,h,u,p,g,f,m,b,v,y,w,x,k,_,E,C,S,L,A,U,D,T=t=>t;function O(){return O=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},O.apply(null,arguments) /*! * License: LGPL-2.1-or-later * Dependencies: * * @webcomponents/scoped-custom-element-registry: BSD-3-Clause * @dbp-toolkit/app-shell: LGPL-2.1-or-later * @dbp-toolkit/common: LGPL-2.1-or-later * @dbp-toolkit/language-select: LGPL-2.1-or-later * @dbp-toolkit/auth: LGPL-2.1-or-later * @dbp-toolkit/notification: LGPL-2.1-or-later * @dbp-toolkit/theme-switcher: LGPL-2.1-or-later * path-to-regexp: MIT * universal-router: MIT * generateUrls: MIT * @dbp-toolkit/matomo: LGPL-2.1-or-later * @tugraz/web-components: LGPL-2.1-or-later */}import{c as I,R,a as M,s as $}from"./shared/notification.DeyWnWpq.es.js";import{c as P,D as F,i as j,k as V,A as N,g as G,S as B,M as H,a as z,I as W,b as q,d as K,s as Y,e as J,f as Z,h as X,j as Q}from"./shared/modal.DTvHO8c1.es.js";(function(){function t(t){var e=0;return function(){return e<t.length?{done:!1,value:t[e++]}:{done:!0}}}var e="function"==typeof Object.defineProperties?Object.defineProperty:function(t,e,n){return t==Array.prototype||t==Object.prototype||(t[e]=n.value),t};var n=function(t){t=["object"==typeof globalThis&&globalThis,t,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof I&&I];for(var e=0;e<t.length;++e){var n=t[e];if(n&&n.Math==Math)return n}throw Error("Cannot find global object")}(this);function i(t,i){if(i)t:{var o=n;t=t.split(".");for(var a=0;a<t.length-1;a++){var r=t[a];if(!(r in o))break t;o=o[r]}(i=i(a=o[t=t[t.length-1]]))!=a&&null!=i&&e(o,t,{configurable:!0,writable:!0,value:i})}}function o(t){return(t={next:t})[Symbol.iterator]=function(){return this},t}function a(e){var n="undefined"!=typeof Symbol&&Symbol.iterator&&e[Symbol.iterator];return n?n.call(e):{next:t(e)}}function r(t){if(!(t instanceof Array)){t=a(t);for(var e,n=[];!(e=t.next()).done;)n.push(e.value);t=n}return t}i("Symbol",(function(t){function n(t,n){this.l=t,e(this,"description",{configurable:!0,writable:!0,value:n})}if(t)return t;n.prototype.toString=function(){return this.l};var i=0;return function t(e){if(this instanceof t)throw new TypeError("Symbol is not a constructor");return new n("jscomp_symbol_"+(e||"")+"_"+i++,e)}})),i("Symbol.iterator",(function(i){if(i)return i;i=Symbol("Symbol.iterator");for(var a="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),r=0;r<a.length;r++){var s=n[a[r]];"function"==typeof s&&"function"!=typeof s.prototype[i]&&e(s.prototype,i,{configurable:!0,writable:!0,value:function(){return o(t(this))}})}return i}));var s,l="function"==typeof Object.create?Object.create:function(t){function e(){}return e.prototype=t,new e},c=function(){if("undefined"!=typeof Reflect&&Reflect.construct){if(function(){function t(){}return Reflect.construct(t,[],(function(){})),new t instanceof t}())return Reflect.construct;var t=Reflect.construct;return function(e,n,i){return e=t(e,n),i&&Reflect.setPrototypeOf(e,i.prototype),e}}return function(t,e,n){return void 0===n&&(n=t),n=l(n.prototype||Object.prototype),Function.prototype.apply.call(t,n,e)||n}}();if("function"==typeof Object.setPrototypeOf)s=Object.setPrototypeOf;else{var d;t:{var h={};try{h.__proto__={a:!0},d=h.a;break t}catch(t){}d=!1}s=d?function(t,e){if(t.__proto__=e,t.__proto__!==e)throw new TypeError(t+" is not extensible");return t}:null}var u,p=s,g=window;if(void 0===(null==(u=g.CustomElementRegistryPolyfill)?void 0:u.formAssociated)){var f={};g.CustomElementRegistryPolyfill=(f.formAssociated=new Set,f)}var m,b,v=window.HTMLElement,y=window.customElements.define,w=window.customElements.get,x=window.customElements,k=new WeakMap,_=new WeakMap,E=new WeakMap,C=new WeakMap;function S(){var t;this.promise=new Promise((function(e){t=e})),this.resolve=t}function L(){this.h=new Map,this.m=new Map,this.j=new Map,this.i=new Map}function A(t,e,n,i){var o=t.i.get(n);o||t.i.set(n,o=new Set),i?o.add(e):o.delete(e)}function U(t){var e;null!=(e=b)&&e.has(t)&&D(t,k.get(t))}function D(t,e){var n;null==(n=b)||n.delete(t),e.attributeChangedCallback&&e.observedAttributes.forEach((function(n){t.hasAttribute(n)&&e.attributeChangedCallback.call(t,n,null,t.getAttribute(n))}))}function T(t){var e=Object.getPrototypeOf(t);if(e!==window.HTMLElement)return e===v?Object.setPrototypeOf(t,window.HTMLElement):T(e)}function O(t,e,n){n=void 0!==n&&n,Object.setPrototypeOf(t,e.g.prototype),k.set(t,e),m=t;try{new e.g}catch(t){T(e.g),new e.g}e.attributeChangedCallback&&(void 0===b||t.hasAttributes()?D(t,e):b.add(t)),n&&e.connectedCallback&&t.isConnected&&e.connectedCallback.call(t)}L.prototype.define=function(t,e){if(t=t.toLowerCase(),void 0!==this.h.get(t))throw new DOMException("Failed to execute 'define' on 'CustomElementRegistry': the name \""+t+'" has already been used with this registry');if(void 0!==this.m.get(e))throw new DOMException("Failed to execute 'define' on 'CustomElementRegistry': this constructor has already been used with this registry");var i=e.prototype.attributeChangedCallback,o=new Set(e.observedAttributes||[]);!function(t,e,n){if(0!==e.size&&void 0!==n){var i=t.prototype.setAttribute;i&&(t.prototype.setAttribute=function(t,o){if(U(this),t=t.toLowerCase(),e.has(t)){var a=this.getAttribute(t);i.call(this,t,o),n.call(this,t,a,o)}else i.call(this,t,o)});var o=t.prototype.removeAttribute;o&&(t.prototype.removeAttribute=function(t){if(U(this),t=t.toLowerCase(),e.has(t)){var i=this.getAttribute(t);o.call(this,t),n.call(this,t,i,null)}else o.call(this,t)});var a=t.prototype.toggleAttribute;a&&(t.prototype.toggleAttribute=function(t,i){if(U(this),t=t.toLowerCase(),e.has(t)){var o=this.getAttribute(t);a.call(this,t,i),o!==(i=this.getAttribute(t))&&n.call(this,t,o,i)}else a.call(this,t,i)})}}(e,o,i);var r,s,l=w.call(x,t),c=null!=(s=null==(r=l)?void 0:r.s)?s:e.formAssociated||g.CustomElementRegistryPolyfill.formAssociated.has(t);if(c&&g.CustomElementRegistryPolyfill.formAssociated.add(t),c!=e.formAssociated)try{e.formAssociated=c}catch(t){}if(i={tagName:t,g:e,connectedCallback:e.prototype.connectedCallback,disconnectedCallback:e.prototype.disconnectedCallback,adoptedCallback:e.prototype.adoptedCallback,attributeChangedCallback:i,formAssociated:c,formAssociatedCallback:e.prototype.formAssociatedCallback,formDisabledCallback:e.prototype.formDisabledCallback,formResetCallback:e.prototype.formResetCallback,formStateRestoreCallback:e.prototype.formStateRestoreCallback,observedAttributes:o},this.h.set(t,i),this.m.set(e,i),l||(l=function(t){function e(){var e=Reflect.construct(v,[],this.constructor);Object.setPrototypeOf(e,HTMLElement.prototype);t:{var n=e.getRootNode();if(!(n===document||n instanceof ShadowRoot)){if((n=M[M.length-1])instanceof CustomElementRegistry){var i=n;break t}(n=n.getRootNode())===document||n instanceof ShadowRoot||(n=(null==(i=C.get(n))?void 0:i.getRootNode())||document)}i=n.registry}return(n=(i=i||window.customElements).h.get(t))?O(e,n):_.set(e,i),e}return n.Object.defineProperty(e,"formAssociated",{configurable:!0,enumerable:!0,get:function(){return g.CustomElementRegistryPolyfill.formAssociated.has(t)}}),e.prototype.connectedCallback=function(e){for(var n=[],i=0;i<arguments.length;++i)n[i]=arguments[i];U(this),(i=k.get(this))?i.connectedCallback&&i.connectedCallback.apply(this,n):A(_.get(this),this,t,!0)},e.prototype.disconnectedCallback=function(e){for(var n=[],i=0;i<arguments.length;++i)n[i]=arguments[i];(i=k.get(this))?i.disconnectedCallback&&i.disconnectedCallback.apply(this,n):A(_.get(this),this,t,!1)},e.prototype.adoptedCallback=function(t){for(var e=[],n=0;n<arguments.length;++n)e[n]=arguments[n];var i,o;null==(i=k.get(this))||null==(o=i.adoptedCallback)||o.apply(this,e)},e.prototype.formAssociatedCallback=function(t){for(var e=[],n=0;n<arguments.length;++n)e[n]=arguments[n];var i;null!=(n=k.get(this))&&n.formAssociated&&(null==n||null==(i=n.formAssociatedCallback)||i.apply(this,e))},e.prototype.formDisabledCallback=function(t){for(var e=[],n=0;n<arguments.length;++n)e[n]=arguments[n];var i;null!=(n=k.get(this))&&n.formAssociated&&(null==n||null==(i=n.formDisabledCallback)||i.apply(this,e))},e.prototype.formResetCallback=function(t){for(var e=[],n=0;n<arguments.length;++n)e[n]=arguments[n];var i;null!=(n=k.get(this))&&n.formAssociated&&(null==n||null==(i=n.formResetCallback)||i.apply(this,e))},e.prototype.formStateRestoreCallback=function(t){for(var e=[],n=0;n<arguments.length;++n)e[n]=arguments[n];var i;null!=(n=k.get(this))&&n.formAssociated&&(null==n||null==(i=n.formStateRestoreCallback)||i.apply(this,e))},e}(t),y.call(x,t,l)),this===window.customElements&&(E.set(e,i),i.o=l),l=this.i.get(t))for(this.i.delete(t),o=(l=a(l)).next();!o.done;o=l.next())o=o.value,_.delete(o),O(o,i,!0);return void 0!==(l=this.j.get(t))&&(l.resolve(e),this.j.delete(t)),e},L.prototype.upgrade=function(t){for(var e=[],n=0;n<arguments.length;++n)e[n]=arguments[n];M.push(this),x.upgrade.apply(x,r(e)),M.pop()},L.prototype.get=function(t){var e;return null==(e=this.h.get(t))?void 0:e.g},L.prototype.whenDefined=function(t){var e=this.h.get(t);return void 0!==e?Promise.resolve(e.g):(void 0===(e=this.j.get(t))&&(e=new S,this.j.set(t,e)),e.promise)},window.HTMLElement=function(){var t=m;if(t)return m=void 0,t;var e=E.get(this.constructor);if(!e)throw new TypeError("Illegal constructor (custom element class must be registered with global customElements registry to be newable)");return t=Reflect.construct(v,[],e.o),Object.setPrototypeOf(t,this.constructor.prototype),k.set(t,e),t},window.HTMLElement.prototype=v.prototype,window.CustomElementRegistry=L,"loading"===document.readyState&&(b=new Set,document.addEventListener("readystatechange",(function(){b.forEach((function(t){return D(t,k.get(t))}))}),{once:!0}));var R=Element.prototype.attachShadow;Element.prototype.attachShadow=function(t,e){for(var n=[],i=1;i<arguments.length;++i)n[i-1]=arguments[i];var o=Object.assign({},t);return i=t.customElements,i=void 0===t.registry?i:t.registry,delete o.customElements,delete o.registry,n=R.call.apply(R,[this,o].concat(r(n))),void 0!==i&&(n.customElements=n.registry=i),n};var M=[document];function $(t,e,n){var i=(n?Object.getPrototypeOf(n):t.prototype)[e];t.prototype[e]=function(t){for(var e=[],o=0;o<arguments.length;++o)e[o]=arguments[o];return M.push(this),void 0!==(e=i.apply(n||this,e))&&C.set(e,this),M.pop(),e}}function P(t){var e=Object.getOwnPropertyDescriptor(t.prototype,"innerHTML");Object.defineProperty(t.prototype,"innerHTML",Object.assign({},e,{set:function(t){M.push(this),e.set.call(this,t),M.pop()}}))}if($(ShadowRoot,"createElement",document),$(ShadowRoot,"createElementNS",document),$(ShadowRoot,"importNode",document),$(Element,"insertAdjacentHTML"),P(Element),P(ShadowRoot),Object.defineProperty(window,"customElements",{value:new CustomElementRegistry,configurable:!0,writable:!0}),window.ElementInternals&&window.ElementInternals.prototype.setFormValue){var F=new WeakMap,j=HTMLElement.prototype.attachInternals;HTMLElement.prototype.attachInternals=function(t){for(var e=[],n=0;n<arguments.length;++n)e[n]=arguments[n];return e=j.call.apply(j,[this].concat(r(e))),F.set(e,this),e},["setFormValue","setValidity","checkValidity","reportValidity"].forEach((function(t){var e=window.ElementInternals.prototype,n=e[t];e[t]=function(t){for(var e=[],i=0;i<arguments.length;++i)e[i]=arguments[i];if(i=F.get(this),!0===k.get(i).formAssociated)return null==n?void 0:n.call.apply(n,[this].concat(r(e)));throw new DOMException("Failed to execute "+n+" on 'ElementInternals': The target element is not a form-associated custom element.")}}));var V=function(t){var e=c(Array,[].concat(r(t)),this.constructor);return e.l=t,e},N=V,G=Array;if(N.prototype=l(G.prototype),N.prototype.constructor=N,p)p(N,G);else for(var B in G)if("prototype"!=B)if(Object.defineProperties){var H=Object.getOwnPropertyDescriptor(G,B);H&&Object.defineProperty(N,B,H)}else N[B]=G[B];N.u=G.prototype,n.Object.defineProperty(V.prototype,"value",{configurable:!0,enumerable:!0,get:function(){var t;return(null==(t=this.l.find((function(t){return!0===t.checked})))?void 0:t.value)||""}});var z=function(t){var e=this,n=new Map;t.forEach((function(t,i){var o=t.getAttribute("name"),a=n.get(o)||[];e[+i]=t,a.push(t),n.set(o,a)})),this.length=t.length,n.forEach((function(t,n){t&&"length"!==n&&"item"!==n&&"namedItem"!==n&&(e[n]=1===t.length?t[0]:new V(t))}))};z.prototype.item=function(t){var e;return null!=(e=this[t])?e:null},z.prototype[Symbol.iterator]=function(){throw Error("Method not implemented.")},z.prototype.namedItem=function(t){var e;return null!=(e=this[t])?e:null};var W=Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"elements");Object.defineProperty(HTMLFormElement.prototype,"elements",{get:function(){for(var t=W.get.call(this),e=[],n=(t=a(t)).next();!n.done;n=t.next()){n=n.value;var i=k.get(n);i&&!0!==i.formAssociated||e.push(n)}return new z(e)}})}}).call("object"==typeof globalThis?globalThis:window);var tt={"activity-example":{"hello-world":"Hallo Welt"},"choose-from-menu":"Bitte wählen Sie eine Aktivität aus dem Menu.",contact:"Kontakt",imprint:"Impressum",login:"Anmelden",logout:"Abmelden","page-not-found":"Die gewünschte Seite wurde nicht gefunden","page-updated-needs-reload":"Die Applikation wurde aktualisiert. Bitte laden Sie die Seite neu.","privacy-policy":"Datenschutz","standard-layout-name":"Standard","switch-layout":"Layout wechseln","switch-to-standard-layout-label":"Zum Standardlayout wechseln","switch-to-wide-layout-label":"Zum Weiten Layout wechseln",welcome:{headline:"Willkommen!"},"wide-layout-name":"Erweitert"},et={"activity-example":{"hello-world":"Hello World"},"choose-from-menu":"Please choose an activity from the menu.",contact:"Contact",imprint:"Legal Notice",login:"Login",logout:"Logout","page-not-found":"Requested Page Not Found","page-updated-needs-reload":"The application has been updated. Please reload the page.","privacy-policy":"Privacy Policy","standard-layout-name":"Standard","switch-layout":"Switch layout","switch-to-standard-layout-label":"Switch to Standard Layout","switch-to-wide-layout-label":"Switch to Wide Layout",welcome:{headline:"Welcome!"},"wide-layout-name":"Wide"};function nt(){return P({en:et,de:tt},"de","en")}var it={de:"Deutsch","de-action":"Auf Deutsch anzeigen",demo:"Hallo Welt",en:"Englisch","en-action":"Auf Englisch anzeigen"},ot={de:"German","de-action":"Switch to German",demo:"Hello World",en:"English","en-action":"Switch to English"};class at extends N{constructor(){super(),this._lang="de",this.languages=["de","en"],this._i18n=P({en:ot,de:it},"de","en"),this._i18n.t("de"),this._i18n.t("de-action"),this._i18n.t("en"),this._i18n.t("en-action")}_getNextLanguage(t){var e=this.languages.indexOf(t),n=this.languages[e+1];return void 0===n&&(n=this.languages[0]),n}_getPreviousLanguage(t){var e=this.languages.indexOf(t),n=this.languages[e-1];return void 0===n&&(n=this.languages[this.languages.length-1]),n}static get properties(){return{lang:{type:String},next:{type:String},languages:{type:Array}}}set lang(t){const e=this.lang,n=this.next;this._lang=t,this.requestUpdate("lang",e),this.requestUpdate("next",n),e!==t&&(this.sendSetPropertyEvent("lang",t),this._i18n.changeLanguage(this.next))}get lang(){return this._lang}set next(t){this.lang=this._getPreviousLanguage(t)}get next(){return this._getNextLanguage(this.lang)}static get styles(){return j(n||(n=T` ${0} :host { display: inline-block; } a:hover { color: var(--dbp-hover-color, var(--dbp-content)); background-color: var(--dbp-hover-background-color); transition: none; } a { padding: 0.3em; display: inline-block; text-decoration: none; transition: background-color 0.15s, color 0.15s; color: var(--dbp-content); } input::-moz-focus-inner { border: 0; } :focus-visible { outline: none !important; outline-width: 0 !important; box-shadow: none; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: 0px 0px 4px 2px var(--dbp-primary); } `),G())}onClick(t){t.preventDefault(),this.lang=this.next}render(){var t=this._i18n.t(this.next+"-action");return V(i||(i=T` <a href="#" title="${0}" @click=${0}>${0}</a> `),t,this.onClick,this.next.toUpperCase())}}var rt={"logging-in":"Anmeldung läuft",login:"Anmelden","login-failed":"Kommunikation mit dem Anmeldeserver fehlgeschlagen",logout:"Abmelden"},st={"logging-in":"Logging in",login:"Login","login-failed":"Communication with the login server failed",logout:"Logout"};function lt(){return P({en:st,de:rt},"de","en")}class ct extends EventTarget{constructor(t,e,n,i,o,a){super(),this._baseURL=t,this._realm=e,this._clientId=n,this._keycloak=null,this._initPromise=null,this._silentCheckSsoUri=i,this._checkLoginIframe=o,this._idpHint=a,this._checkId=null,this.MIN_VALIDITY=20,this.CHECK_INTERVAL=10,this.DEBUG=!1,this._onVisibilityChanged=this._onVisibilityChanged.bind(this),document.addEventListener("visibilitychange",this._onVisibilityChanged)}close(){document.removeEventListener("visibilitychange",this._onVisibilityChanged)}_onVisibilityChanged(){"visible"===document.visibilityState&&this._checkTokeHasExpired()}_onChanged(){const t=new CustomEvent("changed",{detail:this._keycloak,bubbles:!0,composed:!0});this.dispatchEvent(t)}_onReady(t){t&&this._onChanged()}async _onTokenExpired(){console.log("Token has expired");let t=!1;try{t=await this._keycloak.updateToken(-1)}catch(t){return void console.log("Failed to refresh the token",t)}console.assert(t,"token should have been refreshed")}async _checkTokeHasExpired(){let t;if(null===this._keycloak||!this._keycloak.authenticated)return;let e=this.MIN_VALIDITY+this.CHECK_INTERVAL;this.DEBUG&&console.log(`Updating token if not valid for at least ${e}s`);try{t=await this._keycloak.updateToken(e)}catch(t){console.log("Failed to refresh the token",t)}this.DEBUG&&t&&console.log("token has been refreshed")}async _onAuthSuccess(){null!==this._checkId&&(clearInterval(this._checkId),this._checkId=null),this._checkId=setInterval(this._checkTokeHasExpired.bind(this),1e3*this.CHECK_INTERVAL),this._onChanged()}async _onAuthLogout(){null!==this._checkId&&(clearInterval(this._checkId),this._checkId=null),this._onChanged()}async _init(){const t=(await import("./shared/keycloak.DXlw3xkH.es.js")).default;this._keycloak=new t({url:this._baseURL,realm:this._realm,clientId:this._clientId}),this._keycloak.onTokenExpired=this._onTokenExpired.bind(this),this._keycloak.onAuthRefreshSuccess=this._onChanged.bind(this),this._keycloak.onAuthRefreshError=this._onChanged.bind(this),this._keycloak.onAuthLogout=this._onAuthLogout.bind(this),this._keycloak.onAuthSuccess=this._onAuthSuccess.bind(this),this._keycloak.onAuthError=this._onChanged.bind(this),this._keycloak.onReady=this._onReady.bind(this);const e={pkceMethod:"S256"};this.DEBUG&&(e.enableLogging=!0),e.checkLoginIframe=this._checkLoginIframe,this._silentCheckSsoUri?(e.onLoad="check-sso",e.silentCheckSsoRedirectUri=function(t){try{return new URL(t).href}catch(e){return new URL(t,window.location.href).href}}(this._silentCheckSsoUri),await function(t,e){let n=new Promise(((e,n)=>{let i=setTimeout((()=>{clearTimeout(i),n("Timed out in "+t+"ms.")}),t)}));return Promise.race([e,n])}(5e3,this._keycloak.init(e)).catch((()=>{console.log("Login timed out"),this._onChanged()}))):await this._keycloak.init(e)}async _ensureInit(){return null===this._initPromise&&(this._initPromise=this._init()),this._initPromise}isLoggingIn(){const t=window.location.href;return t.search("[&#]state=")>=0&&t.search("[&#]session_state=")>=0}async login(t){await this._ensureInit();const e=(t=t||{}).lang||"en",n=t.scope||"";this._keycloak.authenticated||await this._keycloak.login({locale:e,scope:n,idpHint:this._idpHint})}async tryLogin(){await this._ensureInit()}async localLogout(){this._keycloak.clearToken()}async logout(){await this._ensureInit(),this._keycloak.logout()}}const dt=Object.freeze({UNKNOWN:"unknown",LOGGING_IN:"logging-in",LOGGED_IN:"logged-in",LOGGING_OUT:"logging-out",LOGGED_OUT:"logged-out"});class ht extends N{constructor(){super(),this.forceLogin=!1,this.token="",this.subject="",this.name="",this.tryLogin=!1,this.entryPointUrl="",this._user=null,this._userId="",this._authenticated=!1,this._loginStatus=dt.UNKNOWN,this.requestedLoginStatus=dt.UNKNOWN,this._i18n=lt(),this.lang=this._i18n.language,this.keycloakUrl=null,this.realm=null,this.clientId=null,this.silentCheckSsoRedirectUri=null,this.noCheckLoginIframe=!1,this.scope=null,this.idpHint="",this._onKCChanged=this._onKCChanged.bind(this),window.playwright&&this.setAttribute("data-testid","dbp-auth-keycloak")}update(t){t.forEach(((t,e)=>{switch(e){case"lang":this._i18n.changeLanguage(this.lang);break;case"requestedLoginStatus":switch(console.log("requested-login-status changed",this.requestedLoginStatus),this.requestedLoginStatus){case dt.LOGGED_IN:this._kcwrapper.login({lang:this.lang,scope:this.scope||""});break;case dt.LOGGED_OUT:this._loginStatus===dt.LOGGED_IN&&this._setLoginStatus(dt.LOGGING_OUT),this._kcwrapper.logout(),this._loginStatus===dt.LOGGING_OUT&&this._setLoginStatus(dt.LOGGED_IN)}}})),super.update(t)}async _fetchUser(t){var e;const n=M(this.entryPointUrl,`/frontend/users/${encodeURIComponent(t)}`);let i=await fetch(n,{headers:{Authorization:"Bearer "+this.token}});if(!i.ok)throw i;return{roles:null!=(e=(await i.json()).roles)?e:[]}}async _onKCChanged(t){const e=t.detail;if(this._authenticated=e.authenticated,e.authenticated){let t=this.token!==e.token;this.name=e.idTokenParsed.name,this.token=e.token,this.subject=e.subject;const n=e.idTokenParsed.preferred_username;let i=n!==this._userId;if(i){let t;this._userId=n;try{t=await this._fetchUser(n)}catch(e){console.error(e),t={roles:[]}}n===this._userId&&(this._user=t)}null!==this._user&&this._setLoginStatus(dt.LOGGED_IN,t||i)}else this._loginStatus===dt.LOGGED_IN&&this._setLoginStatus(dt.LOGGING_OUT),this.name="",this.token="",this.subject="",this._userId="",this._user=null,this._setLoginStatus(dt.LOGGED_OUT)}sendSetPropertyEvents(){const t={"login-status":this._loginStatus,subject:this.subject,token:this.token,"user-full-name":this.name,"user-id":this._userId,"person-id":this._userId,person:this._user};(window.Cypress||window.playwright)&&(window.DBPAuth=t,console.log("Cypress/Playwright detected")),this.setAttribute("data-auth-set","true"),this.sendSetPropertyEvent("auth",t)}_setLoginStatus(t,e){(this._loginStatus!==t||e)&&(this._loginStatus=t,this.sendSetPropertyEvents())}static get properties(){return O({},super.properties,{lang:{type:String},forceLogin:{type:Boolean,attribute:"force-login"},tryLogin:{type:Boolean,attribute:"try-login"},entryPointUrl:{type:String,attribute:"entry-point-url"},name:{type:String,attribute:!1},token:{type:String,attribute:!1},subject:{type:String,attribute:!1},_userId:{type:String,attribute:!1},_user:{type:Object,attribute:!1},_loginStatus:{type:String,attribute:!1},keycloakUrl:{type:String,attribute:"url"},realm:{type:String},clientId:{type:String,attribute:"client-id"},silentCheckSsoRedirectUri:{type:String,attribute:"silent-check-sso-redirect-uri"},scope:{type:String},idpHint:{type:String,attribute:"idp-hint"},requestedLoginStatus:{type:String,attribute:"requested-login-status"},noCheckLoginIframe:{type:Boolean,attribute:"no-check-login-iframe"}})}connectedCallback(){var t=this;if(super.connectedCallback(),!this.keycloakUrl)throw Error("url not set");if(!this.realm)throw Error("realm not set");if(!this.clientId)throw Error("client-id not set");this._kcwrapper=new ct(this.keycloakUrl,this.realm,this.clientId,this.silentCheckSsoRedirectUri,!this.noCheckLoginIframe,this.idpHint),this._kcwrapper.addEventListener("changed",this._onKCChanged);!async function(){try{t.forceLogin||t._kcwrapper.isLoggingIn()?(t._setLoginStatus(dt.LOGGING_IN),await t._kcwrapper.login({lang:t.lang,scope:t.scope||""})):t.tryLogin?(t._setLoginStatus(dt.LOGGING_IN),await t._kcwrapper.tryLogin(),t._authenticated||t._setLoginStatus(dt.LOGGED_OUT)):t._setLoginStatus(dt.LOGGED_OUT)}catch(e){throw t._setLoginStatus(dt.LOGGED_OUT),$({summary:t._i18n.t("login-failed"),type:"danger",timeout:5}),e}}()}disconnectedCallback(){this._kcwrapper.close(),this._kcwrapper.removeEventListener("changed",this._onKCChanged),super.disconnectedCallback()}}B(N);class ut extends(B(N)){constructor(){super(),this._i18n=nt(),this.lang=this._i18n.language,this.auth={},this.closeDropdown=this.closeDropdown.bind(this),this.onWindowResize=this.onWindowResize.bind(this)}static get scopedElements(){return{"dbp-icon":W}}static get properties(){return O({},super.properties,{lang:{type:String},auth:{type:Object}})}onWindowResize(){this.updateDropdownWidth()}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.onWindowResize),document.addEventListener("click",this.closeDropdown)}disconnectedCallback(){window.removeEventListener("resize",this.onWindowResize),document.removeEventListener("click",this.closeDropdown),super.disconnectedCallback()}updateDropdownWidth(){const t=this.shadowRoot.querySelector("div.dropdown-menu");if(!t)return;let e=this.getBoundingClientRect(),n=window.innerWidth-e.left;t.setAttribute("style",`width: ${n-20}px`)}onLoginClicked(t){this.sendSetPropertyEvent("requested-login-status",dt.LOGGED_IN),t.preventDefault()}onLogoutClicked(t){this.sendSetPropertyEvent("requested-login-status",dt.LOGGED_OUT)}update(t){t.forEach(((t,e)=>{"lang"===e&&this._i18n.changeLanguage(this.lang)})),super.update(t)}static get styles(){return j(o||(o=T` ${0} :host { display: inline-block; } a { color: var(--dbp-content); fill: var(--dbp-content); cursor: pointer; text-decoration: none; display: block; } input::-moz-focus-inner { border: 0; } :focus-visible { outline: none !important; outline-width: 0 !important; box-shadow: none; -moz-box-shadow: none; -webkit-box-shadow: none; box-shadow: 0px 0px 4px 2px var(--dbp-primary); } .dropdown.is-active .dropdown-menu, .dropdown.is-hoverable:hover .dropdown-menu { display: block; } .dropdown-menu { display: none; min-width: 5em; max-width: 25em; position: absolute; z-index: 20; border: var(--dbp-border); border-radius: 0px; overflow: hidden; background-color: var(--dbp-background); } .dropdown-content { padding-bottom: 0.5rem; padding-top: 0.5rem; } .menu a { /*padding: 0.3em;*/ font-weight: 400; color: var(--dbp-content); display: block; text-decoration: none; } .menu a:hover { color: var(--dbp-hover-color, var(--dbp-content)); background-color: var(--dbp-hover-background-color); } .menu a.selected { color: var(--dbp-on-secondary-surface); background-color: var(--dbp-secondary-surface); } .dropdown-item { color: var(--dbp-muted); display: block; font-size: 0.875rem; line-height: 1.5; padding: 0.375rem 1rem; margin-left: 0.5em; margin-right: 0.5em; padding-left: 0.5em; padding-right: 0.5em; position: relative; } .dropdown { cursor: pointer; } a.dropdown-item { width: initial !important; } .main-button { min-width: 150px; } .menu-icon { height: 1em; width: 1em; vertical-align: -0.1rem; } .login-box svg { width: 1.1em; height: 1.1em; display: flex; } .login-button { padding: 0.3em 0.4em; transition: background-color 0.15s, color 0.15s; } .login-button:hover { color: var(--dbp-hover-color, var(--dbp-content)); background-color: var(--dbp-hover-background-color); cursor: pointer; transition: none; } .login-box { display: flex; align-items: center; } .login-box:hover svg path { fill: var(--dbp-hover-color); } .login-box .label { padding-left: 0.2em; } .dropdown-trigger { display: flex; align-items: center; } .dropdown-trigger .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; margin-right: 0.5em; } `),G())}setChevron(t){const e=this.shadowRoot.querySelector("#menu-chevron-icon");null!==e&&(e.name=t)}onDropdownClick(t){t.stopPropagation(),t.currentTarget.classList.toggle("is-active"),this.setChevron(t.currentTarget.classList.contains("is-active")?"chevron-up":"chevron-down"),this.updateDropdownWidth()}closeDropdown(){this.shadowRoot.querySelectorAll(".dropdown").forEach((function(t){t.classList.remove("is-active")})),this.setChevron("chevron-down")}renderLoggedIn(){const t=this._i18n;return V(a||(a=T` <div class="dropdown" @click="${0}"> <a href="#"> <div class="dropdown-trigger login-button"> <div class="name">${0}</div> <dbp-icon class="menu-icon" name="chevron-down" id="menu-chevron-icon"></dbp-icon> </div> </a> <div class="dropdown-menu" id="dropdown-menu2" role="menu"> <div class="dropdown-content" @blur="${0}"> <div class="menu"> <a href="#" @click="${0}" class="dropdown-item"> ${0} </a> </div> </div> </div> </div> `),this.onDropdownClick,this.auth["user-full-name"],this.closeDropdown,this.onLogoutClicked,t.t("logout"))}renderLoggedOut(){const t=this._i18n;return V(r||(r=T` <a href="#" @click="${0}"> <div class="login-box login-button"> <div class="icon" aria-hidden="true">${0}</div> <div class="label">${0}</div> </div> </a> `),this.onLoginClicked,z('\n <svg\n viewBox="0 0 100 100"\n y="0px"\n x="0px"\n id="icon"\n role="img"\n version="1.1">\n <g\n id="g6">\n <path\n style="stroke-width:1.33417916"\n id="path2"\n d="m 42.943908,38.894934 5.885859,6.967885 H 5.4215537 c -1.8393311,0 -3.4334181,1.741972 -3.4334181,4.064599 0,2.322628 1.4714649,4.064599 3.4334181,4.064599 H 48.829767 L 42.943908,60.9599 c -1.348843,1.596808 -1.348843,4.064599 0,5.661406 1.348843,1.596808 3.433418,1.596808 4.782261,0 L 61.705085,49.927418 47.726169,33.378693 c -1.348843,-1.596806 -3.433418,-1.596806 -4.782261,0 -1.348843,1.596807 -1.348843,4.064599 0,5.516241 z" />\n <path\n id="path4"\n d="m 50,2.3007812 c -18.777325,0 -35.049449,10.9124408 -42.8261719,26.7246098 H 13.390625 C 20.672112,16.348362 34.336876,7.8007812 50,7.8007812 73.3,7.8007812 92.300781,26.7 92.300781,50 92.300781,73.3 73.3,92.300781 50,92.300781 c -15.673389,0 -29.345175,-8.60579 -36.623047,-21.326172 H 7.1640625 C 14.942553,86.8272 31.242598,97.800781 50.099609,97.800781 76.399609,97.800781 97.900391,76.4 97.900391,50 97.800391,23.7 76.3,2.3007812 50,2.3007812 Z" />\n </g>\n </svg>\n '),t.t("login"))}render(){const t="logged-in"===this.auth["login-status"];return V(s||(s=T` <div class="authbox">${0}</div> `),t?this.renderLoggedIn():this.renderLoggedOut())}}var pt={"add-notification":"Benachrichtigung hinzufügen","open-dialog":"Dialog öffnen",send:"Senden"},gt={"add-notification":"Add Notification","open-dialog":"Open Dialog",send:"Send"};class ft extends F{constructor(){super(),this._i18n=P({en:gt,de:pt},"de","en"),this.lang=this._i18n.language,this.notificationBlock=null,this.notifications={},this.targetNotificationId=null}static get properties(){return O({},super.properties,{lang:{type:String},inline:{type:Boolean,attribute:"inline"}})}connectedCallback(){super.connectedCallback(),window.addEventListener("dbp-notification-send",(t=>{const e=t;if(void 0===e.detail)return;if(this.targetNotificationId=void 0!==e.detail.targetNotificationId?e.detail.targetNotificationId:null,this.targetNotificationId&&this.targetNotificationId!==this.id)return;if(!this.targetNotificationId&&"dbp-notification"!==this.id)return;this.notificationBlock=this._("#notification-container");const n=`notification-${(()=>{let t=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?n:3&n|8).toString(16)}))})()}`;this.notifications[n]={},this.notifications[n].id=n,this.notifications[n].messageSelector=`#${n}`;const i=void 0!==e.detail.type?e.detail.type:"info",o=void 0!==e.detail.body?e.detail.body:"",a=void 0!==e.detail.summary?e.detail.summary:"",r=void 0!==e.detail.timeout?e.detail.timeout:0,s=void 0!==e.detail.icon?e.detail.icon:"",l=""!==s?`<dbp-icon name="${s}"></dbp-icon>`:"",c=""!==a?`<h3>${a}</h3>`:"",d=void 0!==e.detail.replaceId?e.detail.replaceId:null;if(d)for(const t in this.notifications)this.notifications[t].replaceId===d&&this.removeMessageById(this.notifications[t]);this.notifications[n].replaceId=d;const h=r>0?`<div class="progress-container"><div class="progress" style="--dbp-progress-timeout: ${r}s;"></div></div>`:"",u=r>0?"has-progress-bar":"no-progress-bar",p=document.createElement("div");p.id=n,p.classList.add("notification","enter-animation",`is-${i}`,u),p.innerHTML=`\n <button id="${n}-button" class="delete"></button>\n ${c}\n ${l} ${o}\n ${h}\n `,this.notificationBlock.appendChild(p);this.notificationBlock.querySelector(`#${n}-button`).addEventListener("click",(()=>this.removeMessageById(this.notifications[n]))),r>0&&(this.notifications[n].progressTimeout=setTimeout((()=>{this.removeMessageById(this.notifications[n])}),1e3*r)),t.preventDefault()}))}disconnectedCallback(){super.disconnectedCallback();for(const t of Object.values(this.notifications))clearTimeout(t.progressTimeout)}removeMessageById(t,e=!1){const n=t.messageSelector,i=this._(n);if(i){const n=e?0:500;i.classList.add("is-removing"),setTimeout((()=>{this.notificationBlock.removeChild(i);const t=new CustomEvent("dbp-notification-close",{detail:{targetNotificationId:this.targetNotificationId},bubbles:!0,composed:!0});this.dispatchEvent(t)}),n),clearTimeout(this.notifications[t.id].progressTimeout),delete this.notifications[t.id]}}removeAllNotifications(){for(const t of Object.values(this.notifications))this.removeMessageById(t,!0)}static get styles(){return j(l||(l=T` ${0} ${0} ${0} .notification-container { position: fixed; top: 0; max-width: 500px; margin: 0.75em auto; left: 0; right: 0; z-index: 1000; padding: 0; } :host([inline]) .notification-container { top: 0; left: 0; right: 0; max-width: 100%; margin: 0 auto; display: flex; flex-direction: column; } :host([inline]) .notification-container--inside { margin-top: 60px; } :host([inline]) .notification:not(:last-child) { /* margin-bottom: 1rem; */ } .notification h3 { font: inherit; font-weight: bold; margin-bottom: 3px; } .delete, .modal-close { -moz-appearance: none; -webkit-appearance: none; background-color: rgba(10, 10, 10, 0.2); border: none; border-radius: 290486px; cursor: pointer; pointer-events: auto; display: inline-block; flex-grow: 0; flex-shrink: 0; font-size: 0; height: 20px; max-height: 20px; max-width: 20px; min-height: 20px; min-width: 20px; outline: 0; position: relative; vertical-align: top; width: 20px; } .delete::before, .modal-close::before, .delete::after, .modal-close::after { background-color: var(--dbp-background); color: var(--dbp-content); content: ''; display: block; left: 50%; position: absolute; top: 50%; -webkit-transform: translateX(-50%) translateY(-50%) rotate(45deg); transform: translateX(-50%) translateY(-50%) rotate(45deg); -webkit-transform-origin: center center; transform-origin: center center; } .delete::before, .modal-close::before { height: 2px; width: 50%; } .delete::after, .modal-close::after { height: 50%; width: 2px; } .delete:hover, .modal-close:hover, .delete:focus, .modal-close:focus { background-color: rgba(10, 10, 10, 0.3); } .delete:active, .modal-close:active { background-color: rgba(10, 10, 10, 0.4); } `),G(),q(),K())}render(){return V(c||(c=T` <div class="columns"> <div class="column notification-container" id="notification-container"></div> </div> `))}}var mt={"color-mode":"Farbmodus ändern","demo-title":"Theme Switcher Demo",intro:"Mit dem Theme-Switcher können Sie zwischen unterschiedlichen Farb-Themes umschalten."},bt={"color-mode":"Change color mode","demo-title":"Theme Switcher Demo",intro:"With the theme-switcher you can switch between multiple themes."};class vt extends(B(N)){constructor(){super(),this._i18n=P({en:bt,de:mt},"de","en"),this.lang=this._i18n.language,this.themes=[],this.boundCloseAdditionalMenuHandler=this.hideModeMenu.bind(this),this.detectBrowserDarkMode=!1,this.darkModeClass="dark-theme",this.langDir="",this.dropdownRight=!1,this.darkModeThemeOverride=null}static get properties(){return O({},super.properties,{lang:{type:String},themes:{type:Array,attribute:"themes"},darkModeThemeOverride:{type:String,attribute:"dark-mode-theme-override"},dropdownRight:{type:Boolean,attribute:"dropdown-right"},langDir:{type:String,attribute:"lang-dir"}})}static get scopedElements(){return{"dbp-icon":W}}update(t){t.forEach(((t,e)=>{"lang"===e&&this._i18n.changeLanguage(this.lang)})),super.update(t)}connectedCallback(){super.connectedCallback(),this.updateComplete.then((()=>{null===this.darkModeThemeOverride?this.detectBrowserDarkMode=!0:""===this.darkModeThemeOverride?this.detectBrowserDarkMode=!1:(this.detectBrowserDarkMode=!0,this.darkModeClass=this.darkModeThemeOverride),this.loadTheme("light-theme"),this.detectInitialMode()})),this.langDir&&Y(this._i18n,this)}detectInitialMode(){let t=localStorage.getItem("prefered-color-mode");if(t){const e=this.themes.find((e=>e.class===t));e&&this.loadTheme(e.class)}else if(this.detectBrowserDarkMode){if(window.matchMedia("(prefers-color-scheme: dark)").matches){const t=this.themes.find((t=>t.class===this.darkModeClass));t&&this.loadTheme(t.class)}}}toggleModeMenu(){const t=this.shadowRoot.querySelector(".mode-button");if(!t)return;t.classList.contains("active")?t.classList.remove("active"):t.classList.add("active");const e=this.shadowRoot.querySelector("ul.extended-menu"),n=this.shadowRoot.querySelector(".mode-button");null!==e&&null!==n&&(e.classList.toggle("hidden"),e.classList.contains("hidden")?document.removeEventListener("click",this.boundCloseAdditionalMenuHandler):(document.addEventListener("click",this.boundCloseAdditionalMenuHandler),this.initateOpenAdditionalMenu=!0))}hideModeMenu(){if(this.initateOpenAdditionalMenu)return void(this.initateOpenAdditionalMenu=!1);const t=this.shadowRoot.querySelector("ul.extended-menu");t&&!t.classList.contains("hidden")&&this.toggleModeMenu()}loadTheme(t){const e=this.shadowRoot.querySelector(".button-"+t),n=this.shadowRoot.querySelectorAll(".button-theme"),i=this.shadowRoot.host.getRootNode({composed:!0}).body;null!==e&&0!==n.length&&null!==i&&(n.forEach((t=>t.classList.remove("active"))),e.classList.add("active"),i.classList.contains(t)||(this.themes.forEach((t=>{i.classList.remove(t.class)})),i.classList.add(t)))}saveTheme(t){const e=window.matchMedia("(prefers-color-scheme: dark)"),n=window.matchMedia("(prefers-color-scheme: light)");"light-theme"===t&&n.matches||t===this.darkModeClass&&e.matches?localStorage.removeItem("prefered-color-mode"):localStorage.setItem("prefered-color-mode",t)}static get styles(){return j(d||(d=T` ${0} ${0} ${0} mode-button, button.button { border: none; } .active, .extended-menu li a.active dbp-icon { color: var(--dbp-accent); } .active { font-weight: bolder; } a:hover:not(.active), .extended-menu li a:hover:not(.active) { color: var(--dbp-hover-color, var(--dbp-content)); background-color: var(--dbp-hover-background-color); transition: none; } a { padding: 0.3em; display: inline-block; text-decoration: none; transition: background-color 0.15s, color 0.15s; color: var(--dbp-content); } .extended-menu { list-style: none; border: var(--dbp-border); position: absolute; background-color: var(--dbp-background); z-index: 1000; border-radius: var(--dbp-border-radius); } .extended-menu li { text-align: left; min-width: 160px; } .extended-menu li a { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 12px 15px; width: 100%; box-sizing: border-box; text-align: left; color: var(--dbp-content); background: none; display: block; } .icon { margin-right: 10px; } #theme-menu { position: relative; } .ul-right { right: 0px; } `),G(),q(),J())}render(){const t=this._i18n;return V(h||(h=T` <div id="theme-menu" class="${0}"> <a href="#" class="mode-button" title="${0}" @click="${0}"> <dbp-icon name="contrast"></dbp-icon> </a> <ul class="extended-menu hidden ${0}"> ${0} </ul> </div> `),R({hidden:this.themes.length<=1}),t.t("color-mode"),(t=>{this.toggleModeMenu(),t.preventDefault()}),R({"ul-right":this.dropdownRight}),this.themes.map((t=>V(u||(u=T` <li class="" id="${0}"> <a href="#" class="button-theme button-${0}" @click="${0}" title="${0}"> <dbp-icon class="icon" name="${0}"></dbp-icon> ${0} </a> </li> `),t.class,t.class,(e=>{this.loadTheme(t.class),this.saveTheme(t.class),e.preventDefault()}),t.name,t.icon,t.name))))}}class yt extends N{constructor(){super(),this._observer=null,this._dark=!1}static get properties(){return O({},super.properties,{_dark:{type:Boolean}})}static get styles(){return j(p||(p=T` .hidden { display: none; } `))}connectedCallback(){super.connectedCallback(),this._observer=new MutationObserver((()=>{this._dark=document.body.classList.contains("dark-theme")})),this._observer.observe(document.body,{attributes:!0,attributeFilter:["class"]})}disconnectedCallback(){this._observer.disconnect(),this._observer=null,super.disconnectedCallback()}render(){return V(g||(g=T` <slot class="${0}" name="light"></slot> <slot class="${0}" name="dark"></slot> `),R({hidden:this._dark}),R({hidden:!this._dark}))}}function wt(t,e){void 0===e&&(e={});for(var n=function(t){for(var e=[],n=0;n<t.length;){var i=t[n];if("*"!==i&&"+"!==i&&"?"!==i)if("\\"!==i)if("{"!==i)if("}"!==i)if(":"!==i)if("("!==i)e.push({type:"CHAR",index:n,value:t[n++]});else{var o=1,a="";if("?"===t[s=n+1])throw new TypeError('Pattern cannot start with "?" at '.concat(s));for(;s<t.length;)if("\\"!==t[s]){if(")"===t[s]){if(0==--o){s++;break}}else if("("===t[s]&&(o++,"?"!==t[s+1]))throw new TypeError("Capturing groups are not allowed at ".concat(s));a+=t[s++]}else a+=t[s++]+t[s++];if(o)throw new TypeError("Unbalanced pattern at ".concat(n));if(!a)throw new TypeError("Missing pattern at ".concat(n));e.push({type:"PATTERN",index:n,value:a}),n=s}else{for(var r="",s=n+1;s<t.length;){var l=t.charCodeAt(s);if(!(l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||95===l))break;r+=t[s++]}if(!r)throw new TypeError("Missing parameter name at ".concat(n));e.push({type:"NAME",index:n,value:r}),n=s}else e.push({type:"CLOSE",index:n,value:t[n++]});else e.push({type:"OPEN",index:n,value:t[n++]});else e.push({type:"ESCAPED_CHAR",index:n++,value:t[n++]});else e.push({type:"MODIFIER",index:n,value:t[n++]})}return e.push({type:"END",index:n,value:""}),e}(t),i=e.prefixes,o=void 0===i?"./":i,a="[^".concat(kt(e.delimiter||"/#?"),"]+?"),r=[],s=0,l=0,c="",d=function(t){if(l<n.length&&n[l].type===t)return n[l++].value},h=function(t){var e=d(t);if(void 0!==e)return e;var i=n[l],o=i.type,a=i.index;throw new TypeError("Unexpected ".concat(o," at ").concat(a,", expected ").concat(t))},u=function(){for(var t,e="";t=d("CHAR")||d("ESCAPED_CHAR");)e+=t;return e};l<n.length;){var p=d("CHAR"),g=d("NAME"),f=d("PATTERN");if(g||f){var m=p||"";-1===o.indexOf(m)&&(c+=m,m=""),c&&(r.push(c),c=""),r.push({name:g||s++,prefix:m,suffix:"",pattern:f||a,modifier:d("MODIFIER")||""})}else{var b=p||d("ESCAPED_CHAR");if(b)c+=b;else if(c&&(r.push(c),c=""),d("OPEN")){m=u();var v=d("NAME")||"",y=d("PATTERN")||"",w=u();h("CLOSE"),r.push({name:v||(y?s++:""),pattern:v&&!y?a:y,prefix:m,suffix:w,modifier:d("MODIFIER")||""})}else h("END")}}return r}function xt(t,e){var n=[];return function(t,e,n){void 0===n&&(n={});var i=n.decode,o=void 0===i?function(t){return t}:i;return function(n){var i=t.exec(n);if(!i)return!1;for(var a=i[0],r=i.index,s=Object.create(null),l=function(t){if(void 0===i[t])return"continue";var n=e[t-1];"*"===n.modifier||"+"===n.modifier?s[n.name]=i[t].split(n.prefix+n.suffix).map((function(t){return o(t,n)})):s[n.name]=o(i[t],n)},c=1;c<i.length;c++)l(c);return{path:a,index:r,params:s}}}(Ct(t,n,e),n,e)}function kt(t){return t.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function _t(t){return t&&t.sensitive?"":"i"}function Et(t,e,n){return function(t,e,n){void 0===n&&(n={});for(var i=n.strict,o=void 0!==i&&i,a=n.start,r=void 0===a||a,s=n.end,l=void 0===s||s,c=n.encode,d=void 0===c?function(t){return t}:c,h=n.delimiter,u=void 0===h?"/#?":h,p=n.endsWith,g="[".concat(kt(void 0===p?"":p),"]|$"),f="[".concat(kt(u),"