@pod-os/elements 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/ion-app_34.cjs.entry.js +35379 -33168
- package/dist/custom-elements/index.js +35433 -33222
- package/dist/elements/elements.esm.js +1 -1
- package/dist/elements/p-7986b311.entry.js +61 -0
- package/dist/esm/ion-app_34.entry.js +35253 -33042
- package/package.json +2 -2
- package/dist/elements/p-6a64c6cf.entry.js +0 -74
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import{r as t,h as e,H as n,a as i,c as r,f as o,d as s,w as a,e as u,i as c}from"./p-a712c2f6.js";import{g as l,c as h,a as d}from"./p-8d1d6062.js";import{h as f,i as p,c as v,r as g}from"./p-735719e4.js";import{o as m,c as w,h as b}from"./p-cfc0e54d.js";const y=class{constructor(e){t(this,e)}componentDidLoad(){k((async()=>{const t=d(window,"hybrid");h.getBoolean("_testing")||import("./p-1aa0e849.js").then((t=>t.startTapClick(h))),h.getBoolean("statusTap",t)&&import("./p-854dbdf1.js").then((t=>t.startStatusTap())),h.getBoolean("inputShims",x())&&import("./p-039fd555.js").then((t=>t.startInputShims(h)));const e=await import("./p-03bda390.js");h.getBoolean("hardwareBackButton",t)?e.startHardwareBackButton():e.blockHardwareBackButton(),"undefined"!=typeof window&&import("./p-91fe653f.js").then((t=>t.startKeyboardAssist(window))),import("./p-aab0f63c.js").then((t=>t.startFocusVisible()))}))}render(){const t=l(this);return e(n,{class:{[t]:!0,"ion-page":!0,"force-statusbar-padding":h.getBoolean("_forceStatusbarPadding")}})}get el(){return i(this)}},x=()=>d(window,"ios")&&d(window,"mobile"),k=t=>{"requestIdleCallback"in window?window.requestIdleCallback(t):setTimeout(t,32)};y.style="html.plt-mobile ion-app{user-select:none}html.plt-mobile ion-app [contenteditable]{user-select:text}ion-app.force-statusbar-padding{--ion-safe-area-top:20px}";const E=class{constructor(e){t(this,e),this.ionFocus=r(this,"ionFocus",7),this.ionBlur=r(this,"ionBlur",7),this.inItem=!1,this.inListHeader=!1,this.inToolbar=!1,this.inheritedAttributes={},this.buttonType="button",this.disabled=!1,this.routerDirection="forward",this.strong=!1,this.type="button",this.handleClick=t=>{if("button"===this.type)m(this.href,t,this.routerDirection,this.routerAnimation);else if(f(this.el)){const e=this.el.closest("form");if(e){t.preventDefault();const n=document.createElement("button");n.type=this.type,n.style.display="none",e.appendChild(n),n.click(),n.remove()}}},this.onFocus=()=>{this.ionFocus.emit()},this.onBlur=()=>{this.ionBlur.emit()}}componentWillLoad(){this.inToolbar=!!this.el.closest("ion-buttons"),this.inListHeader=!!this.el.closest("ion-list-header"),this.inItem=!!this.el.closest("ion-item")||!!this.el.closest("ion-item-divider"),this.inheritedAttributes=p(this.el)}get hasIconOnly(){return!!this.el.querySelector('[slot="icon-only"]')}get rippleType(){return(void 0===this.fill||"clear"===this.fill)&&this.hasIconOnly&&this.inToolbar?"unbounded":"bounded"}render(){const t=l(this),{buttonType:i,type:r,disabled:o,rel:s,target:a,size:u,href:c,color:h,expand:d,hasIconOnly:f,shape:p,strong:v,inheritedAttributes:g}=this,m=void 0===u&&this.inItem?"small":u,y=void 0===c?"button":"a",x="button"===y?{type:r}:{download:this.download,href:c,rel:s,target:a};let k=this.fill;return void 0===k&&(k=this.inToolbar||this.inListHeader?"clear":"solid"),e(n,{onClick:this.handleClick,"aria-disabled":o?"true":null,class:w(h,{[t]:!0,[i]:!0,[`${i}-${d}`]:void 0!==d,[`${i}-${m}`]:void 0!==m,[`${i}-${p}`]:void 0!==p,[`${i}-${k}`]:!0,[`${i}-strong`]:v,"in-toolbar":b("ion-toolbar",this.el),"in-toolbar-color":b("ion-toolbar[color]",this.el),"button-has-icon-only":f,"button-disabled":o,"ion-activatable":!0,"ion-focusable":!0})},e(y,Object.assign({},x,{class:"button-native",part:"native",disabled:o,onFocus:this.onFocus,onBlur:this.onBlur},g),e("span",{class:"button-inner"},e("slot",{name:"icon-only"}),e("slot",{name:"start"}),e("slot",null),e("slot",{name:"end"})),"md"===t&&e("ion-ripple-effect",{type:this.rippleType})))}get el(){return i(this)}};E.style={ios:':host{--overflow:hidden;--ripple-color:currentColor;--border-width:initial;--border-color:initial;--border-style:initial;--color-activated:var(--color);--color-focused:var(--color);--color-hover:var(--color);--box-shadow:none;display:inline-block;width:auto;color:var(--color);font-family:var(--ion-font-family, inherit);text-align:center;text-decoration:none;text-overflow:ellipsis;white-space:nowrap;user-select:none;vertical-align:top;vertical-align:-webkit-baseline-middle;font-kerning:none}:host(.button-disabled){cursor:default;opacity:0.5;pointer-events:none}:host(.button-solid){--background:var(--ion-color-primary, #3880ff);--color:var(--ion-color-primary-contrast, #fff)}:host(.button-outline){--border-color:var(--ion-color-primary, #3880ff);--background:transparent;--color:var(--ion-color-primary, #3880ff)}:host(.button-clear){--border-width:0;--background:transparent;--color:var(--ion-color-primary, #3880ff)}:host(.button-block){display:block}:host(.button-block) .button-native{margin-left:0;margin-right:0;display:block;width:100%;clear:both;contain:content}:host(.button-block) .button-native::after{clear:both}:host(.button-full){display:block}:host(.button-full) .button-native{margin-left:0;margin-right:0;display:block;width:100%;contain:content}:host(.button-full:not(.button-round)) .button-native{border-radius:0;border-right-width:0;border-left-width:0}.button-native{border-radius:var(--border-radius);-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:block;position:relative;width:100%;height:100%;transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);outline:none;background:var(--background);line-height:1;box-shadow:var(--box-shadow);contain:layout style;cursor:pointer;opacity:var(--opacity);overflow:var(--overflow);z-index:0;box-sizing:border-box;appearance:none}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.button-native{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}.button-native::-moz-focus-inner{border:0}.button-inner{display:flex;position:relative;flex-flow:row nowrap;flex-shrink:0;align-items:center;justify-content:center;width:100%;height:100%;z-index:1}::slotted(ion-icon){font-size:1.4em;pointer-events:none}::slotted(ion-icon[slot=start]){margin-left:-0.3em;margin-right:0.3em;margin-top:0;margin-bottom:0}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-icon[slot=start]){margin-left:unset;margin-right:unset;-webkit-margin-start:-0.3em;margin-inline-start:-0.3em;-webkit-margin-end:0.3em;margin-inline-end:0.3em}}::slotted(ion-icon[slot=end]){margin-left:0.3em;margin-right:-0.2em;margin-top:0;margin-bottom:0}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-icon[slot=end]){margin-left:unset;margin-right:unset;-webkit-margin-start:0.3em;margin-inline-start:0.3em;-webkit-margin-end:-0.2em;margin-inline-end:-0.2em}}::slotted(ion-icon[slot=icon-only]){font-size:1.8em}ion-ripple-effect{color:var(--ripple-color)}.button-native::after{left:0;right:0;top:0;bottom:0;position:absolute;content:"";opacity:0}:host(.ion-activated){color:var(--color-activated)}:host(.ion-activated) .button-native::after{background:var(--background-activated);opacity:var(--background-activated-opacity)}:host(.ion-focused){color:var(--color-focused)}:host(.ion-focused) .button-native::after{background:var(--background-focused);opacity:var(--background-focused-opacity)}@media (any-hover: hover){:host(:hover){color:var(--color-hover)}:host(:hover) .button-native::after{background:var(--background-hover);opacity:var(--background-hover-opacity)}}:host(.button-solid.ion-color) .button-native{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.button-outline.ion-color) .button-native{border-color:var(--ion-color-base);background:transparent;color:var(--ion-color-base)}:host(.button-clear.ion-color) .button-native{background:transparent;color:var(--ion-color-base)}:host(.in-toolbar:not(.ion-color):not(.in-toolbar-color)) .button-native{color:var(--ion-toolbar-color, var(--color))}:host(.button-outline.in-toolbar:not(.ion-color):not(.in-toolbar-color)) .button-native{border-color:var(--ion-toolbar-color, var(--color, var(--border-color)))}:host(.button-solid.in-toolbar:not(.ion-color):not(.in-toolbar-color)) .button-native{background:var(--ion-toolbar-color, var(--background));color:var(--ion-toolbar-background, var(--color))}:host{--border-radius:10px;--padding-top:0;--padding-bottom:0;--padding-start:1em;--padding-end:1em;--transition:background-color, opacity 100ms linear;margin-left:2px;margin-right:2px;margin-top:4px;margin-bottom:4px;height:2.8em;font-size:16px;font-weight:500;letter-spacing:-0.03em}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{margin-left:unset;margin-right:unset;-webkit-margin-start:2px;margin-inline-start:2px;-webkit-margin-end:2px;margin-inline-end:2px}}:host(.button-solid){--background-activated:var(--ion-color-primary-shade, #3171e0);--background-focused:var(--ion-color-primary-shade, #3171e0);--background-hover:var(--ion-color-primary-tint, #4c8dff);--background-activated-opacity:1;--background-focused-opacity:1;--background-hover-opacity:1}:host(.button-outline){--border-radius:10px;--border-width:1px;--border-style:solid;--background-activated:var(--ion-color-primary, #3880ff);--background-focused:var(--ion-color-primary, #3880ff);--background-hover:transparent;--background-focused-opacity:.1;--color-activated:var(--ion-color-primary-contrast, #fff)}:host(.button-clear){--background-activated:transparent;--background-focused:var(--ion-color-primary, #3880ff);--background-hover:transparent;--background-focused-opacity:.1;font-size:17px;font-weight:normal;letter-spacing:0}:host(.button-large){--border-radius:12px;--padding-top:0;--padding-start:1em;--padding-end:1em;--padding-bottom:0;height:2.8em;font-size:20px}:host(.button-small){--border-radius:6px;--padding-top:0;--padding-start:0.9em;--padding-end:0.9em;--padding-bottom:0;height:2.1em;font-size:13px}:host(.button-round){--border-radius:64px;--padding-top:0;--padding-start:26px;--padding-end:26px;--padding-bottom:0}:host(.button-strong){font-weight:600}:host(.button-clear.ion-activated){opacity:0.4}:host(.button-outline.ion-activated.ion-color) .button-native{color:var(--ion-color-contrast)}:host(.button-outline.ion-activated.ion-color) .button-native::after{background:var(--ion-color-base)}:host(.button-solid.ion-color.ion-activated) .button-native::after{background:var(--ion-color-shade)}:host(.button-outline.ion-focused.ion-color) .button-native,:host(.button-clear.ion-focused.ion-color) .button-native{color:var(--ion-color-base)}:host(.button-outline.ion-focused.ion-color) .button-native::after,:host(.button-clear.ion-focused.ion-color) .button-native::after{background:var(--ion-color-base)}:host(.button-solid.ion-color.ion-focused) .button-native::after{background:var(--ion-color-shade)}@media (any-hover: hover){:host(.button-clear:hover),:host(.button-outline:hover){opacity:0.6}:host(.button-clear.ion-color:hover) .button-native,:host(.button-outline.ion-color:hover) .button-native{color:var(--ion-color-base)}:host(.button-clear.ion-color:hover) .button-native::after,:host(.button-outline.ion-color:hover) .button-native::after{background:transparent}:host(.button-solid.ion-color:hover) .button-native::after{background:var(--ion-color-tint)}:host(:hover.button-solid.in-toolbar:not(.ion-color):not(.in-toolbar-color)) .button-native::after{background:#fff;opacity:0.1}}',md:':host{--overflow:hidden;--ripple-color:currentColor;--border-width:initial;--border-color:initial;--border-style:initial;--color-activated:var(--color);--color-focused:var(--color);--color-hover:var(--color);--box-shadow:none;display:inline-block;width:auto;color:var(--color);font-family:var(--ion-font-family, inherit);text-align:center;text-decoration:none;text-overflow:ellipsis;white-space:nowrap;user-select:none;vertical-align:top;vertical-align:-webkit-baseline-middle;font-kerning:none}:host(.button-disabled){cursor:default;opacity:0.5;pointer-events:none}:host(.button-solid){--background:var(--ion-color-primary, #3880ff);--color:var(--ion-color-primary-contrast, #fff)}:host(.button-outline){--border-color:var(--ion-color-primary, #3880ff);--background:transparent;--color:var(--ion-color-primary, #3880ff)}:host(.button-clear){--border-width:0;--background:transparent;--color:var(--ion-color-primary, #3880ff)}:host(.button-block){display:block}:host(.button-block) .button-native{margin-left:0;margin-right:0;display:block;width:100%;clear:both;contain:content}:host(.button-block) .button-native::after{clear:both}:host(.button-full){display:block}:host(.button-full) .button-native{margin-left:0;margin-right:0;display:block;width:100%;contain:content}:host(.button-full:not(.button-round)) .button-native{border-radius:0;border-right-width:0;border-left-width:0}.button-native{border-radius:var(--border-radius);-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:block;position:relative;width:100%;height:100%;transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);outline:none;background:var(--background);line-height:1;box-shadow:var(--box-shadow);contain:layout style;cursor:pointer;opacity:var(--opacity);overflow:var(--overflow);z-index:0;box-sizing:border-box;appearance:none}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.button-native{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}.button-native::-moz-focus-inner{border:0}.button-inner{display:flex;position:relative;flex-flow:row nowrap;flex-shrink:0;align-items:center;justify-content:center;width:100%;height:100%;z-index:1}::slotted(ion-icon){font-size:1.4em;pointer-events:none}::slotted(ion-icon[slot=start]){margin-left:-0.3em;margin-right:0.3em;margin-top:0;margin-bottom:0}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-icon[slot=start]){margin-left:unset;margin-right:unset;-webkit-margin-start:-0.3em;margin-inline-start:-0.3em;-webkit-margin-end:0.3em;margin-inline-end:0.3em}}::slotted(ion-icon[slot=end]){margin-left:0.3em;margin-right:-0.2em;margin-top:0;margin-bottom:0}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-icon[slot=end]){margin-left:unset;margin-right:unset;-webkit-margin-start:0.3em;margin-inline-start:0.3em;-webkit-margin-end:-0.2em;margin-inline-end:-0.2em}}::slotted(ion-icon[slot=icon-only]){font-size:1.8em}ion-ripple-effect{color:var(--ripple-color)}.button-native::after{left:0;right:0;top:0;bottom:0;position:absolute;content:"";opacity:0}:host(.ion-activated){color:var(--color-activated)}:host(.ion-activated) .button-native::after{background:var(--background-activated);opacity:var(--background-activated-opacity)}:host(.ion-focused){color:var(--color-focused)}:host(.ion-focused) .button-native::after{background:var(--background-focused);opacity:var(--background-focused-opacity)}@media (any-hover: hover){:host(:hover){color:var(--color-hover)}:host(:hover) .button-native::after{background:var(--background-hover);opacity:var(--background-hover-opacity)}}:host(.button-solid.ion-color) .button-native{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.button-outline.ion-color) .button-native{border-color:var(--ion-color-base);background:transparent;color:var(--ion-color-base)}:host(.button-clear.ion-color) .button-native{background:transparent;color:var(--ion-color-base)}:host(.in-toolbar:not(.ion-color):not(.in-toolbar-color)) .button-native{color:var(--ion-toolbar-color, var(--color))}:host(.button-outline.in-toolbar:not(.ion-color):not(.in-toolbar-color)) .button-native{border-color:var(--ion-toolbar-color, var(--color, var(--border-color)))}:host(.button-solid.in-toolbar:not(.ion-color):not(.in-toolbar-color)) .button-native{background:var(--ion-toolbar-color, var(--background));color:var(--ion-toolbar-background, var(--color))}:host{--border-radius:4px;--padding-top:0;--padding-bottom:0;--padding-start:1.1em;--padding-end:1.1em;--transition:box-shadow 280ms cubic-bezier(.4, 0, .2, 1),\n background-color 15ms linear,\n color 15ms linear;margin-left:2px;margin-right:2px;margin-top:4px;margin-bottom:4px;height:36px;font-size:14px;font-weight:500;letter-spacing:0.06em;text-transform:uppercase}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{margin-left:unset;margin-right:unset;-webkit-margin-start:2px;margin-inline-start:2px;-webkit-margin-end:2px;margin-inline-end:2px}}:host(.button-solid){--background-activated:transparent;--background-hover:var(--ion-color-primary-contrast, #fff);--background-focused:var(--ion-color-primary-contrast, #fff);--background-activated-opacity:0;--background-focused-opacity:.24;--background-hover-opacity:.08;--box-shadow:0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12)}:host(.button-solid.ion-activated){--box-shadow:0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 8px 10px 1px rgba(0, 0, 0, 0.14), 0 3px 14px 2px rgba(0, 0, 0, 0.12)}:host(.button-outline){--border-width:2px;--border-style:solid;--box-shadow:none;--background-activated:transparent;--background-focused:var(--ion-color-primary, #3880ff);--background-hover:var(--ion-color-primary, #3880ff);--background-activated-opacity:0;--background-focused-opacity:.12;--background-hover-opacity:.04}:host(.button-outline.ion-activated.ion-color) .button-native{background:transparent}:host(.button-clear){--background-activated:transparent;--background-focused:var(--ion-color-primary, #3880ff);--background-hover:var(--ion-color-primary, #3880ff);--background-activated-opacity:0;--background-focused-opacity:.12;--background-hover-opacity:.04}:host(.button-round){--border-radius:64px;--padding-top:0;--padding-start:26px;--padding-end:26px;--padding-bottom:0}:host(.button-large){--padding-top:0;--padding-start:1em;--padding-end:1em;--padding-bottom:0;height:2.8em;font-size:20px}:host(.button-small){--padding-top:0;--padding-start:0.9em;--padding-end:0.9em;--padding-bottom:0;height:2.1em;font-size:13px}:host(.button-strong){font-weight:bold}::slotted(ion-icon[slot=icon-only]){padding-left:0;padding-right:0;padding-top:0;padding-bottom:0}:host(.button-solid.ion-color.ion-focused) .button-native::after{background:var(--ion-color-contrast)}:host(.button-clear.ion-color.ion-focused) .button-native::after,:host(.button-outline.ion-color.ion-focused) .button-native::after{background:var(--ion-color-base)}@media (any-hover: hover){:host(.button-solid.ion-color:hover) .button-native::after{background:var(--ion-color-contrast)}:host(.button-clear.ion-color:hover) .button-native::after,:host(.button-outline.ion-color:hover) .button-native::after{background:var(--ion-color-base)}}'};const S=class{constructor(e){t(this,e),this.button=!1,this.type="button",this.disabled=!1,this.routerDirection="forward"}isClickable(){return void 0!==this.href||this.button}renderCard(t){const n=this.isClickable();if(!n)return[e("slot",null)];const{href:i,routerAnimation:r,routerDirection:o}=this,s=n?void 0===i?"button":"a":"div";return e(s,Object.assign({},"button"===s?{type:this.type}:{download:this.download,href:this.href,rel:this.rel,target:this.target},{class:"card-native",part:"native",disabled:this.disabled,onClick:t=>m(i,t,o,r)}),e("slot",null),n&&"md"===t&&e("ion-ripple-effect",null))}render(){const t=l(this);return e(n,{class:w(this.color,{[t]:!0,"card-disabled":this.disabled,"ion-activatable":this.isClickable()})},this.renderCard(t))}};S.style={ios:":host{--ion-safe-area-left:0px;--ion-safe-area-right:0px;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:block;position:relative;background:var(--background);color:var(--color);font-family:var(--ion-font-family, inherit);overflow:hidden}:host(.ion-color){background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.card-disabled){cursor:default;opacity:0.3;pointer-events:none}.card-native{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;display:block;width:100%;min-height:var(--min-height);transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);outline:none;background:inherit}.card-native::-moz-focus-inner{border:0}button,a{cursor:pointer;user-select:none;-webkit-user-drag:none}ion-ripple-effect{color:var(--ripple-color)}:host{--background:var(--ion-card-background, var(--ion-item-background, var(--ion-background-color, #fff)));--color:var(--ion-card-color, var(--ion-item-color, var(--ion-color-step-600, #666666)));margin-left:16px;margin-right:16px;margin-top:24px;margin-bottom:24px;border-radius:8px;transform:translateZ(0);transition:transform 500ms cubic-bezier(0.12, 0.72, 0.29, 1);font-size:14px;box-shadow:0 4px 16px rgba(0, 0, 0, 0.12)}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{margin-left:unset;margin-right:unset;-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:16px;margin-inline-end:16px}}:host(.ion-activated){transform:scale3d(0.97, 0.97, 1)}",md:":host{--ion-safe-area-left:0px;--ion-safe-area-right:0px;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:block;position:relative;background:var(--background);color:var(--color);font-family:var(--ion-font-family, inherit);overflow:hidden}:host(.ion-color){background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.card-disabled){cursor:default;opacity:0.3;pointer-events:none}.card-native{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;display:block;width:100%;min-height:var(--min-height);transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);outline:none;background:inherit}.card-native::-moz-focus-inner{border:0}button,a{cursor:pointer;user-select:none;-webkit-user-drag:none}ion-ripple-effect{color:var(--ripple-color)}:host{--background:var(--ion-card-background, var(--ion-item-background, var(--ion-background-color, #fff)));--color:var(--ion-card-color, var(--ion-item-color, var(--ion-color-step-550, #737373)));margin-left:10px;margin-right:10px;margin-top:10px;margin-bottom:10px;border-radius:4px;font-size:14px;box-shadow:0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12)}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{margin-left:unset;margin-right:unset;-webkit-margin-start:10px;margin-inline-start:10px;-webkit-margin-end:10px;margin-inline-end:10px}}"};const F=class{constructor(e){t(this,e)}render(){const t=l(this);return e(n,{class:{[t]:!0,[`card-content-${t}`]:!0}})}};F.style={ios:"ion-card-content{display:block;position:relative}.card-content-ios{padding-left:20px;padding-right:20px;padding-top:20px;padding-bottom:20px;font-size:16px;line-height:1.4}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.card-content-ios{padding-left:unset;padding-right:unset;-webkit-padding-start:20px;padding-inline-start:20px;-webkit-padding-end:20px;padding-inline-end:20px}}.card-content-ios h1{margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:24px;font-weight:normal}.card-content-ios h2{margin-left:0;margin-right:0;margin-top:2px;margin-bottom:2px;font-size:16px;font-weight:normal}.card-content-ios h3,.card-content-ios h4,.card-content-ios h5,.card-content-ios h6{margin-left:0;margin-right:0;margin-top:2px;margin-bottom:2px;font-size:14px;font-weight:normal}.card-content-ios p{margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:14px}ion-card-header+.card-content-ios{padding-top:0}",md:"ion-card-content{display:block;position:relative}.card-content-md{padding-left:16px;padding-right:16px;padding-top:13px;padding-bottom:13px;font-size:14px;line-height:1.5}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.card-content-md{padding-left:unset;padding-right:unset;-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px}}.card-content-md h1{margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:24px;font-weight:normal}.card-content-md h2{margin-left:0;margin-right:0;margin-top:2px;margin-bottom:2px;font-size:16px;font-weight:normal}.card-content-md h3,.card-content-md h4,.card-content-md h5,.card-content-md h6{margin-left:0;margin-right:0;margin-top:2px;margin-bottom:2px;font-size:14px;font-weight:normal}.card-content-md p{margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:14px;font-weight:normal;line-height:1.5}ion-card-header+.card-content-md{padding-top:0}"};const A=class{constructor(e){t(this,e),this.translucent=!1}render(){const t=l(this);return e(n,{class:w(this.color,{"card-header-translucent":this.translucent,"ion-inherit-color":!0,[t]:!0})},e("slot",null))}};A.style={ios:":host{--background:transparent;--color:inherit;display:block;position:relative;background:var(--background);color:var(--color)}:host(.ion-color){background:var(--ion-color-base);color:var(--ion-color-contrast)}:host{padding-left:20px;padding-right:20px;padding-top:20px;padding-bottom:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:20px;padding-inline-start:20px;-webkit-padding-end:20px;padding-inline-end:20px}}@supports (backdrop-filter: blur(0)){:host(.card-header-translucent){background-color:rgba(var(--ion-background-color-rgb, 255, 255, 255), 0.9);backdrop-filter:saturate(180%) blur(30px)}}",md:":host{--background:transparent;--color:inherit;display:block;position:relative;background:var(--background);color:var(--color)}:host(.ion-color){background:var(--ion-color-base);color:var(--ion-color-contrast)}:host{padding-left:16px;padding-right:16px;padding-top:16px;padding-bottom:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px}}::slotted(ion-card-title:not(:first-child)),::slotted(ion-card-subtitle:not(:first-child)){margin-top:8px}"};const _=class{constructor(e){t(this,e)}render(){const t=l(this);return e(n,{role:"heading","aria-level":"2",class:w(this.color,{"ion-inherit-color":!0,[t]:!0})},e("slot",null))}};_.style={ios:":host{display:block;position:relative;color:var(--color)}:host(.ion-color){color:var(--ion-color-base)}:host{--color:var(--ion-text-color, #000);margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;font-size:28px;font-weight:700;line-height:1.2}",md:":host{display:block;position:relative;color:var(--color)}:host(.ion-color){color:var(--ion-color-base)}:host{--color:var(--ion-color-step-850, #262626);margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;font-size:20px;font-weight:500;line-height:1.2}"};const j={xs:"(min-width: 0px)",sm:"(min-width: 576px)",md:"(min-width: 768px)",lg:"(min-width: 992px)",xl:"(min-width: 1200px)"},C=t=>void 0===t||""===t||!!window.matchMedia&&window.matchMedia(j[t]).matches,R=window,I=!!(R.CSS&&R.CSS.supports&&R.CSS.supports("--a: 0")),T=["","xs","sm","md","lg","xl"],O=class{constructor(e){t(this,e)}onResize(){o(this)}getColumns(t){let e;for(const n of T){const i=C(n),r=this[t+n.charAt(0).toUpperCase()+n.slice(1)];i&&void 0!==r&&(e=r)}return e}calculateSize(){const t=this.getColumns("size");if(!t||""===t)return;const e="auto"===t?"auto":I?`calc(calc(${t} / var(--ion-grid-columns, 12)) * 100%)`:t/12*100+"%";return{flex:`0 0 ${e}`,width:`${e}`,"max-width":`${e}`}}calculatePosition(t,e){const n=this.getColumns(t);if(n)return{[e]:I?`calc(calc(${n} / var(--ion-grid-columns, 12)) * 100%)`:n>0&&n<12?n/12*100+"%":"auto"}}calculateOffset(t){return this.calculatePosition("offset",t?"margin-right":"margin-left")}calculatePull(t){return this.calculatePosition("pull",t?"left":"right")}calculatePush(t){return this.calculatePosition("push",t?"right":"left")}render(){const t="rtl"===document.dir,i=l(this);return e(n,{class:{[i]:!0},style:Object.assign(Object.assign(Object.assign(Object.assign({},this.calculateOffset(t)),this.calculatePull(t)),this.calculatePush(t)),this.calculateSize())},e("slot",null))}};O.style=":host{padding-left:var(--ion-grid-column-padding-xs, var(--ion-grid-column-padding, 5px));padding-right:var(--ion-grid-column-padding-xs, var(--ion-grid-column-padding, 5px));padding-top:var(--ion-grid-column-padding-xs, var(--ion-grid-column-padding, 5px));padding-bottom:var(--ion-grid-column-padding-xs, var(--ion-grid-column-padding, 5px));margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;box-sizing:border-box;position:relative;flex-basis:0;flex-grow:1;width:100%;max-width:100%;min-height:1px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--ion-grid-column-padding-xs, var(--ion-grid-column-padding, 5px));padding-inline-start:var(--ion-grid-column-padding-xs, var(--ion-grid-column-padding, 5px));-webkit-padding-end:var(--ion-grid-column-padding-xs, var(--ion-grid-column-padding, 5px));padding-inline-end:var(--ion-grid-column-padding-xs, var(--ion-grid-column-padding, 5px))}}@media (min-width: 576px){:host{padding-left:var(--ion-grid-column-padding-sm, var(--ion-grid-column-padding, 5px));padding-right:var(--ion-grid-column-padding-sm, var(--ion-grid-column-padding, 5px));padding-top:var(--ion-grid-column-padding-sm, var(--ion-grid-column-padding, 5px));padding-bottom:var(--ion-grid-column-padding-sm, var(--ion-grid-column-padding, 5px))}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--ion-grid-column-padding-sm, var(--ion-grid-column-padding, 5px));padding-inline-start:var(--ion-grid-column-padding-sm, var(--ion-grid-column-padding, 5px));-webkit-padding-end:var(--ion-grid-column-padding-sm, var(--ion-grid-column-padding, 5px));padding-inline-end:var(--ion-grid-column-padding-sm, var(--ion-grid-column-padding, 5px))}}}@media (min-width: 768px){:host{padding-left:var(--ion-grid-column-padding-md, var(--ion-grid-column-padding, 5px));padding-right:var(--ion-grid-column-padding-md, var(--ion-grid-column-padding, 5px));padding-top:var(--ion-grid-column-padding-md, var(--ion-grid-column-padding, 5px));padding-bottom:var(--ion-grid-column-padding-md, var(--ion-grid-column-padding, 5px))}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--ion-grid-column-padding-md, var(--ion-grid-column-padding, 5px));padding-inline-start:var(--ion-grid-column-padding-md, var(--ion-grid-column-padding, 5px));-webkit-padding-end:var(--ion-grid-column-padding-md, var(--ion-grid-column-padding, 5px));padding-inline-end:var(--ion-grid-column-padding-md, var(--ion-grid-column-padding, 5px))}}}@media (min-width: 992px){:host{padding-left:var(--ion-grid-column-padding-lg, var(--ion-grid-column-padding, 5px));padding-right:var(--ion-grid-column-padding-lg, var(--ion-grid-column-padding, 5px));padding-top:var(--ion-grid-column-padding-lg, var(--ion-grid-column-padding, 5px));padding-bottom:var(--ion-grid-column-padding-lg, var(--ion-grid-column-padding, 5px))}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--ion-grid-column-padding-lg, var(--ion-grid-column-padding, 5px));padding-inline-start:var(--ion-grid-column-padding-lg, var(--ion-grid-column-padding, 5px));-webkit-padding-end:var(--ion-grid-column-padding-lg, var(--ion-grid-column-padding, 5px));padding-inline-end:var(--ion-grid-column-padding-lg, var(--ion-grid-column-padding, 5px))}}}@media (min-width: 1200px){:host{padding-left:var(--ion-grid-column-padding-xl, var(--ion-grid-column-padding, 5px));padding-right:var(--ion-grid-column-padding-xl, var(--ion-grid-column-padding, 5px));padding-top:var(--ion-grid-column-padding-xl, var(--ion-grid-column-padding, 5px));padding-bottom:var(--ion-grid-column-padding-xl, var(--ion-grid-column-padding, 5px))}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--ion-grid-column-padding-xl, var(--ion-grid-column-padding, 5px));padding-inline-start:var(--ion-grid-column-padding-xl, var(--ion-grid-column-padding, 5px));-webkit-padding-end:var(--ion-grid-column-padding-xl, var(--ion-grid-column-padding, 5px));padding-inline-end:var(--ion-grid-column-padding-xl, var(--ion-grid-column-padding, 5px))}}}";const N=class{constructor(e){t(this,e),this.ionScrollStart=r(this,"ionScrollStart",7),this.ionScroll=r(this,"ionScroll",7),this.ionScrollEnd=r(this,"ionScrollEnd",7),this.isScrolling=!1,this.lastScroll=0,this.queued=!1,this.cTop=-1,this.cBottom=-1,this.isMainContent=!0,this.detail={scrollTop:0,scrollLeft:0,type:"scroll",event:void 0,startX:0,startY:0,startTime:0,currentX:0,currentY:0,velocityX:0,velocityY:0,deltaX:0,deltaY:0,currentTime:0,data:void 0,isScrolling:!0},this.fullscreen=!1,this.scrollX=!1,this.scrollY=!0,this.scrollEvents=!1}connectedCallback(){this.isMainContent=null===this.el.closest("ion-menu, ion-popover, ion-modal")}disconnectedCallback(){this.onScrollEnd()}onAppLoad(){this.resize()}shouldForceOverscroll(){const{forceOverscroll:t}=this,e=l(this);return void 0===t?"ios"===e&&d("ios"):t}resize(){this.fullscreen?s((()=>this.readDimensions())):0===this.cTop&&0===this.cBottom||(this.cTop=this.cBottom=0,o(this))}readDimensions(){const t=P(this.el),e=Math.max(this.el.offsetTop,0),n=Math.max(t.offsetHeight-e-this.el.offsetHeight,0);(e!==this.cTop||n!==this.cBottom)&&(this.cTop=e,this.cBottom=n,o(this))}onScroll(t){const e=Date.now(),n=!this.isScrolling;this.lastScroll=e,n&&this.onScrollStart(),!this.queued&&this.scrollEvents&&(this.queued=!0,s((e=>{this.queued=!1,this.detail.event=t,D(this.detail,this.scrollEl,e,n),this.ionScroll.emit(this.detail)})))}getScrollElement(){return Promise.resolve(this.scrollEl)}scrollToTop(t=0){return this.scrollToPoint(void 0,0,t)}scrollToBottom(t=0){return this.scrollToPoint(void 0,this.scrollEl.scrollHeight-this.scrollEl.clientHeight,t)}scrollByPoint(t,e,n){return this.scrollToPoint(t+this.scrollEl.scrollLeft,e+this.scrollEl.scrollTop,n)}async scrollToPoint(t,e,n=0){const i=this.scrollEl;if(n<32)return null!=e&&(i.scrollTop=e),void(null!=t&&(i.scrollLeft=t));let r,o=0;const s=new Promise((t=>r=t)),a=i.scrollTop,u=i.scrollLeft,c=null!=e?e-a:0,l=null!=t?t-u:0,h=t=>{const e=Math.min(1,(t-o)/n)-1,s=Math.pow(e,3)+1;0!==c&&(i.scrollTop=Math.floor(s*c+a)),0!==l&&(i.scrollLeft=Math.floor(s*l+u)),s<1?requestAnimationFrame(h):r()};return requestAnimationFrame((t=>{o=t,h(t)})),s}onScrollStart(){this.isScrolling=!0,this.ionScrollStart.emit({isScrolling:!0}),this.watchDog&&clearInterval(this.watchDog),this.watchDog=setInterval((()=>{this.lastScroll<Date.now()-120&&this.onScrollEnd()}),100)}onScrollEnd(){clearInterval(this.watchDog),this.watchDog=null,this.isScrolling&&(this.isScrolling=!1,this.ionScrollEnd.emit({isScrolling:!1}))}render(){const{isMainContent:t,scrollX:i,scrollY:r}=this,o=l(this),s=this.shouldForceOverscroll(),a=t?"main":"div",u="ios"===o&&h.getBoolean("experimentalTransitionShadow",!0);return this.resize(),e(n,{class:w(this.color,{[o]:!0,"content-sizing":b("ion-popover",this.el),overscroll:s}),style:{"--offset-top":`${this.cTop}px`,"--offset-bottom":`${this.cBottom}px`}},e("div",{id:"background-content",part:"background"}),e(a,{class:{"inner-scroll":!0,"scroll-x":i,"scroll-y":r,overscroll:(i||r)&&s},ref:t=>this.scrollEl=t,onScroll:this.scrollEvents?t=>this.onScroll(t):void 0,part:"scroll"},e("slot",null)),u?e("div",{class:"transition-effect"},e("div",{class:"transition-cover"}),e("div",{class:"transition-shadow"})):null,e("slot",{name:"fixed"}))}get el(){return i(this)}},P=t=>{const e=t.closest("ion-tabs");if(e)return e;return t.closest("ion-app, ion-page, .ion-page, page-inner, .popover-content")||(t=>t.parentElement?t.parentElement:t.parentNode&&t.parentNode.host?t.parentNode.host:null)(t)},D=(t,e,n,i)=>{const r=t.currentX,o=t.currentY,s=e.scrollLeft,a=e.scrollTop,u=n-t.currentTime;if(i&&(t.startTime=n,t.startX=s,t.startY=a,t.velocityX=t.velocityY=0),t.currentTime=n,t.currentX=t.scrollLeft=s,t.currentY=t.scrollTop=a,t.deltaX=s-t.startX,t.deltaY=a-t.startY,u>0&&u<100){const e=(a-o)/u;t.velocityX=(s-r)/u*.7+.3*t.velocityX,t.velocityY=.7*e+.3*t.velocityY}};N.style=':host{--background:var(--ion-background-color, #fff);--color:var(--ion-text-color, #000);--padding-top:0px;--padding-bottom:0px;--padding-start:0px;--padding-end:0px;--keyboard-offset:0px;--offset-top:0px;--offset-bottom:0px;--overflow:auto;display:block;position:relative;flex:1;width:100%;height:100%;margin:0 !important;padding:0 !important;font-family:var(--ion-font-family, inherit);contain:size style}:host(.ion-color) .inner-scroll{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.outer-content){--background:var(--ion-color-step-50, #f2f2f2)}#background-content{left:0px;right:0px;top:calc(var(--offset-top) * -1);bottom:calc(var(--offset-bottom) * -1);position:absolute;background:var(--background)}.inner-scroll{left:0px;right:0px;top:calc(var(--offset-top) * -1);bottom:calc(var(--offset-bottom) * -1);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:calc(var(--padding-top) + var(--offset-top));padding-bottom:calc(var(--padding-bottom) + var(--keyboard-offset) + var(--offset-bottom));position:absolute;color:var(--color);box-sizing:border-box;overflow:hidden}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.inner-scroll{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}.scroll-y,.scroll-x{-webkit-overflow-scrolling:touch;z-index:0;will-change:scroll-position}.scroll-y{touch-action:pan-y;overflow-y:var(--overflow);overscroll-behavior-y:contain}.scroll-x{touch-action:pan-x;overflow-x:var(--overflow);overscroll-behavior-x:contain}.scroll-x.scroll-y{touch-action:auto}.overscroll::before,.overscroll::after{position:absolute;width:1px;height:1px;content:""}.overscroll::before{bottom:-1px}.overscroll::after{top:-1px}:host(.content-sizing){display:flex;flex-direction:column;min-height:0;contain:none}:host(.content-sizing) .inner-scroll{position:relative;top:0;bottom:0;margin-top:calc(var(--offset-top) * -1);margin-bottom:calc(var(--offset-bottom) * -1)}.transition-effect{display:none;position:absolute;left:-100%;width:100%;height:100vh;opacity:0;pointer-events:none}.transition-cover{position:absolute;right:0;width:100%;height:100%;background:black;opacity:0.1}.transition-shadow{display:block;position:absolute;right:0;width:10px;height:100%;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAgCAYAAAAIXrg4AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKE1hY2ludG9zaCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MTE3MDgzRkQ5QTkyMTFFOUEwNzQ5MkJFREE1NUY2MjQiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MTE3MDgzRkU5QTkyMTFFOUEwNzQ5MkJFREE1NUY2MjQiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDoxMTcwODNGQjlBOTIxMUU5QTA3NDkyQkVEQTU1RjYyNCIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDoxMTcwODNGQzlBOTIxMUU5QTA3NDkyQkVEQTU1RjYyNCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PmePEuQAAABNSURBVHjaYvz//z8DIxAwMDAwATGMhmFmPDQuOSZks0AMmoJBaQHjkPfB0Lfg/2gQjVow+HPy/yHvg9GiYjQfjMbBqAWjFgy/4hogwADYqwdzxy5BuwAAAABJRU5ErkJggg==);background-repeat:repeat-y;background-size:10px 16px}::slotted([slot=fixed]){position:absolute;transform:translateZ(0)}';const M=class{constructor(e){t(this,e),this.translucent=!1}render(){const t=l(this),i=this.translucent;return e(n,{role:"contentinfo",class:{[t]:!0,[`footer-${t}`]:!0,"footer-translucent":i,[`footer-translucent-${t}`]:i}},"ios"===t&&i&&e("div",{class:"footer-background"}),e("slot",null))}};M.style={ios:"ion-footer{display:block;position:relative;order:1;width:100%;z-index:10}ion-footer ion-toolbar:last-of-type{padding-bottom:var(--ion-safe-area-bottom, 0)}.footer-ios ion-toolbar:first-of-type{--border-width:0.55px 0 0}@supports (backdrop-filter: blur(0)){.footer-background{left:0;right:0;top:0;bottom:0;position:absolute;backdrop-filter:saturate(180%) blur(20px)}.footer-translucent-ios ion-toolbar{--opacity:.8}}.footer-ios.ion-no-border ion-toolbar:first-of-type{--border-width:0}",md:'ion-footer{display:block;position:relative;order:1;width:100%;z-index:10}ion-footer ion-toolbar:last-of-type{padding-bottom:var(--ion-safe-area-bottom, 0)}.footer-md::before{left:0;top:-2px;bottom:auto;background-position:left 0 top 0;position:absolute;width:100%;height:2px;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAHBAMAAADzDtBxAAAAD1BMVEUAAAAAAAAAAAAAAAAAAABPDueNAAAABXRSTlMUCS0gBIh/TXEAAAAaSURBVAjXYxCEAgY4UIICBmMogMsgFLtAAQCNSwXZKOdPxgAAAABJRU5ErkJggg==");background-repeat:repeat-x;content:""}[dir=rtl] .footer-md::before,:host-context([dir=rtl]) .footer-md::before{left:unset;right:unset;right:0}[dir=rtl] .footer-md::before,:host-context([dir=rtl]) .footer-md::before{background-position:right 0 top 0}.footer-md.ion-no-border::before{display:none}'};const U=class{constructor(e){t(this,e),this.fixed=!1}render(){const t=l(this);return e(n,{class:{[t]:!0,"grid-fixed":this.fixed}},e("slot",null))}};U.style=":host{padding-left:var(--ion-grid-padding-xs, var(--ion-grid-padding, 5px));padding-right:var(--ion-grid-padding-xs, var(--ion-grid-padding, 5px));padding-top:var(--ion-grid-padding-xs, var(--ion-grid-padding, 5px));padding-bottom:var(--ion-grid-padding-xs, var(--ion-grid-padding, 5px));margin-left:auto;margin-right:auto;display:block;flex:1}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--ion-grid-padding-xs, var(--ion-grid-padding, 5px));padding-inline-start:var(--ion-grid-padding-xs, var(--ion-grid-padding, 5px));-webkit-padding-end:var(--ion-grid-padding-xs, var(--ion-grid-padding, 5px));padding-inline-end:var(--ion-grid-padding-xs, var(--ion-grid-padding, 5px))}}@media (min-width: 576px){:host{padding-left:var(--ion-grid-padding-sm, var(--ion-grid-padding, 5px));padding-right:var(--ion-grid-padding-sm, var(--ion-grid-padding, 5px));padding-top:var(--ion-grid-padding-sm, var(--ion-grid-padding, 5px));padding-bottom:var(--ion-grid-padding-sm, var(--ion-grid-padding, 5px))}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--ion-grid-padding-sm, var(--ion-grid-padding, 5px));padding-inline-start:var(--ion-grid-padding-sm, var(--ion-grid-padding, 5px));-webkit-padding-end:var(--ion-grid-padding-sm, var(--ion-grid-padding, 5px));padding-inline-end:var(--ion-grid-padding-sm, var(--ion-grid-padding, 5px))}}}@media (min-width: 768px){:host{padding-left:var(--ion-grid-padding-md, var(--ion-grid-padding, 5px));padding-right:var(--ion-grid-padding-md, var(--ion-grid-padding, 5px));padding-top:var(--ion-grid-padding-md, var(--ion-grid-padding, 5px));padding-bottom:var(--ion-grid-padding-md, var(--ion-grid-padding, 5px))}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--ion-grid-padding-md, var(--ion-grid-padding, 5px));padding-inline-start:var(--ion-grid-padding-md, var(--ion-grid-padding, 5px));-webkit-padding-end:var(--ion-grid-padding-md, var(--ion-grid-padding, 5px));padding-inline-end:var(--ion-grid-padding-md, var(--ion-grid-padding, 5px))}}}@media (min-width: 992px){:host{padding-left:var(--ion-grid-padding-lg, var(--ion-grid-padding, 5px));padding-right:var(--ion-grid-padding-lg, var(--ion-grid-padding, 5px));padding-top:var(--ion-grid-padding-lg, var(--ion-grid-padding, 5px));padding-bottom:var(--ion-grid-padding-lg, var(--ion-grid-padding, 5px))}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--ion-grid-padding-lg, var(--ion-grid-padding, 5px));padding-inline-start:var(--ion-grid-padding-lg, var(--ion-grid-padding, 5px));-webkit-padding-end:var(--ion-grid-padding-lg, var(--ion-grid-padding, 5px));padding-inline-end:var(--ion-grid-padding-lg, var(--ion-grid-padding, 5px))}}}@media (min-width: 1200px){:host{padding-left:var(--ion-grid-padding-xl, var(--ion-grid-padding, 5px));padding-right:var(--ion-grid-padding-xl, var(--ion-grid-padding, 5px));padding-top:var(--ion-grid-padding-xl, var(--ion-grid-padding, 5px));padding-bottom:var(--ion-grid-padding-xl, var(--ion-grid-padding, 5px))}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--ion-grid-padding-xl, var(--ion-grid-padding, 5px));padding-inline-start:var(--ion-grid-padding-xl, var(--ion-grid-padding, 5px));-webkit-padding-end:var(--ion-grid-padding-xl, var(--ion-grid-padding, 5px));padding-inline-end:var(--ion-grid-padding-xl, var(--ion-grid-padding, 5px))}}}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{margin-left:unset;margin-right:unset;-webkit-margin-start:auto;margin-inline-start:auto;-webkit-margin-end:auto;margin-inline-end:auto}}:host(.grid-fixed){width:var(--ion-grid-width-xs, var(--ion-grid-width, 100%));max-width:100%}@media (min-width: 576px){:host(.grid-fixed){width:var(--ion-grid-width-sm, var(--ion-grid-width, 540px))}}@media (min-width: 768px){:host(.grid-fixed){width:var(--ion-grid-width-md, var(--ion-grid-width, 720px))}}@media (min-width: 992px){:host(.grid-fixed){width:var(--ion-grid-width-lg, var(--ion-grid-width, 960px))}}@media (min-width: 1200px){:host(.grid-fixed){width:var(--ion-grid-width-xl, var(--ion-grid-width, 1140px))}}:host(.ion-no-padding){--ion-grid-column-padding:0;--ion-grid-column-padding-xs:0;--ion-grid-column-padding-sm:0;--ion-grid-column-padding-md:0;--ion-grid-column-padding-lg:0;--ion-grid-column-padding-xl:0}";const L=t=>{const e=document.querySelector(`${t}.ion-cloned-element`);if(null!==e)return e;const n=document.createElement(t);return n.classList.add("ion-cloned-element"),n.style.setProperty("display","none"),document.body.appendChild(n),n},B=t=>{if(!t)return;const e=t.querySelectorAll("ion-toolbar");return{el:t,toolbars:Array.from(e).map((t=>{const e=t.querySelector("ion-title");return{el:t,background:t.shadowRoot.querySelector(".toolbar-background"),ionTitleEl:e,innerTitleEl:e?e.shadowRoot.querySelector(".toolbar-title"):null,ionButtonsEl:Array.from(t.querySelectorAll("ion-buttons"))||[]}}))||[]}},J=(t,e)=>{void 0===e?t.background.style.removeProperty("--opacity"):t.background.style.setProperty("--opacity",e.toString())},$=(t,e=!0)=>{e?t.el.classList.remove("header-collapse-condense-inactive"):t.el.classList.add("header-collapse-condense-inactive")},H=class{constructor(e){t(this,e),this.collapsibleHeaderInitialized=!1,this.inheritedAttributes={},this.translucent=!1}componentWillLoad(){this.inheritedAttributes=p(this.el)}async componentDidLoad(){await this.checkCollapsibleHeader()}async componentDidUpdate(){await this.checkCollapsibleHeader()}disconnectedCallback(){this.destroyCollapsibleHeader()}async checkCollapsibleHeader(){const t="condense"===this.collapse,e=!(!t||"ios"!==l(this))&&t;if(!e&&this.collapsibleHeaderInitialized)this.destroyCollapsibleHeader();else if(e&&!this.collapsibleHeaderInitialized){const t=this.el.closest("ion-app,ion-page,.ion-page,page-inner"),e=t?t.querySelector("ion-content"):null;a((()=>{L("ion-title").size="large",L("ion-back-button")})),await this.setupCollapsibleHeader(e,t)}}destroyCollapsibleHeader(){this.intersectionObserver&&(this.intersectionObserver.disconnect(),this.intersectionObserver=void 0),this.scrollEl&&this.contentScrollCallback&&(this.scrollEl.removeEventListener("scroll",this.contentScrollCallback),this.contentScrollCallback=void 0),this.collapsibleMainHeader&&(this.collapsibleMainHeader.classList.remove("header-collapse-main"),this.collapsibleMainHeader=void 0)}async setupCollapsibleHeader(t,e){if(!t||!e)return void console.error("ion-header requires a content to collapse, make sure there is an ion-content.");if("undefined"==typeof IntersectionObserver)return;this.scrollEl=await t.getScrollElement();const n=e.querySelectorAll("ion-header");if(this.collapsibleMainHeader=Array.from(n).find((t=>"condense"!==t.collapse)),!this.collapsibleMainHeader)return;const i=B(this.collapsibleMainHeader),r=B(this.el);i&&r&&($(i,!1),i.toolbars.forEach((t=>{J(t,0)})),this.intersectionObserver=new IntersectionObserver((t=>{((t,e,n,i)=>{a((()=>{const r=i.scrollTop;((t,e,n)=>{if(!t[0].isIntersecting)return;const i=t[0].intersectionRatio>.9||n<=0?0:100*(1-t[0].intersectionRatio)/75;e.toolbars.forEach((t=>{J(t,1===i?void 0:i)}))})(t,e,r);const o=t[0],s=o.intersectionRect,a=s.width*s.height,u=0===a&&0==o.rootBounds.width*o.rootBounds.height,c=Math.abs(s.left-o.boundingClientRect.left),l=Math.abs(s.right-o.boundingClientRect.right);u||a>0&&(c>=5||l>=5)||(o.isIntersecting?($(e,!1),$(n)):(0===s.x&&0===s.y||0!==s.width&&0!==s.height)&&r>0&&($(e),$(n,!1),J(e.toolbars[0])))}))})(t,i,r,this.scrollEl)}),{root:t,threshold:[.25,.3,.4,.5,.6,.7,.8,.9,1]}),this.intersectionObserver.observe(r.toolbars[r.toolbars.length-1].el),this.contentScrollCallback=()=>{((t,e,n)=>{s((()=>{const i=v(1,1+-t.scrollTop/500,1.1);null===n.querySelector("ion-refresher.refresher-native")&&a((()=>{((t=[],e=1,n=!1)=>{t.forEach((t=>{const i=t.ionTitleEl,r=t.innerTitleEl;i&&"large"===i.size&&(r.style.transition=n?"all 0.2s ease-in-out":"",r.style.transform=`scale3d(${e}, ${e}, 1)`)}))})(e.toolbars,i)}))}))})(this.scrollEl,r,t)},this.scrollEl.addEventListener("scroll",this.contentScrollCallback),a((()=>{void 0!==this.collapsibleMainHeader&&this.collapsibleMainHeader.classList.add("header-collapse-main")})),this.collapsibleHeaderInitialized=!0)}render(){const{translucent:t,inheritedAttributes:i}=this,r=l(this),o=this.collapse||"none",s=b("ion-menu",this.el)?"none":"banner";return e(n,Object.assign({role:s,class:{[r]:!0,[`header-${r}`]:!0,"header-translucent":this.translucent,[`header-collapse-${o}`]:!0,[`header-translucent-${r}`]:this.translucent}},i),"ios"===r&&t&&e("div",{class:"header-background"}),e("slot",null))}get el(){return i(this)}};let K;H.style={ios:"ion-header{display:block;position:relative;order:-1;width:100%;z-index:10}ion-header ion-toolbar:first-of-type{padding-top:var(--ion-safe-area-top, 0)}.header-ios ion-toolbar:last-of-type{--border-width:0 0 0.55px}@supports (backdrop-filter: blur(0)){.header-background{left:0;right:0;top:0;bottom:0;position:absolute;backdrop-filter:saturate(180%) blur(20px)}.header-translucent-ios ion-toolbar{--opacity:.8}.header-collapse-condense-inactive .header-background{backdrop-filter:blur(20px)}}.header-ios.ion-no-border ion-toolbar:last-of-type{--border-width:0}.header-collapse-condense{z-index:9}.header-collapse-condense ion-toolbar{position:sticky;top:0}.header-collapse-condense ion-toolbar:first-of-type{padding-top:7px;z-index:1}.header-collapse-condense ion-toolbar{--background:var(--ion-background-color, #fff);z-index:0}.header-collapse-condense ion-toolbar ion-searchbar{height:48px;padding-top:0px;padding-bottom:13px}.header-collapse-main ion-toolbar.in-toolbar ion-title,.header-collapse-main ion-toolbar.in-toolbar ion-buttons{transition:all 0.2s ease-in-out}.header-collapse-condense-inactive:not(.header-collapse-condense) ion-toolbar.in-toolbar ion-title,.header-collapse-condense-inactive:not(.header-collapse-condense) ion-toolbar.in-toolbar ion-buttons.buttons-collapse{opacity:0;pointer-events:none}.header-collapse-condense-inactive.header-collapse-condense ion-toolbar.in-toolbar ion-title,.header-collapse-condense-inactive.header-collapse-condense ion-toolbar.in-toolbar ion-buttons.buttons-collapse{visibility:hidden}",md:'ion-header{display:block;position:relative;order:-1;width:100%;z-index:10}ion-header ion-toolbar:first-of-type{padding-top:var(--ion-safe-area-top, 0)}.header-md::after{left:0;bottom:-5px;background-position:left 0 top -2px;position:absolute;width:100%;height:5px;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAHBAMAAADzDtBxAAAAD1BMVEUAAAAAAAAAAAAAAAAAAABPDueNAAAABXRSTlMUCS0gBIh/TXEAAAAaSURBVAjXYxCEAgY4UIICBmMogMsgFLtAAQCNSwXZKOdPxgAAAABJRU5ErkJggg==);background-repeat:repeat-x;content:""}[dir=rtl] .header-md::after,:host-context([dir=rtl]) .header-md::after{left:unset;right:unset;right:0}[dir=rtl] .header-md::after,:host-context([dir=rtl]) .header-md::after{background-position:right 0 top -2px}.header-collapse-condense{display:none}.header-md.ion-no-border::after{display:none}'};const z=(t,e,n,i,r)=>(n="ios"===(n&&G(n))?"ios":"md",i&&"ios"===n?t=G(i):r&&"md"===n?t=G(r):(t||!e||q(e)||(t=e),V(t)&&(t=G(t))),V(t)&&""!==t.trim()?""!==t.replace(/[a-z]|-|\d/gi,"")?null:t:null),W=t=>V(t)&&(t=t.trim(),q(t))?t:null,q=t=>t.length>0&&/(\/|\.)/.test(t),V=t=>"string"==typeof t,G=t=>t.toLowerCase(),X=t=>{if(1===t.nodeType){if("script"===t.nodeName.toLowerCase())return!1;for(let e=0;e<t.attributes.length;e++){const n=t.attributes[e].value;if(V(n)&&0===n.toLowerCase().indexOf("on"))return!1}for(let e=0;e<t.childNodes.length;e++)if(!X(t.childNodes[e]))return!1}return!0},Y=new Map,Z=new Map,Q=class{constructor(e){t(this,e),this.iconName=null,this.isVisible=!1,this.mode=tt(),this.lazy=!1,this.sanitize=!0}connectedCallback(){this.waitUntilVisible(this.el,"50px",(()=>{this.isVisible=!0,this.loadIcon()}))}disconnectedCallback(){this.io&&(this.io.disconnect(),this.io=void 0)}waitUntilVisible(t,e,n){if(this.lazy&&"undefined"!=typeof window&&window.IntersectionObserver){const i=this.io=new window.IntersectionObserver((t=>{t[0].isIntersecting&&(i.disconnect(),this.io=void 0,n())}),{rootMargin:e});i.observe(t)}else n()}loadIcon(){if(this.isVisible){const t=(t=>{let e=W(t.src);if(e)return e;if(e=z(t.name,t.icon,t.mode,t.ios,t.md),e)return n=e,(()=>{if("undefined"==typeof window)return new Map;if(!K){const t=window;t.Ionicons=t.Ionicons||{},K=t.Ionicons.map=t.Ionicons.map||new Map}return K})().get(n)||u(`svg/${n}.svg`);var n;if(t.icon){if(e=W(t.icon),e)return e;if(e=W(t.icon[t.mode]),e)return e}return null})(this);t&&(Y.has(t)?this.svgContent=Y.get(t):((t,e)=>{let n=Z.get(t);if(!n){if("undefined"==typeof fetch||"undefined"==typeof document)return Y.set(t,""),Promise.resolve();n=fetch(t).then((n=>{if(n.ok)return n.text().then((n=>{n&&!1!==e&&(n=(t=>{const e=document.createElement("div");e.innerHTML=t;for(let t=e.childNodes.length-1;t>=0;t--)"svg"!==e.childNodes[t].nodeName.toLowerCase()&&e.removeChild(e.childNodes[t]);const n=e.firstElementChild;if(n&&"svg"===n.nodeName.toLowerCase()){const t=n.getAttribute("class")||"";if(n.setAttribute("class",(t+" s-ion-icon").trim()),X(n))return e.innerHTML}return""})(n)),Y.set(t,n||"")}));Y.set(t,"")})),Z.set(t,n)}return n})(t,this.sanitize).then((()=>this.svgContent=Y.get(t))))}const t=this.iconName=z(this.name,this.icon,this.mode,this.ios,this.md);this.ariaLabel||"true"===this.ariaHidden||t&&(this.ariaLabel=t.replace(/\-/g," "))}render(){const{iconName:t}=this,i=this.mode||"md",r=this.flipRtl||t&&(t.indexOf("arrow")>-1||t.indexOf("chevron")>-1)&&!1!==this.flipRtl;return e(n,{role:"img",class:Object.assign(Object.assign({[i]:!0},et(this.color)),{[`icon-${this.size}`]:!!this.size,"flip-rtl":!!r&&"rtl"===this.el.ownerDocument.dir})},e("div",this.svgContent?{class:"icon-inner",innerHTML:this.svgContent}:{class:"icon-inner"}))}static get assetsDirs(){return["svg"]}get el(){return i(this)}static get watchers(){return{name:["loadIcon"],src:["loadIcon"],icon:["loadIcon"]}}},tt=()=>"undefined"!=typeof document&&document.documentElement.getAttribute("mode")||"md",et=t=>t?{"ion-color":!0,[`ion-color-${t}`]:!0}:null;Q.style=":host{display:inline-block;width:1em;height:1em;contain:strict;fill:currentColor;box-sizing:content-box !important}:host .ionicon{stroke:currentColor}.ionicon-fill-none{fill:none}.ionicon-stroke-width{stroke-width:32px;stroke-width:var(--ionicon-stroke-width, 32px)}.icon-inner,.ionicon,svg{display:block;height:100%;width:100%}:host(.flip-rtl) .icon-inner{transform:scaleX(-1)}:host(.icon-small){font-size:18px !important}:host(.icon-large){font-size:32px !important}:host(.ion-color){color:var(--ion-color-base) !important}:host(.ion-color-primary){--ion-color-base:var(--ion-color-primary, #3880ff)}:host(.ion-color-secondary){--ion-color-base:var(--ion-color-secondary, #0cd1e8)}:host(.ion-color-tertiary){--ion-color-base:var(--ion-color-tertiary, #f4a942)}:host(.ion-color-success){--ion-color-base:var(--ion-color-success, #10dc60)}:host(.ion-color-warning){--ion-color-base:var(--ion-color-warning, #ffce00)}:host(.ion-color-danger){--ion-color-base:var(--ion-color-danger, #f14141)}:host(.ion-color-light){--ion-color-base:var(--ion-color-light, #f4f5f8)}:host(.ion-color-medium){--ion-color-base:var(--ion-color-medium, #989aa2)}:host(.ion-color-dark){--ion-color-base:var(--ion-color-dark, #222428)}";const nt=class{constructor(e){t(this,e),this.labelColorStyles={},this.itemStyles=new Map,this.multipleInputs=!1,this.focusable=!0,this.button=!1,this.detailIcon="chevron-forward",this.disabled=!1,this.routerDirection="forward",this.type="button"}labelColorChanged(t){const{color:e}=this;void 0===e&&(this.labelColorStyles=t.detail)}itemStyle(t){t.stopPropagation();const e=t.target.tagName,n=t.detail,i={},r=this.itemStyles.get(e)||{};let s=!1;Object.keys(n).forEach((t=>{if(n[t]){const e=`item-${t}`;r[e]||(s=!0),i[e]=!0}})),s||Object.keys(i).length===Object.keys(r).length||(s=!0),s&&(this.itemStyles.set(e,i),o(this))}componentDidUpdate(){const t=this.getFirstInput();t&&!this.clickListener&&(this.clickListener=e=>this.delegateFocus(e,t),this.el.addEventListener("click",this.clickListener))}disconnectedCallback(){this.getFirstInput()&&this.clickListener&&(this.el.removeEventListener("click",this.clickListener),this.clickListener=void 0)}componentDidLoad(){g((()=>{this.setMultipleInputs(),this.focusable=this.isFocusable()}))}setMultipleInputs(){const t=this.el.querySelectorAll("ion-checkbox, ion-datetime, ion-select, ion-radio"),e=this.el.querySelectorAll("ion-input, ion-range, ion-searchbar, ion-segment, ion-textarea, ion-toggle"),n=this.el.querySelectorAll("ion-anchor, ion-button, a, button");this.multipleInputs=t.length+e.length>1||t.length+n.length>1||t.length>0&&this.isClickable()}hasCover(){return 1===this.el.querySelectorAll("ion-checkbox, ion-datetime, ion-select, ion-radio").length&&!this.multipleInputs}isClickable(){return void 0!==this.href||this.button}canActivate(){return this.isClickable()||this.hasCover()}isFocusable(){const t=this.el.querySelector(".ion-focusable");return this.canActivate()||null!==t}getFirstInput(){return this.el.querySelectorAll("ion-input, ion-textarea")[0]}delegateFocus(t,e){const n="ION-ITEM"===t.target.tagName;let i=!1;document.activeElement&&(i=e.querySelector("input, textarea")===document.activeElement),n&&i&&(e.fireFocusEvents=!1,e.setBlur(),e.setFocus(),g((()=>{e.fireFocusEvents=!0})))}render(){const{detail:t,detailIcon:i,download:r,labelColorStyles:o,lines:s,disabled:a,href:u,rel:c,target:h,routerAnimation:d,routerDirection:f}=this,p={},v=l(this),g=this.isClickable(),y=this.canActivate(),x=g?void 0===u?"button":"a":"div",k="button"===x?{type:this.type}:{download:r,href:u,rel:c,target:h},E=g?{onClick:t=>{m(u,t,f,d)}}:{},S=void 0!==t?t:"ios"===v&&g;return this.itemStyles.forEach((t=>{Object.assign(p,t)})),e(n,{"aria-disabled":a||p["item-interactive-disabled"]?"true":null,class:Object.assign(Object.assign(Object.assign({},p),o),w(this.color,{item:!0,[v]:!0,[`item-lines-${s}`]:void 0!==s,"item-disabled":a,"in-list":b("ion-list",this.el),"item-multiple-inputs":this.multipleInputs,"ion-activatable":y,"ion-focusable":this.focusable}))},e(x,Object.assign({},k,{class:"item-native",part:"native",disabled:a},E),e("slot",{name:"start"}),e("div",{class:"item-inner"},e("div",{class:"input-wrapper"},e("slot",null)),e("slot",{name:"end"}),S&&e("ion-icon",{icon:i,lazy:!1,class:"item-detail-icon",part:"detail-icon","aria-hidden":"true"}),e("div",{class:"item-inner-highlight"})),y&&"md"===v&&e("ion-ripple-effect",null)),e("div",{class:"item-highlight"}))}static get delegatesFocus(){return!0}get el(){return i(this)}};nt.style={ios:':host{--border-radius:0px;--border-width:0px;--border-style:solid;--padding-top:0px;--padding-bottom:0px;--padding-end:0px;--padding-start:0px;--inner-border-width:0px;--inner-padding-top:0px;--inner-padding-bottom:0px;--inner-padding-start:0px;--inner-padding-end:0px;--inner-box-shadow:none;--show-full-highlight:0;--show-inset-highlight:0;--detail-icon-color:initial;--detail-icon-font-size:20px;--detail-icon-opacity:0.25;--color-activated:var(--color);--color-focused:var(--color);--color-hover:var(--color);--ripple-color:currentColor;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:block;position:relative;align-items:center;justify-content:space-between;outline:none;color:var(--color);font-family:var(--ion-font-family, inherit);text-align:initial;text-decoration:none;overflow:hidden;box-sizing:border-box}:host(.ion-color) .item-native{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.ion-color) .item-native,:host(.ion-color) .item-inner{border-color:var(--ion-color-shade)}:host(.ion-activated) .item-native{color:var(--color-activated)}:host(.ion-activated) .item-native::after{background:var(--background-activated);opacity:var(--background-activated-opacity)}:host(.ion-color.ion-activated) .item-native{color:var(--ion-color-contrast)}:host(.ion-focused) .item-native{color:var(--color-focused)}:host(.ion-focused) .item-native::after{background:var(--background-focused);opacity:var(--background-focused-opacity)}:host(.ion-color.ion-focused) .item-native{color:var(--ion-color-contrast)}:host(.ion-color.ion-focused) .item-native::after{background:var(--ion-color-contrast)}@media (any-hover: hover){:host(.ion-activatable:hover) .item-native{color:var(--color-hover)}:host(.ion-activatable:hover) .item-native::after{background:var(--background-hover);opacity:var(--background-hover-opacity)}:host(.ion-color.ion-activatable:hover) .item-native{color:var(--ion-color-contrast)}:host(.ion-color.ion-activatable:hover) .item-native::after{background:var(--ion-color-contrast)}}:host(.item-interactive-disabled:not(.item-multiple-inputs)){cursor:default;pointer-events:none}:host(.item-disabled){cursor:default;opacity:0.3;pointer-events:none}.item-native{border-radius:var(--border-radius);margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:flex;position:relative;align-items:inherit;justify-content:inherit;width:100%;min-height:var(--min-height);transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);outline:none;background:var(--background);overflow:inherit;box-sizing:border-box;z-index:1}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.item-native{padding-left:unset;padding-right:unset;-webkit-padding-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-inline-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}.item-native::-moz-focus-inner{border:0}.item-native::after{left:0;right:0;top:0;bottom:0;position:absolute;content:"";opacity:0;transition:var(--transition);z-index:-1}button,a{cursor:pointer;user-select:none;-webkit-user-drag:none}.item-inner{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:var(--inner-padding-start);padding-right:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-top:var(--inner-padding-top);padding-bottom:var(--inner-padding-bottom);display:flex;position:relative;flex:1;flex-direction:inherit;align-items:inherit;align-self:stretch;min-height:inherit;border-width:var(--inner-border-width);border-style:var(--border-style);border-color:var(--border-color);box-shadow:var(--inner-box-shadow);overflow:inherit;box-sizing:border-box}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.item-inner{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--inner-padding-start);padding-inline-start:var(--inner-padding-start);-webkit-padding-end:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-inline-end:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end))}}.item-detail-icon{color:var(--detail-icon-color);font-size:var(--detail-icon-font-size);opacity:var(--detail-icon-opacity)}::slotted(ion-icon){font-size:1.6em}::slotted(ion-button){--margin-top:0;--margin-bottom:0;--margin-start:0;--margin-end:0;z-index:1}::slotted(ion-label:not([slot=end])){flex:1}:host(.item-input){align-items:center}.input-wrapper{display:flex;flex:1;flex-direction:inherit;align-items:inherit;align-self:stretch;text-overflow:ellipsis;overflow:inherit;box-sizing:border-box}:host(.item-label-stacked),:host(.item-label-floating){align-items:start}:host(.item-label-stacked) .input-wrapper,:host(.item-label-floating) .input-wrapper{flex:1;flex-direction:column}.item-highlight,.item-inner-highlight{left:0;right:0;bottom:0;position:absolute;background:var(--highlight-background);z-index:1}.item-highlight{height:var(--full-highlight-height)}.item-inner-highlight{height:var(--inset-highlight-height)}:host(.item-interactive.item-has-focus),:host(.item-interactive.ion-touched.ion-invalid){--full-highlight-height:calc(var(--highlight-height) * var(--show-full-highlight));--inset-highlight-height:calc(var(--highlight-height) * var(--show-inset-highlight))}:host(.item-interactive.item-has-focus){--highlight-background:var(--highlight-color-focused)}:host(.item-interactive.ion-valid){--highlight-background:var(--highlight-color-valid)}:host(.item-interactive.ion-invalid){--highlight-background:var(--highlight-color-invalid)}:host(:not(.item-label)) ::slotted(ion-select){--padding-start:0;max-width:none}:host(.item-label-stacked) ::slotted(ion-select),:host(.item-label-floating) ::slotted(ion-select){--padding-top:8px;--padding-bottom:8px;--padding-start:0;align-self:stretch;width:100%;max-width:100%}:host(:not(.item-label)) ::slotted(ion-datetime){--padding-start:0}:host(.item-label-stacked) ::slotted(ion-datetime),:host(.item-label-floating) ::slotted(ion-datetime){--padding-start:0;width:100%}:host(.item-multiple-inputs) ::slotted(ion-checkbox),:host(.item-multiple-inputs) ::slotted(ion-datetime),:host(.item-multiple-inputs) ::slotted(ion-radio),:host(.item-multiple-inputs) ::slotted(ion-select){position:relative}:host(.item-textarea){align-items:stretch}::slotted(ion-reorder[slot]){margin-top:0;margin-bottom:0}ion-ripple-effect{color:var(--ripple-color)}:host{--min-height:44px;--transition:background-color 200ms linear, opacity 200ms linear;--padding-start:20px;--inner-padding-end:10px;--inner-border-width:0px 0px 0.55px 0px;--background:var(--ion-item-background, var(--ion-background-color, #fff));--background-activated:#000;--background-focused:#000;--background-hover:currentColor;--background-activated-opacity:.12;--background-focused-opacity:.15;--background-hover-opacity:.04;--border-color:var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-250, #c8c7cc)));--color:var(--ion-item-color, var(--ion-text-color, #000));--highlight-height:0;--highlight-color-focused:var(--ion-color-primary, #3880ff);--highlight-color-valid:var(--ion-color-success, #2dd36f);--highlight-color-invalid:var(--ion-color-danger, #eb445a);font-size:17px}:host(.ion-activated){--transition:none}:host(.ion-color.ion-focused) .item-native::after{background:#000;opacity:0.15}:host(.ion-color.ion-activated) .item-native::after{background:#000;opacity:0.12}:host(.item-interactive){--show-full-highlight:0;--show-inset-highlight:1}:host(.item-lines-full){--border-width:0px 0px 0.55px 0px;--show-full-highlight:1;--show-inset-highlight:0}:host(.item-lines-inset){--inner-border-width:0px 0px 0.55px 0px;--show-full-highlight:0;--show-inset-highlight:1}:host(.item-lines-inset),:host(.item-lines-none){--border-width:0px;--show-full-highlight:0}:host(.item-lines-full),:host(.item-lines-none){--inner-border-width:0px;--show-inset-highlight:0}::slotted([slot=start]){margin-left:0;margin-right:20px;margin-top:2px;margin-bottom:2px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted([slot=start]){margin-left:unset;margin-right:unset;-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:20px;margin-inline-end:20px}}::slotted([slot=end]){margin-left:10px;margin-right:10px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted([slot=end]){margin-left:unset;margin-right:unset;-webkit-margin-start:10px;margin-inline-start:10px;-webkit-margin-end:10px;margin-inline-end:10px}}::slotted(ion-icon[slot=start]),::slotted(ion-icon[slot=end]){margin-top:7px;margin-bottom:7px}::slotted(ion-toggle[slot=start]),::slotted(ion-toggle[slot=end]){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}:host(.item-label-stacked) ::slotted([slot=end]),:host(.item-label-floating) ::slotted([slot=end]){margin-top:7px;margin-bottom:7px}::slotted(.button-small){--padding-top:0px;--padding-bottom:0px;--padding-start:.5em;--padding-end:.5em;height:24px;font-size:13px}::slotted(ion-avatar){width:36px;height:36px}::slotted(ion-thumbnail){width:56px;height:56px}::slotted(ion-avatar[slot=end]),::slotted(ion-thumbnail[slot=end]){margin-left:10px;margin-right:10px;margin-top:10px;margin-bottom:10px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-avatar[slot=end]),::slotted(ion-thumbnail[slot=end]){margin-left:unset;margin-right:unset;-webkit-margin-start:10px;margin-inline-start:10px;-webkit-margin-end:10px;margin-inline-end:10px}}:host(.item-radio) ::slotted(ion-label),:host(.item-toggle) ::slotted(ion-label){margin-left:0px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host(.item-radio) ::slotted(ion-label),:host(.item-toggle) ::slotted(ion-label){margin-left:unset;-webkit-margin-start:0px;margin-inline-start:0px}}::slotted(ion-label){margin-left:0;margin-right:8px;margin-top:10px;margin-bottom:10px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-label){margin-left:unset;margin-right:unset;-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:8px;margin-inline-end:8px}}:host(.item-label-floating),:host(.item-label-stacked){--min-height:68px}:host(.item-label-stacked) ::slotted(ion-select),:host(.item-label-floating) ::slotted(ion-select){--padding-top:8px;--padding-bottom:8px;--padding-start:0px}:host(.item-label-fixed) ::slotted(ion-select),:host(.item-label-fixed) ::slotted(ion-datetime){--padding-start:0}',md:':host{--border-radius:0px;--border-width:0px;--border-style:solid;--padding-top:0px;--padding-bottom:0px;--padding-end:0px;--padding-start:0px;--inner-border-width:0px;--inner-padding-top:0px;--inner-padding-bottom:0px;--inner-padding-start:0px;--inner-padding-end:0px;--inner-box-shadow:none;--show-full-highlight:0;--show-inset-highlight:0;--detail-icon-color:initial;--detail-icon-font-size:20px;--detail-icon-opacity:0.25;--color-activated:var(--color);--color-focused:var(--color);--color-hover:var(--color);--ripple-color:currentColor;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:block;position:relative;align-items:center;justify-content:space-between;outline:none;color:var(--color);font-family:var(--ion-font-family, inherit);text-align:initial;text-decoration:none;overflow:hidden;box-sizing:border-box}:host(.ion-color) .item-native{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.ion-color) .item-native,:host(.ion-color) .item-inner{border-color:var(--ion-color-shade)}:host(.ion-activated) .item-native{color:var(--color-activated)}:host(.ion-activated) .item-native::after{background:var(--background-activated);opacity:var(--background-activated-opacity)}:host(.ion-color.ion-activated) .item-native{color:var(--ion-color-contrast)}:host(.ion-focused) .item-native{color:var(--color-focused)}:host(.ion-focused) .item-native::after{background:var(--background-focused);opacity:var(--background-focused-opacity)}:host(.ion-color.ion-focused) .item-native{color:var(--ion-color-contrast)}:host(.ion-color.ion-focused) .item-native::after{background:var(--ion-color-contrast)}@media (any-hover: hover){:host(.ion-activatable:hover) .item-native{color:var(--color-hover)}:host(.ion-activatable:hover) .item-native::after{background:var(--background-hover);opacity:var(--background-hover-opacity)}:host(.ion-color.ion-activatable:hover) .item-native{color:var(--ion-color-contrast)}:host(.ion-color.ion-activatable:hover) .item-native::after{background:var(--ion-color-contrast)}}:host(.item-interactive-disabled:not(.item-multiple-inputs)){cursor:default;pointer-events:none}:host(.item-disabled){cursor:default;opacity:0.3;pointer-events:none}.item-native{border-radius:var(--border-radius);margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:flex;position:relative;align-items:inherit;justify-content:inherit;width:100%;min-height:var(--min-height);transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);outline:none;background:var(--background);overflow:inherit;box-sizing:border-box;z-index:1}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.item-native{padding-left:unset;padding-right:unset;-webkit-padding-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-inline-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}.item-native::-moz-focus-inner{border:0}.item-native::after{left:0;right:0;top:0;bottom:0;position:absolute;content:"";opacity:0;transition:var(--transition);z-index:-1}button,a{cursor:pointer;user-select:none;-webkit-user-drag:none}.item-inner{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:var(--inner-padding-start);padding-right:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-top:var(--inner-padding-top);padding-bottom:var(--inner-padding-bottom);display:flex;position:relative;flex:1;flex-direction:inherit;align-items:inherit;align-self:stretch;min-height:inherit;border-width:var(--inner-border-width);border-style:var(--border-style);border-color:var(--border-color);box-shadow:var(--inner-box-shadow);overflow:inherit;box-sizing:border-box}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.item-inner{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--inner-padding-start);padding-inline-start:var(--inner-padding-start);-webkit-padding-end:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-inline-end:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end))}}.item-detail-icon{color:var(--detail-icon-color);font-size:var(--detail-icon-font-size);opacity:var(--detail-icon-opacity)}::slotted(ion-icon){font-size:1.6em}::slotted(ion-button){--margin-top:0;--margin-bottom:0;--margin-start:0;--margin-end:0;z-index:1}::slotted(ion-label:not([slot=end])){flex:1}:host(.item-input){align-items:center}.input-wrapper{display:flex;flex:1;flex-direction:inherit;align-items:inherit;align-self:stretch;text-overflow:ellipsis;overflow:inherit;box-sizing:border-box}:host(.item-label-stacked),:host(.item-label-floating){align-items:start}:host(.item-label-stacked) .input-wrapper,:host(.item-label-floating) .input-wrapper{flex:1;flex-direction:column}.item-highlight,.item-inner-highlight{left:0;right:0;bottom:0;position:absolute;background:var(--highlight-background);z-index:1}.item-highlight{height:var(--full-highlight-height)}.item-inner-highlight{height:var(--inset-highlight-height)}:host(.item-interactive.item-has-focus),:host(.item-interactive.ion-touched.ion-invalid){--full-highlight-height:calc(var(--highlight-height) * var(--show-full-highlight));--inset-highlight-height:calc(var(--highlight-height) * var(--show-inset-highlight))}:host(.item-interactive.item-has-focus){--highlight-background:var(--highlight-color-focused)}:host(.item-interactive.ion-valid){--highlight-background:var(--highlight-color-valid)}:host(.item-interactive.ion-invalid){--highlight-background:var(--highlight-color-invalid)}:host(:not(.item-label)) ::slotted(ion-select){--padding-start:0;max-width:none}:host(.item-label-stacked) ::slotted(ion-select),:host(.item-label-floating) ::slotted(ion-select){--padding-top:8px;--padding-bottom:8px;--padding-start:0;align-self:stretch;width:100%;max-width:100%}:host(:not(.item-label)) ::slotted(ion-datetime){--padding-start:0}:host(.item-label-stacked) ::slotted(ion-datetime),:host(.item-label-floating) ::slotted(ion-datetime){--padding-start:0;width:100%}:host(.item-multiple-inputs) ::slotted(ion-checkbox),:host(.item-multiple-inputs) ::slotted(ion-datetime),:host(.item-multiple-inputs) ::slotted(ion-radio),:host(.item-multiple-inputs) ::slotted(ion-select){position:relative}:host(.item-textarea){align-items:stretch}::slotted(ion-reorder[slot]){margin-top:0;margin-bottom:0}ion-ripple-effect{color:var(--ripple-color)}:host{--min-height:48px;--background:var(--ion-item-background, var(--ion-background-color, #fff));--background-activated:transparent;--background-focused:currentColor;--background-hover:currentColor;--background-activated-opacity:0;--background-focused-opacity:.12;--background-hover-opacity:.04;--border-color:var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-150, rgba(0, 0, 0, 0.13))));--color:var(--ion-item-color, var(--ion-text-color, #000));--transition:opacity 15ms linear, background-color 15ms linear;--padding-start:16px;--border-color:var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-150, rgba(0, 0, 0, 0.13))));--inner-padding-end:16px;--inner-border-width:0 0 1px 0;--highlight-height:2px;--highlight-color-focused:var(--ion-color-primary, #3880ff);--highlight-color-valid:var(--ion-color-success, #2dd36f);--highlight-color-invalid:var(--ion-color-danger, #eb445a);font-size:16px;font-weight:normal;text-transform:none}:host(.ion-color.ion-activated) .item-native::after{background:transparent}:host(.item-interactive){--border-width:0 0 1px 0;--inner-border-width:0;--show-full-highlight:1;--show-inset-highlight:0}:host(.item-lines-full){--border-width:0 0 1px 0;--show-full-highlight:1;--show-inset-highlight:0}:host(.item-lines-inset){--inner-border-width:0 0 1px 0;--show-full-highlight:0;--show-inset-highlight:1}:host(.item-lines-inset),:host(.item-lines-none){--border-width:0;--show-full-highlight:0}:host(.item-lines-full),:host(.item-lines-none){--inner-border-width:0;--show-inset-highlight:0}:host(.item-multi-line) ::slotted([slot=start]),:host(.item-multi-line) ::slotted([slot=end]){margin-top:16px;margin-bottom:16px;align-self:flex-start}::slotted([slot=start]){margin-right:32px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted([slot=start]){margin-right:unset;-webkit-margin-end:32px;margin-inline-end:32px}}::slotted([slot=end]){margin-left:32px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted([slot=end]){margin-left:unset;-webkit-margin-start:32px;margin-inline-start:32px}}::slotted(ion-icon){color:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.54);font-size:24px}:host(.ion-color) ::slotted(ion-icon){color:var(--ion-color-contrast)}::slotted(ion-icon[slot]){margin-top:12px;margin-bottom:12px}::slotted(ion-icon[slot=start]){margin-right:32px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-icon[slot=start]){margin-right:unset;-webkit-margin-end:32px;margin-inline-end:32px}}::slotted(ion-icon[slot=end]){margin-left:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-icon[slot=end]){margin-left:unset;-webkit-margin-start:16px;margin-inline-start:16px}}::slotted(ion-toggle[slot=start]),::slotted(ion-toggle[slot=end]){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}::slotted(ion-note){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;align-self:flex-start;font-size:11px}::slotted(ion-note[slot]){padding-left:0;padding-right:0;padding-top:18px;padding-bottom:10px}::slotted(ion-note[slot=start]){padding-right:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-note[slot=start]){padding-right:unset;-webkit-padding-end:16px;padding-inline-end:16px}}::slotted(ion-note[slot=end]){padding-left:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-note[slot=end]){padding-left:unset;-webkit-padding-start:16px;padding-inline-start:16px}}::slotted(ion-avatar){width:40px;height:40px}::slotted(ion-thumbnail){width:56px;height:56px}::slotted(ion-avatar),::slotted(ion-thumbnail){margin-top:8px;margin-bottom:8px}::slotted(ion-avatar[slot=start]),::slotted(ion-thumbnail[slot=start]){margin-right:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-avatar[slot=start]),::slotted(ion-thumbnail[slot=start]){margin-right:unset;-webkit-margin-end:16px;margin-inline-end:16px}}::slotted(ion-avatar[slot=end]),::slotted(ion-thumbnail[slot=end]){margin-left:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-avatar[slot=end]),::slotted(ion-thumbnail[slot=end]){margin-left:unset;-webkit-margin-start:16px;margin-inline-start:16px}}::slotted(ion-label){margin-left:0;margin-right:0;margin-top:11px;margin-bottom:10px}:host(.item-label-stacked) ::slotted([slot=end]),:host(.item-label-floating) ::slotted([slot=end]){margin-top:7px;margin-bottom:7px}:host(.item-label-fixed) ::slotted(ion-select),:host(.item-label-fixed) ::slotted(ion-datetime){--padding-start:8px}:host(.item-toggle) ::slotted(ion-label),:host(.item-radio) ::slotted(ion-label){margin-left:0}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host(.item-toggle) ::slotted(ion-label),:host(.item-radio) ::slotted(ion-label){margin-left:unset;-webkit-margin-start:0;margin-inline-start:0}}::slotted(.button-small){--padding-top:0;--padding-bottom:0;--padding-start:.6em;--padding-end:.6em;height:25px;font-size:12px}:host(.item-label-floating),:host(.item-label-stacked){--min-height:55px}:host(.item-label-stacked) ::slotted(ion-select),:host(.item-label-floating) ::slotted(ion-select){--padding-top:8px;--padding-bottom:8px;--padding-start:0}:host(.item-has-focus:not(.ion-color)) ::slotted(.label-stacked),:host(.item-has-focus:not(.ion-color)) ::slotted(.label-floating){color:var(--ion-color-primary, #3880ff)}:host(.ion-color){--highlight-color-focused:var(--ion-color-contrast)}:host(.item-label-color){--highlight-color-focused:var(--ion-color-base)}'};const it=class{constructor(e){t(this,e),this.sticky=!1}render(){const t=l(this);return e(n,{class:w(this.color,{[t]:!0,"item-divider-sticky":this.sticky,item:!0})},e("slot",{name:"start"}),e("div",{class:"item-divider-inner"},e("div",{class:"item-divider-wrapper"},e("slot",null)),e("slot",{name:"end"})))}get el(){return i(this)}};it.style={ios:":host{--padding-top:0px;--padding-end:0px;--padding-bottom:0px;--padding-start:0px;--inner-padding-top:0px;--inner-padding-end:0px;--inner-padding-bottom:0px;--inner-padding-start:0px;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);display:flex;align-items:center;justify-content:space-between;width:100%;background:var(--background);color:var(--color);font-family:var(--ion-font-family, inherit);overflow:hidden;z-index:100;box-sizing:border-box}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-inline-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}:host(.ion-color){background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.item-divider-sticky){position:sticky;top:0}.item-divider-inner{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:var(--inner-padding-start);padding-right:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-top:var(--inner-padding-top);padding-bottom:var(--inner-padding-bottom);display:flex;flex:1;flex-direction:inherit;align-items:inherit;align-self:stretch;min-height:inherit;border:0;overflow:hidden}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.item-divider-inner{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--inner-padding-start);padding-inline-start:var(--inner-padding-start);-webkit-padding-end:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-inline-end:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end))}}.item-divider-wrapper{display:flex;flex:1;flex-direction:inherit;align-items:inherit;align-self:stretch;text-overflow:ellipsis;overflow:hidden}:host{--background:var(--ion-color-step-100, #e6e6e6);--color:var(--ion-color-step-850, #262626);--padding-start:20px;--inner-padding-end:10px;border-radius:0;position:relative;min-height:28px;font-size:17px;font-weight:600}:host([slot=start]){margin-left:0;margin-right:20px;margin-top:2px;margin-bottom:2px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host([slot=start]){margin-left:unset;margin-right:unset;-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:20px;margin-inline-end:20px}}:host([slot=end]){margin-left:10px;margin-right:10px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host([slot=end]){margin-left:unset;margin-right:unset;-webkit-margin-start:10px;margin-inline-start:10px;-webkit-margin-end:10px;margin-inline-end:10px}}::slotted(ion-icon[slot=start]),::slotted(ion-icon[slot=end]){margin-top:7px;margin-bottom:7px}::slotted(h1){margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:24px;font-weight:normal}::slotted(h2){margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:17px;font-weight:normal}::slotted(h3),::slotted(h4),::slotted(h5),::slotted(h6){margin-left:0;margin-right:0;margin-top:0;margin-bottom:3px;font-size:14px;font-weight:normal;line-height:normal}::slotted(p){margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;color:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.4);font-size:14px;line-height:normal;text-overflow:inherit;overflow:inherit}::slotted(h2:last-child) ::slotted(h3:last-child),::slotted(h4:last-child),::slotted(h5:last-child),::slotted(h6:last-child),::slotted(p:last-child){margin-bottom:0}",md:":host{--padding-top:0px;--padding-end:0px;--padding-bottom:0px;--padding-start:0px;--inner-padding-top:0px;--inner-padding-end:0px;--inner-padding-bottom:0px;--inner-padding-start:0px;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);display:flex;align-items:center;justify-content:space-between;width:100%;background:var(--background);color:var(--color);font-family:var(--ion-font-family, inherit);overflow:hidden;z-index:100;box-sizing:border-box}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-inline-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}:host(.ion-color){background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.item-divider-sticky){position:sticky;top:0}.item-divider-inner{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:var(--inner-padding-start);padding-right:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-top:var(--inner-padding-top);padding-bottom:var(--inner-padding-bottom);display:flex;flex:1;flex-direction:inherit;align-items:inherit;align-self:stretch;min-height:inherit;border:0;overflow:hidden}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.item-divider-inner{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--inner-padding-start);padding-inline-start:var(--inner-padding-start);-webkit-padding-end:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-inline-end:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end))}}.item-divider-wrapper{display:flex;flex:1;flex-direction:inherit;align-items:inherit;align-self:stretch;text-overflow:ellipsis;overflow:hidden}:host{--background:var(--ion-background-color, #fff);--color:var(--ion-color-step-400, #999999);--padding-start:16px;--inner-padding-end:0;min-height:30px;border-bottom:1px solid var(--ion-item-border-color, var(--ion-border-color, var(--ion-color-step-150, rgba(0, 0, 0, 0.13))));font-size:14px}::slotted([slot=start]){margin-right:32px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted([slot=start]){margin-right:unset;-webkit-margin-end:32px;margin-inline-end:32px}}::slotted([slot=end]){margin-left:32px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted([slot=end]){margin-left:unset;-webkit-margin-start:32px;margin-inline-start:32px}}::slotted(ion-label){margin-left:0;margin-right:0;margin-top:13px;margin-bottom:10px}::slotted(ion-icon){color:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.54);font-size:24px}:host(.ion-color) ::slotted(ion-icon){color:var(--ion-color-contrast)}::slotted(ion-icon[slot]){margin-top:12px;margin-bottom:12px}::slotted(ion-icon[slot=start]){margin-right:32px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-icon[slot=start]){margin-right:unset;-webkit-margin-end:32px;margin-inline-end:32px}}::slotted(ion-icon[slot=end]){margin-left:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-icon[slot=end]){margin-left:unset;-webkit-margin-start:16px;margin-inline-start:16px}}::slotted(ion-note){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;align-self:flex-start;font-size:11px}::slotted(ion-note[slot]){padding-left:0;padding-right:0;padding-top:18px;padding-bottom:10px}::slotted(ion-note[slot=start]){padding-right:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-note[slot=start]){padding-right:unset;-webkit-padding-end:16px;padding-inline-end:16px}}::slotted(ion-note[slot=end]){padding-left:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-note[slot=end]){padding-left:unset;-webkit-padding-start:16px;padding-inline-start:16px}}::slotted(ion-avatar){width:40px;height:40px}::slotted(ion-thumbnail){width:56px;height:56px}::slotted(ion-avatar),::slotted(ion-thumbnail){margin-top:8px;margin-bottom:8px}::slotted(ion-avatar[slot=start]),::slotted(ion-thumbnail[slot=start]){margin-right:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-avatar[slot=start]),::slotted(ion-thumbnail[slot=start]){margin-right:unset;-webkit-margin-end:16px;margin-inline-end:16px}}::slotted(ion-avatar[slot=end]),::slotted(ion-thumbnail[slot=end]){margin-left:16px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(ion-avatar[slot=end]),::slotted(ion-thumbnail[slot=end]){margin-left:unset;-webkit-margin-start:16px;margin-inline-start:16px}}::slotted(h1){margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:24px;font-weight:normal}::slotted(h2){margin-left:0;margin-right:0;margin-top:2px;margin-bottom:2px;font-size:16px;font-weight:normal}::slotted(h3,h4,h5,h6){margin-left:0;margin-right:0;margin-top:2px;margin-bottom:2px;font-size:14px;font-weight:normal;line-height:normal}::slotted(p){margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;color:var(--ion-color-step-600, #666666);font-size:14px;line-height:normal;text-overflow:inherit;overflow:inherit}"};const rt=class{constructor(e){t(this,e)}render(){const t=l(this);return e(n,{role:"group",class:{[t]:!0,[`item-group-${t}`]:!0,item:!0}})}};rt.style={ios:"ion-item-group{display:block}",md:"ion-item-group{display:block}"};const ot=class{constructor(e){t(this,e),this.ionColor=r(this,"ionColor",7),this.ionStyle=r(this,"ionStyle",7),this.inRange=!1,this.noAnimate=!1}componentWillLoad(){this.inRange=!!this.el.closest("ion-range"),this.noAnimate="floating"===this.position,this.emitStyle(),this.emitColor()}componentDidLoad(){this.noAnimate&&setTimeout((()=>{this.noAnimate=!1}),1e3)}colorChanged(){this.emitColor()}positionChanged(){this.emitStyle()}emitColor(){const{color:t}=this;this.ionColor.emit({"item-label-color":void 0!==t,[`ion-color-${t}`]:void 0!==t})}emitStyle(){const{inRange:t,position:e}=this;t||this.ionStyle.emit({label:!0,[`label-${e}`]:void 0!==e})}render(){const t=this.position,i=l(this);return e(n,{class:w(this.color,{[i]:!0,"in-item-color":b("ion-item.ion-color",this.el),[`label-${t}`]:void 0!==t,"label-no-animate":this.noAnimate})})}get el(){return i(this)}static get watchers(){return{color:["colorChanged"],position:["positionChanged"]}}};ot.style={ios:".item.sc-ion-label-ios-h,.item .sc-ion-label-ios-h{--color:initial;display:block;color:var(--color);font-family:var(--ion-font-family, inherit);font-size:inherit;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;box-sizing:border-box}.ion-color.sc-ion-label-ios-h{color:var(--ion-color-base)}.ion-text-wrap.sc-ion-label-ios-h,[text-wrap].sc-ion-label-ios-h{white-space:normal}.item-interactive-disabled.sc-ion-label-ios-h:not(.item-multiple-inputs),.item-interactive-disabled:not(.item-multiple-inputs) .sc-ion-label-ios-h{cursor:default;opacity:0.3;pointer-events:none}.item-input.sc-ion-label-ios-h,.item-input .sc-ion-label-ios-h{flex:initial;max-width:200px;pointer-events:none}.item-textarea.sc-ion-label-ios-h,.item-textarea .sc-ion-label-ios-h{align-self:baseline}.label-fixed.sc-ion-label-ios-h{flex:0 0 100px;width:100px;min-width:100px;max-width:200px}.label-stacked.sc-ion-label-ios-h,.label-floating.sc-ion-label-ios-h{margin-bottom:0;align-self:stretch;width:auto;max-width:100%}.label-no-animate.label-floating.sc-ion-label-ios-h{transition:none}.sc-ion-label-ios-s h1,.sc-ion-label-ios-s h2,.sc-ion-label-ios-s h3,.sc-ion-label-ios-s h4,.sc-ion-label-ios-s h5,.sc-ion-label-ios-s h6{text-overflow:inherit;overflow:inherit}.ion-text-wrap.sc-ion-label-ios-h,[text-wrap].sc-ion-label-ios-h{font-size:14px;line-height:1.5}.label-stacked.sc-ion-label-ios-h{margin-bottom:4px;font-size:14px}.label-floating.sc-ion-label-ios-h{margin-bottom:0;transform:translate3d(0, 29px, 0);transform-origin:left top;transition:transform 150ms ease-in-out}[dir=rtl].sc-ion-label-ios-h -no-combinator.label-floating.sc-ion-label-ios-h,[dir=rtl] .sc-ion-label-ios-h -no-combinator.label-floating.sc-ion-label-ios-h,[dir=rtl].label-floating.sc-ion-label-ios-h,[dir=rtl] .label-floating.sc-ion-label-ios-h{transform-origin:right top}.item-textarea.label-floating.sc-ion-label-ios-h,.item-textarea .label-floating.sc-ion-label-ios-h{transform:translate3d(0, 28px, 0)}.item-has-focus.label-floating.sc-ion-label-ios-h,.item-has-focus .label-floating.sc-ion-label-ios-h,.item-has-placeholder.sc-ion-label-ios-h:not(.item-input).label-floating,.item-has-placeholder:not(.item-input) .label-floating.sc-ion-label-ios-h,.item-has-value.label-floating.sc-ion-label-ios-h,.item-has-value .label-floating.sc-ion-label-ios-h{transform:translate3d(0, 0, 0) scale(0.82)}.sc-ion-label-ios-s h1{margin-left:0;margin-right:0;margin-top:3px;margin-bottom:2px;font-size:22px;font-weight:normal}.sc-ion-label-ios-s h2{margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:17px;font-weight:normal}.sc-ion-label-ios-s h3,.sc-ion-label-ios-s h4,.sc-ion-label-ios-s h5,.sc-ion-label-ios-s h6{margin-left:0;margin-right:0;margin-top:0;margin-bottom:3px;font-size:14px;font-weight:normal;line-height:normal}.sc-ion-label-ios-s p{margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:14px;line-height:normal;text-overflow:inherit;overflow:inherit}.sc-ion-label-ios-s>p{color:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.4)}.sc-ion-label-ios-h.in-item-color.sc-ion-label-ios-s>p{color:inherit}.sc-ion-label-ios-s h2:last-child,.sc-ion-label-ios-s h3:last-child,.sc-ion-label-ios-s h4:last-child,.sc-ion-label-ios-s h5:last-child,.sc-ion-label-ios-s h6:last-child,.sc-ion-label-ios-s p:last-child{margin-bottom:0}",md:".item.sc-ion-label-md-h,.item .sc-ion-label-md-h{--color:initial;display:block;color:var(--color);font-family:var(--ion-font-family, inherit);font-size:inherit;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;box-sizing:border-box}.ion-color.sc-ion-label-md-h{color:var(--ion-color-base)}.ion-text-wrap.sc-ion-label-md-h,[text-wrap].sc-ion-label-md-h{white-space:normal}.item-interactive-disabled.sc-ion-label-md-h:not(.item-multiple-inputs),.item-interactive-disabled:not(.item-multiple-inputs) .sc-ion-label-md-h{cursor:default;opacity:0.3;pointer-events:none}.item-input.sc-ion-label-md-h,.item-input .sc-ion-label-md-h{flex:initial;max-width:200px;pointer-events:none}.item-textarea.sc-ion-label-md-h,.item-textarea .sc-ion-label-md-h{align-self:baseline}.label-fixed.sc-ion-label-md-h{flex:0 0 100px;width:100px;min-width:100px;max-width:200px}.label-stacked.sc-ion-label-md-h,.label-floating.sc-ion-label-md-h{margin-bottom:0;align-self:stretch;width:auto;max-width:100%}.label-no-animate.label-floating.sc-ion-label-md-h{transition:none}.sc-ion-label-md-s h1,.sc-ion-label-md-s h2,.sc-ion-label-md-s h3,.sc-ion-label-md-s h4,.sc-ion-label-md-s h5,.sc-ion-label-md-s h6{text-overflow:inherit;overflow:inherit}.ion-text-wrap.sc-ion-label-md-h,[text-wrap].sc-ion-label-md-h{line-height:1.5}.label-stacked.sc-ion-label-md-h{transform-origin:left top;transform:translateY(50%) scale(0.75);transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1)}[dir=rtl].sc-ion-label-md-h -no-combinator.label-stacked.sc-ion-label-md-h,[dir=rtl] .sc-ion-label-md-h -no-combinator.label-stacked.sc-ion-label-md-h,[dir=rtl].label-stacked.sc-ion-label-md-h,[dir=rtl] .label-stacked.sc-ion-label-md-h{transform-origin:right top}.label-floating.sc-ion-label-md-h{transform:translateY(96%);transform-origin:left top;transition:color 150ms cubic-bezier(0.4, 0, 0.2, 1), transform 150ms cubic-bezier(0.4, 0, 0.2, 1)}[dir=rtl].sc-ion-label-md-h -no-combinator.label-floating.sc-ion-label-md-h,[dir=rtl] .sc-ion-label-md-h -no-combinator.label-floating.sc-ion-label-md-h,[dir=rtl].label-floating.sc-ion-label-md-h,[dir=rtl] .label-floating.sc-ion-label-md-h{transform-origin:right top}.item-textarea.label-floating.sc-ion-label-md-h,.item-textarea .label-floating.sc-ion-label-md-h{transform:translateY(185%)}.label-stacked.sc-ion-label-md-h,.label-floating.sc-ion-label-md-h{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}.item-has-focus.label-floating.sc-ion-label-md-h,.item-has-focus .label-floating.sc-ion-label-md-h,.item-has-placeholder.sc-ion-label-md-h:not(.item-input).label-floating,.item-has-placeholder:not(.item-input) .label-floating.sc-ion-label-md-h,.item-has-value.label-floating.sc-ion-label-md-h,.item-has-value .label-floating.sc-ion-label-md-h{transform:translateY(50%) scale(0.75)}.item-has-focus.label-stacked.sc-ion-label-md-h:not(.ion-color),.item-has-focus .label-stacked.sc-ion-label-md-h:not(.ion-color),.item-has-focus.label-floating.sc-ion-label-md-h:not(.ion-color),.item-has-focus .label-floating.sc-ion-label-md-h:not(.ion-color){color:var(--ion-color-primary, #3880ff)}.item-has-focus.ion-color.label-stacked.sc-ion-label-md-h:not(.ion-color),.item-has-focus.ion-color .label-stacked.sc-ion-label-md-h:not(.ion-color),.item-has-focus.ion-color.label-floating.sc-ion-label-md-h:not(.ion-color),.item-has-focus.ion-color .label-floating.sc-ion-label-md-h:not(.ion-color){color:var(--ion-color-contrast)}.sc-ion-label-md-s h1{margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:24px;font-weight:normal}.sc-ion-label-md-s h2{margin-left:0;margin-right:0;margin-top:2px;margin-bottom:2px;font-size:16px;font-weight:normal}.sc-ion-label-md-s h3,.sc-ion-label-md-s h4,.sc-ion-label-md-s h5,.sc-ion-label-md-s h6{margin-left:0;margin-right:0;margin-top:2px;margin-bottom:2px;font-size:14px;font-weight:normal;line-height:normal}.sc-ion-label-md-s p{margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:14px;line-height:20px;text-overflow:inherit;overflow:inherit}.sc-ion-label-md-s>p{color:var(--ion-color-step-600, #666666)}.sc-ion-label-md-h.in-item-color.sc-ion-label-md-s>p{color:inherit}"};const st=class{constructor(e){t(this,e),this.inset=!1}async closeSlidingItems(){const t=this.el.querySelector("ion-item-sliding");return!(!t||!t.closeOpened)&&t.closeOpened()}render(){const t=l(this),{lines:i,inset:r}=this;return e(n,{class:{[t]:!0,[`list-${t}`]:!0,"list-inset":r,[`list-lines-${i}`]:void 0!==i,[`list-${t}-lines-${i}`]:void 0!==i}})}get el(){return i(this)}};st.style={ios:"ion-list{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;display:block;contain:content;list-style-type:none}ion-list.list-inset{transform:translateZ(0);overflow:hidden}.list-ios{background:var(--ion-item-background, var(--ion-background-color, #fff))}.list-ios.list-inset{margin-left:16px;margin-right:16px;margin-top:16px;margin-bottom:16px;border-radius:4px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.list-ios.list-inset{margin-left:unset;margin-right:unset;-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:16px;margin-inline-end:16px}}.list-ios.list-inset ion-item{--border-width:0 0 1px 0;--inner-border-width:0}.list-ios.list-inset ion-item:last-child{--border-width:0;--inner-border-width:0}.list-ios.list-inset+ion-list.list-inset{margin-top:0}.list-ios-lines-none .item{--border-width:0;--inner-border-width:0}.list-ios-lines-full .item,.list-ios .item-lines-full{--border-width:0 0 0.55px 0}.list-ios-lines-full .item{--inner-border-width:0}.list-ios-lines-inset .item,.list-ios .item-lines-inset{--inner-border-width:0 0 0.55px 0}.list-ios .item-lines-inset{--border-width:0}.list-ios .item-lines-full{--inner-border-width:0}.list-ios .item-lines-none{--border-width:0;--inner-border-width:0}ion-card .list-ios{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}",md:"ion-list{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;display:block;contain:content;list-style-type:none}ion-list.list-inset{transform:translateZ(0);overflow:hidden}.list-md{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:8px;padding-bottom:8px;background:var(--ion-item-background, var(--ion-background-color, #fff))}.list-md>.input:last-child::after{left:0}[dir=rtl] .list-md>.input:last-child::after,:host-context([dir=rtl]) .list-md>.input:last-child::after{left:unset;right:unset;right:0}.list-md.list-inset{margin-left:16px;margin-right:16px;margin-top:16px;margin-bottom:16px;border-radius:2px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.list-md.list-inset{margin-left:unset;margin-right:unset;-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:16px;margin-inline-end:16px}}.list-md.list-inset ion-item:first-child{--border-radius:2px 2px 0 0;--border-width:0 0 1px 0}.list-md.list-inset ion-item:last-child{--border-radius:0 0 2px, 2px;--border-width:0}.list-md.list-inset .item-interactive{--padding-start:0;--padding-end:0}.list-md.list-inset+ion-list.list-inset{margin-top:0}.list-md-lines-none .item{--border-width:0;--inner-border-width:0}.list-md-lines-full .item,.list-md .item-lines-full{--border-width:0 0 1px 0}.list-md-lines-full .item{--inner-border-width:0}.list-md-lines-inset .item,.list-md .item-lines-inset{--inner-border-width:0 0 1px 0}.list-md .item-lines-inset{--border-width:0}.list-md .item-lines-full{--inner-border-width:0}.list-md .item-lines-none{--border-width:0;--inner-border-width:0}ion-card .list-md{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}"};const at=class{constructor(e){t(this,e),this.type="determinate",this.reversed=!1,this.value=0,this.buffer=1}render(){const{color:t,type:i,reversed:r,value:o,buffer:s}=this,a=h.getBoolean("_testing"),u=l(this);return e(n,{role:"progressbar","aria-valuenow":"determinate"===i?o:null,"aria-valuemin":"0","aria-valuemax":"1",class:w(t,{[u]:!0,[`progress-bar-${i}`]:!0,"progress-paused":a,"progress-bar-reversed":"rtl"===document.dir?!r:r})},"indeterminate"===i?ut():ct(o,s))}},ut=()=>e("div",{part:"track",class:"progress-buffer-bar"},e("div",{class:"indeterminate-bar-primary"},e("span",{part:"progress",class:"progress-indeterminate"})),e("div",{class:"indeterminate-bar-secondary"},e("span",{part:"progress",class:"progress-indeterminate"}))),ct=(t,n)=>{const i=v(0,t,1),r=v(0,n,1);return[e("div",{part:"progress",class:"progress",style:{transform:`scaleX(${i})`}}),e("div",{class:{"buffer-circles-container":!0,"ion-hide":1===r},style:{transform:`translateX(${100*r}%)`}},e("div",{class:"buffer-circles-container",style:{transform:`translateX(-${100*r}%)`}},e("div",{part:"stream",class:"buffer-circles"}))),e("div",{part:"track",class:"progress-buffer-bar",style:{transform:`scaleX(${r})`}})]};at.style={ios:":host{--background:rgba(var(--ion-color-primary-rgb, 56, 128, 255), 0.3);--progress-background:var(--ion-color-primary, #3880ff);--buffer-background:var(--background);display:block;position:relative;width:100%;contain:strict;direction:ltr;overflow:hidden}.progress,.progress-indeterminate,.indeterminate-bar-primary,.indeterminate-bar-secondary,.progress-buffer-bar{left:0;right:0;top:0;bottom:0;position:absolute;width:100%;height:100%}.buffer-circles-container,.buffer-circles{left:0;right:0;top:0;bottom:0;position:absolute}.buffer-circles{right:-10px;left:-10px;}.progress,.progress-buffer-bar,.buffer-circles-container{transform-origin:left top;transition:transform 150ms linear}.progress,.progress-indeterminate{background:var(--progress-background);z-index:2}.progress-buffer-bar{background:var(--buffer-background);z-index:1}.buffer-circles-container{overflow:hidden}.indeterminate-bar-primary{top:0;right:0;bottom:0;left:-145.166611%;animation:primary-indeterminate-translate 2s infinite linear}.indeterminate-bar-primary .progress-indeterminate{animation:primary-indeterminate-scale 2s infinite linear;animation-play-state:inherit}.indeterminate-bar-secondary{top:0;right:0;bottom:0;left:-54.888891%;animation:secondary-indeterminate-translate 2s infinite linear}.indeterminate-bar-secondary .progress-indeterminate{animation:secondary-indeterminate-scale 2s infinite linear;animation-play-state:inherit}.buffer-circles{background-image:radial-gradient(ellipse at center, var(--buffer-background) 0%, var(--buffer-background) 30%, transparent 30%);background-repeat:repeat-x;background-position:5px center;background-size:10px 10px;z-index:0;animation:buffering 450ms infinite linear}:host(.progress-bar-reversed){transform:scaleX(-1)}:host(.progress-paused) .indeterminate-bar-secondary,:host(.progress-paused) .indeterminate-bar-primary,:host(.progress-paused) .buffer-circles{animation-play-state:paused}:host(.ion-color) .progress-buffer-bar{background:rgba(var(--ion-color-base-rgb), 0.3)}:host(.ion-color) .buffer-circles{background-image:radial-gradient(ellipse at center, rgba(var(--ion-color-base-rgb), 0.3) 0%, rgba(var(--ion-color-base-rgb), 0.3) 30%, transparent 30%)}:host(.ion-color) .progress,:host(.ion-color) .progress-indeterminate{background:var(--ion-color-base)}@keyframes primary-indeterminate-translate{0%{transform:translateX(0)}20%{animation-timing-function:cubic-bezier(0.5, 0, 0.701732, 0.495819);transform:translateX(0)}59.15%{animation-timing-function:cubic-bezier(0.302435, 0.381352, 0.55, 0.956352);transform:translateX(83.67142%)}100%{transform:translateX(200.611057%)}}@keyframes primary-indeterminate-scale{0%{transform:scaleX(0.08)}36.65%{animation-timing-function:cubic-bezier(0.334731, 0.12482, 0.785844, 1);transform:scaleX(0.08)}69.15%{animation-timing-function:cubic-bezier(0.06, 0.11, 0.6, 1);transform:scaleX(0.661479)}100%{transform:scaleX(0.08)}}@keyframes secondary-indeterminate-translate{0%{animation-timing-function:cubic-bezier(0.15, 0, 0.515058, 0.409685);transform:translateX(0)}25%{animation-timing-function:cubic-bezier(0.31033, 0.284058, 0.8, 0.733712);transform:translateX(37.651913%)}48.35%{animation-timing-function:cubic-bezier(0.4, 0.627035, 0.6, 0.902026);transform:translateX(84.386165%)}100%{transform:translateX(160.277782%)}}@keyframes secondary-indeterminate-scale{0%{animation-timing-function:cubic-bezier(0.205028, 0.057051, 0.57661, 0.453971);transform:scaleX(0.08)}19.15%{animation-timing-function:cubic-bezier(0.152313, 0.196432, 0.648374, 1.004315);transform:scaleX(0.457104)}44.15%{animation-timing-function:cubic-bezier(0.257759, -0.003163, 0.211762, 1.38179);transform:scaleX(0.72796)}100%{transform:scaleX(0.08)}}@keyframes buffering{to{transform:translateX(-10px)}}:host{height:3px}",md:":host{--background:rgba(var(--ion-color-primary-rgb, 56, 128, 255), 0.3);--progress-background:var(--ion-color-primary, #3880ff);--buffer-background:var(--background);display:block;position:relative;width:100%;contain:strict;direction:ltr;overflow:hidden}.progress,.progress-indeterminate,.indeterminate-bar-primary,.indeterminate-bar-secondary,.progress-buffer-bar{left:0;right:0;top:0;bottom:0;position:absolute;width:100%;height:100%}.buffer-circles-container,.buffer-circles{left:0;right:0;top:0;bottom:0;position:absolute}.buffer-circles{right:-10px;left:-10px;}.progress,.progress-buffer-bar,.buffer-circles-container{transform-origin:left top;transition:transform 150ms linear}.progress,.progress-indeterminate{background:var(--progress-background);z-index:2}.progress-buffer-bar{background:var(--buffer-background);z-index:1}.buffer-circles-container{overflow:hidden}.indeterminate-bar-primary{top:0;right:0;bottom:0;left:-145.166611%;animation:primary-indeterminate-translate 2s infinite linear}.indeterminate-bar-primary .progress-indeterminate{animation:primary-indeterminate-scale 2s infinite linear;animation-play-state:inherit}.indeterminate-bar-secondary{top:0;right:0;bottom:0;left:-54.888891%;animation:secondary-indeterminate-translate 2s infinite linear}.indeterminate-bar-secondary .progress-indeterminate{animation:secondary-indeterminate-scale 2s infinite linear;animation-play-state:inherit}.buffer-circles{background-image:radial-gradient(ellipse at center, var(--buffer-background) 0%, var(--buffer-background) 30%, transparent 30%);background-repeat:repeat-x;background-position:5px center;background-size:10px 10px;z-index:0;animation:buffering 450ms infinite linear}:host(.progress-bar-reversed){transform:scaleX(-1)}:host(.progress-paused) .indeterminate-bar-secondary,:host(.progress-paused) .indeterminate-bar-primary,:host(.progress-paused) .buffer-circles{animation-play-state:paused}:host(.ion-color) .progress-buffer-bar{background:rgba(var(--ion-color-base-rgb), 0.3)}:host(.ion-color) .buffer-circles{background-image:radial-gradient(ellipse at center, rgba(var(--ion-color-base-rgb), 0.3) 0%, rgba(var(--ion-color-base-rgb), 0.3) 30%, transparent 30%)}:host(.ion-color) .progress,:host(.ion-color) .progress-indeterminate{background:var(--ion-color-base)}@keyframes primary-indeterminate-translate{0%{transform:translateX(0)}20%{animation-timing-function:cubic-bezier(0.5, 0, 0.701732, 0.495819);transform:translateX(0)}59.15%{animation-timing-function:cubic-bezier(0.302435, 0.381352, 0.55, 0.956352);transform:translateX(83.67142%)}100%{transform:translateX(200.611057%)}}@keyframes primary-indeterminate-scale{0%{transform:scaleX(0.08)}36.65%{animation-timing-function:cubic-bezier(0.334731, 0.12482, 0.785844, 1);transform:scaleX(0.08)}69.15%{animation-timing-function:cubic-bezier(0.06, 0.11, 0.6, 1);transform:scaleX(0.661479)}100%{transform:scaleX(0.08)}}@keyframes secondary-indeterminate-translate{0%{animation-timing-function:cubic-bezier(0.15, 0, 0.515058, 0.409685);transform:translateX(0)}25%{animation-timing-function:cubic-bezier(0.31033, 0.284058, 0.8, 0.733712);transform:translateX(37.651913%)}48.35%{animation-timing-function:cubic-bezier(0.4, 0.627035, 0.6, 0.902026);transform:translateX(84.386165%)}100%{transform:translateX(160.277782%)}}@keyframes secondary-indeterminate-scale{0%{animation-timing-function:cubic-bezier(0.205028, 0.057051, 0.57661, 0.453971);transform:scaleX(0.08)}19.15%{animation-timing-function:cubic-bezier(0.152313, 0.196432, 0.648374, 1.004315);transform:scaleX(0.457104)}44.15%{animation-timing-function:cubic-bezier(0.257759, -0.003163, 0.211762, 1.38179);transform:scaleX(0.72796)}100%{transform:scaleX(0.08)}}@keyframes buffering{to{transform:translateX(-10px)}}:host{height:4px}"};const lt=class{constructor(e){t(this,e),this.type="bounded"}async addRipple(t,e){return new Promise((n=>{s((()=>{const i=this.el.getBoundingClientRect(),r=i.width,o=i.height,s=Math.sqrt(r*r+o*o),u=Math.max(o,r),c=this.unbounded?u:s+dt,l=Math.floor(u*ft),h=c/l;let d=t-i.left,f=e-i.top;this.unbounded&&(d=.5*r,f=.5*o);const p=d-.5*l,v=f-.5*l,g=.5*r-d,m=.5*o-f;a((()=>{const t=document.createElement("div");t.classList.add("ripple-effect");const e=t.style;e.top=v+"px",e.left=p+"px",e.width=e.height=l+"px",e.setProperty("--final-scale",`${h}`),e.setProperty("--translate-end",`${g}px, ${m}px`),(this.el.shadowRoot||this.el).appendChild(t),setTimeout((()=>{n((()=>{ht(t)}))}),325)}))}))}))}get unbounded(){return"unbounded"===this.type}render(){const t=l(this);return e(n,{role:"presentation",class:{[t]:!0,unbounded:this.unbounded}})}get el(){return i(this)}},ht=t=>{t.classList.add("fade-out"),setTimeout((()=>{t.remove()}),200)},dt=10,ft=.5;lt.style=":host{left:0;right:0;top:0;bottom:0;position:absolute;contain:strict;pointer-events:none}:host(.unbounded){contain:layout size style}.ripple-effect{border-radius:50%;position:absolute;background-color:currentColor;color:inherit;contain:strict;opacity:0;animation:225ms rippleAnimation forwards, 75ms fadeInAnimation forwards;will-change:transform, opacity;pointer-events:none}.fade-out{transform:translate(var(--translate-end)) scale(var(--final-scale, 1));animation:150ms fadeOutAnimation forwards}@keyframes rippleAnimation{from{animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transform:scale(1)}to{transform:translate(var(--translate-end)) scale(var(--final-scale, 1))}}@keyframes fadeInAnimation{from{animation-timing-function:linear;opacity:0}to{opacity:0.16}}@keyframes fadeOutAnimation{from{animation-timing-function:linear;opacity:0.16}to{opacity:0}}";const pt=class{constructor(e){t(this,e)}render(){return e(n,{class:l(this)},e("slot",null))}};pt.style=":host{display:flex;flex-wrap:wrap}";const vt=class{constructor(e){t(this,e),this.ionStyle=r(this,"ionStyle",7)}sizeChanged(){this.emitStyle()}connectedCallback(){this.emitStyle()}emitStyle(){const t=this.getSize();this.ionStyle.emit({[`title-${t}`]:!0})}getSize(){return void 0!==this.size?this.size:"default"}render(){const t=l(this),i=this.getSize();return e(n,{class:w(this.color,{[t]:!0,[`title-${i}`]:!0,"title-rtl":"rtl"===document.dir})},e("div",{class:"toolbar-title"},e("slot",null)))}get el(){return i(this)}static get watchers(){return{size:["sizeChanged"]}}};vt.style={ios:":host{--color:initial;display:flex;flex:1;align-items:center;transform:translateZ(0);color:var(--color)}:host(.ion-color){color:var(--ion-color-base)}.toolbar-title{display:block;width:100%;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;pointer-events:auto}:host(.title-small) .toolbar-title{white-space:normal}:host{left:0;top:0;padding-left:90px;padding-right:90px;padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);position:absolute;width:100%;height:100%;transform:translateZ(0);font-size:17px;font-weight:600;text-align:center;box-sizing:border-box;pointer-events:none}:host-context([dir=rtl]){left:unset;right:unset;right:0}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:90px;padding-inline-start:90px;-webkit-padding-end:90px;padding-inline-end:90px}}:host(.title-small){padding-left:9px;padding-right:9px;padding-top:6px;padding-bottom:16px;position:relative;font-size:13px;font-weight:normal}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host(.title-small){padding-left:unset;padding-right:unset;-webkit-padding-start:9px;padding-inline-start:9px;-webkit-padding-end:9px;padding-inline-end:9px}}:host(.title-large){padding-left:16px;padding-right:16px;padding-top:0;padding-bottom:0;transform-origin:left center;bottom:0;align-items:flex-end;min-width:100%;padding-bottom:6px;font-size:34px;font-weight:700;text-align:start}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host(.title-large){padding-left:unset;padding-right:unset;-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px}}:host(.title-large.title-rtl){transform-origin:right center}:host(.title-large.ion-cloned-element){--color:var(--ion-text-color, #000)}:host(.title-large) .toolbar-title{transform-origin:inherit}:host-context([dir=rtl]):host(.title-large) .toolbar-title,:host-context([dir=rtl]).title-large .toolbar-title{transform-origin:calc(100% - inherit)}",md:":host{--color:initial;display:flex;flex:1;align-items:center;transform:translateZ(0);color:var(--color)}:host(.ion-color){color:var(--ion-color-base)}.toolbar-title{display:block;width:100%;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;pointer-events:auto}:host(.title-small) .toolbar-title{white-space:normal}:host{padding-left:20px;padding-right:20px;padding-top:0;padding-bottom:0;font-size:20px;font-weight:500;letter-spacing:0.0125em}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:20px;padding-inline-start:20px;-webkit-padding-end:20px;padding-inline-end:20px}}:host(.title-small){width:100%;height:100%;font-size:15px;font-weight:normal}"};const gt=class{constructor(e){t(this,e),this.childrenStyles=new Map}componentWillLoad(){const t=Array.from(this.el.querySelectorAll("ion-buttons")),e=t.find((t=>"start"===t.slot));e&&e.classList.add("buttons-first-slot");const n=t.reverse(),i=n.find((t=>"end"===t.slot))||n.find((t=>"primary"===t.slot))||n.find((t=>"secondary"===t.slot));i&&i.classList.add("buttons-last-slot")}childrenStyle(t){t.stopPropagation();const e=t.target.tagName,n=t.detail,i={},r=this.childrenStyles.get(e)||{};let s=!1;Object.keys(n).forEach((t=>{const e=`toolbar-${t}`,o=n[t];o!==r[e]&&(s=!0),o&&(i[e]=!0)})),s&&(this.childrenStyles.set(e,i),o(this))}render(){const t=l(this),i={};return this.childrenStyles.forEach((t=>{Object.assign(i,t)})),e(n,{class:Object.assign(Object.assign({},i),w(this.color,{[t]:!0,"in-toolbar":b("ion-toolbar",this.el)}))},e("div",{class:"toolbar-background"}),e("div",{class:"toolbar-container"},e("slot",{name:"start"}),e("slot",{name:"secondary"}),e("div",{class:"toolbar-content"},e("slot",null)),e("slot",{name:"primary"}),e("slot",{name:"end"})))}get el(){return i(this)}};gt.style={ios:":host{--border-width:0;--border-style:solid;--opacity:1;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;padding-left:var(--ion-safe-area-left);padding-right:var(--ion-safe-area-right);display:block;position:relative;width:100%;color:var(--color);font-family:var(--ion-font-family, inherit);contain:content;z-index:10;box-sizing:border-box}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--ion-safe-area-left);padding-inline-start:var(--ion-safe-area-left);-webkit-padding-end:var(--ion-safe-area-right);padding-inline-end:var(--ion-safe-area-right)}}:host(.ion-color){color:var(--ion-color-contrast)}:host(.ion-color) .toolbar-background{background:var(--ion-color-base)}.toolbar-container{padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);display:flex;position:relative;flex-direction:row;align-items:center;justify-content:space-between;width:100%;min-height:var(--min-height);contain:content;overflow:hidden;z-index:10;box-sizing:border-box}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.toolbar-container{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}.toolbar-background{left:0;right:0;top:0;bottom:0;position:absolute;transform:translateZ(0);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);contain:strict;opacity:var(--opacity);z-index:-1;pointer-events:none}::slotted(ion-progress-bar){left:0;right:0;bottom:0;position:absolute}:host{--background:var(--ion-toolbar-background, var(--ion-color-step-50, #fff));--color:var(--ion-toolbar-color, var(--ion-text-color, #000));--border-color:var(--ion-toolbar-border-color, var(--ion-border-color, var(--ion-color-step-150, rgba(0, 0, 0, 0.2))));--padding-top:3px;--padding-bottom:3px;--padding-start:4px;--padding-end:4px;--min-height:44px}.toolbar-content{flex:1;order:4;min-width:0}:host(.toolbar-segment) .toolbar-content{display:inline-flex}:host(.toolbar-searchbar) .toolbar-container{padding-top:0;padding-bottom:0}:host(.toolbar-searchbar) ::slotted(*){align-self:start}:host(.toolbar-searchbar) ::slotted(ion-chip){margin-top:3px}:host(.toolbar-searchbar) ::slotted(ion-back-button){height:38px}::slotted(ion-buttons){min-height:38px}::slotted([slot=start]){order:2}::slotted([slot=secondary]){order:3}::slotted([slot=primary]){order:5;text-align:end}::slotted([slot=end]){order:6;text-align:end}:host(.toolbar-title-large) .toolbar-container{flex-wrap:wrap;align-items:flex-start}:host(.toolbar-title-large) .toolbar-content ion-title{flex:1;order:8;min-width:100%}",md:":host{--border-width:0;--border-style:solid;--opacity:1;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;padding-left:var(--ion-safe-area-left);padding-right:var(--ion-safe-area-right);display:block;position:relative;width:100%;color:var(--color);font-family:var(--ion-font-family, inherit);contain:content;z-index:10;box-sizing:border-box}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--ion-safe-area-left);padding-inline-start:var(--ion-safe-area-left);-webkit-padding-end:var(--ion-safe-area-right);padding-inline-end:var(--ion-safe-area-right)}}:host(.ion-color){color:var(--ion-color-contrast)}:host(.ion-color) .toolbar-background{background:var(--ion-color-base)}.toolbar-container{padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);display:flex;position:relative;flex-direction:row;align-items:center;justify-content:space-between;width:100%;min-height:var(--min-height);contain:content;overflow:hidden;z-index:10;box-sizing:border-box}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.toolbar-container{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}.toolbar-background{left:0;right:0;top:0;bottom:0;position:absolute;transform:translateZ(0);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--background);contain:strict;opacity:var(--opacity);z-index:-1;pointer-events:none}::slotted(ion-progress-bar){left:0;right:0;bottom:0;position:absolute}:host{--background:var(--ion-toolbar-background, var(--ion-background-color, #fff));--color:var(--ion-toolbar-color, var(--ion-text-color, #424242));--border-color:var(--ion-toolbar-border-color, var(--ion-border-color, var(--ion-color-step-150, #c1c4cd)));--padding-top:0;--padding-bottom:0;--padding-start:0;--padding-end:0;--min-height:56px}.toolbar-content{flex:1;order:3;min-width:0;max-width:100%}::slotted(ion-segment){min-height:var(--min-height)}::slotted(.buttons-first-slot){margin-left:4px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(.buttons-first-slot){margin-left:unset;-webkit-margin-start:4px;margin-inline-start:4px}}::slotted(.buttons-last-slot){margin-right:4px}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){::slotted(.buttons-last-slot){margin-right:unset;-webkit-margin-end:4px;margin-inline-end:4px}}::slotted([slot=start]){order:2}::slotted([slot=secondary]){order:4}::slotted([slot=primary]){order:5;text-align:end}::slotted([slot=end]){order:6;text-align:end}"};const mt=t=>!("isConnected"in t)||t.isConnected,wt=(()=>{let t;return(...e)=>{t&&clearTimeout(t),t=setTimeout((()=>{t=0,(t=>{for(let e of t.keys())t.set(e,t.get(e).filter(mt))})(...e)}),2e3)}})(),bt=(t,e)=>{const n=((t,e=((t,e)=>t!==e))=>{let n=new Map(Object.entries(null!=t?t:{}));const i={dispose:[],get:[],set:[],reset:[]},r=()=>{n=new Map(Object.entries(null!=t?t:{})),i.reset.forEach((t=>t()))},o=t=>(i.get.forEach((e=>e(t))),n.get(t)),s=(t,r)=>{const o=n.get(t);e(r,o,t)&&(n.set(t,r),i.set.forEach((e=>e(t,r,o))))},a="undefined"==typeof Proxy?{}:new Proxy(t,{get:(t,e)=>o(e),ownKeys:()=>Array.from(n.keys()),getOwnPropertyDescriptor:()=>({enumerable:!0,configurable:!0}),has:(t,e)=>n.has(e),set:(t,e,n)=>(s(e,n),!0)}),u=(t,e)=>(i[t].push(e),()=>{((t,e)=>{const n=t.indexOf(e);n>=0&&(t[n]=t[t.length-1],t.length--)})(i[t],e)});return{state:a,get:o,set:s,on:u,onChange:(e,n)=>{const i=u("set",((t,i)=>{t===e&&n(i)})),r=u("reset",(()=>n(t[e])));return()=>{i(),r()}},use:(...t)=>{const e=t.reduce(((t,e)=>(e.set&&t.push(u("set",e.set)),e.get&&t.push(u("get",e.get)),e.reset&&t.push(u("reset",e.reset)),e.dispose&&t.push(u("dispose",e.dispose)),t)),[]);return()=>e.forEach((t=>t()))},dispose:()=>{i.dispose.forEach((t=>t())),r()},reset:r,forceUpdate:t=>{const e=n.get(t);i.set.forEach((n=>n(t,e,e)))}}})(t,e);return n.use((()=>{if("function"!=typeof c)return{};const t=new Map;return{dispose:()=>t.clear(),get:e=>{const n=c();n&&((t,e,n)=>{const i=t.get(e);i?i.includes(n)||i.push(n):t.set(e,[n])})(t,e,n)},set:e=>{const n=t.get(e);n&&t.set(e,n.filter(o)),wt(t)},reset:()=>{t.forEach((t=>t.forEach(o))),wt(t)}}})()),n},yt=bt({getIdpUrl:()=>prompt("Please enter your Identity Provider URL","http://localhost:3000"),isLoggedIn:!1,webId:""});var xt,kt,Et,St,Ft,At,_t=Object.create,jt=Object.defineProperty,Ct=Object.defineProperties,Rt=Object.getOwnPropertyDescriptor,It=Object.getOwnPropertyDescriptors,Tt=Object.getOwnPropertyNames,Ot=Object.getOwnPropertySymbols,Nt=Object.getPrototypeOf,Pt=Object.prototype.hasOwnProperty,Dt=Object.prototype.propertyIsEnumerable,Mt=(t,e,n)=>e in t?jt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ut=(t,e)=>{for(var n in e||={})Pt.call(e,n)&&Mt(t,n,e[n]);if(Ot)for(var n of Ot(e))Dt.call(e,n)&&Mt(t,n,e[n]);return t},Lt=(t,e)=>Ct(t,It(e)),Bt=(t,e)=>function(){return t&&(e=(0,t[Tt(t)[0]])(t=0)),e},Jt=(t,e)=>function(){return e||(0,t[Tt(t)[0]])((e={exports:{}}).exports,e),e.exports},$t=(t,e)=>{for(var n in e)jt(t,n,{get:e[n],enumerable:!0})},Ht=(t,e,n,i)=>{if(e&&"object"==typeof e||"function"==typeof e)for(let r of Tt(e))Pt.call(t,r)||r===n||jt(t,r,{get:()=>e[r],enumerable:!(i=Rt(e,r))||i.enumerable});return t},Kt=(t,e,n)=>(n=null!=t?_t(Nt(t)):{},Ht(!e&&t&&t.__esModule?n:jt(n,"default",{value:t,enumerable:!0}),t)),zt=t=>Ht(jt({},"__esModule",{value:!0}),t),Wt=(t,e,n)=>new Promise(((i,r)=>{var o=t=>{try{a(n.next(t))}catch(t){r(t)}},s=t=>{try{a(n.throw(t))}catch(t){r(t)}},a=t=>t.done?i(t.value):Promise.resolve(t.value).then(o,s);a((n=n.apply(t,e)).next())})),qt=Jt({"../node_modules/events/events.js"(t,e){var n,i="object"==typeof Reflect?Reflect:null,r=i&&"function"==typeof i.apply?i.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};n=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var o=Number.isNaN||function(t){return t!=t};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(t,e){return new Promise((function(n,i){function r(n){t.removeListener(e,o),i(n)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",r),n([].slice.call(arguments))}g(t,e,o,{once:!0}),"error"!==e&&function(t,e){"function"==typeof t.on&&g(t,"error",e,{once:!0})}(t,r)}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var a=10;function u(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function c(t){return void 0===t._maxListeners?s.defaultMaxListeners:t._maxListeners}function l(t,e,n,i){var r,o,s;if(u(n),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),s=o[e]),void 0===s)s=o[e]=n,++t._eventsCount;else if("function"==typeof s?s=o[e]=i?[n,s]:[s,n]:i?s.unshift(n):s.push(n),(r=c(t))>0&&s.length>r&&!s.warned){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=s.length,console&&console.warn&&console.warn(a)}return t}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(t,e,n){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},r=h.bind(i);return r.listener=n,i.wrapFn=r,r}function f(t,e,n){var i=t._events;if(void 0===i)return[];var r=i[e];return void 0===r?[]:"function"==typeof r?n?[r.listener||r]:[r]:n?function(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}(r):v(r,r.length)}function p(t){var e=this._events;if(void 0!==e){var n=e[t];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function v(t,e){for(var n=new Array(e),i=0;i<e;++i)n[i]=t[i];return n}function g(t,e,n,i){if("function"==typeof t.on)i.once?t.once(e,n):t.on(e,n);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function r(o){i.once&&t.removeEventListener(e,r),n(o)}))}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(t){if("number"!=typeof t||t<0||o(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");a=t}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||o(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},s.prototype.getMaxListeners=function(){return c(this)},s.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var i="error"===t,o=this._events;if(void 0!==o)i=i&&void 0===o.error;else if(!i)return!1;if(i){var s;if(e.length>0&&(s=e[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=o[t];if(void 0===u)return!1;if("function"==typeof u)r(u,this,e);else{var c=u.length,l=v(u,c);for(n=0;n<c;++n)r(l[n],this,e)}return!0},s.prototype.on=s.prototype.addListener=function(t,e){return l(this,t,e,!1)},s.prototype.prependListener=function(t,e){return l(this,t,e,!0)},s.prototype.once=function(t,e){return u(e),this.on(t,d(this,t,e)),this},s.prototype.prependOnceListener=function(t,e){return u(e),this.prependListener(t,d(this,t,e)),this},s.prototype.off=s.prototype.removeListener=function(t,e){var n,i,r,o,s;if(u(e),void 0===(i=this._events))return this;if(void 0===(n=i[t]))return this;if(n===e||n.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete i[t],i.removeListener&&this.emit("removeListener",t,n.listener||e));else if("function"!=typeof n){for(r=-1,o=n.length-1;o>=0;o--)if(n[o]===e||n[o].listener===e){s=n[o].listener,r=o;break}if(r<0)return this;0===r?n.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(n,r),1===n.length&&(i[t]=n[0]),void 0!==i.removeListener&&this.emit("removeListener",t,s||e)}return this},s.prototype.removeAllListeners=function(t){var e,n,i;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[t]),this;if(0===arguments.length){var r,o=Object.keys(n);for(i=0;i<o.length;++i)"removeListener"!==(r=o[i])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=n[t]))this.removeListener(t,e);else if(void 0!==e)for(i=e.length-1;i>=0;i--)this.removeListener(t,e[i]);return this},s.prototype.listeners=function(t){return f(this,t,!0)},s.prototype.rawListeners=function(t){return f(this,t,!1)},s.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):p.call(t,e)},s.prototype.listenerCount=p,s.prototype.eventNames=function(){return this._eventsCount>0?n(this._events):[]}}}),Vt=Jt({"../node_modules/@inrupt/solid-client-authn-core/dist/constant.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_SCOPES=t.REFRESH_BEFORE_EXPIRATION_SECONDS=t.EVENTS=t.PREFERRED_SIGNING_ALG=t.SOLID_CLIENT_AUTHN_KEY_PREFIX=void 0,t.SOLID_CLIENT_AUTHN_KEY_PREFIX="solidClientAuthn:",t.PREFERRED_SIGNING_ALG=["ES256","RS256"],t.EVENTS={ERROR:"error",LOGIN:"login",LOGOUT:"logout",NEW_REFRESH_TOKEN:"newRefreshToken",SESSION_EXPIRED:"sessionExpired",SESSION_EXTENDED:"sessionExtended",SESSION_RESTORED:"sessionRestore",TIMEOUT_SET:"timeoutSet"},t.REFRESH_BEFORE_EXPIRATION_SECONDS=5,t.DEFAULT_SCOPES=["openid","offline_access","webid"].join(" ")}}),Gt=Jt({"../node_modules/@inrupt/solid-client-authn-core/dist/errors/InruptError.js"(t){Object.defineProperty(t,"__esModule",{value:!0});var e=class extends Error{constructor(t,n,i=!0){super("string"==typeof t?e.substituteParams(t,n):e.appendErrorIri(e.lookupErrorIri(t,n),t,i))}httpResponse(t,n=!0){return this.message=e.appendHttpResponseDetails(this.message,t,n),this.httpErrorResponse=t,this}hasHttpResponse(){return void 0!==this.httpErrorResponse}getHttpResponse(){return this.httpErrorResponse}getHttpStatusCode(){if(void 0===this.httpErrorResponse)throw new e("This InruptError was not provided with a HTTP response - so we can't get its HTTP Status Code.");return this.httpErrorResponse.status}getHttpStatusText(){if(void 0===this.httpErrorResponse)throw new e("This InruptError was not provided with a HTTP response - so we can't get its HTTP Status Text!");return this.httpErrorResponse.statusText}static determineIfVocabTerm(t){return void 0!==t.strict}static lookupErrorIri(t,n){if(e.determineIfVocabTerm(t)){const e=void 0===n?t.message:t.messageParams(...n);return void 0===e?`Looked up error message IRI [${t.value}], but found no message value.`:e}return`Error message looked up at: [${t.value}]${void 0===n?"":`, with params [${n.toString()}]`}`}static appendHttpResponseDetails(t,e,n){return n&&void 0!==e?`${t} HTTP details: status code [${e.status}], status text [${e.statusText}].`:t}static appendErrorIri(t,e,n){return n?`${t} Error IRI: [${e.value}].`:t}static substituteParams(t,e){let n=t;if(void 0!==e){const i=t.split("{{").length-1;if(i!==e.length)throw new Error(`Setting parameters on message [${t}], but it requires [${i}] params and we received [${e.length}].`);for(let t=0;t<e.length;t+=1)n=n.replace(`{{${t}}}`,e[t])}return n}};t.default=e}}),Xt=Jt({"../node_modules/@inrupt/solid-client-authn-core/dist/util/handlerPattern/AggregateHandler.js"(t){var e=t&&t.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(t,"__esModule",{value:!0});var n=e(Gt());t.default=class{constructor(t){this.handleables=t}async getProperHandler(t){const e=await Promise.all(this.handleables.map((e=>e.canHandle(...t))));for(let t=0;t<e.length;t+=1)if(e[t])return this.handleables[t];return null}async canHandle(...t){return null!==await this.getProperHandler(t)}async handle(...t){const e=await this.getProperHandler(t);if(e)return e.handle(...t);throw new n.default(`[${this.constructor.name}] cannot find a suitable handler for: ${t.map((t=>{try{return JSON.stringify(t)}catch(e){return t.toString()}})).join(", ")}`)}}}}),Yt=Jt({"../node_modules/cross-fetch/dist/browser-ponyfill.js"(t,e){var n,i="undefined"!=typeof self?self:t,r=function(){function t(){this.fetch=!1,this.DOMException=i.DOMException}return t.prototype=i,new t}();n=r,function(t){var e="URLSearchParams"in n,i="Symbol"in n&&"iterator"in Symbol,r="FileReader"in n&&"Blob"in n&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in n,s="ArrayBuffer"in n;if(s)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(t){return t&&a.indexOf(Object.prototype.toString.call(t))>-1};function c(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function l(t){return"string"!=typeof t&&(t=String(t)),t}function h(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return i&&(e[Symbol.iterator]=function(){return e}),e}function d(t){this.map={},t instanceof d?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function f(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function p(t){return new Promise((function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}}))}function v(t){var e=new FileReader,n=p(e);return e.readAsArrayBuffer(t),n}function g(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function m(){return this.bodyUsed=!1,this._initBody=function(t){var n;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:r&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:e&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():s&&r&&(n=t)&&DataView.prototype.isPrototypeOf(n)?(this._bodyArrayBuffer=g(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(t)||u(t))?this._bodyArrayBuffer=g(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):e&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r&&(this.blob=function(){var t=f(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(v)}),this.text=function(){var t,e,n,i=f(this);if(i)return i;if(this._bodyBlob)return t=this._bodyBlob,n=p(e=new FileReader),e.readAsText(t),n;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),n=new Array(e.length),i=0;i<e.length;i++)n[i]=String.fromCharCode(e[i]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},o&&(this.formData=function(){return this.text().then(y)}),this.json=function(){return this.text().then(JSON.parse)},this}d.prototype.append=function(t,e){t=c(t),e=l(e);var n=this.map[t];this.map[t]=n?n+", "+e:e},d.prototype.delete=function(t){delete this.map[c(t)]},d.prototype.get=function(t){return t=c(t),this.has(t)?this.map[t]:null},d.prototype.has=function(t){return this.map.hasOwnProperty(c(t))},d.prototype.set=function(t,e){this.map[c(t)]=l(e)},d.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)},d.prototype.keys=function(){var t=[];return this.forEach((function(e,n){t.push(n)})),h(t)},d.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),h(t)},d.prototype.entries=function(){var t=[];return this.forEach((function(e,n){t.push([n,e])})),h(t)},i&&(d.prototype[Symbol.iterator]=d.prototype.entries);var w=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function b(t,e){var n,i,r=(e=e||{}).body;if(t instanceof b){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new d(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,r||null==t._bodyInit||(r=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new d(e.headers)),this.method=(i=(n=e.method||this.method||"GET").toUpperCase(),w.indexOf(i)>-1?i:n),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function y(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var n=t.split("="),i=n.shift().replace(/\+/g," "),r=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(i),decodeURIComponent(r))}})),e}function x(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new d(e.headers),this.url=e.url||"",this._initBody(t)}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})},m.call(b.prototype),m.call(x.prototype),x.prototype.clone=function(){return new x(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},x.error=function(){var t=new x(null,{status:0,statusText:""});return t.type="error",t};var k=[301,302,303,307,308];x.redirect=function(t,e){if(-1===k.indexOf(e))throw new RangeError("Invalid status code");return new x(null,{status:e,headers:{location:t}})},t.DOMException=n.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(t,e){this.message=t,this.name=e;var n=Error(t);this.stack=n.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function E(e,n){return new Promise((function(i,o){var s=new b(e,n);if(s.signal&&s.signal.aborted)return o(new t.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function u(){a.abort()}a.onload=function(){var t,e,n={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new d,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var n=t.split(":"),i=n.shift().trim();if(i){var r=n.join(":").trim();e.append(i,r)}})),e)};n.url="responseURL"in a?a.responseURL:n.headers.get("X-Request-URL"),i(new x("response"in a?a.response:a.responseText,n))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.onabort=function(){o(new t.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&r&&(a.responseType="blob"),s.headers.forEach((function(t,e){a.setRequestHeader(e,t)})),s.signal&&(s.signal.addEventListener("abort",u),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",u)}),a.send(void 0===s._bodyInit?null:s._bodyInit)}))}E.polyfill=!0,n.fetch||(n.fetch=E,n.Headers=d,n.Request=b,n.Response=x),t.Headers=d,t.Request=b,t.Response=x,t.fetch=E,Object.defineProperty(t,"__esModule",{value:!0})}({}),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var o=r;(t=o.fetch).default=o.fetch,t.fetch=o.fetch,t.Headers=o.Headers,t.Request=o.Request,t.Response=o.Response,e.exports=t}}),Zt=Bt({"../node_modules/jose/dist/browser/runtime/webcrypto.js"(){xt=crypto,kt=t=>t instanceof CryptoKey}}),Qt=Bt({"../node_modules/jose/dist/browser/runtime/digest.js"(){Zt(),Et=async(t,e)=>{const n=`SHA-${t.slice(-3)}`;return new Uint8Array(await xt.subtle.digest(n,e))}}});function te(...t){const e=t.reduce(((t,{length:e})=>t+e),0),n=new Uint8Array(e);let i=0;return t.forEach((t=>{n.set(t,i),i+=t.length})),n}function ee(t,e,n){if(e<0||e>=At)throw new RangeError(`value must be >= 0 and <= ${At-1}. Received ${e}`);t.set([e>>>24,e>>>16,e>>>8,255&e],n)}function ne(t){const e=Math.floor(t/At),n=t%At,i=new Uint8Array(8);return ee(i,e,0),ee(i,n,4),i}function ie(t){const e=new Uint8Array(4);return ee(e,t),e}function re(t){return te(ie(t.length),t)}var oe,se,ae,ue,ce,le,he,de,fe,pe,ve,ge,me,we,be,ye,xe,ke,Ee,Se=Bt({"../node_modules/jose/dist/browser/lib/buffer_utils.js"(){Qt(),St=new TextEncoder,Ft=new TextDecoder,At=2**32}}),Fe=Bt({"../node_modules/jose/dist/browser/runtime/base64url.js"(){Se(),oe=t=>{let e=t;"string"==typeof e&&(e=St.encode(e));const n=[];for(let t=0;t<e.length;t+=32768)n.push(String.fromCharCode.apply(null,e.subarray(t,t+32768)));return btoa(n.join(""))},se=t=>oe(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),ae=t=>{const e=atob(t),n=new Uint8Array(e.length);for(let t=0;t<e.length;t++)n[t]=e.charCodeAt(t);return n},ue=t=>{let e=t;e instanceof Uint8Array&&(e=Ft.decode(e)),e=e.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return ae(e)}catch(t){throw new TypeError("The input to be decoded is not correctly encoded.")}}}}),Ae={};$t(Ae,{JOSEAlgNotAllowed:()=>de,JOSEError:()=>ce,JOSENotSupported:()=>fe,JWEDecryptionFailed:()=>pe,JWEInvalid:()=>ve,JWKInvalid:()=>we,JWKSInvalid:()=>be,JWKSMultipleMatchingKeys:()=>xe,JWKSNoMatchingKey:()=>ye,JWKSTimeout:()=>ke,JWSInvalid:()=>ge,JWSSignatureVerificationFailed:()=>Ee,JWTClaimValidationFailed:()=>le,JWTExpired:()=>he,JWTInvalid:()=>me});var _e,je,Ce=Bt({"../node_modules/jose/dist/browser/util/errors.js"(){ce=class extends Error{constructor(t){var e;super(t),this.code="ERR_JOSE_GENERIC",this.name=this.constructor.name,null===(e=Error.captureStackTrace)||void 0===e||e.call(Error,this,this.constructor)}static get code(){return"ERR_JOSE_GENERIC"}},le=class extends ce{constructor(t,e="unspecified",n="unspecified"){super(t),this.code="ERR_JWT_CLAIM_VALIDATION_FAILED",this.claim=e,this.reason=n}static get code(){return"ERR_JWT_CLAIM_VALIDATION_FAILED"}},he=class extends ce{constructor(t,e="unspecified",n="unspecified"){super(t),this.code="ERR_JWT_EXPIRED",this.claim=e,this.reason=n}static get code(){return"ERR_JWT_EXPIRED"}},de=class extends ce{constructor(){super(...arguments),this.code="ERR_JOSE_ALG_NOT_ALLOWED"}static get code(){return"ERR_JOSE_ALG_NOT_ALLOWED"}},fe=class extends ce{constructor(){super(...arguments),this.code="ERR_JOSE_NOT_SUPPORTED"}static get code(){return"ERR_JOSE_NOT_SUPPORTED"}},pe=class extends ce{constructor(){super(...arguments),this.code="ERR_JWE_DECRYPTION_FAILED",this.message="decryption operation failed"}static get code(){return"ERR_JWE_DECRYPTION_FAILED"}},ve=class extends ce{constructor(){super(...arguments),this.code="ERR_JWE_INVALID"}static get code(){return"ERR_JWE_INVALID"}},ge=class extends ce{constructor(){super(...arguments),this.code="ERR_JWS_INVALID"}static get code(){return"ERR_JWS_INVALID"}},me=class extends ce{constructor(){super(...arguments),this.code="ERR_JWT_INVALID"}static get code(){return"ERR_JWT_INVALID"}},we=class extends ce{constructor(){super(...arguments),this.code="ERR_JWK_INVALID"}static get code(){return"ERR_JWK_INVALID"}},be=class extends ce{constructor(){super(...arguments),this.code="ERR_JWKS_INVALID"}static get code(){return"ERR_JWKS_INVALID"}},ye=class extends ce{constructor(){super(...arguments),this.code="ERR_JWKS_NO_MATCHING_KEY",this.message="no applicable key found in the JSON Web Key Set"}static get code(){return"ERR_JWKS_NO_MATCHING_KEY"}},xe=class extends ce{constructor(){super(...arguments),this.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS",this.message="multiple matching keys found in the JSON Web Key Set"}static get code(){return"ERR_JWKS_MULTIPLE_MATCHING_KEYS"}},ke=class extends ce{constructor(){super(...arguments),this.code="ERR_JWKS_TIMEOUT",this.message="request timed out"}static get code(){return"ERR_JWKS_TIMEOUT"}},Ee=class extends ce{constructor(){super(...arguments),this.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED",this.message="signature verification failed"}static get code(){return"ERR_JWS_SIGNATURE_VERIFICATION_FAILED"}}}}),Re=Bt({"../node_modules/jose/dist/browser/runtime/random.js"(){Zt(),_e=xt.getRandomValues.bind(xt)}});function Ie(t){switch(t){case"A128GCM":case"A128GCMKW":case"A192GCM":case"A192GCMKW":case"A256GCM":case"A256GCMKW":return 96;case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return 128;default:throw new fe(`Unsupported JWE Algorithm: ${t}`)}}var Te,Oe,Ne,Pe=Bt({"../node_modules/jose/dist/browser/lib/iv.js"(){Ce(),Re(),je=t=>_e(new Uint8Array(Ie(t)>>3))}}),De=Bt({"../node_modules/jose/dist/browser/lib/check_iv_length.js"(){Ce(),Pe(),Te=(t,e)=>{if(e.length<<3!==Ie(t))throw new ve("Invalid Initialization Vector length")}}}),Me=Bt({"../node_modules/jose/dist/browser/runtime/check_cek_length.js"(){Ce(),Oe=(t,e)=>{if(t.length<<3!==e)throw new ve("Invalid Content Encryption Key length")}}}),Ue=Bt({"../node_modules/jose/dist/browser/runtime/timing_safe_equal.js"(){Ne=(t,e)=>{if(!(t instanceof Uint8Array))throw new TypeError("First argument must be a buffer");if(!(e instanceof Uint8Array))throw new TypeError("Second argument must be a buffer");if(t.length!==e.length)throw new TypeError("Input buffers must have the same length");const n=t.length;let i=0,r=-1;for(;++r<n;)i|=t[r]^e[r];return 0===i}}});function Le(){return"function"==typeof WebSocketPair}var Be=Bt({"../node_modules/jose/dist/browser/runtime/env.js"(){}});function Je(t,e="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${e} must be ${t}`)}function $e(t,e){return t.name===e}function He(t){return parseInt(t.name.slice(4),10)}function Ke(t,e){if(e.length&&!e.some((e=>t.usages.includes(e)))){let t="CryptoKey does not support this operation, its usages must include ";if(e.length>2){const n=e.pop();t+=`one of ${e.join(", ")}, or ${n}.`}else t+=2===e.length?`one of ${e[0]} or ${e[1]}.`:`${e[0]}.`;throw new TypeError(t)}}function ze(t,e,...n){switch(e){case"A128GCM":case"A192GCM":case"A256GCM":{if(!$e(t.algorithm,"AES-GCM"))throw Je("AES-GCM");const n=parseInt(e.slice(1,4),10);if(t.algorithm.length!==n)throw Je(n,"algorithm.length");break}case"A128KW":case"A192KW":case"A256KW":{if(!$e(t.algorithm,"AES-KW"))throw Je("AES-KW");const n=parseInt(e.slice(1,4),10);if(t.algorithm.length!==n)throw Je(n,"algorithm.length");break}case"ECDH":if(!$e(t.algorithm,"ECDH"))throw Je("ECDH");break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":if(!$e(t.algorithm,"PBKDF2"))throw Je("PBKDF2");break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":{if(!$e(t.algorithm,"RSA-OAEP"))throw Je("RSA-OAEP");const n=parseInt(e.slice(9),10)||1;if(He(t.algorithm.hash)!==n)throw Je(`SHA-${n}`,"algorithm.hash");break}default:throw new TypeError("CryptoKey does not support this operation")}Ke(t,n)}var We,qe,Ve,Ge,Xe,Ye,Ze,Qe=Bt({"../node_modules/jose/dist/browser/lib/crypto_key.js"(){Be()}}),tn=Bt({"../node_modules/jose/dist/browser/lib/invalid_key_input.js"(){We=(t,...e)=>{let n="Key must be ";if(e.length>2){const t=e.pop();n+=`one of type ${e.join(", ")}, or ${t}.`}else n+=2===e.length?`one of type ${e[0]} or ${e[1]}.`:`of type ${e[0]}.`;return null==t?n+=` Received ${t}`:"function"==typeof t&&t.name?n+=` Received function ${t.name}`:"object"==typeof t&&null!=t&&t.constructor&&t.constructor.name&&(n+=` Received an instance of ${t.constructor.name}`),n}}}),en=Bt({"../node_modules/jose/dist/browser/runtime/is_key_like.js"(){Zt(),qe=t=>kt(t),Ve=["CryptoKey"]}}),nn=Bt({"../node_modules/jose/dist/browser/runtime/decrypt.js"(){Se(),De(),Me(),Ue(),Ce(),Zt(),Qe(),tn(),en(),Ge=async(t,e,n,i,r,o)=>{if(!(kt(e)||e instanceof Uint8Array))throw new TypeError(We(e,...Ve,"Uint8Array"));switch(Te(t,i),t){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return e instanceof Uint8Array&&Oe(e,parseInt(t.slice(-3),10)),async function(t,e,n,i,r,o){if(!(e instanceof Uint8Array))throw new TypeError(We(e,"Uint8Array"));const s=parseInt(t.slice(1,4),10),a=await xt.subtle.importKey("raw",e.subarray(s>>3),"AES-CBC",!1,["decrypt"]),u=await xt.subtle.importKey("raw",e.subarray(0,s>>3),{hash:"SHA-"+(s<<1),name:"HMAC"},!1,["sign"]),c=te(o,i,n,ne(o.length<<3)),l=new Uint8Array((await xt.subtle.sign("HMAC",u,c)).slice(0,s>>3));let h,d;try{h=Ne(r,l)}catch(t){}if(!h)throw new pe;try{d=new Uint8Array(await xt.subtle.decrypt({iv:i,name:"AES-CBC"},a,n))}catch(t){}if(!d)throw new pe;return d}(t,e,n,i,r,o);case"A128GCM":case"A192GCM":case"A256GCM":return e instanceof Uint8Array&&Oe(e,parseInt(t.slice(1,4),10)),async function(t,e,n,i,r,o){let s;e instanceof Uint8Array?s=await xt.subtle.importKey("raw",e,"AES-GCM",!1,["decrypt"]):(ze(e,t,"decrypt"),s=e);try{return new Uint8Array(await xt.subtle.decrypt({additionalData:o,iv:i,name:"AES-GCM",tagLength:128},s,te(n,r)))}catch(t){throw new pe}}(t,e,n,i,r,o);default:throw new fe("Unsupported JWE Content Encryption Algorithm")}}}}),rn=Bt({"../node_modules/jose/dist/browser/runtime/zlib.js"(){Ce(),Xe=async()=>{throw new fe('JWE "zip" (Compression Algorithm) Header Parameter is not supported by your javascript runtime. You need to use the `inflateRaw` decrypt option to provide Inflate Raw implementation.')},Ye=async()=>{throw new fe('JWE "zip" (Compression Algorithm) Header Parameter is not supported by your javascript runtime. You need to use the `deflateRaw` encrypt option to provide Deflate Raw implementation.')}}}),on=Bt({"../node_modules/jose/dist/browser/lib/is_disjoint.js"(){Ze=(...t)=>{const e=t.filter(Boolean);if(0===e.length||1===e.length)return!0;let n;for(const t of e){const e=Object.keys(t);if(n&&0!==n.size)for(const t of e){if(n.has(t))return!1;n.add(t)}else n=new Set(e)}return!0}}});function sn(t){if("object"!=typeof(e=t)||null===e||"[object Object]"!==Object.prototype.toString.call(t))return!1;var e;if(null===Object.getPrototypeOf(t))return!0;let n=t;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(t)===n}var an,un,cn,ln=Bt({"../node_modules/jose/dist/browser/lib/is_object.js"(){}}),hn=Bt({"../node_modules/jose/dist/browser/runtime/bogus.js"(){an=[{hash:"SHA-256",name:"HMAC"},!0,["sign"]]}});function dn(t,e){if(t.algorithm.length!==parseInt(e.slice(1,4),10))throw new TypeError(`Invalid key size for alg: ${e}`)}function fn(t,e,n){if(kt(t))return ze(t,e,n),t;if(t instanceof Uint8Array)return xt.subtle.importKey("raw",t,"AES-KW",!0,[n]);throw new TypeError(We(t,...Ve,"Uint8Array"))}var pn=Bt({"../node_modules/jose/dist/browser/runtime/aeskw.js"(){hn(),Zt(),Qe(),tn(),en(),un=async(t,e,n)=>{const i=await fn(e,t,"wrapKey");dn(i,t);const r=await xt.subtle.importKey("raw",n,...an);return new Uint8Array(await xt.subtle.wrapKey("raw",r,i,"AES-KW"))},cn=async(t,e,n)=>{const i=await fn(e,t,"unwrapKey");dn(i,t);const r=await xt.subtle.unwrapKey("raw",n,i,"AES-KW",...an);return new Uint8Array(await xt.subtle.exportKey("raw",r))}}});async function vn(t,e,n,i,r=new Uint8Array(0),o=new Uint8Array(0)){if(!kt(t))throw new TypeError(We(t,...Ve));if(ze(t,"ECDH"),!kt(e))throw new TypeError(We(e,...Ve));ze(e,"ECDH","deriveBits");const s=te(re(St.encode(n)),re(r),re(o),ie(i));return async function(t,e,n){const i=Math.ceil((e>>3)/32),r=new Uint8Array(32*i);for(let e=0;e<i;e++){const i=new Uint8Array(4+t.length+n.length);i.set(ie(e+1)),i.set(t,4),i.set(n,4+t.length),r.set(await Et("sha256",i),32*e)}return r.slice(0,e>>3)}(new Uint8Array(await xt.subtle.deriveBits({name:"ECDH",public:t},e,Math.ceil(parseInt(e.algorithm.namedCurve.slice(-3),10)/8)<<3)),i,s)}function gn(t){if(!kt(t))throw new TypeError(We(t,...Ve));return["P-256","P-384","P-521"].includes(t.algorithm.namedCurve)}var mn,wn,bn=Bt({"../node_modules/jose/dist/browser/runtime/ecdhes.js"(){Se(),Zt(),Qe(),tn(),en()}}),yn=Bt({"../node_modules/jose/dist/browser/lib/check_p2s.js"(){Ce()}});async function xn(t,e,n,i){!function(t){if(!(t instanceof Uint8Array)||t.length<8)throw new ve("PBES2 Salt Input must be 8 or more octets")}(t);const r=function(t,e){return te(St.encode(t),new Uint8Array([0]),e)}(e,t),o=parseInt(e.slice(13,16),10),s={hash:`SHA-${e.slice(8,11)}`,iterations:n,name:"PBKDF2",salt:r},a={length:o,name:"AES-KW"},u=await function(t,e){if(t instanceof Uint8Array)return xt.subtle.importKey("raw",t,"PBKDF2",!1,["deriveBits"]);if(kt(t))return ze(t,e,"deriveBits","deriveKey"),t;throw new TypeError(We(t,...Ve,"Uint8Array"))}(i,e);if(u.usages.includes("deriveBits"))return new Uint8Array(await xt.subtle.deriveBits(s,u,o));if(u.usages.includes("deriveKey"))return xt.subtle.deriveKey(s,u,a,!1,["wrapKey","unwrapKey"]);throw new TypeError('PBKDF2 key "usages" must include "deriveBits" or "deriveKey"')}var kn=Bt({"../node_modules/jose/dist/browser/runtime/pbes2kw.js"(){Re(),Se(),Fe(),pn(),yn(),Zt(),Qe(),tn(),en(),mn=async(t,e,n,i=2048,r=_e(new Uint8Array(16)))=>{const o=await xn(r,t,i,e);return{encryptedKey:await un(t.slice(-6),o,n),p2c:i,p2s:se(r)}},wn=async(t,e,n,i,r)=>{const o=await xn(r,t,i,e);return cn(t.slice(-6),o,n)}}});function En(t){switch(t){case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":return"RSA-OAEP";default:throw new fe(`alg ${t} is not supported either by JOSE or your javascript runtime`)}}var Sn,Fn,An,_n,jn=Bt({"../node_modules/jose/dist/browser/runtime/subtle_rsaes.js"(){Ce()}}),Cn=Bt({"../node_modules/jose/dist/browser/runtime/check_key_length.js"(){Sn=(t,e)=>{if(t.startsWith("RS")||t.startsWith("PS")){const{modulusLength:n}=e.algorithm;if("number"!=typeof n||n<2048)throw new TypeError(`${t} requires key modulusLength to be 2048 bits or larger`)}}}}),Rn=Bt({"../node_modules/jose/dist/browser/runtime/rsaes.js"(){jn(),hn(),Zt(),Qe(),Cn(),tn(),en(),Fn=async(t,e,n)=>{if(!kt(e))throw new TypeError(We(e,...Ve));if(ze(e,t,"encrypt","wrapKey"),Sn(t,e),e.usages.includes("encrypt"))return new Uint8Array(await xt.subtle.encrypt(En(t),e,n));if(e.usages.includes("wrapKey")){const i=await xt.subtle.importKey("raw",n,...an);return new Uint8Array(await xt.subtle.wrapKey("raw",i,e,En(t)))}throw new TypeError('RSA-OAEP key "usages" must include "encrypt" or "wrapKey" for this operation')},An=async(t,e,n)=>{if(!kt(e))throw new TypeError(We(e,...Ve));if(ze(e,t,"decrypt","unwrapKey"),Sn(t,e),e.usages.includes("decrypt"))return new Uint8Array(await xt.subtle.decrypt(En(t),e,n));if(e.usages.includes("unwrapKey")){const i=await xt.subtle.unwrapKey("raw",n,e,En(t),...an);return new Uint8Array(await xt.subtle.exportKey("raw",i))}throw new TypeError('RSA-OAEP key "usages" must include "decrypt" or "unwrapKey" for this operation')}}});function In(t){switch(t){case"A128GCM":return 128;case"A192GCM":return 192;case"A256GCM":case"A128CBC-HS256":return 256;case"A192CBC-HS384":return 384;case"A256CBC-HS512":return 512;default:throw new fe(`Unsupported JWE Algorithm: ${t}`)}}var Tn,On,Nn,Pn,Dn,Mn,Un,Ln,Bn,Jn,$n=Bt({"../node_modules/jose/dist/browser/lib/cek.js"(){Ce(),Re(),_n=t=>_e(new Uint8Array(In(t)>>3))}}),Hn=Bt({"../node_modules/jose/dist/browser/lib/format_pem.js"(){Tn=(t,e)=>`-----BEGIN ${e}-----\n${(t.match(/.{1,64}/g)||[]).join("\n")}\n-----END ${e}-----`}}),Kn=Bt({"../node_modules/jose/dist/browser/runtime/asn1.js"(){Be(),Zt(),tn(),Fe(),Hn(),Ce(),en(),On=async(t,e,n)=>{if(!kt(n))throw new TypeError(We(n,...Ve));if(!n.extractable)throw new TypeError("CryptoKey is not extractable");if(n.type!==t)throw new TypeError(`key is not a ${t} key`);return Tn(oe(new Uint8Array(await xt.subtle.exportKey(e,n))),`${t.toUpperCase()} KEY`)},Nn=t=>On("public","spki",t),Pn=t=>On("private","pkcs8",t),Dn=(t,e,n=0)=>{0===n&&(e.unshift(e.length),e.unshift(6));let i=t.indexOf(e[0],n);if(-1===i)return!1;const r=t.subarray(i,i+e.length);return r.length===e.length&&(r.every(((t,n)=>t===e[n]))||Dn(t,e,i+1))},Mn=t=>{switch(!0){case Dn(t,[42,134,72,206,61,3,1,7]):return"P-256";case Dn(t,[43,129,4,0,34]):return"P-384";case Dn(t,[43,129,4,0,35]):return"P-521";case Le()&&Dn(t,[43,101,112]):return"Ed25519";default:throw new fe("Invalid or unsupported EC Key Curve or OKP Key Sub Type")}},Un=async(t,e,n,i,r)=>{var o;let s,a;const u=new Uint8Array(atob(n.replace(t,"")).split("").map((t=>t.charCodeAt(0)))),c="spki"===e;switch(i){case"PS256":case"PS384":case"PS512":s={name:"RSA-PSS",hash:`SHA-${i.slice(-3)}`},a=c?["verify"]:["sign"];break;case"RS256":case"RS384":case"RS512":s={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${i.slice(-3)}`},a=c?["verify"]:["sign"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":s={name:"RSA-OAEP",hash:`SHA-${parseInt(i.slice(-3),10)||1}`},a=c?["encrypt","wrapKey"]:["decrypt","unwrapKey"];break;case"ES256":s={name:"ECDSA",namedCurve:"P-256"},a=c?["verify"]:["sign"];break;case"ES384":s={name:"ECDSA",namedCurve:"P-384"},a=c?["verify"]:["sign"];break;case"ES512":s={name:"ECDSA",namedCurve:"P-521"},a=c?["verify"]:["sign"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":s={name:"ECDH",namedCurve:Mn(u)},a=c?[]:["deriveBits"];break;case Le()&&"EdDSA":const t=Mn(u).toUpperCase();s={name:`NODE-${t}`,namedCurve:`NODE-${t}`},a=c?["verify"]:["sign"];break;default:throw new fe('Invalid or unsupported "alg" (Algorithm) value')}return xt.subtle.importKey(e,u,s,null!==(o=null==r?void 0:r.extractable)&&void 0!==o&&o,a)},Ln=(t,e,n)=>Un(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,"pkcs8",t,e,n),Bn=(t,e,n)=>Un(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g,"spki",t,e,n)}}),zn=Bt({"../node_modules/jose/dist/browser/runtime/jwk_to_key.js"(){Be(),Zt(),Ce(),Fe(),Jn=async t=>{var e,n;const{algorithm:i,keyUsages:r}=function(t){let e,n;switch(t.kty){case"oct":switch(t.alg){case"HS256":case"HS384":case"HS512":e={name:"HMAC",hash:`SHA-${t.alg.slice(-3)}`},n=["sign","verify"];break;case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":throw new fe(`${t.alg} keys cannot be imported as CryptoKey instances`);case"A128GCM":case"A192GCM":case"A256GCM":case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":e={name:"AES-GCM"},n=["encrypt","decrypt"];break;case"A128KW":case"A192KW":case"A256KW":e={name:"AES-KW"},n=["wrapKey","unwrapKey"];break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":e={name:"PBKDF2"},n=["deriveBits"];break;default:throw new fe('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"RSA":switch(t.alg){case"PS256":case"PS384":case"PS512":e={name:"RSA-PSS",hash:`SHA-${t.alg.slice(-3)}`},n=t.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":e={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${t.alg.slice(-3)}`},n=t.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":e={name:"RSA-OAEP",hash:`SHA-${parseInt(t.alg.slice(-3),10)||1}`},n=t.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new fe('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case"EC":switch(t.alg){case"ES256":e={name:"ECDSA",namedCurve:"P-256"},n=t.d?["sign"]:["verify"];break;case"ES384":e={name:"ECDSA",namedCurve:"P-384"},n=t.d?["sign"]:["verify"];break;case"ES512":e={name:"ECDSA",namedCurve:"P-521"},n=t.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":e={name:"ECDH",namedCurve:t.crv},n=t.d?["deriveBits"]:[];break;default:throw new fe('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break;case Le()&&"OKP":if("EdDSA"!==t.alg)throw new fe('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');switch(t.crv){case"Ed25519":e={name:"NODE-ED25519",namedCurve:"NODE-ED25519"},n=t.d?["sign"]:["verify"];break;default:throw new fe('Invalid or unsupported JWK "crv" (Subtype of Key Pair) Parameter value')}break;default:throw new fe('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:e,keyUsages:n}}(t),o=[i,null!==(e=t.ext)&&void 0!==e&&e,null!==(n=t.key_ops)&&void 0!==n?n:r];if("PBKDF2"===i.name)return xt.subtle.importKey("raw",ue(t.k),...o);const s={...t};return delete s.alg,xt.subtle.importKey("jwk",s,...o)}}});function Wn(t){let e=[],n=0;for(;n<t.length;){let i=qn(t.subarray(n));e.push(i),n+=i.byteLength}return e}function qn(t){let e=0,n=31&t[0];if(e++,31===n){for(n=0;t[e]>=128;)n=128*n+t[e]-128,e++;n=128*n+t[e]-128,e++}let i=0;if(t[e]<128)i=t[e],e++;else{let n=127&t[e];e++,i=0;for(let r=0;r<n;r++)i=256*i+t[e],e++}if(128===i){for(i=0;0!==t[e+i]||0!==t[e+i+1];)i++;const n=e+i+2;return{byteLength:n,contents:t.subarray(e,e+i),raw:t.subarray(0,n)}}const r=e+i;return{byteLength:r,contents:t.subarray(e,r),raw:t.subarray(0,r)}}async function Vn(t,e,n){if("string"!=typeof t||0!==t.indexOf("-----BEGIN PUBLIC KEY-----"))throw new TypeError('"spki" must be SPKI formatted string');return Bn(t,e,n)}async function Gn(t,e,n){if("string"!=typeof t||0!==t.indexOf("-----BEGIN CERTIFICATE-----"))throw new TypeError('"x509" must be X.509 formatted string');const i=function(t){const e=t.replace(/(?:-----(?:BEGIN|END) CERTIFICATE-----|\s)/g,""),n=ae(e);return Tn(function(t){const e=Wn(Wn(qn(t).contents)[0].contents);return oe(e[160===e[0].raw[0]?6:5].raw)}(n),"PUBLIC KEY")}(t);return Bn(i,e,n)}async function Xn(t,e,n){if("string"!=typeof t||0!==t.indexOf("-----BEGIN PRIVATE KEY-----"))throw new TypeError('"pkcs8" must be PCKS8 formatted string');return Ln(t,e,n)}async function Yn(t,e,n){if(!sn(t))throw new TypeError("JWK must be an object");if(e||(e=t.alg),"string"!=typeof e||!e)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');switch(t.kty){case"oct":if("string"!=typeof t.k||!t.k)throw new TypeError('missing "k" (Key Value) Parameter value');return null!=n||(n=!0!==t.ext),n?Jn({...t,alg:e,ext:!1}):ue(t.k);case"RSA":if(void 0!==t.oth)throw new fe('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');case"EC":case"OKP":return Jn({...t,alg:e});default:throw new fe('Unsupported "kty" (Key Type) Parameter value')}}var Zn,Qn,ti,ei,ni,ii=Bt({"../node_modules/jose/dist/browser/key/import.js"(){Fe(),Kn(),Kn(),zn(),Ce(),Hn(),ln()}}),ri=Bt({"../node_modules/jose/dist/browser/lib/check_key_type.js"(){tn(),en(),Zn=t=>{if(!(t instanceof Uint8Array)){if(!qe(t))throw new TypeError(We(t,...Ve,"Uint8Array"));if("secret"!==t.type)throw new TypeError(`${Ve.join(" or ")} instances for symmetric algorithms must be of type "secret"`)}},Qn=(t,e)=>{if(!qe(t))throw new TypeError(We(t,...Ve));if("secret"===t.type)throw new TypeError(`${Ve.join(" or ")} instances for asymmetric algorithms must not be of type "secret"`);if("sign"===e&&"public"===t.type)throw new TypeError(`${Ve.join(" or ")} instances for asymmetric algorithm signing must be of type "private"`);if("decrypt"===e&&"public"===t.type)throw new TypeError(`${Ve.join(" or ")} instances for asymmetric algorithm decryption must be of type "private"`);if(t.algorithm&&"verify"===e&&"private"===t.type)throw new TypeError(`${Ve.join(" or ")} instances for asymmetric algorithm verifying must be of type "public"`);if(t.algorithm&&"encrypt"===e&&"private"===t.type)throw new TypeError(`${Ve.join(" or ")} instances for asymmetric algorithm encryption must be of type "public"`)},ti=(t,e,n)=>{t.startsWith("HS")||"dir"===t||t.startsWith("PBES2")||/^A\d{3}(?:GCM)?KW$/.test(t)?Zn(e):Qn(e,n)}}}),oi=Bt({"../node_modules/jose/dist/browser/runtime/encrypt.js"(){Se(),De(),Me(),Zt(),Qe(),tn(),Ce(),en(),ei=async(t,e,n,i,r)=>{if(!(kt(n)||n instanceof Uint8Array))throw new TypeError(We(n,...Ve,"Uint8Array"));switch(Te(t,i),t){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return n instanceof Uint8Array&&Oe(n,parseInt(t.slice(-3),10)),async function(t,e,n,i,r){if(!(n instanceof Uint8Array))throw new TypeError(We(n,"Uint8Array"));const o=parseInt(t.slice(1,4),10),s=await xt.subtle.importKey("raw",n.subarray(o>>3),"AES-CBC",!1,["encrypt"]),a=await xt.subtle.importKey("raw",n.subarray(0,o>>3),{hash:"SHA-"+(o<<1),name:"HMAC"},!1,["sign"]),u=new Uint8Array(await xt.subtle.encrypt({iv:i,name:"AES-CBC"},s,e)),c=te(r,i,u,ne(r.length<<3));return{ciphertext:u,tag:new Uint8Array((await xt.subtle.sign("HMAC",a,c)).slice(0,o>>3))}}(t,e,n,i,r);case"A128GCM":case"A192GCM":case"A256GCM":return n instanceof Uint8Array&&Oe(n,parseInt(t.slice(1,4),10)),async function(t,e,n,i,r){let o;n instanceof Uint8Array?o=await xt.subtle.importKey("raw",n,"AES-GCM",!1,["encrypt"]):(ze(n,t,"encrypt"),o=n);const s=new Uint8Array(await xt.subtle.encrypt({additionalData:r,iv:i,name:"AES-GCM",tagLength:128},o,e)),a=s.slice(-16);return{ciphertext:s.slice(0,-16),tag:a}}(t,e,n,i,r);default:throw new fe("Unsupported JWE Content Encryption Algorithm")}}}}),si=Bt({"../node_modules/jose/dist/browser/lib/aesgcmkw.js"(){oi(),nn(),Pe(),Fe()}});async function ai(t,e,n,i){switch(ti(t,e,"decrypt"),t){case"dir":if(void 0!==n)throw new ve("Encountered unexpected JWE Encrypted Key");return e;case"ECDH-ES":if(void 0!==n)throw new ve("Encountered unexpected JWE Encrypted Key");case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{if(!sn(i.epk))throw new ve('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');if(!gn(e))throw new fe("ECDH with the provided key is not allowed or not supported by your javascript runtime");const r=await Yn(i.epk,t);let o,s;if(void 0!==i.apu){if("string"!=typeof i.apu)throw new ve('JOSE Header "apu" (Agreement PartyUInfo) invalid');o=ue(i.apu)}if(void 0!==i.apv){if("string"!=typeof i.apv)throw new ve('JOSE Header "apv" (Agreement PartyVInfo) invalid');s=ue(i.apv)}const a=await vn(r,e,"ECDH-ES"===t?i.enc:t,"ECDH-ES"===t?In(i.enc):parseInt(t.slice(-5,-2),10),o,s);if("ECDH-ES"===t)return a;if(void 0===n)throw new ve("JWE Encrypted Key missing");return cn(t.slice(-6),a,n)}case"RSA1_5":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":if(void 0===n)throw new ve("JWE Encrypted Key missing");return An(t,e,n);case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":if(void 0===n)throw new ve("JWE Encrypted Key missing");if("number"!=typeof i.p2c)throw new ve('JOSE Header "p2c" (PBES2 Count) missing or invalid');if("string"!=typeof i.p2s)throw new ve('JOSE Header "p2s" (PBES2 Salt) missing or invalid');return wn(t,e,n,i.p2c,ue(i.p2s));case"A128KW":case"A192KW":case"A256KW":if(void 0===n)throw new ve("JWE Encrypted Key missing");return cn(t,e,n);case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":if(void 0===n)throw new ve("JWE Encrypted Key missing");if("string"!=typeof i.iv)throw new ve('JOSE Header "iv" (Initialization Vector) missing or invalid');if("string"!=typeof i.tag)throw new ve('JOSE Header "tag" (Authentication Tag) missing or invalid');return async function(t,e,n,i,r){const o=t.slice(0,7);return Ge(o,e,n,i,r,new Uint8Array(0))}(t,e,n,ue(i.iv),ue(i.tag));default:throw new fe('Invalid or unsupported "alg" (JWE Algorithm) header value')}}var ui,ci=Bt({"../node_modules/jose/dist/browser/lib/decrypt_key_management.js"(){pn(),bn(),kn(),Rn(),Fe(),Ce(),$n(),ii(),ri(),ln(),si(),ni=ai}});function li(t,e,n,i,r){if(void 0!==r.crit&&void 0===i.crit)throw new t('"crit" (Critical) Header Parameter MUST be integrity protected');if(!i||void 0===i.crit)return new Set;if(!Array.isArray(i.crit)||0===i.crit.length||i.crit.some((t=>"string"!=typeof t||0===t.length)))throw new t('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let o;o=void 0!==n?new Map([...Object.entries(n),...e.entries()]):e;for(const e of i.crit){if(!o.has(e))throw new fe(`Extension Header Parameter "${e}" is not recognized`);if(void 0===r[e])throw new t(`Extension Header Parameter "${e}" is missing`);if(o.get(e)&&void 0===i[e])throw new t(`Extension Header Parameter "${e}" MUST be integrity protected`)}return new Set(i.crit)}var hi,di=Bt({"../node_modules/jose/dist/browser/lib/validate_crit.js"(){Ce(),ui=li}}),fi=Bt({"../node_modules/jose/dist/browser/lib/validate_algorithms.js"(){hi=(t,e)=>{if(void 0!==e&&(!Array.isArray(e)||e.some((t=>"string"!=typeof t))))throw new TypeError(`"${t}" option must be an array of strings`);if(e)return new Set(e)}}});async function pi(t,e,n){var i;if(!sn(t))throw new ve("Flattened JWE must be an object");if(void 0===t.protected&&void 0===t.header&&void 0===t.unprotected)throw new ve("JOSE Header missing");if("string"!=typeof t.iv)throw new ve("JWE Initialization Vector missing or incorrect type");if("string"!=typeof t.ciphertext)throw new ve("JWE Ciphertext missing or incorrect type");if("string"!=typeof t.tag)throw new ve("JWE Authentication Tag missing or incorrect type");if(void 0!==t.protected&&"string"!=typeof t.protected)throw new ve("JWE Protected Header incorrect type");if(void 0!==t.encrypted_key&&"string"!=typeof t.encrypted_key)throw new ve("JWE Encrypted Key incorrect type");if(void 0!==t.aad&&"string"!=typeof t.aad)throw new ve("JWE AAD incorrect type");if(void 0!==t.header&&!sn(t.header))throw new ve("JWE Shared Unprotected Header incorrect type");if(void 0!==t.unprotected&&!sn(t.unprotected))throw new ve("JWE Per-Recipient Unprotected Header incorrect type");let r;if(t.protected)try{const e=ue(t.protected);r=JSON.parse(Ft.decode(e))}catch(t){throw new ve("JWE Protected Header is invalid")}if(!Ze(r,t.header,t.unprotected))throw new ve("JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint");const o={...r,...t.header,...t.unprotected};if(ui(ve,new Map,null==n?void 0:n.crit,r,o),void 0!==o.zip){if(!r||!r.zip)throw new ve('JWE "zip" (Compression Algorithm) Header MUST be integrity protected');if("DEF"!==o.zip)throw new fe('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value')}const{alg:s,enc:a}=o;if("string"!=typeof s||!s)throw new ve("missing JWE Algorithm (alg) in JWE Header");if("string"!=typeof a||!a)throw new ve("missing JWE Encryption Algorithm (enc) in JWE Header");const u=n&&hi("keyManagementAlgorithms",n.keyManagementAlgorithms),c=n&&hi("contentEncryptionAlgorithms",n.contentEncryptionAlgorithms);if(u&&!u.has(s))throw new de('"alg" (Algorithm) Header Parameter not allowed');if(c&&!c.has(a))throw new de('"enc" (Encryption Algorithm) Header Parameter not allowed');let l;void 0!==t.encrypted_key&&(l=ue(t.encrypted_key));let h,d=!1;"function"==typeof e&&(e=await e(r,t),d=!0);try{h=await ni(s,e,l,o)}catch(t){if(t instanceof TypeError)throw t;h=_n(a)}const f=ue(t.iv),p=ue(t.tag),v=St.encode(null!==(i=t.protected)&&void 0!==i?i:"");let g;g=void 0!==t.aad?te(v,St.encode("."),St.encode(t.aad)):v;let m=await Ge(a,h,ue(t.ciphertext),f,p,g);"DEF"===o.zip&&(m=await((null==n?void 0:n.inflateRaw)||Xe)(m));const w={plaintext:m};return void 0!==t.protected&&(w.protectedHeader=r),void 0!==t.aad&&(w.additionalAuthenticatedData=ue(t.aad)),void 0!==t.unprotected&&(w.sharedUnprotectedHeader=t.unprotected),void 0!==t.header&&(w.unprotectedHeader=t.header),d?{...w,key:e}:w}var vi=Bt({"../node_modules/jose/dist/browser/jwe/flattened/decrypt.js"(){Fe(),nn(),rn(),Ce(),on(),ln(),ci(),Se(),$n(),di(),fi()}});async function gi(t,e,n){if(t instanceof Uint8Array&&(t=Ft.decode(t)),"string"!=typeof t)throw new ve("Compact JWE must be a string or Uint8Array");const{0:i,1:r,2:o,3:s,4:a,length:u}=t.split(".");if(5!==u)throw new ve("Invalid Compact JWE");const c=await pi({ciphertext:s,iv:o||void 0,protected:i||void 0,tag:a||void 0,encrypted_key:r||void 0},e,n),l={plaintext:c.plaintext,protectedHeader:c.protectedHeader};return"function"==typeof e?{...l,key:c.key}:l}var mi=Bt({"../node_modules/jose/dist/browser/jwe/compact/decrypt.js"(){vi(),Ce(),Se()}});async function wi(t,e,n){if(!sn(t))throw new ve("General JWE must be an object");if(!Array.isArray(t.recipients)||!t.recipients.every(sn))throw new ve("JWE Recipients missing or incorrect type");if(!t.recipients.length)throw new ve("JWE Recipients has no members");for(const i of t.recipients)try{return await pi({aad:t.aad,ciphertext:t.ciphertext,encrypted_key:i.encrypted_key,header:i.header,iv:t.iv,protected:t.protected,tag:t.tag,unprotected:t.unprotected},e,n)}catch(t){}throw new pe}var bi,yi=Bt({"../node_modules/jose/dist/browser/jwe/general/decrypt.js"(){vi(),Ce(),ln()}}),xi=Bt({"../node_modules/jose/dist/browser/runtime/key_to_jwk.js"(){Zt(),tn(),Fe(),en(),bi=async t=>{if(t instanceof Uint8Array)return{kty:"oct",k:se(t)};if(!kt(t))throw new TypeError(We(t,...Ve,"Uint8Array"));if(!t.extractable)throw new TypeError("non-extractable CryptoKey cannot be exported as a JWK");const{ext:e,key_ops:n,alg:i,use:r,...o}=await xt.subtle.exportKey("jwk",t);return o}}});async function ki(t){return Nn(t)}async function Ei(t){return Pn(t)}async function Si(t){return bi(t)}var Fi,Ai=Bt({"../node_modules/jose/dist/browser/key/export.js"(){Kn(),Kn(),xi()}});async function _i(t,e,n,i,r={}){let o,s,a;switch(ti(t,n,"encrypt"),t){case"dir":a=n;break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{if(!gn(n))throw new fe("ECDH with the provided key is not allowed or not supported by your javascript runtime");const{apu:u,apv:c}=r;let{epk:l}=r;l||(l=(await async function(t){if(!kt(t))throw new TypeError(We(t,...Ve));return xt.subtle.generateKey(t.algorithm,!0,["deriveBits"])}(n)).privateKey);const{x:h,y:d,crv:f,kty:p}=await Si(l),v=await vn(n,l,"ECDH-ES"===t?e:t,"ECDH-ES"===t?In(e):parseInt(t.slice(-5,-2),10),u,c);if(s={epk:{x:h,crv:f,kty:p}},"EC"===p&&(s.epk.y=d),u&&(s.apu=se(u)),c&&(s.apv=se(c)),"ECDH-ES"===t){a=v;break}a=i||_n(e);const g=t.slice(-6);o=await un(g,v,a);break}case"RSA1_5":case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":a=i||_n(e),o=await Fn(t,n,a);break;case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{a=i||_n(e);const{p2c:u,p2s:c}=r;({encryptedKey:o,...s}=await mn(t,n,a,u,c));break}case"A128KW":case"A192KW":case"A256KW":a=i||_n(e),o=await un(t,n,a);break;case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{a=i||_n(e);const{iv:u}=r;({encryptedKey:o,...s}=await async function(t,e,n,i){const r=t.slice(0,7);i||(i=je(r));const{ciphertext:o,tag:s}=await ei(r,n,e,i,new Uint8Array(0));return{encryptedKey:o,iv:se(i),tag:se(s)}}(t,n,a,u));break}default:throw new fe('Invalid or unsupported "alg" (JWE Algorithm) header value')}return{cek:a,encryptedKey:o,parameters:s}}var ji,Ci,Ri,Ii,Ti=Bt({"../node_modules/jose/dist/browser/lib/encrypt_key_management.js"(){pn(),bn(),kn(),Rn(),Fe(),$n(),Ce(),Ai(),ri(),si(),Fi=_i}}),Oi=Bt({"../node_modules/jose/dist/browser/jwe/flattened/encrypt.js"(){Fe(),oi(),rn(),Pe(),Ti(),Ce(),on(),Se(),di(),ji=Symbol(),Ci=class{constructor(t){if(!(t instanceof Uint8Array))throw new TypeError("plaintext must be an instance of Uint8Array");this._plaintext=t}setKeyManagementParameters(t){if(this._keyManagementParameters)throw new TypeError("setKeyManagementParameters can only be called once");return this._keyManagementParameters=t,this}setProtectedHeader(t){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=t,this}setSharedUnprotectedHeader(t){if(this._sharedUnprotectedHeader)throw new TypeError("setSharedUnprotectedHeader can only be called once");return this._sharedUnprotectedHeader=t,this}setUnprotectedHeader(t){if(this._unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=t,this}setAdditionalAuthenticatedData(t){return this._aad=t,this}setContentEncryptionKey(t){if(this._cek)throw new TypeError("setContentEncryptionKey can only be called once");return this._cek=t,this}setInitializationVector(t){if(this._iv)throw new TypeError("setInitializationVector can only be called once");return this._iv=t,this}async encrypt(t,e){if(!this._protectedHeader&&!this._unprotectedHeader&&!this._sharedUnprotectedHeader)throw new ve("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");if(!Ze(this._protectedHeader,this._unprotectedHeader,this._sharedUnprotectedHeader))throw new ve("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");const n={...this._protectedHeader,...this._unprotectedHeader,...this._sharedUnprotectedHeader};if(ui(ve,new Map,null==e?void 0:e.crit,this._protectedHeader,n),void 0!==n.zip){if(!this._protectedHeader||!this._protectedHeader.zip)throw new ve('JWE "zip" (Compression Algorithm) Header MUST be integrity protected');if("DEF"!==n.zip)throw new fe('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value')}const{alg:i,enc:r}=n;if("string"!=typeof i||!i)throw new ve('JWE "alg" (Algorithm) Header Parameter missing or invalid');if("string"!=typeof r||!r)throw new ve('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');let o,s,a,u,c,l,h;if("dir"===i){if(this._cek)throw new TypeError("setContentEncryptionKey cannot be called when using Direct Encryption")}else if("ECDH-ES"===i&&this._cek)throw new TypeError("setContentEncryptionKey cannot be called when using Direct Key Agreement");{let n;({cek:s,encryptedKey:o,parameters:n}=await Fi(i,r,t,this._cek,this._keyManagementParameters)),n&&(e&&ji in e?this._unprotectedHeader?this._unprotectedHeader={...this._unprotectedHeader,...n}:this.setUnprotectedHeader(n):this._protectedHeader?this._protectedHeader={...this._protectedHeader,...n}:this.setProtectedHeader(n))}if(this._iv||(this._iv=je(r)),u=St.encode(this._protectedHeader?se(JSON.stringify(this._protectedHeader)):""),this._aad?(c=se(this._aad),a=te(u,St.encode("."),St.encode(c))):a=u,"DEF"===n.zip){const t=await((null==e?void 0:e.deflateRaw)||Ye)(this._plaintext);({ciphertext:l,tag:h}=await ei(r,t,s,this._iv,a))}else({ciphertext:l,tag:h}=await ei(r,this._plaintext,s,this._iv,a));const d={ciphertext:se(l),iv:se(this._iv),tag:se(h)};return o&&(d.encrypted_key=se(o)),c&&(d.aad=c),this._protectedHeader&&(d.protected=Ft.decode(u)),this._sharedUnprotectedHeader&&(d.unprotected=this._sharedUnprotectedHeader),this._unprotectedHeader&&(d.header=this._unprotectedHeader),d}}}}),Ni=Bt({"../node_modules/jose/dist/browser/jwe/general/encrypt.js"(){Oi(),Ce(),$n(),on(),Ti(),Fe(),di(),Ri=class{constructor(t,e,n){this.parent=t,this.key=e,this.options=n}setUnprotectedHeader(t){if(this.unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this.unprotectedHeader=t,this}addRecipient(...t){return this.parent.addRecipient(...t)}encrypt(...t){return this.parent.encrypt(...t)}done(){return this.parent}},Ii=class{constructor(t){this._recipients=[],this._plaintext=t}addRecipient(t,e){const n=new Ri(this,t,{crit:null==e?void 0:e.crit});return this._recipients.push(n),n}setProtectedHeader(t){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=t,this}setSharedUnprotectedHeader(t){if(this._unprotectedHeader)throw new TypeError("setSharedUnprotectedHeader can only be called once");return this._unprotectedHeader=t,this}setAdditionalAuthenticatedData(t){return this._aad=t,this}async encrypt(t){var e,n,i;if(!this._recipients.length)throw new ve("at least one recipient must be added");if(t={deflateRaw:null==t?void 0:t.deflateRaw},1===this._recipients.length){const[e]=this._recipients,n=await new Ci(this._plaintext).setAdditionalAuthenticatedData(this._aad).setProtectedHeader(this._protectedHeader).setSharedUnprotectedHeader(this._unprotectedHeader).setUnprotectedHeader(e.unprotectedHeader).encrypt(e.key,{...e.options,...t});let i={ciphertext:n.ciphertext,iv:n.iv,recipients:[{}],tag:n.tag};return n.aad&&(i.aad=n.aad),n.protected&&(i.protected=n.protected),n.unprotected&&(i.unprotected=n.unprotected),n.encrypted_key&&(i.recipients[0].encrypted_key=n.encrypted_key),n.header&&(i.recipients[0].header=n.header),i}let r;for(let t=0;t<this._recipients.length;t++){const e=this._recipients[t];if(!Ze(this._protectedHeader,this._unprotectedHeader,e.unprotectedHeader))throw new ve("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");const n={...this._protectedHeader,...this._unprotectedHeader,...e.unprotectedHeader},{alg:i}=n;if("string"!=typeof i||!i)throw new ve('JWE "alg" (Algorithm) Header Parameter missing or invalid');if("dir"===i||"ECDH-ES"===i)throw new ve('"dir" and "ECDH-ES" alg may only be used with a single recipient');if("string"!=typeof n.enc||!n.enc)throw new ve('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');if(r){if(r!==n.enc)throw new ve('JWE "enc" (Encryption Algorithm) Header Parameter must be the same for all recipients')}else r=n.enc;if(ui(ve,new Map,e.options.crit,this._protectedHeader,n),!(void 0===n.zip||this._protectedHeader&&this._protectedHeader.zip))throw new ve('JWE "zip" (Compression Algorithm) Header MUST be integrity protected')}const o=_n(r);let s={ciphertext:"",iv:"",recipients:[],tag:""};for(let a=0;a<this._recipients.length;a++){const u=this._recipients[a],c={};s.recipients.push(c);const l={...this._protectedHeader,...this._unprotectedHeader,...u.unprotectedHeader}.alg.startsWith("PBES2")?2048+a:void 0;if(0===a){const e=await new Ci(this._plaintext).setAdditionalAuthenticatedData(this._aad).setContentEncryptionKey(o).setProtectedHeader(this._protectedHeader).setSharedUnprotectedHeader(this._unprotectedHeader).setUnprotectedHeader(u.unprotectedHeader).setKeyManagementParameters({p2c:l}).encrypt(u.key,{...u.options,...t,[ji]:!0});s.ciphertext=e.ciphertext,s.iv=e.iv,s.tag=e.tag,e.aad&&(s.aad=e.aad),e.protected&&(s.protected=e.protected),e.unprotected&&(s.unprotected=e.unprotected),c.encrypted_key=e.encrypted_key,e.header&&(c.header=e.header);continue}const{encryptedKey:h,parameters:d}=await Fi((null===(e=u.unprotectedHeader)||void 0===e?void 0:e.alg)||(null===(n=this._protectedHeader)||void 0===n?void 0:n.alg)||(null===(i=this._unprotectedHeader)||void 0===i?void 0:i.alg),r,u.key,o,{p2c:l});c.encrypted_key=se(h),(u.unprotectedHeader||d)&&(c.header={...u.unprotectedHeader,...d})}return s}}}});function Pi(t,e){const n=`SHA-${t.slice(-3)}`;switch(t){case"HS256":case"HS384":case"HS512":return{hash:n,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:n,name:"RSA-PSS",saltLength:t.slice(-3)>>3};case"RS256":case"RS384":case"RS512":return{hash:n,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:n,name:"ECDSA",namedCurve:e.namedCurve};case Le()&&"EdDSA":const{namedCurve:i}=e;return{name:i,namedCurve:i};default:throw new fe(`alg ${t} is not supported either by JOSE or your javascript runtime`)}}var Di=Bt({"../node_modules/jose/dist/browser/runtime/subtle_dsa.js"(){Be(),Ce()}});function Mi(t,e,n){if(kt(e))return function(t,e,...n){switch(e){case"HS256":case"HS384":case"HS512":{if(!$e(t.algorithm,"HMAC"))throw Je("HMAC");const n=parseInt(e.slice(2),10);if(He(t.algorithm.hash)!==n)throw Je(`SHA-${n}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!$e(t.algorithm,"RSASSA-PKCS1-v1_5"))throw Je("RSASSA-PKCS1-v1_5");const n=parseInt(e.slice(2),10);if(He(t.algorithm.hash)!==n)throw Je(`SHA-${n}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!$e(t.algorithm,"RSA-PSS"))throw Je("RSA-PSS");const n=parseInt(e.slice(2),10);if(He(t.algorithm.hash)!==n)throw Je(`SHA-${n}`,"algorithm.hash");break}case Le()&&"EdDSA":if(!$e(t.algorithm,"NODE-ED25519"))throw Je("NODE-ED25519");break;case"ES256":case"ES384":case"ES512":{if(!$e(t.algorithm,"ECDSA"))throw Je("ECDSA");const n=function(t){switch(t){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}(e);if(t.algorithm.namedCurve!==n)throw Je(n,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}Ke(t,n)}(e,t,n),e;if(e instanceof Uint8Array){if(!t.startsWith("HS"))throw new TypeError(We(e,...Ve));return xt.subtle.importKey("raw",e,{hash:`SHA-${t.slice(-3)}`,name:"HMAC"},!1,[n])}throw new TypeError(We(e,...Ve,"Uint8Array"))}var Ui,Li=Bt({"../node_modules/jose/dist/browser/runtime/get_sign_verify_key.js"(){Zt(),Qe(),tn(),en()}}),Bi=Bt({"../node_modules/jose/dist/browser/runtime/verify.js"(){Di(),Zt(),Cn(),Li(),Ui=async(t,e,n,i)=>{const r=await Mi(t,e,"verify");Sn(t,r);const o=Pi(t,r.algorithm);try{return await xt.subtle.verify(o,r,n,i)}catch(t){return!1}}}});async function Ji(t,e,n){var i;if(!sn(t))throw new ge("Flattened JWS must be an object");if(void 0===t.protected&&void 0===t.header)throw new ge('Flattened JWS must have either of the "protected" or "header" members');if(void 0!==t.protected&&"string"!=typeof t.protected)throw new ge("JWS Protected Header incorrect type");if(void 0===t.payload)throw new ge("JWS Payload missing");if("string"!=typeof t.signature)throw new ge("JWS Signature missing or incorrect type");if(void 0!==t.header&&!sn(t.header))throw new ge("JWS Unprotected Header incorrect type");let r={};if(t.protected)try{const e=ue(t.protected);r=JSON.parse(Ft.decode(e))}catch(t){throw new ge("JWS Protected Header is invalid")}if(!Ze(r,t.header))throw new ge("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const o={...r,...t.header};let s=!0;if(ui(ge,new Map([["b64",!0]]),null==n?void 0:n.crit,r,o).has("b64")&&(s=r.b64,"boolean"!=typeof s))throw new ge('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:a}=o;if("string"!=typeof a||!a)throw new ge('JWS "alg" (Algorithm) Header Parameter missing or invalid');const u=n&&hi("algorithms",n.algorithms);if(u&&!u.has(a))throw new de('"alg" (Algorithm) Header Parameter not allowed');if(s){if("string"!=typeof t.payload)throw new ge("JWS Payload must be a string")}else if("string"!=typeof t.payload&&!(t.payload instanceof Uint8Array))throw new ge("JWS Payload must be a string or an Uint8Array instance");let c=!1;"function"==typeof e&&(e=await e(r,t),c=!0),ti(a,e,"verify");const l=te(St.encode(null!==(i=t.protected)&&void 0!==i?i:""),St.encode("."),"string"==typeof t.payload?St.encode(t.payload):t.payload),h=ue(t.signature);if(!await Ui(a,e,h,l))throw new Ee;let d;d=s?ue(t.payload):"string"==typeof t.payload?St.encode(t.payload):t.payload;const f={payload:d};return void 0!==t.protected&&(f.protectedHeader=r),void 0!==t.header&&(f.unprotectedHeader=t.header),c?{...f,key:e}:f}var $i=Bt({"../node_modules/jose/dist/browser/jws/flattened/verify.js"(){Fe(),Bi(),Ce(),Se(),on(),ln(),ri(),di(),fi()}});async function Hi(t,e,n){if(t instanceof Uint8Array&&(t=Ft.decode(t)),"string"!=typeof t)throw new ge("Compact JWS must be a string or Uint8Array");const{0:i,1:r,2:o,length:s}=t.split(".");if(3!==s)throw new ge("Invalid Compact JWS");const a=await Ji({payload:r,protected:i,signature:o},e,n),u={payload:a.payload,protectedHeader:a.protectedHeader};return"function"==typeof e?{...u,key:a.key}:u}var Ki=Bt({"../node_modules/jose/dist/browser/jws/compact/verify.js"(){$i(),Ce(),Se()}});async function zi(t,e,n){if(!sn(t))throw new ge("General JWS must be an object");if(!Array.isArray(t.signatures)||!t.signatures.every(sn))throw new ge("JWS Signatures missing or incorrect type");for(const i of t.signatures)try{return await Ji({header:i.header,payload:t.payload,protected:i.protected,signature:i.signature},e,n)}catch(t){}throw new Ee}var Wi,qi,Vi,Gi,Xi,Yi,Zi=Bt({"../node_modules/jose/dist/browser/jws/general/verify.js"(){$i(),Ce(),ln()}}),Qi=Bt({"../node_modules/jose/dist/browser/lib/epoch.js"(){Wi=t=>Math.floor(t.getTime()/1e3)}}),tr=Bt({"../node_modules/jose/dist/browser/lib/secs.js"(){qi=/^(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)$/i,Vi=t=>{const e=qi.exec(t);if(!e)throw new TypeError("Invalid time period format");const n=parseFloat(e[1]);switch(e[2].toLowerCase()){case"sec":case"secs":case"second":case"seconds":case"s":return Math.round(n);case"minute":case"minutes":case"min":case"mins":case"m":return Math.round(60*n);case"hour":case"hours":case"hr":case"hrs":case"h":return Math.round(3600*n);case"day":case"days":case"d":return Math.round(86400*n);case"week":case"weeks":case"w":return Math.round(604800*n);default:return Math.round(31557600*n)}}}}),er=Bt({"../node_modules/jose/dist/browser/lib/jwt_claims_set.js"(){Ce(),Se(),Qi(),tr(),ln(),Gi=t=>t.toLowerCase().replace(/^application\//,""),Xi=(t,e)=>"string"==typeof t?e.includes(t):!!Array.isArray(t)&&e.some(Set.prototype.has.bind(new Set(t))),Yi=(t,e,n={})=>{const{typ:i}=n;if(i&&("string"!=typeof t.typ||Gi(t.typ)!==Gi(i)))throw new le('unexpected "typ" JWT header value',"typ","check_failed");let r;try{r=JSON.parse(Ft.decode(e))}catch(t){}if(!sn(r))throw new me("JWT Claims Set must be a top-level JSON object");const{issuer:o}=n;if(o&&!(Array.isArray(o)?o:[o]).includes(r.iss))throw new le('unexpected "iss" claim value',"iss","check_failed");const{subject:s}=n;if(s&&r.sub!==s)throw new le('unexpected "sub" claim value',"sub","check_failed");const{audience:a}=n;if(a&&!Xi(r.aud,"string"==typeof a?[a]:a))throw new le('unexpected "aud" claim value',"aud","check_failed");let u;switch(typeof n.clockTolerance){case"string":u=Vi(n.clockTolerance);break;case"number":u=n.clockTolerance;break;case"undefined":u=0;break;default:throw new TypeError("Invalid clockTolerance option type")}const{currentDate:c}=n,l=Wi(c||new Date);if((void 0!==r.iat||n.maxTokenAge)&&"number"!=typeof r.iat)throw new le('"iat" claim must be a number',"iat","invalid");if(void 0!==r.nbf){if("number"!=typeof r.nbf)throw new le('"nbf" claim must be a number',"nbf","invalid");if(r.nbf>l+u)throw new le('"nbf" claim timestamp check failed',"nbf","check_failed")}if(void 0!==r.exp){if("number"!=typeof r.exp)throw new le('"exp" claim must be a number',"exp","invalid");if(r.exp<=l-u)throw new he('"exp" claim timestamp check failed',"exp","check_failed")}if(n.maxTokenAge){const t=l-r.iat;if(t-u>("number"==typeof n.maxTokenAge?n.maxTokenAge:Vi(n.maxTokenAge)))throw new he('"iat" claim timestamp check failed (too far in the past)',"iat","check_failed");if(t<0-u)throw new le('"iat" claim timestamp check failed (it should be in the past)',"iat","check_failed")}return r}}});async function nr(t,e,n){var i;const r=await Hi(t,e,n);if((null===(i=r.protectedHeader.crit)||void 0===i?void 0:i.includes("b64"))&&!1===r.protectedHeader.b64)throw new me("JWTs MUST NOT use unencoded payload");const o={payload:Yi(r.protectedHeader,r.payload,n),protectedHeader:r.protectedHeader};return"function"==typeof e?{...o,key:r.key}:o}var ir=Bt({"../node_modules/jose/dist/browser/jwt/verify.js"(){Ki(),er(),Ce()}});async function rr(t,e,n){const i=await gi(t,e,n),r=Yi(i.protectedHeader,i.plaintext,n),{protectedHeader:o}=i;if(void 0!==o.iss&&o.iss!==r.iss)throw new le('replicated "iss" claim header parameter mismatch',"iss","mismatch");if(void 0!==o.sub&&o.sub!==r.sub)throw new le('replicated "sub" claim header parameter mismatch',"sub","mismatch");if(void 0!==o.aud&&JSON.stringify(o.aud)!==JSON.stringify(r.aud))throw new le('replicated "aud" claim header parameter mismatch',"aud","mismatch");const s={payload:r,protectedHeader:o};return"function"==typeof e?{...s,key:i.key}:s}var or,sr,ar,ur,cr,lr,hr,dr,fr,pr,vr=Bt({"../node_modules/jose/dist/browser/jwt/decrypt.js"(){mi(),er(),Ce()}}),gr=Bt({"../node_modules/jose/dist/browser/jwe/compact/encrypt.js"(){Oi(),or=class{constructor(t){this._flattened=new Ci(t)}setContentEncryptionKey(t){return this._flattened.setContentEncryptionKey(t),this}setInitializationVector(t){return this._flattened.setInitializationVector(t),this}setProtectedHeader(t){return this._flattened.setProtectedHeader(t),this}setKeyManagementParameters(t){return this._flattened.setKeyManagementParameters(t),this}async encrypt(t,e){const n=await this._flattened.encrypt(t,e);return[n.protected,n.encrypted_key,n.iv,n.ciphertext,n.tag].join(".")}}}}),mr=Bt({"../node_modules/jose/dist/browser/runtime/sign.js"(){Di(),Zt(),Cn(),Li(),sr=async(t,e,n)=>{const i=await Mi(t,e,"sign");Sn(t,i);const r=await xt.subtle.sign(Pi(t,i.algorithm),i,n);return new Uint8Array(r)}}}),wr=Bt({"../node_modules/jose/dist/browser/jws/flattened/sign.js"(){Fe(),mr(),on(),Ce(),Se(),ri(),di(),ar=class{constructor(t){if(!(t instanceof Uint8Array))throw new TypeError("payload must be an instance of Uint8Array");this._payload=t}setProtectedHeader(t){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=t,this}setUnprotectedHeader(t){if(this._unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=t,this}async sign(t,e){if(!this._protectedHeader&&!this._unprotectedHeader)throw new ge("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!Ze(this._protectedHeader,this._unprotectedHeader))throw new ge("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const n={...this._protectedHeader,...this._unprotectedHeader};let i=!0;if(ui(ge,new Map([["b64",!0]]),null==e?void 0:e.crit,this._protectedHeader,n).has("b64")&&(i=this._protectedHeader.b64,"boolean"!=typeof i))throw new ge('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:r}=n;if("string"!=typeof r||!r)throw new ge('JWS "alg" (Algorithm) Header Parameter missing or invalid');ti(r,t,"sign");let o,s=this._payload;i&&(s=St.encode(se(s))),o=St.encode(this._protectedHeader?se(JSON.stringify(this._protectedHeader)):"");const a=te(o,St.encode("."),s),u=await sr(r,t,a),c={signature:se(u),payload:""};return i&&(c.payload=Ft.decode(s)),this._unprotectedHeader&&(c.header=this._unprotectedHeader),this._protectedHeader&&(c.protected=Ft.decode(o)),c}}}}),br=Bt({"../node_modules/jose/dist/browser/jws/compact/sign.js"(){wr(),ur=class{constructor(t){this._flattened=new ar(t)}setProtectedHeader(t){return this._flattened.setProtectedHeader(t),this}async sign(t,e){const n=await this._flattened.sign(t,e);if(void 0===n.payload)throw new TypeError("use the flattened module for creating JWS with b64: false");return`${n.protected}.${n.payload}.${n.signature}`}}}}),yr=Bt({"../node_modules/jose/dist/browser/jws/general/sign.js"(){wr(),Ce(),cr=class{constructor(t,e,n){this.parent=t,this.key=e,this.options=n}setProtectedHeader(t){if(this.protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this.protectedHeader=t,this}setUnprotectedHeader(t){if(this.unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this.unprotectedHeader=t,this}addSignature(...t){return this.parent.addSignature(...t)}sign(...t){return this.parent.sign(...t)}done(){return this.parent}},lr=class{constructor(t){this._signatures=[],this._payload=t}addSignature(t,e){const n=new cr(this,t,e);return this._signatures.push(n),n}async sign(){if(!this._signatures.length)throw new ge("at least one signature must be added");const t={signatures:[],payload:""};for(let e=0;e<this._signatures.length;e++){const n=this._signatures[e],i=new ar(this._payload);i.setProtectedHeader(n.protectedHeader),i.setUnprotectedHeader(n.unprotectedHeader);const{payload:r,...o}=await i.sign(n.key,n.options);if(0===e)t.payload=r;else if(t.payload!==r)throw new ge("inconsistent use of JWS Unencoded Payload Option (RFC7797)");t.signatures.push(o)}return t}}}}),xr=Bt({"../node_modules/jose/dist/browser/jwt/produce.js"(){Qi(),ln(),tr(),hr=class{constructor(t){if(!sn(t))throw new TypeError("JWT Claims Set MUST be an object");this._payload=t}setIssuer(t){return this._payload={...this._payload,iss:t},this}setSubject(t){return this._payload={...this._payload,sub:t},this}setAudience(t){return this._payload={...this._payload,aud:t},this}setJti(t){return this._payload={...this._payload,jti:t},this}setNotBefore(t){return this._payload="number"==typeof t?{...this._payload,nbf:t}:{...this._payload,nbf:Wi(new Date)+Vi(t)},this}setExpirationTime(t){return this._payload="number"==typeof t?{...this._payload,exp:t}:{...this._payload,exp:Wi(new Date)+Vi(t)},this}setIssuedAt(t){return this._payload=void 0===t?{...this._payload,iat:Wi(new Date)}:{...this._payload,iat:t},this}}}}),kr=Bt({"../node_modules/jose/dist/browser/jwt/sign.js"(){br(),Ce(),Se(),xr(),dr=class extends hr{setProtectedHeader(t){return this._protectedHeader=t,this}async sign(t,e){var n;const i=new ur(St.encode(JSON.stringify(this._payload)));if(i.setProtectedHeader(this._protectedHeader),Array.isArray(null===(n=this._protectedHeader)||void 0===n?void 0:n.crit)&&this._protectedHeader.crit.includes("b64")&&!1===this._protectedHeader.b64)throw new me("JWTs MUST NOT use unencoded payload");return i.sign(t,e)}}}}),Er=Bt({"../node_modules/jose/dist/browser/jwt/encrypt.js"(){gr(),Se(),xr(),fr=class extends hr{setProtectedHeader(t){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=t,this}setKeyManagementParameters(t){if(this._keyManagementParameters)throw new TypeError("setKeyManagementParameters can only be called once");return this._keyManagementParameters=t,this}setContentEncryptionKey(t){if(this._cek)throw new TypeError("setContentEncryptionKey can only be called once");return this._cek=t,this}setInitializationVector(t){if(this._iv)throw new TypeError("setInitializationVector can only be called once");return this._iv=t,this}replicateIssuerAsHeader(){return this._replicateIssuerAsHeader=!0,this}replicateSubjectAsHeader(){return this._replicateSubjectAsHeader=!0,this}replicateAudienceAsHeader(){return this._replicateAudienceAsHeader=!0,this}async encrypt(t,e){const n=new or(St.encode(JSON.stringify(this._payload)));return this._replicateIssuerAsHeader&&(this._protectedHeader={...this._protectedHeader,iss:this._payload.iss}),this._replicateSubjectAsHeader&&(this._protectedHeader={...this._protectedHeader,sub:this._payload.sub}),this._replicateAudienceAsHeader&&(this._protectedHeader={...this._protectedHeader,aud:this._payload.aud}),n.setProtectedHeader(this._protectedHeader),this._iv&&n.setInitializationVector(this._iv),this._cek&&n.setContentEncryptionKey(this._cek),this._keyManagementParameters&&n.setKeyManagementParameters(this._keyManagementParameters),n.encrypt(t,e)}}}});async function Sr(t,e){if(!sn(t))throw new TypeError("JWK must be an object");if(null!=e||(e="sha256"),"sha256"!==e&&"sha384"!==e&&"sha512"!==e)throw new TypeError('digestAlgorithm must one of "sha256", "sha384", or "sha512"');let n;switch(t.kty){case"EC":pr(t.crv,'"crv" (Curve) Parameter'),pr(t.x,'"x" (X Coordinate) Parameter'),pr(t.y,'"y" (Y Coordinate) Parameter'),n={crv:t.crv,kty:t.kty,x:t.x,y:t.y};break;case"OKP":pr(t.crv,'"crv" (Subtype of Key Pair) Parameter'),pr(t.x,'"x" (Public Key) Parameter'),n={crv:t.crv,kty:t.kty,x:t.x};break;case"RSA":pr(t.e,'"e" (Exponent) Parameter'),pr(t.n,'"n" (Modulus) Parameter'),n={e:t.e,kty:t.kty,n:t.n};break;case"oct":pr(t.k,'"k" (Key Value) Parameter'),n={k:t.k,kty:t.kty};break;default:throw new fe('"kty" (Key Type) Parameter missing or unsupported')}const i=St.encode(JSON.stringify(n));return se(await Et(e,i))}async function Fr(t,e){null!=e||(e="sha256");const n=await Sr(t,e);return`urn:ietf:params:oauth:jwk-thumbprint:sha-${e.slice(-3)}:${n}`}var Ar=Bt({"../node_modules/jose/dist/browser/jwk/thumbprint.js"(){Qt(),Fe(),Ce(),Se(),ln(),pr=(t,e)=>{if("string"!=typeof t||!t)throw new we(`${e} missing or invalid`)}}});async function _r(t,e){const n={...t,...e.header};if(!sn(n.jwk))throw new ge('"jwk" (JSON Web Key) Header Parameter must be a JSON object');const i=await Yn({...n.jwk,ext:!0},n.alg,!0);if(i instanceof Uint8Array||"public"!==i.type)throw new ge('"jwk" (JSON Web Key) Header Parameter must be a public key');return i}var jr,Cr=Bt({"../node_modules/jose/dist/browser/jwk/embedded.js"(){ii(),ln(),Ce()}});function Rr(t){return t&&"object"==typeof t&&Array.isArray(t.keys)&&t.keys.every(Ir)}function Ir(t){return sn(t)}function Tr(t){return jr.prototype.getKey.bind(new jr(t))}var Or,Nr,Pr=Bt({"../node_modules/jose/dist/browser/jwks/local.js"(){ii(),Ce(),ln(),jr=class{constructor(t){if(this._cached=new WeakMap,!Rr(t))throw new be("JSON Web Key Set malformed");var e;this._jwks=(e=t,"function"==typeof structuredClone?structuredClone(e):JSON.parse(JSON.stringify(e)))}async getKey(t,e){const{alg:n,kid:i}={...t,...e.header},r=function(t){switch("string"==typeof t&&t.slice(0,2)){case"RS":case"PS":return"RSA";case"ES":return"EC";case"Ed":return"OKP";default:throw new fe('Unsupported "alg" value for a JSON Web Key Set')}}(n),o=this._jwks.keys.filter((t=>{let e=r===t.kty;if(e&&"string"==typeof i&&(e=i===t.kid),e&&"string"==typeof t.alg&&(e=n===t.alg),e&&"string"==typeof t.use&&(e="sig"===t.use),e&&Array.isArray(t.key_ops)&&(e=t.key_ops.includes("verify")),e&&"EdDSA"===n&&(e="Ed25519"===t.crv||"Ed448"===t.crv),e)switch(n){case"ES256":e="P-256"===t.crv;break;case"ES256K":e="secp256k1"===t.crv;break;case"ES384":e="P-384"===t.crv;break;case"ES512":e="P-521"===t.crv}return e})),{0:s,length:a}=o;if(0===a)throw new ye;if(1!==a)throw new xe;const u=this._cached.get(s)||this._cached.set(s,{}).get(s);if(void 0===u[n]){const t=await Yn({...s,ext:!0},n);if(t instanceof Uint8Array||"public"!==t.type)throw new be("JSON Web Key Set members must be public keys");u[n]=t}return u[n]}}}}),Dr=Bt({"../node_modules/jose/dist/browser/runtime/fetch_jwks.js"(){Ce(),Or=async(t,e,n)=>{let i,r,o=!1;"function"==typeof AbortController&&(i=new AbortController,r=setTimeout((()=>{o=!0,i.abort()}),e));const s=await fetch(t.href,{signal:i?i.signal:void 0,redirect:"manual",headers:n.headers}).catch((t=>{if(o)throw new ke;throw t}));if(void 0!==r&&clearTimeout(r),200!==s.status)throw new ce("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await s.json()}catch(t){throw new ce("Failed to parse the JSON Web Key Set HTTP response as JSON")}}}});function Mr(t,e){return Nr.prototype.getKey.bind(new Nr(t,e))}var Ur,Lr,Br,Jr=Bt({"../node_modules/jose/dist/browser/jwks/remote.js"(){Dr(),Be(),Ce(),Pr(),Nr=class extends jr{constructor(t,e){if(super({keys:[]}),this._jwks=void 0,!(t instanceof URL))throw new TypeError("url must be an instance of URL");this._url=new URL(t.href),this._options={agent:null==e?void 0:e.agent,headers:null==e?void 0:e.headers},this._timeoutDuration="number"==typeof(null==e?void 0:e.timeoutDuration)?null==e?void 0:e.timeoutDuration:5e3,this._cooldownDuration="number"==typeof(null==e?void 0:e.cooldownDuration)?null==e?void 0:e.cooldownDuration:3e4,this._cacheMaxAge="number"==typeof(null==e?void 0:e.cacheMaxAge)?null==e?void 0:e.cacheMaxAge:6e5}coolingDown(){return"number"==typeof this._jwksTimestamp&&Date.now()<this._jwksTimestamp+this._cooldownDuration}fresh(){return"number"==typeof this._jwksTimestamp&&Date.now()<this._jwksTimestamp+this._cacheMaxAge}async getKey(t,e){this._jwks&&this.fresh()||await this.reload();try{return await super.getKey(t,e)}catch(n){if(n instanceof ye&&!1===this.coolingDown())return await this.reload(),super.getKey(t,e);throw n}}async reload(){if(this._pendingFetch&&Le())return new Promise((t=>{const e=()=>{void 0===this._pendingFetch?t():setTimeout(e,5)};e()}));this._pendingFetch||(this._pendingFetch=Or(this._url,this._timeoutDuration,this._options).then((t=>{if(!Rr(t))throw new be("JSON Web Key Set malformed");this._jwks={keys:t.keys},this._jwksTimestamp=Date.now(),this._pendingFetch=void 0})).catch((t=>{throw this._pendingFetch=void 0,t}))),await this._pendingFetch}}}}),$r=Bt({"../node_modules/jose/dist/browser/jwt/unsecured.js"(){Fe(),Se(),Ce(),er(),xr(),Ur=class extends hr{encode(){return`${se(JSON.stringify({alg:"none"}))}.${se(JSON.stringify(this._payload))}.`}static decode(t,e){if("string"!=typeof t)throw new me("Unsecured JWT must be a string");const{0:n,1:i,2:r,length:o}=t.split(".");if(3!==o||""!==r)throw new me("Invalid Unsecured JWT");let s;try{if(s=JSON.parse(Ft.decode(ue(n))),"none"!==s.alg)throw new Error}catch(t){throw new me("Invalid Unsecured JWT")}return{payload:Yi(s,ue(i),e),header:s}}}}}),Hr={};$t(Hr,{decode:()=>Br,encode:()=>Lr});var Kr=Bt({"../node_modules/jose/dist/browser/util/base64url.js"(){Fe(),Lr=se,Br=ue}});function zr(t){let e;if("string"==typeof t){const n=t.split(".");3!==n.length&&5!==n.length||([e]=n)}else if("object"==typeof t&&t){if(!("protected"in t))throw new TypeError("Token does not contain a Protected Header");e=t.protected}try{if("string"!=typeof e||!e)throw new Error;const t=JSON.parse(Ft.decode(Br(e)));if(!sn(t))throw new Error;return t}catch(t){throw new TypeError("Invalid Token or Protected Header formatting")}}var Wr=Bt({"../node_modules/jose/dist/browser/util/decode_protected_header.js"(){Kr(),Se(),ln()}});function qr(t){if("string"!=typeof t)throw new me("JWTs must use Compact JWS serialization, JWT must be a string");const{1:e,length:n}=t.split(".");if(5===n)throw new me("Only JWTs using Compact JWS serialization can be decoded");if(3!==n)throw new me("Invalid JWT");if(!e)throw new me("JWTs must contain a payload");let i,r;try{i=Br(e)}catch(t){throw new me("Failed to parse the base64url encoded payload")}try{r=JSON.parse(Ft.decode(i))}catch(t){throw new me("Failed to parse the decoded payload as JSON")}if(!sn(r))throw new me("Invalid JWT Claims Set");return r}var Vr=Bt({"../node_modules/jose/dist/browser/util/decode_jwt.js"(){Kr(),Se(),ln(),Ce()}});function Gr(t){var e;const n=null!==(e=null==t?void 0:t.modulusLength)&&void 0!==e?e:2048;if("number"!=typeof n||n<2048)throw new fe("Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used");return n}var Xr=Bt({"../node_modules/jose/dist/browser/runtime/generate.js"(){Be(),Zt(),Ce(),Re()}});async function Yr(t,e){return async function(t,e){var n,i;let r,o;switch(t){case"PS256":case"PS384":case"PS512":r={name:"RSA-PSS",hash:`SHA-${t.slice(-3)}`,publicExponent:new Uint8Array([1,0,1]),modulusLength:Gr(e)},o=["sign","verify"];break;case"RS256":case"RS384":case"RS512":r={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${t.slice(-3)}`,publicExponent:new Uint8Array([1,0,1]),modulusLength:Gr(e)},o=["sign","verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":r={name:"RSA-OAEP",hash:`SHA-${parseInt(t.slice(-3),10)||1}`,publicExponent:new Uint8Array([1,0,1]),modulusLength:Gr(e)},o=["decrypt","unwrapKey","encrypt","wrapKey"];break;case"ES256":r={name:"ECDSA",namedCurve:"P-256"},o=["sign","verify"];break;case"ES384":r={name:"ECDSA",namedCurve:"P-384"},o=["sign","verify"];break;case"ES512":r={name:"ECDSA",namedCurve:"P-521"},o=["sign","verify"];break;case Le()&&"EdDSA":switch(null==e?void 0:e.crv){case void 0:case"Ed25519":r={name:"NODE-ED25519",namedCurve:"NODE-ED25519"},o=["sign","verify"];break;default:throw new fe("Invalid or unsupported crv option provided")}break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":r={name:"ECDH",namedCurve:null!==(n=null==e?void 0:e.crv)&&void 0!==n?n:"P-256"},o=["deriveKey","deriveBits"];break;default:throw new fe('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}return xt.subtle.generateKey(r,null!==(i=null==e?void 0:e.extractable)&&void 0!==i&&i,o)}(t,e)}var Zr=Bt({"../node_modules/jose/dist/browser/key/generate_key_pair.js"(){Xr()}});async function Qr(t,e){return async function(t,e){var n;let i,r,o;switch(t){case"HS256":case"HS384":case"HS512":i=parseInt(t.slice(-3),10),r={name:"HMAC",hash:`SHA-${i}`,length:i},o=["sign","verify"];break;case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return i=parseInt(t.slice(-3),10),_e(new Uint8Array(i>>3));case"A128KW":case"A192KW":case"A256KW":i=parseInt(t.slice(1,4),10),r={name:"AES-KW",length:i},o=["wrapKey","unwrapKey"];break;case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":case"A128GCM":case"A192GCM":case"A256GCM":i=parseInt(t.slice(1,4),10),r={name:"AES-GCM",length:i},o=["encrypt","decrypt"];break;default:throw new fe('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}return xt.subtle.generateKey(r,null!==(n=null==e?void 0:e.extractable)&&void 0!==n&&n,o)}(t,e)}var to=Bt({"../node_modules/jose/dist/browser/key/generate_secret.js"(){Xr()}}),eo={};$t(eo,{CompactEncrypt:()=>or,CompactSign:()=>ur,EmbeddedJWK:()=>_r,EncryptJWT:()=>fr,FlattenedEncrypt:()=>Ci,FlattenedSign:()=>ar,GeneralEncrypt:()=>Ii,GeneralSign:()=>lr,SignJWT:()=>dr,UnsecuredJWT:()=>Ur,base64url:()=>Hr,calculateJwkThumbprint:()=>Sr,calculateJwkThumbprintUri:()=>Fr,compactDecrypt:()=>gi,compactVerify:()=>Hi,createLocalJWKSet:()=>Tr,createRemoteJWKSet:()=>Mr,decodeJwt:()=>qr,decodeProtectedHeader:()=>zr,errors:()=>Ae,exportJWK:()=>Si,exportPKCS8:()=>Ei,exportSPKI:()=>ki,flattenedDecrypt:()=>pi,flattenedVerify:()=>Ji,generalDecrypt:()=>wi,generalVerify:()=>zi,generateKeyPair:()=>Yr,generateSecret:()=>Qr,importJWK:()=>Yn,importPKCS8:()=>Xn,importSPKI:()=>Vn,importX509:()=>Gn,jwtDecrypt:()=>rr,jwtVerify:()=>nr});var no,io,ro=Bt({"../node_modules/jose/dist/browser/index.js"(){mi(),vi(),yi(),Ni(),Ki(),$i(),Zi(),ir(),vr(),gr(),Oi(),br(),wr(),yr(),kr(),Er(),Ar(),Cr(),Pr(),Jr(),$r(),Ai(),ii(),Wr(),Vr(),Ce(),Zr(),to(),Kr()}}),oo=Jt({"../node_modules/@inrupt/solid-client-authn-core/dist/util/token.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getWebidFromTokenPayload=t.fetchJwks=void 0;var e=Yt(),n=(ro(),zt(eo));async function i(t,n){const i=await(0,e.fetch)(t);if(200!==i.status)throw new Error(`Could not fetch JWKS for [${n}] at [${t}]: ${i.status} ${i.statusText}`);let r;try{r=(await i.json()).keys[0]}catch(e){throw new Error(`Malformed JWKS for [${n}] at [${t}]: ${e.message}`)}return r}t.fetchJwks=i,t.getWebidFromTokenPayload=async function(t,e,r,o){const s=await i(e,r);let a;try{const{payload:e}=await(0,n.jwtVerify)(t,await(0,n.importJWK)(s),{issuer:r,audience:o});a=e}catch(t){throw new Error(`Token verification failed: ${t.stack}`)}if("string"==typeof a.webid)return a.webid;if("string"!=typeof a.sub)throw new Error(`The token ${JSON.stringify(a)} is invalid: it has no 'webid' claim and no 'sub' claim.`);try{return new URL(a.sub),a.sub}catch(t){throw new Error(`The token has no 'webid' claim, and its 'sub' claim of [${a.sub}] is invalid as a URL - error [${t}].`)}}}}),so=Jt({"../node_modules/@inrupt/solid-client-authn-core/dist/sessionInfo/ISessionInfo.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isSupportedTokenType=void 0,t.isSupportedTokenType=function(t){return"string"==typeof t&&["DPoP","Bearer"].includes(t)}}}),ao=Jt({"../node_modules/@inrupt/solid-client-authn-core/dist/sessionInfo/ISessionInfoManager.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.USER_SESSION_PREFIX=void 0,t.USER_SESSION_PREFIX="solidClientAuthenticationUser"}}),uo=Jt({"../node_modules/@inrupt/solid-client-authn-core/dist/login/oidc/IClientRegistrar.js"(t){function e(t){try{return new URL(t),!0}catch(t){return!1}}Object.defineProperty(t,"__esModule",{value:!0}),t.handleRegistration=t.determineSigningAlg=void 0,t.determineSigningAlg=function(t,e){var n;return null!==(n=e.find((e=>t.includes(e))))&&void 0!==n?n:null},t.handleRegistration=async function(t,n,i,r){const o=function(t,n){return void 0===t.clientId||e(t.clientId)?n.scopesSupported.includes("webid")&&void 0!==t.clientId&&e(t.clientId)?"solid-oidc":"dynamic":"static"}(t,n);return"dynamic"===o?r.getClient({sessionId:t.sessionId,clientName:t.clientName,redirectUrl:t.redirectUrl},n):(await i.setForUser(t.sessionId,{clientId:t.clientId}),t.clientSecret&&await i.setForUser(t.sessionId,{clientSecret:t.clientSecret}),t.clientName&&await i.setForUser(t.sessionId,{clientName:t.clientName}),{clientId:t.clientId,clientSecret:t.clientSecret,clientName:t.clientName,clientType:o})}}}),co=Jt({"../node_modules/@inrupt/solid-client-authn-core/dist/storage/StorageUtility.js"(t){var e=t&&t.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(t,"__esModule",{value:!0}),t.saveSessionInfoToStorage=t.loadOidcContextFromStorage=t.getSessionIdFromOauthState=void 0;var n=(ro(),zt(eo)),i=e(Gt());t.getSessionIdFromOauthState=async function(t,e){return t.getForUser(e,"sessionId")},t.loadOidcContextFromStorage=async function(t,e,n){try{const[i,r,o,s]=await Promise.all([e.getForUser(t,"issuer",{errorIfNull:!0}),e.getForUser(t,"codeVerifier"),e.getForUser(t,"redirectUrl"),e.getForUser(t,"dpop",{errorIfNull:!0})]);return await e.deleteForUser(t,"codeVerifier"),{codeVerifier:r,redirectUrl:o,issuerConfig:await n.fetchConfig(i),dpop:"true"===s}}catch(e){throw new Error(`Failed to retrieve OIDC context from storage associated with session [${t}]: ${e}`)}},t.saveSessionInfoToStorage=async function(t,e,i,r,o,s,a){void 0!==o&&await t.setForUser(e,{refreshToken:o},{secure:s}),void 0!==i&&await t.setForUser(e,{webId:i},{secure:s}),void 0!==r&&await t.setForUser(e,{isLoggedIn:r},{secure:s}),void 0!==a&&await t.setForUser(e,{publicKey:JSON.stringify(a.publicKey),privateKey:JSON.stringify(await(0,n.exportJWK)(a.privateKey))},{secure:s})},t.default=class{constructor(t,e){this.secureStorage=t,this.insecureStorage=e}getKey(t){return`solidClientAuthenticationUser:${t}`}async getUserData(t,e){const n=await(e?this.secureStorage:this.insecureStorage).get(this.getKey(t));if(void 0===n)return{};try{return JSON.parse(n)}catch(r){throw new i.default(`Data for user [${t}] in [${e?"secure":"unsecure"}] storage is corrupted - expected valid JSON, but got: ${n}`)}}async setUserData(t,e,n){await(n?this.secureStorage:this.insecureStorage).set(this.getKey(t),JSON.stringify(e))}async get(t,e){const n=await((null==e?void 0:e.secure)?this.secureStorage:this.insecureStorage).get(t);if(void 0===n&&(null==e?void 0:e.errorIfNull))throw new i.default(`[${t}] is not stored`);return n}async set(t,e,n){return((null==n?void 0:n.secure)?this.secureStorage:this.insecureStorage).set(t,e)}async delete(t,e){return((null==e?void 0:e.secure)?this.secureStorage:this.insecureStorage).delete(t)}async getForUser(t,e,n){const r=await this.getUserData(t,null==n?void 0:n.secure);let o;if(r&&r[e]||(o=void 0),o=r[e],void 0===o&&(null==n?void 0:n.errorIfNull))throw new i.default(`Field [${e}] for user [${t}] is not stored`);return o||void 0}async setForUser(t,e,n){let i;try{i=await this.getUserData(t,null==n?void 0:n.secure)}catch(t){i={}}await this.setUserData(t,{...i,...e},null==n?void 0:n.secure)}async deleteForUser(t,e,n){const i=await this.getUserData(t,null==n?void 0:n.secure);delete i[e],await this.setUserData(t,i,null==n?void 0:n.secure)}async deleteAllUserData(t,e){await((null==e?void 0:e.secure)?this.secureStorage:this.insecureStorage).delete(this.getKey(t))}}}}),lo=Jt({"../node_modules/@inrupt/solid-client-authn-core/dist/storage/InMemoryStorage.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(){this.map={}}async get(t){return this.map[t]||void 0}async set(t,e){this.map[t]=e}async delete(t){delete this.map[t]}}}}),ho=Jt({"../node_modules/@inrupt/solid-client-authn-core/dist/errors/ConfigurationError.js"(t){Object.defineProperty(t,"__esModule",{value:!0});var e=class extends Error{constructor(t){super(t)}};t.default=e}}),fo=Jt({"../node_modules/@inrupt/solid-client-authn-core/dist/errors/NotImplementedError.js"(t){Object.defineProperty(t,"__esModule",{value:!0});var e=class extends Error{constructor(t){super(`[${t}] is not implemented`)}};t.default=e}}),po=Jt({"../node_modules/@inrupt/solid-client-authn-core/dist/errors/InvalidResponseError.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.InvalidResponseError=void 0;var e=class extends Error{constructor(t){super(`Invalid response from OIDC provider: missing fields ${t}`),this.missingFields=t}};t.InvalidResponseError=e}}),vo=Jt({"../node_modules/@inrupt/solid-client-authn-core/dist/errors/OidcProviderError.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.OidcProviderError=void 0;var e=class extends Error{constructor(t,e,n){super(t),this.error=e,this.errorDescription=n}};t.OidcProviderError=e}});function go(){if(!no&&!(no="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return no(io)}var mo,wo,bo=Bt({"../node_modules/uuid/dist/esm-browser/rng.js"(){io=new Uint8Array(16)}}),yo=Bt({"../node_modules/uuid/dist/esm-browser/regex.js"(){mo=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i}});function xo(t){return"string"==typeof t&&mo.test(t)}var ko,Eo,So,Fo=Bt({"../node_modules/uuid/dist/esm-browser/validate.js"(){yo(),wo=xo}});function Ao(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(ko[t[e+0]]+ko[t[e+1]]+ko[t[e+2]]+ko[t[e+3]]+"-"+ko[t[e+4]]+ko[t[e+5]]+"-"+ko[t[e+6]]+ko[t[e+7]]+"-"+ko[t[e+8]]+ko[t[e+9]]+"-"+ko[t[e+10]]+ko[t[e+11]]+ko[t[e+12]]+ko[t[e+13]]+ko[t[e+14]]+ko[t[e+15]]).toLowerCase();if(!wo(n))throw TypeError("Stringified UUID is invalid");return n}var _o,jo,Co,Ro,Io,To=Bt({"../node_modules/uuid/dist/esm-browser/stringify.js"(){for(Fo(),ko=[],Eo=0;Eo<256;++Eo)ko.push((Eo+256).toString(16).substr(1));So=Ao}});function Oo(t,e,n){var i=e&&n||0,r=e||new Array(16),o=(t=t||{}).node||_o,s=void 0!==t.clockseq?t.clockseq:jo;if(null==o||null==s){var a=t.random||(t.rng||go)();null==o&&(o=_o=[1|a[0],a[1],a[2],a[3],a[4],a[5]]),null==s&&(s=jo=16383&(a[6]<<8|a[7]))}var u=void 0!==t.msecs?t.msecs:Date.now(),c=void 0!==t.nsecs?t.nsecs:Ro+1,l=u-Co+(c-Ro)/1e4;if(l<0&&void 0===t.clockseq&&(s=s+1&16383),(l<0||u>Co)&&void 0===t.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Co=u,Ro=c,jo=s;var h=(1e4*(268435455&(u+=122192928e5))+c)%4294967296;r[i++]=h>>>24&255,r[i++]=h>>>16&255,r[i++]=h>>>8&255,r[i++]=255&h;var d=u/4294967296*1e4&268435455;r[i++]=d>>>8&255,r[i++]=255&d,r[i++]=d>>>24&15|16,r[i++]=d>>>16&255,r[i++]=s>>>8|128,r[i++]=255&s;for(var f=0;f<6;++f)r[i+f]=o[f];return e||So(r)}var No,Po=Bt({"../node_modules/uuid/dist/esm-browser/v1.js"(){bo(),To(),Co=0,Ro=0,Io=Oo}});function Do(t){if(!wo(t))throw TypeError("Invalid UUID");var e,n=new Uint8Array(16);return n[0]=(e=parseInt(t.slice(0,8),16))>>>24,n[1]=e>>>16&255,n[2]=e>>>8&255,n[3]=255&e,n[4]=(e=parseInt(t.slice(9,13),16))>>>8,n[5]=255&e,n[6]=(e=parseInt(t.slice(14,18),16))>>>8,n[7]=255&e,n[8]=(e=parseInt(t.slice(19,23),16))>>>8,n[9]=255&e,n[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,n[11]=e/4294967296&255,n[12]=e>>>24&255,n[13]=e>>>16&255,n[14]=e>>>8&255,n[15]=255&e,n}var Mo,Uo,Lo=Bt({"../node_modules/uuid/dist/esm-browser/parse.js"(){Fo(),No=Do}});function Bo(t,e,n){function i(t,i,r,o){if("string"==typeof t&&(t=function(t){t=unescape(encodeURIComponent(t));for(var e=[],n=0;n<t.length;++n)e.push(t.charCodeAt(n));return e}(t)),"string"==typeof i&&(i=No(i)),16!==i.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var s=new Uint8Array(16+t.length);if(s.set(i),s.set(t,i.length),(s=n(s))[6]=15&s[6]|e,s[8]=63&s[8]|128,r){o=o||0;for(var a=0;a<16;++a)r[o+a]=s[a];return r}return So(s)}try{i.name=t}catch(t){}return i.DNS=Mo,i.URL=Uo,i}var Jo,$o=Bt({"../node_modules/uuid/dist/esm-browser/v35.js"(){To(),Lo(),Mo="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Uo="6ba7b811-9dad-11d1-80b4-00c04fd430c8"}});function Ho(t){if("string"==typeof t){var e=unescape(encodeURIComponent(t));t=new Uint8Array(e.length);for(var n=0;n<e.length;++n)t[n]=e.charCodeAt(n)}return function(t){for(var e=[],n=32*t.length,i="0123456789abcdef",r=0;r<n;r+=8){var o=t[r>>5]>>>r%32&255,s=parseInt(i.charAt(o>>>4&15)+i.charAt(15&o),16);e.push(s)}return e}(function(t,e){t[e>>5]|=128<<e%32,t[Ko(e)-1]=e;for(var n=1732584193,i=-271733879,r=-1732584194,o=271733878,s=0;s<t.length;s+=16){var a=n,u=i,c=r,l=o;n=qo(n,i,r,o,t[s],7,-680876936),o=qo(o,n,i,r,t[s+1],12,-389564586),r=qo(r,o,n,i,t[s+2],17,606105819),i=qo(i,r,o,n,t[s+3],22,-1044525330),n=qo(n,i,r,o,t[s+4],7,-176418897),o=qo(o,n,i,r,t[s+5],12,1200080426),r=qo(r,o,n,i,t[s+6],17,-1473231341),i=qo(i,r,o,n,t[s+7],22,-45705983),n=qo(n,i,r,o,t[s+8],7,1770035416),o=qo(o,n,i,r,t[s+9],12,-1958414417),r=qo(r,o,n,i,t[s+10],17,-42063),i=qo(i,r,o,n,t[s+11],22,-1990404162),n=qo(n,i,r,o,t[s+12],7,1804603682),o=qo(o,n,i,r,t[s+13],12,-40341101),r=qo(r,o,n,i,t[s+14],17,-1502002290),n=Vo(n,i=qo(i,r,o,n,t[s+15],22,1236535329),r,o,t[s+1],5,-165796510),o=Vo(o,n,i,r,t[s+6],9,-1069501632),r=Vo(r,o,n,i,t[s+11],14,643717713),i=Vo(i,r,o,n,t[s],20,-373897302),n=Vo(n,i,r,o,t[s+5],5,-701558691),o=Vo(o,n,i,r,t[s+10],9,38016083),r=Vo(r,o,n,i,t[s+15],14,-660478335),i=Vo(i,r,o,n,t[s+4],20,-405537848),n=Vo(n,i,r,o,t[s+9],5,568446438),o=Vo(o,n,i,r,t[s+14],9,-1019803690),r=Vo(r,o,n,i,t[s+3],14,-187363961),i=Vo(i,r,o,n,t[s+8],20,1163531501),n=Vo(n,i,r,o,t[s+13],5,-1444681467),o=Vo(o,n,i,r,t[s+2],9,-51403784),r=Vo(r,o,n,i,t[s+7],14,1735328473),n=Go(n,i=Vo(i,r,o,n,t[s+12],20,-1926607734),r,o,t[s+5],4,-378558),o=Go(o,n,i,r,t[s+8],11,-2022574463),r=Go(r,o,n,i,t[s+11],16,1839030562),i=Go(i,r,o,n,t[s+14],23,-35309556),n=Go(n,i,r,o,t[s+1],4,-1530992060),o=Go(o,n,i,r,t[s+4],11,1272893353),r=Go(r,o,n,i,t[s+7],16,-155497632),i=Go(i,r,o,n,t[s+10],23,-1094730640),n=Go(n,i,r,o,t[s+13],4,681279174),o=Go(o,n,i,r,t[s],11,-358537222),r=Go(r,o,n,i,t[s+3],16,-722521979),i=Go(i,r,o,n,t[s+6],23,76029189),n=Go(n,i,r,o,t[s+9],4,-640364487),o=Go(o,n,i,r,t[s+12],11,-421815835),r=Go(r,o,n,i,t[s+15],16,530742520),n=Xo(n,i=Go(i,r,o,n,t[s+2],23,-995338651),r,o,t[s],6,-198630844),o=Xo(o,n,i,r,t[s+7],10,1126891415),r=Xo(r,o,n,i,t[s+14],15,-1416354905),i=Xo(i,r,o,n,t[s+5],21,-57434055),n=Xo(n,i,r,o,t[s+12],6,1700485571),o=Xo(o,n,i,r,t[s+3],10,-1894986606),r=Xo(r,o,n,i,t[s+10],15,-1051523),i=Xo(i,r,o,n,t[s+1],21,-2054922799),n=Xo(n,i,r,o,t[s+8],6,1873313359),o=Xo(o,n,i,r,t[s+15],10,-30611744),r=Xo(r,o,n,i,t[s+6],15,-1560198380),i=Xo(i,r,o,n,t[s+13],21,1309151649),n=Xo(n,i,r,o,t[s+4],6,-145523070),o=Xo(o,n,i,r,t[s+11],10,-1120210379),r=Xo(r,o,n,i,t[s+2],15,718787259),i=Xo(i,r,o,n,t[s+9],21,-343485551),n=zo(n,a),i=zo(i,u),r=zo(r,c),o=zo(o,l)}return[n,i,r,o]}(function(t){if(0===t.length)return[];for(var e=8*t.length,n=new Uint32Array(Ko(e)),i=0;i<e;i+=8)n[i>>5]|=(255&t[i/8])<<i%32;return n}(t),8*t.length))}function Ko(t){return 14+(t+64>>>9<<4)+1}function zo(t,e){var n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}function Wo(t,e,n,i,r,o){return zo((s=zo(zo(e,t),zo(i,o)))<<(a=r)|s>>>32-a,n);var s,a}function qo(t,e,n,i,r,o,s){return Wo(e&n|~e&i,t,e,r,o,s)}function Vo(t,e,n,i,r,o,s){return Wo(e&i|n&~i,t,e,r,o,s)}function Go(t,e,n,i,r,o,s){return Wo(e^n^i,t,e,r,o,s)}function Xo(t,e,n,i,r,o,s){return Wo(n^(e|~i),t,e,r,o,s)}var Yo,Zo,Qo,ts=Bt({"../node_modules/uuid/dist/esm-browser/md5.js"(){Jo=Ho}}),es=Bt({"../node_modules/uuid/dist/esm-browser/v3.js"(){$o(),ts(),Yo=Bo("v3",48,Jo),Zo=Yo}});function ns(t,e,n){var i=(t=t||{}).random||(t.rng||go)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,e){n=n||0;for(var r=0;r<16;++r)e[n+r]=i[r];return e}return So(i)}var is,rs=Bt({"../node_modules/uuid/dist/esm-browser/v4.js"(){bo(),To(),Qo=ns}});function os(t,e,n,i){switch(t){case 0:return e&n^~e&i;case 1:return e^n^i;case 2:return e&n^e&i^n&i;case 3:return e^n^i}}function ss(t,e){return t<<e|t>>>32-e}function as(t){var e=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof t){var i=unescape(encodeURIComponent(t));t=[];for(var r=0;r<i.length;++r)t.push(i.charCodeAt(r))}else Array.isArray(t)||(t=Array.prototype.slice.call(t));t.push(128);for(var o=Math.ceil((t.length/4+2)/16),s=new Array(o),a=0;a<o;++a){for(var u=new Uint32Array(16),c=0;c<16;++c)u[c]=t[64*a+4*c]<<24|t[64*a+4*c+1]<<16|t[64*a+4*c+2]<<8|t[64*a+4*c+3];s[a]=u}s[o-1][14]=8*(t.length-1)/Math.pow(2,32),s[o-1][14]=Math.floor(s[o-1][14]),s[o-1][15]=8*(t.length-1)&4294967295;for(var l=0;l<o;++l){for(var h=new Uint32Array(80),d=0;d<16;++d)h[d]=s[l][d];for(var f=16;f<80;++f)h[f]=ss(h[f-3]^h[f-8]^h[f-14]^h[f-16],1);for(var p=n[0],v=n[1],g=n[2],m=n[3],w=n[4],b=0;b<80;++b){var y=Math.floor(b/20),x=ss(p,5)+os(y,v,g,m)+w+e[y]+h[b]>>>0;w=m,m=g,g=ss(v,30)>>>0,v=p,p=x}n[0]=n[0]+p>>>0,n[1]=n[1]+v>>>0,n[2]=n[2]+g>>>0,n[3]=n[3]+m>>>0,n[4]=n[4]+w>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]}var us,cs,ls,hs,ds=Bt({"../node_modules/uuid/dist/esm-browser/sha1.js"(){is=as}}),fs=Bt({"../node_modules/uuid/dist/esm-browser/v5.js"(){$o(),ds(),us=Bo("v5",80,is),cs=us}}),ps=Bt({"../node_modules/uuid/dist/esm-browser/nil.js"(){ls="00000000-0000-0000-0000-000000000000"}});function vs(t){if(!wo(t))throw TypeError("Invalid UUID");return parseInt(t.substr(14,1),16)}var gs=Bt({"../node_modules/uuid/dist/esm-browser/version.js"(){Fo(),hs=vs}}),ms={};$t(ms,{NIL:()=>ls,parse:()=>No,stringify:()=>So,v1:()=>Io,v3:()=>Zo,v4:()=>Qo,v5:()=>cs,validate:()=>wo,version:()=>hs});var ws=Bt({"../node_modules/uuid/dist/esm-browser/index.js"(){Po(),es(),rs(),fs(),ps(),gs(),Fo(),To(),Lo()}}),bs=Jt({"../node_modules/@inrupt/solid-client-authn-core/dist/authenticatedFetch/dpopUtils.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.generateDpopKeyPair=t.createDpopHeader=void 0;var e=(ro(),zt(eo)),n=(ws(),zt(ms)),i=Vt();function r(t){const e=new URL(t);return new URL(e.pathname,e.origin).toString()}t.createDpopHeader=async function(t,o,s){return new e.SignJWT({htu:r(t),htm:o.toUpperCase(),jti:(0,n.v4)()}).setProtectedHeader({alg:i.PREFERRED_SIGNING_ALG[0],jwk:s.publicKey,typ:"dpop+jwt"}).setIssuedAt().sign(s.privateKey,{})},t.generateDpopKeyPair=async function(){const{privateKey:t,publicKey:n}=await(0,e.generateKeyPair)(i.PREFERRED_SIGNING_ALG[0]),r={privateKey:t,publicKey:await(0,e.exportJWK)(n)};return[r.publicKey.alg]=i.PREFERRED_SIGNING_ALG,r}}}),ys=Jt({"../node_modules/@inrupt/solid-client-authn-core/dist/authenticatedFetch/fetchFactory.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.buildAuthenticatedFetch=t.DEFAULT_EXPIRATION_TIME_SECONDS=void 0;var e=Yt(),n=Vt(),i=bs(),r=vo(),o=po();async function s(t,n,r,o,s){return t(r,await async function(t,n,r,o){if(void 0!==r)return async function(t,n,r,o){var s;const a=new e.Headers(null==o?void 0:o.headers);return a.set("Authorization",`DPoP ${n}`),a.set("DPoP",await(0,i.createDpopHeader)(t,null!==(s=null==o?void 0:o.method)&&void 0!==s?s:"get",r)),{...o,headers:a}}(t,n,r,o);const s=new e.Headers(null==o?void 0:o.headers);return s.set("Authorization",`Bearer ${n}`),{...o,headers:s}}(r.toString(),n,s,o))}t.DEFAULT_EXPIRATION_TIME_SECONDS=600;var a=e=>void 0!==e?e-n.REFRESH_BEFORE_EXPIRATION_SECONDS>0?e-n.REFRESH_BEFORE_EXPIRATION_SECONDS:e:t.DEFAULT_EXPIRATION_TIME_SECONDS;t.buildAuthenticatedFetch=async function(e,i,u){var c;let l,h=i;const d=null==u?void 0:u.refreshOptions;if(void 0!==d){const e=async()=>{var i,s,c,f;try{const{accessToken:r,refreshToken:o,expiresIn:s}=await async function(e,i,r){var o;const s=await e.tokenRefresher.refresh(e.sessionId,e.refreshToken,i);return null==r||r.emit(n.EVENTS.SESSION_EXTENDED,null!==(o=s.expiresIn)&&void 0!==o?o:t.DEFAULT_EXPIRATION_TIME_SECONDS),"string"==typeof s.refreshToken&&(null==r||r.emit(n.EVENTS.NEW_REFRESH_TOKEN,s.refreshToken)),{accessToken:s.accessToken,refreshToken:s.refreshToken,expiresIn:s.expiresIn}}(d,u.dpopKey,u.eventEmitter);h=r,void 0!==o&&(d.refreshToken=o),clearTimeout(l),l=setTimeout(e,1e3*a(s)),null===(i=u.eventEmitter)||void 0===i||i.emit(n.EVENTS.TIMEOUT_SET,l)}catch(t){t instanceof r.OidcProviderError&&(null===(s=null==u?void 0:u.eventEmitter)||void 0===s||s.emit(n.EVENTS.ERROR,t.error,t.errorDescription),null===(c=null==u?void 0:u.eventEmitter)||void 0===c||c.emit(n.EVENTS.SESSION_EXPIRED)),t instanceof o.InvalidResponseError&&t.missingFields.includes("access_token")&&(null===(f=null==u?void 0:u.eventEmitter)||void 0===f||f.emit(n.EVENTS.SESSION_EXPIRED))}};l=setTimeout(e,1e3*a(u.expiresIn)),null===(c=u.eventEmitter)||void 0===c||c.emit(n.EVENTS.TIMEOUT_SET,l)}else if(void 0!==u&&void 0!==u.eventEmitter){const t=setTimeout((()=>{u.eventEmitter.emit(n.EVENTS.SESSION_EXPIRED)}),1e3*a(u.expiresIn));u.eventEmitter.emit(n.EVENTS.TIMEOUT_SET,t)}return async(t,n)=>{let i=await s(e,h,t,n,null==u?void 0:u.dpopKey);const r=!i.ok&&![401,403].includes(i.status);return i.ok||r||i.url!==t&&void 0!==(null==u?void 0:u.dpopKey)&&(i=await s(e,h,i.url,n,u.dpopKey)),i}}}}),xs=Jt({"../node_modules/@inrupt/solid-client-authn-core/dist/storage/__mocks__/StorageUtility.js"(t){var e=t&&t.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(t,"__esModule",{value:!0}),t.mockStorageUtility=t.mockStorage=t.StorageUtilityMock=t.StorageUtilityGetResponse=void 0;var n=e(co());t.StorageUtilityGetResponse="getResponse",t.StorageUtilityMock={get:async()=>t.StorageUtilityGetResponse,set:async()=>{},delete:async()=>{},getForUser:async()=>t.StorageUtilityGetResponse,setForUser:async()=>{},deleteForUser:async()=>{},deleteAllUserData:async()=>{}},t.mockStorage=t=>{const e=t;return{get:async t=>{if(void 0!==e[t])return"string"==typeof e[t]?e[t]:JSON.stringify(e[t])},set:async(t,n)=>{e[t]=n},delete:async t=>{delete e[t]}}},t.mockStorageUtility=(e,i=!1)=>i?new n.default((0,t.mockStorage)(e),(0,t.mockStorage)({})):new n.default((0,t.mockStorage)({}),(0,t.mockStorage)(e))}}),ks=Jt({"../node_modules/@inrupt/solid-client-authn-core/dist/index.js"(t){var e=t&&t.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(e,n);r&&!("get"in r?!e.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,r)}:function(t,e,n,i){void 0===i&&(i=n),t[i]=e[n]}),n=t&&t.__exportStar||function(t,n){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(n,i)||e(n,t,i)},i=t&&t.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(t,"__esModule",{value:!0}),t.StorageUtilityGetResponse=t.StorageUtilityMock=t.mockStorageUtility=t.mockStorage=t.buildAuthenticatedFetch=t.generateDpopKeyPair=t.createDpopHeader=t.OidcProviderError=t.InvalidResponseError=t.NotImplementedError=t.ConfigurationError=t.InMemoryStorage=t.getSessionIdFromOauthState=t.saveSessionInfoToStorage=t.loadOidcContextFromStorage=t.StorageUtility=t.determineSigningAlg=t.handleRegistration=t.USER_SESSION_PREFIX=t.isSupportedTokenType=t.fetchJwks=t.getWebidFromTokenPayload=t.AggregateHandler=void 0,n(Vt(),t);var r=Xt();Object.defineProperty(t,"AggregateHandler",{enumerable:!0,get:function(){return i(r).default}});var o=oo();Object.defineProperty(t,"getWebidFromTokenPayload",{enumerable:!0,get:function(){return o.getWebidFromTokenPayload}}),Object.defineProperty(t,"fetchJwks",{enumerable:!0,get:function(){return o.fetchJwks}});var s=so();Object.defineProperty(t,"isSupportedTokenType",{enumerable:!0,get:function(){return s.isSupportedTokenType}});var a=ao();Object.defineProperty(t,"USER_SESSION_PREFIX",{enumerable:!0,get:function(){return a.USER_SESSION_PREFIX}});var u=uo();Object.defineProperty(t,"handleRegistration",{enumerable:!0,get:function(){return u.handleRegistration}}),Object.defineProperty(t,"determineSigningAlg",{enumerable:!0,get:function(){return u.determineSigningAlg}});var c=co();Object.defineProperty(t,"StorageUtility",{enumerable:!0,get:function(){return i(c).default}}),Object.defineProperty(t,"loadOidcContextFromStorage",{enumerable:!0,get:function(){return c.loadOidcContextFromStorage}}),Object.defineProperty(t,"saveSessionInfoToStorage",{enumerable:!0,get:function(){return c.saveSessionInfoToStorage}}),Object.defineProperty(t,"getSessionIdFromOauthState",{enumerable:!0,get:function(){return c.getSessionIdFromOauthState}});var l=lo();Object.defineProperty(t,"InMemoryStorage",{enumerable:!0,get:function(){return i(l).default}});var h=ho();Object.defineProperty(t,"ConfigurationError",{enumerable:!0,get:function(){return i(h).default}});var d=fo();Object.defineProperty(t,"NotImplementedError",{enumerable:!0,get:function(){return i(d).default}});var f=po();Object.defineProperty(t,"InvalidResponseError",{enumerable:!0,get:function(){return f.InvalidResponseError}});var p=vo();Object.defineProperty(t,"OidcProviderError",{enumerable:!0,get:function(){return p.OidcProviderError}});var v=bs();Object.defineProperty(t,"createDpopHeader",{enumerable:!0,get:function(){return v.createDpopHeader}}),Object.defineProperty(t,"generateDpopKeyPair",{enumerable:!0,get:function(){return v.generateDpopKeyPair}});var g=ys();Object.defineProperty(t,"buildAuthenticatedFetch",{enumerable:!0,get:function(){return g.buildAuthenticatedFetch}});var m=xs();Object.defineProperty(t,"mockStorage",{enumerable:!0,get:function(){return m.mockStorage}}),Object.defineProperty(t,"mockStorageUtility",{enumerable:!0,get:function(){return m.mockStorageUtility}}),Object.defineProperty(t,"StorageUtilityMock",{enumerable:!0,get:function(){return m.StorageUtilityMock}}),Object.defineProperty(t,"StorageUtilityGetResponse",{enumerable:!0,get:function(){return m.StorageUtilityGetResponse}})}}),Es=Jt({"../node_modules/@inrupt/solid-client-authn-browser/dist/storage/StorageUtility.js"(t){Object.defineProperty(t,"__esModule",{value:!0});var e=ks();t.default=class extends e.StorageUtility{constructor(t,e){super(t,e)}}}}),Ss=Jt({"../node_modules/@inrupt/oidc-client/lib/oidc-client.min.js"(t,e){!function(n,i){if("object"==typeof t&&"object"==typeof e)e.exports=i();else if("function"==typeof define&&define.amd)define([],i);else{var r=i();for(var o in r)("object"==typeof t?t:n)[o]=r[o]}}(t,(function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=22)}([function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),i={debug:function(){},info:function(){},warn:function(){},error:function(){}},r=void 0,o=void 0;(e.Log=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return t.reset=function(){o=3,r=i},t.debug=function(){if(o>=4){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];r.debug.apply(r,Array.from(e))}},t.info=function(){if(o>=3){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];r.info.apply(r,Array.from(e))}},t.warn=function(){if(o>=2){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];r.warn.apply(r,Array.from(e))}},t.error=function(){if(o>=1){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];r.error.apply(r,Array.from(e))}},n(t,null,[{key:"NONE",get:function(){return 0}},{key:"ERROR",get:function(){return 1}},{key:"WARN",get:function(){return 2}},{key:"INFO",get:function(){return 3}},{key:"DEBUG",get:function(){return 4}},{key:"level",get:function(){return o},set:function(t){if(!(0<=t&&t<=4))throw new Error("Invalid log level");o=t}},{key:"logger",get:function(){return r},set:function(t){if(!t.debug&&t.info&&(t.debug=t.info),!(t.debug&&t.info&&t.warn&&t.error))throw new Error("Invalid logger");r=t}}]),t}()).reset()},function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),i={setInterval:function(t){function e(e,n){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(t,e){return setInterval(t,e)})),clearInterval:function(t){function e(e){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}((function(t){return clearInterval(t)}))},r=!1,o=null;e.Global=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return t._testing=function(){r=!0},t.setXMLHttpRequest=function(t){o=t},n(t,null,[{key:"location",get:function(){if(!r)return location}},{key:"localStorage",get:function(){if(!r&&"undefined"!=typeof window)return localStorage}},{key:"sessionStorage",get:function(){if(!r&&"undefined"!=typeof window)return sessionStorage}},{key:"XMLHttpRequest",get:function(){if(!r&&"undefined"!=typeof window)return o||XMLHttpRequest}},{key:"timer",get:function(){if(!r)return i}}]),t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.MetadataService=void 0;var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),r=n(0),o=n(7);function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var a=".well-known/openid-configuration";e.MetadataService=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.JsonService;if(s(this,t),!e)throw r.Log.error("MetadataService: No settings passed to MetadataService"),new Error("settings");this._settings=e,this._jsonService=new n(["application/jwk-set+json"])}return t.prototype.resetSigningKeys=function(){this._settings=this._settings||{},this._settings.signingKeys=void 0},t.prototype.getMetadata=function(){var t=this;return this._settings.metadata?(r.Log.debug("MetadataService.getMetadata: Returning metadata from settings"),Promise.resolve(this._settings.metadata)):this.metadataUrl?(r.Log.debug("MetadataService.getMetadata: getting metadata from",this.metadataUrl),this._jsonService.getJson(this.metadataUrl).then((function(e){return r.Log.debug("MetadataService.getMetadata: json received"),t._settings.metadata=Object.assign({},t._settings.metadataSeed||{},e),t._settings.metadata}))):(r.Log.error("MetadataService.getMetadata: No authority or metadataUrl configured on settings"),Promise.reject(new Error("No authority or metadataUrl configured on settings")))},t.prototype.getIssuer=function(){return this._getMetadataProperty("issuer")},t.prototype.getAuthorizationEndpoint=function(){return this._getMetadataProperty("authorization_endpoint")},t.prototype.getUserInfoEndpoint=function(){return this._getMetadataProperty("userinfo_endpoint")},t.prototype.getTokenEndpoint=function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._getMetadataProperty("token_endpoint",t)},t.prototype.getCheckSessionIframe=function(){return this._getMetadataProperty("check_session_iframe",!0)},t.prototype.getEndSessionEndpoint=function(){return this._getMetadataProperty("end_session_endpoint",!0)},t.prototype.getRevocationEndpoint=function(){return this._getMetadataProperty("revocation_endpoint",!0)},t.prototype.getKeysEndpoint=function(){return this._getMetadataProperty("jwks_uri",!0)},t.prototype._getMetadataProperty=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return r.Log.debug("MetadataService.getMetadataProperty for: "+t),this.getMetadata().then((function(n){if(r.Log.debug("MetadataService.getMetadataProperty: metadata recieved"),void 0===n[t]){if(!0===e)return void r.Log.warn("MetadataService.getMetadataProperty: Metadata does not contain optional property "+t);throw r.Log.error("MetadataService.getMetadataProperty: Metadata does not contain property "+t),new Error("Metadata does not contain property "+t)}return n[t]}))},t.prototype.getSigningKeys=function(){var t=this;return this._settings.signingKeys?(r.Log.debug("MetadataService.getSigningKeys: Returning signingKeys from settings"),Promise.resolve(this._settings.signingKeys)):this._getMetadataProperty("jwks_uri").then((function(e){return r.Log.debug("MetadataService.getSigningKeys: jwks_uri received",e),t._jsonService.getJson(e).then((function(e){if(r.Log.debug("MetadataService.getSigningKeys: key set received",e),!e.keys)throw r.Log.error("MetadataService.getSigningKeys: Missing keys on keyset"),new Error("Missing keys on keyset");return t._settings.signingKeys=e.keys,t._settings.signingKeys}))}))},i(t,[{key:"metadataUrl",get:function(){return this._metadataUrl||(this._settings.metadataUrl?this._metadataUrl=this._settings.metadataUrl:(this._metadataUrl=this._settings.authority,this._metadataUrl&&this._metadataUrl.indexOf(a)<0&&("/"!==this._metadataUrl[this._metadataUrl.length-1]&&(this._metadataUrl+="/"),this._metadataUrl+=a))),this._metadataUrl}}]),t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.UrlUtility=void 0;var i=n(0),r=n(1);e.UrlUtility=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return t.addQueryParam=function(t,e,n){return t.indexOf("?")<0&&(t+="?"),"?"!==t[t.length-1]&&(t+="&"),t+=encodeURIComponent(e),(t+="=")+encodeURIComponent(n)},t.parseUrlFragment=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"#",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:r.Global;"string"!=typeof t&&(t=n.location.href);var o=t.lastIndexOf(e);o>=0&&(t=t.substr(o+1)),"?"===e&&(o=t.indexOf("#"))>=0&&(t=t.substr(0,o));for(var s,a={},u=/([^&=]+)=([^&]*)/g,c=0;s=u.exec(t);)if(a[decodeURIComponent(s[1])]=decodeURIComponent(s[2].replace(/\+/g," ")),c++>50)return i.Log.error("UrlUtility.parseUrlFragment: response exceeded expected number of parameters",t),{error:"Response exceeded expected number of parameters"};for(var l in a)return a;return{}},t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.JoseUtil=void 0;var i,r=n(26),o=(i=n(33))&&i.__esModule?i:{default:i};e.JoseUtil=(0,o.default)({jws:r.jws,KeyUtil:r.KeyUtil,X509:r.X509,crypto:r.crypto,hextob64u:r.hextob64u,b64tohex:r.b64tohex,AllowedSigningAlgs:r.AllowedSigningAlgs})},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.OidcClientSettings=void 0;var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=n(0),s=n(23),a=n(6),u=n(24),c=n(2);function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var h=".well-known/openid-configuration",d="id_token",f="openid",p="client_secret_post";e.OidcClientSettings=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.authority,r=e.metadataUrl,o=e.metadata,h=e.signingKeys,v=e.metadataSeed,g=e.client_id,m=e.client_secret,w=e.response_type,b=void 0===w?d:w,y=e.scope,x=void 0===y?f:y,k=e.redirect_uri,E=e.post_logout_redirect_uri,S=e.client_authentication,F=void 0===S?p:S,A=e.prompt,_=e.display,j=e.max_age,C=e.ui_locales,R=e.acr_values,I=e.resource,T=e.response_mode,O=e.filterProtocolClaims,N=void 0===O||O,P=e.loadUserInfo,D=void 0===P||P,M=e.staleStateAge,U=void 0===M?900:M,L=e.clockSkew,B=void 0===L?300:L,J=e.clockService,$=void 0===J?new s.ClockService:J,H=e.userInfoJwtIssuer,K=void 0===H?"OP":H,z=e.mergeClaims,W=void 0!==z&&z,q=e.stateStore,V=void 0===q?new a.WebStorageStateStore:q,G=e.ResponseValidatorCtor,X=void 0===G?u.ResponseValidator:G,Y=e.MetadataServiceCtor,Z=void 0===Y?c.MetadataService:Y,Q=e.extraQueryParams,tt=void 0===Q?{}:Q,et=e.extraTokenParams,nt=void 0===et?{}:et;l(this,t),this._authority=n,this._metadataUrl=r,this._metadata=o,this._metadataSeed=v,this._signingKeys=h,this._client_id=g,this._client_secret=m,this._response_type=b,this._scope=x,this._redirect_uri=k,this._post_logout_redirect_uri=E,this._client_authentication=F,this._prompt=A,this._display=_,this._max_age=j,this._ui_locales=C,this._acr_values=R,this._resource=I,this._response_mode=T,this._filterProtocolClaims=!!N,this._loadUserInfo=!!D,this._staleStateAge=U,this._clockSkew=B,this._clockService=$,this._userInfoJwtIssuer=K,this._mergeClaims=!!W,this._stateStore=V,this._validator=new X(this),this._metadataService=new Z(this),this._extraQueryParams="object"===(void 0===tt?"undefined":i(tt))?tt:{},this._extraTokenParams="object"===(void 0===nt?"undefined":i(nt))?nt:{}}return t.prototype.getEpochTime=function(){return this._clockService.getEpochTime()},r(t,[{key:"client_id",get:function(){return this._client_id},set:function(t){if(this._client_id)throw o.Log.error("OidcClientSettings.set_client_id: client_id has already been assigned."),new Error("client_id has already been assigned.");this._client_id=t}},{key:"client_secret",get:function(){return this._client_secret}},{key:"response_type",get:function(){return this._response_type}},{key:"scope",get:function(){return this._scope}},{key:"redirect_uri",get:function(){return this._redirect_uri}},{key:"post_logout_redirect_uri",get:function(){return this._post_logout_redirect_uri}},{key:"client_authentication",get:function(){return this._client_authentication}},{key:"prompt",get:function(){return this._prompt}},{key:"display",get:function(){return this._display}},{key:"max_age",get:function(){return this._max_age}},{key:"ui_locales",get:function(){return this._ui_locales}},{key:"acr_values",get:function(){return this._acr_values}},{key:"resource",get:function(){return this._resource}},{key:"response_mode",get:function(){return this._response_mode}},{key:"authority",get:function(){return this._authority},set:function(t){if(this._authority)throw o.Log.error("OidcClientSettings.set_authority: authority has already been assigned."),new Error("authority has already been assigned.");this._authority=t}},{key:"metadataUrl",get:function(){return this._metadataUrl||(this._metadataUrl=this.authority,this._metadataUrl&&this._metadataUrl.indexOf(h)<0&&("/"!==this._metadataUrl[this._metadataUrl.length-1]&&(this._metadataUrl+="/"),this._metadataUrl+=h)),this._metadataUrl}},{key:"metadata",get:function(){return this._metadata},set:function(t){this._metadata=t}},{key:"metadataSeed",get:function(){return this._metadataSeed},set:function(t){this._metadataSeed=t}},{key:"signingKeys",get:function(){return this._signingKeys},set:function(t){this._signingKeys=t}},{key:"filterProtocolClaims",get:function(){return this._filterProtocolClaims}},{key:"loadUserInfo",get:function(){return this._loadUserInfo}},{key:"staleStateAge",get:function(){return this._staleStateAge}},{key:"clockSkew",get:function(){return this._clockSkew}},{key:"userInfoJwtIssuer",get:function(){return this._userInfoJwtIssuer}},{key:"mergeClaims",get:function(){return this._mergeClaims}},{key:"stateStore",get:function(){return this._stateStore}},{key:"validator",get:function(){return this._validator}},{key:"metadataService",get:function(){return this._metadataService}},{key:"extraQueryParams",get:function(){return this._extraQueryParams},set:function(t){this._extraQueryParams="object"===(void 0===t?"undefined":i(t))?t:{}}},{key:"extraTokenParams",get:function(){return this._extraTokenParams},set:function(t){this._extraTokenParams="object"===(void 0===t?"undefined":i(t))?t:{}}}]),t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.WebStorageStateStore=void 0;var i=n(0),r=n(1);function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.WebStorageStateStore=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.prefix,i=void 0===n?"oidc.":n,s=e.store,a=void 0===s?r.Global.localStorage:s;o(this,t),this._store=a,this._prefix=i}return t.prototype.set=function(t,e){return i.Log.debug("WebStorageStateStore.set",t),this._store.setItem(t=this._prefix+t,e),Promise.resolve()},t.prototype.get=function(t){i.Log.debug("WebStorageStateStore.get",t);var e=this._store.getItem(t=this._prefix+t);return Promise.resolve(e)},t.prototype.remove=function(t){i.Log.debug("WebStorageStateStore.remove",t);var e=this._store.getItem(t=this._prefix+t);return this._store.removeItem(t),Promise.resolve(e)},t.prototype.getAllKeys=function(){i.Log.debug("WebStorageStateStore.getAllKeys");for(var t=[],e=0;e<this._store.length;e++){var n=this._store.key(e);0===n.indexOf(this._prefix)&&t.push(n.substr(this._prefix.length))}return Promise.resolve(t)},t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.JsonService=void 0;var i=n(0),r=n(1);function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.JsonService=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.Global.XMLHttpRequest,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;o(this,t),this._contentTypes=e&&Array.isArray(e)?e.slice():[],this._contentTypes.push("application/json"),i&&this._contentTypes.push("application/jwt"),this._XMLHttpRequest=n,this._jwtHandler=i}return t.prototype.getJson=function(t,e){var n=this;if(!t)throw i.Log.error("JsonService.getJson: No url passed"),new Error("url");return i.Log.debug("JsonService.getJson, url: ",t),new Promise((function(r,o){var s=new n._XMLHttpRequest;s.open("GET",t);var a=n._contentTypes,u=n._jwtHandler;s.onload=function(){if(i.Log.debug("JsonService.getJson: HTTP response received, status",s.status),200===s.status){var e=s.getResponseHeader("Content-Type");if(e){var n=a.find((function(t){if(e.startsWith(t))return!0}));if("application/jwt"==n)return void u(s).then(r,o);if(n)try{return void r(JSON.parse(s.responseText))}catch(t){return i.Log.error("JsonService.getJson: Error parsing JSON response",t.message),void o(t)}}o(Error("Invalid response Content-Type: "+e+", from URL: "+t))}else o(Error(s.statusText+" ("+s.status+")"))},s.onerror=function(){i.Log.error("JsonService.getJson: network error"),o(Error("Network Error"))},e&&(i.Log.debug("JsonService.getJson: token passed, setting Authorization header"),s.setRequestHeader("Authorization","Bearer "+e)),s.send()}))},t.prototype.postForm=function(t,e,n){var r=this;if(!t)throw i.Log.error("JsonService.postForm: No url passed"),new Error("url");return i.Log.debug("JsonService.postForm, url: ",t),new Promise((function(o,s){var a=new r._XMLHttpRequest;a.open("POST",t);var u=r._contentTypes;a.onload=function(){if(i.Log.debug("JsonService.postForm: HTTP response received, status",a.status),200!==a.status){if(400===a.status&&(n=a.getResponseHeader("Content-Type"))&&u.find((function(t){if(n.startsWith(t))return!0})))try{var e=JSON.parse(a.responseText);if(e&&e.error)return i.Log.error("JsonService.postForm: Error from server: ",e.error),void s(new Error(e.error))}catch(t){return i.Log.error("JsonService.postForm: Error parsing JSON response",t.message),void s(t)}s(Error(a.statusText+" ("+a.status+")"))}else{var n;if((n=a.getResponseHeader("Content-Type"))&&u.find((function(t){if(n.startsWith(t))return!0})))try{return void o(JSON.parse(a.responseText))}catch(t){return i.Log.error("JsonService.postForm: Error parsing JSON response",t.message),void s(t)}s(Error("Invalid response Content-Type: "+n+", from URL: "+t))}},a.onerror=function(){i.Log.error("JsonService.postForm: network error"),s(Error("Network Error"))};var c="";for(var l in e){var h=e[l];h&&(c.length>0&&(c+="&"),c+=encodeURIComponent(l),c+="=",c+=encodeURIComponent(h))}a.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),void 0!==n&&a.setRequestHeader("Authorization","Basic "+btoa(n)),a.send(c)}))},t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.SigninRequest=void 0;var i=n(0),r=n(3),o=n(13);e.SigninRequest=function(){function t(e){var n=e.url,s=e.client_id,a=e.redirect_uri,u=e.response_type,c=e.scope,l=e.authority,h=e.data,d=e.prompt,f=e.display,p=e.max_age,v=e.ui_locales,g=e.id_token_hint,m=e.login_hint,w=e.acr_values,b=e.resource,y=e.response_mode,x=e.request,k=e.request_uri,E=e.extraQueryParams,S=e.request_type,F=e.client_secret,A=e.extraTokenParams,_=e.skipUserInfo;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!n)throw i.Log.error("SigninRequest.ctor: No url passed"),new Error("url");if(!s)throw i.Log.error("SigninRequest.ctor: No client_id passed"),new Error("client_id");if(!a)throw i.Log.error("SigninRequest.ctor: No redirect_uri passed"),new Error("redirect_uri");if(!u)throw i.Log.error("SigninRequest.ctor: No response_type passed"),new Error("response_type");if(!c)throw i.Log.error("SigninRequest.ctor: No scope passed"),new Error("scope");if(!l)throw i.Log.error("SigninRequest.ctor: No authority passed"),new Error("authority");var j=t.isOidc(u),C=t.isCode(u);y||(y=t.isCode(u)?"query":null),this.state=new o.SigninState({nonce:j,data:h,client_id:s,authority:l,redirect_uri:a,code_verifier:C,request_type:S,response_mode:y,client_secret:F,scope:c,extraTokenParams:A,skipUserInfo:_}),n=r.UrlUtility.addQueryParam(n,"client_id",s),n=r.UrlUtility.addQueryParam(n,"redirect_uri",a),n=r.UrlUtility.addQueryParam(n,"response_type",u),n=r.UrlUtility.addQueryParam(n,"scope",c),n=r.UrlUtility.addQueryParam(n,"state",this.state.id),j&&(n=r.UrlUtility.addQueryParam(n,"nonce",this.state.nonce)),C&&(n=r.UrlUtility.addQueryParam(n,"code_challenge",this.state.code_challenge),n=r.UrlUtility.addQueryParam(n,"code_challenge_method","S256"));var R={prompt:d,display:f,max_age:p,ui_locales:v,id_token_hint:g,login_hint:m,acr_values:w,resource:b,request:x,request_uri:k,response_mode:y};for(var I in R)R[I]&&(n=r.UrlUtility.addQueryParam(n,I,R[I]));for(var T in E)n=r.UrlUtility.addQueryParam(n,T,E[T]);this.url=n}return t.isOidc=function(t){return!!t.split(/\s+/g).filter((function(t){return"id_token"===t}))[0]},t.isOAuth=function(t){return!!t.split(/\s+/g).filter((function(t){return"token"===t}))[0]},t.isCode=function(t){return!!t.split(/\s+/g).filter((function(t){return"code"===t}))[0]},t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.State=void 0;var i,r=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=n(0),s=(i=n(14))&&i.__esModule?i:{default:i};function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.State=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.id,i=e.data,r=e.created,o=e.request_type;a(this,t),this._id=n||(0,s.default)(),this._data=i,this._created="number"==typeof r&&r>0?r:parseInt(Date.now()/1e3),this._request_type=o}return t.prototype.toStorageString=function(){return o.Log.debug("State.toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type})},t.fromStorageString=function(e){return o.Log.debug("State.fromStorageString"),new t(JSON.parse(e))},t.clearStaleState=function(e,n){var i=Date.now()/1e3-n;return e.getAllKeys().then((function(n){o.Log.debug("State.clearStaleState: got keys",n);for(var r=[],s=function(s){var a=n[s];u=e.get(a).then((function(n){var r=!1;if(n)try{var s=t.fromStorageString(n);o.Log.debug("State.clearStaleState: got item from key: ",a,s.created),s.created<=i&&(r=!0)}catch(t){o.Log.error("State.clearStaleState: Error parsing state for key",a,t.message),r=!0}else o.Log.debug("State.clearStaleState: no item in storage for key: ",a),r=!0;if(r)return o.Log.debug("State.clearStaleState: removed item for key: ",a),e.remove(a)})),r.push(u)},a=0;a<n.length;a++){var u;s(a)}return o.Log.debug("State.clearStaleState: waiting on promise count:",r.length),Promise.all(r)}))},r(t,[{key:"id",get:function(){return this._id}},{key:"data",get:function(){return this._data}},{key:"created",get:function(){return this._created}},{key:"request_type",get:function(){return this._request_type}}]),t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.OidcClient=void 0;var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),r=n(0),o=n(5),s=n(12),a=n(8),u=n(34),c=n(35),l=n(36),h=n(13),d=n(9);function f(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.OidcClient=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};f(this,t),this._settings=e instanceof o.OidcClientSettings?e:new o.OidcClientSettings(e)}return t.prototype.createSigninRequest=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.response_type,i=e.scope,o=e.redirect_uri,s=e.data,u=e.state,c=e.prompt,l=e.display,h=e.max_age,d=e.ui_locales,f=e.id_token_hint,p=e.login_hint,v=e.acr_values,g=e.resource,m=e.request,w=e.request_uri,b=e.response_mode,y=e.extraQueryParams,x=e.extraTokenParams,k=e.request_type,E=e.skipUserInfo,S=arguments[1];r.Log.debug("OidcClient.createSigninRequest");var F=this._settings.client_id;i=i||this._settings.scope,o=o||this._settings.redirect_uri,c=c||this._settings.prompt,l=l||this._settings.display,h=h||this._settings.max_age,d=d||this._settings.ui_locales,v=v||this._settings.acr_values,g=g||this._settings.resource,b=b||this._settings.response_mode,y=y||this._settings.extraQueryParams,x=x||this._settings.extraTokenParams;var A=this._settings.authority;return a.SigninRequest.isCode(n=n||this._settings.response_type)&&"code"!==n?Promise.reject(new Error("OpenID Connect hybrid flow is not supported")):this._metadataService.getAuthorizationEndpoint().then((function(e){r.Log.debug("OidcClient.createSigninRequest: Received authorization endpoint",e);var _=new a.SigninRequest({url:e,client_id:F,redirect_uri:o,response_type:n,scope:i,data:s||u,authority:A,prompt:c,display:l,max_age:h,ui_locales:d,id_token_hint:f,login_hint:p,acr_values:v,resource:g,request:m,request_uri:w,extraQueryParams:y,extraTokenParams:x,request_type:k,response_mode:b,client_secret:t._settings.client_secret,skipUserInfo:E}),j=_.state;return(S=S||t._stateStore).set(j.id,j.toStorageString()).then((function(){return _}))}))},t.prototype.readSigninResponseState=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];r.Log.debug("OidcClient.readSigninResponseState");var i="query"===this._settings.response_mode||!this._settings.response_mode&&a.SigninRequest.isCode(this._settings.response_type),o=i?"?":"#",s=new u.SigninResponse(t,o);if(!s.state)return r.Log.error("OidcClient.readSigninResponseState: No state in response"),Promise.reject(new Error("No state in response"));e=e||this._stateStore;var c=n?e.remove.bind(e):e.get.bind(e);return c(s.state).then((function(t){if(!t)throw r.Log.error("OidcClient.readSigninResponseState: No matching state found in storage"),new Error("No matching state found in storage");return{state:h.SigninState.fromStorageString(t),response:s}}))},t.prototype.processSigninResponse=function(t,e){var n=this;return r.Log.debug("OidcClient.processSigninResponse"),this.readSigninResponseState(t,e,!0).then((function(t){var e=t.state,i=t.response;return r.Log.debug("OidcClient.processSigninResponse: Received state from storage; validating response"),n._validator.validateSigninResponse(e,i)}))},t.prototype.createSignoutRequest=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.id_token_hint,i=e.data,o=e.state,s=e.post_logout_redirect_uri,a=e.extraQueryParams,u=e.request_type,l=arguments[1];return r.Log.debug("OidcClient.createSignoutRequest"),s=s||this._settings.post_logout_redirect_uri,a=a||this._settings.extraQueryParams,this._metadataService.getEndSessionEndpoint().then((function(e){if(!e)throw r.Log.error("OidcClient.createSignoutRequest: No end session endpoint url returned"),new Error("no end session endpoint");r.Log.debug("OidcClient.createSignoutRequest: Received end session endpoint",e);var h=new c.SignoutRequest({url:e,id_token_hint:n,post_logout_redirect_uri:s,data:i||o,extraQueryParams:a,request_type:u}),d=h.state;return d&&(r.Log.debug("OidcClient.createSignoutRequest: Signout request has state to persist"),(l=l||t._stateStore).set(d.id,d.toStorageString())),h}))},t.prototype.readSignoutResponseState=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];r.Log.debug("OidcClient.readSignoutResponseState");var i=new l.SignoutResponse(t);if(!i.state)return r.Log.debug("OidcClient.readSignoutResponseState: No state in response"),i.error?(r.Log.warn("OidcClient.readSignoutResponseState: Response was error: ",i.error),Promise.reject(new s.ErrorResponse(i))):Promise.resolve({state:void 0,response:i});var o=i.state;e=e||this._stateStore;var a=n?e.remove.bind(e):e.get.bind(e);return a(o).then((function(t){if(!t)throw r.Log.error("OidcClient.readSignoutResponseState: No matching state found in storage"),new Error("No matching state found in storage");return{state:d.State.fromStorageString(t),response:i}}))},t.prototype.processSignoutResponse=function(t,e){var n=this;return r.Log.debug("OidcClient.processSignoutResponse"),this.readSignoutResponseState(t,e,!0).then((function(t){var e=t.state,i=t.response;return e?(r.Log.debug("OidcClient.processSignoutResponse: Received state from storage; validating response"),n._validator.validateSignoutResponse(e,i)):(r.Log.debug("OidcClient.processSignoutResponse: No state from storage; skipping validating response"),i)}))},t.prototype.clearStaleState=function(t){return r.Log.debug("OidcClient.clearStaleState"),d.State.clearStaleState(t=t||this._stateStore,this.settings.staleStateAge)},i(t,[{key:"_stateStore",get:function(){return this.settings.stateStore}},{key:"_validator",get:function(){return this.settings.validator}},{key:"_metadataService",get:function(){return this.settings.metadataService}},{key:"settings",get:function(){return this._settings}},{key:"metadataService",get:function(){return this._metadataService}}]),t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.TokenClient=void 0;var i=n(7),r=n(2),o=n(0);function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.TokenClient=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i.JsonService,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:r.MetadataService;if(s(this,t),!e)throw o.Log.error("TokenClient.ctor: No settings passed"),new Error("settings");this._settings=e,this._jsonService=new n,this._metadataService=new a(this._settings)}return t.prototype.exchangeCode=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(e=Object.assign({},e)).grant_type=e.grant_type||"authorization_code",e.client_id=e.client_id||this._settings.client_id,e.client_secret=e.client_secret||this._settings.client_secret,e.redirect_uri=e.redirect_uri||this._settings.redirect_uri;var n=void 0,i=e._client_authentication||this._settings._client_authentication;return delete e._client_authentication,e.code?e.redirect_uri?e.code_verifier?e.client_id?e.client_secret||"client_secret_basic"!=i?("client_secret_basic"==i&&(n=e.client_id+":"+e.client_secret,delete e.client_id,delete e.client_secret),this._metadataService.getTokenEndpoint(!1).then((function(i){return o.Log.debug("TokenClient.exchangeCode: Received token endpoint"),t._jsonService.postForm(i,e,n).then((function(t){return o.Log.debug("TokenClient.exchangeCode: response received"),t}))}))):(o.Log.error("TokenClient.exchangeCode: No client_secret passed"),Promise.reject(new Error("A client_secret is required"))):(o.Log.error("TokenClient.exchangeCode: No client_id passed"),Promise.reject(new Error("A client_id is required"))):(o.Log.error("TokenClient.exchangeCode: No code_verifier passed"),Promise.reject(new Error("A code_verifier is required"))):(o.Log.error("TokenClient.exchangeCode: No redirect_uri passed"),Promise.reject(new Error("A redirect_uri is required"))):(o.Log.error("TokenClient.exchangeCode: No code passed"),Promise.reject(new Error("A code is required")))},t.prototype.exchangeRefreshToken=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(e=Object.assign({},e)).grant_type=e.grant_type||"refresh_token",e.client_id=e.client_id||this._settings.client_id,e.client_secret=e.client_secret||this._settings.client_secret;var n=void 0,i=e._client_authentication||this._settings._client_authentication;return delete e._client_authentication,e.refresh_token?e.client_id?("client_secret_basic"==i&&(n=e.client_id+":"+e.client_secret,delete e.client_id,delete e.client_secret),this._metadataService.getTokenEndpoint(!1).then((function(i){return o.Log.debug("TokenClient.exchangeRefreshToken: Received token endpoint"),t._jsonService.postForm(i,e,n).then((function(t){return o.Log.debug("TokenClient.exchangeRefreshToken: response received"),t}))}))):(o.Log.error("TokenClient.exchangeRefreshToken: No client_id passed"),Promise.reject(new Error("A client_id is required"))):(o.Log.error("TokenClient.exchangeRefreshToken: No refresh_token passed"),Promise.reject(new Error("A refresh_token is required")))},t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.ErrorResponse=void 0;var i=n(0);function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}e.ErrorResponse=function(t){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=n.error,a=n.error_description,u=n.error_uri,c=n.state,l=n.session_state;if(r(this,e),!s)throw i.Log.error("No error passed to ErrorResponse"),new Error("error");var h=o(this,t.call(this,a||s));return h.name="ErrorResponse",h.error=s,h.error_description=a,h.error_uri=u,h.state=c,h.session_state=l,h}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e}(Error)},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.SigninState=void 0;var i,r=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=n(0),s=n(9),a=n(4),u=(i=n(14))&&i.__esModule?i:{default:i};function c(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}e.SigninState=function(t){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=n.nonce,r=n.authority,o=n.client_id,s=n.redirect_uri,h=n.code_verifier,d=n.response_mode,f=n.client_secret,p=n.scope,v=n.extraTokenParams,g=n.skipUserInfo;c(this,e);var m=l(this,t.call(this,arguments[0]));if(!0===i?m._nonce=(0,u.default)():i&&(m._nonce=i),!0===h?m._code_verifier=(0,u.default)()+(0,u.default)()+(0,u.default)():h&&(m._code_verifier=h),m.code_verifier){var w=a.JoseUtil.hashString(m.code_verifier,"SHA256");m._code_challenge=a.JoseUtil.hexToBase64Url(w)}return m._redirect_uri=s,m._authority=r,m._client_id=o,m._response_mode=d,m._client_secret=f,m._scope=p,m._extraTokenParams=v,m._skipUserInfo=g,m}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.toStorageString=function(){return o.Log.debug("SigninState.toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,nonce:this.nonce,code_verifier:this.code_verifier,redirect_uri:this.redirect_uri,authority:this.authority,client_id:this.client_id,response_mode:this.response_mode,client_secret:this.client_secret,scope:this.scope,extraTokenParams:this.extraTokenParams,skipUserInfo:this.skipUserInfo})},e.fromStorageString=function(t){return o.Log.debug("SigninState.fromStorageString"),new e(JSON.parse(t))},r(e,[{key:"nonce",get:function(){return this._nonce}},{key:"authority",get:function(){return this._authority}},{key:"client_id",get:function(){return this._client_id}},{key:"redirect_uri",get:function(){return this._redirect_uri}},{key:"code_verifier",get:function(){return this._code_verifier}},{key:"code_challenge",get:function(){return this._code_challenge}},{key:"response_mode",get:function(){return this._response_mode}},{key:"client_secret",get:function(){return this._client_secret}},{key:"scope",get:function(){return this._scope}},{key:"extraTokenParams",get:function(){return this._extraTokenParams}},{key:"skipUserInfo",get:function(){return this._skipUserInfo}}]),e}(s.State)},function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(){return("undefined"!=n&&null!==n&&void 0!==n.getRandomValues?i:r)().replace(/-/g,"")};var n="undefined"!=typeof window?window.crypto||window.msCrypto:null;function i(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(function(t){return(t^n.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16)}))}function r(){return([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(function(t){return(t^16*Math.random()>>t/4).toString(16)}))}t.exports=e.default},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.User=void 0;var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),r=n(0);e.User=function(){function t(e){var n=e.id_token,i=e.session_state,r=e.access_token,o=e.refresh_token,s=e.token_type,a=e.scope,u=e.profile,c=e.expires_at,l=e.state;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.id_token=n,this.session_state=i,this.access_token=r,this.refresh_token=o,this.token_type=s,this.scope=a,this.profile=u,this.expires_at=c,this.state=l}return t.prototype.toStorageString=function(){return r.Log.debug("User.toStorageString"),JSON.stringify({id_token:this.id_token,session_state:this.session_state,access_token:this.access_token,refresh_token:this.refresh_token,token_type:this.token_type,scope:this.scope,profile:this.profile,expires_at:this.expires_at})},t.fromStorageString=function(e){return r.Log.debug("User.fromStorageString"),new t(JSON.parse(e))},i(t,[{key:"expires_in",get:function(){if(this.expires_at){var t=parseInt(Date.now()/1e3);return this.expires_at-t}},set:function(t){var e=parseInt(t);if("number"==typeof e&&e>0){var n=parseInt(Date.now()/1e3);this.expires_at=n+e}}},{key:"expired",get:function(){var t=this.expires_in;if(void 0!==t)return t<=0}},{key:"scopes",get:function(){return(this.scope||"").split(" ")}}]),t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.AccessTokenEvents=void 0;var i=n(0),r=n(46);function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.AccessTokenEvents=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.accessTokenExpiringNotificationTime,i=void 0===n?60:n,s=e.accessTokenExpiringTimer,a=void 0===s?new r.Timer("Access token expiring"):s,u=e.accessTokenExpiredTimer,c=void 0===u?new r.Timer("Access token expired"):u;o(this,t),this._accessTokenExpiringNotificationTime=i,this._accessTokenExpiring=a,this._accessTokenExpired=c}return t.prototype.load=function(t){if(t.access_token&&void 0!==t.expires_in){var e=t.expires_in;if(i.Log.debug("AccessTokenEvents.load: access token present, remaining duration:",e),e>0){var n=e-this._accessTokenExpiringNotificationTime;n<=0&&(n=1),i.Log.debug("AccessTokenEvents.load: registering expiring timer in:",n),this._accessTokenExpiring.init(n)}else i.Log.debug("AccessTokenEvents.load: canceling existing expiring timer becase we're past expiration."),this._accessTokenExpiring.cancel();var r=e+1;i.Log.debug("AccessTokenEvents.load: registering expired timer in:",r),this._accessTokenExpired.init(r)}else this._accessTokenExpiring.cancel(),this._accessTokenExpired.cancel()},t.prototype.unload=function(){i.Log.debug("AccessTokenEvents.unload: canceling existing access token timers"),this._accessTokenExpiring.cancel(),this._accessTokenExpired.cancel()},t.prototype.addAccessTokenExpiring=function(t){this._accessTokenExpiring.addHandler(t)},t.prototype.removeAccessTokenExpiring=function(t){this._accessTokenExpiring.removeHandler(t)},t.prototype.addAccessTokenExpired=function(t){this._accessTokenExpired.addHandler(t)},t.prototype.removeAccessTokenExpired=function(t){this._accessTokenExpired.removeHandler(t)},t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.Event=void 0;var i=n(0);e.Event=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._name=e,this._callbacks=[]}return t.prototype.addHandler=function(t){this._callbacks.push(t)},t.prototype.removeHandler=function(t){var e=this._callbacks.findIndex((function(e){return e===t}));e>=0&&this._callbacks.splice(e,1)},t.prototype.raise=function(){i.Log.debug("Event: Raising event: "+this._name);for(var t=0;t<this._callbacks.length;t++){var e;(e=this._callbacks)[t].apply(e,arguments)}},t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.SessionMonitor=void 0;var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),r=n(0),o=n(19),s=n(1);function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.SessionMonitor=function(){function t(e){var n=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.CheckSessionIFrame,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s.Global.timer;if(a(this,t),!e)throw r.Log.error("SessionMonitor.ctor: No user manager passed to SessionMonitor"),new Error("userManager");this._userManager=e,this._CheckSessionIFrameCtor=i,this._timer=u,this._userManager.events.addUserLoaded(this._start.bind(this)),this._userManager.events.addUserUnloaded(this._stop.bind(this)),Promise.resolve(this._userManager.getUser().then((function(t){t?n._start(t):n._settings.monitorAnonymousSession&&n._userManager.querySessionStatus().then((function(t){var e={session_state:t.session_state};t.sub&&t.sid&&(e.profile={sub:t.sub,sid:t.sid}),n._start(e)})).catch((function(t){r.Log.error("SessionMonitor ctor: error from querySessionStatus:",t.message)}))})).catch((function(t){r.Log.error("SessionMonitor ctor: error from getUser:",t.message)})))}return t.prototype._start=function(t){var e=this,n=t.session_state;n&&(t.profile?(this._sub=t.profile.sub,this._sid=t.profile.sid,r.Log.debug("SessionMonitor._start: session_state:",n,", sub:",this._sub)):(this._sub=void 0,this._sid=void 0,r.Log.debug("SessionMonitor._start: session_state:",n,", anonymous user")),this._checkSessionIFrame?this._checkSessionIFrame.start(n):this._metadataService.getCheckSessionIframe().then((function(t){if(t){r.Log.debug("SessionMonitor._start: Initializing check session iframe");var i=e._client_id,o=e._checkSessionInterval,s=e._stopCheckSessionOnError;e._checkSessionIFrame=new e._CheckSessionIFrameCtor(e._callback.bind(e),i,t,o,s),e._checkSessionIFrame.load().then((function(){e._checkSessionIFrame.start(n)}))}else r.Log.warn("SessionMonitor._start: No check session iframe found in the metadata")})).catch((function(t){r.Log.error("SessionMonitor._start: Error from getCheckSessionIframe:",t.message)})))},t.prototype._stop=function(){var t=this;if(this._sub=void 0,this._sid=void 0,this._checkSessionIFrame&&(r.Log.debug("SessionMonitor._stop"),this._checkSessionIFrame.stop()),this._settings.monitorAnonymousSession)var e=this._timer.setInterval((function(){t._timer.clearInterval(e),t._userManager.querySessionStatus().then((function(e){var n={session_state:e.session_state};e.sub&&e.sid&&(n.profile={sub:e.sub,sid:e.sid}),t._start(n)})).catch((function(t){r.Log.error("SessionMonitor: error from querySessionStatus:",t.message)}))}),1e3)},t.prototype._callback=function(){var t=this;this._userManager.querySessionStatus().then((function(e){var n=!0;e?e.sub===t._sub?(n=!1,t._checkSessionIFrame.start(e.session_state),e.sid===t._sid?r.Log.debug("SessionMonitor._callback: Same sub still logged in at OP, restarting check session iframe; session_state:",e.session_state):(r.Log.debug("SessionMonitor._callback: Same sub still logged in at OP, session state has changed, restarting check session iframe; session_state:",e.session_state),t._userManager.events._raiseUserSessionChanged())):r.Log.debug("SessionMonitor._callback: Different subject signed into OP:",e.sub):r.Log.debug("SessionMonitor._callback: Subject no longer signed into OP"),n&&(t._sub?(r.Log.debug("SessionMonitor._callback: SessionMonitor._callback; raising signed out event"),t._userManager.events._raiseUserSignedOut()):(r.Log.debug("SessionMonitor._callback: SessionMonitor._callback; raising signed in event"),t._userManager.events._raiseUserSignedIn()))})).catch((function(e){t._sub&&(r.Log.debug("SessionMonitor._callback: Error calling queryCurrentSigninSession; raising signed out event",e.message),t._userManager.events._raiseUserSignedOut())}))},i(t,[{key:"_settings",get:function(){return this._userManager.settings}},{key:"_metadataService",get:function(){return this._userManager.metadataService}},{key:"_client_id",get:function(){return this._settings.client_id}},{key:"_checkSessionInterval",get:function(){return this._settings.checkSessionInterval}},{key:"_stopCheckSessionOnError",get:function(){return this._settings.stopCheckSessionOnError}}]),t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.CheckSessionIFrame=void 0;var i=n(0);function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.CheckSessionIFrame=function(){function t(e,n,i,o){var s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];r(this,t),this._callback=e,this._client_id=n,this._url=i,this._interval=o||2e3,this._stopOnError=s;var a=i.indexOf("/",i.indexOf("//")+2);this._frame_origin=i.substr(0,a),this._frame=window.document.createElement("iframe"),this._frame.style.visibility="hidden",this._frame.style.position="absolute",this._frame.style.display="none",this._frame.width=0,this._frame.height=0,this._frame.src=i}return t.prototype.load=function(){var t=this;return new Promise((function(e){t._frame.onload=function(){e()},window.document.body.appendChild(t._frame),t._boundMessageEvent=t._message.bind(t),window.addEventListener("message",t._boundMessageEvent,!1)}))},t.prototype._message=function(t){t.origin===this._frame_origin&&t.source===this._frame.contentWindow&&("error"===t.data?(i.Log.error("CheckSessionIFrame: error message from check session op iframe"),this._stopOnError&&this.stop()):"changed"===t.data?(i.Log.debug("CheckSessionIFrame: changed message from check session op iframe"),this.stop(),this._callback()):i.Log.debug("CheckSessionIFrame: "+t.data+" message from check session op iframe"))},t.prototype.start=function(t){var e=this;if(this._session_state!==t){i.Log.debug("CheckSessionIFrame.start"),this.stop(),this._session_state=t;var n=function(){e._frame.contentWindow.postMessage(e._client_id+" "+e._session_state,e._frame_origin)};n(),this._timer=window.setInterval(n,this._interval)}},t.prototype.stop=function(){this._session_state=null,this._timer&&(i.Log.debug("CheckSessionIFrame.stop"),window.clearInterval(this._timer),this._timer=null)},t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.TokenRevocationClient=void 0;var i=n(0),r=n(2),o=n(1);function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var a="access_token",u="refresh_token";e.TokenRevocationClient=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.Global.XMLHttpRequest,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:r.MetadataService;if(s(this,t),!e)throw i.Log.error("TokenRevocationClient.ctor: No settings provided"),new Error("No settings provided.");this._settings=e,this._XMLHttpRequestCtor=n,this._metadataService=new a(this._settings)}return t.prototype.revoke=function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"access_token";if(!t)throw i.Log.error("TokenRevocationClient.revoke: No token provided"),new Error("No token provided.");if(r!==a&&r!=u)throw i.Log.error("TokenRevocationClient.revoke: Invalid token type"),new Error("Invalid token type.");return this._metadataService.getRevocationEndpoint().then((function(o){if(o)return i.Log.debug("TokenRevocationClient.revoke: Revoking "+r),n._revoke(o,n._settings.client_id,n._settings.client_secret,t,r);if(e)throw i.Log.error("TokenRevocationClient.revoke: Revocation not supported"),new Error("Revocation not supported")}))},t.prototype._revoke=function(t,e,n,r,o){var s=this;return new Promise((function(a,u){var c=new s._XMLHttpRequestCtor;c.open("POST",t),c.onload=function(){i.Log.debug("TokenRevocationClient.revoke: HTTP response received, status",c.status),200===c.status?a():u(Error(c.statusText+" ("+c.status+")"))},c.onerror=function(){i.Log.debug("TokenRevocationClient.revoke: Network Error."),u("Network Error")};var l="client_id="+encodeURIComponent(e);n&&(l+="&client_secret="+encodeURIComponent(n)),l+="&token_type_hint="+encodeURIComponent(o),l+="&token="+encodeURIComponent(r),c.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),c.send(l)}))},t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.CordovaPopupWindow=void 0;var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),r=n(0);e.CordovaPopupWindow=function(){function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._promise=new Promise((function(t,e){n._resolve=t,n._reject=e})),this.features=e.popupWindowFeatures||"location=no,toolbar=no,zoom=no",this.target=e.popupWindowTarget||"_blank",this.redirect_uri=e.startUrl,r.Log.debug("CordovaPopupWindow.ctor: redirect_uri: "+this.redirect_uri)}return t.prototype._isInAppBrowserInstalled=function(t){return["cordova-plugin-inappbrowser","cordova-plugin-inappbrowser.inappbrowser","org.apache.cordova.inappbrowser"].some((function(e){return t.hasOwnProperty(e)}))},t.prototype.navigate=function(t){if(t&&t.url){if(!window.cordova)return this._error("cordova is undefined");var e=window.cordova.require("cordova/plugin_list").metadata;if(!1===this._isInAppBrowserInstalled(e))return this._error("InAppBrowser plugin not found");this._popup=cordova.InAppBrowser.open(t.url,this.target,this.features),this._popup?(r.Log.debug("CordovaPopupWindow.navigate: popup successfully created"),this._exitCallbackEvent=this._exitCallback.bind(this),this._loadStartCallbackEvent=this._loadStartCallback.bind(this),this._popup.addEventListener("exit",this._exitCallbackEvent,!1),this._popup.addEventListener("loadstart",this._loadStartCallbackEvent,!1)):this._error("Error opening popup window")}else this._error("No url provided");return this.promise},t.prototype._loadStartCallback=function(t){0===t.url.indexOf(this.redirect_uri)&&this._success({url:t.url})},t.prototype._exitCallback=function(t){this._error(t)},t.prototype._success=function(t){this._cleanup(),r.Log.debug("CordovaPopupWindow: Successful response from cordova popup window"),this._resolve(t)},t.prototype._error=function(t){this._cleanup(),r.Log.error(t),this._reject(new Error(t))},t.prototype.close=function(){this._cleanup()},t.prototype._cleanup=function(){this._popup&&(r.Log.debug("CordovaPopupWindow: cleaning up popup"),this._popup.removeEventListener("exit",this._exitCallbackEvent,!1),this._popup.removeEventListener("loadstart",this._loadStartCallbackEvent,!1),this._popup.close()),this._popup=null},i(t,[{key:"promise",get:function(){return this._promise}}]),t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var i=n(0),r=n(10),o=n(5),s=n(6),a=n(37),u=n(38),c=n(16),l=n(2),h=n(48),d=n(49),f=n(19),p=n(20),v=n(18),g=n(1),m=n(15),w=n(50);e.default={Version:w.Version,Log:i.Log,OidcClient:r.OidcClient,OidcClientSettings:o.OidcClientSettings,WebStorageStateStore:s.WebStorageStateStore,InMemoryWebStorage:a.InMemoryWebStorage,UserManager:u.UserManager,AccessTokenEvents:c.AccessTokenEvents,MetadataService:l.MetadataService,CordovaPopupNavigator:h.CordovaPopupNavigator,CordovaIFrameNavigator:d.CordovaIFrameNavigator,CheckSessionIFrame:f.CheckSessionIFrame,TokenRevocationClient:p.TokenRevocationClient,SessionMonitor:v.SessionMonitor,Global:g.Global,User:m.User},t.exports=e.default},function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.ClockService=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return t.prototype.getEpochTime=function(){return Promise.resolve(Date.now()/1e3|0)},t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.ResponseValidator=void 0;var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r=n(0),o=n(2),s=n(25),a=n(11),u=n(12),c=n(4);function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var h=["nonce","at_hash","iat","nbf","exp","aud","iss","c_hash"];e.ResponseValidator=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.MetadataService,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s.UserInfoService,u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:c.JoseUtil,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:a.TokenClient;if(l(this,t),!e)throw r.Log.error("ResponseValidator.ctor: No settings passed to ResponseValidator"),new Error("settings");this._settings=e,this._metadataService=new n(this._settings),this._userInfoService=new i(this._settings),this._joseUtil=u,this._tokenClient=new h(this._settings)}return t.prototype.validateSigninResponse=function(t,e){var n=this;return r.Log.debug("ResponseValidator.validateSigninResponse"),this._processSigninParams(t,e).then((function(e){return r.Log.debug("ResponseValidator.validateSigninResponse: state processed"),n._validateTokens(t,e).then((function(e){return r.Log.debug("ResponseValidator.validateSigninResponse: tokens validated"),n._processClaims(t,e).then((function(t){return r.Log.debug("ResponseValidator.validateSigninResponse: claims processed"),t}))}))}))},t.prototype.validateSignoutResponse=function(t,e){return t.id!==e.state?(r.Log.error("ResponseValidator.validateSignoutResponse: State does not match"),Promise.reject(new Error("State does not match"))):(r.Log.debug("ResponseValidator.validateSignoutResponse: state validated"),e.state=t.data,e.error?(r.Log.warn("ResponseValidator.validateSignoutResponse: Response was error",e.error),Promise.reject(new u.ErrorResponse(e))):Promise.resolve(e))},t.prototype._processSigninParams=function(t,e){if(t.id!==e.state)return r.Log.error("ResponseValidator._processSigninParams: State does not match"),Promise.reject(new Error("State does not match"));if(!t.client_id)return r.Log.error("ResponseValidator._processSigninParams: No client_id on state"),Promise.reject(new Error("No client_id on state"));if(!t.authority)return r.Log.error("ResponseValidator._processSigninParams: No authority on state"),Promise.reject(new Error("No authority on state"));if(this._settings.authority){if(this._settings.authority&&this._settings.authority!==t.authority)return r.Log.error("ResponseValidator._processSigninParams: authority mismatch on settings vs. signin state"),Promise.reject(new Error("authority mismatch on settings vs. signin state"))}else this._settings.authority=t.authority;if(this._settings.client_id){if(this._settings.client_id&&this._settings.client_id!==t.client_id)return r.Log.error("ResponseValidator._processSigninParams: client_id mismatch on settings vs. signin state"),Promise.reject(new Error("client_id mismatch on settings vs. signin state"))}else this._settings.client_id=t.client_id;return r.Log.debug("ResponseValidator._processSigninParams: state validated"),e.state=t.data,e.error?(r.Log.warn("ResponseValidator._processSigninParams: Response was error",e.error),Promise.reject(new u.ErrorResponse(e))):t.nonce&&!e.id_token?(r.Log.error("ResponseValidator._processSigninParams: Expecting id_token in response"),Promise.reject(new Error("No id_token in response"))):!t.nonce&&e.id_token?(r.Log.error("ResponseValidator._processSigninParams: Not expecting id_token in response"),Promise.reject(new Error("Unexpected id_token in response"))):t.code_verifier&&!e.code?(r.Log.error("ResponseValidator._processSigninParams: Expecting code in response"),Promise.reject(new Error("No code in response"))):!t.code_verifier&&e.code?(r.Log.error("ResponseValidator._processSigninParams: Not expecting code in response"),Promise.reject(new Error("Unexpected code in response"))):(e.scope||(e.scope=t.scope),Promise.resolve(e))},t.prototype._processClaims=function(t,e){var n=this;if(e.isOpenIdConnect){if(r.Log.debug("ResponseValidator._processClaims: response is OIDC, processing claims"),e.profile=this._filterProtocolClaims(e.profile),!0!==t.skipUserInfo&&this._settings.loadUserInfo&&e.access_token)return r.Log.debug("ResponseValidator._processClaims: loading user info"),this._userInfoService.getClaims(e.access_token).then((function(t){return r.Log.debug("ResponseValidator._processClaims: user info claims received from user info endpoint"),t.sub!==e.profile.sub?(r.Log.error("ResponseValidator._processClaims: sub from user info endpoint does not match sub in id_token"),Promise.reject(new Error("sub from user info endpoint does not match sub in id_token"))):(e.profile=n._mergeClaims(e.profile,t),r.Log.debug("ResponseValidator._processClaims: user info claims received, updated profile:",e.profile),e)}));r.Log.debug("ResponseValidator._processClaims: not loading user info")}else r.Log.debug("ResponseValidator._processClaims: response is not OIDC, not processing claims");return Promise.resolve(e)},t.prototype._mergeClaims=function(t,e){var n=Object.assign({},t);for(var r in e){var o=e[r];Array.isArray(o)||(o=[o]);for(var s=0;s<o.length;s++){var a=o[s];n[r]?Array.isArray(n[r])?n[r].indexOf(a)<0&&n[r].push(a):n[r]!==a&&(n[r]="object"===(void 0===a?"undefined":i(a))&&this._settings.mergeClaims?this._mergeClaims(n[r],a):[n[r],a]):n[r]=a}}return n},t.prototype._filterProtocolClaims=function(t){r.Log.debug("ResponseValidator._filterProtocolClaims, incoming claims:",t);var e=Object.assign({},t);return this._settings._filterProtocolClaims?(h.forEach((function(t){delete e[t]})),r.Log.debug("ResponseValidator._filterProtocolClaims: protocol claims filtered",e)):r.Log.debug("ResponseValidator._filterProtocolClaims: protocol claims not filtered"),e},t.prototype._validateTokens=function(t,e){return e.code?(r.Log.debug("ResponseValidator._validateTokens: Validating code"),this._processCode(t,e)):e.id_token?e.access_token?(r.Log.debug("ResponseValidator._validateTokens: Validating id_token and access_token"),this._validateIdTokenAndAccessToken(t,e)):(r.Log.debug("ResponseValidator._validateTokens: Validating id_token"),this._validateIdToken(t,e)):(r.Log.debug("ResponseValidator._validateTokens: No code to process or id_token to validate"),Promise.resolve(e))},t.prototype._processCode=function(t,e){var n=this,o={client_id:t.client_id,client_secret:t.client_secret,code:e.code,redirect_uri:t.redirect_uri,code_verifier:t.code_verifier};return t.extraTokenParams&&"object"===i(t.extraTokenParams)&&Object.assign(o,t.extraTokenParams),this._tokenClient.exchangeCode(o).then((function(i){for(var o in i)e[o]=i[o];return e.id_token?(r.Log.debug("ResponseValidator._processCode: token response successful, processing id_token"),n._validateIdTokenAttributes(t,e)):(r.Log.debug("ResponseValidator._processCode: token response successful, returning response"),e)}))},t.prototype._validateIdTokenAttributes=function(t,e){var n=this;return this._metadataService.getIssuer().then((function(i){var o=t.client_id,s=n._settings.clockSkew;return r.Log.debug("ResponseValidator._validateIdTokenAttributes: Validaing JWT attributes; using clock skew (in seconds) of: ",s),n._settings.getEpochTime().then((function(a){return n._joseUtil.validateJwtAttributes(e.id_token,i,o,s,a).then((function(n){return t.nonce&&t.nonce!==n.nonce?(r.Log.error("ResponseValidator._validateIdTokenAttributes: Invalid nonce in id_token"),Promise.reject(new Error("Invalid nonce in id_token"))):n.sub?(e.profile=n,e):(r.Log.error("ResponseValidator._validateIdTokenAttributes: No sub present in id_token"),Promise.reject(new Error("No sub present in id_token")))}))}))}))},t.prototype._validateIdTokenAndAccessToken=function(t,e){var n=this;return this._validateIdToken(t,e).then((function(t){return n._validateAccessToken(t)}))},t.prototype._getSigningKeyForJwt=function(t){var e=this;return this._metadataService.getSigningKeys().then((function(n){var i=t.header.kid;if(!n)return r.Log.error("ResponseValidator._validateIdToken: No signing keys from metadata"),Promise.reject(new Error("No signing keys from metadata"));r.Log.debug("ResponseValidator._validateIdToken: Received signing keys");var o=void 0;if(i)o=n.filter((function(t){return t.kid===i}))[0];else{if((n=e._filterByAlg(n,t.header.alg)).length>1)return r.Log.error("ResponseValidator._validateIdToken: No kid found in id_token and more than one key found in metadata"),Promise.reject(new Error("No kid found in id_token and more than one key found in metadata"));o=n[0]}return Promise.resolve(o)}))},t.prototype._getSigningKeyForJwtWithSingleRetry=function(t){var e=this;return this._getSigningKeyForJwt(t).then((function(n){return n?Promise.resolve(n):(e._metadataService.resetSigningKeys(),e._getSigningKeyForJwt(t))}))},t.prototype._validateIdToken=function(t,e){var n=this;if(!t.nonce)return r.Log.error("ResponseValidator._validateIdToken: No nonce on state"),Promise.reject(new Error("No nonce on state"));var i=this._joseUtil.parseJwt(e.id_token);return i&&i.header&&i.payload?t.nonce!==i.payload.nonce?(r.Log.error("ResponseValidator._validateIdToken: Invalid nonce in id_token"),Promise.reject(new Error("Invalid nonce in id_token"))):this._metadataService.getIssuer().then((function(o){return r.Log.debug("ResponseValidator._validateIdToken: Received issuer"),n._getSigningKeyForJwtWithSingleRetry(i).then((function(s){if(!s)return r.Log.error("ResponseValidator._validateIdToken: No key matching kid or alg found in signing keys"),Promise.reject(new Error("No key matching kid or alg found in signing keys"));var a=t.client_id,u=n._settings.clockSkew;return r.Log.debug("ResponseValidator._validateIdToken: Validaing JWT; using clock skew (in seconds) of: ",u),n._joseUtil.validateJwt(e.id_token,s,o,a,u).then((function(){return r.Log.debug("ResponseValidator._validateIdToken: JWT validation successful"),i.payload.sub?(e.profile=i.payload,e):(r.Log.error("ResponseValidator._validateIdToken: No sub present in id_token"),Promise.reject(new Error("No sub present in id_token")))}))}))})):(r.Log.error("ResponseValidator._validateIdToken: Failed to parse id_token",i),Promise.reject(new Error("Failed to parse id_token")))},t.prototype._filterByAlg=function(t,e){var n=null;if(e.startsWith("RS"))n="RSA";else if(e.startsWith("PS"))n="PS";else{if(!e.startsWith("ES"))return r.Log.debug("ResponseValidator._filterByAlg: alg not supported: ",e),[];n="EC"}return r.Log.debug("ResponseValidator._filterByAlg: Looking for keys that match kty: ",n),t=t.filter((function(t){return t.kty===n})),r.Log.debug("ResponseValidator._filterByAlg: Number of keys that match kty: ",n,t.length),t},t.prototype._validateAccessToken=function(t){if(!t.profile)return r.Log.error("ResponseValidator._validateAccessToken: No profile loaded from id_token"),Promise.reject(new Error("No profile loaded from id_token"));if(!t.profile.at_hash)return r.Log.error("ResponseValidator._validateAccessToken: No at_hash in id_token"),Promise.reject(new Error("No at_hash in id_token"));if(!t.id_token)return r.Log.error("ResponseValidator._validateAccessToken: No id_token"),Promise.reject(new Error("No id_token"));var e=this._joseUtil.parseJwt(t.id_token);if(!e||!e.header)return r.Log.error("ResponseValidator._validateAccessToken: Failed to parse id_token",e),Promise.reject(new Error("Failed to parse id_token"));var n=e.header.alg;if(!n||5!==n.length)return r.Log.error("ResponseValidator._validateAccessToken: Unsupported alg:",n),Promise.reject(new Error("Unsupported alg: "+n));var i=n.substr(2,3);if(!i)return r.Log.error("ResponseValidator._validateAccessToken: Unsupported alg:",n,i),Promise.reject(new Error("Unsupported alg: "+n));if(256!==(i=parseInt(i))&&384!==i&&512!==i)return r.Log.error("ResponseValidator._validateAccessToken: Unsupported alg:",n,i),Promise.reject(new Error("Unsupported alg: "+n));var o="sha"+i,s=this._joseUtil.hashString(t.access_token,o);if(!s)return r.Log.error("ResponseValidator._validateAccessToken: access_token hash failed:",o),Promise.reject(new Error("Failed to validate at_hash"));var a=s.substr(0,s.length/2),u=this._joseUtil.hexToBase64Url(a);return u!==t.profile.at_hash?(r.Log.error("ResponseValidator._validateAccessToken: Failed to validate at_hash",u,t.profile.at_hash),Promise.reject(new Error("Failed to validate at_hash"))):(r.Log.debug("ResponseValidator._validateAccessToken: success"),Promise.resolve(t))},t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.UserInfoService=void 0;var i=n(7),r=n(2),o=n(0),s=n(4);function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.UserInfoService=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i.JsonService,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:r.MetadataService,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:s.JoseUtil;if(a(this,t),!e)throw o.Log.error("UserInfoService.ctor: No settings passed"),new Error("settings");this._settings=e,this._jsonService=new n(void 0,void 0,this._getClaimsFromJwt.bind(this)),this._metadataService=new u(this._settings),this._joseUtil=c}return t.prototype.getClaims=function(t){var e=this;return t?this._metadataService.getUserInfoEndpoint().then((function(n){return o.Log.debug("UserInfoService.getClaims: received userinfo url",n),e._jsonService.getJson(n,t).then((function(t){return o.Log.debug("UserInfoService.getClaims: claims received",t),t}))})):(o.Log.error("UserInfoService.getClaims: No token passed"),Promise.reject(new Error("A token is required")))},t.prototype._getClaimsFromJwt=function(t){var e=this;try{var n=this._joseUtil.parseJwt(t.responseText);if(!n||!n.header||!n.payload)return o.Log.error("UserInfoService._getClaimsFromJwt: Failed to parse JWT",n),Promise.reject(new Error("Failed to parse id_token"));var i=n.header.kid,r=void 0;switch(this._settings.userInfoJwtIssuer){case"OP":r=this._metadataService.getIssuer();break;case"ANY":r=Promise.resolve(n.payload.iss);break;default:r=Promise.resolve(this._settings.userInfoJwtIssuer)}return r.then((function(r){return o.Log.debug("UserInfoService._getClaimsFromJwt: Received issuer:"+r),e._metadataService.getSigningKeys().then((function(s){if(!s)return o.Log.error("UserInfoService._getClaimsFromJwt: No signing keys from metadata"),Promise.reject(new Error("No signing keys from metadata"));o.Log.debug("UserInfoService._getClaimsFromJwt: Received signing keys");var a=void 0;if(i)a=s.filter((function(t){return t.kid===i}))[0];else{if((s=e._filterByAlg(s,n.header.alg)).length>1)return o.Log.error("UserInfoService._getClaimsFromJwt: No kid found in id_token and more than one key found in metadata"),Promise.reject(new Error("No kid found in id_token and more than one key found in metadata"));a=s[0]}if(!a)return o.Log.error("UserInfoService._getClaimsFromJwt: No key matching kid or alg found in signing keys"),Promise.reject(new Error("No key matching kid or alg found in signing keys"));var u=e._settings.client_id,c=e._settings.clockSkew;return o.Log.debug("UserInfoService._getClaimsFromJwt: Validaing JWT; using clock skew (in seconds) of: ",c),e._joseUtil.validateJwt(t.responseText,a,r,u,c,void 0,!0).then((function(){return o.Log.debug("UserInfoService._getClaimsFromJwt: JWT validation successful"),n.payload}))}))}))}catch(t){return o.Log.error("UserInfoService._getClaimsFromJwt: Error parsing JWT response",t.message),void reject(t)}},t.prototype._filterByAlg=function(t,e){var n=null;if(e.startsWith("RS"))n="RSA";else if(e.startsWith("PS"))n="PS";else{if(!e.startsWith("ES"))return o.Log.debug("UserInfoService._filterByAlg: alg not supported: ",e),[];n="EC"}return o.Log.debug("UserInfoService._filterByAlg: Looking for keys that match kty: ",n),t=t.filter((function(t){return t.kty===n})),o.Log.debug("UserInfoService._filterByAlg: Number of keys that match kty: ",n,t.length),t},t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.AllowedSigningAlgs=e.b64tohex=e.hextob64u=e.crypto=e.X509=e.KeyUtil=e.jws=void 0;var i=n(27);e.jws=i.jws,e.KeyUtil=i.KEYUTIL,e.X509=i.X509,e.crypto=i.crypto,e.hextob64u=i.hextob64u,e.b64tohex=i.b64tohex,e.AllowedSigningAlgs=["RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"]},function(t,e,n){(function(t){Object.defineProperty(e,"__esModule",{value:!0});var n,i,r,o,s,a,u,c,l,h,d,f,p,v,g,m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},w={},b=b||(n=Math,r=(i={}).lib={},o=r.Base=function(){function t(){}return{extend:function(e){t.prototype=this;var n=new t;return e&&n.mixIn(e),n.hasOwnProperty("init")||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),s=r.WordArray=o.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||u).stringify(this)},concat:function(t){var e=this.words,n=t.words,i=this.sigBytes,r=t.sigBytes;if(this.clamp(),i%4)for(var o=0;o<r;o++)e[i+o>>>2]|=(n[o>>>2]>>>24-o%4*8&255)<<24-(i+o)%4*8;else for(o=0;o<r;o+=4)e[i+o>>>2]=n[o>>>2];return this.sigBytes+=r,this},clamp:function(){var t=this.words,e=this.sigBytes;t[e>>>2]&=4294967295<<32-e%4*8,t.length=n.ceil(e/4)},clone:function(){var t=o.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],i=0;i<t;i+=4)e.push(4294967296*n.random()|0);return new s.init(e,t)}}),a=i.enc={},u=a.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,i=[],r=0;r<n;r++){var o=e[r>>>2]>>>24-r%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(t){for(var e=t.length,n=[],i=0;i<e;i+=2)n[i>>>3]|=parseInt(t.substr(i,2),16)<<24-i%8*4;return new s.init(n,e/2)}},c=a.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,i=[],r=0;r<n;r++)i.push(String.fromCharCode(e[r>>>2]>>>24-r%4*8&255));return i.join("")},parse:function(t){for(var e=t.length,n=[],i=0;i<e;i++)n[i>>>2]|=(255&t.charCodeAt(i))<<24-i%4*8;return new s.init(n,e)}},l=a.Utf8={stringify:function(t){try{return decodeURIComponent(escape(c.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return c.parse(unescape(encodeURIComponent(t)))}},h=r.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=l.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(t){var e=this._data,i=e.words,r=e.sigBytes,o=this.blockSize,a=r/(4*o),u=(a=t?n.ceil(a):n.max((0|a)-this._minBufferSize,0))*o,c=n.min(4*u,r);if(u){for(var l=0;l<u;l+=o)this._doProcessBlock(i,l);var h=i.splice(0,u);e.sigBytes-=c}return new s.init(h,c)},clone:function(){var t=o.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),r.Hasher=h.extend({cfg:o.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){h.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new d.HMAC.init(t,n).finalize(e)}}}),d=i.algo={},i);p=(f=b).lib,v=p.Base,g=p.WordArray,(f=f.x64={}).Word=v.extend({init:function(t,e){this.high=t,this.low=e}}),f.WordArray=v.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:8*t.length},toX32:function(){for(var t=this.words,e=t.length,n=[],i=0;i<e;i++){var r=t[i];n.push(r.high),n.push(r.low)}return g.create(n,this.sigBytes)},clone:function(){for(var t=v.clone.call(this),e=t.words=this.words.slice(0),n=e.length,i=0;i<n;i++)e[i]=e[i].clone();return t}}),function(){var t=b.lib.WordArray;b.enc.Base64={stringify:function(t){var e=t.words,n=t.sigBytes,i=this._map;t.clamp(),t=[];for(var r=0;r<n;r+=3)for(var o=(e[r>>>2]>>>24-r%4*8&255)<<16|(e[r+1>>>2]>>>24-(r+1)%4*8&255)<<8|e[r+2>>>2]>>>24-(r+2)%4*8&255,s=0;4>s&&r+.75*s<n;s++)t.push(i.charAt(o>>>6*(3-s)&63));if(e=i.charAt(64))for(;t.length%4;)t.push(e);return t.join("")},parse:function(e){var n=e.length,i=this._map;(r=i.charAt(64))&&-1!=(r=e.indexOf(r))&&(n=r);for(var r=[],o=0,s=0;s<n;s++)if(s%4){var a=i.indexOf(e.charAt(s-1))<<s%4*2,u=i.indexOf(e.charAt(s))>>>6-s%4*2;r[o>>>2]|=(a|u)<<24-o%4*8,o++}return t.create(r,o)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(t){for(var e=b,n=(r=e.lib).WordArray,i=r.Hasher,r=e.algo,o=[],s=[],a=function(t){return 4294967296*(t-(0|t))|0},u=2,c=0;64>c;){var l;t:{for(var h=t.sqrt(l=u),d=2;d<=h;d++)if(!(l%d)){l=!1;break t}l=!0}l&&(8>c&&(o[c]=a(t.pow(u,.5))),s[c]=a(t.pow(u,1/3)),c++),u++}var f=[];r=r.SHA256=i.extend({_doReset:function(){this._hash=new n.init(o.slice(0))},_doProcessBlock:function(t,e){for(var n=this._hash.words,i=n[0],r=n[1],o=n[2],a=n[3],u=n[4],c=n[5],l=n[6],h=n[7],d=0;64>d;d++){if(16>d)f[d]=0|t[e+d];else{var p=f[d-15],v=f[d-2];f[d]=((p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3)+f[d-7]+((v<<15|v>>>17)^(v<<13|v>>>19)^v>>>10)+f[d-16]}p=h+((u<<26|u>>>6)^(u<<21|u>>>11)^(u<<7|u>>>25))+(u&c^~u&l)+s[d]+f[d],v=((i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22))+(i&r^i&o^r&o),h=l,l=c,c=u,u=a+p|0,a=o,o=r,r=i,i=p+v|0}n[0]=n[0]+i|0,n[1]=n[1]+r|0,n[2]=n[2]+o|0,n[3]=n[3]+a|0,n[4]=n[4]+u|0,n[5]=n[5]+c|0,n[6]=n[6]+l|0,n[7]=n[7]+h|0},_doFinalize:function(){var e=this._data,n=e.words,i=8*this._nDataBytes,r=8*e.sigBytes;return n[r>>>5]|=128<<24-r%32,n[14+(r+64>>>9<<4)]=t.floor(i/4294967296),n[15+(r+64>>>9<<4)]=i,e.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}}),e.SHA256=i._createHelper(r),e.HmacSHA256=i._createHmacHelper(r)}(Math),function(){function t(){return i.create.apply(i,arguments)}for(var e=b,n=e.lib.Hasher,i=(o=e.x64).Word,r=o.WordArray,o=e.algo,s=[t(1116352408,3609767458),t(1899447441,602891725),t(3049323471,3964484399),t(3921009573,2173295548),t(961987163,4081628472),t(1508970993,3053834265),t(2453635748,2937671579),t(2870763221,3664609560),t(3624381080,2734883394),t(310598401,1164996542),t(607225278,1323610764),t(1426881987,3590304994),t(1925078388,4068182383),t(2162078206,991336113),t(2614888103,633803317),t(3248222580,3479774868),t(3835390401,2666613458),t(4022224774,944711139),t(264347078,2341262773),t(604807628,2007800933),t(770255983,1495990901),t(1249150122,1856431235),t(1555081692,3175218132),t(1996064986,2198950837),t(2554220882,3999719339),t(2821834349,766784016),t(2952996808,2566594879),t(3210313671,3203337956),t(3336571891,1034457026),t(3584528711,2466948901),t(113926993,3758326383),t(338241895,168717936),t(666307205,1188179964),t(773529912,1546045734),t(1294757372,1522805485),t(1396182291,2643833823),t(1695183700,2343527390),t(1986661051,1014477480),t(2177026350,1206759142),t(2456956037,344077627),t(2730485921,1290863460),t(2820302411,3158454273),t(3259730800,3505952657),t(3345764771,106217008),t(3516065817,3606008344),t(3600352804,1432725776),t(4094571909,1467031594),t(275423344,851169720),t(430227734,3100823752),t(506948616,1363258195),t(659060556,3750685593),t(883997877,3785050280),t(958139571,3318307427),t(1322822218,3812723403),t(1537002063,2003034995),t(1747873779,3602036899),t(1955562222,1575990012),t(2024104815,1125592928),t(2227730452,2716904306),t(2361852424,442776044),t(2428436474,593698344),t(2756734187,3733110249),t(3204031479,2999351573),t(3329325298,3815920427),t(3391569614,3928383900),t(3515267271,566280711),t(3940187606,3454069534),t(4118630271,4000239992),t(116418474,1914138554),t(174292421,2731055270),t(289380356,3203993006),t(460393269,320620315),t(685471733,587496836),t(852142971,1086792851),t(1017036298,365543100),t(1126000580,2618297676),t(1288033470,3409855158),t(1501505948,4234509866),t(1607167915,987167468),t(1816402316,1246189591)],a=[],u=0;80>u;u++)a[u]=t();o=o.SHA512=n.extend({_doReset:function(){this._hash=new r.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(t,e){for(var n=(h=this._hash.words)[0],i=h[1],r=h[2],o=h[3],u=h[4],c=h[5],l=h[6],h=h[7],d=n.high,f=n.low,p=i.high,v=i.low,g=r.high,m=r.low,w=o.high,b=o.low,y=u.high,x=u.low,k=c.high,E=c.low,S=l.high,F=l.low,A=h.high,_=h.low,j=d,C=f,R=p,I=v,T=g,O=m,N=w,P=b,D=y,M=x,U=k,L=E,B=S,J=F,$=A,H=_,K=0;80>K;K++){var z=a[K];if(16>K)var W=z.high=0|t[e+2*K],q=z.low=0|t[e+2*K+1];else{W=((q=(W=a[K-15]).high)>>>1|(V=W.low)<<31)^(q>>>8|V<<24)^q>>>7;var V=(V>>>1|q<<31)^(V>>>8|q<<24)^(V>>>7|q<<25),G=((q=(G=a[K-2]).high)>>>19|(X=G.low)<<13)^(q<<3|X>>>29)^q>>>6,X=(X>>>19|q<<13)^(X<<3|q>>>29)^(X>>>6|q<<26),Y=(q=a[K-7]).high,Z=(Q=a[K-16]).high,Q=Q.low;W=(W=(W=W+Y+((q=V+q.low)>>>0<V>>>0?1:0))+G+((q+=X)>>>0<X>>>0?1:0))+Z+((q+=Q)>>>0<Q>>>0?1:0),z.high=W,z.low=q}Y=D&U^~D&B,Q=M&L^~M&J,z=j&R^j&T^R&T;var tt=C&I^C&O^I&O,et=(V=(j>>>28|C<<4)^(j<<30|C>>>2)^(j<<25|C>>>7),G=(C>>>28|j<<4)^(C<<30|j>>>2)^(C<<25|j>>>7),(X=s[K]).high),nt=X.low;Z=$+((D>>>14|M<<18)^(D>>>18|M<<14)^(D<<23|M>>>9))+((X=H+((M>>>14|D<<18)^(M>>>18|D<<14)^(M<<23|D>>>9)))>>>0<H>>>0?1:0),$=B,H=J,B=U,J=L,U=D,L=M,D=N+(Z=(Z=(Z=Z+Y+((X+=Q)>>>0<Q>>>0?1:0))+et+((X+=nt)>>>0<nt>>>0?1:0))+W+((X+=q)>>>0<q>>>0?1:0))+((M=P+X|0)>>>0<P>>>0?1:0)|0,N=T,P=O,T=R,O=I,R=j,I=C,j=Z+(z=V+z+((q=G+tt)>>>0<G>>>0?1:0))+((C=X+q|0)>>>0<X>>>0?1:0)|0}f=n.low=f+C,n.high=d+j+(f>>>0<C>>>0?1:0),v=i.low=v+I,i.high=p+R+(v>>>0<I>>>0?1:0),m=r.low=m+O,r.high=g+T+(m>>>0<O>>>0?1:0),b=o.low=b+P,o.high=w+N+(b>>>0<P>>>0?1:0),x=u.low=x+M,u.high=y+D+(x>>>0<M>>>0?1:0),E=c.low=E+L,c.high=k+U+(E>>>0<L>>>0?1:0),F=l.low=F+J,l.high=S+B+(F>>>0<J>>>0?1:0),_=h.low=_+H,h.high=A+$+(_>>>0<H>>>0?1:0)},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;return e[i>>>5]|=128<<24-i%32,e[30+(i+128>>>10<<5)]=Math.floor(n/4294967296),e[31+(i+128>>>10<<5)]=n,t.sigBytes=4*e.length,this._process(),this._hash.toX32()},clone:function(){var t=n.clone.call(this);return t._hash=this._hash.clone(),t},blockSize:32}),e.SHA512=n._createHelper(o),e.HmacSHA512=n._createHmacHelper(o)}(),function(){var t=b,e=(r=t.x64).Word,n=r.WordArray,i=(r=t.algo).SHA512,r=r.SHA384=i.extend({_doReset:function(){this._hash=new n.init([new e.init(3418070365,3238371032),new e.init(1654270250,914150663),new e.init(2438529370,812702999),new e.init(355462360,4144912697),new e.init(1731405415,4290775857),new e.init(2394180231,1750603025),new e.init(3675008525,1694076839),new e.init(1203062813,3204075428)])},_doFinalize:function(){var t=i._doFinalize.call(this);return t.sigBytes-=16,t}});t.SHA384=i._createHelper(r),t.HmacSHA384=i._createHmacHelper(r)}();var y="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function x(t){var e,n,i="";for(e=0;e+3<=t.length;e+=3)n=parseInt(t.substring(e,e+3),16),i+=y.charAt(n>>6)+y.charAt(63&n);for(e+1==t.length?(n=parseInt(t.substring(e,e+1),16),i+=y.charAt(n<<2)):e+2==t.length&&(n=parseInt(t.substring(e,e+2),16),i+=y.charAt(n>>2)+y.charAt((3&n)<<4));(3&i.length)>0;)i+="=";return i}function k(t){var e,n,i,r="",o=0;for(e=0;e<t.length&&"="!=t.charAt(e);++e)(i=y.indexOf(t.charAt(e)))<0||(0==o?(r+=C(i>>2),n=3&i,o=1):1==o?(r+=C(n<<2|i>>4),n=15&i,o=2):2==o?(r+=C(n),r+=C(i>>2),n=3&i,o=3):(r+=C(n<<2|i>>4),r+=C(15&i),o=0));return 1==o&&(r+=C(n<<2)),r}function E(t){var e,n=k(t),i=new Array;for(e=0;2*e<n.length;++e)i[e]=parseInt(n.substring(2*e,2*e+2),16);return i}function S(t,e,n){null!=t&&("number"==typeof t?this.fromNumber(t,e,n):this.fromString(t,null==e&&"string"!=typeof t?256:e))}function F(){return new S(null)}S.prototype.am=function(t,e,n,i,r,o){for(;--o>=0;){var s=e*this[t++]+n[i]+r;r=Math.floor(s/67108864),n[i++]=67108863&s}return r},S.prototype.DB=26,S.prototype.DM=67108863,S.prototype.DV=1<<26,S.prototype.FV=Math.pow(2,52),S.prototype.F1=26,S.prototype.F2=0;var A,_,j=new Array;for(A="0".charCodeAt(0),_=0;_<=9;++_)j[A++]=_;for(A="a".charCodeAt(0),_=10;_<36;++_)j[A++]=_;for(A="A".charCodeAt(0),_=10;_<36;++_)j[A++]=_;function C(t){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(t)}function R(t,e){var n=j[t.charCodeAt(e)];return null==n?-1:n}function I(t){var e=F();return e.fromInt(t),e}function T(t){var e,n=1;return 0!=(e=t>>>16)&&(t=e,n+=16),0!=(e=t>>8)&&(t=e,n+=8),0!=(e=t>>4)&&(t=e,n+=4),0!=(e=t>>2)&&(t=e,n+=2),0!=(e=t>>1)&&(t=e,n+=1),n}function O(t){this.m=t}function N(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function P(t,e){return t&e}function D(t,e){return t|e}function M(t,e){return t^e}function U(t,e){return t&~e}function L(t){if(0==t)return-1;var e=0;return 0==(65535&t)&&(t>>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function B(t){for(var e=0;0!=t;)t&=t-1,++e;return e}function J(){}function $(t){return t}function H(t){this.r2=F(),this.q3=F(),S.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}O.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},O.prototype.revert=function(t){return t},O.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},O.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n),this.reduce(n)},O.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},N.prototype.convert=function(t){var e=F();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(S.ZERO)>0&&this.m.subTo(e,e),e},N.prototype.revert=function(t){var e=F();return t.copyTo(e),this.reduce(e),e},N.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var n=32767&t[e],i=n*this.mpl+((n*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[n=e+this.m.t]+=this.m.am(0,i,t,e,0,this.m.t);t[n]>=t.DV;)t[n]-=t.DV,t[++n]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},N.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n),this.reduce(n)},N.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},S.prototype.copyTo=function(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s},S.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0},S.prototype.fromString=function(t,e){var n;if(16==e)n=4;else if(8==e)n=3;else if(256==e)n=8;else if(2==e)n=1;else if(32==e)n=5;else{if(4!=e)return void this.fromRadix(t,e);n=2}this.t=0,this.s=0;for(var i=t.length,r=!1,o=0;--i>=0;){var s=8==n?255&t[i]:R(t,i);s<0?"-"==t.charAt(i)&&(r=!0):(r=!1,0==o?this[this.t++]=s:o+n>this.DB?(this[this.t-1]|=(s&(1<<this.DB-o)-1)<<o,this[this.t++]=s>>this.DB-o):this[this.t-1]|=s<<o,(o+=n)>=this.DB&&(o-=this.DB))}8==n&&0!=(128&t[0])&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),r&&S.ZERO.subTo(this,this)},S.prototype.clamp=function(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t},S.prototype.dlShiftTo=function(t,e){var n;for(n=this.t-1;n>=0;--n)e[n+t]=this[n];for(n=t-1;n>=0;--n)e[n]=0;e.t=this.t+t,e.s=this.s},S.prototype.drShiftTo=function(t,e){for(var n=t;n<this.t;++n)e[n-t]=this[n];e.t=Math.max(this.t-t,0),e.s=this.s},S.prototype.lShiftTo=function(t,e){var n,i=t%this.DB,r=this.DB-i,o=(1<<r)-1,s=Math.floor(t/this.DB),a=this.s<<i&this.DM;for(n=this.t-1;n>=0;--n)e[n+s+1]=this[n]>>r|a,a=(this[n]&o)<<i;for(n=s-1;n>=0;--n)e[n]=0;e[s]=a,e.t=this.t+s+1,e.s=this.s,e.clamp()},S.prototype.rShiftTo=function(t,e){e.s=this.s;var n=Math.floor(t/this.DB);if(n>=this.t)e.t=0;else{var i=t%this.DB,r=this.DB-i,o=(1<<i)-1;e[0]=this[n]>>i;for(var s=n+1;s<this.t;++s)e[s-n-1]|=(this[s]&o)<<r,e[s-n]=this[s]>>i;i>0&&(e[this.t-n-1]|=(this.s&o)<<r),e.t=this.t-n,e.clamp()}},S.prototype.subTo=function(t,e){for(var n=0,i=0,r=Math.min(t.t,this.t);n<r;)i+=this[n]-t[n],e[n++]=i&this.DM,i>>=this.DB;if(t.t<this.t){for(i-=t.s;n<this.t;)i+=this[n],e[n++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;n<t.t;)i-=t[n],e[n++]=i&this.DM,i>>=this.DB;i-=t.s}e.s=i<0?-1:0,i<-1?e[n++]=this.DV+i:i>0&&(e[n++]=i),e.t=n,e.clamp()},S.prototype.multiplyTo=function(t,e){var n=this.abs(),i=t.abs(),r=n.t;for(e.t=r+i.t;--r>=0;)e[r]=0;for(r=0;r<i.t;++r)e[r+n.t]=n.am(0,i[r],e,r,0,n.t);e.s=0,e.clamp(),this.s!=t.s&&S.ZERO.subTo(e,e)},S.prototype.squareTo=function(t){for(var e=this.abs(),n=t.t=2*e.t;--n>=0;)t[n]=0;for(n=0;n<e.t-1;++n){var i=e.am(n,e[n],t,2*n,0,1);(t[n+e.t]+=e.am(n+1,2*e[n],t,2*n+1,i,e.t-n-1))>=e.DV&&(t[n+e.t]-=e.DV,t[n+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(n,e[n],t,2*n,0,1)),t.s=0,t.clamp()},S.prototype.divRemTo=function(t,e,n){var i=t.abs();if(!(i.t<=0)){var r=this.abs();if(r.t<i.t)return null!=e&&e.fromInt(0),void(null!=n&&this.copyTo(n));null==n&&(n=F());var o=F(),s=this.s,a=t.s,u=this.DB-T(i[i.t-1]);u>0?(i.lShiftTo(u,o),r.lShiftTo(u,n)):(i.copyTo(o),r.copyTo(n));var c=o.t,l=o[c-1];if(0!=l){var h=l*(1<<this.F1)+(c>1?o[c-2]>>this.F2:0),d=this.FV/h,f=(1<<this.F1)/h,p=1<<this.F2,v=n.t,g=v-c,m=null==e?F():e;for(o.dlShiftTo(g,m),n.compareTo(m)>=0&&(n[n.t++]=1,n.subTo(m,n)),S.ONE.dlShiftTo(c,m),m.subTo(o,o);o.t<c;)o[o.t++]=0;for(;--g>=0;){var w=n[--v]==l?this.DM:Math.floor(n[v]*d+(n[v-1]+p)*f);if((n[v]+=o.am(0,w,n,g,0,c))<w)for(o.dlShiftTo(g,m),n.subTo(m,n);n[v]<--w;)n.subTo(m,n)}null!=e&&(n.drShiftTo(c,e),s!=a&&S.ZERO.subTo(e,e)),n.t=c,n.clamp(),u>0&&n.rShiftTo(u,n),s<0&&S.ZERO.subTo(n,n)}}},S.prototype.invDigit=function(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},S.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},S.prototype.exp=function(t,e){if(t>4294967295||t<1)return S.ONE;var n=F(),i=F(),r=e.convert(this),o=T(t)-1;for(r.copyTo(n);--o>=0;)if(e.sqrTo(n,i),(t&1<<o)>0)e.mulTo(i,r,n);else{var s=n;n=i,i=s}return e.revert(n)},S.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var n,i=(1<<e)-1,r=!1,o="",s=this.t,a=this.DB-s*this.DB%e;if(s-- >0)for(a<this.DB&&(n=this[s]>>a)>0&&(r=!0,o=C(n));s>=0;)a<e?(n=(this[s]&(1<<a)-1)<<e-a,n|=this[--s]>>(a+=this.DB-e)):(n=this[s]>>(a-=e)&i,a<=0&&(a+=this.DB,--s)),n>0&&(r=!0),r&&(o+=C(n));return r?o:"0"},S.prototype.negate=function(){var t=F();return S.ZERO.subTo(this,t),t},S.prototype.abs=function(){return this.s<0?this.negate():this},S.prototype.compareTo=function(t){var e=this.s-t.s;if(0!=e)return e;var n=this.t;if(0!=(e=n-t.t))return this.s<0?-e:e;for(;--n>=0;)if(0!=(e=this[n]-t[n]))return e;return 0},S.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+T(this[this.t-1]^this.s&this.DM)},S.prototype.mod=function(t){var e=F();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(S.ZERO)>0&&t.subTo(e,e),e},S.prototype.modPowInt=function(t,e){var n;return n=t<256||e.isEven()?new O(e):new N(e),this.exp(t,n)},S.ZERO=I(0),S.ONE=I(1),J.prototype.convert=$,J.prototype.revert=$,J.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n)},J.prototype.sqrTo=function(t,e){t.squareTo(e)},H.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=F();return t.copyTo(e),this.reduce(e),e},H.prototype.revert=function(t){return t},H.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},H.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n),this.reduce(n)},H.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)};var K,z,W,q=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],V=(1<<26)/q[q.length-1];function G(){this.i=0,this.j=0,this.S=new Array}function X(){!function(t){z[W++]^=255&t,z[W++]^=t>>8&255,z[W++]^=t>>16&255,z[W++]^=t>>24&255,W>=256&&(W-=256)}((new Date).getTime())}if(S.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},S.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),n=Math.pow(t,e),i=I(n),r=F(),o=F(),s="";for(this.divRemTo(i,r,o);r.signum()>0;)s=(n+o.intValue()).toString(t).substr(1)+s,r.divRemTo(i,r,o);return o.intValue().toString(t)+s},S.prototype.fromRadix=function(t,e){this.fromInt(0),null==e&&(e=10);for(var n=this.chunkSize(e),i=Math.pow(e,n),r=!1,o=0,s=0,a=0;a<t.length;++a){var u=R(t,a);u<0?"-"==t.charAt(a)&&0==this.signum()&&(r=!0):(s=e*s+u,++o>=n&&(this.dMultiply(i),this.dAddOffset(s,0),o=0,s=0))}o>0&&(this.dMultiply(Math.pow(e,o)),this.dAddOffset(s,0)),r&&S.ZERO.subTo(this,this)},S.prototype.fromNumber=function(t,e,n){if("number"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,n),this.testBit(t-1)||this.bitwiseTo(S.ONE.shiftLeft(t-1),D,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(S.ONE.shiftLeft(t-1),this);else{var i=new Array,r=7&t;i.length=1+(t>>3),e.nextBytes(i),r>0?i[0]&=(1<<r)-1:i[0]=0,this.fromString(i,256)}},S.prototype.bitwiseTo=function(t,e,n){var i,r,o=Math.min(t.t,this.t);for(i=0;i<o;++i)n[i]=e(this[i],t[i]);if(t.t<this.t){for(r=t.s&this.DM,i=o;i<this.t;++i)n[i]=e(this[i],r);n.t=this.t}else{for(r=this.s&this.DM,i=o;i<t.t;++i)n[i]=e(r,t[i]);n.t=t.t}n.s=e(this.s,t.s),n.clamp()},S.prototype.changeBit=function(t,e){var n=S.ONE.shiftLeft(t);return this.bitwiseTo(n,e,n),n},S.prototype.addTo=function(t,e){for(var n=0,i=0,r=Math.min(t.t,this.t);n<r;)i+=this[n]+t[n],e[n++]=i&this.DM,i>>=this.DB;if(t.t<this.t){for(i+=t.s;n<this.t;)i+=this[n],e[n++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;n<t.t;)i+=t[n],e[n++]=i&this.DM,i>>=this.DB;i+=t.s}e.s=i<0?-1:0,i>0?e[n++]=i:i<-1&&(e[n++]=this.DV+i),e.t=n,e.clamp()},S.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},S.prototype.dAddOffset=function(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},S.prototype.multiplyLowerTo=function(t,e,n){var i,r=Math.min(this.t+t.t,e);for(n.s=0,n.t=r;r>0;)n[--r]=0;for(i=n.t-this.t;r<i;++r)n[r+this.t]=this.am(0,t[r],n,r,0,this.t);for(i=Math.min(t.t,e);r<i;++r)this.am(0,t[r],n,r,0,e-r);n.clamp()},S.prototype.multiplyUpperTo=function(t,e,n){--e;var i=n.t=this.t+t.t-e;for(n.s=0;--i>=0;)n[i]=0;for(i=Math.max(e-this.t,0);i<t.t;++i)n[this.t+i-e]=this.am(e-i,t[i],n,0,0,this.t+i-e);n.clamp(),n.drShiftTo(1,n)},S.prototype.modInt=function(t){if(t<=0)return 0;var e=this.DV%t,n=this.s<0?t-1:0;if(this.t>0)if(0==e)n=this[0]%t;else for(var i=this.t-1;i>=0;--i)n=(e*n+this[i])%t;return n},S.prototype.millerRabin=function(t){var e=this.subtract(S.ONE),n=e.getLowestSetBit();if(n<=0)return!1;var i=e.shiftRight(n);(t=t+1>>1)>q.length&&(t=q.length);for(var r=F(),o=0;o<t;++o){r.fromInt(q[Math.floor(Math.random()*q.length)]);var s=r.modPow(i,this);if(0!=s.compareTo(S.ONE)&&0!=s.compareTo(e)){for(var a=1;a++<n&&0!=s.compareTo(e);)if(0==(s=s.modPowInt(2,this)).compareTo(S.ONE))return!1;if(0!=s.compareTo(e))return!1}}return!0},S.prototype.clone=function(){var t=F();return this.copyTo(t),t},S.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},S.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},S.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},S.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},S.prototype.toByteArray=function(){var t=this.t,e=new Array;e[0]=this.s;var n,i=this.DB-t*this.DB%8,r=0;if(t-- >0)for(i<this.DB&&(n=this[t]>>i)!=(this.s&this.DM)>>i&&(e[r++]=n|this.s<<this.DB-i);t>=0;)i<8?(n=(this[t]&(1<<i)-1)<<8-i,n|=this[--t]>>(i+=this.DB-8)):(n=this[t]>>(i-=8)&255,i<=0&&(i+=this.DB,--t)),0!=(128&n)&&(n|=-256),0==r&&(128&this.s)!=(128&n)&&++r,(r>0||n!=this.s)&&(e[r++]=n);return e},S.prototype.equals=function(t){return 0==this.compareTo(t)},S.prototype.min=function(t){return this.compareTo(t)<0?this:t},S.prototype.max=function(t){return this.compareTo(t)>0?this:t},S.prototype.and=function(t){var e=F();return this.bitwiseTo(t,P,e),e},S.prototype.or=function(t){var e=F();return this.bitwiseTo(t,D,e),e},S.prototype.xor=function(t){var e=F();return this.bitwiseTo(t,M,e),e},S.prototype.andNot=function(t){var e=F();return this.bitwiseTo(t,U,e),e},S.prototype.not=function(){for(var t=F(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t},S.prototype.shiftLeft=function(t){var e=F();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e},S.prototype.shiftRight=function(t){var e=F();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e},S.prototype.getLowestSetBit=function(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+L(this[t]);return this.s<0?this.t*this.DB:-1},S.prototype.bitCount=function(){for(var t=0,e=this.s&this.DM,n=0;n<this.t;++n)t+=B(this[n]^e);return t},S.prototype.testBit=function(t){var e=Math.floor(t/this.DB);return e>=this.t?0!=this.s:0!=(this[e]&1<<t%this.DB)},S.prototype.setBit=function(t){return this.changeBit(t,D)},S.prototype.clearBit=function(t){return this.changeBit(t,U)},S.prototype.flipBit=function(t){return this.changeBit(t,M)},S.prototype.add=function(t){var e=F();return this.addTo(t,e),e},S.prototype.subtract=function(t){var e=F();return this.subTo(t,e),e},S.prototype.multiply=function(t){var e=F();return this.multiplyTo(t,e),e},S.prototype.divide=function(t){var e=F();return this.divRemTo(t,e,null),e},S.prototype.remainder=function(t){var e=F();return this.divRemTo(t,null,e),e},S.prototype.divideAndRemainder=function(t){var e=F(),n=F();return this.divRemTo(t,e,n),new Array(e,n)},S.prototype.modPow=function(t,e){var n,i,r=t.bitLength(),o=I(1);if(r<=0)return o;n=r<18?1:r<48?3:r<144?4:r<768?5:6,i=r<8?new O(e):e.isEven()?new H(e):new N(e);var s=new Array,a=3,u=n-1,c=(1<<n)-1;if(s[1]=i.convert(this),n>1){var l=F();for(i.sqrTo(s[1],l);a<=c;)s[a]=F(),i.mulTo(l,s[a-2],s[a]),a+=2}var h,d,f=t.t-1,p=!0,v=F();for(r=T(t[f])-1;f>=0;){for(r>=u?h=t[f]>>r-u&c:(h=(t[f]&(1<<r+1)-1)<<u-r,f>0&&(h|=t[f-1]>>this.DB+r-u)),a=n;0==(1&h);)h>>=1,--a;if((r-=a)<0&&(r+=this.DB,--f),p)s[h].copyTo(o),p=!1;else{for(;a>1;)i.sqrTo(o,v),i.sqrTo(v,o),a-=2;a>0?i.sqrTo(o,v):(d=o,o=v,v=d),i.mulTo(v,s[h],o)}for(;f>=0&&0==(t[f]&1<<r);)i.sqrTo(o,v),d=o,o=v,v=d,--r<0&&(r=this.DB-1,--f)}return i.revert(o)},S.prototype.modInverse=function(t){var e=t.isEven();if(this.isEven()&&e||0==t.signum())return S.ZERO;for(var n=t.clone(),i=this.clone(),r=I(1),o=I(0),s=I(0),a=I(1);0!=n.signum();){for(;n.isEven();)n.rShiftTo(1,n),e?(r.isEven()&&o.isEven()||(r.addTo(this,r),o.subTo(t,o)),r.rShiftTo(1,r)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);for(;i.isEven();)i.rShiftTo(1,i),e?(s.isEven()&&a.isEven()||(s.addTo(this,s),a.subTo(t,a)),s.rShiftTo(1,s)):a.isEven()||a.subTo(t,a),a.rShiftTo(1,a);n.compareTo(i)>=0?(n.subTo(i,n),e&&r.subTo(s,r),o.subTo(a,o)):(i.subTo(n,i),e&&s.subTo(r,s),a.subTo(o,a))}return 0!=i.compareTo(S.ONE)?S.ZERO:a.compareTo(t)>=0?a.subtract(t):a.signum()<0?(a.addTo(t,a),a.signum()<0?a.add(t):a):a},S.prototype.pow=function(t){return this.exp(t,new J)},S.prototype.gcd=function(t){var e=this.s<0?this.negate():this.clone(),n=t.s<0?t.negate():t.clone();if(e.compareTo(n)<0){var i=e;e=n,n=i}var r=e.getLowestSetBit(),o=n.getLowestSetBit();if(o<0)return e;for(r<o&&(o=r),o>0&&(e.rShiftTo(o,e),n.rShiftTo(o,n));e.signum()>0;)(r=e.getLowestSetBit())>0&&e.rShiftTo(r,e),(r=n.getLowestSetBit())>0&&n.rShiftTo(r,n),e.compareTo(n)>=0?(e.subTo(n,e),e.rShiftTo(1,e)):(n.subTo(e,n),n.rShiftTo(1,n));return o>0&&n.lShiftTo(o,n),n},S.prototype.isProbablePrime=function(t){var e,n=this.abs();if(1==n.t&&n[0]<=q[q.length-1]){for(e=0;e<q.length;++e)if(n[0]==q[e])return!0;return!1}if(n.isEven())return!1;for(e=1;e<q.length;){for(var i=q[e],r=e+1;r<q.length&&i<V;)i*=q[r++];for(i=n.modInt(i);e<r;)if(i%q[e++]==0)return!1}return n.millerRabin(t)},S.prototype.square=function(){var t=F();return this.squareTo(t),t},G.prototype.init=function(t){var e,n,i;for(e=0;e<256;++e)this.S[e]=e;for(n=0,e=0;e<256;++e)i=this.S[e],this.S[e]=this.S[n=n+this.S[e]+t[e%t.length]&255],this.S[n]=i;this.i=0,this.j=0},G.prototype.next=function(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]},null==z){var Y;if(z=new Array,W=0,void 0!==w&&void 0!==w.msCrypto){var Z=w.msCrypto;if(Z.getRandomValues){var Q=new Uint8Array(32);for(Z.getRandomValues(Q),Y=0;Y<32;++Y)z[W++]=Q[Y]}}for(;W<256;)Y=Math.floor(65536*Math.random()),z[W++]=Y>>>8,z[W++]=255&Y;W=0,X()}function tt(){if(null==K){for(X(),(K=new G).init(z),W=0;W<z.length;++W)z[W]=0;W=0}return K.next()}function et(){}function nt(t,e){return new S(t,e)}function it(t,e,n){for(var i="",r=0;i.length<e;)i+=n(String.fromCharCode.apply(String,t.concat([(4278190080&r)>>24,(16711680&r)>>16,(65280&r)>>8,255&r]))),r+=1;return i}function rt(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}function ot(t,e){this.x=e,this.q=t}function st(t,e,n,i){this.curve=t,this.x=e,this.y=n,this.z=null==i?S.ONE:i,this.zinv=null}function at(t,e,n){this.q=t,this.a=this.fromBigInteger(e),this.b=this.fromBigInteger(n),this.infinity=new st(this,null,null)}et.prototype.nextBytes=function(t){var e;for(e=0;e<t.length;++e)t[e]=tt()},rt.prototype.doPublic=function(t){return t.modPowInt(this.e,this.n)},rt.prototype.setPublic=function(t,e){if(this.isPublic=!0,this.isPrivate=!1,"string"!=typeof t)this.n=t,this.e=e;else{if(!(null!=t&&null!=e&&t.length>0&&e.length>0))throw"Invalid RSA public key";this.n=nt(t,16),this.e=parseInt(e,16)}},rt.prototype.encrypt=function(t){var e=function(t,e){if(e<t.length+11)throw"Message too long for RSA";for(var n=new Array,i=t.length-1;i>=0&&e>0;){var r=t.charCodeAt(i--);r<128?n[--e]=r:r>127&&r<2048?(n[--e]=63&r|128,n[--e]=r>>6|192):(n[--e]=63&r|128,n[--e]=r>>6&63|128,n[--e]=r>>12|224)}n[--e]=0;for(var o=new et,s=new Array;e>2;){for(s[0]=0;0==s[0];)o.nextBytes(s);n[--e]=s[0]}return n[--e]=2,n[--e]=0,new S(n)}(t,this.n.bitLength()+7>>3);if(null==e)return null;var n=this.doPublic(e);if(null==n)return null;var i=n.toString(16);return 0==(1&i.length)?i:"0"+i},rt.prototype.encryptOAEP=function(t,e,n){var i=function(t,e,n,i){var r=ct.crypto.MessageDigest,o=ct.crypto.Util,s=null;if(n||(n="sha1"),"string"==typeof n&&(s=r.getCanonicalAlgName(n),i=r.getHashLength(s),n=function(t){return Et(o.hashHex(St(t),s))}),t.length+2*i+2>e)throw"Message too long for RSA";var a,u="";for(a=0;a<e-t.length-2*i-2;a+=1)u+="\0";var c=n("")+u+""+t,l=new Array(i);(new et).nextBytes(l);var h=it(l,c.length,n),d=[];for(a=0;a<c.length;a+=1)d[a]=c.charCodeAt(a)^h.charCodeAt(a);var f=it(d,l.length,n),p=[0];for(a=0;a<l.length;a+=1)p[a+1]=l[a]^f.charCodeAt(a);return new S(p.concat(d))}(t,this.n.bitLength()+7>>3,e,n);if(null==i)return null;var r=this.doPublic(i);if(null==r)return null;var o=r.toString(16);return 0==(1&o.length)?o:"0"+o},rt.prototype.type="RSA",ot.prototype.equals=function(t){return t==this||this.q.equals(t.q)&&this.x.equals(t.x)},ot.prototype.toBigInteger=function(){return this.x},ot.prototype.negate=function(){return new ot(this.q,this.x.negate().mod(this.q))},ot.prototype.add=function(t){return new ot(this.q,this.x.add(t.toBigInteger()).mod(this.q))},ot.prototype.subtract=function(t){return new ot(this.q,this.x.subtract(t.toBigInteger()).mod(this.q))},ot.prototype.multiply=function(t){return new ot(this.q,this.x.multiply(t.toBigInteger()).mod(this.q))},ot.prototype.square=function(){return new ot(this.q,this.x.square().mod(this.q))},ot.prototype.divide=function(t){return new ot(this.q,this.x.multiply(t.toBigInteger().modInverse(this.q)).mod(this.q))},st.prototype.getX=function(){return null==this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))},st.prototype.getY=function(){return null==this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))},st.prototype.equals=function(t){return t==this||(this.isInfinity()?t.isInfinity():t.isInfinity()?this.isInfinity():!!t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(S.ZERO)&&t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(S.ZERO))},st.prototype.isInfinity=function(){return null==this.x&&null==this.y||this.z.equals(S.ZERO)&&!this.y.toBigInteger().equals(S.ZERO)},st.prototype.negate=function(){return new st(this.curve,this.x,this.y.negate(),this.z)},st.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q),n=t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q);if(S.ZERO.equals(n))return S.ZERO.equals(e)?this.twice():this.curve.getInfinity();var i=new S("3"),r=this.x.toBigInteger(),o=this.y.toBigInteger(),s=(t.x.toBigInteger(),t.y.toBigInteger(),n.square()),a=s.multiply(n),u=r.multiply(s),c=e.square().multiply(this.z),l=c.subtract(u.shiftLeft(1)).multiply(t.z).subtract(a).multiply(n).mod(this.curve.q),h=u.multiply(i).multiply(e).subtract(o.multiply(a)).subtract(c.multiply(e)).multiply(t.z).add(e.multiply(a)).mod(this.curve.q),d=a.multiply(this.z).multiply(t.z).mod(this.curve.q);return new st(this.curve,this.curve.fromBigInteger(l),this.curve.fromBigInteger(h),d)},st.prototype.twice=function(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var t=new S("3"),e=this.x.toBigInteger(),n=this.y.toBigInteger(),i=n.multiply(this.z),r=i.multiply(n).mod(this.curve.q),o=this.curve.a.toBigInteger(),s=e.square().multiply(t);S.ZERO.equals(o)||(s=s.add(this.z.square().multiply(o)));var a=(s=s.mod(this.curve.q)).square().subtract(e.shiftLeft(3).multiply(r)).shiftLeft(1).multiply(i).mod(this.curve.q),u=s.multiply(t).multiply(e).subtract(r.shiftLeft(1)).shiftLeft(2).multiply(r).subtract(s.square().multiply(s)).mod(this.curve.q),c=i.square().multiply(i).shiftLeft(3).mod(this.curve.q);return new st(this.curve,this.curve.fromBigInteger(a),this.curve.fromBigInteger(u),c)},st.prototype.multiply=function(t){if(this.isInfinity())return this;if(0==t.signum())return this.curve.getInfinity();var e,n=t,i=n.multiply(new S("3")),r=this.negate(),o=this,s=this.curve.q.subtract(t),a=s.multiply(new S("3")),u=new st(this.curve,this.x,this.y),c=u.negate();for(e=i.bitLength()-2;e>0;--e){o=o.twice();var l=i.testBit(e);l!=n.testBit(e)&&(o=o.add(l?this:r))}for(e=a.bitLength()-2;e>0;--e){u=u.twice();var h=a.testBit(e);h!=s.testBit(e)&&(u=u.add(h?u:c))}return o},st.prototype.multiplyTwo=function(t,e,n){var i;i=t.bitLength()>n.bitLength()?t.bitLength()-1:n.bitLength()-1;for(var r=this.curve.getInfinity(),o=this.add(e);i>=0;)r=r.twice(),t.testBit(i)?r=n.testBit(i)?r.add(o):r.add(this):n.testBit(i)&&(r=r.add(e)),--i;return r},at.prototype.getQ=function(){return this.q},at.prototype.getA=function(){return this.a},at.prototype.getB=function(){return this.b},at.prototype.equals=function(t){return t==this||this.q.equals(t.q)&&this.a.equals(t.a)&&this.b.equals(t.b)},at.prototype.getInfinity=function(){return this.infinity},at.prototype.fromBigInteger=function(t){return new ot(this.q,t)},at.prototype.decodePointHex=function(t){switch(parseInt(t.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:return null;case 4:case 6:case 7:var e=(t.length-2)/2,n=t.substr(2,e),i=t.substr(e+2,e);return new st(this,this.fromBigInteger(new S(n,16)),this.fromBigInteger(new S(i,16)));default:return null}},ot.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)},st.prototype.getEncoded=function(t){var e=function(t,e){var n=t.toByteArrayUnsigned();if(e<n.length)n=n.slice(n.length-e);else for(;e>n.length;)n.unshift(0);return n},n=this.getX().toBigInteger(),i=this.getY().toBigInteger(),r=e(n,32);return t?i.isEven()?r.unshift(2):r.unshift(3):(r.unshift(4),r=r.concat(e(i,32))),r},st.decodeFrom=function(t,e){var n=e.length-1,i=e.slice(1,1+n/2),r=e.slice(1+n/2,1+n);i.unshift(0),r.unshift(0);var o=new S(i),s=new S(r);return new st(t,t.fromBigInteger(o),t.fromBigInteger(s))},st.decodeFromHex=function(t,e){e.substr(0,2);var n=e.length-2,i=e.substr(2,n/2),r=e.substr(2+n/2,n/2),o=new S(i,16),s=new S(r,16);return new st(t,t.fromBigInteger(o),t.fromBigInteger(s))},st.prototype.add2D=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;if(this.x.equals(t.x))return this.y.equals(t.y)?this.twice():this.curve.getInfinity();var e=t.x.subtract(this.x),n=t.y.subtract(this.y).divide(e),i=n.square().subtract(this.x).subtract(t.x),r=n.multiply(this.x.subtract(i)).subtract(this.y);return new st(this.curve,i,r)},st.prototype.twice2D=function(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var t=this.curve.fromBigInteger(S.valueOf(2)),e=this.curve.fromBigInteger(S.valueOf(3)),n=this.x.square().multiply(e).add(this.curve.a).divide(this.y.multiply(t)),i=n.square().subtract(this.x.multiply(t)),r=n.multiply(this.x.subtract(i)).subtract(this.y);return new st(this.curve,i,r)},st.prototype.multiply2D=function(t){if(this.isInfinity())return this;if(0==t.signum())return this.curve.getInfinity();var e,n=t,i=n.multiply(new S("3")),r=this.negate(),o=this;for(e=i.bitLength()-2;e>0;--e){o=o.twice();var s=i.testBit(e);s!=n.testBit(e)&&(o=o.add2D(s?this:r))}return o},st.prototype.isOnCurve=function(){var t=this.getX().toBigInteger(),e=this.getY().toBigInteger(),n=this.curve.getA().toBigInteger(),i=this.curve.getB().toBigInteger(),r=this.curve.getQ(),o=e.multiply(e).mod(r),s=t.multiply(t).multiply(t).add(n.multiply(t)).add(i).mod(r);return o.equals(s)},st.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"},st.prototype.validate=function(){var t=this.curve.getQ();if(this.isInfinity())throw new Error("Point is at infinity.");var e=this.getX().toBigInteger(),n=this.getY().toBigInteger();if(e.compareTo(S.ONE)<0||e.compareTo(t.subtract(S.ONE))>0)throw new Error("x coordinate out of bounds");if(n.compareTo(S.ONE)<0||n.compareTo(t.subtract(S.ONE))>0)throw new Error("y coordinate out of bounds");if(!this.isOnCurve())throw new Error("Point is not on the curve.");if(this.multiply(t).isInfinity())throw new Error("Point is not a scalar multiple of G.");return!0};var ut=function(){var t=new RegExp('(?:false|true|null|[\\{\\}\\[\\]]|(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)|(?:"(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))*"))',"g"),e=new RegExp("\\\\(?:([^u])|u(.{4}))","g"),n={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};function i(t,e,i){return e?n[e]:String.fromCharCode(parseInt(i,16))}var r=new String(""),o=Object.hasOwnProperty;return function(n,s){var a,u,c=n.match(t),l=c[0],h=!1;"{"===l?a={}:"["===l?a=[]:(a=[],h=!0);for(var d=[a],f=1-h,p=c.length;f<p;++f){var v;switch((l=c[f]).charCodeAt(0)){default:(v=d[0])[u||v.length]=+l,u=void 0;break;case 34:if(-1!==(l=l.substring(1,l.length-1)).indexOf("\\")&&(l=l.replace(e,i)),v=d[0],!u){if(!(v instanceof Array)){u=l||r;break}u=v.length}v[u]=l,u=void 0;break;case 91:d.unshift((v=d[0])[u||v.length]=[]),u=void 0;break;case 93:d.shift();break;case 102:(v=d[0])[u||v.length]=!1,u=void 0;break;case 110:(v=d[0])[u||v.length]=null,u=void 0;break;case 116:(v=d[0])[u||v.length]=!0,u=void 0;break;case 123:d.unshift((v=d[0])[u||v.length]={}),u=void 0;break;case 125:d.shift()}}if(h){if(1!==d.length)throw new Error;a=a[0]}else if(d.length)throw new Error;return s&&(a=function t(e,n){var i=e[n];if(i&&"object"===(void 0===i?"undefined":m(i))){var r=null;for(var a in i)if(o.call(i,a)&&i!==e){var u=t(i,a);void 0!==u?i[a]=u:(r||(r=[]),r.push(a))}if(r)for(var c=r.length;--c>=0;)delete i[r[c]]}return s.call(e,n,i)}({"":a},"")),a}}();void 0!==ct&&ct||(e.KJUR=ct={}),void 0!==ct.asn1&&ct.asn1||(ct.asn1={}),ct.asn1.ASN1Util=new function(){this.integerToByteHex=function(t){var e=t.toString(16);return e.length%2==1&&(e="0"+e),e},this.bigIntToMinTwosComplementsHex=function(t){var e=t.toString(16);if("-"!=e.substr(0,1))e.length%2==1?e="0"+e:e.match(/^[0-7]/)||(e="00"+e);else{var n=e.substr(1).length;n%2==1?n+=1:e.match(/^[0-7]/)||(n+=2);for(var i="",r=0;r<n;r++)i+="f";e=new S(i,16).xor(t).add(S.ONE).toString(16).replace(/^-/,"")}return e},this.getPEMStringFromHex=function(t,e){return jt(t,e)},this.newObject=function(t){var e=ct.asn1,n=e.ASN1Object,i=e.DERBoolean,r=e.DERInteger,o=e.DERBitString,s=e.DEROctetString,a=e.DERNull,u=e.DERObjectIdentifier,c=e.DEREnumerated,l=e.DERUTF8String,h=e.DERNumericString,d=e.DERPrintableString,f=e.DERTeletexString,p=e.DERIA5String,v=e.DERUTCTime,g=e.DERGeneralizedTime,m=e.DERVisibleString,w=e.DERBMPString,b=e.DERSequence,y=e.DERSet,x=e.DERTaggedObject,k=e.ASN1Util.newObject;if(t instanceof e.ASN1Object)return t;var E=Object.keys(t);if(1!=E.length)throw new Error("key of param shall be only one.");var S=E[0];if(-1==":asn1:bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:visstr:bmpstr:seq:set:tag:".indexOf(":"+S+":"))throw new Error("undefined key: "+S);if("bool"==S)return new i(t[S]);if("int"==S)return new r(t[S]);if("bitstr"==S)return new o(t[S]);if("octstr"==S)return new s(t[S]);if("null"==S)return new a(t[S]);if("oid"==S)return new u(t[S]);if("enum"==S)return new c(t[S]);if("utf8str"==S)return new l(t[S]);if("numstr"==S)return new h(t[S]);if("prnstr"==S)return new d(t[S]);if("telstr"==S)return new f(t[S]);if("ia5str"==S)return new p(t[S]);if("utctime"==S)return new v(t[S]);if("gentime"==S)return new g(t[S]);if("visstr"==S)return new m(t[S]);if("bmpstr"==S)return new w(t[S]);if("asn1"==S)return new n(t[S]);if("seq"==S){for(var F=t[S],A=[],_=0;_<F.length;_++){var j=k(F[_]);A.push(j)}return new b({array:A})}if("set"==S){for(F=t[S],A=[],_=0;_<F.length;_++)j=k(F[_]),A.push(j);return new y({array:A})}if("tag"==S){var C=t[S];if("[object Array]"===Object.prototype.toString.call(C)&&3==C.length){var R=k(C[2]);return new x({tag:C[0],explicit:C[1],obj:R})}return new x(C)}},this.jsonToASN1HEX=function(t){return this.newObject(t).getEncodedHex()}},ct.asn1.ASN1Util.oidHexToInt=function(t){for(var e="",n=parseInt(t.substr(0,2),16),i=(e=Math.floor(n/40)+"."+n%40,""),r=2;r<t.length;r+=2){var o=("00000000"+parseInt(t.substr(r,2),16).toString(2)).slice(-8);i+=o.substr(1,7),"0"==o.substr(0,1)&&(e=e+"."+new S(i,2).toString(10),i="")}return e},ct.asn1.ASN1Util.oidIntToHex=function(t){var e=function(t){var e=t.toString(16);return 1==e.length&&(e="0"+e),e},n=function(t){var n="",i=new S(t,10).toString(2),r=7-i.length%7;7==r&&(r=0);for(var o="",s=0;s<r;s++)o+="0";for(i=o+i,s=0;s<i.length-1;s+=7){var a=i.substr(s,7);s!=i.length-7&&(a="1"+a),n+=e(parseInt(a,2))}return n};if(!t.match(/^[0-9.]+$/))throw"malformed oid string: "+t;var i="",r=t.split("."),o=40*parseInt(r[0])+parseInt(r[1]);i+=e(o),r.splice(0,2);for(var s=0;s<r.length;s++)i+=n(r[s]);return i},ct.asn1.ASN1Object=function(t){this.params=null,this.getLengthHexFromValue=function(){if(void 0===this.hV||null==this.hV)throw new Error("this.hV is null or undefined");if(this.hV.length%2==1)throw new Error("value hex must be even length: n="+"".length+",v="+this.hV);var t=this.hV.length/2,e=t.toString(16);if(e.length%2==1&&(e="0"+e),t<128)return e;var n=e.length/2;if(n>15)throw"ASN.1 length too long to represent by 8x: n = "+t.toString(16);return(128+n).toString(16)+e},this.getEncodedHex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""},this.setByParam=function(t){this.params=t},null!=t&&null!=t.tlv&&(this.hTLV=t.tlv,this.isModified=!1)},ct.asn1.DERAbstractString=function(t){ct.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=xt(this.s).toLowerCase()},this.setStringHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t?this.setString(t):void 0!==t.str?this.setString(t.str):void 0!==t.hex&&this.setStringHex(t.hex))},$t(ct.asn1.DERAbstractString,ct.asn1.ASN1Object),ct.asn1.DERAbstractTime=function(){ct.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(t){var e=t.getTime()+6e4*t.getTimezoneOffset();return new Date(e)},this.formatDate=function(t,e,n){var i=this.zeroPadding,r=this.localDateToUTC(t),o=String(r.getFullYear());"utc"==e&&(o=o.substr(2,2));var s=o+i(String(r.getMonth()+1),2)+i(String(r.getDate()),2)+i(String(r.getHours()),2)+i(String(r.getMinutes()),2)+i(String(r.getSeconds()),2);if(!0===n){var a=r.getMilliseconds();if(0!=a){var u=i(String(a),3);s=s+"."+(u=u.replace(/[0]+$/,""))}}return s+"Z"},this.zeroPadding=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=gt(t)},this.setByDateValue=function(t,e,n,i,r,o){var s=new Date(Date.UTC(t,e-1,n,i,r,o,0));this.setByDate(s)},this.getFreshValueHex=function(){return this.hV}},$t(ct.asn1.DERAbstractTime,ct.asn1.ASN1Object),ct.asn1.DERAbstractStructured=function(t){ct.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array=t},this.appendASN1Object=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array.push(t)},this.asn1Array=new Array,void 0!==t&&void 0!==t.array&&(this.asn1Array=t.array)},$t(ct.asn1.DERAbstractStructured,ct.asn1.ASN1Object),ct.asn1.DERBoolean=function(t){ct.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV=0==t?"010100":"0101ff"},$t(ct.asn1.DERBoolean,ct.asn1.ASN1Object),ct.asn1.DERInteger=function(t){ct.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=ct.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new S(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.bigint?this.setByBigInteger(t.bigint):void 0!==t.int?this.setByInteger(t.int):"number"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},$t(ct.asn1.DERInteger,ct.asn1.ASN1Object),ct.asn1.DERBitString=function(t){if(void 0!==t&&void 0!==t.obj){var e=ct.asn1.ASN1Util.newObject(t.obj);t.hex="00"+e.getEncodedHex()}ct.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(t){this.hTLV=null,this.isModified=!0,this.hV=t},this.setUnusedBitsAndHexValue=function(t,e){if(t<0||7<t)throw"unused bits shall be from 0 to 7: u = "+t;var n="0"+t;this.hTLV=null,this.isModified=!0,this.hV=n+e},this.setByBinaryString=function(t){var e=8-(t=t.replace(/0+$/,"")).length%8;8==e&&(e=0);for(var n=0;n<=e;n++)t+="0";var i="";for(n=0;n<t.length-1;n+=8){var r=t.substr(n,8),o=parseInt(r,2).toString(16);1==o.length&&(o="0"+o),i+=o}this.hTLV=null,this.isModified=!0,this.hV="0"+e+i},this.setByBooleanArray=function(t){for(var e="",n=0;n<t.length;n++)e+=1==t[n]?"1":"0";this.setByBinaryString(e)},this.newFalseArray=function(t){for(var e=new Array(t),n=0;n<t;n++)e[n]=!1;return e},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t&&t.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(t):void 0!==t.hex?this.setHexValueIncludingUnusedBits(t.hex):void 0!==t.bin?this.setByBinaryString(t.bin):void 0!==t.array&&this.setByBooleanArray(t.array))},$t(ct.asn1.DERBitString,ct.asn1.ASN1Object),ct.asn1.DEROctetString=function(t){if(void 0!==t&&void 0!==t.obj){var e=ct.asn1.ASN1Util.newObject(t.obj);t.hex=e.getEncodedHex()}ct.asn1.DEROctetString.superclass.constructor.call(this,t),this.hT="04"},$t(ct.asn1.DEROctetString,ct.asn1.DERAbstractString),ct.asn1.DERNull=function(){ct.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},$t(ct.asn1.DERNull,ct.asn1.ASN1Object),ct.asn1.DERObjectIdentifier=function(t){ct.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.setValueOidString=function(t){var e=function(t){var e=function(t){var e=t.toString(16);return 1==e.length&&(e="0"+e),e},n=function(t){var n="",i=parseInt(t,10).toString(2),r=7-i.length%7;7==r&&(r=0);for(var o="",s=0;s<r;s++)o+="0";for(i=o+i,s=0;s<i.length-1;s+=7){var a=i.substr(s,7);s!=i.length-7&&(a="1"+a),n+=e(parseInt(a,2))}return n};try{if(!t.match(/^[0-9.]+$/))return null;var i="",r=t.split("."),o=40*parseInt(r[0],10)+parseInt(r[1],10);i+=e(o),r.splice(0,2);for(var s=0;s<r.length;s++)i+=n(r[s]);return i}catch(t){return null}}(t);if(null==e)throw new Error("malformed oid string: "+t);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.setValueName=function(t){var e=ct.asn1.x509.OID.name2oid(t);if(""===e)throw new Error("DERObjectIdentifier oidName undefined: "+t);this.setValueOidString(e)},this.setValueNameOrOid=function(t){t.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(t):this.setValueName(t)},this.getFreshValueHex=function(){return this.hV},this.setByParam=function(t){"string"==typeof t?this.setValueNameOrOid(t):void 0!==t.oid?this.setValueNameOrOid(t.oid):void 0!==t.name?this.setValueNameOrOid(t.name):void 0!==t.hex&&this.setValueHex(t.hex)},void 0!==t&&this.setByParam(t)},$t(ct.asn1.DERObjectIdentifier,ct.asn1.ASN1Object),ct.asn1.DEREnumerated=function(t){ct.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=ct.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new S(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.int?this.setByInteger(t.int):"number"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},$t(ct.asn1.DEREnumerated,ct.asn1.ASN1Object),ct.asn1.DERUTF8String=function(t){ct.asn1.DERUTF8String.superclass.constructor.call(this,t),this.hT="0c"},$t(ct.asn1.DERUTF8String,ct.asn1.DERAbstractString),ct.asn1.DERNumericString=function(t){ct.asn1.DERNumericString.superclass.constructor.call(this,t),this.hT="12"},$t(ct.asn1.DERNumericString,ct.asn1.DERAbstractString),ct.asn1.DERPrintableString=function(t){ct.asn1.DERPrintableString.superclass.constructor.call(this,t),this.hT="13"},$t(ct.asn1.DERPrintableString,ct.asn1.DERAbstractString),ct.asn1.DERTeletexString=function(t){ct.asn1.DERTeletexString.superclass.constructor.call(this,t),this.hT="14"},$t(ct.asn1.DERTeletexString,ct.asn1.DERAbstractString),ct.asn1.DERIA5String=function(t){ct.asn1.DERIA5String.superclass.constructor.call(this,t),this.hT="16"},$t(ct.asn1.DERIA5String,ct.asn1.DERAbstractString),ct.asn1.DERVisibleString=function(t){ct.asn1.DERIA5String.superclass.constructor.call(this,t),this.hT="1a"},$t(ct.asn1.DERVisibleString,ct.asn1.DERAbstractString),ct.asn1.DERBMPString=function(t){ct.asn1.DERBMPString.superclass.constructor.call(this,t),this.hT="1e"},$t(ct.asn1.DERBMPString,ct.asn1.DERAbstractString),ct.asn1.DERUTCTime=function(t){ct.asn1.DERUTCTime.superclass.constructor.call(this,t),this.hT="17",this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"utc"),this.hV=gt(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=gt(this.s)),this.hV},void 0!==t&&(void 0!==t.str?this.setString(t.str):"string"==typeof t&&t.match(/^[0-9]{12}Z$/)?this.setString(t):void 0!==t.hex?this.setStringHex(t.hex):void 0!==t.date&&this.setByDate(t.date))},$t(ct.asn1.DERUTCTime,ct.asn1.DERAbstractTime),ct.asn1.DERGeneralizedTime=function(t){ct.asn1.DERGeneralizedTime.superclass.constructor.call(this,t),this.hT="18",this.withMillis=!1,this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=gt(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=gt(this.s)),this.hV},void 0!==t&&(void 0!==t.str?this.setString(t.str):"string"==typeof t&&t.match(/^[0-9]{14}Z$/)?this.setString(t):void 0!==t.hex?this.setStringHex(t.hex):void 0!==t.date&&this.setByDate(t.date),!0===t.millis&&(this.withMillis=!0))},$t(ct.asn1.DERGeneralizedTime,ct.asn1.DERAbstractTime),ct.asn1.DERSequence=function(t){ct.asn1.DERSequence.superclass.constructor.call(this,t),this.hT="30",this.getFreshValueHex=function(){for(var t="",e=0;e<this.asn1Array.length;e++)t+=this.asn1Array[e].getEncodedHex();return this.hV=t,this.hV}},$t(ct.asn1.DERSequence,ct.asn1.DERAbstractStructured),ct.asn1.DERSet=function(t){ct.asn1.DERSet.superclass.constructor.call(this,t),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var t=new Array,e=0;e<this.asn1Array.length;e++)t.push(this.asn1Array[e].getEncodedHex());return 1==this.sortFlag&&t.sort(),this.hV=t.join(""),this.hV},void 0!==t&&void 0!==t.sortflag&&0==t.sortflag&&(this.sortFlag=!1)},$t(ct.asn1.DERSet,ct.asn1.DERAbstractStructured),ct.asn1.DERTaggedObject=function(t){ct.asn1.DERTaggedObject.superclass.constructor.call(this);var e=ct.asn1;this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(t,e,n){this.hT=e,this.isExplicit=t,this.asn1Object=n,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=n.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,e),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},this.setByParam=function(t){null!=t.tag&&(this.hT=t.tag),null!=t.explicit&&(this.isExplicit=t.explicit),null!=t.tage&&(this.hT=t.tage,this.isExplicit=!0),null!=t.tagi&&(this.hT=t.tagi,this.isExplicit=!1),null!=t.obj&&(t.obj instanceof e.ASN1Object?(this.asn1Object=t.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)):"object"==m(t.obj)&&(this.asn1Object=e.ASN1Util.newObject(t.obj),this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},null!=t&&this.setByParam(t)},$t(ct.asn1.DERTaggedObject,ct.asn1.ASN1Object);var ct,lt,ht,dt=new function(){};function ft(t){for(var e=new Array,n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}function pt(t){for(var e="",n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return e}function vt(t){for(var e="",n=0;n<t.length;n++){var i=t[n].toString(16);1==i.length&&(i="0"+i),e+=i}return e}function gt(t){return vt(ft(t))}function mt(t){return(t=(t=t.replace(/\=/g,"")).replace(/\+/g,"-")).replace(/\//g,"_")}function wt(t){return t.length%4==2?t+="==":t.length%4==3&&(t+="="),(t=t.replace(/-/g,"+")).replace(/_/g,"/")}function bt(t){return t.length%2==1&&(t="0"+t),mt(x(t))}function yt(t){return k(wt(t))}function xt(t){return Tt(Ut(t))}function kt(t){return decodeURIComponent(Ot(t))}function Et(t){for(var e="",n=0;n<t.length-1;n+=2)e+=String.fromCharCode(parseInt(t.substr(n,2),16));return e}function St(t){for(var e="",n=0;n<t.length;n++)e+=("0"+t.charCodeAt(n).toString(16)).slice(-2);return e}function Ft(t){return x(t)}function At(t){return Ft(t).replace(/(.{64})/g,"$1\r\n").replace(/\r\n$/,"")}function _t(t){return k(t.replace(/[^0-9A-Za-z\/+=]*/g,""))}function jt(t,e){return"-----BEGIN "+e+"-----\r\n"+At(t)+"\r\n-----END "+e+"-----\r\n"}function Ct(t,e){if(-1==t.indexOf("-----BEGIN "))throw"can't find PEM header: "+e;return _t(t=void 0!==e?(t=t.replace(new RegExp("^[^]*-----BEGIN "+e+"-----"),"")).replace(new RegExp("-----END "+e+"-----[^]*$"),""):(t=t.replace(/^[^]*-----BEGIN [^-]+-----/,"")).replace(/-----END [^-]+-----[^]*$/,""))}function Rt(t){var e,n,i,r,o,s,a,u,c,l,h;if(h=t.match(/^(\d{2}|\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(|\.\d+)Z$/))return u=h[1],e=parseInt(u),2===u.length&&(50<=e&&e<100?e=1900+e:0<=e&&e<50&&(e=2e3+e)),n=parseInt(h[2])-1,i=parseInt(h[3]),r=parseInt(h[4]),o=parseInt(h[5]),s=parseInt(h[6]),a=0,""!==(c=h[7])&&(l=(c.substr(1)+"00").substr(0,3),a=parseInt(l)),Date.UTC(e,n,i,r,o,s,a);throw"unsupported zulu format: "+t}function It(t){return~~(Rt(t)/1e3)}function Tt(t){return t.replace(/%/g,"")}function Ot(t){return t.replace(/(..)/g,"%$1")}function Nt(t){var e="malformed IPv6 address";if(!t.match(/^[0-9A-Fa-f:]+$/))throw e;var n=(t=t.toLowerCase()).split(":").length-1;if(n<2)throw e;var i=":".repeat(7-n+2),r=(t=t.replace("::",i)).split(":");if(8!=r.length)throw e;for(var o=0;o<8;o++)r[o]=("0000"+r[o]).slice(-4);return r.join("")}function Pt(t){if(!t.match(/^[0-9A-Fa-f]{32}$/))throw"malformed IPv6 address octet";for(var e=(t=t.toLowerCase()).match(/.{1,4}/g),n=0;n<8;n++)e[n]=e[n].replace(/^0+/,""),""==e[n]&&(e[n]="0");var i=(t=":"+e.join(":")+":").match(/:(0:){2,}/g);if(null===i)return t.slice(1,-1);var r="";for(n=0;n<i.length;n++)i[n].length>r.length&&(r=i[n]);return(t=t.replace(r,"::")).slice(1,-1)}function Dt(t){var e="malformed hex value";if(!t.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw e;if(8!=t.length)return 32==t.length?Pt(t):t;try{return parseInt(t.substr(0,2),16)+"."+parseInt(t.substr(2,2),16)+"."+parseInt(t.substr(4,2),16)+"."+parseInt(t.substr(6,2),16)}catch(t){throw e}}function Mt(t){return t.match(/.{4}/g).map((function(t){var e=parseInt(t.substr(0,2),16),n=parseInt(t.substr(2),16);if(0==e&n<128)return String.fromCharCode(n);if(e<8){var i=128|63&n;return kt((192|(7&e)<<3|(192&n)>>6).toString(16)+i.toString(16))}i=128|(15&e)<<2|(192&n)>>6;var r=128|63&n;return kt((224|(240&e)>>4).toString(16)+i.toString(16)+r.toString(16))})).join("")}function Ut(t){for(var e=encodeURIComponent(t),n="",i=0;i<e.length;i++)"%"==e[i]?(n+=e.substr(i,3),i+=2):n=n+"%"+gt(e[i]);return n}function Lt(t){return!(t.length%2!=0||!t.match(/^[0-9a-f]+$/)&&!t.match(/^[0-9A-F]+$/))}function Bt(t){return t.length%2==1?"0"+t:t.substr(0,1)>"7"?"00"+t:t}dt.getLblen=function(t,e){if("8"!=t.substr(e+2,1))return 1;var n=parseInt(t.substr(e+3,1));return 0==n?-1:0<n&&n<10?n+1:-2},dt.getL=function(t,e){var n=dt.getLblen(t,e);return n<1?"":t.substr(e+2,2*n)},dt.getVblen=function(t,e){var n;return""==(n=dt.getL(t,e))?-1:("8"===n.substr(0,1)?new S(n.substr(2),16):new S(n,16)).intValue()},dt.getVidx=function(t,e){var n=dt.getLblen(t,e);return n<0?n:e+2*(n+1)},dt.getV=function(t,e){var n=dt.getVidx(t,e),i=dt.getVblen(t,e);return t.substr(n,2*i)},dt.getTLV=function(t,e){return t.substr(e,2)+dt.getL(t,e)+dt.getV(t,e)},dt.getTLVblen=function(t,e){return 2+2*dt.getLblen(t,e)+2*dt.getVblen(t,e)},dt.getNextSiblingIdx=function(t,e){return dt.getVidx(t,e)+2*dt.getVblen(t,e)},dt.getChildIdx=function(t,e){var n,i,r,o=dt,s=[];n=o.getVidx(t,e),i=2*o.getVblen(t,e),"03"==t.substr(e,2)&&(n+=2,i-=2),r=0;for(var a=n;r<=i;){var u=o.getTLVblen(t,a);if((r+=u)<=i&&s.push(a),a+=u,r>=i)break}return s},dt.getNthChildIdx=function(t,e,n){return dt.getChildIdx(t,e)[n]},dt.getIdxbyList=function(t,e,n,i){var r,o,s=dt;return 0==n.length?void 0!==i&&t.substr(e,2)!==i?-1:e:(r=n.shift())>=(o=s.getChildIdx(t,e)).length?-1:s.getIdxbyList(t,o[r],n,i)},dt.getIdxbyListEx=function(t,e,n,i){var r,o,s=dt;if(0==n.length)return void 0!==i&&t.substr(e,2)!==i?-1:e;r=n.shift(),o=s.getChildIdx(t,e);for(var a=0,u=0;u<o.length;u++){var c=t.substr(o[u],2);if("number"==typeof r&&!s.isContextTag(c)&&a==r||"string"==typeof r&&s.isContextTag(c,r))return s.getIdxbyListEx(t,o[u],n,i);s.isContextTag(c)||a++}return-1},dt.getTLVbyList=function(t,e,n,i){var r=dt,o=r.getIdxbyList(t,e,n,i);return-1==o||o>=t.length?null:r.getTLV(t,o)},dt.getTLVbyListEx=function(t,e,n,i){var r=dt,o=r.getIdxbyListEx(t,e,n,i);return-1==o?null:r.getTLV(t,o)},dt.getVbyList=function(t,e,n,i,r){var o,s,a=dt;return-1==(o=a.getIdxbyList(t,e,n,i))||o>=t.length?null:(s=a.getV(t,o),!0===r&&(s=s.substr(2)),s)},dt.getVbyListEx=function(t,e,n,i,r){var o,s,a=dt;return-1==(o=a.getIdxbyListEx(t,e,n,i))?null:(s=a.getV(t,o),"03"==t.substr(o,2)&&!1!==r&&(s=s.substr(2)),s)},dt.getInt=function(t,e,n){null==n&&(n=-1);try{var i=t.substr(e,2);if("02"!=i&&"03"!=i)return n;var r=dt.getV(t,e);return"02"==i?parseInt(r,16):function(t){try{var e=t.substr(0,2);if("00"==e)return parseInt(t.substr(2),16);var n=parseInt(e,16),i=t.substr(2),r=parseInt(i,16).toString(2);return"0"==r&&(r="00000000"),r=r.slice(0,0-n),parseInt(r,2)}catch(t){return-1}}(r)}catch(t){return n}},dt.getOID=function(t,e,n){null==n&&(n=null);try{return"06"!=t.substr(e,2)?n:function(t){if(!Lt(t))return null;try{var e=[],n=t.substr(0,2),i=parseInt(n,16);e[0]=new String(Math.floor(i/40)),e[1]=new String(i%40);for(var r=t.substr(2),o=[],s=0;s<r.length/2;s++)o.push(parseInt(r.substr(2*s,2),16));var a=[],u="";for(s=0;s<o.length;s++)128&o[s]?u+=Jt((127&o[s]).toString(2),7):(u+=Jt((127&o[s]).toString(2),7),a.push(new String(parseInt(u,2))),u="");var c=e.join(".");return a.length>0&&(c=c+"."+a.join(".")),c}catch(t){return null}}(dt.getV(t,e))}catch(t){return n}},dt.getOIDName=function(t,e,n){null==n&&(n=null);try{var i=dt.getOID(t,e,n);if(i==n)return n;var r=ct.asn1.x509.OID.oid2name(i);return""==r?i:r}catch(t){return n}},dt.getString=function(t,e,n){null==n&&(n=null);try{return Et(dt.getV(t,e))}catch(t){return n}},dt.hextooidstr=function(t){var e=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},n=[],i=t.substr(0,2),r=parseInt(i,16);n[0]=new String(Math.floor(r/40)),n[1]=new String(r%40);for(var o=t.substr(2),s=[],a=0;a<o.length/2;a++)s.push(parseInt(o.substr(2*a,2),16));var u=[],c="";for(a=0;a<s.length;a++)128&s[a]?c+=e((127&s[a]).toString(2),7):(c+=e((127&s[a]).toString(2),7),u.push(new String(parseInt(c,2))),c="");var l=n.join(".");return u.length>0&&(l=l+"."+u.join(".")),l},dt.dump=function(t,e,n,i){var r=dt,o=r.getV,s=r.dump,a=r.getChildIdx,u=t;t instanceof ct.asn1.ASN1Object&&(u=t.getEncodedHex());var c=function(t,e){return t.length<=2*e?t:t.substr(0,e)+"..(total "+t.length/2+"bytes).."+t.substr(t.length-e,e)};void 0===e&&(e={ommit_long_octet:32}),void 0===n&&(n=0),void 0===i&&(i="");var l,h=e.ommit_long_octet;if("01"==(l=u.substr(n,2)))return"00"==(d=o(u,n))?i+"BOOLEAN FALSE\n":i+"BOOLEAN TRUE\n";if("02"==l)return i+"INTEGER "+c(d=o(u,n),h)+"\n";if("03"==l){var d=o(u,n);return r.isASN1HEX(d.substr(2))?(x=i+"BITSTRING, encapsulates\n")+s(d.substr(2),e,0,i+" "):i+"BITSTRING "+c(d,h)+"\n"}if("04"==l)return d=o(u,n),r.isASN1HEX(d)?(x=i+"OCTETSTRING, encapsulates\n")+s(d,e,0,i+" "):i+"OCTETSTRING "+c(d,h)+"\n";if("05"==l)return i+"NULL\n";if("06"==l){var f=o(u,n),p=ct.asn1.ASN1Util.oidHexToInt(f),v=ct.asn1.x509.OID.oid2name(p),g=p.replace(/\./g," ");return""!=v?i+"ObjectIdentifier "+v+" ("+g+")\n":i+"ObjectIdentifier ("+g+")\n"}if("0a"==l)return i+"ENUMERATED "+parseInt(o(u,n))+"\n";if("0c"==l)return i+"UTF8String '"+kt(o(u,n))+"'\n";if("13"==l)return i+"PrintableString '"+kt(o(u,n))+"'\n";if("14"==l)return i+"TeletexString '"+kt(o(u,n))+"'\n";if("16"==l)return i+"IA5String '"+kt(o(u,n))+"'\n";if("17"==l)return i+"UTCTime "+kt(o(u,n))+"\n";if("18"==l)return i+"GeneralizedTime "+kt(o(u,n))+"\n";if("1a"==l)return i+"VisualString '"+kt(o(u,n))+"'\n";if("1e"==l)return i+"BMPString '"+Mt(o(u,n))+"'\n";if("30"==l){if("3000"==u.substr(n,4))return i+"SEQUENCE {}\n";x=i+"SEQUENCE\n";var m=e;if((2==(y=a(u,n)).length||3==y.length)&&"06"==u.substr(y[0],2)&&"04"==u.substr(y[y.length-1],2)){v=r.oidname(o(u,y[0]));var w=JSON.parse(JSON.stringify(e));w.x509ExtName=v,m=w}for(var b=0;b<y.length;b++)x+=s(u,m,y[b],i+" ");return x}if("31"==l){x=i+"SET\n";var y=a(u,n);for(b=0;b<y.length;b++)x+=s(u,e,y[b],i+" ");return x}if(0!=(128&(l=parseInt(l,16)))){var x,k=31&l;if(0!=(32&l)){for(x=i+"["+k+"]\n",y=a(u,n),b=0;b<y.length;b++)x+=s(u,e,y[b],i+" ");return x}return d=o(u,n),dt.isASN1HEX(d)?(x=i+"["+k+"]\n")+s(d,e,0,i+" "):(("68747470"==d.substr(0,8)||"subjectAltName"===e.x509ExtName&&2==k)&&(d=kt(d)),i+"["+k+"] "+d+"\n")}return i+"UNKNOWN("+l+") "+o(u,n)+"\n"},dt.isContextTag=function(t,e){var n,i;t=t.toLowerCase();try{n=parseInt(t,16)}catch(t){return-1}if(void 0===e)return 128==(192&n);try{return null!=e.match(/^\[[0-9]+\]$/)&&!((i=parseInt(e.substr(1,e.length-1),10))>31)&&128==(192&n)&&(31&n)==i}catch(t){return!1}},dt.isASN1HEX=function(t){var e=dt;if(t.length%2==1)return!1;var n=e.getVblen(t,0),i=t.substr(0,2),r=e.getL(t,0);return t.length-i.length-r.length==2*n},dt.checkStrictDER=function(t,e,n,i,r){var o=dt;if(void 0===n){if("string"!=typeof t)throw new Error("not hex string");if(t=t.toLowerCase(),!ct.lang.String.isHex(t))throw new Error("not hex string");n=t.length,r=(i=t.length/2)<128?1:Math.ceil(i.toString(16))+1}if(o.getL(t,e).length>2*r)throw new Error("L of TLV too long: idx="+e);var s=o.getVblen(t,e);if(s>i)throw new Error("value of L too long than hex: idx="+e);var a=o.getTLV(t,e),u=a.length-2-o.getL(t,e).length;if(u!==2*s)throw new Error("V string length and L's value not the same:"+u+"/"+2*s);if(0===e&&t.length!=a.length)throw new Error("total length and TLV length unmatch:"+t.length+"!="+a.length);var c=t.substr(e,2);if("02"===c){var l=o.getVidx(t,e);if("00"==t.substr(l,2)&&t.charCodeAt(l+2)<56)throw new Error("not least zeros for DER INTEGER")}if(32&parseInt(c,16)){for(var h=o.getVblen(t,e),d=0,f=o.getChildIdx(t,e),p=0;p<f.length;p++)d+=o.getTLV(t,f[p]).length,o.checkStrictDER(t,f[p],n,i,r);if(2*h!=d)throw new Error("sum of children's TLV length and L unmatch: "+2*h+"!="+d)}},dt.oidname=function(t){var e=ct.asn1;ct.lang.String.isHex(t)&&(t=e.ASN1Util.oidHexToInt(t));var n=e.x509.OID.oid2name(t);return""===n&&(n=t),n},void 0!==ct&&ct||(e.KJUR=ct={}),void 0!==ct.lang&&ct.lang||(ct.lang={}),ct.lang.String=function(){},"function"==typeof t?(e.utf8tob64u=lt=function(e){return mt(t.from(e,"utf8").toString("base64"))},e.b64utoutf8=ht=function(e){return t.from(wt(e),"base64").toString("utf8")}):(e.utf8tob64u=lt=function(t){return bt(Tt(Ut(t)))},e.b64utoutf8=ht=function(t){return decodeURIComponent(Ot(yt(t)))}),ct.lang.String.isInteger=function(t){return!!t.match(/^[0-9]+$/)||!!t.match(/^-[0-9]+$/)},ct.lang.String.isHex=function(t){return Lt(t)},ct.lang.String.isBase64=function(t){return!(!(t=t.replace(/\s+/g,"")).match(/^[0-9A-Za-z+\/]+={0,3}$/)||t.length%4!=0)},ct.lang.String.isBase64URL=function(t){return!t.match(/[+/=]/)&&(t=wt(t),ct.lang.String.isBase64(t))},ct.lang.String.isIntegerArray=function(t){return!!(t=t.replace(/\s+/g,"")).match(/^\[[0-9,]+\]$/)},ct.lang.String.isPrintable=function(t){return null!==t.match(/^[0-9A-Za-z '()+,-./:=?]*$/)},ct.lang.String.isIA5=function(t){return null!==t.match(/^[\x20-\x21\x23-\x7f]*$/)},ct.lang.String.isMail=function(t){return null!==t.match(/^[A-Za-z0-9]{1}[A-Za-z0-9_.-]*@{1}[A-Za-z0-9_.-]{1,}\.[A-Za-z0-9]{1,}$/)};var Jt=function(t,e,n){return null==n&&(n="0"),t.length>=e?t:new Array(e-t.length+1).join(n)+t};function $t(t,e){var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.superclass=e.prototype,e.prototype.constructor==Object.prototype.constructor&&(e.prototype.constructor=e)}void 0!==ct&&ct||(e.KJUR=ct={}),void 0!==ct.crypto&&ct.crypto||(ct.crypto={}),ct.crypto.Util=new function(){this.DIGESTINFOHEAD={sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",ripemd160:"3021300906052b2403020105000414"},this.DEFAULTPROVIDER={md5:"cryptojs",sha1:"cryptojs",sha224:"cryptojs",sha256:"cryptojs",sha384:"cryptojs",sha512:"cryptojs",ripemd160:"cryptojs",hmacmd5:"cryptojs",hmacsha1:"cryptojs",hmacsha224:"cryptojs",hmacsha256:"cryptojs",hmacsha384:"cryptojs",hmacsha512:"cryptojs",hmacripemd160:"cryptojs",MD5withRSA:"cryptojs/jsrsa",SHA1withRSA:"cryptojs/jsrsa",SHA224withRSA:"cryptojs/jsrsa",SHA256withRSA:"cryptojs/jsrsa",SHA384withRSA:"cryptojs/jsrsa",SHA512withRSA:"cryptojs/jsrsa",RIPEMD160withRSA:"cryptojs/jsrsa",MD5withECDSA:"cryptojs/jsrsa",SHA1withECDSA:"cryptojs/jsrsa",SHA224withECDSA:"cryptojs/jsrsa",SHA256withECDSA:"cryptojs/jsrsa",SHA384withECDSA:"cryptojs/jsrsa",SHA512withECDSA:"cryptojs/jsrsa",RIPEMD160withECDSA:"cryptojs/jsrsa",SHA1withDSA:"cryptojs/jsrsa",SHA224withDSA:"cryptojs/jsrsa",SHA256withDSA:"cryptojs/jsrsa",MD5withRSAandMGF1:"cryptojs/jsrsa",SHAwithRSAandMGF1:"cryptojs/jsrsa",SHA1withRSAandMGF1:"cryptojs/jsrsa",SHA224withRSAandMGF1:"cryptojs/jsrsa",SHA256withRSAandMGF1:"cryptojs/jsrsa",SHA384withRSAandMGF1:"cryptojs/jsrsa",SHA512withRSAandMGF1:"cryptojs/jsrsa",RIPEMD160withRSAandMGF1:"cryptojs/jsrsa"},this.CRYPTOJSMESSAGEDIGESTNAME={md5:b.algo.MD5,sha1:b.algo.SHA1,sha224:b.algo.SHA224,sha256:b.algo.SHA256,sha384:b.algo.SHA384,sha512:b.algo.SHA512,ripemd160:b.algo.RIPEMD160},this.getDigestInfoHex=function(t,e){if(void 0===this.DIGESTINFOHEAD[e])throw"alg not supported in Util.DIGESTINFOHEAD: "+e;return this.DIGESTINFOHEAD[e]+t},this.getPaddedDigestInfoHex=function(t,e,n){var i=this.getDigestInfoHex(t,e),r=n/4;if(i.length+22>r)throw"key is too short for SigAlg: keylen="+n+","+e;for(var o="0001",s="00"+i,a="",u=r-o.length-s.length,c=0;c<u;c+=2)a+="ff";return o+a+s},this.hashString=function(t,e){return new ct.crypto.MessageDigest({alg:e}).digestString(t)},this.hashHex=function(t,e){return new ct.crypto.MessageDigest({alg:e}).digestHex(t)},this.sha1=function(t){return this.hashString(t,"sha1")},this.sha256=function(t){return this.hashString(t,"sha256")},this.sha256Hex=function(t){return this.hashHex(t,"sha256")},this.sha512=function(t){return this.hashString(t,"sha512")},this.sha512Hex=function(t){return this.hashHex(t,"sha512")},this.isKey=function(t){return t instanceof rt||t instanceof ct.crypto.DSA||t instanceof ct.crypto.ECDSA}},ct.crypto.Util.md5=function(t){return new ct.crypto.MessageDigest({alg:"md5",prov:"cryptojs"}).digestString(t)},ct.crypto.Util.ripemd160=function(t){return new ct.crypto.MessageDigest({alg:"ripemd160",prov:"cryptojs"}).digestString(t)},ct.crypto.Util.SECURERANDOMGEN=new et,ct.crypto.Util.getRandomHexOfNbytes=function(t){var e=new Array(t);return ct.crypto.Util.SECURERANDOMGEN.nextBytes(e),vt(e)},ct.crypto.Util.getRandomBigIntegerOfNbytes=function(t){return new S(ct.crypto.Util.getRandomHexOfNbytes(t),16)},ct.crypto.Util.getRandomHexOfNbits=function(t){var e=t%8,n=new Array((t-e)/8+1);return ct.crypto.Util.SECURERANDOMGEN.nextBytes(n),n[0]=(255<<e&255^255)&n[0],vt(n)},ct.crypto.Util.getRandomBigIntegerOfNbits=function(t){return new S(ct.crypto.Util.getRandomHexOfNbits(t),16)},ct.crypto.Util.getRandomBigIntegerZeroToMax=function(t){for(var e=t.bitLength();;){var n=ct.crypto.Util.getRandomBigIntegerOfNbits(e);if(-1!=t.compareTo(n))return n}},ct.crypto.Util.getRandomBigIntegerMinToMax=function(t,e){var n=t.compareTo(e);if(1==n)throw"biMin is greater than biMax";if(0==n)return t;var i=e.subtract(t);return ct.crypto.Util.getRandomBigIntegerZeroToMax(i).add(t)},ct.crypto.MessageDigest=function(t){this.setAlgAndProvider=function(t,e){if(null!==(t=ct.crypto.MessageDigest.getCanonicalAlgName(t))&&void 0===e&&(e=ct.crypto.Util.DEFAULTPROVIDER[t]),-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(t)&&"cryptojs"==e){try{this.md=ct.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[t].create()}catch(e){throw"setAlgAndProvider hash alg set fail alg="+t+"/"+e}this.updateString=function(t){this.md.update(t)},this.updateHex=function(t){var e=b.enc.Hex.parse(t);this.md.update(e)},this.digest=function(){return this.md.finalize().toString(b.enc.Hex)},this.digestString=function(t){return this.updateString(t),this.digest()},this.digestHex=function(t){return this.updateHex(t),this.digest()}}if(-1!=":sha256:".indexOf(t)&&"sjcl"==e){try{this.md=new sjcl.hash.sha256}catch(e){throw"setAlgAndProvider hash alg set fail alg="+t+"/"+e}this.updateString=function(t){this.md.update(t)},this.updateHex=function(t){var e=sjcl.codec.hex.toBits(t);this.md.update(e)},this.digest=function(){var t=this.md.finalize();return sjcl.codec.hex.fromBits(t)},this.digestString=function(t){return this.updateString(t),this.digest()},this.digestHex=function(t){return this.updateHex(t),this.digest()}}},this.updateString=function(){throw"updateString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.updateHex=function(){throw"updateHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digest=function(){throw"digest() not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestString=function(){throw"digestString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestHex=function(){throw"digestHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},void 0!==t&&void 0!==t.alg&&(this.algName=t.alg,void 0===t.prov&&(this.provName=ct.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName))},ct.crypto.MessageDigest.getCanonicalAlgName=function(t){return"string"==typeof t&&(t=(t=t.toLowerCase()).replace(/-/,"")),t},ct.crypto.MessageDigest.getHashLength=function(t){var e=ct.crypto.MessageDigest,n=e.getCanonicalAlgName(t);if(void 0===e.HASHLENGTH[n])throw"not supported algorithm: "+t;return e.HASHLENGTH[n]},ct.crypto.MessageDigest.HASHLENGTH={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,ripemd160:20},ct.crypto.Mac=function(t){this.setAlgAndProvider=function(t,e){if(null==(t=t.toLowerCase())&&(t="hmacsha1"),"hmac"!=(t=t.toLowerCase()).substr(0,4))throw"setAlgAndProvider unsupported HMAC alg: "+t;void 0===e&&(e=ct.crypto.Util.DEFAULTPROVIDER[t]),this.algProv=t+"/"+e;var n=t.substr(4);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(n)&&"cryptojs"==e){try{this.mac=b.algo.HMAC.create(ct.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[n],this.pass)}catch(t){throw"setAlgAndProvider hash alg set fail hashAlg="+n+"/"+t}this.updateString=function(t){this.mac.update(t)},this.updateHex=function(t){var e=b.enc.Hex.parse(t);this.mac.update(e)},this.doFinal=function(){return this.mac.finalize().toString(b.enc.Hex)},this.doFinalString=function(t){return this.updateString(t),this.doFinal()},this.doFinalHex=function(t){return this.updateHex(t),this.doFinal()}}},this.updateString=function(){throw"updateString(str) not supported for this alg/prov: "+this.algProv},this.updateHex=function(){throw"updateHex(hex) not supported for this alg/prov: "+this.algProv},this.doFinal=function(){throw"digest() not supported for this alg/prov: "+this.algProv},this.doFinalString=function(){throw"digestString(str) not supported for this alg/prov: "+this.algProv},this.doFinalHex=function(){throw"digestHex(hex) not supported for this alg/prov: "+this.algProv},this.setPassword=function(t){if("string"==typeof t){var e=t;return t.length%2!=1&&t.match(/^[0-9A-Fa-f]+$/)||(e=St(t)),void(this.pass=b.enc.Hex.parse(e))}if("object"!=(void 0===t?"undefined":m(t)))throw"KJUR.crypto.Mac unsupported password type: "+t;if(e=null,void 0!==t.hex){if(t.hex.length%2!=0||!t.hex.match(/^[0-9A-Fa-f]+$/))throw"Mac: wrong hex password: "+t.hex;e=t.hex}if(void 0!==t.utf8&&(e=xt(t.utf8)),void 0!==t.rstr&&(e=St(t.rstr)),void 0!==t.b64&&(e=k(t.b64)),void 0!==t.b64u&&(e=yt(t.b64u)),null==e)throw"KJUR.crypto.Mac unsupported password type: "+t;this.pass=b.enc.Hex.parse(e)},void 0!==t&&(void 0!==t.pass&&this.setPassword(t.pass),void 0!==t.alg&&(this.algName=t.alg,void 0===t.prov&&(this.provName=ct.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName)))},ct.crypto.Signature=function(t){var e=null;if(this._setAlgNames=function(){var t=this.algName.match(/^(.+)with(.+)$/);t&&(this.mdAlgName=t[1].toLowerCase(),this.pubkeyAlgName=t[2].toLowerCase(),"rsaandmgf1"==this.pubkeyAlgName&&"sha"==this.mdAlgName&&(this.mdAlgName="sha1"))},this._zeroPaddingOfSignature=function(t,e){for(var n="",i=e/4-t.length,r=0;r<i;r++)n+="0";return n+t},this.setAlgAndProvider=function(t,e){if(this._setAlgNames(),"cryptojs/jsrsa"!=e)throw new Error("provider not supported: "+e);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(this.mdAlgName)){try{this.md=new ct.crypto.MessageDigest({alg:this.mdAlgName})}catch(t){throw new Error("setAlgAndProvider hash alg set fail alg="+this.mdAlgName+"/"+t)}this.init=function(t,e){var n=null;try{n=void 0===e?Ht.getKey(t):Ht.getKey(t,e)}catch(t){throw"init failed:"+t}if(!0===n.isPrivate)this.prvKey=n,this.state="SIGN";else{if(!0!==n.isPublic)throw"init failed.:"+n;this.pubKey=n,this.state="VERIFY"}},this.updateString=function(t){this.md.updateString(t)},this.updateHex=function(t){this.md.updateHex(t)},this.sign=function(){if(this.sHashHex=this.md.digest(),void 0===this.prvKey&&void 0!==this.ecprvhex&&void 0!==this.eccurvename&&void 0!==ct.crypto.ECDSA&&(this.prvKey=new ct.crypto.ECDSA({curve:this.eccurvename,prv:this.ecprvhex})),this.prvKey instanceof rt&&"rsaandmgf1"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHashPSS(this.sHashHex,this.mdAlgName,this.pssSaltLen);else if(this.prvKey instanceof rt&&"rsa"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex,this.mdAlgName);else if(this.prvKey instanceof ct.crypto.ECDSA)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex);else{if(!(this.prvKey instanceof ct.crypto.DSA))throw"Signature: unsupported private key alg: "+this.pubkeyAlgName;this.hSign=this.prvKey.signWithMessageHash(this.sHashHex)}return this.hSign},this.signString=function(t){return this.updateString(t),this.sign()},this.signHex=function(t){return this.updateHex(t),this.sign()},this.verify=function(t){if(this.sHashHex=this.md.digest(),void 0===this.pubKey&&void 0!==this.ecpubhex&&void 0!==this.eccurvename&&void 0!==ct.crypto.ECDSA&&(this.pubKey=new ct.crypto.ECDSA({curve:this.eccurvename,pub:this.ecpubhex})),this.pubKey instanceof rt&&"rsaandmgf1"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHashPSS(this.sHashHex,t,this.mdAlgName,this.pssSaltLen);if(this.pubKey instanceof rt&&"rsa"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);if(void 0!==ct.crypto.ECDSA&&this.pubKey instanceof ct.crypto.ECDSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);if(void 0!==ct.crypto.DSA&&this.pubKey instanceof ct.crypto.DSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);throw"Signature: unsupported public key alg: "+this.pubkeyAlgName}}},this.init=function(){throw"init(key, pass) not supported for this alg:prov="+this.algProvName},this.updateString=function(){throw"updateString(str) not supported for this alg:prov="+this.algProvName},this.updateHex=function(){throw"updateHex(hex) not supported for this alg:prov="+this.algProvName},this.sign=function(){throw"sign() not supported for this alg:prov="+this.algProvName},this.signString=function(){throw"digestString(str) not supported for this alg:prov="+this.algProvName},this.signHex=function(){throw"digestHex(hex) not supported for this alg:prov="+this.algProvName},this.verify=function(){throw"verify(hSigVal) not supported for this alg:prov="+this.algProvName},this.initParams=t,void 0!==t&&(void 0!==t.alg&&(this.algName=t.alg,this.provName=void 0===t.prov?ct.crypto.Util.DEFAULTPROVIDER[this.algName]:t.prov,this.algProvName=this.algName+":"+this.provName,this.setAlgAndProvider(this.algName,this.provName),this._setAlgNames()),void 0!==t.psssaltlen&&(this.pssSaltLen=t.psssaltlen),void 0!==t.prvkeypem)){if(void 0!==t.prvkeypas)throw"both prvkeypem and prvkeypas parameters not supported";try{e=Ht.getKey(t.prvkeypem),this.init(e)}catch(t){throw"fatal error to load pem private key: "+t}}},ct.crypto.Cipher=function(){},ct.crypto.Cipher.encrypt=function(t,e,n){if(e instanceof rt&&e.isPublic){var i=ct.crypto.Cipher.getAlgByKeyAndName(e,n);if("RSA"===i)return e.encrypt(t);if("RSAOAEP"===i)return e.encryptOAEP(t,"sha1");var r=i.match(/^RSAOAEP(\d+)$/);if(null!==r)return e.encryptOAEP(t,"sha"+r[1]);throw"Cipher.encrypt: unsupported algorithm for RSAKey: "+n}throw"Cipher.encrypt: unsupported key or algorithm"},ct.crypto.Cipher.decrypt=function(t,e,n){if(e instanceof rt&&e.isPrivate){var i=ct.crypto.Cipher.getAlgByKeyAndName(e,n);if("RSA"===i)return e.decrypt(t);if("RSAOAEP"===i)return e.decryptOAEP(t,"sha1");var r=i.match(/^RSAOAEP(\d+)$/);if(null!==r)return e.decryptOAEP(t,"sha"+r[1]);throw"Cipher.decrypt: unsupported algorithm for RSAKey: "+n}throw"Cipher.decrypt: unsupported key or algorithm"},ct.crypto.Cipher.getAlgByKeyAndName=function(t,e){if(t instanceof rt){if(-1!=":RSA:RSAOAEP:RSAOAEP224:RSAOAEP256:RSAOAEP384:RSAOAEP512:".indexOf(e))return e;if(null==e)return"RSA";throw"getAlgByKeyAndName: not supported algorithm name for RSAKey: "+e}throw"getAlgByKeyAndName: not supported algorithm name: "+e},ct.crypto.OID=new function(){this.oidhex2name={"2a864886f70d010101":"rsaEncryption","2a8648ce3d0201":"ecPublicKey","2a8648ce380401":"dsa","2a8648ce3d030107":"secp256r1","2b8104001f":"secp192k1","2b81040021":"secp224r1","2b8104000a":"secp256k1","2b81040023":"secp521r1","2b81040022":"secp384r1","2a8648ce380403":"SHA1withDSA","608648016503040301":"SHA224withDSA","608648016503040302":"SHA256withDSA"}},void 0!==ct&&ct||(e.KJUR=ct={}),void 0!==ct.crypto&&ct.crypto||(ct.crypto={}),ct.crypto.ECDSA=function(t){var e=Error,n=S,i=st,r=ct.crypto.ECDSA,o=ct.crypto.ECParameterDB,s=r.getName,a=dt.getVbyListEx,u=dt.isASN1HEX,c=new et;this.type="EC",this.isPrivate=!1,this.isPublic=!1,this.getBigRandom=function(t){return new n(t.bitLength(),c).mod(t.subtract(n.ONE)).add(n.ONE)},this.setNamedCurve=function(t){this.ecparams=o.getByName(t),this.prvKeyHex=null,this.pubKeyHex=null,this.curveName=t},this.setPrivateKeyHex=function(t){this.isPrivate=!0,this.prvKeyHex=t},this.setPublicKeyHex=function(t){this.isPublic=!0,this.pubKeyHex=t},this.getPublicKeyXYHex=function(){var t=this.pubKeyHex;if("04"!==t.substr(0,2))throw"this method supports uncompressed format(04) only";var e=this.ecparams.keylen/4;if(t.length!==2+2*e)throw"malformed public key hex length";var n={};return n.x=t.substr(2,e),n.y=t.substr(2+e),n},this.getShortNISTPCurveName=function(){var t=this.curveName;return"secp256r1"===t||"NIST P-256"===t||"P-256"===t||"prime256v1"===t?"P-256":"secp384r1"===t||"NIST P-384"===t||"P-384"===t?"P-384":null},this.generateKeyPairHex=function(){var t=this.getBigRandom(this.ecparams.n),e=this.ecparams.G.multiply(t),n=e.getX().toBigInteger(),i=e.getY().toBigInteger(),r=this.ecparams.keylen/4,o=("0000000000"+t.toString(16)).slice(-r),s="04"+("0000000000"+n.toString(16)).slice(-r)+("0000000000"+i.toString(16)).slice(-r);return this.setPrivateKeyHex(o),this.setPublicKeyHex(s),{ecprvhex:o,ecpubhex:s}},this.signWithMessageHash=function(t){return this.signHex(t,this.prvKeyHex)},this.signHex=function(t,e){var i=new n(e,16),o=this.ecparams.n,s=new n(t.substring(0,this.ecparams.keylen/4),16);do{var a=this.getBigRandom(o),u=this.ecparams.G.multiply(a).getX().toBigInteger().mod(o)}while(u.compareTo(n.ZERO)<=0);var c=a.modInverse(o).multiply(s.add(i.multiply(u))).mod(o);return r.biRSSigToASN1Sig(u,c)},this.sign=function(t,e){var i=e,r=this.ecparams.n,o=n.fromByteArrayUnsigned(t);do{var s=this.getBigRandom(r),a=this.ecparams.G.multiply(s).getX().toBigInteger().mod(r)}while(a.compareTo(S.ZERO)<=0);var u=s.modInverse(r).multiply(o.add(i.multiply(a))).mod(r);return this.serializeSig(a,u)},this.verifyWithMessageHash=function(t,e){return this.verifyHex(t,e,this.pubKeyHex)},this.verifyHex=function(t,e,o){try{var s,a,u=r.parseSigHex(e);s=u.r,a=u.s;var c=i.decodeFromHex(this.ecparams.curve,o),l=new n(t.substring(0,this.ecparams.keylen/4),16);return this.verifyRaw(l,s,a,c)}catch(t){return!1}},this.verify=function(t,e,r){var o,s,a;if(Bitcoin.Util.isArray(e)){var u=this.parseSig(e);o=u.r,s=u.s}else{if("object"!==(void 0===e?"undefined":m(e))||!e.r||!e.s)throw"Invalid value for signature";o=e.r,s=e.s}if(r instanceof st)a=r;else{if(!Bitcoin.Util.isArray(r))throw"Invalid format for pubkey value, must be byte array or ECPointFp";a=i.decodeFrom(this.ecparams.curve,r)}var c=n.fromByteArrayUnsigned(t);return this.verifyRaw(c,o,s,a)},this.verifyRaw=function(t,e,i,r){var o=this.ecparams.n,s=this.ecparams.G;if(e.compareTo(n.ONE)<0||e.compareTo(o)>=0)return!1;if(i.compareTo(n.ONE)<0||i.compareTo(o)>=0)return!1;var a=i.modInverse(o),u=t.multiply(a).mod(o),c=e.multiply(a).mod(o);return s.multiply(u).add(r.multiply(c)).getX().toBigInteger().mod(o).equals(e)},this.serializeSig=function(t,e){var n=t.toByteArraySigned(),i=e.toByteArraySigned(),r=[];return r.push(2),r.push(n.length),(r=r.concat(n)).push(2),r.push(i.length),(r=r.concat(i)).unshift(r.length),r.unshift(48),r},this.parseSig=function(t){var e;if(48!=t[0])throw new Error("Signature not a valid DERSequence");if(2!=t[e=2])throw new Error("First element in signature must be a DERInteger");var i=t.slice(e+2,e+2+t[e+1]);if(2!=t[e+=2+t[e+1]])throw new Error("Second element in signature must be a DERInteger");var r=t.slice(e+2,e+2+t[e+1]);return e+=2+t[e+1],{r:n.fromByteArrayUnsigned(i),s:n.fromByteArrayUnsigned(r)}},this.parseSigCompact=function(t){if(65!==t.length)throw"Signature has the wrong length";var e=t[0]-27;if(e<0||e>7)throw"Invalid signature type";var i=this.ecparams.n;return{r:n.fromByteArrayUnsigned(t.slice(1,33)).mod(i),s:n.fromByteArrayUnsigned(t.slice(33,65)).mod(i),i:e}},this.readPKCS5PrvKeyHex=function(t){if(!1===u(t))throw new Error("not ASN.1 hex string");var e,n,i;try{e=a(t,0,["[0]",0],"06"),n=a(t,0,[1],"04");try{i=a(t,0,["[1]",0],"03")}catch(t){}}catch(t){throw new Error("malformed PKCS#1/5 plain ECC private key")}if(this.curveName=s(e),void 0===this.curveName)throw"unsupported curve name";this.setNamedCurve(this.curveName),this.setPublicKeyHex(i),this.setPrivateKeyHex(n),this.isPublic=!1},this.readPKCS8PrvKeyHex=function(t){if(!1===u(t))throw new e("not ASN.1 hex string");var n,i,r;try{a(t,0,[1,0],"06"),n=a(t,0,[1,1],"06"),i=a(t,0,[2,0,1],"04");try{r=a(t,0,[2,0,"[1]",0],"03")}catch(t){}}catch(t){throw new e("malformed PKCS#8 plain ECC private key")}if(this.curveName=s(n),void 0===this.curveName)throw new e("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(r),this.setPrivateKeyHex(i),this.isPublic=!1},this.readPKCS8PubKeyHex=function(t){if(!1===u(t))throw new e("not ASN.1 hex string");var n,i;try{a(t,0,[0,0],"06"),n=a(t,0,[0,1],"06"),i=a(t,0,[1],"03")}catch(t){throw new e("malformed PKCS#8 ECC public key")}if(this.curveName=s(n),null===this.curveName)throw new e("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(i)},this.readCertPubKeyHex=function(t){if(!1===u(t))throw new e("not ASN.1 hex string");var n,i;try{n=a(t,0,[0,5,0,1],"06"),i=a(t,0,[0,5,1],"03")}catch(t){throw new e("malformed X.509 certificate ECC public key")}if(this.curveName=s(n),null===this.curveName)throw new e("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(i)},void 0!==t&&void 0!==t.curve&&(this.curveName=t.curve),void 0===this.curveName&&(this.curveName="secp256r1"),this.setNamedCurve(this.curveName),void 0!==t&&(void 0!==t.prv&&this.setPrivateKeyHex(t.prv),void 0!==t.pub&&this.setPublicKeyHex(t.pub))},ct.crypto.ECDSA.parseSigHex=function(t){var e=ct.crypto.ECDSA.parseSigHexInHexRS(t);return{r:new S(e.r,16),s:new S(e.s,16)}},ct.crypto.ECDSA.parseSigHexInHexRS=function(t){var e=dt.getChildIdx,n=dt.getV;if(dt.checkStrictDER(t,0),"30"!=t.substr(0,2))throw new Error("signature is not a ASN.1 sequence");var i=e(t,0);if(2!=i.length)throw new Error("signature shall have two elements");var r=i[0],o=i[1];if("02"!=t.substr(r,2))throw new Error("1st item not ASN.1 integer");if("02"!=t.substr(o,2))throw new Error("2nd item not ASN.1 integer");return{r:n(t,r),s:n(t,o)}},ct.crypto.ECDSA.asn1SigToConcatSig=function(t){var e=ct.crypto.ECDSA.parseSigHexInHexRS(t),n=e.r,i=e.s;if("00"==n.substr(0,2)&&n.length%32==2&&(n=n.substr(2)),"00"==i.substr(0,2)&&i.length%32==2&&(i=i.substr(2)),n.length%32==30&&(n="00"+n),i.length%32==30&&(i="00"+i),n.length%32!=0)throw"unknown ECDSA sig r length error";if(i.length%32!=0)throw"unknown ECDSA sig s length error";return n+i},ct.crypto.ECDSA.concatSigToASN1Sig=function(t){if(t.length/2*8%128!=0)throw"unknown ECDSA concatinated r-s sig length error";var e=t.substr(0,t.length/2),n=t.substr(t.length/2);return ct.crypto.ECDSA.hexRSSigToASN1Sig(e,n)},ct.crypto.ECDSA.hexRSSigToASN1Sig=function(t,e){var n=new S(t,16),i=new S(e,16);return ct.crypto.ECDSA.biRSSigToASN1Sig(n,i)},ct.crypto.ECDSA.biRSSigToASN1Sig=function(t,e){var n=ct.asn1,i=new n.DERInteger({bigint:t}),r=new n.DERInteger({bigint:e});return new n.DERSequence({array:[i,r]}).getEncodedHex()},ct.crypto.ECDSA.getName=function(t){return"2b8104001f"===t?"secp192k1":"2a8648ce3d030107"===t?"secp256r1":"2b8104000a"===t?"secp256k1":"2b81040021"===t?"secp224r1":"2b81040022"===t?"secp384r1":-1!=="|secp256r1|NIST P-256|P-256|prime256v1|".indexOf(t)?"secp256r1":-1!=="|secp256k1|".indexOf(t)?"secp256k1":-1!=="|secp224r1|NIST P-224|P-224|".indexOf(t)?"secp224r1":-1!=="|secp384r1|NIST P-384|P-384|".indexOf(t)?"secp384r1":null},void 0!==ct&&ct||(e.KJUR=ct={}),void 0!==ct.crypto&&ct.crypto||(ct.crypto={}),ct.crypto.ECParameterDB=new function(){var t={},e={};function n(t){return new S(t,16)}this.getByName=function(n){var i=n;if(void 0!==e[i]&&(i=e[n]),void 0!==t[i])return t[i];throw"unregistered EC curve name: "+i},this.regist=function(i,r,o,s,a,u,c,l,h,d,f,p){t[i]={};var v=n(o),g=n(s),m=n(a),w=n(u),b=n(c),y=new at(v,g,m),x=y.decodePointHex("04"+l+h);t[i].name=i,t[i].keylen=r,t[i].curve=y,t[i].G=x,t[i].n=w,t[i].h=b,t[i].oid=f,t[i].info=p;for(var k=0;k<d.length;k++)e[d[k]]=i}},ct.crypto.ECParameterDB.regist("secp128r1",128,"FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC","E87579C11079F43DD824993C2CEE5ED3","FFFFFFFE0000000075A30D1B9038A115","1","161FF7528B899B2D0C28607CA52C5B86","CF5AC8395BAFEB13C02DA292DDED7A83",[],"","secp128r1 : SECG curve over a 128 bit prime field"),ct.crypto.ECParameterDB.regist("secp160k1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73","0","7","0100000000000000000001B8FA16DFAB9ACA16B6B3","1","3B4C382CE37AA192A4019E763036F4F5DD4D7EBB","938CF935318FDCED6BC28286531733C3F03C4FEE",[],"","secp160k1 : SECG curve over a 160 bit prime field"),ct.crypto.ECParameterDB.regist("secp160r1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC","1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45","0100000000000000000001F4C8F927AED3CA752257","1","4A96B5688EF573284664698968C38BB913CBFC82","23A628553168947D59DCC912042351377AC5FB32",[],"","secp160r1 : SECG curve over a 160 bit prime field"),ct.crypto.ECParameterDB.regist("secp192k1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37","0","3","FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D","1","DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D","9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D",[]),ct.crypto.ECParameterDB.regist("secp192r1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC","64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1","FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831","1","188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012","07192B95FFC8DA78631011ED6B24CDD573F977A11E794811",[]),ct.crypto.ECParameterDB.regist("secp224r1",224,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE","B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4","FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D","1","B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21","BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34",[]),ct.crypto.ECParameterDB.regist("secp256k1",256,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F","0","7","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141","1","79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798","483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8",[]),ct.crypto.ECParameterDB.regist("secp256r1",256,"FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC","5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B","FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551","1","6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296","4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5",["NIST P-256","P-256","prime256v1"]),ct.crypto.ECParameterDB.regist("secp384r1",384,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC","B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973","1","AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7","3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f",["NIST P-384","P-384"]),ct.crypto.ECParameterDB.regist("secp521r1",521,"1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC","051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409","1","C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66","011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650",["NIST P-521","P-521"]);var Ht=function(){var t=function(t,n,i){return e(b.AES,t,n,i)},e=function(t,e,n,i){var r=b.enc.Hex.parse(e),o=b.enc.Hex.parse(n),s=b.enc.Hex.parse(i),a={};a.key=o,a.iv=s,a.ciphertext=r;var u=t.decrypt(a,o,{iv:s});return b.enc.Hex.stringify(u)},n=function(t,e,n){return i(b.AES,t,e,n)},i=function(t,e,n,i){var r=b.enc.Hex.parse(e),o=b.enc.Hex.parse(n),s=b.enc.Hex.parse(i),a=t.encrypt(r,o,{iv:s}),u=b.enc.Hex.parse(a.toString());return b.enc.Base64.stringify(u)},r={"AES-256-CBC":{proc:t,eproc:n,keylen:32,ivlen:16},"AES-192-CBC":{proc:t,eproc:n,keylen:24,ivlen:16},"AES-128-CBC":{proc:t,eproc:n,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:function(t,n,i){return e(b.TripleDES,t,n,i)},eproc:function(t,e,n){return i(b.TripleDES,t,e,n)},keylen:24,ivlen:8},"DES-CBC":{proc:function(t,n,i){return e(b.DES,t,n,i)},eproc:function(t,e,n){return i(b.DES,t,e,n)},keylen:8,ivlen:8}},o=function(t){var e={},n=t.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"));n&&(e.cipher=n[1],e.ivsalt=n[2]);var i=t.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));i&&(e.type=i[1]);var r=-1,o=0;-1!=t.indexOf("\r\n\r\n")&&(r=t.indexOf("\r\n\r\n"),o=2),-1!=t.indexOf("\n\n")&&(r=t.indexOf("\n\n"),o=1);var s=t.indexOf("-----END");if(-1!=r&&-1!=s){var a=t.substring(r+2*o,s-o);a=a.replace(/\s+/g,""),e.data=a}return e},s=function(t,e,n){for(var i=n.substring(0,16),o=b.enc.Hex.parse(i),s=b.enc.Utf8.parse(e),a=r[t].keylen+r[t].ivlen,u="",c=null;;){var l=b.algo.MD5.create();if(null!=c&&l.update(c),l.update(s),l.update(o),c=l.finalize(),(u+=b.enc.Hex.stringify(c)).length>=2*a)break}var h={};return h.keyhex=u.substr(0,2*r[t].keylen),h.ivhex=u.substr(2*r[t].keylen,2*r[t].ivlen),h},a=function(t,e,n,i){var o=b.enc.Base64.parse(t),s=b.enc.Hex.stringify(o);return(0,r[e].proc)(s,n,i)};return{version:"1.0.0",parsePKCS5PEM:function(t){return o(t)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(t,e,n){return s(t,e,n)},decryptKeyB64:function(t,e,n,i){return a(t,e,n,i)},getDecryptedKeyHex:function(t,e){var n=o(t),i=n.cipher,r=n.ivsalt,u=n.data,c=s(i,e,r).keyhex;return a(u,i,c,r)},getEncryptedPKCS5PEMFromPrvKeyHex:function(t,e,n,i,o){var a,u,c="";if(void 0!==i&&null!=i||(i="AES-256-CBC"),void 0===r[i])throw new Error("KEYUTIL unsupported algorithm: "+i);return void 0!==o&&null!=o||(o=(a=r[i].ivlen,u=b.lib.WordArray.random(a),b.enc.Hex.stringify(u)).toUpperCase()),c="-----BEGIN "+t+" PRIVATE KEY-----\r\n",c+="Proc-Type: 4,ENCRYPTED\r\n",c+="DEK-Info: "+i+","+o+"\r\n",c+="\r\n",(c+=function(t,e,n,i){return(0,r[e].eproc)(t,n,i)}(e,i,s(i,n,o).keyhex,o).replace(/(.{64})/g,"$1\r\n"))+"\r\n-----END "+t+" PRIVATE KEY-----\r\n"},parseHexOfEncryptedPKCS8:function(t){var e=dt.getChildIdx,n=dt.getV,i={},r=e(t,0);if(2!=r.length)throw new Error("malformed format: SEQUENCE(0).items != 2: "+r.length);i.ciphertext=n(t,r[1]);var o=e(t,r[0]);if(2!=o.length)throw new Error("malformed format: SEQUENCE(0.0).items != 2: "+o.length);if("2a864886f70d01050d"!=n(t,o[0]))throw new Error("this only supports pkcs5PBES2");var s=e(t,o[1]);if(2!=o.length)throw new Error("malformed format: SEQUENCE(0.0.1).items != 2: "+s.length);var a=e(t,s[1]);if(2!=a.length)throw new Error("malformed format: SEQUENCE(0.0.1.1).items != 2: "+a.length);if("2a864886f70d0307"!=n(t,a[0]))throw"this only supports TripleDES";i.encryptionSchemeAlg="TripleDES",i.encryptionSchemeIV=n(t,a[1]);var u=e(t,s[0]);if(2!=u.length)throw new Error("malformed format: SEQUENCE(0.0.1.0).items != 2: "+u.length);if("2a864886f70d01050c"!=n(t,u[0]))throw new Error("this only supports pkcs5PBKDF2");var c=e(t,u[1]);if(c.length<2)throw new Error("malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+c.length);i.pbkdf2Salt=n(t,c[0]);var l=n(t,c[1]);try{i.pbkdf2Iter=parseInt(l,16)}catch(t){throw new Error("malformed format pbkdf2Iter: "+l)}return i},getPBKDF2KeyHexFromParam:function(t,e){var n=b.enc.Hex.parse(t.pbkdf2Salt),i=b.PBKDF2(e,n,{keySize:6,iterations:t.pbkdf2Iter});return b.enc.Hex.stringify(i)},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(t,e){var n=Ct(t,"ENCRYPTED PRIVATE KEY"),i=this.parseHexOfEncryptedPKCS8(n),r=Ht.getPBKDF2KeyHexFromParam(i,e),o={};o.ciphertext=b.enc.Hex.parse(i.ciphertext);var s=b.enc.Hex.parse(r),a=b.enc.Hex.parse(i.encryptionSchemeIV),u=b.TripleDES.decrypt(o,s,{iv:a});return b.enc.Hex.stringify(u)},getKeyFromEncryptedPKCS8PEM:function(t,e){var n=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(t,e);return this.getKeyFromPlainPrivatePKCS8Hex(n)},parsePlainPrivatePKCS8Hex:function(t){var e=dt,n=e.getChildIdx,i=e.getV,r={algparam:null};if("30"!=t.substr(0,2))throw new Error("malformed plain PKCS8 private key(code:001)");var o=n(t,0);if(o.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if("30"!=t.substr(o[1],2))throw new Error("malformed PKCS8 private key(code:003)");var s=n(t,o[1]);if(2!=s.length)throw new Error("malformed PKCS8 private key(code:004)");if("06"!=t.substr(s[0],2))throw new Error("malformed PKCS8 private key(code:005)");if(r.algoid=i(t,s[0]),"06"==t.substr(s[1],2)&&(r.algparam=i(t,s[1])),"04"!=t.substr(o[2],2))throw new Error("malformed PKCS8 private key(code:006)");return r.keyidx=e.getVidx(t,o[2]),r},getKeyFromPlainPrivatePKCS8PEM:function(t){var e=Ct(t,"PRIVATE KEY");return this.getKeyFromPlainPrivatePKCS8Hex(e)},getKeyFromPlainPrivatePKCS8Hex:function(t){var e,n=this.parsePlainPrivatePKCS8Hex(t);if("2a864886f70d010101"==n.algoid)e=new rt;else if("2a8648ce380401"==n.algoid)e=new ct.crypto.DSA;else{if("2a8648ce3d0201"!=n.algoid)throw new Error("unsupported private key algorithm");e=new ct.crypto.ECDSA}return e.readPKCS8PrvKeyHex(t),e},_getKeyFromPublicPKCS8Hex:function(t){var e,n=dt.getVbyList(t,0,[0,0],"06");if("2a864886f70d010101"===n)e=new rt;else if("2a8648ce380401"===n)e=new ct.crypto.DSA;else{if("2a8648ce3d0201"!==n)throw new Error("unsupported PKCS#8 public key hex");e=new ct.crypto.ECDSA}return e.readPKCS8PubKeyHex(t),e},parsePublicRawRSAKeyHex:function(t){var e=dt.getChildIdx,n=dt.getV,i={};if("30"!=t.substr(0,2))throw new Error("malformed RSA key(code:001)");var r=e(t,0);if(2!=r.length)throw new Error("malformed RSA key(code:002)");if("02"!=t.substr(r[0],2))throw new Error("malformed RSA key(code:003)");if(i.n=n(t,r[0]),"02"!=t.substr(r[1],2))throw new Error("malformed RSA key(code:004)");return i.e=n(t,r[1]),i},parsePublicPKCS8Hex:function(t){var e=dt,n=e.getChildIdx,i=e.getV,r={algparam:null},o=n(t,0);if(2!=o.length)throw new Error("outer DERSequence shall have 2 elements: "+o.length);var s=o[0];if("30"!=t.substr(s,2))throw new Error("malformed PKCS8 public key(code:001)");var a=n(t,s);if(2!=a.length)throw new Error("malformed PKCS8 public key(code:002)");if("06"!=t.substr(a[0],2))throw new Error("malformed PKCS8 public key(code:003)");if(r.algoid=i(t,a[0]),"06"==t.substr(a[1],2)?r.algparam=i(t,a[1]):"30"==t.substr(a[1],2)&&(r.algparam={},r.algparam.p=e.getVbyList(t,a[1],[0],"02"),r.algparam.q=e.getVbyList(t,a[1],[1],"02"),r.algparam.g=e.getVbyList(t,a[1],[2],"02")),"03"!=t.substr(o[1],2))throw new Error("malformed PKCS8 public key(code:004)");return r.key=i(t,o[1]).substr(2),r}}}();function Kt(t,e){for(var n="",i=e/4-t.length,r=0;r<i;r++)n+="0";return n+t}function zt(t,e,n){for(var i="",r=0;i.length<e;)i+=Et(n(St(t+String.fromCharCode.apply(String,[(4278190080&r)>>24,(16711680&r)>>16,(65280&r)>>8,255&r])))),r+=1;return i}function Wt(t){for(var e in ct.crypto.Util.DIGESTINFOHEAD){var n=ct.crypto.Util.DIGESTINFOHEAD[e],i=n.length;if(t.substring(0,i)==n)return[e,t.substring(i)]}return[]}function qt(t){var e,n=dt,i=n.getChildIdx,r=n.getV,o=n.getTLV,s=n.getVbyList,a=n.getVbyListEx,u=n.getTLVbyList,c=n.getTLVbyListEx,l=n.getIdxbyList,h=n.getIdxbyListEx,d=n.getVidx,f=n.getInt,p=n.oidname,v=n.hextooidstr,g=Ct;try{e=ct.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV}catch(t){}this.HEX2STAG={"0c":"utf8",13:"prn",16:"ia5","1a":"vis","1e":"bmp"},this.hex=null,this.version=0,this.foffset=0,this.aExtInfo=null,this.getVersion=function(){if(null===this.hex||0!==this.version)return this.version;var t=u(this.hex,0,[0,0]);if("a0"==t.substr(0,2)){var e=u(t,0,[0]),n=f(e,0);if(n<0||2<n)throw new Error("malformed version field");return this.version=n+1,this.version}return this.version=1,this.foffset=-1,1},this.getSerialNumberHex=function(){return a(this.hex,0,[0,0],"02")},this.getSignatureAlgorithmField=function(){var t=c(this.hex,0,[0,1]);return this.getAlgorithmIdentifierName(t)},this.getAlgorithmIdentifierName=function(t){for(var n in e)if(t===e[n])return n;return p(a(t,0,[0],"06"))},this.getIssuer=function(){return this.getX500Name(this.getIssuerHex())},this.getIssuerHex=function(){return u(this.hex,0,[0,3+this.foffset],"30")},this.getIssuerString=function(){return this.getIssuer().str},this.getSubject=function(){return this.getX500Name(this.getSubjectHex())},this.getSubjectHex=function(){return u(this.hex,0,[0,5+this.foffset],"30")},this.getSubjectString=function(){return this.getSubject().str},this.getNotBefore=function(){var t=s(this.hex,0,[0,4+this.foffset,0]);return t=t.replace(/(..)/g,"%$1"),decodeURIComponent(t)},this.getNotAfter=function(){var t=s(this.hex,0,[0,4+this.foffset,1]);return t=t.replace(/(..)/g,"%$1"),decodeURIComponent(t)},this.getPublicKeyHex=function(){return n.getTLVbyList(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyIdx=function(){return l(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyContentIdx=function(){var t=this.getPublicKeyIdx();return l(this.hex,t,[1,0],"30")},this.getPublicKey=function(){return Ht.getKey(this.getPublicKeyHex(),null,"pkcs8pub")},this.getSignatureAlgorithmName=function(){var t=u(this.hex,0,[1],"30");return this.getAlgorithmIdentifierName(t)},this.getSignatureValueHex=function(){return s(this.hex,0,[2],"03",!0)},this.verifySignature=function(t){var e=this.getSignatureAlgorithmField(),n=this.getSignatureValueHex(),i=u(this.hex,0,[0],"30"),r=new ct.crypto.Signature({alg:e});return r.init(t),r.updateHex(i),r.verify(n)},this.parseExt=function(t){var e,o,a;if(void 0===t){if(3!==this.version)return-1;e=l(a=this.hex,0,[0,7,0],"30"),o=i(a,e)}else{a=Ct(t);var u=l(a,0,[0,3,0,0],"06");if("2a864886f70d01090e"!=r(a,u))return void(this.aExtInfo=new Array);e=l(a,0,[0,3,0,1,0],"30"),o=i(a,e),this.hex=a}this.aExtInfo=new Array;for(var c=0;c<o.length;c++){var h={critical:!1},f=0;3===i(a,o[c]).length&&(h.critical=!0,f=1),h.oid=n.hextooidstr(s(a,o[c],[0],"06"));var p=l(a,o[c],[1+f]);h.vidx=d(a,p),this.aExtInfo.push(h)}},this.getExtInfo=function(t){var e=this.aExtInfo,n=t;if(t.match(/^[0-9.]+$/)||(n=ct.asn1.x509.OID.name2oid(t)),""!==n)for(var i=0;i<e.length;i++)if(e[i].oid===n)return e[i]},this.getExtBasicConstraints=function(t,e){if(void 0===t&&void 0===e){var n=this.getExtInfo("basicConstraints");if(void 0===n)return;t=o(this.hex,n.vidx),e=n.critical}var i={extname:"basicConstraints"};if(e&&(i.critical=!0),"3000"===t)return i;if("30030101ff"===t)return i.cA=!0,i;if("30060101ff02"===t.substr(0,12)){var s=r(t,10),a=parseInt(s,16);return i.cA=!0,i.pathLen=a,i}throw new Error("hExtV parse error: "+t)},this.getExtKeyUsage=function(t,e){if(void 0===t&&void 0===e){var n=this.getExtInfo("keyUsage");if(void 0===n)return;t=o(this.hex,n.vidx),e=n.critical}var i={extname:"keyUsage"};return e&&(i.critical=!0),i.names=this.getExtKeyUsageString(t).split(","),i},this.getExtKeyUsageBin=function(t){if(void 0===t){var e=this.getExtInfo("keyUsage");if(void 0===e)return"";t=o(this.hex,e.vidx)}if(8!=t.length&&10!=t.length)throw new Error("malformed key usage value: "+t);var n="000000000000000"+parseInt(t.substr(6),16).toString(2);return 8==t.length&&(n=n.slice(-8)),10==t.length&&(n=n.slice(-16)),""==(n=n.replace(/0+$/,""))&&(n="0"),n},this.getExtKeyUsageString=function(t){for(var e=this.getExtKeyUsageBin(t),n=new Array,i=0;i<e.length;i++)"1"==e.substr(i,1)&&n.push(qt.KEYUSAGE_NAME[i]);return n.join(",")},this.getExtSubjectKeyIdentifier=function(t,e){if(void 0===t&&void 0===e){var n=this.getExtInfo("subjectKeyIdentifier");if(void 0===n)return;t=o(this.hex,n.vidx),e=n.critical}var i={extname:"subjectKeyIdentifier"};e&&(i.critical=!0);var s=r(t,0);return i.kid={hex:s},i},this.getExtAuthorityKeyIdentifier=function(t,e){if(void 0===t&&void 0===e){var n=this.getExtInfo("authorityKeyIdentifier");if(void 0===n)return;t=o(this.hex,n.vidx),e=n.critical}var s={extname:"authorityKeyIdentifier"};e&&(s.critical=!0);for(var a=i(t,0),u=0;u<a.length;u++){var c=t.substr(a[u],2);if("80"===c&&(s.kid={hex:r(t,a[u])}),"a1"===c){var l=o(t,a[u]),h=this.getGeneralNames(l);s.issuer=h[0].dn}"82"===c&&(s.sn={hex:r(t,a[u])})}return s},this.getExtExtKeyUsage=function(t,e){if(void 0===t&&void 0===e){var n=this.getExtInfo("extKeyUsage");if(void 0===n)return;t=o(this.hex,n.vidx),e=n.critical}var s={extname:"extKeyUsage",array:[]};e&&(s.critical=!0);for(var a=i(t,0),u=0;u<a.length;u++)s.array.push(p(r(t,a[u])));return s},this.getExtExtKeyUsageName=function(){var t=this.getExtInfo("extKeyUsage");if(void 0===t)return t;var e=new Array,n=o(this.hex,t.vidx);if(""===n)return e;for(var s=i(n,0),a=0;a<s.length;a++)e.push(p(r(n,s[a])));return e},this.getExtSubjectAltName=function(t,e){if(void 0===t&&void 0===e){var n=this.getExtInfo("subjectAltName");if(void 0===n)return;t=o(this.hex,n.vidx),e=n.critical}var i={extname:"subjectAltName",array:[]};return e&&(i.critical=!0),i.array=this.getGeneralNames(t),i},this.getExtIssuerAltName=function(t,e){if(void 0===t&&void 0===e){var n=this.getExtInfo("issuerAltName");if(void 0===n)return;t=o(this.hex,n.vidx),e=n.critical}var i={extname:"issuerAltName",array:[]};return e&&(i.critical=!0),i.array=this.getGeneralNames(t),i},this.getGeneralNames=function(t){for(var e=i(t,0),n=[],r=0;r<e.length;r++){var s=this.getGeneralName(o(t,e[r]));void 0!==s&&n.push(s)}return n},this.getGeneralName=function(t){var e=t.substr(0,2),n=r(t,0),i=Et(n);return"81"==e?{rfc822:i}:"82"==e?{dns:i}:"86"==e?{uri:i}:"87"==e?{ip:Dt(n)}:"a4"==e?{dn:this.getX500Name(n)}:void 0},this.getExtSubjectAltName2=function(){var t,e,n,s=this.getExtInfo("subjectAltName");if(void 0===s)return s;for(var a=new Array,u=o(this.hex,s.vidx),c=i(u,0),l=0;l<c.length;l++)n=u.substr(c[l],2),t=r(u,c[l]),"81"===n&&(e=kt(t),a.push(["MAIL",e])),"82"===n&&(e=kt(t),a.push(["DNS",e])),"84"===n&&(e=qt.hex2dn(t,0),a.push(["DN",e])),"86"===n&&(e=kt(t),a.push(["URI",e])),"87"===n&&(e=Dt(t),a.push(["IP",e]));return a},this.getExtCRLDistributionPoints=function(t,e){if(void 0===t&&void 0===e){var n=this.getExtInfo("cRLDistributionPoints");if(void 0===n)return;t=o(this.hex,n.vidx),e=n.critical}var r={extname:"cRLDistributionPoints",array:[]};e&&(r.critical=!0);for(var s=i(t,0),a=0;a<s.length;a++){var u=o(t,s[a]);r.array.push(this.getDistributionPoint(u))}return r},this.getDistributionPoint=function(t){for(var e={},n=i(t,0),r=0;r<n.length;r++){var s=t.substr(n[r],2),a=o(t,n[r]);"a0"==s&&(e.dpname=this.getDistributionPointName(a))}return e},this.getDistributionPointName=function(t){for(var e={},n=i(t,0),r=0;r<n.length;r++){var s=t.substr(n[r],2),a=o(t,n[r]);"a0"==s&&(e.full=this.getGeneralNames(a))}return e},this.getExtCRLDistributionPointsURI=function(){var t=this.getExtInfo("cRLDistributionPoints");if(void 0===t)return t;for(var e=new Array,n=i(this.hex,t.vidx),r=0;r<n.length;r++)try{var o=kt(s(this.hex,n[r],[0,0,0],"86"));e.push(o)}catch(t){}return e},this.getExtAIAInfo=function(){var t=this.getExtInfo("authorityInfoAccess");if(void 0===t)return t;for(var e={ocsp:[],caissuer:[]},n=i(this.hex,t.vidx),r=0;r<n.length;r++){var o=s(this.hex,n[r],[0],"06"),a=s(this.hex,n[r],[1],"86");"2b06010505073001"===o&&e.ocsp.push(kt(a)),"2b06010505073002"===o&&e.caissuer.push(kt(a))}return e},this.getExtAuthorityInfoAccess=function(t,e){if(void 0===t&&void 0===e){var n=this.getExtInfo("authorityInfoAccess");if(void 0===n)return;t=o(this.hex,n.vidx),e=n.critical}var r={extname:"authorityInfoAccess",array:[]};e&&(r.critical=!0);for(var u=i(t,0),c=0;c<u.length;c++){var l=a(t,u[c],[0],"06"),h=kt(s(t,u[c],[1],"86"));if("2b06010505073001"==l)r.array.push({ocsp:h});else{if("2b06010505073002"!=l)throw new Error("unknown method: "+l);r.array.push({caissuer:h})}}return r},this.getExtCertificatePolicies=function(t,e){if(void 0===t&&void 0===e){var n=this.getExtInfo("certificatePolicies");if(void 0===n)return;t=o(this.hex,n.vidx),e=n.critical}var r={extname:"certificatePolicies",array:[]};e&&(r.critical=!0);for(var s=i(t,0),a=0;a<s.length;a++){var u=o(t,s[a]),c=this.getPolicyInformation(u);r.array.push(c)}return r},this.getPolicyInformation=function(t){var e={},n=s(t,0,[0],"06");e.policyoid=p(n);var r=h(t,0,[1],"30");if(-1!=r){e.array=[];for(var a=i(t,r),u=0;u<a.length;u++){var c=o(t,a[u]),l=this.getPolicyQualifierInfo(c);e.array.push(l)}}return e},this.getPolicyQualifierInfo=function(t){var e={},n=s(t,0,[0],"06");if("2b06010505070201"===n){var i=a(t,0,[1],"16");e.cps=Et(i)}else if("2b06010505070202"===n){var r=u(t,0,[1],"30");e.unotice=this.getUserNotice(r)}return e},this.getUserNotice=function(t){for(var e={},n=i(t,0),r=0;r<n.length;r++){var s=o(t,n[r]);"30"!=s.substr(0,2)&&(e.exptext=this.getDisplayText(s))}return e},this.getDisplayText=function(t){var e={};return e.type={"0c":"utf8",16:"ia5","1a":"vis","1e":"bmp"}[t.substr(0,2)],e.str=Et(r(t,0)),e},this.getExtCRLNumber=function(t,e){var n={extname:"cRLNumber"};if(e&&(n.critical=!0),"02"==t.substr(0,2))return n.num={hex:r(t,0)},n;throw new Error("hExtV parse error: "+t)},this.getExtCRLReason=function(t,e){var n={extname:"cRLReason"};if(e&&(n.critical=!0),"0a"==t.substr(0,2))return n.code=parseInt(r(t,0),16),n;throw new Error("hExtV parse error: "+t)},this.getExtOcspNonce=function(t,e){var n={extname:"ocspNonce"};e&&(n.critical=!0);var i=r(t,0);return n.hex=i,n},this.getExtOcspNoCheck=function(t,e){var n={extname:"ocspNoCheck"};return e&&(n.critical=!0),n},this.getExtAdobeTimeStamp=function(t,e){if(void 0===t&&void 0===e){var n=this.getExtInfo("adobeTimeStamp");if(void 0===n)return;t=o(this.hex,n.vidx),e=n.critical}var r={extname:"adobeTimeStamp"};e&&(r.critical=!0);var s=i(t,0);if(s.length>1){var a=o(t,s[1]),u=this.getGeneralName(a);null!=u.uri&&(r.uri=u.uri)}if(s.length>2){var c=o(t,s[2]);"0101ff"==c&&(r.reqauth=!0),"010100"==c&&(r.reqauth=!1)}return r},this.getX500NameRule=function(t){for(var e=null,n=[],i=0;i<t.length;i++)for(var r=t[i],o=0;o<r.length;o++)n.push(r[o]);for(i=0;i<n.length;i++){var s=n[i],a=s.ds,u=s.type;if("prn"!=a&&"utf8"!=a&&"ia5"!=a)return"mixed";if("ia5"==a){if("CN"!=u)return"mixed";if(ct.lang.String.isMail(s.value))continue;return"mixed"}if("C"==u){if("prn"==a)continue;return"mixed"}if(null==e)e=a;else if(e!==a)return"mixed"}return null==e?"prn":e},this.getX500Name=function(t){var e=this.getX500NameArray(t);return{array:e,str:this.dnarraytostr(e)}},this.getX500NameArray=function(t){for(var e=[],n=i(t,0),r=0;r<n.length;r++)e.push(this.getRDN(o(t,n[r])));return e},this.getRDN=function(t){for(var e=[],n=i(t,0),r=0;r<n.length;r++)e.push(this.getAttrTypeAndValue(o(t,n[r])));return e},this.getAttrTypeAndValue=function(t){var e={type:null,value:null,ds:null},n=i(t,0),r=s(t,n[0],[],"06"),o=s(t,n[1],[]),a=ct.asn1.ASN1Util.oidHexToInt(r);return e.type=ct.asn1.x509.OID.oid2atype(a),e.ds=this.HEX2STAG[t.substr(n[1],2)],e.value="bmp"!=e.ds?kt(o):Mt(o),e},this.readCertPEM=function(t){this.readCertHex(g(t))},this.readCertHex=function(t){this.hex=t,this.getVersion();try{l(this.hex,0,[0,7],"a3"),this.parseExt()}catch(t){}},this.getParam=function(){var t={};return t.version=this.getVersion(),t.serial={hex:this.getSerialNumberHex()},t.sigalg=this.getSignatureAlgorithmField(),t.issuer=this.getIssuer(),t.notbefore=this.getNotBefore(),t.notafter=this.getNotAfter(),t.subject=this.getSubject(),t.sbjpubkey=jt(this.getPublicKeyHex(),"PUBLIC KEY"),this.aExtInfo.length>0&&(t.ext=this.getExtParamArray()),t.sighex=this.getSignatureValueHex(),t},this.getExtParamArray=function(t){null==t&&-1!=h(this.hex,0,[0,"[3]"])&&(t=c(this.hex,0,[0,"[3]",0],"30"));for(var e=[],n=i(t,0),r=0;r<n.length;r++){var s=o(t,n[r]),a=this.getExtParam(s);null!=a&&e.push(a)}return e},this.getExtParam=function(t){var e=i(t,0).length;if(2!=e&&3!=e)throw new Error("wrong number elements in Extension: "+e+" "+t);var n=v(s(t,0,[0],"06")),r=!1;3==e&&"0101ff"==u(t,0,[1])&&(r=!0);var o=u(t,0,[e-1,0]),a=void 0;if("2.5.29.14"==n?a=this.getExtSubjectKeyIdentifier(o,r):"2.5.29.15"==n?a=this.getExtKeyUsage(o,r):"2.5.29.17"==n?a=this.getExtSubjectAltName(o,r):"2.5.29.18"==n?a=this.getExtIssuerAltName(o,r):"2.5.29.19"==n?a=this.getExtBasicConstraints(o,r):"2.5.29.31"==n?a=this.getExtCRLDistributionPoints(o,r):"2.5.29.32"==n?a=this.getExtCertificatePolicies(o,r):"2.5.29.35"==n?a=this.getExtAuthorityKeyIdentifier(o,r):"2.5.29.37"==n?a=this.getExtExtKeyUsage(o,r):"1.3.6.1.5.5.7.1.1"==n?a=this.getExtAuthorityInfoAccess(o,r):"2.5.29.20"==n?a=this.getExtCRLNumber(o,r):"2.5.29.21"==n?a=this.getExtCRLReason(o,r):"1.3.6.1.5.5.7.48.1.2"==n?a=this.getExtOcspNonce(o,r):"1.3.6.1.5.5.7.48.1.5"==n?a=this.getExtOcspNoCheck(o,r):"1.2.840.113583.1.1.9.1"==n&&(a=this.getExtAdobeTimeStamp(o,r)),null!=a)return a;var c={extname:n,extn:o};return r&&(c.critical=!0),c},this.findExt=function(t,e){for(var n=0;n<t.length;n++)if(t[n].extname==e)return t[n];return null},this.updateExtCDPFullURI=function(t,e){var n=this.findExt(t,"cRLDistributionPoints");if(null!=n&&null!=n.array)for(var i=n.array,r=0;r<i.length;r++)if(null!=i[r].dpname&&null!=i[r].dpname.full)for(var o=i[r].dpname.full,s=0;s<o.length;s++){var a=o[r];null!=a.uri&&(a.uri=e)}},this.updateExtAIAOCSP=function(t,e){var n=this.findExt(t,"authorityInfoAccess");if(null!=n&&null!=n.array)for(var i=n.array,r=0;r<i.length;r++)null!=i[r].ocsp&&(i[r].ocsp=e)},this.updateExtAIACAIssuer=function(t,e){var n=this.findExt(t,"authorityInfoAccess");if(null!=n&&null!=n.array)for(var i=n.array,r=0;r<i.length;r++)null!=i[r].caissuer&&(i[r].caissuer=e)},this.dnarraytostr=function(t){return"/"+t.map((function(t){return(e=t,e.map((function(t){return(e=t,e.type+"="+e.value).replace(/\+/,"\\+");var e})).join("+")).replace(/\//,"\\/");var e})).join("/")},this.getInfo=function(){var t,e,n,i,r=function(t){for(var e="",n=t.array,i=0;i<n.length;i++){var r=n[i];if(e+=" policy oid: "+r.policyoid+"\n",void 0!==r.array)for(var o=0;o<r.array.length;o++){var s=r.array[o];void 0!==s.cps&&(e+=" cps: "+s.cps+"\n")}}return e},o=function(t){for(var e="",n=t.array,i=0;i<n.length;i++){var r=n[i];try{void 0!==r.dpname.full[0].uri&&(e+=" "+r.dpname.full[0].uri+"\n")}catch(t){}try{void 0!==r.dname.full[0].dn.hex&&(e+=" "+qt.hex2dn(r.dpname.full[0].dn.hex)+"\n")}catch(t){}}return e},s=function(t){for(var e="",n=t.array,i=0;i<n.length;i++){var r=n[i];void 0!==r.caissuer&&(e+=" caissuer: "+r.caissuer+"\n"),void 0!==r.ocsp&&(e+=" ocsp: "+r.ocsp+"\n")}return e};if(t="Basic Fields\n",t+=" serial number: "+this.getSerialNumberHex()+"\n",t+=" signature algorithm: "+this.getSignatureAlgorithmField()+"\n",t+=" issuer: "+this.getIssuerString()+"\n",t+=" notBefore: "+this.getNotBefore()+"\n",t+=" notAfter: "+this.getNotAfter()+"\n",t+=" subject: "+this.getSubjectString()+"\n",t+=" subject public key info: \n",t+=" key algorithm: "+(e=this.getPublicKey()).type+"\n","RSA"===e.type&&(t+=" n="+Bt(e.n.toString(16)).substr(0,16)+"...\n",t+=" e="+Bt(e.e.toString(16))+"\n"),null!=(n=this.aExtInfo)){t+="X509v3 Extensions:\n";for(var a=0;a<n.length;a++){var u=n[a],c=ct.asn1.x509.OID.oid2name(u.oid);""===c&&(c=u.oid);var l="";if(!0===u.critical&&(l="CRITICAL"),t+=" "+c+" "+l+":\n","basicConstraints"===c){var h=this.getExtBasicConstraints();void 0===h.cA?t+=" {}\n":(t+=" cA=true",void 0!==h.pathLen&&(t+=", pathLen="+h.pathLen),t+="\n")}else if("keyUsage"===c)t+=" "+this.getExtKeyUsageString()+"\n";else if("subjectKeyIdentifier"===c)t+=" "+this.getExtSubjectKeyIdentifier().kid.hex+"\n";else if("authorityKeyIdentifier"===c){var d=this.getExtAuthorityKeyIdentifier();void 0!==d.kid&&(t+=" kid="+d.kid.hex+"\n")}else"extKeyUsage"===c?t+=" "+this.getExtExtKeyUsage().array.join(", ")+"\n":"subjectAltName"===c?t+=" "+(i=this.getExtSubjectAltName(),JSON.stringify(i.array).replace(/[\[\]\{\}\"]/g,"")+"\n"):"cRLDistributionPoints"===c?t+=o(this.getExtCRLDistributionPoints()):"authorityInfoAccess"===c?t+=s(this.getExtAuthorityInfoAccess()):"certificatePolicies"===c&&(t+=r(this.getExtCertificatePolicies()))}}return(t+="signature algorithm: "+this.getSignatureAlgorithmName()+"\n")+"signature: "+this.getSignatureValueHex().substr(0,16)+"...\n"},"string"==typeof t&&(-1!=t.indexOf("-----BEGIN")?this.readCertPEM(t):ct.lang.String.isHex(t)&&this.readCertHex(t))}Ht.getKey=function(t,e,n){var i,r=(m=dt).getChildIdx,o=m.getVbyList,s=ct.crypto,a=s.ECDSA,u=s.DSA,c=rt,l=Ct,h=Ht;if(void 0!==c&&t instanceof c)return t;if(void 0!==a&&t instanceof a)return t;if(void 0!==u&&t instanceof u)return t;if(void 0!==t.curve&&void 0!==t.xy&&void 0===t.d)return new a({pub:t.xy,curve:t.curve});if(void 0!==t.curve&&void 0!==t.d)return new a({prv:t.d,curve:t.curve});if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0===t.d)return(C=new c).setPublic(t.n,t.e),C;if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0!==t.p&&void 0!==t.q&&void 0!==t.dp&&void 0!==t.dq&&void 0!==t.co&&void 0===t.qi)return(C=new c).setPrivateEx(t.n,t.e,t.d,t.p,t.q,t.dp,t.dq,t.co),C;if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0===t.p)return(C=new c).setPrivate(t.n,t.e,t.d),C;if(void 0!==t.p&&void 0!==t.q&&void 0!==t.g&&void 0!==t.y&&void 0===t.x)return(C=new u).setPublic(t.p,t.q,t.g,t.y),C;if(void 0!==t.p&&void 0!==t.q&&void 0!==t.g&&void 0!==t.y&&void 0!==t.x)return(C=new u).setPrivate(t.p,t.q,t.g,t.y,t.x),C;if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0===t.d)return(C=new c).setPublic(yt(t.n),yt(t.e)),C;if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0!==t.p&&void 0!==t.q&&void 0!==t.dp&&void 0!==t.dq&&void 0!==t.qi)return(C=new c).setPrivateEx(yt(t.n),yt(t.e),yt(t.d),yt(t.p),yt(t.q),yt(t.dp),yt(t.dq),yt(t.qi)),C;if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d)return(C=new c).setPrivate(yt(t.n),yt(t.e),yt(t.d)),C;if("EC"===t.kty&&void 0!==t.crv&&void 0!==t.x&&void 0!==t.y&&void 0===t.d){var d=(j=new a({curve:t.crv})).ecparams.keylen/4,f="04"+("0000000000"+yt(t.x)).slice(-d)+("0000000000"+yt(t.y)).slice(-d);return j.setPublicKeyHex(f),j}if("EC"===t.kty&&void 0!==t.crv&&void 0!==t.x&&void 0!==t.y&&void 0!==t.d){d=(j=new a({curve:t.crv})).ecparams.keylen/4,f="04"+("0000000000"+yt(t.x)).slice(-d)+("0000000000"+yt(t.y)).slice(-d);var p=("0000000000"+yt(t.d)).slice(-d);return j.setPublicKeyHex(f),j.setPrivateKeyHex(p),j}if("pkcs5prv"===n){var v,g=t,m=dt;if(9===(v=r(g,0)).length)(C=new c).readPKCS5PrvKeyHex(g);else if(6===v.length)(C=new u).readPKCS5PrvKeyHex(g);else{if(!(v.length>2&&"04"===g.substr(v[1],2)))throw new Error("unsupported PKCS#1/5 hexadecimal key");(C=new a).readPKCS5PrvKeyHex(g)}return C}if("pkcs8prv"===n)return h.getKeyFromPlainPrivatePKCS8Hex(t);if("pkcs8pub"===n)return h._getKeyFromPublicPKCS8Hex(t);if("x509pub"===n)return qt.getPublicKeyFromCertHex(t);if(-1!=t.indexOf("-END CERTIFICATE-",0)||-1!=t.indexOf("-END X509 CERTIFICATE-",0)||-1!=t.indexOf("-END TRUSTED CERTIFICATE-",0))return qt.getPublicKeyFromCertPEM(t);if(-1!=t.indexOf("-END PUBLIC KEY-")){var w=Ct(t,"PUBLIC KEY");return h._getKeyFromPublicPKCS8Hex(w)}if(-1!=t.indexOf("-END RSA PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED")){var b=l(t,"RSA PRIVATE KEY");return h.getKey(b,null,"pkcs5prv")}if(-1!=t.indexOf("-END DSA PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED")){var y=o(i=l(t,"DSA PRIVATE KEY"),0,[1],"02"),x=o(i,0,[2],"02"),k=o(i,0,[3],"02"),E=o(i,0,[4],"02"),F=o(i,0,[5],"02");return(C=new u).setPrivate(new S(y,16),new S(x,16),new S(k,16),new S(E,16),new S(F,16)),C}if(-1!=t.indexOf("-END EC PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED"))return b=l(t,"EC PRIVATE KEY"),h.getKey(b,null,"pkcs5prv");if(-1!=t.indexOf("-END PRIVATE KEY-"))return h.getKeyFromPlainPrivatePKCS8PEM(t);if(-1!=t.indexOf("-END RSA PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED")){var A=h.getDecryptedKeyHex(t,e),_=new rt;return _.readPKCS5PrvKeyHex(A),_}if(-1!=t.indexOf("-END EC PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED")){var j,C=o(i=h.getDecryptedKeyHex(t,e),0,[1],"04"),R=o(i,0,[2,0],"06"),I=o(i,0,[3,0],"03").substr(2);if(void 0===ct.crypto.OID.oidhex2name[R])throw new Error("undefined OID(hex) in KJUR.crypto.OID: "+R);return(j=new a({curve:ct.crypto.OID.oidhex2name[R]})).setPublicKeyHex(I),j.setPrivateKeyHex(C),j.isPublic=!1,j}if(-1!=t.indexOf("-END DSA PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED"))return y=o(i=h.getDecryptedKeyHex(t,e),0,[1],"02"),x=o(i,0,[2],"02"),k=o(i,0,[3],"02"),E=o(i,0,[4],"02"),F=o(i,0,[5],"02"),(C=new u).setPrivate(new S(y,16),new S(x,16),new S(k,16),new S(E,16),new S(F,16)),C;if(-1!=t.indexOf("-END ENCRYPTED PRIVATE KEY-"))return h.getKeyFromEncryptedPKCS8PEM(t,e);throw new Error("not supported argument")},Ht.generateKeypair=function(t,e){if("RSA"==t){var n=e;(s=new rt).generate(n,"10001"),s.isPrivate=!0,s.isPublic=!0;var i=new rt,r=s.n.toString(16),o=s.e.toString(16);return i.setPublic(r,o),i.isPrivate=!1,i.isPublic=!0,(a={}).prvKeyObj=s,a.pubKeyObj=i,a}if("EC"==t){var s,a,u=e,c=new ct.crypto.ECDSA({curve:u}).generateKeyPairHex();return(s=new ct.crypto.ECDSA({curve:u})).setPublicKeyHex(c.ecpubhex),s.setPrivateKeyHex(c.ecprvhex),s.isPrivate=!0,s.isPublic=!1,(i=new ct.crypto.ECDSA({curve:u})).setPublicKeyHex(c.ecpubhex),i.isPrivate=!1,i.isPublic=!0,(a={}).prvKeyObj=s,a.pubKeyObj=i,a}throw new Error("unknown algorithm: "+t)},Ht.getPEM=function(t,e,n,i,r,o){var s=ct.asn1,a=s.DERObjectIdentifier,u=s.DERInteger,c=s.ASN1Util.newObject,l=ct.crypto,h=l.DSA,d=l.ECDSA,f=rt;function p(t){return c({seq:[{int:0},{int:{bigint:t.n}},{int:t.e},{int:{bigint:t.d}},{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.dmp1}},{int:{bigint:t.dmq1}},{int:{bigint:t.coeff}}]})}function v(t){return c({seq:[{int:1},{octstr:{hex:t.prvKeyHex}},{tag:["a0",!0,{oid:{name:t.curveName}}]},{tag:["a1",!0,{bitstr:{hex:"00"+t.pubKeyHex}}]}]})}function g(t){return c({seq:[{int:0},{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.g}},{int:{bigint:t.y}},{int:{bigint:t.x}}]})}if((void 0!==f&&t instanceof f||void 0!==h&&t instanceof h||void 0!==d&&t instanceof d)&&1==t.isPublic&&(void 0===e||"PKCS8PUB"==e))return jt(x=new(0,s.x509.SubjectPublicKeyInfo)(t).getEncodedHex(),"PUBLIC KEY");if("PKCS1PRV"==e&&void 0!==f&&t instanceof f&&(void 0===n||null==n)&&1==t.isPrivate)return jt(x=p(t).getEncodedHex(),"RSA PRIVATE KEY");if("PKCS1PRV"==e&&void 0!==d&&t instanceof d&&(void 0===n||null==n)&&1==t.isPrivate){var m=new a({name:t.curveName}).getEncodedHex(),w=v(t).getEncodedHex(),y="";return(y+=jt(m,"EC PARAMETERS"))+jt(w,"EC PRIVATE KEY")}if("PKCS1PRV"==e&&void 0!==h&&t instanceof h&&(void 0===n||null==n)&&1==t.isPrivate)return jt(x=g(t).getEncodedHex(),"DSA PRIVATE KEY");if("PKCS5PRV"==e&&void 0!==f&&t instanceof f&&void 0!==n&&null!=n&&1==t.isPrivate){var x=p(t).getEncodedHex();return void 0===i&&(i="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",x,n,i,o)}if("PKCS5PRV"==e&&void 0!==d&&t instanceof d&&void 0!==n&&null!=n&&1==t.isPrivate)return x=v(t).getEncodedHex(),void 0===i&&(i="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",x,n,i,o);if("PKCS5PRV"==e&&void 0!==h&&t instanceof h&&void 0!==n&&null!=n&&1==t.isPrivate)return x=g(t).getEncodedHex(),void 0===i&&(i="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",x,n,i,o);var k=function(t,e){var n=E(t,e);return new c({seq:[{seq:[{oid:{name:"pkcs5PBES2"}},{seq:[{seq:[{oid:{name:"pkcs5PBKDF2"}},{seq:[{octstr:{hex:n.pbkdf2Salt}},{int:n.pbkdf2Iter}]}]},{seq:[{oid:{name:"des-EDE3-CBC"}},{octstr:{hex:n.encryptionSchemeIV}}]}]}]},{octstr:{hex:n.ciphertext}}]}).getEncodedHex()},E=function(t,e){var n=b.lib.WordArray.random(8),i=b.lib.WordArray.random(8),r=b.PBKDF2(e,n,{keySize:6,iterations:100}),o=b.enc.Hex.parse(t),s=b.TripleDES.encrypt(o,r,{iv:i})+"",a={};return a.ciphertext=s,a.pbkdf2Salt=b.enc.Hex.stringify(n),a.pbkdf2Iter=100,a.encryptionSchemeAlg="DES-EDE3-CBC",a.encryptionSchemeIV=b.enc.Hex.stringify(i),a};if("PKCS8PRV"==e&&null!=f&&t instanceof f&&1==t.isPrivate){var S=p(t).getEncodedHex();return x=c({seq:[{int:0},{seq:[{oid:{name:"rsaEncryption"}},{null:!0}]},{octstr:{hex:S}}]}).getEncodedHex(),void 0===n||null==n?jt(x,"PRIVATE KEY"):jt(w=k(x,n),"ENCRYPTED PRIVATE KEY")}if("PKCS8PRV"==e&&void 0!==d&&t instanceof d&&1==t.isPrivate)return S=new c({seq:[{int:1},{octstr:{hex:t.prvKeyHex}},{tag:["a1",!0,{bitstr:{hex:"00"+t.pubKeyHex}}]}]}).getEncodedHex(),x=c({seq:[{int:0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:t.curveName}}]},{octstr:{hex:S}}]}).getEncodedHex(),void 0===n||null==n?jt(x,"PRIVATE KEY"):jt(w=k(x,n),"ENCRYPTED PRIVATE KEY");if("PKCS8PRV"==e&&void 0!==h&&t instanceof h&&1==t.isPrivate)return S=new u({bigint:t.x}).getEncodedHex(),x=c({seq:[{int:0},{seq:[{oid:{name:"dsa"}},{seq:[{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.g}}]}]},{octstr:{hex:S}}]}).getEncodedHex(),void 0===n||null==n?jt(x,"PRIVATE KEY"):jt(w=k(x,n),"ENCRYPTED PRIVATE KEY");throw new Error("unsupported object nor format")},Ht.getKeyFromCSRPEM=function(t){var e=Ct(t,"CERTIFICATE REQUEST");return Ht.getKeyFromCSRHex(e)},Ht.getKeyFromCSRHex=function(t){var e=Ht.parseCSRHex(t);return Ht.getKey(e.p8pubkeyhex,null,"pkcs8pub")},Ht.parseCSRHex=function(t){var e=dt.getChildIdx,n=dt.getTLV,i={},r=t;if("30"!=r.substr(0,2))throw new Error("malformed CSR(code:001)");var o=e(r,0);if(o.length<1)throw new Error("malformed CSR(code:002)");if("30"!=r.substr(o[0],2))throw new Error("malformed CSR(code:003)");var s=e(r,o[0]);if(s.length<3)throw new Error("malformed CSR(code:004)");return i.p8pubkeyhex=n(r,s[2]),i},Ht.getKeyID=function(t){var e=Ht,n=dt;"string"==typeof t&&-1!=t.indexOf("BEGIN ")&&(t=e.getKey(t));var i=Ct(e.getPEM(t)),r=n.getIdxbyList(i,0,[1]),o=n.getV(i,r).substring(2);return ct.crypto.Util.hashHex(o,"sha1")},Ht.getJWKFromKey=function(t){var e={};if(t instanceof rt&&t.isPrivate)return e.kty="RSA",e.n=bt(t.n.toString(16)),e.e=bt(t.e.toString(16)),e.d=bt(t.d.toString(16)),e.p=bt(t.p.toString(16)),e.q=bt(t.q.toString(16)),e.dp=bt(t.dmp1.toString(16)),e.dq=bt(t.dmq1.toString(16)),e.qi=bt(t.coeff.toString(16)),e;if(t instanceof rt&&t.isPublic)return e.kty="RSA",e.n=bt(t.n.toString(16)),e.e=bt(t.e.toString(16)),e;if(t instanceof ct.crypto.ECDSA&&t.isPrivate){if("P-256"!==(i=t.getShortNISTPCurveName())&&"P-384"!==i)throw new Error("unsupported curve name for JWT: "+i);var n=t.getPublicKeyXYHex();return e.kty="EC",e.crv=i,e.x=bt(n.x),e.y=bt(n.y),e.d=bt(t.prvKeyHex),e}if(t instanceof ct.crypto.ECDSA&&t.isPublic){var i;if("P-256"!==(i=t.getShortNISTPCurveName())&&"P-384"!==i)throw new Error("unsupported curve name for JWT: "+i);return n=t.getPublicKeyXYHex(),e.kty="EC",e.crv=i,e.x=bt(n.x),e.y=bt(n.y),e}throw new Error("not supported key object")},rt.getPosArrayOfChildrenFromHex=function(t){return dt.getChildIdx(t,0)},rt.getHexValueArrayOfChildrenFromHex=function(t){var e,n=dt.getV,i=n(t,(e=rt.getPosArrayOfChildrenFromHex(t))[0]),r=n(t,e[1]),o=n(t,e[2]),s=n(t,e[3]),a=n(t,e[4]),u=n(t,e[5]),c=n(t,e[6]),l=n(t,e[7]),h=n(t,e[8]);return(e=new Array).push(i,r,o,s,a,u,c,l,h),e},rt.prototype.readPrivateKeyFromPEMString=function(t){var e=Ct(t),n=rt.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8])},rt.prototype.readPKCS5PrvKeyHex=function(t){var e=rt.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},rt.prototype.readPKCS8PrvKeyHex=function(t){var e,n,i,r,o,s,a,u,c=dt.getVbyListEx;if(!1===dt.isASN1HEX(t))throw new Error("not ASN.1 hex string");try{e=c(t,0,[2,0,1],"02"),n=c(t,0,[2,0,2],"02"),i=c(t,0,[2,0,3],"02"),r=c(t,0,[2,0,4],"02"),o=c(t,0,[2,0,5],"02"),s=c(t,0,[2,0,6],"02"),a=c(t,0,[2,0,7],"02"),u=c(t,0,[2,0,8],"02")}catch(t){throw new Error("malformed PKCS#8 plain RSA private key")}this.setPrivateEx(e,n,i,r,o,s,a,u)},rt.prototype.readPKCS5PubKeyHex=function(t){var e=dt,n=e.getV;if(!1===e.isASN1HEX(t))throw new Error("keyHex is not ASN.1 hex string");var i=e.getChildIdx(t,0);if(2!==i.length||"02"!==t.substr(i[0],2)||"02"!==t.substr(i[1],2))throw new Error("wrong hex for PKCS#5 public key");var r=n(t,i[0]),o=n(t,i[1]);this.setPublic(r,o)},rt.prototype.readPKCS8PubKeyHex=function(t){var e=dt;if(!1===e.isASN1HEX(t))throw new Error("not ASN.1 hex string");if("06092a864886f70d010101"!==e.getTLVbyListEx(t,0,[0,0]))throw new Error("not PKCS8 RSA public key");var n=e.getTLVbyListEx(t,0,[1,0]);this.readPKCS5PubKeyHex(n)},rt.prototype.readCertPubKeyHex=function(t){var e,n;(e=new qt).readCertHex(t),n=e.getPublicKeyHex(),this.readPKCS8PubKeyHex(n)},rt.prototype.sign=function(t,e){var n=ct.crypto.Util.hashString(t,e);return this.signWithMessageHash(n,e)},rt.prototype.signWithMessageHash=function(t,e){var n=nt(ct.crypto.Util.getPaddedDigestInfoHex(t,e,this.n.bitLength()),16);return Kt(this.doPrivate(n).toString(16),this.n.bitLength())},rt.prototype.signPSS=function(t,e,n){var i,r=(i=St(t),ct.crypto.Util.hashHex(i,e));return void 0===n&&(n=-1),this.signWithMessageHashPSS(r,e,n)},rt.prototype.signWithMessageHashPSS=function(t,e,n){var i,r=Et(t),o=r.length,s=this.n.bitLength()-1,a=Math.ceil(s/8),u=function(t){return ct.crypto.Util.hashHex(t,e)};if(-1===n||void 0===n)n=o;else if(-2===n)n=a-o-2;else if(n<-2)throw new Error("invalid salt length");if(a<o+n+2)throw new Error("data too long");var c="";n>0&&(c=new Array(n),(new et).nextBytes(c),c=String.fromCharCode.apply(String,c));var l=Et(u(St("\0\0\0\0\0\0\0\0"+r+c))),h=[];for(i=0;i<a-n-o-2;i+=1)h[i]=0;var d=String.fromCharCode.apply(String,h)+""+c,f=zt(l,d.length,u),p=[];for(i=0;i<d.length;i+=1)p[i]=d.charCodeAt(i)^f.charCodeAt(i);for(p[0]&=~(65280>>8*a-s&255),i=0;i<o;i++)p.push(l.charCodeAt(i));return p.push(188),Kt(this.doPrivate(new S(p)).toString(16),this.n.bitLength())},rt.prototype.verify=function(t,e){if(null==(e=e.toLowerCase()).match(/^[0-9a-f]+$/))return!1;var n=nt(e,16),i=this.n.bitLength();if(n.bitLength()>i)return!1;var r=this.doPublic(n).toString(16);if(r.length+3!=i/4)return!1;var o=Wt(r.replace(/^1f+00/,""));return 0!=o.length&&o[1]==ct.crypto.Util.hashString(t,o[0])},rt.prototype.verifyWithMessageHash=function(t,e){if(e.length!=Math.ceil(this.n.bitLength()/4))return!1;var n=nt(e,16);if(n.bitLength()>this.n.bitLength())return 0;var i=Wt(this.doPublic(n).toString(16).replace(/^1f+00/,""));return 0!=i.length&&i[1]==t},rt.prototype.verifyPSS=function(t,e,n,i){var r,o=(r=St(t),ct.crypto.Util.hashHex(r,n));return void 0===i&&(i=-1),this.verifyWithMessageHashPSS(o,e,n,i)},rt.prototype.verifyWithMessageHashPSS=function(t,e,n,i){if(e.length!=Math.ceil(this.n.bitLength()/4))return!1;var r,o=new S(e,16),s=function(t){return ct.crypto.Util.hashHex(t,n)},a=Et(t),u=a.length,c=this.n.bitLength()-1,l=Math.ceil(c/8);if(-1===i||void 0===i)i=u;else if(-2===i)i=l-u-2;else if(i<-2)throw new Error("invalid salt length");if(l<u+i+2)throw new Error("data too long");var h=this.doPublic(o).toByteArray();for(r=0;r<h.length;r+=1)h[r]&=255;for(;h.length<l;)h.unshift(0);if(188!==h[l-1])throw new Error("encoded message does not end in 0xbc");var d=(h=String.fromCharCode.apply(String,h)).substr(0,l-u-1),f=h.substr(d.length,u),p=65280>>8*l-c&255;if(0!=(d.charCodeAt(0)&p))throw new Error("bits beyond keysize not zero");var v=zt(f,d.length,s),g=[];for(r=0;r<d.length;r+=1)g[r]=d.charCodeAt(r)^v.charCodeAt(r);g[0]&=~p;var m=l-u-i-2;for(r=0;r<m;r+=1)if(0!==g[r])throw new Error("leftmost octets not zero");if(1!==g[m])throw new Error("0x01 marker not found");return f===Et(s(St("\0\0\0\0\0\0\0\0"+a+String.fromCharCode.apply(String,g.slice(-i)))))},rt.SALT_LEN_HLEN=-1,rt.SALT_LEN_MAX=-2,rt.SALT_LEN_RECOVER=-2,qt.hex2dn=function(t,e){void 0===e&&(e=0);var n=new qt;return dt.getTLV(t,e),n.getX500Name(t).str},qt.hex2rdn=function(t,e){if(void 0===e&&(e=0),"31"!==t.substr(e,2))throw new Error("malformed RDN");for(var n=new Array,i=dt.getChildIdx(t,e),r=0;r<i.length;r++)n.push(qt.hex2attrTypeValue(t,i[r]));return(n=n.map((function(t){return t.replace("+","\\+")}))).join("+")},qt.hex2attrTypeValue=function(t,e){var n=dt,i=n.getV;if(void 0===e&&(e=0),"30"!==t.substr(e,2))throw new Error("malformed attribute type and value");var r=n.getChildIdx(t,e);2!==r.length||t.substr(r[0],2);var o=i(t,r[0]),s=ct.asn1.ASN1Util.oidHexToInt(o);return ct.asn1.x509.OID.oid2atype(s)+"="+Et(i(t,r[1]))},qt.getPublicKeyFromCertHex=function(t){var e=new qt;return e.readCertHex(t),e.getPublicKey()},qt.getPublicKeyFromCertPEM=function(t){var e=new qt;return e.readCertPEM(t),e.getPublicKey()},qt.getPublicKeyInfoPropOfCertPEM=function(t){var e,n,i=dt.getVbyList,r={algparam:null};return(e=new qt).readCertPEM(t),n=e.getPublicKeyHex(),r.keyhex=i(n,0,[1],"03").substr(2),r.algoid=i(n,0,[0,0],"06"),"2a8648ce3d0201"===r.algoid&&(r.algparam=i(n,0,[0,1],"06")),r},qt.KEYUSAGE_NAME=["digitalSignature","nonRepudiation","keyEncipherment","dataEncipherment","keyAgreement","keyCertSign","cRLSign","encipherOnly","decipherOnly"],void 0!==ct&&ct||(e.KJUR=ct={}),void 0!==ct.jws&&ct.jws||(ct.jws={}),ct.jws.JWS=function(){var t=ct.jws.JWS.isSafeJSONString;this.parseJWS=function(e,n){if(void 0===this.parsedJWS||!n&&void 0===this.parsedJWS.sigvalH){var i=e.match(/^([^.]+)\.([^.]+)\.([^.]+)$/);if(null==i)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";var r=i[1],o=i[2],s=i[3],a=r+"."+o;if(this.parsedJWS={},this.parsedJWS.headB64U=r,this.parsedJWS.payloadB64U=o,this.parsedJWS.sigvalB64U=s,this.parsedJWS.si=a,!n){var u=yt(s),c=nt(u,16);this.parsedJWS.sigvalH=u,this.parsedJWS.sigvalBI=c}var l=ht(r),h=ht(o);if(this.parsedJWS.headS=l,this.parsedJWS.payloadS=h,!t(l,this.parsedJWS,"headP"))throw"malformed JSON string for JWS Head: "+l}}},ct.jws.JWS.sign=function(t,e,n,i,r){var o,s,a,u=ct.jws.JWS,c=u.readSafeJSONString,l=u.isSafeJSONString,h=ct.crypto,d=h.Mac,f=h.Signature,p=JSON;if("string"!=typeof e&&"object"!=(void 0===e?"undefined":m(e)))throw"spHeader must be JSON string or object: "+e;if("object"==(void 0===e?"undefined":m(e))&&(o=p.stringify(s=e)),"string"==typeof e){if(!l(o=e))throw"JWS Head is not safe JSON string: "+o;s=c(o)}if(a=n,"object"==(void 0===n?"undefined":m(n))&&(a=p.stringify(n)),""!=t&&null!=t||void 0===s.alg||(t=s.alg),""!=t&&null!=t&&void 0===s.alg&&(s.alg=t,o=p.stringify(s)),t!==s.alg)throw"alg and sHeader.alg doesn't match: "+t+"!="+s.alg;var v=null;if(void 0===u.jwsalg2sigalg[t])throw"unsupported alg name: "+t;v=u.jwsalg2sigalg[t];var g=lt(o)+"."+lt(a),w="";if("Hmac"==v.substr(0,4)){if(void 0===i)throw"mac key shall be specified for HS* alg";var b=new d({alg:v,prov:"cryptojs",pass:i});b.updateString(g),w=b.doFinal()}else if(-1!=v.indexOf("withECDSA")){(x=new f({alg:v})).init(i,r),x.updateString(g);var y=x.sign();w=ct.crypto.ECDSA.asn1SigToConcatSig(y)}else{var x;"none"!=v&&((x=new f({alg:v})).init(i,r),x.updateString(g),w=x.sign())}return g+"."+bt(w)},ct.jws.JWS.verify=function(t,e,n){var i,r=ct.jws.JWS,o=r.readSafeJSONString,s=ct.crypto,a=s.ECDSA,u=s.Mac,c=s.Signature;void 0!==m(rt)&&(i=rt);var l=t.split(".");if(3!==l.length)return!1;var h,d=l[0]+"."+l[1],f=yt(l[2]),p=o(ht(l[0])),v=null;if(void 0===p.alg)throw"algorithm not specified in header";if(h=(v=p.alg).substr(0,2),null!=n&&"[object Array]"===Object.prototype.toString.call(n)&&n.length>0&&-1==(":"+n.join(":")+":").indexOf(":"+v+":"))throw"algorithm '"+v+"' not accepted in the list";if("none"!=v&&null===e)throw"key shall be specified to verify.";if("string"==typeof e&&-1!=e.indexOf("-----BEGIN ")&&(e=Ht.getKey(e)),!("RS"!=h&&"PS"!=h||e instanceof i))throw"key shall be a RSAKey obj for RS* and PS* algs";if("ES"==h&&!(e instanceof a))throw"key shall be a ECDSA obj for ES* algs";var g=null;if(void 0===r.jwsalg2sigalg[p.alg])throw"unsupported alg name: "+v;if("none"==(g=r.jwsalg2sigalg[v]))throw"not supported";if("Hmac"==g.substr(0,4)){if(void 0===e)throw"hexadecimal key shall be specified for HMAC";var w=new u({alg:g,pass:e});return w.updateString(d),f==w.doFinal()}if(-1!=g.indexOf("withECDSA")){var b,y=null;try{y=a.concatSigToASN1Sig(f)}catch(t){return!1}return(b=new c({alg:g})).init(e),b.updateString(d),b.verify(y)}return(b=new c({alg:g})).init(e),b.updateString(d),b.verify(f)},ct.jws.JWS.parse=function(t){var e,n,i=t.split("."),r={};if(2!=i.length&&3!=i.length)throw"malformed sJWS: wrong number of '.' splitted elements";return e=i[1],3==i.length&&(n=i[2]),r.headerObj=ct.jws.JWS.readSafeJSONString(ht(i[0])),r.payloadObj=ct.jws.JWS.readSafeJSONString(ht(e)),r.headerPP=JSON.stringify(r.headerObj,null," "),r.payloadPP=null==r.payloadObj?ht(e):JSON.stringify(r.payloadObj,null," "),void 0!==n&&(r.sigHex=yt(n)),r},ct.jws.JWS.verifyJWT=function(t,e,n){var i=ct.jws,r=i.JWS,o=r.readSafeJSONString,s=r.inArray,a=r.includedArray,u=t.split("."),c=u[0],l=u[1],h=(yt(u[2]),o(ht(c))),d=o(ht(l));if(void 0===h.alg)return!1;if(void 0===n.alg)throw"acceptField.alg shall be specified";if(!s(h.alg,n.alg))return!1;if(void 0!==d.iss&&"object"===m(n.iss)&&!s(d.iss,n.iss))return!1;if(void 0!==d.sub&&"object"===m(n.sub)&&!s(d.sub,n.sub))return!1;if(void 0!==d.aud&&"object"===m(n.aud))if("string"==typeof d.aud){if(!s(d.aud,n.aud))return!1}else if("object"==m(d.aud)&&!a(d.aud,n.aud))return!1;var f=i.IntDate.getNow();return void 0!==n.verifyAt&&"number"==typeof n.verifyAt&&(f=n.verifyAt),void 0!==n.gracePeriod&&"number"==typeof n.gracePeriod||(n.gracePeriod=0),!(void 0!==d.exp&&"number"==typeof d.exp&&d.exp+n.gracePeriod<f||void 0!==d.nbf&&"number"==typeof d.nbf&&f<d.nbf-n.gracePeriod||void 0!==d.iat&&"number"==typeof d.iat&&f<d.iat-n.gracePeriod||void 0!==d.jti&&void 0!==n.jti&&d.jti!==n.jti||!r.verify(t,e,n.alg))},ct.jws.JWS.includedArray=function(t,e){var n=ct.jws.JWS.inArray;if(null===t)return!1;if("object"!==(void 0===t?"undefined":m(t)))return!1;if("number"!=typeof t.length)return!1;for(var i=0;i<t.length;i++)if(!n(t[i],e))return!1;return!0},ct.jws.JWS.inArray=function(t,e){if(null===e)return!1;if("object"!==(void 0===e?"undefined":m(e)))return!1;if("number"!=typeof e.length)return!1;for(var n=0;n<e.length;n++)if(e[n]==t)return!0;return!1},ct.jws.JWS.jwsalg2sigalg={HS256:"HmacSHA256",HS384:"HmacSHA384",HS512:"HmacSHA512",RS256:"SHA256withRSA",RS384:"SHA384withRSA",RS512:"SHA512withRSA",ES256:"SHA256withECDSA",ES384:"SHA384withECDSA",PS256:"SHA256withRSAandMGF1",PS384:"SHA384withRSAandMGF1",PS512:"SHA512withRSAandMGF1",none:"none"},ct.jws.JWS.isSafeJSONString=function(t,e,n){var i=null;try{return"object"!=(void 0===(i=ut(t))?"undefined":m(i))||i.constructor===Array?0:(e&&(e[n]=i),1)}catch(t){return 0}},ct.jws.JWS.readSafeJSONString=function(t){var e=null;try{return"object"!=(void 0===(e=ut(t))?"undefined":m(e))||e.constructor===Array?null:e}catch(t){return null}},ct.jws.JWS.getEncodedSignatureValueFromJWS=function(t){var e=t.match(/^[^.]+\.[^.]+\.([^.]+)$/);if(null==e)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";return e[1]},ct.jws.JWS.getJWKthumbprint=function(t){if("RSA"!==t.kty&&"EC"!==t.kty&&"oct"!==t.kty)throw"unsupported algorithm for JWK Thumprint";var e="{";if("RSA"===t.kty){if("string"!=typeof t.n||"string"!=typeof t.e)throw"wrong n and e value for RSA key";e+='"e":"'+t.e+'",',e+='"kty":"'+t.kty+'",',e+='"n":"'+t.n+'"}'}else if("EC"===t.kty){if("string"!=typeof t.crv||"string"!=typeof t.x||"string"!=typeof t.y)throw"wrong crv, x and y value for EC key";e+='"crv":"'+t.crv+'",',e+='"kty":"'+t.kty+'",',e+='"x":"'+t.x+'",',e+='"y":"'+t.y+'"}'}else if("oct"===t.kty){if("string"!=typeof t.k)throw"wrong k value for oct(symmetric) key";e+='"kty":"'+t.kty+'",',e+='"k":"'+t.k+'"}'}var n=St(e);return bt(ct.crypto.Util.hashHex(n,"sha256"))},ct.jws.IntDate={},ct.jws.IntDate.get=function(t){var e=ct.jws.IntDate,n=e.getNow,i=e.getZulu;if("now"==t)return n();if("now + 1hour"==t)return n()+3600;if("now + 1day"==t)return n()+86400;if("now + 1month"==t)return n()+2592e3;if("now + 1year"==t)return n()+31536e3;if(t.match(/Z$/))return i(t);if(t.match(/^[0-9]+$/))return parseInt(t);throw"unsupported format: "+t},ct.jws.IntDate.getZulu=function(t){return It(t)},ct.jws.IntDate.getNow=function(){return~~(new Date/1e3)},ct.jws.IntDate.intDate2UTCString=function(t){return new Date(1e3*t).toUTCString()},ct.jws.IntDate.intDate2Zulu=function(t){var e=new Date(1e3*t);return("0000"+e.getUTCFullYear()).slice(-4)+("00"+(e.getUTCMonth()+1)).slice(-2)+("00"+e.getUTCDate()).slice(-2)+("00"+e.getUTCHours()).slice(-2)+("00"+e.getUTCMinutes()).slice(-2)+("00"+e.getUTCSeconds()).slice(-2)+"Z"},e.SecureRandom=et,e.rng_seed_time=X,e.BigInteger=S,e.RSAKey=rt,e.EDSA=ct.crypto.EDSA,e.DSA=ct.crypto.DSA,e.Signature=ct.crypto.Signature,e.MessageDigest=ct.crypto.MessageDigest,e.Mac=ct.crypto.Mac,e.Cipher=ct.crypto.Cipher,e.KEYUTIL=Ht,e.ASN1HEX=dt,e.X509=qt,e.CryptoJS=b,e.b64tohex=k,e.b64toBA=E,e.stoBA=ft,e.BAtos=pt,e.BAtohex=vt,e.stohex=gt,e.stob64=function(t){return x(gt(t))},e.stob64u=function(t){return mt(x(gt(t)))},e.b64utos=function(t){return pt(E(wt(t)))},e.b64tob64u=mt,e.b64utob64=wt,e.hex2b64=x,e.hextob64u=bt,e.b64utohex=yt,e.utf8tob64u=lt,e.b64utoutf8=ht,e.utf8tob64=function(t){return x(Tt(Ut(t)))},e.b64toutf8=function(t){return decodeURIComponent(Ot(k(t)))},e.utf8tohex=xt,e.hextoutf8=kt,e.hextorstr=Et,e.rstrtohex=St,e.hextob64=Ft,e.hextob64nl=At,e.b64nltohex=_t,e.hextopem=jt,e.pemtohex=Ct,e.hextoArrayBuffer=function(t){if(t.length%2!=0)throw"input is not even length";if(null==t.match(/^[0-9A-Fa-f]+$/))throw"input is not hexadecimal";for(var e=new ArrayBuffer(t.length/2),n=new DataView(e),i=0;i<t.length/2;i++)n.setUint8(i,parseInt(t.substr(2*i,2),16));return e},e.ArrayBuffertohex=function(t){for(var e="",n=new DataView(t),i=0;i<t.byteLength;i++)e+=("00"+n.getUint8(i).toString(16)).slice(-2);return e},e.zulutomsec=Rt,e.zulutosec=It,e.zulutodate=function(t){return new Date(Rt(t))},e.datetozulu=function(t,e,n){var i,r=t.getUTCFullYear();if(e){if(r<1950||2049<r)throw"not proper year for UTCTime: "+r;i=(""+r).slice(-2)}else i=("000"+r).slice(-4);if(i+=("0"+(t.getUTCMonth()+1)).slice(-2),i+=("0"+t.getUTCDate()).slice(-2),i+=("0"+t.getUTCHours()).slice(-2),i+=("0"+t.getUTCMinutes()).slice(-2),i+=("0"+t.getUTCSeconds()).slice(-2),n){var o=t.getUTCMilliseconds();0!==o&&(i+="."+(o=(o=("00"+o).slice(-3)).replace(/0+$/g,"")))}return i+"Z"},e.uricmptohex=Tt,e.hextouricmp=Ot,e.ipv6tohex=Nt,e.hextoipv6=Pt,e.hextoip=Dt,e.iptohex=function(t){var e="malformed IP address";if(!(t=t.toLowerCase(t)).match(/^[0-9.]+$/)){if(t.match(/^[0-9a-f:]+$/)&&-1!==t.indexOf(":"))return Nt(t);throw e}var n=t.split(".");if(4!==n.length)throw e;var i="";try{for(var r=0;r<4;r++)i+=("0"+parseInt(n[r]).toString(16)).slice(-2);return i}catch(t){throw e}},e.encodeURIComponentAll=Ut,e.newline_toUnix=function(t){return t.replace(/\r\n/gm,"\n")},e.newline_toDos=function(t){return(t=t.replace(/\r\n/gm,"\n")).replace(/\n/gm,"\r\n")},e.hextoposhex=Bt,e.intarystrtohex=function(t){t=(t=(t=t.replace(/^\s*\[\s*/,"")).replace(/\s*\]\s*$/,"")).replace(/\s*/g,"");try{return t.split(/,/).map((function(t){var e=parseInt(t);if(e<0||255<e)throw"integer not in range 0-255";return("00"+e.toString(16)).slice(-2)})).join("")}catch(t){throw"malformed integer array string: "+t}},e.strdiffidx=function(t,e){var n=t.length;t.length>e.length&&(n=e.length);for(var i=0;i<n;i++)if(t.charCodeAt(i)!=e.charCodeAt(i))return i;return t.length!=e.length?n:-1},e.KJUR=ct,e.crypto=ct.crypto,e.asn1=ct.asn1,e.jws=ct.jws,e.lang=ct.lang}).call(this,n(28).Buffer)},function(t,e,n){(function(t){var i=n(30),r=n(31),o=n(32);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(s()<e)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=u.prototype:(null===t&&(t=new u(e)),t.length=e),t}function u(t,e,n){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(t,e,n);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return h(this,t)}return c(this,t,e,n)}function c(t,e,n,i){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,n,i){if(n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(i||0))throw new RangeError("'length' is out of bounds");return e=void 0===n&&void 0===i?new Uint8Array(e):void 0===i?new Uint8Array(e,n):new Uint8Array(e,n,i),u.TYPED_ARRAY_SUPPORT?(t=e).__proto__=u.prototype:t=d(t,e),t}(t,e,n,i):"string"==typeof e?function(t,e,n){if("string"==typeof n&&""!==n||(n="utf8"),!u.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var i=0|p(e,n),r=(t=a(t,i)).write(e,n);return r!==i&&(t=t.slice(0,r)),t}(t,e,n):function(t,e){if(u.isBuffer(e)){var n=0|f(e.length);return 0===(t=a(t,n)).length||e.copy(t,0,0,n),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(i=e.length)!=i?a(t,0):d(t,e);if("Buffer"===e.type&&o(e.data))return d(t,e.data)}var i;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function l(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function h(t,e){if(l(e),t=a(t,e<0?0:0|f(e)),!u.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function d(t,e){var n=e.length<0?0:0|f(e.length);t=a(t,n);for(var i=0;i<n;i+=1)t[i]=255&e[i];return t}function f(t){if(t>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function p(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return J(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return $(t).length;default:if(i)return J(t).length;e=(""+e).toLowerCase(),i=!0}}function v(t,e,n){var i=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return R(this,e,n);case"utf8":case"utf-8":return A(this,e,n);case"ascii":return j(this,e,n);case"latin1":case"binary":return C(this,e,n);case"base64":return F(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,n);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function g(t,e,n){var i=t[e];t[e]=t[n],t[n]=i}function m(t,e,n,i,r){if(0===t.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=r?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(r)return-1;n=t.length-1}else if(n<0){if(!r)return-1;n=0}if("string"==typeof e&&(e=u.from(e,i)),u.isBuffer(e))return 0===e.length?-1:w(t,e,n,i,r);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):w(t,[e],n,i,r);throw new TypeError("val must be string, number or Buffer")}function w(t,e,n,i,r){var o,s=1,a=t.length,u=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,n/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(r){var l=-1;for(o=n;o<a;o++)if(c(t,o)===c(e,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===u)return l*s}else-1!==l&&(o-=o-l),l=-1}else for(n+u>a&&(n=a-u),o=n;o>=0;o--){for(var h=!0,d=0;d<u;d++)if(c(t,o+d)!==c(e,d)){h=!1;break}if(h)return o}return-1}function b(t,e,n,i){n=Number(n)||0;var r=t.length-n;i?(i=Number(i))>r&&(i=r):i=r;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");i>o/2&&(i=o/2);for(var s=0;s<i;++s){var a=parseInt(e.substr(2*s,2),16);if(isNaN(a))return s;t[n+s]=a}return s}function y(t,e,n,i){return H(J(e,t.length-n),t,n,i)}function x(t,e,n,i){return H(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,i)}function k(t,e,n,i){return x(t,e,n,i)}function E(t,e,n,i){return H($(e),t,n,i)}function S(t,e,n,i){return H(function(t,e){for(var n,i,r=[],o=0;o<t.length&&!((e-=2)<0);++o)i=(n=t.charCodeAt(o))>>8,r.push(n%256),r.push(i);return r}(e,t.length-n),t,n,i)}function F(t,e,n){return i.fromByteArray(0===e&&n===t.length?t:t.slice(e,n))}function A(t,e,n){n=Math.min(t.length,n);for(var i=[],r=e;r<n;){var o,s,a,u,c=t[r],l=null,h=c>239?4:c>223?3:c>191?2:1;if(r+h<=n)switch(h){case 1:c<128&&(l=c);break;case 2:128==(192&(o=t[r+1]))&&(u=(31&c)<<6|63&o)>127&&(l=u);break;case 3:s=t[r+2],128==(192&(o=t[r+1]))&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:s=t[r+2],a=t[r+3],128==(192&(o=t[r+1]))&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(l=u)}null===l?(l=65533,h=1):l>65535&&(i.push((l-=65536)>>>10&1023|55296),l=56320|1023&l),i.push(l),r+=h}return function(t){var e=t.length;if(e<=_)return String.fromCharCode.apply(String,t);for(var n="",i=0;i<e;)n+=String.fromCharCode.apply(String,t.slice(i,i+=_));return n}(i)}e.Buffer=u,e.SlowBuffer=function(t){return+t!=t&&(t=0),u.alloc(+t)},e.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=s(),u.poolSize=8192,u._augment=function(t){return t.__proto__=u.prototype,t},u.from=function(t,e,n){return c(null,t,e,n)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(t,e,n){return i=null,o=e,s=n,l(r=t),r<=0?a(i,r):void 0!==o?"string"==typeof s?a(i,r).fill(o,s):a(i,r).fill(o):a(i,r);var i,r,o,s},u.allocUnsafe=function(t){return h(null,t)},u.allocUnsafeSlow=function(t){return h(null,t)},u.isBuffer=function(t){return!(null==t||!t._isBuffer)},u.compare=function(t,e){if(!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,i=e.length,r=0,o=Math.min(n,i);r<o;++r)if(t[r]!==e[r]){n=t[r],i=e[r];break}return n<i?-1:i<n?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var i=u.allocUnsafe(e),r=0;for(n=0;n<t.length;++n){var s=t[n];if(!u.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(i,r),r+=s.length}return i},u.byteLength=p,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)g(this,e,e+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)g(this,e,e+3),g(this,e+1,e+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)g(this,e,e+7),g(this,e+1,e+6),g(this,e+2,e+5),g(this,e+3,e+4);return this},u.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?A(this,0,t):v.apply(this,arguments)},u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),"<Buffer "+t+">"},u.prototype.compare=function(t,e,n,i,r){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===i&&(i=0),void 0===r&&(r=this.length),e<0||n>t.length||i<0||r>this.length)throw new RangeError("out of range index");if(i>=r&&e>=n)return 0;if(i>=r)return-1;if(e>=n)return 1;if(this===t)return 0;for(var o=(r>>>=0)-(i>>>=0),s=(n>>>=0)-(e>>>=0),a=Math.min(o,s),c=this.slice(i,r),l=t.slice(e,n),h=0;h<a;++h)if(c[h]!==l[h]){o=c[h],s=l[h];break}return o<s?-1:s<o?1:0},u.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},u.prototype.indexOf=function(t,e,n){return m(this,t,e,n,!0)},u.prototype.lastIndexOf=function(t,e,n){return m(this,t,e,n,!1)},u.prototype.write=function(t,e,n,i){if(void 0===e)i="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)i=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,void 0===i&&(i="utf8")):(i=n,n=void 0)}var r=this.length-e;if((void 0===n||n>r)&&(n=r),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return b(this,t,e,n);case"utf8":case"utf-8":return y(this,t,e,n);case"ascii":return x(this,t,e,n);case"latin1":case"binary":return k(this,t,e,n);case"base64":return E(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var _=4096;function j(t,e,n){var i="";n=Math.min(t.length,n);for(var r=e;r<n;++r)i+=String.fromCharCode(127&t[r]);return i}function C(t,e,n){var i="";n=Math.min(t.length,n);for(var r=e;r<n;++r)i+=String.fromCharCode(t[r]);return i}function R(t,e,n){var i=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>i)&&(n=i);for(var r="",o=e;o<n;++o)r+=B(t[o]);return r}function I(t,e,n){for(var i=t.slice(e,n),r="",o=0;o<i.length;o+=2)r+=String.fromCharCode(i[o]+256*i[o+1]);return r}function T(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function O(t,e,n,i,r,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>r||e<o)throw new RangeError('"value" argument is out of bounds');if(n+i>t.length)throw new RangeError("Index out of range")}function N(t,e,n,i){e<0&&(e=65535+e+1);for(var r=0,o=Math.min(t.length-n,2);r<o;++r)t[n+r]=(e&255<<8*(i?r:1-r))>>>8*(i?r:1-r)}function P(t,e,n,i){e<0&&(e=4294967295+e+1);for(var r=0,o=Math.min(t.length-n,4);r<o;++r)t[n+r]=e>>>8*(i?r:3-r)&255}function D(t,e,n,i){if(n+i>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function M(t,e,n,i,o){return o||D(t,0,n,4),r.write(t,e,n,i,23,4),n+4}function U(t,e,n,i,o){return o||D(t,0,n,8),r.write(t,e,n,i,52,8),n+8}u.prototype.slice=function(t,e){var n,i=this.length;if((t=~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),(e=void 0===e?i:~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),e<t&&(e=t),u.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=u.prototype;else{var r=e-t;n=new u(r,void 0);for(var o=0;o<r;++o)n[o]=this[o+t]}return n},u.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||T(t,e,this.length);for(var i=this[t],r=1,o=0;++o<e&&(r*=256);)i+=this[t+o]*r;return i},u.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||T(t,e,this.length);for(var i=this[t+--e],r=1;e>0&&(r*=256);)i+=this[t+--e]*r;return i},u.prototype.readUInt8=function(t,e){return e||T(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||T(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||T(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||T(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||T(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||T(t,e,this.length);for(var i=this[t],r=1,o=0;++o<e&&(r*=256);)i+=this[t+o]*r;return i>=(r*=128)&&(i-=Math.pow(2,8*e)),i},u.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||T(t,e,this.length);for(var i=e,r=1,o=this[t+--i];i>0&&(r*=256);)o+=this[t+--i]*r;return o>=(r*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return e||T(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||T(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(t,e){e||T(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function(t,e){return e||T(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||T(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||T(t,4,this.length),r.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||T(t,4,this.length),r.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||T(t,8,this.length),r.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||T(t,8,this.length),r.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,n,i){t=+t,e|=0,n|=0,i||O(this,t,e,n,Math.pow(2,8*n)-1,0);var r=1,o=0;for(this[e]=255&t;++o<n&&(r*=256);)this[e+o]=t/r&255;return e+n},u.prototype.writeUIntBE=function(t,e,n,i){t=+t,e|=0,n|=0,i||O(this,t,e,n,Math.pow(2,8*n)-1,0);var r=n-1,o=1;for(this[e+r]=255&t;--r>=0&&(o*=256);)this[e+r]=t/o&255;return e+n},u.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):N(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):N(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):P(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):P(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,n,i){if(t=+t,e|=0,!i){var r=Math.pow(2,8*n-1);O(this,t,e,n,r-1,-r)}var o=0,s=1,a=0;for(this[e]=255&t;++o<n&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+n},u.prototype.writeIntBE=function(t,e,n,i){if(t=+t,e|=0,!i){var r=Math.pow(2,8*n-1);O(this,t,e,n,r-1,-r)}var o=n-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+n},u.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):N(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):N(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):P(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):P(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,n){return M(this,t,e,!0,n)},u.prototype.writeFloatBE=function(t,e,n){return M(this,t,e,!1,n)},u.prototype.writeDoubleLE=function(t,e,n){return U(this,t,e,!0,n)},u.prototype.writeDoubleBE=function(t,e,n){return U(this,t,e,!1,n)},u.prototype.copy=function(t,e,n,i){if(n||(n=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<n&&(i=n),i===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-n&&(i=t.length-e+n);var r,o=i-n;if(this===t&&n<e&&e<i)for(r=o-1;r>=0;--r)t[r+e]=this[r+n];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(r=0;r<o;++r)t[r+e]=this[r+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+o),e);return o},u.prototype.fill=function(t,e,n,i){if("string"==typeof t){if("string"==typeof e?(i=e,e=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),1===t.length){var r=t.charCodeAt(0);r<256&&(t=r)}if(void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!u.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var o;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o<n;++o)this[o]=t;else{var s=u.isBuffer(t)?t:J(new u(t,i).toString()),a=s.length;for(o=0;o<n-e;++o)this[o+e]=s[o%a]}return this};var L=/[^+\/0-9A-Za-z-_]/g;function B(t){return t<16?"0"+t.toString(16):t.toString(16)}function J(t,e){var n;e=e||1/0;for(var i=t.length,r=null,o=[],s=0;s<i;++s){if((n=t.charCodeAt(s))>55295&&n<57344){if(!r){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===i){(e-=3)>-1&&o.push(239,191,189);continue}r=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(e-=3)>-1&&o.push(239,191,189);if(r=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function $(t){return i.toByteArray(function(t){if((t=(e=t,e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")).replace(L,"")).length<2)return"";for(var e;t.length%4!=0;)t+="=";return t}(t))}function H(t,e,n,i){for(var r=0;r<i&&!(r+n>=e.length||r>=t.length);++r)e[r+n]=t[r];return r}}).call(this,n(29))},function(t){var e;e=function(){return this}();try{e=e||new Function("return this")()}catch(t){"object"==typeof window&&(e=window)}t.exports=e},function(t,e){e.byteLength=function(t){var e=u(t),n=e[1];return 3*(e[0]+n)/4-n},e.toByteArray=function(t){var e,n,o,s=u(t),a=s[0],c=s[1],l=new r(3*(a+(o=c))/4-o),h=0,d=c>0?a-4:a;for(n=0;n<d;n+=4)e=i[t.charCodeAt(n)]<<18|i[t.charCodeAt(n+1)]<<12|i[t.charCodeAt(n+2)]<<6|i[t.charCodeAt(n+3)],l[h++]=e>>16&255,l[h++]=e>>8&255,l[h++]=255&e;return 2===c&&(e=i[t.charCodeAt(n)]<<2|i[t.charCodeAt(n+1)]>>4,l[h++]=255&e),1===c&&(e=i[t.charCodeAt(n)]<<10|i[t.charCodeAt(n+1)]<<4|i[t.charCodeAt(n+2)]>>2,l[h++]=e>>8&255,l[h++]=255&e),l},e.fromByteArray=function(t){for(var e,i=t.length,r=i%3,o=[],s=16383,a=0,u=i-r;a<u;a+=s)o.push(c(t,a,a+s>u?u:a+s));return 1===r?o.push(n[(e=t[i-1])>>2]+n[e<<4&63]+"=="):2===r&&o.push(n[(e=(t[i-2]<<8)+t[i-1])>>10]+n[e>>4&63]+n[e<<2&63]+"="),o.join("")};for(var n=[],i=[],r="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,a=o.length;s<a;++s)n[s]=o[s],i[o.charCodeAt(s)]=s;function u(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function c(t,e,i){for(var r,o=[],s=e;s<i;s+=3)o.push(n[(r=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]))>>18&63]+n[r>>12&63]+n[r>>6&63]+n[63&r]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,n,i,r){var o,s,a=8*r-i-1,u=(1<<a)-1,c=u>>1,l=-7,h=n?r-1:0,d=n?-1:1,f=t[e+h];for(h+=d,o=f&(1<<-l)-1,f>>=-l,l+=a;l>0;o=256*o+t[e+h],h+=d,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=i;l>0;s=256*s+t[e+h],h+=d,l-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,i),o-=c}return(f?-1:1)*s*Math.pow(2,o-i)},e.write=function(t,e,n,i,r,o){var s,a,u,c=8*o-r-1,l=(1<<c)-1,h=l>>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,f=i?0:o-1,p=i?1:-1,v=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=l):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+h>=1?d/u:d*Math.pow(2,1-h))*u>=2&&(s++,u/=2),s+h>=l?(a=0,s=l):s+h>=1?(a=(e*u-1)*Math.pow(2,r),s+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,r),s=0));r>=8;t[n+f]=255&a,f+=p,a/=256,r-=8);for(s=s<<r|a,c+=r;c>0;t[n+f]=255&s,f+=p,s/=256,c-=8);t[n+f-p]|=128*v}},function(t){var e={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==e.call(t)}},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){var e=t.jws,n=t.KeyUtil,r=t.X509,o=t.crypto,s=t.hextob64u,a=t.b64tohex,u=t.AllowedSigningAlgs;return function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return t.parseJwt=function(t){i.Log.debug("JoseUtil.parseJwt");try{var n=e.JWS.parse(t);return{header:n.headerObj,payload:n.payloadObj}}catch(t){i.Log.error(t)}},t.validateJwt=function(e,o,s,u,c,l,h){i.Log.debug("JoseUtil.validateJwt");try{if("RSA"===o.kty)if(o.e&&o.n)o=n.getKey(o);else{if(!o.x5c||!o.x5c.length)return i.Log.error("JoseUtil.validateJwt: RSA key missing key material",o),Promise.reject(new Error("RSA key missing key material"));var d=a(o.x5c[0]);o=r.getPublicKeyFromCertHex(d)}else{if("EC"!==o.kty)return i.Log.error("JoseUtil.validateJwt: Unsupported key type",o&&o.kty),Promise.reject(new Error(o.kty));if(!(o.crv&&o.x&&o.y))return i.Log.error("JoseUtil.validateJwt: EC key missing key material",o),Promise.reject(new Error("EC key missing key material"));o=n.getKey(o)}return t._validateJwt(e,o,s,u,c,l,h)}catch(t){return i.Log.error(t&&t.message||t),Promise.reject("JWT validation failed")}},t.validateJwtAttributes=function(e,n,r,o,s,a){o||(o=0),s||(s=parseInt(Date.now()/1e3));var u=t.parseJwt(e).payload;if(!u.iss)return i.Log.error("JoseUtil._validateJwt: issuer was not provided"),Promise.reject(new Error("issuer was not provided"));if(u.iss!==n)return i.Log.error("JoseUtil._validateJwt: Invalid issuer in token",u.iss),Promise.reject(new Error("Invalid issuer in token: "+u.iss));if(!u.aud)return i.Log.error("JoseUtil._validateJwt: aud was not provided"),Promise.reject(new Error("aud was not provided"));if(!(u.aud===r||Array.isArray(u.aud)&&u.aud.indexOf(r)>=0))return i.Log.error("JoseUtil._validateJwt: Invalid audience in token",u.aud),Promise.reject(new Error("Invalid audience in token: "+u.aud));if(u.azp&&u.azp!==r)return i.Log.error("JoseUtil._validateJwt: Invalid azp in token",u.azp),Promise.reject(new Error("Invalid azp in token: "+u.azp));if(!a){var c=s+o,l=s-o;if(!u.iat)return i.Log.error("JoseUtil._validateJwt: iat was not provided"),Promise.reject(new Error("iat was not provided"));if(c<u.iat)return i.Log.error("JoseUtil._validateJwt: iat is in the future",u.iat),Promise.reject(new Error("iat is in the future: "+u.iat));if(u.nbf&&c<u.nbf)return i.Log.error("JoseUtil._validateJwt: nbf is in the future",u.nbf),Promise.reject(new Error("nbf is in the future: "+u.nbf));if(!u.exp)return i.Log.error("JoseUtil._validateJwt: exp was not provided"),Promise.reject(new Error("exp was not provided"));if(u.exp<l)return i.Log.error("JoseUtil._validateJwt: exp is in the past",u.exp),Promise.reject(new Error("exp is in the past:"+u.exp))}return Promise.resolve(u)},t._validateJwt=function(n,r,o,s,a,c,l){return t.validateJwtAttributes(n,o,s,a,c,l).then((function(t){try{return e.JWS.verify(n,r,u)?t:(i.Log.error("JoseUtil._validateJwt: signature validation failed"),Promise.reject(new Error("signature validation failed")))}catch(t){return i.Log.error(t&&t.message||t),Promise.reject(new Error("signature validation failed"))}}))},t.hashString=function(t,e){try{return o.Util.hashString(t,e)}catch(t){i.Log.error(t)}},t.hexToBase64Url=function(t){try{return s(t)}catch(t){i.Log.error(t)}},t}()};var i=n(0);t.exports=e.default},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.SigninResponse=void 0;var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),r=n(3);function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.SigninResponse=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"#";o(this,t);var i=r.UrlUtility.parseUrlFragment(e,n);this.error=i.error,this.error_description=i.error_description,this.error_uri=i.error_uri,this.code=i.code,this.state=i.state,this.id_token=i.id_token,this.session_state=i.session_state,this.access_token=i.access_token,this.token_type=i.token_type,this.scope=i.scope,this.profile=void 0,this.expires_in=i.expires_in}return i(t,[{key:"expires_in",get:function(){if(this.expires_at){var t=parseInt(Date.now()/1e3);return this.expires_at-t}},set:function(t){var e=parseInt(t);if("number"==typeof e&&e>0){var n=parseInt(Date.now()/1e3);this.expires_at=n+e}}},{key:"expired",get:function(){var t=this.expires_in;if(void 0!==t)return t<=0}},{key:"scopes",get:function(){return(this.scope||"").split(" ")}},{key:"isOpenIdConnect",get:function(){return this.scopes.indexOf("openid")>=0||!!this.id_token}}]),t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.SignoutRequest=void 0;var i=n(0),r=n(3),o=n(9);e.SignoutRequest=function t(e){var n=e.url,s=e.id_token_hint,a=e.post_logout_redirect_uri,u=e.data,c=e.extraQueryParams,l=e.request_type;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!n)throw i.Log.error("SignoutRequest.ctor: No url passed"),new Error("url");for(var h in s&&(n=r.UrlUtility.addQueryParam(n,"id_token_hint",s)),a&&(n=r.UrlUtility.addQueryParam(n,"post_logout_redirect_uri",a),u&&(this.state=new o.State({data:u,request_type:l}),n=r.UrlUtility.addQueryParam(n,"state",this.state.id))),c)n=r.UrlUtility.addQueryParam(n,h,c[h]);this.url=n}},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.SignoutResponse=void 0;var i=n(3);e.SignoutResponse=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);var n=i.UrlUtility.parseUrlFragment(e,"?");this.error=n.error,this.error_description=n.error_description,this.error_uri=n.error_uri,this.state=n.state}},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.InMemoryWebStorage=void 0;var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),r=n(0);e.InMemoryWebStorage=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._data={}}return t.prototype.getItem=function(t){return r.Log.debug("InMemoryWebStorage.getItem",t),this._data[t]},t.prototype.setItem=function(t,e){r.Log.debug("InMemoryWebStorage.setItem",t),this._data[t]=e},t.prototype.removeItem=function(t){r.Log.debug("InMemoryWebStorage.removeItem",t),delete this._data[t]},t.prototype.key=function(t){return Object.getOwnPropertyNames(this._data)[t]},i(t,[{key:"length",get:function(){return Object.getOwnPropertyNames(this._data).length}}]),t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.UserManager=void 0;var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),r=n(0),o=n(10),s=n(39),a=n(15),u=n(45),c=n(47),l=n(18),h=n(8),d=n(20),f=n(11),p=n(4);function v(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function g(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}e.UserManager=function(t){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.SilentRenewService,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l.SessionMonitor,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:d.TokenRevocationClient,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:f.TokenClient,m=arguments.length>5&&void 0!==arguments[5]?arguments[5]:p.JoseUtil;v(this,e),n instanceof s.UserManagerSettings||(n=new s.UserManagerSettings(n));var w=g(this,t.call(this,n));return w._events=new u.UserManagerEvents(n),w._silentRenewService=new i(w),w.settings.automaticSilentRenew&&(r.Log.debug("UserManager.ctor: automaticSilentRenew is configured, setting up silent renew"),w.startSilentRenew()),w.settings.monitorSession&&(r.Log.debug("UserManager.ctor: monitorSession is configured, setting up session monitor"),w._sessionMonitor=new o(w)),w._tokenRevocationClient=new a(w._settings),w._tokenClient=new h(w._settings),w._joseUtil=m,w}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.getUser=function(){var t=this;return this._loadUser().then((function(e){return e?(r.Log.info("UserManager.getUser: user loaded"),t._events.load(e,!1),e):(r.Log.info("UserManager.getUser: user not found in storage"),null)}))},e.prototype.removeUser=function(){var t=this;return this.storeUser(null).then((function(){r.Log.info("UserManager.removeUser: user removed from storage"),t._events.unload()}))},e.prototype.signinRedirect=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(t=Object.assign({},t)).request_type="si:r";var e={useReplaceToNavigate:t.useReplaceToNavigate};return this._signinStart(t,this._redirectNavigator,e).then((function(){r.Log.info("UserManager.signinRedirect: successful")}))},e.prototype.signinRedirectCallback=function(t){return this._signinEnd(t||this._redirectNavigator.url).then((function(t){return t.profile&&t.profile.sub?r.Log.info("UserManager.signinRedirectCallback: successful, signed in sub: ",t.profile.sub):r.Log.info("UserManager.signinRedirectCallback: no sub"),t}))},e.prototype.signinPopup=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(t=Object.assign({},t)).request_type="si:p";var e=t.redirect_uri||this.settings.popup_redirect_uri||this.settings.redirect_uri;return e?(t.redirect_uri=e,t.display="popup",this._signin(t,this._popupNavigator,{startUrl:e,popupWindowFeatures:t.popupWindowFeatures||this.settings.popupWindowFeatures,popupWindowTarget:t.popupWindowTarget||this.settings.popupWindowTarget}).then((function(t){return t&&(t.profile&&t.profile.sub?r.Log.info("UserManager.signinPopup: signinPopup successful, signed in sub: ",t.profile.sub):r.Log.info("UserManager.signinPopup: no sub")),t}))):(r.Log.error("UserManager.signinPopup: No popup_redirect_uri or redirect_uri configured"),Promise.reject(new Error("No popup_redirect_uri or redirect_uri configured")))},e.prototype.signinPopupCallback=function(t){return this._signinCallback(t,this._popupNavigator).then((function(t){return t&&(t.profile&&t.profile.sub?r.Log.info("UserManager.signinPopupCallback: successful, signed in sub: ",t.profile.sub):r.Log.info("UserManager.signinPopupCallback: no sub")),t})).catch((function(t){r.Log.error(t.message)}))},e.prototype.signinSilent=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e=Object.assign({},e),this._loadUser().then((function(n){return n&&n.refresh_token?(e.refresh_token=n.refresh_token,t._useRefreshToken(e)):(e.request_type="si:s",e.id_token_hint=e.id_token_hint||t.settings.includeIdTokenInSilentRenew&&n&&n.id_token,n&&t._settings.validateSubOnSilentRenew&&(r.Log.debug("UserManager.signinSilent, subject prior to silent renew: ",n.profile.sub),e.current_sub=n.profile.sub),t._signinSilentIframe(e))}))},e.prototype._useRefreshToken=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._tokenClient.exchangeRefreshToken(e).then((function(e){return e?e.access_token?t._loadUser().then((function(n){if(n){var i=Promise.resolve();return e.id_token&&(i=t._validateIdTokenFromTokenRefreshToken(n.profile,e.id_token)),i.then((function(){return r.Log.debug("UserManager._useRefreshToken: refresh token response success"),n.id_token=e.id_token||n.id_token,n.access_token=e.access_token,n.refresh_token=e.refresh_token||n.refresh_token,n.expires_in=e.expires_in,t.storeUser(n).then((function(){return t._events.load(n),n}))}))}return null})):(r.Log.error("UserManager._useRefreshToken: No access token returned from token endpoint"),Promise.reject("No access token returned from token endpoint")):(r.Log.error("UserManager._useRefreshToken: No response returned from token endpoint"),Promise.reject("No response returned from token endpoint"))}))},e.prototype._validateIdTokenFromTokenRefreshToken=function(t,e){var n=this;return this._metadataService.getIssuer().then((function(i){return n.settings.getEpochTime().then((function(o){return n._joseUtil.validateJwtAttributes(e,i,n._settings.client_id,n._settings.clockSkew,o).then((function(e){return e?e.sub!==t.sub?(r.Log.error("UserManager._validateIdTokenFromTokenRefreshToken: sub in id_token does not match current sub"),Promise.reject(new Error("sub in id_token does not match current sub"))):e.auth_time&&e.auth_time!==t.auth_time?(r.Log.error("UserManager._validateIdTokenFromTokenRefreshToken: auth_time in id_token does not match original auth_time"),Promise.reject(new Error("auth_time in id_token does not match original auth_time"))):e.azp&&e.azp!==t.azp?(r.Log.error("UserManager._validateIdTokenFromTokenRefreshToken: azp in id_token does not match original azp"),Promise.reject(new Error("azp in id_token does not match original azp"))):!e.azp&&t.azp?(r.Log.error("UserManager._validateIdTokenFromTokenRefreshToken: azp not in id_token, but present in original id_token"),Promise.reject(new Error("azp not in id_token, but present in original id_token"))):void 0:(r.Log.error("UserManager._validateIdTokenFromTokenRefreshToken: Failed to validate id_token"),Promise.reject(new Error("Failed to validate id_token")))}))}))}))},e.prototype._signinSilentIframe=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.redirect_uri||this.settings.silent_redirect_uri||this.settings.redirect_uri;return e?(t.redirect_uri=e,t.prompt=t.prompt||"none",this._signin(t,this._iframeNavigator,{startUrl:e,silentRequestTimeout:t.silentRequestTimeout||this.settings.silentRequestTimeout}).then((function(t){return t&&(t.profile&&t.profile.sub?r.Log.info("UserManager.signinSilent: successful, signed in sub: ",t.profile.sub):r.Log.info("UserManager.signinSilent: no sub")),t}))):(r.Log.error("UserManager.signinSilent: No silent_redirect_uri configured"),Promise.reject(new Error("No silent_redirect_uri configured")))},e.prototype.signinSilentCallback=function(t){return this._signinCallback(t,this._iframeNavigator).then((function(t){return t&&(t.profile&&t.profile.sub?r.Log.info("UserManager.signinSilentCallback: successful, signed in sub: ",t.profile.sub):r.Log.info("UserManager.signinSilentCallback: no sub")),t}))},e.prototype.signinCallback=function(t){var e=this;return this.readSigninResponseState(t).then((function(n){var i=n.state;return"si:r"===i.request_type?e.signinRedirectCallback(t):"si:p"===i.request_type?e.signinPopupCallback(t):"si:s"===i.request_type?e.signinSilentCallback(t):Promise.reject(new Error("invalid response_type in state"))}))},e.prototype.signoutCallback=function(t,e){var n=this;return this.readSignoutResponseState(t).then((function(i){var r=i.state,o=i.response;return r?"so:r"===r.request_type?n.signoutRedirectCallback(t):"so:p"===r.request_type?n.signoutPopupCallback(t,e):Promise.reject(new Error("invalid response_type in state")):o}))},e.prototype.querySessionStatus=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(e=Object.assign({},e)).request_type="si:s";var n=e.redirect_uri||this.settings.silent_redirect_uri||this.settings.redirect_uri;return n?(e.redirect_uri=n,e.prompt="none",e.response_type=e.response_type||this.settings.query_status_response_type,e.scope=e.scope||"openid",e.skipUserInfo=!0,this._signinStart(e,this._iframeNavigator,{startUrl:n,silentRequestTimeout:e.silentRequestTimeout||this.settings.silentRequestTimeout}).then((function(e){return t.processSigninResponse(e.url).then((function(t){if(r.Log.debug("UserManager.querySessionStatus: got signin response"),t.session_state&&t.profile.sub)return r.Log.info("UserManager.querySessionStatus: querySessionStatus success for sub: ",t.profile.sub),{session_state:t.session_state,sub:t.profile.sub,sid:t.profile.sid};r.Log.info("querySessionStatus successful, user not authenticated")})).catch((function(e){if(e.session_state&&t.settings.monitorAnonymousSession&&("login_required"==e.message||"consent_required"==e.message||"interaction_required"==e.message||"account_selection_required"==e.message))return r.Log.info("UserManager.querySessionStatus: querySessionStatus success for anonymous user"),{session_state:e.session_state};throw e}))}))):(r.Log.error("UserManager.querySessionStatus: No silent_redirect_uri configured"),Promise.reject(new Error("No silent_redirect_uri configured")))},e.prototype._signin=function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this._signinStart(t,e,i).then((function(e){return n._signinEnd(e.url,t)}))},e.prototype._signinStart=function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return e.prepare(i).then((function(e){return r.Log.debug("UserManager._signinStart: got navigator window handle"),n.createSigninRequest(t).then((function(t){return r.Log.debug("UserManager._signinStart: got signin request"),i.url=t.url,i.id=t.state.id,e.navigate(i)})).catch((function(t){throw e.close&&(r.Log.debug("UserManager._signinStart: Error after preparing navigator, closing navigator window"),e.close()),t}))}))},e.prototype._signinEnd=function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.processSigninResponse(t).then((function(t){r.Log.debug("UserManager._signinEnd: got signin response");var i=new a.User(t);if(n.current_sub){if(n.current_sub!==i.profile.sub)return r.Log.debug("UserManager._signinEnd: current user does not match user returned from signin. sub from signin: ",i.profile.sub),Promise.reject(new Error("login_required"));r.Log.debug("UserManager._signinEnd: current user matches user returned from signin")}return e.storeUser(i).then((function(){return r.Log.debug("UserManager._signinEnd: user stored"),e._events.load(i),i}))}))},e.prototype._signinCallback=function(t,e){r.Log.debug("UserManager._signinCallback");var n="query"===this._settings.response_mode||!this._settings.response_mode&&h.SigninRequest.isCode(this._settings.response_type)?"?":"#";return e.callback(t,void 0,n)},e.prototype.signoutRedirect=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(t=Object.assign({},t)).request_type="so:r";var e=t.post_logout_redirect_uri||this.settings.post_logout_redirect_uri;e&&(t.post_logout_redirect_uri=e);var n={useReplaceToNavigate:t.useReplaceToNavigate};return this._signoutStart(t,this._redirectNavigator,n).then((function(){r.Log.info("UserManager.signoutRedirect: successful")}))},e.prototype.signoutRedirectCallback=function(t){return this._signoutEnd(t||this._redirectNavigator.url).then((function(t){return r.Log.info("UserManager.signoutRedirectCallback: successful"),t}))},e.prototype.signoutPopup=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(t=Object.assign({},t)).request_type="so:p";var e=t.post_logout_redirect_uri||this.settings.popup_post_logout_redirect_uri||this.settings.post_logout_redirect_uri;return t.post_logout_redirect_uri=e,t.display="popup",t.post_logout_redirect_uri&&(t.state=t.state||{}),this._signout(t,this._popupNavigator,{startUrl:e,popupWindowFeatures:t.popupWindowFeatures||this.settings.popupWindowFeatures,popupWindowTarget:t.popupWindowTarget||this.settings.popupWindowTarget}).then((function(){r.Log.info("UserManager.signoutPopup: successful")}))},e.prototype.signoutPopupCallback=function(t,e){return void 0===e&&"boolean"==typeof t&&(e=t,t=null),this._popupNavigator.callback(t,e,"?").then((function(){r.Log.info("UserManager.signoutPopupCallback: successful")}))},e.prototype._signout=function(t,e){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this._signoutStart(t,e,i).then((function(t){return n._signoutEnd(t.url)}))},e.prototype._signoutStart=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this,n=arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n.prepare(i).then((function(n){return r.Log.debug("UserManager._signoutStart: got navigator window handle"),e._loadUser().then((function(o){return r.Log.debug("UserManager._signoutStart: loaded current user from storage"),(e._settings.revokeAccessTokenOnSignout?e._revokeInternal(o):Promise.resolve()).then((function(){var s=t.id_token_hint||o&&o.id_token;return s&&(r.Log.debug("UserManager._signoutStart: Setting id_token into signout request"),t.id_token_hint=s),e.removeUser().then((function(){return r.Log.debug("UserManager._signoutStart: user removed, creating signout request"),e.createSignoutRequest(t).then((function(t){return r.Log.debug("UserManager._signoutStart: got signout request"),i.url=t.url,t.state&&(i.id=t.state.id),n.navigate(i)}))}))}))})).catch((function(t){throw n.close&&(r.Log.debug("UserManager._signoutStart: Error after preparing navigator, closing navigator window"),n.close()),t}))}))},e.prototype._signoutEnd=function(t){return this.processSignoutResponse(t).then((function(t){return r.Log.debug("UserManager._signoutEnd: got signout response"),t}))},e.prototype.revokeAccessToken=function(){var t=this;return this._loadUser().then((function(e){return t._revokeInternal(e,!0).then((function(n){if(n)return r.Log.debug("UserManager.revokeAccessToken: removing token properties from user and re-storing"),e.access_token=null,e.refresh_token=null,e.expires_at=null,e.token_type=null,t.storeUser(e).then((function(){r.Log.debug("UserManager.revokeAccessToken: user stored"),t._events.load(e)}))}))})).then((function(){r.Log.info("UserManager.revokeAccessToken: access token revoked successfully")}))},e.prototype._revokeInternal=function(t,e){var n=this;if(t){var i=t.refresh_token;return this._revokeAccessTokenInternal(t.access_token,e).then((function(t){return n._revokeRefreshTokenInternal(i,e).then((function(e){return t||e||r.Log.debug("UserManager.revokeAccessToken: no need to revoke due to no token(s), or JWT format"),t||e}))}))}return Promise.resolve(!1)},e.prototype._revokeAccessTokenInternal=function(t,e){return!t||t.indexOf(".")>=0?Promise.resolve(!1):this._tokenRevocationClient.revoke(t,e).then((function(){return!0}))},e.prototype._revokeRefreshTokenInternal=function(t,e){return t?this._tokenRevocationClient.revoke(t,e,"refresh_token").then((function(){return!0})):Promise.resolve(!1)},e.prototype.startSilentRenew=function(){this._silentRenewService.start()},e.prototype.stopSilentRenew=function(){this._silentRenewService.stop()},e.prototype._loadUser=function(){return this._userStore.get(this._userStoreKey).then((function(t){return t?(r.Log.debug("UserManager._loadUser: user storageString loaded"),a.User.fromStorageString(t)):(r.Log.debug("UserManager._loadUser: no user storageString"),null)}))},e.prototype.storeUser=function(t){if(t){r.Log.debug("UserManager.storeUser: storing user");var e=t.toStorageString();return this._userStore.set(this._userStoreKey,e)}return r.Log.debug("storeUser.storeUser: removing user"),this._userStore.remove(this._userStoreKey)},i(e,[{key:"_redirectNavigator",get:function(){return this.settings.redirectNavigator}},{key:"_popupNavigator",get:function(){return this.settings.popupNavigator}},{key:"_iframeNavigator",get:function(){return this.settings.iframeNavigator}},{key:"_userStore",get:function(){return this.settings.userStore}},{key:"events",get:function(){return this._events}},{key:"_userStoreKey",get:function(){return"user:"+this.settings.authority+":"+this.settings.client_id}}]),e}(o.OidcClient)},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.UserManagerSettings=void 0;var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),r=(n(0),n(5)),o=n(40),s=n(41),a=n(43),u=n(6),c=n(1),l=n(8);function h(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function d(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}e.UserManagerSettings=function(t){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=n.popup_redirect_uri,r=n.popup_post_logout_redirect_uri,f=n.popupWindowFeatures,p=n.popupWindowTarget,v=n.silent_redirect_uri,g=n.silentRequestTimeout,m=n.automaticSilentRenew,w=void 0!==m&&m,b=n.validateSubOnSilentRenew,y=void 0!==b&&b,x=n.includeIdTokenInSilentRenew,k=void 0===x||x,E=n.monitorSession,S=void 0===E||E,F=n.monitorAnonymousSession,A=void 0!==F&&F,_=n.checkSessionInterval,j=void 0===_?2e3:_,C=n.stopCheckSessionOnError,R=void 0===C||C,I=n.query_status_response_type,T=n.revokeAccessTokenOnSignout,O=void 0!==T&&T,N=n.accessTokenExpiringNotificationTime,P=void 0===N?60:N,D=n.redirectNavigator,M=void 0===D?new o.RedirectNavigator:D,U=n.popupNavigator,L=void 0===U?new s.PopupNavigator:U,B=n.iframeNavigator,J=void 0===B?new a.IFrameNavigator:B,$=n.userStore,H=void 0===$?new u.WebStorageStateStore({store:c.Global.sessionStorage}):$;h(this,e);var K=d(this,t.call(this,arguments[0]));return K._popup_redirect_uri=i,K._popup_post_logout_redirect_uri=r,K._popupWindowFeatures=f,K._popupWindowTarget=p,K._silent_redirect_uri=v,K._silentRequestTimeout=g,K._automaticSilentRenew=w,K._validateSubOnSilentRenew=y,K._includeIdTokenInSilentRenew=k,K._accessTokenExpiringNotificationTime=P,K._monitorSession=S,K._monitorAnonymousSession=A,K._checkSessionInterval=j,K._stopCheckSessionOnError=R,K._query_status_response_type=I||(arguments[0]&&arguments[0].response_type?l.SigninRequest.isOidc(arguments[0].response_type)?"id_token":"code":"id_token"),K._revokeAccessTokenOnSignout=O,K._redirectNavigator=M,K._popupNavigator=L,K._iframeNavigator=J,K._userStore=H,K}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),i(e,[{key:"popup_redirect_uri",get:function(){return this._popup_redirect_uri}},{key:"popup_post_logout_redirect_uri",get:function(){return this._popup_post_logout_redirect_uri}},{key:"popupWindowFeatures",get:function(){return this._popupWindowFeatures}},{key:"popupWindowTarget",get:function(){return this._popupWindowTarget}},{key:"silent_redirect_uri",get:function(){return this._silent_redirect_uri}},{key:"silentRequestTimeout",get:function(){return this._silentRequestTimeout}},{key:"automaticSilentRenew",get:function(){return this._automaticSilentRenew}},{key:"validateSubOnSilentRenew",get:function(){return this._validateSubOnSilentRenew}},{key:"includeIdTokenInSilentRenew",get:function(){return this._includeIdTokenInSilentRenew}},{key:"accessTokenExpiringNotificationTime",get:function(){return this._accessTokenExpiringNotificationTime}},{key:"monitorSession",get:function(){return this._monitorSession}},{key:"monitorAnonymousSession",get:function(){return this._monitorAnonymousSession}},{key:"checkSessionInterval",get:function(){return this._checkSessionInterval}},{key:"stopCheckSessionOnError",get:function(){return this._stopCheckSessionOnError}},{key:"query_status_response_type",get:function(){return this._query_status_response_type}},{key:"revokeAccessTokenOnSignout",get:function(){return this._revokeAccessTokenOnSignout}},{key:"redirectNavigator",get:function(){return this._redirectNavigator}},{key:"popupNavigator",get:function(){return this._popupNavigator}},{key:"iframeNavigator",get:function(){return this._iframeNavigator}},{key:"userStore",get:function(){return this._userStore}}]),e}(r.OidcClientSettings)},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.RedirectNavigator=void 0;var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),r=n(0);e.RedirectNavigator=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return t.prototype.prepare=function(){return Promise.resolve(this)},t.prototype.navigate=function(t){return t&&t.url?(t.useReplaceToNavigate?window.location.replace(t.url):window.location=t.url,Promise.resolve()):(r.Log.error("RedirectNavigator.navigate: No url provided"),Promise.reject(new Error("No url provided")))},i(t,[{key:"url",get:function(){return window.location.href}}]),t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.PopupNavigator=void 0;var i=n(0),r=n(42);e.PopupNavigator=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return t.prototype.prepare=function(t){var e=new r.PopupWindow(t);return Promise.resolve(e)},t.prototype.callback=function(t,e,n){i.Log.debug("PopupNavigator.callback");try{return r.PopupWindow.notifyOpener(t,e,n),Promise.resolve()}catch(t){return Promise.reject(t)}},t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.PopupWindow=void 0;var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),r=n(0),o=n(3);e.PopupWindow=function(){function t(e){var n=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._promise=new Promise((function(t,e){n._resolve=t,n._reject=e})),this._popup=window.open("",e.popupWindowTarget||"_blank",e.popupWindowFeatures||"location=no,toolbar=no,width=500,height=500,left=100,top=100;"),this._popup&&(r.Log.debug("PopupWindow.ctor: popup successfully created"),this._checkForPopupClosedTimer=window.setInterval(this._checkForPopupClosed.bind(this),500))}return t.prototype.navigate=function(t){return this._popup?t&&t.url?(r.Log.debug("PopupWindow.navigate: Setting URL in popup"),this._id=t.id,this._id&&(window["popupCallback_"+t.id]=this._callback.bind(this)),this._popup.focus(),this._popup.window.location=t.url):(this._error("PopupWindow.navigate: no url provided"),this._error("No url provided")):this._error("PopupWindow.navigate: Error opening popup window"),this.promise},t.prototype._success=function(t){r.Log.debug("PopupWindow.callback: Successful response from popup window"),this._cleanup(),this._resolve(t)},t.prototype._error=function(t){r.Log.error("PopupWindow.error: ",t),this._cleanup(),this._reject(new Error(t))},t.prototype.close=function(){this._cleanup(!1)},t.prototype._cleanup=function(t){r.Log.debug("PopupWindow.cleanup"),window.clearInterval(this._checkForPopupClosedTimer),this._checkForPopupClosedTimer=null,delete window["popupCallback_"+this._id],this._popup&&!t&&this._popup.close(),this._popup=null},t.prototype._checkForPopupClosed=function(){this._popup&&!this._popup.closed||this._error("Popup window closed")},t.prototype._callback=function(t,e){this._cleanup(e),t?(r.Log.debug("PopupWindow.callback success"),this._success({url:t})):(r.Log.debug("PopupWindow.callback: Invalid response from popup"),this._error("Invalid response from popup"))},t.notifyOpener=function(t,e,n){if(window.opener){if(t=t||window.location.href){var i=o.UrlUtility.parseUrlFragment(t,n);if(i.state){var s=window.opener["popupCallback_"+i.state];s?(r.Log.debug("PopupWindow.notifyOpener: passing url message to opener"),s(t,e)):r.Log.warn("PopupWindow.notifyOpener: no matching callback found on opener")}else r.Log.warn("PopupWindow.notifyOpener: no state found in response url")}}else r.Log.warn("PopupWindow.notifyOpener: no window.opener. Can't complete notification.")},i(t,[{key:"promise",get:function(){return this._promise}}]),t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.IFrameNavigator=void 0;var i=n(0),r=n(44);e.IFrameNavigator=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return t.prototype.prepare=function(t){var e=new r.IFrameWindow(t);return Promise.resolve(e)},t.prototype.callback=function(t){i.Log.debug("IFrameNavigator.callback");try{return r.IFrameWindow.notifyParent(t),Promise.resolve()}catch(t){return Promise.reject(t)}},t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.IFrameWindow=void 0;var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),r=n(0);e.IFrameWindow=function(){function t(){var e=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._promise=new Promise((function(t,n){e._resolve=t,e._reject=n})),this._boundMessageEvent=this._message.bind(this),window.addEventListener("message",this._boundMessageEvent,!1),this._frame=window.document.createElement("iframe"),this._frame.style.visibility="hidden",this._frame.style.position="absolute",this._frame.width=0,this._frame.height=0,window.document.body.appendChild(this._frame)}return t.prototype.navigate=function(t){if(t&&t.url){var e=t.silentRequestTimeout||1e4;r.Log.debug("IFrameWindow.navigate: Using timeout of:",e),this._timer=window.setTimeout(this._timeout.bind(this),e),this._frame.src=t.url}else this._error("No url provided");return this.promise},t.prototype._success=function(t){this._cleanup(),r.Log.debug("IFrameWindow: Successful response from frame window"),this._resolve(t)},t.prototype._error=function(t){this._cleanup(),r.Log.error(t),this._reject(new Error(t))},t.prototype.close=function(){this._cleanup()},t.prototype._cleanup=function(){this._frame&&(r.Log.debug("IFrameWindow: cleanup"),window.removeEventListener("message",this._boundMessageEvent,!1),window.clearTimeout(this._timer),window.document.body.removeChild(this._frame),this._timer=null,this._frame=null,this._boundMessageEvent=null)},t.prototype._timeout=function(){r.Log.debug("IFrameWindow.timeout"),this._error("Frame window timed out")},t.prototype._message=function(t){if(r.Log.debug("IFrameWindow.message"),this._timer&&t.origin===this._origin&&t.source===this._frame.contentWindow&&"string"==typeof t.data&&(t.data.startsWith("http://")||t.data.startsWith("https://"))){var e=t.data;e?this._success({url:e}):this._error("Invalid response from frame")}},t.notifyParent=function(t){r.Log.debug("IFrameWindow.notifyParent"),(t=t||window.location.href)&&(r.Log.debug("IFrameWindow.notifyParent: posting url message to parent"),window.parent.postMessage(t,location.protocol+"//"+location.host))},i(t,[{key:"promise",get:function(){return this._promise}},{key:"_origin",get:function(){return location.protocol+"//"+location.host}}]),t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.UserManagerEvents=void 0;var i=n(0),r=n(16),o=n(17);e.UserManagerEvents=function(t){function e(n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var i=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}(this,t.call(this,n));return i._userLoaded=new o.Event("User loaded"),i._userUnloaded=new o.Event("User unloaded"),i._silentRenewError=new o.Event("Silent renew error"),i._userSignedIn=new o.Event("User signed in"),i._userSignedOut=new o.Event("User signed out"),i._userSessionChanged=new o.Event("User session changed"),i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.load=function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];i.Log.debug("UserManagerEvents.load"),t.prototype.load.call(this,e),n&&this._userLoaded.raise(e)},e.prototype.unload=function(){i.Log.debug("UserManagerEvents.unload"),t.prototype.unload.call(this),this._userUnloaded.raise()},e.prototype.addUserLoaded=function(t){this._userLoaded.addHandler(t)},e.prototype.removeUserLoaded=function(t){this._userLoaded.removeHandler(t)},e.prototype.addUserUnloaded=function(t){this._userUnloaded.addHandler(t)},e.prototype.removeUserUnloaded=function(t){this._userUnloaded.removeHandler(t)},e.prototype.addSilentRenewError=function(t){this._silentRenewError.addHandler(t)},e.prototype.removeSilentRenewError=function(t){this._silentRenewError.removeHandler(t)},e.prototype._raiseSilentRenewError=function(t){i.Log.debug("UserManagerEvents._raiseSilentRenewError",t.message),this._silentRenewError.raise(t)},e.prototype.addUserSignedIn=function(t){this._userSignedIn.addHandler(t)},e.prototype.removeUserSignedIn=function(t){this._userSignedIn.removeHandler(t)},e.prototype._raiseUserSignedIn=function(){i.Log.debug("UserManagerEvents._raiseUserSignedIn"),this._userSignedIn.raise()},e.prototype.addUserSignedOut=function(t){this._userSignedOut.addHandler(t)},e.prototype.removeUserSignedOut=function(t){this._userSignedOut.removeHandler(t)},e.prototype._raiseUserSignedOut=function(){i.Log.debug("UserManagerEvents._raiseUserSignedOut"),this._userSignedOut.raise()},e.prototype.addUserSessionChanged=function(t){this._userSessionChanged.addHandler(t)},e.prototype.removeUserSessionChanged=function(t){this._userSessionChanged.removeHandler(t)},e.prototype._raiseUserSessionChanged=function(){i.Log.debug("UserManagerEvents._raiseUserSessionChanged"),this._userSessionChanged.raise()},e}(r.AccessTokenEvents)},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.Timer=void 0;var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),r=n(0),o=n(1),s=n(17);function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}e.Timer=function(t){function e(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o.Global.timer,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;a(this,e);var s=u(this,t.call(this,n));return s._timer=i,s._nowFunc=r||function(){return Date.now()/1e3},s}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.init=function(t){t<=0&&(t=1),t=parseInt(t);var e=this.now+t;if(this.expiration===e&&this._timerHandle)r.Log.debug("Timer.init timer "+this._name+" skipping initialization since already initialized for expiration:",this.expiration);else{this.cancel(),r.Log.debug("Timer.init timer "+this._name+" for duration:",t),this._expiration=e;var n=5;t<n&&(n=t),this._timerHandle=this._timer.setInterval(this._callback.bind(this),1e3*n)}},e.prototype.cancel=function(){this._timerHandle&&(r.Log.debug("Timer.cancel: ",this._name),this._timer.clearInterval(this._timerHandle),this._timerHandle=null)},e.prototype._callback=function(){r.Log.debug("Timer.callback; "+this._name+" timer expires in:",this._expiration-this.now),this._expiration<=this.now&&(this.cancel(),t.prototype.raise.call(this))},i(e,[{key:"now",get:function(){return parseInt(this._nowFunc())}},{key:"expiration",get:function(){return this._expiration}}]),e}(s.Event)},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.SilentRenewService=void 0;var i=n(0);e.SilentRenewService=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._userManager=e}return t.prototype.start=function(){this._callback||(this._callback=this._tokenExpiring.bind(this),this._userManager.events.addAccessTokenExpiring(this._callback),this._userManager.getUser().then((function(){})).catch((function(t){i.Log.error("SilentRenewService.start: Error from getUser:",t.message)})))},t.prototype.stop=function(){this._callback&&(this._userManager.events.removeAccessTokenExpiring(this._callback),delete this._callback)},t.prototype._tokenExpiring=function(){var t=this;this._userManager.signinSilent().then((function(){i.Log.debug("SilentRenewService._tokenExpiring: Silent token renewal successful")}),(function(e){i.Log.error("SilentRenewService._tokenExpiring: Error from signinSilent:",e.message),t._userManager.events._raiseSilentRenewError(e)}))},t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.CordovaPopupNavigator=void 0;var i=n(21);e.CordovaPopupNavigator=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return t.prototype.prepare=function(t){var e=new i.CordovaPopupWindow(t);return Promise.resolve(e)},t}()},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0}),e.CordovaIFrameNavigator=void 0;var i=n(21);e.CordovaIFrameNavigator=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return t.prototype.prepare=function(t){t.popupWindowFeatures="hidden=yes";var e=new i.CordovaPopupWindow(t);return Promise.resolve(e)},t}()},function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Version="1.11.6"}])}))}}),Fs=Jt({"../node_modules/@inrupt/oidc-client-ext/dist/index.js"(t){Object.defineProperty(t,"__esModule",{value:!0});var e=Ss(),n=ks();function i(t){return void 0!==t.error_description&&"string"==typeof t.error_description}function r(t,e){if(void 0!==(r=t).error&&"string"==typeof r.error)throw new n.OidcProviderError(`Token endpoint returned error [${t.error}]${i(t)?`: ${t.error_description}`:""}${function(t){return void 0!==t.error_uri&&"string"==typeof t.error_uri}(t)?` (see ${t.error_uri})`:""}`,t.error,i(t)?t.error_description:void 0);var r;if(!function(t){return void 0!==t.access_token&&"string"==typeof t.access_token}(t))throw new n.InvalidResponseError(["access_token"]);if(!function(t){return void 0!==t.id_token&&"string"==typeof t.id_token}(t))throw new n.InvalidResponseError(["id_token"]);if(!function(t){return void 0!==t.token_type&&"string"==typeof t.token_type}(t))throw new n.InvalidResponseError(["token_type"]);if(!function(t){return void 0===t.expires_in||"number"==typeof t.expires_in}(t))throw new n.InvalidResponseError(["expires_in"]);if(!e&&"bearer"!==t.token_type.toLowerCase())throw new Error(`Invalid token endpoint response: requested a [Bearer] token, but got a 'token_type' value of [${t.token_type}].`);return t}Object.defineProperty(t,"CordovaIFrameNavigator",{enumerable:!0,get:function(){return e.CordovaIFrameNavigator}}),Object.defineProperty(t,"CordovaPopupNavigator",{enumerable:!0,get:function(){return e.CordovaPopupNavigator}}),Object.defineProperty(t,"InMemoryWebStorage",{enumerable:!0,get:function(){return e.InMemoryWebStorage}}),Object.defineProperty(t,"Log",{enumerable:!0,get:function(){return e.Log}}),Object.defineProperty(t,"OidcClient",{enumerable:!0,get:function(){return e.OidcClient}}),Object.defineProperty(t,"SessionMonitor",{enumerable:!0,get:function(){return e.SessionMonitor}}),Object.defineProperty(t,"User",{enumerable:!0,get:function(){return e.User}}),Object.defineProperty(t,"UserManager",{enumerable:!0,get:function(){return e.UserManager}}),Object.defineProperty(t,"Version",{enumerable:!0,get:function(){return e.Version}}),Object.defineProperty(t,"WebStorageStateStore",{enumerable:!0,get:function(){return e.WebStorageStateStore}}),t.clearOidcPersistentStorage=async function(){const t=new e.OidcClient({response_mode:"query"});await t.clearStaleState(new e.WebStorageStateStore({}));const n=window.localStorage,i=[];for(let t=0;t<=n.length;t+=1){const e=n.key(t);e&&(e.match(/^oidc\..+$/)||e.match(/^solidClientAuthenticationUser:.+$/))&&i.push(e)}i.forEach((t=>n.removeItem(t)))},t.getBearerToken=async function(t){let i;try{const r=new e.OidcClient({response_mode:"query",loadUserInfo:!1});if(i=await r.processSigninResponse(t),void 0===r.settings.metadata)throw new Error("Cannot retrieve issuer metadata from client information in storage.");if(void 0===r.settings.metadata.jwks_uri)throw new Error("Missing some issuer metadata from client information in storage: 'jwks_uri' is undefined");if(void 0===r.settings.metadata.issuer)throw new Error("Missing some issuer metadata from client information in storage: 'issuer' is undefined");if(void 0===r.settings.client_id)throw new Error("Missing some client information in storage: 'client_id' is undefined");const o=await n.getWebidFromTokenPayload(i.id_token,r.settings.metadata.jwks_uri,r.settings.metadata.issuer,r.settings.client_id);return{accessToken:i.access_token,idToken:i.id_token,webId:o,refreshToken:i.refresh_token}}catch(e){throw new Error(`Problem handling Auth Code Grant (Flow) redirect - URL [${t}]: ${e}`)}},t.getDpopToken=async function(t,e,i){return async function(t,e,i,o){!function(t,e){if(e.grantType&&(!t.grantTypesSupported||!t.grantTypesSupported.includes(e.grantType)))throw new Error(`The issuer [${t.issuer}] does not support the [${e.grantType}] grant`);if(!t.tokenEndpoint)throw new Error(`This issuer [${t.issuer}] does not have a token endpoint`)}(t,i);const s={"content-type":"application/x-www-form-urlencoded"};let a;o&&(a=await n.generateDpopKeyPair(),s.DPoP=await n.createDpopHeader(t.tokenEndpoint,"POST",a)),e.clientSecret&&(s.Authorization=`Basic ${btoa(`${e.clientId}:${e.clientSecret}`)}`);const u={method:"POST",headers:s,body:new URLSearchParams({grant_type:i.grantType,redirect_uri:i.redirectUrl,code:i.code,code_verifier:i.codeVerifier,client_id:e.clientId}).toString()},c=await await fetch(t.tokenEndpoint,u),l=r(await c.json(),o),h=await n.getWebidFromTokenPayload(l.id_token,t.jwksUri,t.issuer,e.clientId);return{accessToken:l.access_token,idToken:l.id_token,refreshToken:(d=l,void 0!==d.refresh_token&&"string"==typeof d.refresh_token?l.refresh_token:void 0),webId:h,dpopKey:a,expiresIn:l.expires_in};var d}(t,e,i,!0)},t.refresh=async function(t,e,i,o){if(void 0===i.clientId)throw new Error("No client ID available when trying to refresh the access token.");const s={grant_type:"refresh_token",refresh_token:t,scope:n.DEFAULT_SCOPES};let a={};void 0!==o&&(a={DPoP:await n.createDpopHeader(e.tokenEndpoint,"POST",o)});let u={};void 0!==i.clientSecret?u={Authorization:`Basic ${btoa(`${i.clientId}:${i.clientSecret}`)}`}:(t=>{try{return new URL(t),!0}catch(t){return!1}})(i.clientId)&&(s.client_id=i.clientId);const c=await fetch(e.tokenEndpoint,{method:"POST",body:new URLSearchParams(s).toString(),headers:{...a,...u,"Content-Type":"application/x-www-form-urlencoded"}});let l;try{l=await c.json()}catch(t){throw new Error(`The token endpoint of issuer ${e.issuer} returned a malformed response.`)}const h=r(l,void 0!==o),d=await n.getWebidFromTokenPayload(h.id_token,e.jwksUri,e.issuer,i.clientId);return{accessToken:h.access_token,idToken:h.id_token,refreshToken:"string"==typeof h.refresh_token?h.refresh_token:void 0,webId:d,dpopKey:o,expiresIn:h.expires_in}},t.registerClient=async function(t,e){var i;if(!e.registrationEndpoint)throw new Error("Dynamic Registration could not be completed because the issuer has no registration endpoint.");if(!Array.isArray(e.idTokenSigningAlgValuesSupported))throw new Error("The OIDC issuer discovery profile is missing the 'id_token_signing_alg_values_supported' value, which is mandatory.");const r=n.determineSigningAlg(e.idTokenSigningAlgValuesSupported,n.PREFERRED_SIGNING_ALG),o={client_name:t.clientName,application_type:"web",redirect_uris:[null===(i=t.redirectUrl)||void 0===i?void 0:i.toString()],subject_type:"public",token_endpoint_auth_method:"client_secret_basic",id_token_signed_response_alg:r,grant_types:["authorization_code","refresh_token"]},s=await fetch(e.registrationEndpoint.toString(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(s.ok){const e=await s.json();return function(t,e){if(void 0===t.client_id)throw new Error(`Dynamic client registration failed: no client_id has been found on ${JSON.stringify(t)}`);if(e.redirectUrl&&(void 0===t.redirect_uris||t.redirect_uris[0]!==e.redirectUrl.toString()))throw new Error(`Dynamic client registration failed: the returned redirect URIs ${JSON.stringify(t.redirect_uris)} don't match the provided ${JSON.stringify([e.redirectUrl.toString()])}`)}(e,t),{clientId:e.client_id,clientSecret:e.client_secret,idTokenSignedResponseAlg:e.id_token_signed_response_alg,clientType:"dynamic"}}throw 400===s.status&&function(t,e){var n,i,r,o;if("invalid_redirect_uri"===t.error)throw new Error(`Dynamic client registration failed: the provided redirect uri [${null===(n=e.redirectUrl)||void 0===n?void 0:n.toString()}] is invalid - ${null!==(i=t.error_description)&&void 0!==i?i:""}`);if("invalid_client_metadata"===t.error)throw new Error(`Dynamic client registration failed: the provided client metadata ${JSON.stringify(e)} is invalid - ${null!==(r=t.error_description)&&void 0!==r?r:""}`);throw new Error(`Dynamic client registration failed: ${t.error} - ${null!==(o=t.error_description)&&void 0!==o?o:""}`)}(await s.json(),t),new Error(`Dynamic client registration failed: the server returned ${s.status} ${s.statusText} - ${await s.text()}`)},t.removeOidcQueryParam=function(t){const e=new URL(t);return e.searchParams.delete("code"),e.searchParams.delete("state"),e.hash="",e.toString()}}}),As=Jt({"../node_modules/@inrupt/solid-client-authn-browser/dist/ClientAuthentication.js"(t){Object.defineProperty(t,"__esModule",{value:!0});var e=ks(),n=Fs(),i=(t,e)=>window.fetch(t,e);t.default=class{constructor(t,r,o,s,a){this.loginHandler=t,this.redirectHandler=r,this.logoutHandler=o,this.sessionInfoManager=s,this.issuerConfigFetcher=a,this.login=async(t,e)=>{var i,r;await this.sessionInfoManager.clear(t.sessionId);const o=(0,n.removeOidcQueryParam)(null!==(i=t.redirectUrl)&&void 0!==i?i:window.location.href);await this.loginHandler.handle({...t,redirectUrl:o,clientName:null!==(r=t.clientName)&&void 0!==r?r:t.clientId,eventEmitter:e})},this.fetch=i,this.logout=async t=>{await this.logoutHandler.handle(t),this.fetch=i},this.getSessionInfo=async t=>this.sessionInfoManager.get(t),this.getAllSessionInfo=async()=>this.sessionInfoManager.getAll(),this.validateCurrentSession=async t=>{const e=await this.sessionInfoManager.get(t);return void 0===e||void 0===e.clientAppId||void 0===e.issuer?null:e},this.handleIncomingRedirect=async(t,n)=>{try{const e=await this.redirectHandler.handle(t,n);return this.fetch=e.fetch.bind(window),this.cleanUrlAfterRedirect(t),{isLoggedIn:e.isLoggedIn,webId:e.webId,sessionId:e.sessionId,expirationDate:e.expirationDate}}catch(i){return this.cleanUrlAfterRedirect(t),void n.emit(e.EVENTS.ERROR,"redirect",i)}}}cleanUrlAfterRedirect(t){const e=new URL(t);e.searchParams.delete("state"),e.searchParams.delete("code"),e.searchParams.delete("id_token"),e.searchParams.delete("access_token"),e.searchParams.delete("error"),e.searchParams.delete("error_description"),window.history.replaceState(null,"",e.toString())}}}}),_s=Jt({"../node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/OidcLoginHandler.js"(t){Object.defineProperty(t,"__esModule",{value:!0});var e=ks();function n(t){return"string"==typeof t.oidcIssuer}function i(t){return"string"==typeof t.redirectUrl}t.default=class{constructor(t,e,n,i){this.storageUtility=t,this.oidcHandler=e,this.issuerConfigFetcher=n,this.clientRegistrar=i}async canHandle(t){return n(t)&&i(t)}async handle(t){if(!n(t))throw new e.ConfigurationError(`OidcLoginHandler requires an OIDC issuer: missing property 'oidcIssuer' in ${JSON.stringify(t)}`);if(!i(t))throw new e.ConfigurationError(`OidcLoginHandler requires a redirect URL: missing property 'redirectUrl' in ${JSON.stringify(t)}`);const r=await this.issuerConfigFetcher.fetchConfig(t.oidcIssuer),o=await(0,e.handleRegistration)(t,r,this.storageUtility,this.clientRegistrar),s={issuer:r.issuer,dpop:"dpop"===t.tokenType.toLowerCase(),...t,issuerConfiguration:r,client:o};return this.oidcHandler.handle(s)}}}}),js=Jt({"../node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/oidcHandlers/AuthorizationCodeWithPkceOidcHandler.js"(t){Object.defineProperty(t,"__esModule",{value:!0});var e=ks(),n=Fs();t.default=class{constructor(t,e){this.storageUtility=t,this.redirector=e}async canHandle(t){return!!(t.issuerConfiguration.grantTypesSupported&&t.issuerConfiguration.grantTypesSupported.indexOf("authorization_code")>-1)}async handle(t){var i;const r={authority:t.issuer.toString(),client_id:t.client.clientId,client_secret:t.client.clientSecret,redirect_uri:t.redirectUrl.toString(),post_logout_redirect_uri:t.redirectUrl.toString(),response_type:"code",scope:e.DEFAULT_SCOPES,filterProtocolClaims:!0,loadUserInfo:!1,code_verifier:!0,prompt:null!==(i=t.prompt)&&void 0!==i?i:"consent"},o=new n.OidcClient(r),{redirector:s}=this,a=this.storageUtility;try{const e=await o.createSigninRequest();await Promise.all([a.setForUser(e.state._id,{sessionId:t.sessionId}),a.setForUser(t.sessionId,{codeVerifier:e.state._code_verifier,issuer:t.issuer.toString(),redirectUrl:t.redirectUrl,dpop:t.dpop?"true":"false"})]),s.redirect(e.url.toString(),{handleRedirect:t.handleRedirect})}catch(t){console.error(t)}}}}}),Cs=Jt({"../node_modules/@inrupt/solid-client-authn-browser/dist/util/urlPath.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.appendToUrlPathname=void 0,t.appendToUrlPathname=function(t,e){const n=new URL(t),i=n.pathname;return n.pathname=`${i}${i.endsWith("/")?"":"/"}${e.startsWith("/")?e.substring(1):e}`,n.toString()}}}),Rs=Jt({"../node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/IssuerConfigFetcher.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.WELL_KNOWN_OPENID_CONFIG=void 0;var e=ks(),n=Cs();t.WELL_KNOWN_OPENID_CONFIG=".well-known/openid-configuration";var i={issuer:{toKey:"issuer",convertToUrl:!0},authorization_endpoint:{toKey:"authorizationEndpoint",convertToUrl:!0},token_endpoint:{toKey:"tokenEndpoint",convertToUrl:!0},userinfo_endpoint:{toKey:"userinfoEndpoint",convertToUrl:!0},jwks_uri:{toKey:"jwksUri",convertToUrl:!0},registration_endpoint:{toKey:"registrationEndpoint",convertToUrl:!0},scopes_supported:{toKey:"scopesSupported"},response_types_supported:{toKey:"responseTypesSupported"},response_modes_supported:{toKey:"responseModesSupported"},grant_types_supported:{toKey:"grantTypesSupported"},acr_values_supported:{toKey:"acrValuesSupported"},subject_types_supported:{toKey:"subjectTypesSupported"},id_token_signing_alg_values_supported:{toKey:"idTokenSigningAlgValuesSupported"},id_token_encryption_alg_values_supported:{toKey:"idTokenEncryptionAlgValuesSupported"},id_token_encryption_enc_values_supported:{toKey:"idTokenEncryptionEncValuesSupported"},userinfo_signing_alg_values_supported:{toKey:"userinfoSigningAlgValuesSupported"},userinfo_encryption_alg_values_supported:{toKey:"userinfoEncryptionAlgValuesSupported"},userinfo_encryption_enc_values_supported:{toKey:"userinfoEncryptionEncValuesSupported"},request_object_signing_alg_values_supported:{toKey:"requestObjectSigningAlgValuesSupported"},request_object_encryption_alg_values_supported:{toKey:"requestObjectEncryptionAlgValuesSupported"},request_object_encryption_enc_values_supported:{toKey:"requestObjectEncryptionEncValuesSupported"},token_endpoint_auth_methods_supported:{toKey:"tokenEndpointAuthMethodsSupported"},token_endpoint_auth_signing_alg_values_supported:{toKey:"tokenEndpointAuthSigningAlgValuesSupported"},display_values_supported:{toKey:"displayValuesSupported"},claim_types_supported:{toKey:"claimTypesSupported"},claims_supported:{toKey:"claimsSupported"},service_documentation:{toKey:"serviceDocumentation"},claims_locales_supported:{toKey:"claimsLocalesSupported"},ui_locales_supported:{toKey:"uiLocalesSupported"},claims_parameter_supported:{toKey:"claimsParameterSupported"},request_parameter_supported:{toKey:"requestParameterSupported"},request_uri_parameter_supported:{toKey:"requestUriParameterSupported"},require_request_uri_registration:{toKey:"requireRequestUriRegistration"},op_policy_uri:{toKey:"opPolicyUri",convertToUrl:!0},op_tos_uri:{toKey:"opTosUri",convertToUrl:!0}},r=class{constructor(t){this.storageUtility=t}static getLocalStorageKey(t){return`issuerConfig:${t}`}async fetchConfig(o){let s;const a=(0,n.appendToUrlPathname)(o,t.WELL_KNOWN_OPENID_CONFIG),u=await window.fetch(a);try{s=function(t){const e={};return Object.keys(t).forEach((n=>{i[n]&&(e[i[n].toKey]=t[n])})),Array.isArray(e.scopesSupported)||(e.scopesSupported=["openid"]),e}(await u.json())}catch(t){throw new e.ConfigurationError(`[${o.toString()}] has an invalid configuration: ${t.message}`)}return await this.storageUtility.set(r.getLocalStorageKey(o),JSON.stringify(s)),s}};t.default=r}}),Is=Jt({"../node_modules/@inrupt/solid-client-authn-browser/dist/sessionInfo/SessionInfoManager.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.SessionInfoManager=t.clear=t.getUnauthenticatedSession=void 0;var e=ks(),n=(ws(),zt(ms)),i=Fs();async function r(t,e){await Promise.all([e.deleteAllUserData(t,{secure:!1}),e.deleteAllUserData(t,{secure:!0}),e.delete("clientKey",{secure:!1})]),await(0,i.clearOidcPersistentStorage)()}t.getUnauthenticatedSession=function(){return{isLoggedIn:!1,sessionId:(0,n.v4)(),fetch}},t.clear=r,t.SessionInfoManager=class{constructor(t){this.storageUtility=t}update(t,e){throw new Error("Not Implemented")}async get(t){var n;const i=await this.storageUtility.getForUser(t,"isLoggedIn",{secure:!0}),r=await this.storageUtility.getForUser(t,"webId",{secure:!0}),o=await this.storageUtility.getForUser(t,"clientId",{secure:!1}),s=await this.storageUtility.getForUser(t,"clientSecret",{secure:!1}),a=await this.storageUtility.getForUser(t,"redirectUrl",{secure:!1}),u=await this.storageUtility.getForUser(t,"refreshToken",{secure:!0}),c=await this.storageUtility.getForUser(t,"issuer",{secure:!1}),l=null!==(n=await this.storageUtility.getForUser(t,"tokenType",{secure:!1}))&&void 0!==n?n:"DPoP";if(!(0,e.isSupportedTokenType)(l))throw new Error(`Tokens of type [${l}] are not supported.`);if(void 0!==o||void 0!==i||void 0!==r||void 0!==u)return{sessionId:t,webId:r,isLoggedIn:"true"===i,redirectUrl:a,refreshToken:u,issuer:c,clientAppId:o,clientAppSecret:s,tokenType:l}}async getAll(){throw new Error("Not implemented")}async clear(t){return r(t,this.storageUtility)}async register(t){throw new Error("Not implemented")}async getRegisteredSessionIdAll(){throw new Error("Not implemented")}async clearAll(){throw new Error("Not implemented")}}}}),Ts=Jt({"../node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/incomingRedirectHandler/FallbackRedirectHandler.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.FallbackRedirectHandler=void 0;var e=Is();t.FallbackRedirectHandler=class{async canHandle(t){try{return new URL(t),!0}catch(e){throw new Error(`[${t}] is not a valid URL, and cannot be used as a redirect URL: ${e}`)}}async handle(t){return(0,e.getUnauthenticatedSession)()}}}}),Os=Jt({"../node_modules/@inrupt/solid-client-authn-browser/dist/logout/GeneralLogoutHandler.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{constructor(t){this.sessionInfoManager=t}async canHandle(){return!0}async handle(t){await this.sessionInfoManager.clear(t)}}}}),Ns=Jt({"../node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/incomingRedirectHandler/AuthCodeRedirectHandler.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.AuthCodeRedirectHandler=void 0;var e=ks(),n=Fs();t.AuthCodeRedirectHandler=class{constructor(t,e,n,i,r){this.storageUtility=t,this.sessionInfoManager=e,this.issuerConfigFetcher=n,this.clientRegistrar=i,this.tokerRefresher=r}async canHandle(t){try{const e=new URL(t);return null!==e.searchParams.get("code")&&null!==e.searchParams.get("state")}catch(e){throw new Error(`[${t}] is not a valid URL, and cannot be used as a redirect URL: ${e}`)}}async handle(t,i){if(!await this.canHandle(t))throw new Error(`AuthCodeRedirectHandler cannot handle [${t}]: it is missing one of [code, state].`);const r=new URL(t),o=r.searchParams.get("state"),s=await this.storageUtility.getForUser(o,"sessionId",{errorIfNull:!0}),{issuerConfig:a,codeVerifier:u,redirectUrl:c,dpop:l}=await(0,e.loadOidcContextFromStorage)(s,this.storageUtility,this.issuerConfigFetcher);if(void 0===u)throw new Error(`The code verifier for session ${s} is missing from storage.`);if(void 0===c)throw new Error(`The redirect URL for session ${s} is missing from storage.`);const h=await this.clientRegistrar.getClient({sessionId:s},a);let d;const f=Date.now();let p;l?(d=await(0,n.getDpopToken)(a,h,{grantType:"authorization_code",code:r.searchParams.get("code"),codeVerifier:u,redirectUrl:c}),window.localStorage.removeItem(`oidc.${o}`)):d=await(0,n.getBearerToken)(r.toString()),void 0!==d.refreshToken&&(p={sessionId:s,refreshToken:d.refreshToken,tokenRefresher:this.tokerRefresher});const v=await(0,e.buildAuthenticatedFetch)(fetch,d.accessToken,{dpopKey:d.dpopKey,refreshOptions:p,eventEmitter:i,expiresIn:d.expiresIn});await this.storageUtility.setForUser(s,{webId:d.webId,isLoggedIn:"true"},{secure:!0}),r.searchParams.delete("code"),await this.storageUtility.setForUser(s,{redirectUrl:r.toString()},{secure:!1});const g=await this.sessionInfoManager.get(s);if(!g)throw new Error(`Could not retrieve session: [${s}].`);return Object.assign(g,{fetch:v,expirationDate:"number"==typeof d.expiresIn?f+1e3*d.expiresIn:null})}}}}),Ps=Jt({"../node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/AggregateRedirectHandler.js"(t){Object.defineProperty(t,"__esModule",{value:!0});var e=ks();t.default=class extends e.AggregateHandler{constructor(t){super(t)}}}}),Ds=Jt({"../node_modules/@inrupt/solid-client-authn-browser/dist/storage/BrowserStorage.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{get storage(){return window.localStorage}async get(t){return this.storage.getItem(t)||void 0}async set(t,e){this.storage.setItem(t,e)}async delete(t){this.storage.removeItem(t)}}}}),Ms=Jt({"../node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/Redirector.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=class{redirect(t,e){e&&e.handleRedirect?e.handleRedirect(t):e&&e.redirectByReplacingState?window.history.replaceState({},"",t):window.location.href=t}}}}),Us=Jt({"../node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/ClientRegistrar.js"(t){Object.defineProperty(t,"__esModule",{value:!0});var e=Fs();t.default=class{constructor(t){this.storageUtility=t}async getClient(t,n){const[i,r]=await Promise.all([this.storageUtility.getForUser(t.sessionId,"clientId",{secure:!1}),this.storageUtility.getForUser(t.sessionId,"clientSecret",{secure:!1})]);if(i)return{clientId:i,clientSecret:r,clientType:"dynamic"};try{const i=await(0,e.registerClient)(t,n),r={clientId:i.clientId};return i.clientSecret&&(r.clientSecret=i.clientSecret),i.idTokenSignedResponseAlg&&(r.idTokenSignedResponseAlg=i.idTokenSignedResponseAlg),await this.storageUtility.setForUser(t.sessionId,r,{secure:!1}),i}catch(t){throw new Error(`Client registration failed: [${t}]`)}}}}}),Ls=Jt({"../node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/incomingRedirectHandler/ErrorOidcHandler.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorOidcHandler=void 0;var e=ks(),n=Is();t.ErrorOidcHandler=class{async canHandle(t){try{return new URL(t).searchParams.has("error")}catch(e){throw new Error(`[${t}] is not a valid URL, and cannot be used as a redirect URL: ${e}`)}}async handle(t,i){if(void 0!==i){const n=new URL(t),r=n.searchParams.get("error"),o=n.searchParams.get("error_description");i.emit(e.EVENTS.ERROR,r,o)}return(0,n.getUnauthenticatedSession)()}}}}),Bs=Jt({"../node_modules/@inrupt/solid-client-authn-browser/dist/login/oidc/refresh/TokenRefresher.js"(t){Object.defineProperty(t,"__esModule",{value:!0});var e=ks(),n=Fs();t.default=class{constructor(t,e,n){this.storageUtility=t,this.issuerConfigFetcher=e,this.clientRegistrar=n}async refresh(t,i,r,o){const s=await(0,e.loadOidcContextFromStorage)(t,this.storageUtility,this.issuerConfigFetcher),a=await this.clientRegistrar.getClient({sessionId:t},s.issuerConfig);if(void 0===i)throw new Error(`Session [${t}] has no refresh token to allow it to refresh its access token.`);if(s.dpop&&void 0===r)throw new Error(`For session [${t}], the key bound to the DPoP access token must be provided to refresh said access token.`);const u=await(0,n.refresh)(i,s.issuerConfig,a,r);return void 0!==u.refreshToken&&(null==o||o.emit(e.EVENTS.NEW_REFRESH_TOKEN,u.refreshToken),await this.storageUtility.setForUser(t,{refreshToken:u.refreshToken})),u}}}}),Js=Jt({"../node_modules/@inrupt/solid-client-authn-browser/dist/dependencies.js"(t){var e=t&&t.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(t,"__esModule",{value:!0}),t.getClientAuthenticationWithDependencies=void 0;var n=ks(),i=e(Es()),r=e(As()),o=e(_s()),s=e(js()),a=e(Rs()),u=Ts(),c=e(Os()),l=Is(),h=Ns(),d=e(Ps()),f=e(Ds()),p=e(Ms()),v=e(Us()),g=Ls(),m=e(Bs());t.getClientAuthenticationWithDependencies=function(t){const e=new n.InMemoryStorage,w=t.secureStorage||e,b=t.insecureStorage||new f.default,y=new i.default(w,b),x=new a.default(y),k=new v.default(y),E=new l.SessionInfoManager(y),S=new m.default(y,x,k),F=new o.default(y,new s.default(y,new p.default),x,k),A=new d.default([new g.ErrorOidcHandler,new h.AuthCodeRedirectHandler(y,E,x,k,S),new u.FallbackRedirectHandler]);return new r.default(F,A,new c.default(E),E,x)}}}),$s=Jt({"../node_modules/@inrupt/solid-client-authn-browser/dist/constant.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.KEY_CURRENT_URL=t.KEY_CURRENT_SESSION=void 0;var e=ks();t.KEY_CURRENT_SESSION=`${e.SOLID_CLIENT_AUTHN_KEY_PREFIX}currentSession`,t.KEY_CURRENT_URL=`${e.SOLID_CLIENT_AUTHN_KEY_PREFIX}currentUrl`}}),Hs=Jt({"../node_modules/@inrupt/solid-client-authn-browser/dist/Session.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Session=t.silentlyAuthenticate=void 0;var e=qt(),n=ks(),i=(ws(),zt(ms)),r=Js(),o=$s();async function s(t,e,n){var i;const r=await e.validateCurrentSession(t);return null!==r&&(window.localStorage.setItem(o.KEY_CURRENT_URL,window.location.href),await e.login({sessionId:t,prompt:"none",oidcIssuer:r.issuer,redirectUrl:r.redirectUrl,clientId:r.clientAppId,clientSecret:r.clientAppSecret,tokenType:null!==(i=r.tokenType)&&void 0!==i?i:"DPoP"},n),!0)}t.silentlyAuthenticate=s,t.Session=class extends e.EventEmitter{constructor(t={},e){super(),this.tokenRequestInProgress=!1,this.login=async t=>{var e;return await this.clientAuthentication.login({sessionId:this.info.sessionId,...t,tokenType:null!==(e=t.tokenType)&&void 0!==e?e:"DPoP"},this),new Promise((()=>{}))},this.fetch=async(t,e)=>this.clientAuthentication.fetch(t,e),this.internalLogout=async t=>{window.localStorage.removeItem(o.KEY_CURRENT_SESSION),await this.clientAuthentication.logout(this.info.sessionId),this.info.isLoggedIn=!1,t&&this.emit(n.EVENTS.LOGOUT)},this.logout=async()=>this.internalLogout(!0),this.handleIncomingRedirect=async(t={})=>{var e;if(this.info.isLoggedIn)return this.info;if(this.tokenRequestInProgress)return;const i="string"==typeof t?{url:t}:t,r=null!==(e=i.url)&&void 0!==e?e:window.location.href;this.tokenRequestInProgress=!0;const a=await this.clientAuthentication.handleIncomingRedirect(r,this);if(function(t){return!!(null==t?void 0:t.isLoggedIn)}(a)){this.setSessionInfo(a);const t=window.localStorage.getItem(o.KEY_CURRENT_URL);null===t?this.emit(n.EVENTS.LOGIN):(window.localStorage.removeItem(o.KEY_CURRENT_URL),this.emit(n.EVENTS.SESSION_RESTORED,t))}else if(!0===i.restorePreviousSession){const t=window.localStorage.getItem(o.KEY_CURRENT_SESSION);if(null!==t&&await s(t,this.clientAuthentication,this))return new Promise((()=>{}))}return this.tokenRequestInProgress=!1,a},this.clientAuthentication=t.clientAuthentication?t.clientAuthentication:(0,r.getClientAuthenticationWithDependencies)(t.secureStorage&&t.insecureStorage?{secureStorage:t.secureStorage,insecureStorage:t.insecureStorage}:{}),this.info=t.sessionInfo?{sessionId:t.sessionInfo.sessionId,isLoggedIn:!1,webId:t.sessionInfo.webId}:{sessionId:null!=e?e:(0,i.v4)(),isLoggedIn:!1},this.on(n.EVENTS.LOGIN,(()=>window.localStorage.setItem(o.KEY_CURRENT_SESSION,this.info.sessionId))),this.on(n.EVENTS.SESSION_EXPIRED,(()=>this.internalLogout(!1))),this.on(n.EVENTS.ERROR,(()=>this.internalLogout(!1)))}onLogin(t){this.on(n.EVENTS.LOGIN,t)}onLogout(t){this.on(n.EVENTS.LOGOUT,t)}onError(t){this.on(n.EVENTS.ERROR,t)}onSessionRestore(t){this.on(n.EVENTS.SESSION_RESTORED,t)}onSessionExpiration(t){this.on(n.EVENTS.SESSION_EXPIRED,t)}setSessionInfo(t){this.info.isLoggedIn=t.isLoggedIn,this.info.webId=t.webId,this.info.sessionId=t.sessionId,this.info.expirationDate=t.expirationDate,this.on(n.EVENTS.SESSION_EXTENDED,(t=>{this.info.expirationDate=Date.now()+1e3*t}))}}}}),Ks=Jt({"../node_modules/@inrupt/solid-client-authn-browser/dist/defaultSession.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.onSessionRestore=t.onLogout=t.onLogin=t.handleIncomingRedirect=t.logout=t.login=t.fetch=t.getDefaultSession=void 0;var e,n=Hs();function i(){return void 0===e&&(e=new n.Session),e}t.getDefaultSession=i,t.fetch=(...t)=>i().fetch(...t),t.login=(...t)=>i().login(...t),t.logout=(...t)=>i().logout(...t),t.handleIncomingRedirect=(...t)=>i().handleIncomingRedirect(...t),t.onLogin=(...t)=>i().onLogin(...t),t.onLogout=(...t)=>i().onLogout(...t),t.onSessionRestore=(...t)=>i().onSessionRestore(...t)}}),zs=Jt({"../node_modules/@inrupt/solid-client-authn-browser/dist/index.js"(t){var e=t&&t.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(e,n);r&&!("get"in r?!e.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,r)}:function(t,e,n,i){void 0===i&&(i=n),t[i]=e[n]}),n=t&&t.__exportStar||function(t,n){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(n,i)||e(n,t,i)};Object.defineProperty(t,"__esModule",{value:!0}),t.InMemoryStorage=t.ConfigurationError=t.NotImplementedError=t.getClientAuthenticationWithDependencies=t.Session=void 0;var i=Hs();Object.defineProperty(t,"Session",{enumerable:!0,get:function(){return i.Session}});var r=Js();Object.defineProperty(t,"getClientAuthenticationWithDependencies",{enumerable:!0,get:function(){return r.getClientAuthenticationWithDependencies}}),n(Ks(),t);var o=ks();Object.defineProperty(t,"NotImplementedError",{enumerable:!0,get:function(){return o.NotImplementedError}}),Object.defineProperty(t,"ConfigurationError",{enumerable:!0,get:function(){return o.ConfigurationError}}),Object.defineProperty(t,"InMemoryStorage",{enumerable:!0,get:function(){return o.InMemoryStorage}})}}),Ws=Jt({"../node_modules/rdf-canonize/lib/IdentifierIssuer.js"(t,e){e.exports=class t{constructor(t,e=new Map,n=0){this.prefix=t,this._existing=e,this.counter=n}clone(){const{prefix:e,_existing:n,counter:i}=this;return new t(e,new Map(n),i)}getId(t){const e=t&&this._existing.get(t);if(e)return e;const n=this.prefix+this.counter;return this.counter++,t&&this._existing.set(t,n),n}hasId(t){return this._existing.has(t)}getOldIds(){return[...this._existing.keys()]}}}}),qs=Jt({"../node_modules/setimmediate/setImmediate.js"(t){!function(t){if(!t.setImmediate){var e,n,i,r,o,s=1,a={},u=!1,c=t.document,l=Object.getPrototypeOf&&Object.getPrototypeOf(t);l=l&&l.setTimeout?l:t,"[object process]"==={}.toString.call(t.process)?e=function(t){process.nextTick((function(){d(t)}))}:function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?(r="setImmediate$"+Math.random()+"$",o=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(r)&&d(+e.data.slice(r.length))},t.addEventListener?t.addEventListener("message",o,!1):t.attachEvent("onmessage",o),e=function(e){t.postMessage(r+e,"*")}):t.MessageChannel?((i=new MessageChannel).port1.onmessage=function(t){d(t.data)},e=function(t){i.port2.postMessage(t)}):c&&"onreadystatechange"in c.createElement("script")?(n=c.documentElement,e=function(t){var e=c.createElement("script");e.onreadystatechange=function(){d(t),e.onreadystatechange=null,n.removeChild(e),e=null},n.appendChild(e)}):e=function(t){setTimeout(d,0,t)},l.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var n=new Array(arguments.length-1),i=0;i<n.length;i++)n[i]=arguments[i+1];var r={callback:t,args:n};return a[s]=r,e(s),s++},l.clearImmediate=h}function h(t){delete a[t]}function d(t){if(u)setTimeout(d,0,t);else{var e=a[t];if(e){u=!0;try{!function(t){var e=t.callback,n=t.args;switch(n.length){case 0:e();break;case 1:e(n[0]);break;case 2:e(n[0],n[1]);break;case 3:e(n[0],n[1],n[2]);break;default:e.apply(void 0,n)}}(e)}finally{h(t),u=!1}}}}}("undefined"==typeof self?"undefined"==typeof global?t:global:self)}}),Vs=Jt({"../node_modules/rdf-canonize/lib/MessageDigest-browser.js"(t,e){qs();var n=self.crypto||self.msCrypto;e.exports=class{constructor(t){if(!n||!n.subtle)throw new Error("crypto.subtle not found.");if("sha256"===t)this.algorithm={name:"SHA-256"};else{if("sha1"!==t)throw new Error(`Unsupport algorithm "${t}".`);this.algorithm={name:"SHA-1"}}this._content=""}update(t){this._content+=t}async digest(){const t=(new TextEncoder).encode(this._content),e=new Uint8Array(await n.subtle.digest(this.algorithm,t));let i="";for(let t=0;t<e.length;++t)i+=e[t].toString(16).padStart(2,"0");return i}}}}),Gs=Jt({"../node_modules/rdf-canonize/lib/Permuter.js"(t,e){e.exports=class{constructor(t){this.current=t.sort(),this.done=!1,this.dir=new Map;for(let e=0;e<t.length;++e)this.dir.set(t[e],!0)}hasNext(){return!this.done}next(){const{current:t,dir:e}=this,n=t.slice();let i=null,r=0;const o=t.length;for(let n=0;n<o;++n){const s=t[n],a=e.get(s);(null===i||s>i)&&(a&&n>0&&s>t[n-1]||!a&&n<o-1&&s>t[n+1])&&(i=s,r=n)}if(null===i)this.done=!0;else{const n=e.get(i)?r-1:r+1;t[r]=t[n],t[n]=i;for(const n of t)n>i&&e.set(n,!e.get(n))}return n}}}}),Xs=Jt({"../node_modules/rdf-canonize/lib/NQuads.js"(t,e){var n="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString",i="http://www.w3.org/2001/XMLSchema#string",r="NamedNode",o="BlankNode",s="Literal",a="DefaultGraph",u={};u.eoln=/(?:\r\n)|(?:\n)|(?:\r)/g,u.empty=new RegExp("^[ \\t]*$"),u.quad=new RegExp('^[ \\t]*(?:(?:<([^:]+:[^>]*)>)|(_:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9])(?:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀.])*(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀]))?))[ \\t]+(?:<([^:]+:[^>]*)>)[ \\t]+(?:(?:<([^:]+:[^>]*)>)|(_:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9])(?:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀.])*(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀]))?)|(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"(?:(?:\\^\\^(?:<([^:]+:[^>]*)>))|(?:@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*)))?))[ \\t]*(?:\\.|(?:(?:(?:<([^:]+:[^>]*)>)|(_:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9])(?:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀.])*(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀]))?))[ \\t]*\\.))[ \\t]*$'),e.exports=class t{static parse(t){const e=[],c={},h=t.split(u.eoln);let d=0;for(const t of h){if(d++,u.empty.test(t))continue;const h=t.match(u.quad);if(null===h)throw new Error("N-Quads parse error on line "+d+".");const v={subject:null,predicate:null,object:null,graph:null};if(v.subject=void 0!==h[1]?{termType:r,value:h[1]}:{termType:o,value:h[2]},v.predicate={termType:r,value:h[3]},void 0!==h[4]?v.object={termType:r,value:h[4]}:void 0!==h[5]?v.object={termType:o,value:h[5]}:(v.object={termType:s,value:void 0,datatype:{termType:r}},void 0!==h[7]?v.object.datatype.value=h[7]:void 0!==h[8]?(v.object.datatype.value=n,v.object.language=h[8]):v.object.datatype.value=i,v.object.value=h[6].replace(l,(function(t,e,n,i){if(e)switch(e){case"t":return"\t";case"b":return"\b";case"n":return"\n";case"r":return"\r";case"f":return"\f";case'"':return'"';case"'":return"'";case"\\":return"\\"}if(n)return String.fromCharCode(parseInt(n,16));if(i)throw new Error("Unsupported U escape")}))),v.graph=void 0!==h[9]?{termType:r,value:h[9]}:void 0!==h[10]?{termType:o,value:h[10]}:{termType:a,value:""},v.graph.value in c){let t=!0;const n=c[v.graph.value];for(const e of n)if((f=e).subject.termType===(p=v).subject.termType&&f.object.termType===p.object.termType&&f.subject.value===p.subject.value&&f.predicate.value===p.predicate.value&&f.object.value===p.object.value&&(f.object.termType!==s||f.object.datatype.termType===p.object.datatype.termType&&f.object.language===p.object.language&&f.object.datatype.value===p.object.datatype.value)){t=!1;break}t&&(n.push(v),e.push(v))}else c[v.graph.value]=[v],e.push(v)}var f,p;return e}static serialize(e){Array.isArray(e)||(e=t.legacyDatasetToQuads(e));const n=[];for(const i of e)n.push(t.serializeQuad(i));return n.sort().join("")}static serializeQuad(t){const e=t.subject,s=t.object,a=t.graph;let u="";return u+=e.termType===r?`<${e.value}>`:`${e.value}`,u+=` <${t.predicate.value}> `,s.termType===r?u+=`<${s.value}>`:s.termType===o?u+=s.value:(u+=`"${function(t){return t.replace(c,(function(t){switch(t){case'"':return'\\"';case"\\":return"\\\\";case"\n":return"\\n";case"\r":return"\\r"}}))}(s.value)}"`,s.datatype.value===n?s.language&&(u+=`@${s.language}`):s.datatype.value!==i&&(u+=`^^<${s.datatype.value}>`)),a.termType===r?u+=` <${a.value}>`:a.termType===o&&(u+=` ${a.value}`),u+=" .\n",u}static legacyDatasetToQuads(t){const e=[],u={"blank node":o,IRI:r,literal:s};for(const c in t)t[c].forEach((t=>{const l={};for(const e in t){const o=t[e],a={termType:u[o.type],value:o.value};a.termType===s&&(a.datatype={termType:r},"datatype"in o&&(a.datatype.value=o.datatype),"language"in o?("datatype"in o||(a.datatype.value=n),a.language=o.language):"datatype"in o||(a.datatype.value=i)),l[e]=a}l.graph="@default"===c?{termType:a,value:""}:{termType:c.startsWith("_:")?o:r,value:c},e.push(l)}));return e}};var c=/["\\\n\r]/g,l=/(?:\\([tbnrf"'\\]))|(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g}}),Ys=Jt({"../node_modules/rdf-canonize/lib/URDNA2015.js"(t,e){var n=Ws(),i=Vs(),r=Gs(),o=Xs();function s(t,e){return t.hash<e.hash?-1:t.hash>e.hash?1:0}e.exports=class{constructor({maxDeepIterations:t=1/0}={}){this.name="URDNA2015",this.blankNodeInfo=new Map,this.canonicalIssuer=new n("_:c14n"),this.hashAlgorithm="sha256",this.maxDeepIterations=t,this.quads=null,this.deepIterations=null}async main(t){this.deepIterations=new Map,this.quads=t;for(const e of t)this._addBlankNodeQuadInfo({quad:e,component:e.subject}),this._addBlankNodeQuadInfo({quad:e,component:e.object}),this._addBlankNodeQuadInfo({quad:e,component:e.graph});const e=new Map,i=[...this.blankNodeInfo.keys()];let r=0;for(const t of i)++r%100==0&&await this._yield(),await this._hashAndTrackBlankNode({id:t,hashToBlankNodes:e});const a=[...e.keys()].sort(),u=[];for(const t of a){const n=e.get(t);n.length>1?u.push(n):this.canonicalIssuer.getId(n[0])}for(const t of u){const e=[];for(const i of t){if(this.canonicalIssuer.hasId(i))continue;const t=new n("_:b");t.getId(i);const r=await this.hashNDegreeQuads(i,t);e.push(r)}e.sort(s);for(const t of e){const e=t.issuer.getOldIds();for(const t of e)this.canonicalIssuer.getId(t)}}const c=[];for(const t of this.quads){const e={...t};e.subject=this._useCanonicalId({component:e.subject}),e.object=this._useCanonicalId({component:e.object}),e.graph=this._useCanonicalId({component:e.graph}),c.push(o.serializeQuad(e))}return c.sort(),c.join("")}async hashFirstDegreeQuads(t){const e=[],n=this.blankNodeInfo.get(t),r=n.quads;for(const n of r){const i={subject:null,predicate:n.predicate,object:null,graph:null};i.subject=this.modifyFirstDegreeComponent(t,n.subject,"subject"),i.object=this.modifyFirstDegreeComponent(t,n.object,"object"),i.graph=this.modifyFirstDegreeComponent(t,n.graph,"graph"),e.push(o.serializeQuad(i))}e.sort();const s=new i(this.hashAlgorithm);for(const t of e)s.update(t);return n.hash=await s.digest(),n.hash}async hashRelatedBlankNode(t,e,n,r){let o;o=this.canonicalIssuer.hasId(t)?this.canonicalIssuer.getId(t):n.hasId(t)?n.getId(t):this.blankNodeInfo.get(t).hash;const s=new i(this.hashAlgorithm);return s.update(r),"g"!==r&&s.update(this.getRelatedPredicate(e)),s.update(o),s.digest()}async hashNDegreeQuads(t,e){const n=this.deepIterations.get(t)||0;if(n>this.maxDeepIterations)throw new Error(`Maximum deep iterations (${this.maxDeepIterations}) exceeded.`);this.deepIterations.set(t,n+1);const o=new i(this.hashAlgorithm),s=await this.createHashToRelated(t,e),a=[...s.keys()].sort();for(const t of a){o.update(t);let n,i="";const a=new r(s.get(t));let u=0;for(;a.hasNext();){const t=a.next();++u%3==0&&await this._yield();let r=e.clone(),o="";const s=[];let c=!1;for(const e of t)if(this.canonicalIssuer.hasId(e)?o+=this.canonicalIssuer.getId(e):(r.hasId(e)||s.push(e),o+=r.getId(e)),0!==i.length&&o>i){c=!0;break}if(!c){for(const t of s){const e=await this.hashNDegreeQuads(t,r);if(o+=r.getId(t),o+=`<${e.hash}>`,r=e.issuer,0!==i.length&&o>i){c=!0;break}}c||(0===i.length||o<i)&&(i=o,n=r)}}o.update(i),e=n}return{hash:await o.digest(),issuer:e}}modifyFirstDegreeComponent(t,e){return"BlankNode"!==e.termType?e:{termType:"BlankNode",value:e.value===t?"_:a":"_:z"}}getRelatedPredicate(t){return`<${t.predicate.value}>`}async createHashToRelated(t,e){const n=new Map,i=this.blankNodeInfo.get(t).quads;let r=0;for(const o of i)++r%100==0&&await this._yield(),await Promise.all([this._addRelatedBlankNodeHash({quad:o,component:o.subject,position:"s",id:t,issuer:e,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:o,component:o.object,position:"o",id:t,issuer:e,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:o,component:o.graph,position:"g",id:t,issuer:e,hashToRelated:n})]);return n}async _hashAndTrackBlankNode({id:t,hashToBlankNodes:e}){const n=await this.hashFirstDegreeQuads(t),i=e.get(n);i?i.push(t):e.set(n,[t])}_addBlankNodeQuadInfo({quad:t,component:e}){if("BlankNode"!==e.termType)return;const n=e.value,i=this.blankNodeInfo.get(n);i?i.quads.add(t):this.blankNodeInfo.set(n,{quads:new Set([t]),hash:null})}async _addRelatedBlankNodeHash({quad:t,component:e,position:n,id:i,issuer:r,hashToRelated:o}){if("BlankNode"!==e.termType||e.value===i)return;const s=e.value,a=await this.hashRelatedBlankNode(s,t,r,n),u=o.get(a);u?u.push(s):o.set(a,[s])}_useCanonicalId({component:t}){return"BlankNode"!==t.termType||t.value.startsWith(this.canonicalIssuer.prefix)?t:{termType:"BlankNode",value:this.canonicalIssuer.getId(t.value)}}async _yield(){return new Promise((t=>setImmediate(t)))}}}}),Zs=Jt({"../node_modules/rdf-canonize/lib/URGNA2012.js"(t,e){var n=Ys();e.exports=class extends n{constructor(){super(),this.name="URGNA2012",this.hashAlgorithm="sha1"}modifyFirstDegreeComponent(t,e,n){return"BlankNode"!==e.termType?e:"graph"===n?{termType:"BlankNode",value:"_:g"}:{termType:"BlankNode",value:e.value===t?"_:a":"_:z"}}getRelatedPredicate(t){return t.predicate.value}async createHashToRelated(t,e){const n=new Map,i=this.blankNodeInfo.get(t).quads;let r=0;for(const o of i){let i,s;if("BlankNode"===o.subject.termType&&o.subject.value!==t)s=o.subject.value,i="p";else{if("BlankNode"!==o.object.termType||o.object.value===t)continue;s=o.object.value,i="r"}++r%100==0&&await this._yield();const a=await this.hashRelatedBlankNode(s,o,e,i),u=n.get(a);u?u.push(s):n.set(a,[s])}return n}}}}),Qs=Jt({"../node_modules/rdf-canonize/lib/URDNA2015Sync.js"(t,e){var n=Ws(),i=Vs(),r=Gs(),o=Xs();function s(t,e){return t.hash<e.hash?-1:t.hash>e.hash?1:0}e.exports=class{constructor({maxDeepIterations:t=1/0}={}){this.name="URDNA2015",this.blankNodeInfo=new Map,this.canonicalIssuer=new n("_:c14n"),this.hashAlgorithm="sha256",this.maxDeepIterations=t,this.quads=null,this.deepIterations=null}main(t){this.deepIterations=new Map,this.quads=t;for(const e of t)this._addBlankNodeQuadInfo({quad:e,component:e.subject}),this._addBlankNodeQuadInfo({quad:e,component:e.object}),this._addBlankNodeQuadInfo({quad:e,component:e.graph});const e=new Map,i=[...this.blankNodeInfo.keys()];for(const t of i)this._hashAndTrackBlankNode({id:t,hashToBlankNodes:e});const r=[...e.keys()].sort(),a=[];for(const t of r){const n=e.get(t);n.length>1?a.push(n):this.canonicalIssuer.getId(n[0])}for(const t of a){const e=[];for(const i of t){if(this.canonicalIssuer.hasId(i))continue;const t=new n("_:b");t.getId(i);const r=this.hashNDegreeQuads(i,t);e.push(r)}e.sort(s);for(const t of e){const e=t.issuer.getOldIds();for(const t of e)this.canonicalIssuer.getId(t)}}const u=[];for(const t of this.quads){const e={...t};e.subject=this._useCanonicalId({component:e.subject}),e.object=this._useCanonicalId({component:e.object}),e.graph=this._useCanonicalId({component:e.graph}),u.push(o.serializeQuad(e))}return u.sort(),u.join("")}hashFirstDegreeQuads(t){const e=[],n=this.blankNodeInfo.get(t),r=n.quads;for(const n of r){const i={subject:null,predicate:n.predicate,object:null,graph:null};i.subject=this.modifyFirstDegreeComponent(t,n.subject,"subject"),i.object=this.modifyFirstDegreeComponent(t,n.object,"object"),i.graph=this.modifyFirstDegreeComponent(t,n.graph,"graph"),e.push(o.serializeQuad(i))}e.sort();const s=new i(this.hashAlgorithm);for(const t of e)s.update(t);return n.hash=s.digest(),n.hash}hashRelatedBlankNode(t,e,n,r){let o;o=this.canonicalIssuer.hasId(t)?this.canonicalIssuer.getId(t):n.hasId(t)?n.getId(t):this.blankNodeInfo.get(t).hash;const s=new i(this.hashAlgorithm);return s.update(r),"g"!==r&&s.update(this.getRelatedPredicate(e)),s.update(o),s.digest()}hashNDegreeQuads(t,e){const n=this.deepIterations.get(t)||0;if(n>this.maxDeepIterations)throw new Error(`Maximum deep iterations (${this.maxDeepIterations}) exceeded.`);this.deepIterations.set(t,n+1);const o=new i(this.hashAlgorithm),s=this.createHashToRelated(t,e),a=[...s.keys()].sort();for(const t of a){o.update(t);let n,i="";const a=new r(s.get(t));for(;a.hasNext();){const t=a.next();let r=e.clone(),o="";const s=[];let u=!1;for(const e of t)if(this.canonicalIssuer.hasId(e)?o+=this.canonicalIssuer.getId(e):(r.hasId(e)||s.push(e),o+=r.getId(e)),0!==i.length&&o>i){u=!0;break}if(!u){for(const t of s){const e=this.hashNDegreeQuads(t,r);if(o+=r.getId(t),o+=`<${e.hash}>`,r=e.issuer,0!==i.length&&o>i){u=!0;break}}u||(0===i.length||o<i)&&(i=o,n=r)}}o.update(i),e=n}return{hash:o.digest(),issuer:e}}modifyFirstDegreeComponent(t,e){return"BlankNode"!==e.termType?e:{termType:"BlankNode",value:e.value===t?"_:a":"_:z"}}getRelatedPredicate(t){return`<${t.predicate.value}>`}createHashToRelated(t,e){const n=new Map,i=this.blankNodeInfo.get(t).quads;for(const r of i)this._addRelatedBlankNodeHash({quad:r,component:r.subject,position:"s",id:t,issuer:e,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:r,component:r.object,position:"o",id:t,issuer:e,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:r,component:r.graph,position:"g",id:t,issuer:e,hashToRelated:n});return n}_hashAndTrackBlankNode({id:t,hashToBlankNodes:e}){const n=this.hashFirstDegreeQuads(t),i=e.get(n);i?i.push(t):e.set(n,[t])}_addBlankNodeQuadInfo({quad:t,component:e}){if("BlankNode"!==e.termType)return;const n=e.value,i=this.blankNodeInfo.get(n);i?i.quads.add(t):this.blankNodeInfo.set(n,{quads:new Set([t]),hash:null})}_addRelatedBlankNodeHash({quad:t,component:e,position:n,id:i,issuer:r,hashToRelated:o}){if("BlankNode"!==e.termType||e.value===i)return;const s=e.value,a=this.hashRelatedBlankNode(s,t,r,n),u=o.get(a);u?u.push(s):o.set(a,[s])}_useCanonicalId({component:t}){return"BlankNode"!==t.termType||t.value.startsWith(this.canonicalIssuer.prefix)?t:{termType:"BlankNode",value:this.canonicalIssuer.getId(t.value)}}}}}),ta=Jt({"../node_modules/rdf-canonize/lib/URGNA2012Sync.js"(t,e){var n=Qs();e.exports=class extends n{constructor(){super(),this.name="URGNA2012",this.hashAlgorithm="sha1"}modifyFirstDegreeComponent(t,e,n){return"BlankNode"!==e.termType?e:"graph"===n?{termType:"BlankNode",value:"_:g"}:{termType:"BlankNode",value:e.value===t?"_:a":"_:z"}}getRelatedPredicate(t){return t.predicate.value}createHashToRelated(t,e){const n=new Map,i=this.blankNodeInfo.get(t).quads;for(const r of i){let i,o;if("BlankNode"===r.subject.termType&&r.subject.value!==t)o=r.subject.value,i="p";else{if("BlankNode"!==r.object.termType||r.object.value===t)continue;o=r.object.value,i="r"}const s=this.hashRelatedBlankNode(o,r,e,i),a=n.get(s);a?a.push(o):n.set(s,[o])}return n}}}}),ea=Jt({"(disabled):rdf-canonize-native"(){}}),na=Jt({"../node_modules/rdf-canonize/lib/index.js"(t,e){var n,i=Ys(),r=Zs(),o=Qs(),s=ta();try{n=ea()}catch(t){}var a={};e.exports=a,a.NQuads=Xs(),a.IdentifierIssuer=Ws(),a._rdfCanonizeNative=function(t){return t&&(n=t),n},a.canonize=async function(t,e){if(Array.isArray(t)||(t=a.NQuads.legacyDatasetToQuads(t)),e.useNative){if(!n)throw new Error("rdf-canonize-native not available");return new Promise(((i,r)=>n.canonize(t,e,((t,e)=>t?r(t):i(e)))))}if("URDNA2015"===e.algorithm)return new i(e).main(t);if("URGNA2012"===e.algorithm)return new r(e).main(t);if(!("algorithm"in e))throw new Error("No RDF Dataset Canonicalization algorithm specified.");throw new Error("Invalid RDF Dataset Canonicalization algorithm: "+e.algorithm)},a._canonizeSync=function(t,e){if(Array.isArray(t)||(t=a.NQuads.legacyDatasetToQuads(t)),e.useNative){if(n)return n.canonizeSync(t,e);throw new Error("rdf-canonize-native not available")}if("URDNA2015"===e.algorithm)return new o(e).main(t);if("URGNA2012"===e.algorithm)return new s(e).main(t);if(!("algorithm"in e))throw new Error("No RDF Dataset Canonicalization algorithm specified.");throw new Error("Invalid RDF Dataset Canonicalization algorithm: "+e.algorithm)}}}),ia=Jt({"../node_modules/rdf-canonize/index.js"(t,e){e.exports=na()}}),ra=Jt({"../node_modules/jsonld/lib/types.js"(t,e){var n={};e.exports=n,n.isArray=Array.isArray,n.isBoolean=t=>"boolean"==typeof t||"[object Boolean]"===Object.prototype.toString.call(t),n.isDouble=t=>n.isNumber(t)&&(-1!==String(t).indexOf(".")||Math.abs(t)>=1e21),n.isEmptyObject=t=>n.isObject(t)&&0===Object.keys(t).length,n.isNumber=t=>"number"==typeof t||"[object Number]"===Object.prototype.toString.call(t),n.isNumeric=t=>!isNaN(parseFloat(t))&&isFinite(t),n.isObject=t=>"[object Object]"===Object.prototype.toString.call(t),n.isString=t=>"string"==typeof t||"[object String]"===Object.prototype.toString.call(t),n.isUndefined=t=>void 0===t}}),oa=Jt({"../node_modules/jsonld/lib/graphTypes.js"(t,e){var n=ra(),i={};e.exports=i,i.isSubject=t=>!(!n.isObject(t)||"@value"in t||"@set"in t||"@list"in t)&&(Object.keys(t).length>1||!("@id"in t)),i.isSubjectReference=t=>n.isObject(t)&&1===Object.keys(t).length&&"@id"in t,i.isValue=t=>n.isObject(t)&&"@value"in t,i.isList=t=>n.isObject(t)&&"@list"in t,i.isGraph=t=>n.isObject(t)&&"@graph"in t&&1===Object.keys(t).filter((t=>"@id"!==t&&"@index"!==t)).length,i.isSimpleGraph=t=>i.isGraph(t)&&!("@id"in t),i.isBlankNode=t=>!!n.isObject(t)&&("@id"in t?0===t["@id"].indexOf("_:"):0===Object.keys(t).length||!("@value"in t||"@set"in t||"@list"in t))}}),sa=Jt({"../node_modules/jsonld/lib/JsonLdError.js"(t,e){e.exports=class extends Error{constructor(t="An unspecified JSON-LD error occurred.",e="jsonld.Error",n={}){super(t),this.name=e,this.message=t,this.details=n}}}}),aa=Jt({"../node_modules/jsonld/lib/util.js"(t,e){var n=oa(),i=ra(),r=ia().IdentifierIssuer,o=sa(),s=/(?:<[^>]*?>|"[^"]*?"|[^,])+/g,a=/\s*<([^>]*?)>\s*(?:;\s*(.*))?/,u=/(.*?)=(?:(?:"([^"]*?)")|([^"]*?))\s*(?:(?:;\s*)|$)/g,c="application/ld+json, application/json",l={};function h(t,e){if(i.isArray(e))for(let n=0;n<e.length;++n)e[n]=h(t,e[n]);else if(n.isList(e))e["@list"]=h(t,e["@list"]);else if(i.isObject(e)){n.isBlankNode(e)&&(e["@id"]=t.getId(e["@id"]));const i=Object.keys(e).sort();for(let n=0;n<i.length;++n){const r=i[n];"@id"!==r&&(e[r]=h(t,e[r]))}}return e}e.exports=l,l.IdentifierIssuer=r,l.clone=function(t){if(t&&"object"==typeof t){let e;if(i.isArray(t)){e=[];for(let n=0;n<t.length;++n)e[n]=l.clone(t[n])}else if(t instanceof Map){e=new Map;for(const[n,i]of t)e.set(n,l.clone(i))}else if(t instanceof Set){e=new Set;for(const n of t)e.add(l.clone(n))}else if(i.isObject(t)){e={};for(const n in t)e[n]=l.clone(t[n])}else e=t.toString();return e}return t},l.asArray=function(t){return Array.isArray(t)?t:[t]},l.buildHeaders=(t={})=>{if(Object.keys(t).some((t=>"accept"===t.toLowerCase())))throw new RangeError('Accept header may not be specified; only "'+c+'" is supported.');return Object.assign({Accept:c},t)},l.parseLinkHeader=t=>{const e={},n=t.match(s);for(let t=0;t<n.length;++t){let i=n[t].match(a);if(!i)continue;const r={target:i[1]},o=i[2];for(;i=u.exec(o);)r[i[1]]=void 0===i[2]?i[3]:i[2];const s=r.rel||"";Array.isArray(e[s])?e[s].push(r):e[s]=e.hasOwnProperty(s)?[e[s],r]:r}return e},l.validateTypeValue=(t,e)=>{if(!(i.isString(t)||i.isArray(t)&&t.every((t=>i.isString(t))))){if(e&&i.isObject(t))switch(Object.keys(t).length){case 0:return;case 1:if("@default"in t&&l.asArray(t["@default"]).every((t=>i.isString(t))))return}throw new o('Invalid JSON-LD syntax; "@type" value must a string, an array of strings, an empty object, or a default object.',"jsonld.SyntaxError",{code:"invalid type value",value:t})}},l.hasProperty=(t,e)=>{if(t.hasOwnProperty(e)){const n=t[e];return!i.isArray(n)||n.length>0}return!1},l.hasValue=(t,e,r)=>{if(l.hasProperty(t,e)){let o=t[e];const s=n.isList(o);if(i.isArray(o)||s){s&&(o=o["@list"]);for(let t=0;t<o.length;++t)if(l.compareValues(r,o[t]))return!0}else if(!i.isArray(r))return l.compareValues(r,o)}return!1},l.addValue=(t,e,n,r)=>{if("propertyIsArray"in(r=r||{})||(r.propertyIsArray=!1),"valueIsArray"in r||(r.valueIsArray=!1),"allowDuplicate"in r||(r.allowDuplicate=!0),"prependValue"in r||(r.prependValue=!1),r.valueIsArray)t[e]=n;else if(i.isArray(n)){0===n.length&&r.propertyIsArray&&!t.hasOwnProperty(e)&&(t[e]=[]),r.prependValue&&(n=n.concat(t[e]),t[e]=[]);for(let i=0;i<n.length;++i)l.addValue(t,e,n[i],r)}else if(t.hasOwnProperty(e)){const o=!r.allowDuplicate&&l.hasValue(t,e,n);i.isArray(t[e])||o&&!r.propertyIsArray||(t[e]=[t[e]]),o||(r.prependValue?t[e].unshift(n):t[e].push(n))}else t[e]=r.propertyIsArray?[n]:n},l.getValues=(t,e)=>[].concat(t[e]||[]),l.removeProperty=(t,e)=>{delete t[e]},l.removeValue=(t,e,n,i)=>{"propertyIsArray"in(i=i||{})||(i.propertyIsArray=!1);const r=l.getValues(t,e).filter((t=>!l.compareValues(t,n)));0===r.length?l.removeProperty(t,e):t[e]=1!==r.length||i.propertyIsArray?r:r[0]},l.relabelBlankNodes=(t,e)=>h((e=e||{}).issuer||new r("_:b"),t),l.compareValues=(t,e)=>t===e||!(!n.isValue(t)||!n.isValue(e)||t["@value"]!==e["@value"]||t["@type"]!==e["@type"]||t["@language"]!==e["@language"]||t["@index"]!==e["@index"])||!!(i.isObject(t)&&"@id"in t&&i.isObject(e)&&"@id"in e)&&t["@id"]===e["@id"],l.compareShortestLeast=(t,e)=>t.length<e.length?-1:e.length<t.length?1:t===e?0:t<e?-1:1}}),ua=Jt({"../node_modules/jsonld/lib/constants.js"(t,e){var n="http://www.w3.org/1999/02/22-rdf-syntax-ns#",i="http://www.w3.org/2001/XMLSchema#";e.exports={LINK_HEADER_REL:"http://www.w3.org/ns/json-ld#context",LINK_HEADER_CONTEXT:"http://www.w3.org/ns/json-ld#context",RDF:n,RDF_LIST:n+"List",RDF_FIRST:n+"first",RDF_REST:n+"rest",RDF_NIL:n+"nil",RDF_TYPE:n+"type",RDF_PLAIN_LITERAL:n+"PlainLiteral",RDF_XML_LITERAL:n+"XMLLiteral",RDF_JSON_LITERAL:n+"JSON",RDF_OBJECT:n+"object",RDF_LANGSTRING:n+"langString",XSD:i,XSD_BOOLEAN:i+"boolean",XSD_DOUBLE:i+"double",XSD_INTEGER:i+"integer",XSD_STRING:i+"string"}}}),ca=Jt({"../node_modules/jsonld/lib/RequestQueue.js"(t,e){e.exports=class{constructor(){this._requests={}}wrapLoader(t){const e=this;return e._loader=t,function(){return e.add.apply(e,arguments)}}async add(t){let e=this._requests[t];if(e)return Promise.resolve(e);e=this._requests[t]=this._loader(t);try{return await e}finally{delete this._requests[t]}}}}}),la=Jt({"../node_modules/jsonld/lib/url.js"(t,e){var n=ra(),i={};e.exports=i,i.parsers={simple:{keys:["href","scheme","authority","path","query","fragment"],regex:/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/},full:{keys:["href","protocol","scheme","authority","auth","user","password","hostname","port","path","directory","file","query","fragment"],regex:/^(([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?(?:(((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/}},i.parse=(t,e)=>{const n={},r=i.parsers[e||"full"],o=r.regex.exec(t);let s=r.keys.length;for(;s--;)n[r.keys[s]]=void 0===o[s]?null:o[s];return("https"===n.scheme&&"443"===n.port||"http"===n.scheme&&"80"===n.port)&&(n.href=n.href.replace(":"+n.port,""),n.authority=n.authority.replace(":"+n.port,""),n.port=null),n.normalizedPath=i.removeDotSegments(n.path),n},i.prependBase=(t,e)=>{if(null===t)return e;if(i.isAbsolute(e))return e;t&&!n.isString(t)||(t=i.parse(t||""));const r=i.parse(e),o={protocol:t.protocol||""};if(null!==r.authority)o.authority=r.authority,o.path=r.path,o.query=r.query;else if(o.authority=t.authority,""===r.path)o.path=t.path,o.query=null!==r.query?r.query:t.query;else{if(0===r.path.indexOf("/"))o.path=r.path;else{let e=t.path;e=e.substr(0,e.lastIndexOf("/")+1),(e.length>0||t.authority)&&"/"!==e.substr(-1)&&(e+="/"),e+=r.path,o.path=e}o.query=r.query}""!==r.path&&(o.path=i.removeDotSegments(o.path));let s=o.protocol;return null!==o.authority&&(s+="//"+o.authority),s+=o.path,null!==o.query&&(s+="?"+o.query),null!==r.fragment&&(s+="#"+r.fragment),""===s&&(s="./"),s},i.removeBase=(t,e)=>{if(null===t)return e;t&&!n.isString(t)||(t=i.parse(t||""));let r="";if(""!==t.href?r+=(t.protocol||"")+"//"+(t.authority||""):e.indexOf("//")&&(r+="//"),0!==e.indexOf(r))return e;const o=i.parse(e.substr(r.length)),s=t.normalizedPath.split("/"),a=o.normalizedPath.split("/"),u=o.fragment||o.query?0:1;for(;s.length>0&&a.length>u&&s[0]===a[0];)s.shift(),a.shift();let c="";if(s.length>0){s.pop();for(let t=0;t<s.length;++t)c+="../"}return c+=a.join("/"),null!==o.query&&(c+="?"+o.query),null!==o.fragment&&(c+="#"+o.fragment),""===c&&(c="./"),c},i.removeDotSegments=t=>{if(0===t.length)return"";const e=t.split("/"),n=[];for(;e.length>0;){const t=e.shift(),i=0===e.length;"."!==t?".."!==t?n.push(t):(n.pop(),i&&n.push("")):i&&n.push("")}return"/"===t[0]&&n.length>0&&""!==n[0]&&n.unshift(""),1===n.length&&""===n[0]?"/":n.join("/")};var r=/^([A-Za-z][A-Za-z0-9+-.]*|_):[^\s]*$/;i.isAbsolute=t=>n.isString(t)&&r.test(t),i.isRelative=t=>n.isString(t)}}),ha=Jt({"../node_modules/jsonld/lib/documentLoaders/xhr.js"(t,e){var{parseLinkHeader:n,buildHeaders:i}=aa(),{LINK_HEADER_CONTEXT:r}=ua(),o=sa(),s=ca(),{prependBase:a}=la(),u=/(^|(\r\n))link:/i;e.exports=({secure:t,headers:e={},xhr:c}={headers:{}})=>(e=i(e),(new s).wrapLoader((async function i(s){if(0!==s.indexOf("http:")&&0!==s.indexOf("https:"))throw new o('URL could not be dereferenced; only "http" and "https" URLs are supported.',"jsonld.InvalidUrl",{code:"loading document failed",url:s});if(t&&0!==s.indexOf("https"))throw new o('URL could not be dereferenced; secure mode is enabled and the URL\'s scheme is not "https".',"jsonld.InvalidUrl",{code:"loading document failed",url:s});let l;try{l=await function(t,e,n){const i=new(t=t||XMLHttpRequest);return new Promise(((t,r)=>{i.onload=()=>t(i),i.onerror=t=>r(t),i.open("GET",e,!0);for(const t in n)i.setRequestHeader(t,n[t]);i.send()}))}(c,s,e)}catch(t){throw new o("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:s,cause:t})}if(l.status>=400)throw new o("URL could not be dereferenced: "+l.statusText,"jsonld.LoadDocumentError",{code:"loading document failed",url:s,httpStatusCode:l.status});let h={contextUrl:null,documentUrl:s,document:l.response},d=null;const f=l.getResponseHeader("Content-Type");let p;if(u.test(l.getAllResponseHeaders())&&(p=l.getResponseHeader("Link")),p&&"application/ld+json"!==f){const t=n(p),e=t[r];if(Array.isArray(e))throw new o("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:s});e&&(h.contextUrl=e.target),d=t.alternate,d&&"application/ld+json"==d.type&&!(f||"").match(/^application\/(\w*\+)?json$/)&&(h=await i(a(s,d.target)))}return h})))}}),da=Jt({"../node_modules/jsonld/lib/platform-browser.js"(t,e){var n=ha(),i={};e.exports=i,i.setupDocumentLoaders=function(t){"undefined"!=typeof XMLHttpRequest&&(t.documentLoaders.xhr=n,t.useDocumentLoader("xhr"))},i.setupGlobals=function(t){void 0===globalThis.JsonLdProcessor&&Object.defineProperty(globalThis,"JsonLdProcessor",{writable:!0,enumerable:!1,configurable:!0,value:t.JsonLdProcessor})}}}),fa=Jt({"../node_modules/yallist/iterator.js"(t,e){e.exports=function(t){t.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}}}),pa=Jt({"../node_modules/yallist/yallist.js"(t,e){function n(t){var e=this;if(e instanceof n||(e=new n),e.tail=null,e.head=null,e.length=0,t&&"function"==typeof t.forEach)t.forEach((function(t){e.push(t)}));else if(arguments.length>0)for(var i=0,r=arguments.length;i<r;i++)e.push(arguments[i]);return e}function i(t,e){t.tail=new o(e,t.tail,null,t),t.head||(t.head=t.tail),t.length++}function r(t,e){t.head=new o(e,null,t.head,t),t.tail||(t.tail=t.head),t.length++}function o(t,e,n,i){if(!(this instanceof o))return new o(t,e,n,i);this.list=i,this.value=t,e?(e.next=this,this.prev=e):this.prev=null,n?(n.prev=this,this.next=n):this.next=null}e.exports=n,n.Node=o,n.create=n,n.prototype.removeNode=function(t){if(t.list!==this)throw new Error("removing node which does not belong to this list");var e=t.next,n=t.prev;return e&&(e.prev=n),n&&(n.next=e),t===this.head&&(this.head=e),t===this.tail&&(this.tail=n),t.list.length--,t.next=null,t.prev=null,t.list=null,e},n.prototype.unshiftNode=function(t){if(t!==this.head){t.list&&t.list.removeNode(t);var e=this.head;t.list=this,t.next=e,e&&(e.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}},n.prototype.pushNode=function(t){if(t!==this.tail){t.list&&t.list.removeNode(t);var e=this.tail;t.list=this,t.prev=e,e&&(e.next=t),this.tail=t,this.head||(this.head=t),this.length++}},n.prototype.push=function(){for(var t=0,e=arguments.length;t<e;t++)i(this,arguments[t]);return this.length},n.prototype.unshift=function(){for(var t=0,e=arguments.length;t<e;t++)r(this,arguments[t]);return this.length},n.prototype.pop=function(){if(this.tail){var t=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,t}},n.prototype.shift=function(){if(this.head){var t=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,t}},n.prototype.forEach=function(t,e){e=e||this;for(var n=this.head,i=0;null!==n;i++)t.call(e,n.value,i,this),n=n.next},n.prototype.forEachReverse=function(t,e){e=e||this;for(var n=this.tail,i=this.length-1;null!==n;i--)t.call(e,n.value,i,this),n=n.prev},n.prototype.get=function(t){for(var e=0,n=this.head;null!==n&&e<t;e++)n=n.next;if(e===t&&null!==n)return n.value},n.prototype.getReverse=function(t){for(var e=0,n=this.tail;null!==n&&e<t;e++)n=n.prev;if(e===t&&null!==n)return n.value},n.prototype.map=function(t,e){e=e||this;for(var i=new n,r=this.head;null!==r;)i.push(t.call(e,r.value,this)),r=r.next;return i},n.prototype.mapReverse=function(t,e){e=e||this;for(var i=new n,r=this.tail;null!==r;)i.push(t.call(e,r.value,this)),r=r.prev;return i},n.prototype.reduce=function(t,e){var n,i=this.head;if(arguments.length>1)n=e;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");i=this.head.next,n=this.head.value}for(var r=0;null!==i;r++)n=t(n,i.value,r),i=i.next;return n},n.prototype.reduceReverse=function(t,e){var n,i=this.tail;if(arguments.length>1)n=e;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");i=this.tail.prev,n=this.tail.value}for(var r=this.length-1;null!==i;r--)n=t(n,i.value,r),i=i.prev;return n},n.prototype.toArray=function(){for(var t=new Array(this.length),e=0,n=this.head;null!==n;e++)t[e]=n.value,n=n.next;return t},n.prototype.toArrayReverse=function(){for(var t=new Array(this.length),e=0,n=this.tail;null!==n;e++)t[e]=n.value,n=n.prev;return t},n.prototype.slice=function(t,e){(e=e||this.length)<0&&(e+=this.length),(t=t||0)<0&&(t+=this.length);var i=new n;if(e<t||e<0)return i;t<0&&(t=0),e>this.length&&(e=this.length);for(var r=0,o=this.head;null!==o&&r<t;r++)o=o.next;for(;null!==o&&r<e;r++,o=o.next)i.push(o.value);return i},n.prototype.sliceReverse=function(t,e){(e=e||this.length)<0&&(e+=this.length),(t=t||0)<0&&(t+=this.length);var i=new n;if(e<t||e<0)return i;t<0&&(t=0),e>this.length&&(e=this.length);for(var r=this.length,o=this.tail;null!==o&&r>e;r--)o=o.prev;for(;null!==o&&r>t;r--,o=o.prev)i.push(o.value);return i},n.prototype.splice=function(t,e,...n){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var i=0,r=this.head;null!==r&&i<t;i++)r=r.next;var s,a,u,c,l=[];for(i=0;r&&i<e;i++)l.push(r.value),r=this.removeNode(r);for(null===r&&(r=this.tail),r!==this.head&&r!==this.tail&&(r=r.prev),i=0;i<n.length;i++)u=n[i],c=void 0,null===(c=(a=r)===(s=this).head?new o(u,null,a,s):new o(u,a,a.next,s)).next&&(s.tail=c),null===c.prev&&(s.head=c),s.length++,r=c;return l},n.prototype.reverse=function(){for(var t=this.head,e=this.tail,n=t;null!==n;n=n.prev){var i=n.prev;n.prev=n.next,n.next=i}return this.head=e,this.tail=t,this};try{fa()(n)}catch(t){}}}),va=Jt({"../node_modules/lru-cache/index.js"(t,e){var n=pa(),i=Symbol("max"),r=Symbol("length"),o=Symbol("lengthCalculator"),s=Symbol("allowStale"),a=Symbol("maxAge"),u=Symbol("dispose"),c=Symbol("noDisposeOnSet"),l=Symbol("lruList"),h=Symbol("cache"),d=Symbol("updateAgeOnGet"),f=()=>1,p=(t,e,n)=>{const i=t[h].get(e);if(i){const e=i.value;if(v(t,e)){if(m(t,i),!t[s])return}else n&&(t[d]&&(i.value.now=Date.now()),t[l].unshiftNode(i));return e.value}},v=(t,e)=>{if(!e||!e.maxAge&&!t[a])return!1;const n=Date.now()-e.now;return e.maxAge?n>e.maxAge:t[a]&&n>t[a]},g=t=>{if(t[r]>t[i])for(let e=t[l].tail;t[r]>t[i]&&null!==e;){const n=e.prev;m(t,e),e=n}},m=(t,e)=>{if(e){const n=e.value;t[u]&&t[u](n.key,n.value),t[r]-=n.length,t[h].delete(n.key),t[l].removeNode(e)}},w=(t,e,n,i)=>{let r=n.value;v(t,r)&&(m(t,n),t[s]||(r=void 0)),r&&e.call(i,r.value,r.key,t)};e.exports=class{constructor(t){if("number"==typeof t&&(t={max:t}),t||(t={}),t.max&&("number"!=typeof t.max||t.max<0))throw new TypeError("max must be a non-negative number");this[i]=t.max||1/0;const e=t.length||f;if(this[o]="function"!=typeof e?f:e,this[s]=t.stale||!1,t.maxAge&&"number"!=typeof t.maxAge)throw new TypeError("maxAge must be a number");this[a]=t.maxAge||0,this[u]=t.dispose,this[c]=t.noDisposeOnSet||!1,this[d]=t.updateAgeOnGet||!1,this.reset()}set max(t){if("number"!=typeof t||t<0)throw new TypeError("max must be a non-negative number");this[i]=t||1/0,g(this)}get max(){return this[i]}set allowStale(t){this[s]=!!t}get allowStale(){return this[s]}set maxAge(t){if("number"!=typeof t)throw new TypeError("maxAge must be a non-negative number");this[a]=t,g(this)}get maxAge(){return this[a]}set lengthCalculator(t){"function"!=typeof t&&(t=f),t!==this[o]&&(this[o]=t,this[r]=0,this[l].forEach((t=>{t.length=this[o](t.value,t.key),this[r]+=t.length}))),g(this)}get lengthCalculator(){return this[o]}get length(){return this[r]}get itemCount(){return this[l].length}rforEach(t,e){e=e||this;for(let n=this[l].tail;null!==n;){const i=n.prev;w(this,t,n,e),n=i}}forEach(t,e){e=e||this;for(let n=this[l].head;null!==n;){const i=n.next;w(this,t,n,e),n=i}}keys(){return this[l].toArray().map((t=>t.key))}values(){return this[l].toArray().map((t=>t.value))}reset(){this[u]&&this[l]&&this[l].length&&this[l].forEach((t=>this[u](t.key,t.value))),this[h]=new Map,this[l]=new n,this[r]=0}dump(){return this[l].map((t=>!v(this,t)&&{k:t.key,v:t.value,e:t.now+(t.maxAge||0)})).toArray().filter((t=>t))}dumpLru(){return this[l]}set(t,e,n){if((n=n||this[a])&&"number"!=typeof n)throw new TypeError("maxAge must be a number");const s=n?Date.now():0,d=this[o](e,t);if(this[h].has(t)){if(d>this[i])return m(this,this[h].get(t)),!1;const o=this[h].get(t).value;return this[u]&&(this[c]||this[u](t,o.value)),o.now=s,o.maxAge=n,o.value=e,this[r]+=d-o.length,o.length=d,this.get(t),g(this),!0}const f=new class{constructor(t,e,n,i,r){this.key=t,this.value=e,this.length=n,this.now=i,this.maxAge=r||0}}(t,e,d,s,n);return f.length>this[i]?(this[u]&&this[u](t,e),!1):(this[r]+=f.length,this[l].unshift(f),this[h].set(t,this[l].head),g(this),!0)}has(t){if(!this[h].has(t))return!1;const e=this[h].get(t).value;return!v(this,e)}get(t){return p(this,t,!0)}peek(t){return p(this,t,!1)}pop(){const t=this[l].tail;return t?(m(this,t),t.value):null}del(t){m(this,this[h].get(t))}load(t){this.reset();const e=Date.now();for(let n=t.length-1;n>=0;n--){const i=t[n],r=i.e||0;if(0===r)this.set(i.k,i.v);else{const t=r-e;t>0&&this.set(i.k,i.v,t)}}}prune(){this[h].forEach(((t,e)=>p(this,e,!1)))}}}}),ga=Jt({"../node_modules/jsonld/lib/ResolvedContext.js"(t,e){var n=va();e.exports=class{constructor({document:t}){this.document=t,this.cache=new n({max:10})}getProcessed(t){return this.cache.get(t)}setProcessed(t,e){this.cache.set(t,e)}}}}),ma=Jt({"../node_modules/jsonld/lib/ContextResolver.js"(t,e){var{isArray:n,isObject:i,isString:r}=ra(),{asArray:o}=aa(),{prependBase:s}=la(),a=sa(),u=ga();function c(t){throw new a("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:t})}function l({context:t,base:e}){if(!t)return;const o=t["@context"];if(r(o))t["@context"]=s(e,o);else if(n(o))for(let t=0;t<o.length;++t){const n=o[t];r(n)?o[t]=s(e,n):i(n)&&l({context:{"@context":n},base:e})}else if(i(o))for(const t in o)l({context:o[t],base:e})}e.exports=class{constructor({sharedCache:t}){this.perOpCache=new Map,this.sharedCache=t}async resolve({activeCtx:t,context:e,documentLoader:s,base:a,cycles:l=new Set}){e&&i(e)&&e["@context"]&&(e=e["@context"]),e=o(e);const h=[];for(const o of e){if(r(o)){let e=this._get(o);e||(e=await this._resolveRemoteContext({activeCtx:t,url:o,documentLoader:s,base:a,cycles:l})),n(e)?h.push(...e):h.push(e);continue}if(null===o){h.push(new u({document:null}));continue}i(o)||c(e);const d=JSON.stringify(o);let f=this._get(d);f||(f=new u({document:o}),this._cacheResolvedContext({key:d,resolved:f,tag:"static"})),h.push(f)}return h}_get(t){let e=this.perOpCache.get(t);if(!e){const n=this.sharedCache.get(t);n&&(e=n.get("static"),e&&this.perOpCache.set(t,e))}return e}_cacheResolvedContext({key:t,resolved:e,tag:n}){if(this.perOpCache.set(t,e),void 0!==n){let i=this.sharedCache.get(t);i||(i=new Map,this.sharedCache.set(t,i)),i.set(n,e)}return e}async _resolveRemoteContext({activeCtx:t,url:e,documentLoader:n,base:i,cycles:r}){e=s(i,e);const{context:o,remoteDoc:a}=await this._fetchContext({activeCtx:t,url:e,documentLoader:n,cycles:r});l({context:o,base:i=a.documentUrl||e});const u=await this.resolve({activeCtx:t,context:o,documentLoader:n,base:i,cycles:r});return this._cacheResolvedContext({key:e,resolved:u,tag:a.tag}),u}async _fetchContext({activeCtx:t,url:e,documentLoader:o,cycles:s}){if(s.size>10)throw new a("Maximum number of @context URLs exceeded.","jsonld.ContextUrlError",{code:"json-ld-1.0"===t.processingMode?"loading remote context failed":"context overflow",max:10});if(s.has(e))throw new a("Cyclical @context URLs detected.","jsonld.ContextUrlError",{code:"json-ld-1.0"===t.processingMode?"recursive context inclusion":"context overflow",url:e});let u,c;s.add(e);try{c=await o(e),u=c.document||null,r(u)&&(u=JSON.parse(u))}catch(t){throw new a("Dereferencing a URL did not result in a valid JSON-LD object. Possible causes are an inaccessible URL perhaps due to a same-origin policy (ensure the server uses CORS if you are using client-side JavaScript), too many redirects, a non-JSON response, or more than one HTTP Link Header was provided for a remote context.","jsonld.InvalidUrl",{code:"loading remote context failed",url:e,cause:t})}if(!i(u))throw new a("Dereferencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object.","jsonld.InvalidUrl",{code:"invalid remote context",url:e});return u="@context"in u?{"@context":u["@context"]}:{"@context":{}},c.contextUrl&&(n(u["@context"])||(u["@context"]=[u["@context"]]),u["@context"].push(c.contextUrl)),{context:u,remoteDoc:c}}}}}),wa=Jt({"../node_modules/jsonld/lib/NQuads.js"(t,e){e.exports=ia().NQuads}}),ba=Jt({"../node_modules/jsonld/lib/context.js"(t,e){var n=aa(),i=sa(),{isArray:r,isObject:o,isString:s,isUndefined:a}=ra(),{isAbsolute:u,isRelative:c,prependBase:l}=la(),{asArray:h,compareShortestLeast:d}=aa(),f=new Map,p=/^@[a-zA-Z]+$/,v={};function g(t,e,n,i,r,a){if(null===e||!s(e)||v.isKeyword(e))return e;if(e.match(p))return null;if(i&&i.hasOwnProperty(e)&&!0!==r.get(e)&&v.createTermDefinition({activeCtx:t,localCtx:i,term:e,defined:r,options:a}),(n=n||{}).vocab){const n=t.mappings.get(e);if(null===n)return null;if(o(n)&&"@id"in n)return n["@id"]}const c=e.indexOf(":");if(c>0){const n=e.substr(0,c),o=e.substr(c+1);if("_"===n||0===o.indexOf("//"))return e;i&&i.hasOwnProperty(n)&&v.createTermDefinition({activeCtx:t,localCtx:i,term:n,defined:r,options:a});const s=t.mappings.get(n);if(s&&s._prefix)return s["@id"]+o;if(u(e))return e}if(n.vocab&&"@vocab"in t)return t["@vocab"]+e;if(n.base&&"@base"in t){if(t["@base"])return l(l(a.base,t["@base"]),e)}else if(n.base)return l(a.base,e);return e}function m(t,e){if(!t||"object"!=typeof t||!e||"object"!=typeof e)return t===e;const n=Array.isArray(t);if(n!==Array.isArray(e))return!1;if(n){if(t.length!==e.length)return!1;for(let n=0;n<t.length;++n)if(!m(t[n],e[n]))return!1;return!0}const i=Object.keys(t),r=Object.keys(e);if(i.length!==r.length)return!1;for(const n in t){let i=t[n],r=e[n];if("@container"===n&&Array.isArray(i)&&Array.isArray(r)&&(i=i.slice().sort(),r=r.slice().sort()),!m(i,r))return!1}return!0}e.exports=v,v.process=async({activeCtx:t,localCtx:e,options:a,propagate:d=!0,overrideProtected:f=!1,cycles:p=new Set})=>{if(o(e)&&"@context"in e&&r(e["@context"])&&(e=e["@context"]),0===h(e).length)return t;const m=await a.contextResolver.resolve({activeCtx:t,context:e,documentLoader:a.documentLoader,base:a.base});o(m[0].document)&&"boolean"==typeof m[0].document["@propagate"]&&(d=m[0].document["@propagate"]);let w=t;d||w.previousContext||(w=w.clone(),w.previousContext=t);for(const r of m){let{document:h}=r;if(t=w,null===h){if(!f&&0!==Object.keys(t.protected).length){const o=a&&a.protectedMode||"error";if("error"===o)throw new i("Tried to nullify a context with protected terms outside of a term definition.","jsonld.SyntaxError",{code:"invalid context nullification"});if("warn"===o){console.warn("WARNING: invalid context nullification");const e=r.getProcessed(t);if(e){w=t=e;continue}const i=t;w=t=v.getInitialContext(a).clone();for(const[e,r]of Object.entries(i.protected))r&&(t.mappings[e]=n.clone(i.mappings[e]));t.protected=n.clone(i.protected),r.setProcessed(i,w);continue}throw new i("Invalid protectedMode.","jsonld.SyntaxError",{code:"invalid protected mode",context:e,protectedMode:o})}w=t=v.getInitialContext(a).clone();continue}const d=r.getProcessed(t);if(d){w=t=d;continue}if(o(h)&&"@context"in h&&(h=h["@context"]),!o(h))throw new i("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:h});w=w.clone();const m=new Map;if("@version"in h){if(1.1!==h["@version"])throw new i("Unsupported JSON-LD version: "+h["@version"],"jsonld.UnsupportedVersion",{code:"invalid @version value",context:h});if(t.processingMode&&"json-ld-1.0"===t.processingMode)throw new i("@version: "+h["@version"]+" not compatible with "+t.processingMode,"jsonld.ProcessingModeConflict",{code:"processing mode conflict",context:h});w.processingMode="json-ld-1.1",w["@version"]=h["@version"],m.set("@version",!0)}if(w.processingMode=w.processingMode||t.processingMode,"@base"in h){let t=h["@base"];if(null===t||u(t));else{if(!c(t))throw new i('Invalid JSON-LD syntax; the value of "@base" in a @context must be an absolute IRI, a relative IRI, or null.',"jsonld.SyntaxError",{code:"invalid base IRI",context:h});t=l(w["@base"],t)}w["@base"]=t,m.set("@base",!0)}if("@vocab"in h){const t=h["@vocab"];if(null===t)delete w["@vocab"];else{if(!s(t))throw new i('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:h});if(!u(t)&&v.processingMode(w,1))throw new i('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be an absolute IRI.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:h});w["@vocab"]=g(w,t,{vocab:!0,base:!0},void 0,void 0,a)}m.set("@vocab",!0)}if("@language"in h){const t=h["@language"];if(null===t)delete w["@language"];else{if(!s(t))throw new i('Invalid JSON-LD syntax; the value of "@language" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid default language",context:h});w["@language"]=t.toLowerCase()}m.set("@language",!0)}if("@direction"in h){const e=h["@direction"];if("json-ld-1.0"===t.processingMode)throw new i("Invalid JSON-LD syntax; @direction not compatible with "+t.processingMode,"jsonld.SyntaxError",{code:"invalid context member",context:h});if(null===e)delete w["@direction"];else{if("ltr"!==e&&"rtl"!==e)throw new i('Invalid JSON-LD syntax; the value of "@direction" in a @context must be null, "ltr", or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",context:h});w["@direction"]=e}m.set("@direction",!0)}if("@propagate"in h){const n=h["@propagate"];if("json-ld-1.0"===t.processingMode)throw new i("Invalid JSON-LD syntax; @propagate not compatible with "+t.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context:h});if("boolean"!=typeof n)throw new i("Invalid JSON-LD syntax; @propagate value must be a boolean.","jsonld.SyntaxError",{code:"invalid @propagate value",context:e});m.set("@propagate",!0)}if("@import"in h){const n=h["@import"];if("json-ld-1.0"===t.processingMode)throw new i("Invalid JSON-LD syntax; @import not compatible with "+t.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context:h});if(!s(n))throw new i("Invalid JSON-LD syntax; @import must be a string.","jsonld.SyntaxError",{code:"invalid @import value",context:e});const r=await a.contextResolver.resolve({activeCtx:t,context:n,documentLoader:a.documentLoader,base:a.base});if(1!==r.length)throw new i("Invalid JSON-LD syntax; @import must reference a single context.","jsonld.SyntaxError",{code:"invalid remote context",context:e});const o=r[0].getProcessed(t);if(o)h=o;else{const n=r[0].document;if("@import"in n)throw new i("Invalid JSON-LD syntax: imported context must not include @import.","jsonld.SyntaxError",{code:"invalid context entry",context:e});for(const t in n)h.hasOwnProperty(t)||(h[t]=n[t]);r[0].setProcessed(t,h)}m.set("@import",!0)}m.set("@protected",h["@protected"]||!1);for(const t in h)if(v.createTermDefinition({activeCtx:w,localCtx:h,term:t,defined:m,options:a,overrideProtected:f}),o(h[t])&&"@context"in h[t]){const e=h[t]["@context"];let n=!0;if(s(e)){const t=l(a.base,e);p.has(t)?n=!1:p.add(t)}if(n)try{await v.process({activeCtx:w.clone(),localCtx:h[t]["@context"],overrideProtected:!0,options:a,cycles:p})}catch(e){throw new i("Invalid JSON-LD syntax; invalid scoped context.","jsonld.SyntaxError",{code:"invalid scoped context",context:h[t]["@context"],term:t})}}r.setProcessed(t,w)}return w},v.createTermDefinition=({activeCtx:t,localCtx:e,term:n,defined:a,options:c,overrideProtected:l=!1})=>{if(a.has(n)){if(a.get(n))return;throw new i("Cyclical context definition detected.","jsonld.CyclicalContext",{code:"cyclic IRI mapping",context:e,term:n})}let h;if(a.set(n,!1),e.hasOwnProperty(n)&&(h=e[n]),"@type"===n&&o(h)&&"@set"===(h["@container"]||"@set")&&v.processingMode(t,1.1)){const t=["@container","@id","@protected"],r=Object.keys(h);if(0===r.length||r.some((e=>!t.includes(e))))throw new i("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:e,term:n})}else{if(v.isKeyword(n))throw new i("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:e,term:n});if(n.match(p))return void console.warn('WARNING: terms beginning with "@" are reserved for future use and ignored',{term:n});if(""===n)throw new i("Invalid JSON-LD syntax; a term cannot be an empty string.","jsonld.SyntaxError",{code:"invalid term definition",context:e})}const d=t.mappings.get(n);t.mappings.has(n)&&t.mappings.delete(n);let f=!1;if((s(h)||null===h)&&(f=!0,h={"@id":h}),!o(h))throw new i("Invalid JSON-LD syntax; @context term values must be strings or objects.","jsonld.SyntaxError",{code:"invalid term definition",context:e});const w={};t.mappings.set(n,w),w.reverse=!1;const b=["@container","@id","@language","@reverse","@type"];v.processingMode(t,1.1)&&b.push("@context","@direction","@index","@nest","@prefix","@protected");for(const t in h)if(!b.includes(t))throw new i("Invalid JSON-LD syntax; a term definition must not contain "+t,"jsonld.SyntaxError",{code:"invalid term definition",context:e});const y=n.indexOf(":");if(w._termHasColon=y>0,"@reverse"in h){if("@id"in h)throw new i("Invalid JSON-LD syntax; a @reverse term definition must not contain @id.","jsonld.SyntaxError",{code:"invalid reverse property",context:e});if("@nest"in h)throw new i("Invalid JSON-LD syntax; a @reverse term definition must not contain @nest.","jsonld.SyntaxError",{code:"invalid reverse property",context:e});const r=h["@reverse"];if(!s(r))throw new i("Invalid JSON-LD syntax; a @context @reverse value must be a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:e});if(!v.isKeyword(r)&&r.match(p))return console.warn('WARNING: values beginning with "@" are reserved for future use and ignored',{reverse:r}),void(d?t.mappings.set(n,d):t.mappings.delete(n));const o=g(t,r,{vocab:!0,base:!1},e,a,c);if(!u(o))throw new i("Invalid JSON-LD syntax; a @context @reverse value must be an absolute IRI or a blank node identifier.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:e});w["@id"]=o,w.reverse=!0}else if("@id"in h){let r=h["@id"];if(r&&!s(r))throw new i("Invalid JSON-LD syntax; a @context @id value must be an array of strings or a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:e});if(null===r)w["@id"]=null;else{if(!v.isKeyword(r)&&r.match(p))return console.warn('WARNING: values beginning with "@" are reserved for future use and ignored',{id:r}),void(d?t.mappings.set(n,d):t.mappings.delete(n));if(r!==n){if(r=g(t,r,{vocab:!0,base:!1},e,a,c),!u(r)&&!v.isKeyword(r))throw new i("Invalid JSON-LD syntax; a @context @id value must be an absolute IRI, a blank node identifier, or a keyword.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:e});if(n.match(/(?::[^:])|\//)&&g(t,n,{vocab:!0,base:!1},e,new Map(a).set(n,!0),c)!==r)throw new i("Invalid JSON-LD syntax; term in form of IRI must expand to definition.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:e});w["@id"]=r,w._prefix=f&&!w._termHasColon&&r.match(/[:\/\?#\[\]@]$/)}}}if(!("@id"in w))if(w._termHasColon){const i=n.substr(0,y);if(e.hasOwnProperty(i)&&v.createTermDefinition({activeCtx:t,localCtx:e,term:i,defined:a,options:c}),t.mappings.has(i)){const e=n.substr(y+1);w["@id"]=t.mappings.get(i)["@id"]+e}else w["@id"]=n}else if("@type"===n)w["@id"]=n;else{if(!("@vocab"in t))throw new i("Invalid JSON-LD syntax; @context terms must define an @id.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:e,term:n});w["@id"]=t["@vocab"]+n}if((!0===h["@protected"]||!0===a.get("@protected")&&!1!==h["@protected"])&&(t.protected[n]=!0,w.protected=!0),a.set(n,!0),"@type"in h){let n=h["@type"];if(!s(n))throw new i("Invalid JSON-LD syntax; an @context @type value must be a string.","jsonld.SyntaxError",{code:"invalid type mapping",context:e});if("@json"===n||"@none"===n){if(v.processingMode(t,1))throw new i(`Invalid JSON-LD syntax; an @context @type value must not be "${n}" in JSON-LD 1.0 mode.`,"jsonld.SyntaxError",{code:"invalid type mapping",context:e})}else if("@id"!==n&&"@vocab"!==n){if(n=g(t,n,{vocab:!0,base:!1},e,a,c),!u(n))throw new i("Invalid JSON-LD syntax; an @context @type value must be an absolute IRI.","jsonld.SyntaxError",{code:"invalid type mapping",context:e});if(0===n.indexOf("_:"))throw new i("Invalid JSON-LD syntax; an @context @type value must be an IRI, not a blank node identifier.","jsonld.SyntaxError",{code:"invalid type mapping",context:e})}w["@type"]=n}if("@container"in h){const n=s(h["@container"])?[h["@container"]]:h["@container"]||[],o=["@list","@set","@index","@language"];let a=!0;const u=n.includes("@set");if(v.processingMode(t,1.1)){if(o.push("@graph","@id","@type"),n.includes("@list")){if(1!==n.length)throw new i("Invalid JSON-LD syntax; @context @container with @list must have no other values","jsonld.SyntaxError",{code:"invalid container mapping",context:e})}else if(n.includes("@graph")){if(n.some((t=>"@graph"!==t&&"@id"!==t&&"@index"!==t&&"@set"!==t)))throw new i("Invalid JSON-LD syntax; @context @container with @graph must have no other values other than @id, @index, and @set","jsonld.SyntaxError",{code:"invalid container mapping",context:e})}else a&=n.length<=(u?2:1);if(n.includes("@type")&&(w["@type"]=w["@type"]||"@id",!["@id","@vocab"].includes(w["@type"])))throw new i("Invalid JSON-LD syntax; container: @type requires @type to be @id or @vocab.","jsonld.SyntaxError",{code:"invalid type mapping",context:e})}else a&=!r(h["@container"]),a&=n.length<=1;if(a&=n.every((t=>o.includes(t))),a&=!(u&&n.includes("@list")),!a)throw new i("Invalid JSON-LD syntax; @context @container value must be one of the following: "+o.join(", "),"jsonld.SyntaxError",{code:"invalid container mapping",context:e});if(w.reverse&&!n.every((t=>["@index","@set"].includes(t))))throw new i("Invalid JSON-LD syntax; @context @container value for a @reverse type definition must be @index or @set.","jsonld.SyntaxError",{code:"invalid reverse property",context:e});w["@container"]=n}if("@index"in h){if(!("@container"in h)||!w["@container"].includes("@index"))throw new i(`Invalid JSON-LD syntax; @index without @index in @container: "${h["@index"]}" on term "${n}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:e});if(!s(h["@index"])||0===h["@index"].indexOf("@"))throw new i(`Invalid JSON-LD syntax; @index must expand to an IRI: "${h["@index"]}" on term "${n}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:e});w["@index"]=h["@index"]}if("@context"in h&&(w["@context"]=h["@context"]),"@language"in h&&!("@type"in h)){let t=h["@language"];if(null!==t&&!s(t))throw new i("Invalid JSON-LD syntax; @context @language value must be a string or null.","jsonld.SyntaxError",{code:"invalid language mapping",context:e});null!==t&&(t=t.toLowerCase()),w["@language"]=t}if("@prefix"in h){if(n.match(/:|\//))throw new i("Invalid JSON-LD syntax; @context @prefix used on a compact IRI term","jsonld.SyntaxError",{code:"invalid term definition",context:e});if(v.isKeyword(w["@id"]))throw new i("Invalid JSON-LD syntax; keywords may not be used as prefixes","jsonld.SyntaxError",{code:"invalid term definition",context:e});if("boolean"!=typeof h["@prefix"])throw new i("Invalid JSON-LD syntax; @context value for @prefix must be boolean","jsonld.SyntaxError",{code:"invalid @prefix value",context:e});w._prefix=!0===h["@prefix"]}if("@direction"in h){const t=h["@direction"];if(null!==t&&"ltr"!==t&&"rtl"!==t)throw new i('Invalid JSON-LD syntax; @direction value must be null, "ltr", or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",context:e});w["@direction"]=t}if("@nest"in h){const t=h["@nest"];if(!s(t)||"@nest"!==t&&0===t.indexOf("@"))throw new i("Invalid JSON-LD syntax; @context @nest value must be a string which is not a keyword other than @nest.","jsonld.SyntaxError",{code:"invalid @nest value",context:e});w["@nest"]=t}const x=w["@id"];if("@context"===x||"@preserve"===x)throw new i("Invalid JSON-LD syntax; @context and @preserve cannot be aliased.","jsonld.SyntaxError",{code:"invalid keyword alias",context:e});if(d&&d.protected&&!l&&(t.protected[n]=!0,w.protected=!0,!m(d,w))){const t=c&&c.protectedMode||"error";if("error"===t)throw new i(`Invalid JSON-LD syntax; tried to redefine "${n}" which is a protected term.`,"jsonld.SyntaxError",{code:"protected term redefinition",context:e,term:n});if("warn"===t)return void console.warn("WARNING: protected term redefinition",{term:n});throw new i("Invalid protectedMode.","jsonld.SyntaxError",{code:"invalid protected mode",context:e,term:n,protectedMode:t})}},v.expandIri=(t,e,n,i)=>g(t,e,n,void 0,void 0,i),v.getInitialContext=t=>{const e=JSON.stringify({processingMode:t.processingMode}),i=f.get(e);if(i)return i;const r={processingMode:t.processingMode,mappings:new Map,inverse:null,getInverse:function(){const t=this;if(t.inverse)return t.inverse;const e=t.inverse={},n=t.fastCurieMap={},i={},r=(t["@language"]||"@none").toLowerCase(),a=t["@direction"],u=t.mappings,c=[...u.keys()].sort(d);for(const t of c){const o=u.get(t);if(null===o)continue;let c=o["@container"]||"@none";if(c=[].concat(c).sort().join(""),null===o["@id"])continue;const l=h(o["@id"]);for(const u of l){let l=e[u];const h=v.isKeyword(u);if(l)h||o._termHasColon||i[u].push(t);else if(e[u]=l={},!h&&!o._termHasColon){i[u]=[t];const e={iri:u,terms:i[u]};u[0]in n?n[u[0]].push(e):n[u[0]]=[e]}if(l[c]||(l[c]={"@language":{},"@type":{},"@any":{}}),l=l[c],s(t,l["@any"],"@none"),o.reverse)s(t,l["@type"],"@reverse");else if("@none"===o["@type"])s(t,l["@any"],"@none"),s(t,l["@language"],"@none"),s(t,l["@type"],"@none");else if("@type"in o)s(t,l["@type"],o["@type"]);else if("@language"in o&&"@direction"in o){const e=o["@language"],n=o["@direction"];s(t,l["@language"],e&&n?`${e}_${n}`.toLowerCase():e?e.toLowerCase():n?`_${n}`:"@null")}else"@language"in o?s(t,l["@language"],(o["@language"]||"@null").toLowerCase()):"@direction"in o?s(t,l["@language"],o["@direction"]?`_${o["@direction"]}`:"@none"):a?(s(t,l["@language"],`_${a}`),s(t,l["@language"],"@none"),s(t,l["@type"],"@none")):(s(t,l["@language"],r),s(t,l["@language"],"@none"),s(t,l["@type"],"@none"))}}for(const t in n)o(n,t,1);return e},clone:function(){const t={};return t.mappings=n.clone(this.mappings),t.clone=this.clone,t.inverse=null,t.getInverse=this.getInverse,t.protected=n.clone(this.protected),this.previousContext&&(t.previousContext=this.previousContext.clone()),t.revertToPreviousContext=this.revertToPreviousContext,"@base"in this&&(t["@base"]=this["@base"]),"@language"in this&&(t["@language"]=this["@language"]),"@vocab"in this&&(t["@vocab"]=this["@vocab"]),t},revertToPreviousContext:function(){return this.previousContext?this.previousContext.clone():this},protected:{}};return 1e4===f.size&&f.clear(),f.set(e,r),r;function o(t,e,n){const i=t[e],r=t[e]={};let s,a;for(const t of i)s=t.iri,a=n>=s.length?"":s[n],a in r?r[a].push(t):r[a]=[t];for(const t in r)""!==t&&o(r,t,n+1)}function s(t,e,n){e.hasOwnProperty(n)||(e[n]=t)}},v.getContextValue=(t,e,n)=>{if(null===e){if("@context"===n)return;return null}if(t.mappings.has(e)){const i=t.mappings.get(e);if(a(n))return i;if(i.hasOwnProperty(n))return i[n]}return"@language"===n&&n in t||"@direction"===n&&n in t?t[n]:"@context"!==n?null:void 0},v.processingMode=(t,e)=>e.toString()>="1.1"?!t.processingMode||t.processingMode>="json-ld-"+e.toString():"json-ld-1.0"===t.processingMode,v.isKeyword=t=>{if(!s(t)||"@"!==t[0])return!1;switch(t){case"@base":case"@container":case"@context":case"@default":case"@direction":case"@embed":case"@explicit":case"@graph":case"@id":case"@included":case"@index":case"@json":case"@language":case"@list":case"@nest":case"@none":case"@omitDefault":case"@prefix":case"@preserve":case"@protected":case"@requireAll":case"@reverse":case"@set":case"@type":case"@value":case"@version":case"@vocab":return!0}return!1}}}),ya=Jt({"../node_modules/jsonld/lib/expand.js"(t,e){var n=sa(),{isArray:i,isObject:r,isEmptyObject:o,isString:s,isUndefined:a}=ra(),{isList:u,isValue:c,isGraph:l,isSubject:h}=oa(),{expandIri:d,getContextValue:f,isKeyword:p,process:v,processingMode:g}=ba(),{isAbsolute:m}=la(),{addValue:w,asArray:b,getValues:y,validateTypeValue:x}=aa(),k={};e.exports=k;var E=/^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/;async function S({activeCtx:t,activeProperty:e,expandedActiveProperty:l,element:y,expandedParent:F,options:j={},insideList:C,typeKey:R,typeScopedContext:I,expansionMap:T}){const O=Object.keys(y).sort(),N=[];let P;const D=y[R]&&"@json"===d(t,i(y[R])?y[R][0]:y[R],{vocab:!0},j);for(const S of O){let R,O=y[S];if("@context"===S)continue;let M=d(t,S,{vocab:!0},j);if((null===M||!m(M)&&!p(M))&&(M=T({unmappedProperty:S,activeCtx:t,activeProperty:e,parent:y,options:j,insideList:C,value:O,expandedParent:F}),void 0===M))continue;if(p(M)){if("@reverse"===l)throw new n("Invalid JSON-LD syntax; a keyword cannot be used as a @reverse property.","jsonld.SyntaxError",{code:"invalid reverse property map",value:O});if(M in F&&"@included"!==M&&"@type"!==M)throw new n("Invalid JSON-LD syntax; colliding keywords detected.","jsonld.SyntaxError",{code:"colliding keywords",keyword:M})}if("@id"===M){if(!s(O)){if(!j.isFrame)throw new n('Invalid JSON-LD syntax; "@id" value must a string.',"jsonld.SyntaxError",{code:"invalid @id value",value:O});if(r(O)){if(!o(O))throw new n('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:O})}else{if(!i(O))throw new n('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:O});if(!O.every((t=>s(t))))throw new n('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:O})}}w(F,"@id",b(O).map((e=>s(e)?d(t,e,{base:!0},j):e)),{propertyIsArray:j.isFrame});continue}if("@type"===M){r(O)&&(O=Object.fromEntries(Object.entries(O).map((([t,e])=>[d(I,t,{vocab:!0}),b(e).map((t=>d(I,t,{base:!0,vocab:!0})))])))),x(O,j.isFrame),w(F,"@type",b(O).map((t=>s(t)?d(I,t,{base:!0,vocab:!0},j):t)),{propertyIsArray:j.isFrame});continue}if("@included"===M&&g(t,1.1)){const i=b(await k.expand({activeCtx:t,activeProperty:e,element:O,options:j,expansionMap:T}));if(!i.every((t=>h(t))))throw new n("Invalid JSON-LD syntax; values of @included must expand to node objects.","jsonld.SyntaxError",{code:"invalid @included value",value:O});w(F,"@included",i,{propertyIsArray:!0});continue}if("@graph"===M&&!r(O)&&!i(O))throw new n('Invalid JSON-LD syntax; "@graph" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid @graph value",value:O});if("@value"===M){P=O,D&&g(t,1.1)?F["@value"]=O:w(F,"@value",O,{propertyIsArray:j.isFrame});continue}if("@language"===M){if(null===O)continue;if(!s(O)&&!j.isFrame)throw new n('Invalid JSON-LD syntax; "@language" value must be a string.',"jsonld.SyntaxError",{code:"invalid language-tagged string",value:O});O=b(O).map((t=>s(t)?t.toLowerCase():t));for(const t of O)s(t)&&!t.match(E)&&console.warn(`@language must be valid BCP47: ${t}`);w(F,"@language",O,{propertyIsArray:j.isFrame});continue}if("@direction"===M){if(!s(O)&&!j.isFrame)throw new n('Invalid JSON-LD syntax; "@direction" value must be a string.',"jsonld.SyntaxError",{code:"invalid base direction",value:O});O=b(O);for(const t of O)if(s(t)&&"ltr"!==t&&"rtl"!==t)throw new n('Invalid JSON-LD syntax; "@direction" must be "ltr" or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",value:O});w(F,"@direction",O,{propertyIsArray:j.isFrame});continue}if("@index"===M){if(!s(O))throw new n('Invalid JSON-LD syntax; "@index" value must be a string.',"jsonld.SyntaxError",{code:"invalid @index value",value:O});w(F,"@index",O);continue}if("@reverse"===M){if(!r(O))throw new n('Invalid JSON-LD syntax; "@reverse" value must be an object.',"jsonld.SyntaxError",{code:"invalid @reverse value",value:O});if(R=await k.expand({activeCtx:t,activeProperty:"@reverse",element:O,options:j,expansionMap:T}),"@reverse"in R)for(const t in R["@reverse"])w(F,t,R["@reverse"][t],{propertyIsArray:!0});let e=F["@reverse"]||null;for(const t in R){if("@reverse"===t)continue;null===e&&(e=F["@reverse"]={}),w(e,t,[],{propertyIsArray:!0});const i=R[t];for(let r=0;r<i.length;++r){const o=i[r];if(c(o)||u(o))throw new n('Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.',"jsonld.SyntaxError",{code:"invalid reverse property value",value:R});w(e,t,o,{propertyIsArray:!0})}}continue}if("@nest"===M){N.push(S);continue}let U=t;const L=f(t,S,"@context");a(L)||(U=await v({activeCtx:t,localCtx:L,propagate:!0,overrideProtected:!0,options:j}));const B=f(U,S,"@container")||[];if(B.includes("@language")&&r(O))R=A(U,O,f(U,S,"@direction"),j);else if(B.includes("@index")&&r(O)){const e=B.includes("@graph"),n=f(U,S,"@index")||"@index",i="@index"!==n&&d(t,n,{vocab:!0},j);R=await _({activeCtx:U,options:j,activeProperty:S,value:O,expansionMap:T,asGraph:e,indexKey:n,propertyIndex:i})}else if(B.includes("@id")&&r(O)){const t=B.includes("@graph");R=await _({activeCtx:U,options:j,activeProperty:S,value:O,expansionMap:T,asGraph:t,indexKey:"@id"})}else if(B.includes("@type")&&r(O))R=await _({activeCtx:U.revertToPreviousContext(),options:j,activeProperty:S,value:O,expansionMap:T,asGraph:!1,indexKey:"@type"});else{const n="@list"===M;if(n||"@set"===M){let t=e;n&&"@graph"===l&&(t=null),R=await k.expand({activeCtx:U,activeProperty:t,element:O,options:j,insideList:n,expansionMap:T})}else R="@json"===f(t,S,"@type")?{"@type":"@json","@value":O}:await k.expand({activeCtx:U,activeProperty:S,element:O,options:j,insideList:!1,expansionMap:T})}if(null!==R||"@value"===M||(R=T({unmappedValue:O,expandedProperty:M,activeCtx:U,activeProperty:e,parent:y,options:j,insideList:C,key:S,expandedParent:F}),void 0!==R))if("@list"!==M&&!u(R)&&B.includes("@list")&&(R={"@list":b(R)}),B.includes("@graph")&&!B.some((t=>"@id"===t||"@index"===t))&&(R=b(R).map((t=>({"@graph":b(t)})))),U.mappings.has(S)&&U.mappings.get(S).reverse){const t=F["@reverse"]=F["@reverse"]||{};R=b(R);for(let e=0;e<R.length;++e){const i=R[e];if(c(i)||u(i))throw new n('Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.',"jsonld.SyntaxError",{code:"invalid reverse property value",value:R});w(t,M,i,{propertyIsArray:!0})}}else w(F,M,R,{propertyIsArray:!0})}if("@value"in F)if("@json"===F["@type"]&&g(t,1.1));else if((r(P)||i(P))&&!j.isFrame)throw new n('Invalid JSON-LD syntax; "@value" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid value object value",value:P});for(const o of N){const s=i(y[o])?y[o]:[y[o]];for(const i of s){if(!r(i)||Object.keys(i).some((e=>"@value"===d(t,e,{vocab:!0},j))))throw new n("Invalid JSON-LD syntax; nested value must be a node object.","jsonld.SyntaxError",{code:"invalid @nest value",value:i});await S({activeCtx:t,activeProperty:e,expandedActiveProperty:l,element:i,expandedParent:F,options:j,insideList:C,typeScopedContext:I,typeKey:R,expansionMap:T})}}}function F({activeCtx:t,activeProperty:e,value:n,options:i}){if(null==n)return null;const r=d(t,e,{vocab:!0},i);if("@id"===r)return d(t,n,{base:!0},i);if("@type"===r)return d(t,n,{vocab:!0,base:!0},i);const o=f(t,e,"@type");if(("@id"===o||"@graph"===r)&&s(n))return{"@id":d(t,n,{base:!0},i)};if("@vocab"===o&&s(n))return{"@id":d(t,n,{vocab:!0,base:!0},i)};if(p(r))return n;const a={};if(o&&!["@id","@vocab","@none"].includes(o))a["@type"]=o;else if(s(n)){const n=f(t,e,"@language");null!==n&&(a["@language"]=n);const i=f(t,e,"@direction");null!==i&&(a["@direction"]=i)}return["boolean","number","string"].includes(typeof n)||(n=n.toString()),a["@value"]=n,a}function A(t,e,r,o){const a=[],u=Object.keys(e).sort();for(const c of u){const u=d(t,c,{vocab:!0},o);let l=e[c];i(l)||(l=[l]);for(const t of l){if(null===t)continue;if(!s(t))throw new n("Invalid JSON-LD syntax; language map values must be strings.","jsonld.SyntaxError",{code:"invalid language map value",languageMap:e});const i={"@value":t};"@none"!==u&&(i["@language"]=c.toLowerCase()),r&&(i["@direction"]=r),a.push(i)}}return a}async function _({activeCtx:t,options:e,activeProperty:r,value:o,expansionMap:s,asGraph:u,indexKey:h,propertyIndex:p}){const g=[],m=Object.keys(o).sort(),b="@type"===h;for(let y of m){if(b){const n=f(t,y,"@context");a(n)||(t=await v({activeCtx:t,localCtx:n,propagate:!1,options:e}))}let m,x=o[y];i(x)||(x=[x]),x=await k.expand({activeCtx:t,activeProperty:r,element:x,options:e,insideList:!1,insideIndex:!0,expansionMap:s}),m=p?"@none"===y?"@none":F({activeCtx:t,activeProperty:h,value:y,options:e}):d(t,y,{vocab:!0},e),"@id"===h?y=d(t,y,{base:!0},e):b&&(y=m);for(let t of x){if(u&&!l(t)&&(t={"@graph":[t]}),"@type"===h)"@none"===m||(t["@type"]=t["@type"]?[y].concat(t["@type"]):[y]);else{if(c(t)&&!["@language","@type","@index"].includes(h))throw new n(`Invalid JSON-LD syntax; Attempt to add illegal key to value object: "${h}".`,"jsonld.SyntaxError",{code:"invalid value object",value:t});p?"@none"!==m&&w(t,p,m,{propertyIsArray:!0,prependValue:!0}):"@none"===m||h in t||(t[h]=y)}g.push(t)}}return g}k.expand=async({activeCtx:t,activeProperty:e=null,element:u,options:c={},insideList:l=!1,insideIndex:h=!1,typeScopedContext:p=null,expansionMap:w=(()=>{})})=>{if(null==u)return null;if("@default"===e&&(c=Object.assign({},c,{isFrame:!1})),!i(u)&&!r(u)){if(!l&&(null===e||"@graph"===d(t,e,{vocab:!0},c))){const n=await w({unmappedValue:u,activeCtx:t,activeProperty:e,options:c,insideList:l});return void 0===n?null:n}return F({activeCtx:t,activeProperty:e,value:u,options:c})}if(i(u)){let n=[];const r=f(t,e,"@container")||[];l=l||r.includes("@list");for(let r=0;r<u.length;++r){let o=await k.expand({activeCtx:t,activeProperty:e,element:u[r],options:c,expansionMap:w,insideIndex:h,typeScopedContext:p});l&&i(o)&&(o={"@list":o}),null===o&&(o=await w({unmappedValue:u[r],activeCtx:t,activeProperty:e,parent:u,index:r,options:c,expandedParent:n,insideList:l}),void 0===o)||(i(o)?n=n.concat(o):n.push(o))}return n}const x=d(t,e,{vocab:!0},c),E=f(t,e,"@context");p=p||(t.previousContext?t:null);let A=Object.keys(u).sort(),_=!h;if(_&&p&&A.length<=2&&!A.includes("@context"))for(const e of A){const n=d(p,e,{vocab:!0},c);if("@value"===n){_=!1,t=p;break}if("@id"===n&&1===A.length){_=!1;break}}_&&(t=t.revertToPreviousContext()),a(E)||(t=await v({activeCtx:t,localCtx:E,propagate:!0,overrideProtected:!0,options:c})),"@context"in u&&(t=await v({activeCtx:t,localCtx:u["@context"],options:c})),p=t;let j=null;for(const e of A)if("@type"===d(t,e,{vocab:!0},c)){j=j||e;const n=u[e],i=Array.isArray(n)?n.length>1?n.slice().sort():n:[n];for(const e of i){const n=f(p,e,"@context");a(n)||(t=await v({activeCtx:t,localCtx:n,options:c,propagate:!1}))}}let C={};await S({activeCtx:t,activeProperty:e,expandedActiveProperty:x,element:u,expandedParent:C,options:c,insideList:l,typeKey:j,typeScopedContext:p,expansionMap:w}),A=Object.keys(C);let R=A.length;if("@value"in C){if("@type"in C&&("@language"in C||"@direction"in C))throw new n('Invalid JSON-LD syntax; an element containing "@value" may not contain both "@type" and either "@language" or "@direction".',"jsonld.SyntaxError",{code:"invalid value object",element:C});let i=R-1;if("@type"in C&&(i-=1),"@index"in C&&(i-=1),"@language"in C&&(i-=1),"@direction"in C&&(i-=1),0!==i)throw new n('Invalid JSON-LD syntax; an element containing "@value" may only have an "@index" property and either "@type" or either or both "@language" or "@direction".',"jsonld.SyntaxError",{code:"invalid value object",element:C});const r=null===C["@value"]?[]:b(C["@value"]),a=y(C,"@type");if(g(t,1.1)&&a.includes("@json")&&1===a.length);else if(0===r.length){const n=await w({unmappedValue:C,activeCtx:t,activeProperty:e,element:u,options:c,insideList:l});C=void 0!==n?n:null}else{if(!r.every((t=>s(t)||o(t)))&&"@language"in C)throw new n("Invalid JSON-LD syntax; only strings may be language-tagged.","jsonld.SyntaxError",{code:"invalid language-tagged value",element:C});if(!a.every((t=>m(t)&&!(s(t)&&0===t.indexOf("_:"))||o(t))))throw new n('Invalid JSON-LD syntax; an element containing "@value" and "@type" must have an absolute IRI for the value of "@type".',"jsonld.SyntaxError",{code:"invalid typed value",element:C})}}else if("@type"in C&&!i(C["@type"]))C["@type"]=[C["@type"]];else if("@set"in C||"@list"in C){if(R>1&&(2!==R||!("@index"in C)))throw new n('Invalid JSON-LD syntax; if an element has the property "@set" or "@list", then it can have at most one other property that is "@index".',"jsonld.SyntaxError",{code:"invalid set or list object",element:C});"@set"in C&&(C=C["@set"],A=Object.keys(C),R=A.length)}else if(1===R&&"@language"in C){const n=await w(C,{unmappedValue:C,activeCtx:t,activeProperty:e,element:u,options:c,insideList:l});C=void 0!==n?n:null}if(r(C)&&!c.keepFreeFloatingNodes&&!l&&(null===e||"@graph"===x)&&(0===R||"@value"in C||"@list"in C||1===R&&"@id"in C)){const n=await w({unmappedValue:C,activeCtx:t,activeProperty:e,element:u,options:c,insideList:l});C=void 0!==n?n:null}return C}}}),xa=Jt({"../node_modules/jsonld/lib/nodeMap.js"(t,e){var{isKeyword:n}=ba(),i=oa(),r=ra(),o=aa(),s=sa(),a={};e.exports=a,a.createMergedNodeMap=(t,e)=>{const n=(e=e||{}).issuer||new o.IdentifierIssuer("_:b"),i={"@default":{}};return a.createNodeMap(t,i,"@default",n),a.mergeNodeMaps(i)},a.createNodeMap=(t,e,u,c,l,h)=>{if(r.isArray(t)){for(const n of t)a.createNodeMap(n,e,u,c,void 0,h);return}if(!r.isObject(t))return void(h&&h.push(t));if(i.isValue(t)){if("@type"in t){let e=t["@type"];0===e.indexOf("_:")&&(t["@type"]=e=c.getId(e))}return void(h&&h.push(t))}if(h&&i.isList(t)){const n=[];return a.createNodeMap(t["@list"],e,u,c,l,n),void h.push({"@list":n})}if("@type"in t){const e=t["@type"];for(const t of e)0===t.indexOf("_:")&&c.getId(t)}r.isUndefined(l)&&(l=i.isBlankNode(t)?c.getId(t["@id"]):t["@id"]),h&&h.push({"@id":l});const d=e[u],f=d[l]=d[l]||{};f["@id"]=l;const p=Object.keys(t).sort();for(let r of p){if("@id"===r)continue;if("@reverse"===r){const n={"@id":l},r=t["@reverse"];for(const t in r){const s=r[t];for(const r of s){let s=r["@id"];i.isBlankNode(r)&&(s=c.getId(s)),a.createNodeMap(r,e,u,c,s),o.addValue(d[s],t,n,{propertyIsArray:!0,allowDuplicate:!1})}}continue}if("@graph"===r){l in e||(e[l]={}),a.createNodeMap(t[r],e,l,c);continue}if("@included"===r){a.createNodeMap(t[r],e,u,c);continue}if("@type"!==r&&n(r)){if("@index"===r&&r in f&&(t[r]!==f[r]||t[r]["@id"]!==f[r]["@id"]))throw new s("Invalid JSON-LD syntax; conflicting @index property detected.","jsonld.SyntaxError",{code:"conflicting indexes",subject:f});f[r]=t[r];continue}const h=t[r];if(0===r.indexOf("_:")&&(r=c.getId(r)),0!==h.length)for(let t of h)if("@type"===r&&(t=0===t.indexOf("_:")?c.getId(t):t),i.isSubject(t)||i.isSubjectReference(t)){if("@id"in t&&!t["@id"])continue;const n=i.isBlankNode(t)?c.getId(t["@id"]):t["@id"];o.addValue(f,r,{"@id":n},{propertyIsArray:!0,allowDuplicate:!1}),a.createNodeMap(t,e,u,c,n)}else if(i.isValue(t))o.addValue(f,r,t,{propertyIsArray:!0,allowDuplicate:!1});else if(i.isList(t)){const n=[];a.createNodeMap(t["@list"],e,u,c,l,n),t={"@list":n},o.addValue(f,r,t,{propertyIsArray:!0,allowDuplicate:!1})}else a.createNodeMap(t,e,u,c,l),o.addValue(f,r,t,{propertyIsArray:!0,allowDuplicate:!1});else o.addValue(f,r,[],{propertyIsArray:!0})}},a.mergeNodeMapGraphs=t=>{const e={};for(const i of Object.keys(t).sort())for(const r of Object.keys(t[i]).sort()){const s=t[i][r];r in e||(e[r]={"@id":r});const a=e[r];for(const t of Object.keys(s).sort())if(n(t)&&"@type"!==t)a[t]=o.clone(s[t]);else for(const e of s[t])o.addValue(a,t,o.clone(e),{propertyIsArray:!0,allowDuplicate:!1})}return e},a.mergeNodeMaps=t=>{const e=t["@default"],n=Object.keys(t).sort();for(const r of n){if("@default"===r)continue;const n=t[r];let o=e[r];o?"@graph"in o||(o["@graph"]=[]):e[r]=o={"@id":r,"@graph":[]};const s=o["@graph"];for(const t of Object.keys(n).sort()){const e=n[t];i.isSubjectReference(e)||s.push(e)}}return e}}}),ka=Jt({"../node_modules/jsonld/lib/flatten.js"(t,e){var{isSubjectReference:n}=oa(),{createMergedNodeMap:i}=xa(),r={};e.exports=r,r.flatten=t=>{const e=i(t),r=[],o=Object.keys(e).sort();for(let t=0;t<o.length;++t){const i=e[o[t]];n(i)||r.push(i)}return r}}}),Ea=Jt({"../node_modules/jsonld/lib/fromRdf.js"(t,e){var n=sa(),i=oa(),r=ra(),o=aa(),{RDF_LIST:s,RDF_FIRST:a,RDF_REST:u,RDF_NIL:c,RDF_TYPE:l,RDF_JSON_LITERAL:h,XSD_BOOLEAN:d,XSD_DOUBLE:f,XSD_INTEGER:p,XSD_STRING:v}=ua(),g=/^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/,m={};function w(t,e,i){if(t.termType.endsWith("Node"))return{"@id":t.value};const o={"@value":t.value};if(t.language)o["@language"]=t.language;else{let s=t.datatype.value;if(s||(s=v),s===h){s="@json";try{o["@value"]=JSON.parse(o["@value"])}catch(t){throw new n("JSON literal could not be parsed.","jsonld.InvalidJsonLiteral",{code:"invalid JSON literal",value:o["@value"],cause:t})}}if(e){if(s===d)"true"===o["@value"]?o["@value"]=!0:"false"===o["@value"]&&(o["@value"]=!1);else if(r.isNumeric(o["@value"]))if(s===p){const t=parseInt(o["@value"],10);t.toFixed(0)===o["@value"]&&(o["@value"]=t)}else s===f&&(o["@value"]=parseFloat(o["@value"]));[d,p,f,v].includes(s)||(o["@type"]=s)}else if("i18n-datatype"===i&&s.startsWith("https://www.w3.org/ns/i18n#")){const[,t,e]=s.split(/[#_]/);t.length>0&&(o["@language"]=t,t.match(g)||console.warn(`@language must be valid BCP47: ${t}`)),o["@direction"]=e}else s!==v&&(o["@type"]=s)}return o}e.exports=m,m.fromRDF=async(t,{useRdfType:e=!1,useNativeTypes:n=!1,rdfDirection:h=null})=>{const d={},f={"@default":d},p={};for(const i of t){const t="DefaultGraph"===i.graph.termType?"@default":i.graph.value;t in f||(f[t]={}),"@default"===t||t in d||(d[t]={"@id":t});const r=f[t],s=i.subject.value,a=i.predicate.value,u=i.object;s in r||(r[s]={"@id":s});const v=r[s],g=u.termType.endsWith("Node");if(g&&!(u.value in r)&&(r[u.value]={"@id":u.value}),a===l&&!e&&g){o.addValue(v,"@type",u.value,{propertyIsArray:!0});continue}const m=w(u,n,h);if(o.addValue(v,a,m,{propertyIsArray:!0}),g)if(u.value===c){const t=r[u.value];"usages"in t||(t.usages=[]),t.usages.push({node:v,property:a,value:m})}else p[u.value]=!(u.value in p)&&{node:v,property:a,value:m}}for(const t in f){const e=f[t];if(!(c in e))continue;const n=e[c];if(n.usages){for(let t of n.usages){let n=t.node,o=t.property,c=t.value;const l=[],h=[];let d=Object.keys(n).length;for(;o===u&&r.isObject(p[n["@id"]])&&r.isArray(n[a])&&1===n[a].length&&r.isArray(n[u])&&1===n[u].length&&(3===d||4===d&&r.isArray(n["@type"])&&1===n["@type"].length&&n["@type"][0]===s)&&(l.push(n[a][0]),h.push(n["@id"]),t=p[n["@id"]],n=t.node,o=t.property,c=t.value,d=Object.keys(n).length,i.isBlankNode(n)););delete c["@id"],c["@list"]=l.reverse();for(const t of h)delete e[t]}delete n.usages}}const v=[],g=Object.keys(d).sort();for(const t of g){const e=d[t];if(t in f){const n=e["@graph"]=[],r=f[t],o=Object.keys(r).sort();for(const t of o){const e=r[t];i.isSubjectReference(e)||n.push(e)}}i.isSubjectReference(e)||v.push(e)}return v}}}),Sa=Jt({"../node_modules/canonicalize/lib/canonicalize.js"(t,e){e.exports=function t(e){return null===e||"object"!=typeof e||null!=e.toJSON?JSON.stringify(e):Array.isArray(e)?"["+e.reduce(((e,n,i)=>e+(0===i?"":",")+t(void 0===n||"symbol"==typeof n?null:n)),"")+"]":"{"+Object.keys(e).sort().reduce(((n,i)=>void 0===e[i]||"symbol"==typeof e[i]?n:n+(0===n.length?"":",")+t(i)+":"+t(e[i])),"")+"}"}}}),Fa=Jt({"../node_modules/jsonld/lib/toRdf.js"(t,e){var{createNodeMap:n}=xa(),{isKeyword:i}=ba(),r=oa(),o=Sa(),s=ra(),a=aa(),{RDF_FIRST:u,RDF_REST:c,RDF_NIL:l,RDF_TYPE:h,RDF_JSON_LITERAL:d,RDF_LANGSTRING:f,XSD_BOOLEAN:p,XSD_DOUBLE:v,XSD_INTEGER:g,XSD_STRING:m}=ua(),{isAbsolute:w}=la(),b={};function y(t,e,n,r,o){const s=Object.keys(e).sort();for(const a of s){const s=e[a],u=Object.keys(s).sort();for(let e of u){const u=s[e];if("@type"===e)e=h;else if(i(e))continue;for(const i of u){const s={termType:a.startsWith("_:")?"BlankNode":"NamedNode",value:a};if(!w(a))continue;const u={termType:e.startsWith("_:")?"BlankNode":"NamedNode",value:e};if(!w(e))continue;if("BlankNode"===u.termType&&!o.produceGeneralizedRdf)continue;const c=x(i,r,t,n,o.rdfDirection);c&&t.push({subject:s,predicate:u,object:c,graph:n})}}}}function x(t,e,n,i,a){const h={};if(r.isValue(t)){h.termType="Literal",h.value=void 0,h.datatype={termType:"NamedNode"};let e=t["@value"];const n=t["@type"]||null;"@json"===n?(h.value=o(e),h.datatype.value=d):s.isBoolean(e)?(h.value=e.toString(),h.datatype.value=n||p):s.isDouble(e)||n===v?(s.isDouble(e)||(e=parseFloat(e)),h.value=e.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),h.datatype.value=n||v):s.isNumber(e)?(h.value=e.toFixed(0),h.datatype.value=n||g):"i18n-datatype"===a&&"@direction"in t?(h.datatype.value="https://www.w3.org/ns/i18n#"+(t["@language"]||"")+`_${t["@direction"]}`,h.value=e):"@language"in t?(h.value=e,h.datatype.value=n||f,h.language=t["@language"]):(h.value=e,h.datatype.value=n||m)}else if(r.isList(t)){const r=function(t,e,n,i,r){const o={termType:"NamedNode",value:u},s={termType:"NamedNode",value:c},a={termType:"NamedNode",value:l},h=t.pop(),d=h?{termType:"BlankNode",value:e.getId()}:a;let f=d;for(const a of t){const t=x(a,e,n,i,r),u={termType:"BlankNode",value:e.getId()};n.push({subject:f,predicate:o,object:t,graph:i}),n.push({subject:f,predicate:s,object:u,graph:i}),f=u}if(h){const t=x(h,e,n,i,r);n.push({subject:f,predicate:o,object:t,graph:i}),n.push({subject:f,predicate:s,object:a,graph:i})}return d}(t["@list"],e,n,i,a);h.termType=r.termType,h.value=r.value}else{const e=s.isObject(t)?t["@id"]:t;h.termType=e.startsWith("_:")?"BlankNode":"NamedNode",h.value=e}return"NamedNode"!==h.termType||w(h.value)?h:null}e.exports=b,b.toRDF=(t,e)=>{const i=new a.IdentifierIssuer("_:b"),r={"@default":{}};n(t,r,"@default",i);const o=[],s=Object.keys(r).sort();for(const t of s){let n;if("@default"===t)n={termType:"DefaultGraph",value:""};else{if(!w(t))continue;n=t.startsWith("_:")?{termType:"BlankNode"}:{termType:"NamedNode"},n.value=t}y(o,r[t],n,i,e)}return o}}}),Aa=Jt({"../node_modules/jsonld/lib/frame.js"(t,e){var{isKeyword:n}=ba(),i=oa(),r=ra(),o=aa(),s=la(),a=sa(),{createNodeMap:u,mergeNodeMapGraphs:c}=xa(),l={};function h(t){const e={};for(const n in t)void 0!==t[n]&&(e["@"+n]=[t[n]]);return[e]}function d(t,e,n){for(let i=n.length-1;i>=0;--i){const r=n[i];if(r.graph===e&&r.subject["@id"]===t["@id"])return!0}return!1}function f(t,e,n){const i="@"+n;let r=i in t?t[i][0]:e[n];if("embed"===n)if(!0===r)r="@once";else if(!1===r)r="@never";else if("@always"!==r&&"@never"!==r&&"@link"!==r&&"@first"!==r&&"@last"!==r&&"@once"!==r)throw new a("Invalid JSON-LD syntax; invalid value of @embed.","jsonld.SyntaxError",{code:"invalid @embed value",frame:t});return r}function p(t){if(!r.isArray(t)||1!==t.length||!r.isObject(t[0]))throw new a("Invalid JSON-LD syntax; a JSON-LD frame must be a single object.","jsonld.SyntaxError",{frame:t});if("@id"in t[0])for(const e of o.asArray(t[0]["@id"]))if(!r.isObject(e)&&!s.isAbsolute(e)||r.isString(e)&&0===e.indexOf("_:"))throw new a("Invalid JSON-LD syntax; invalid @id in frame.","jsonld.SyntaxError",{code:"invalid frame",frame:t});if("@type"in t[0])for(const e of o.asArray(t[0]["@type"]))if(!r.isObject(e)&&!s.isAbsolute(e)||r.isString(e)&&0===e.indexOf("_:"))throw new a("Invalid JSON-LD syntax; invalid @type in frame.","jsonld.SyntaxError",{code:"invalid frame",frame:t})}function v(t,e,s,a){let u=!0,c=!1;for(const l in s){let h=!1;const d=o.getValues(e,l),f=0===o.getValues(s,l).length;if("@id"===l){if(r.isEmptyObject(s["@id"][0]||{})?h=!0:s["@id"].length>=0&&(h=s["@id"].includes(d[0])),!a.requireAll)return h}else if("@type"===l){if(u=!1,f){if(d.length>0)return!1;h=!0}else if(1===s["@type"].length&&r.isEmptyObject(s["@type"][0]))h=d.length>0;else for(const t of s["@type"])h=!(!r.isObject(t)||!("@default"in t))||h||d.some((e=>e===t));if(!a.requireAll)return h}else{if(n(l))continue;{const e=o.getValues(s,l)[0];let n=!1;if(e&&(p([e]),n="@default"in e),u=!1,0===d.length&&n)continue;if(d.length>0&&f)return!1;if(void 0===e){if(d.length>0)return!1;h=!0}else if(i.isList(e)){const n=e["@list"][0];if(i.isList(d[0])){const e=d[0]["@list"];i.isValue(n)?h=e.some((t=>y(n,t))):(i.isSubject(n)||i.isSubjectReference(n))&&(h=e.some((e=>b(t,n,e,a))))}}else h=i.isValue(e)?d.some((t=>y(e,t))):i.isSubjectReference(e)?d.some((n=>b(t,e,n,a))):!!r.isObject(e)&&d.length>0}}if(!h&&a.requireAll)return!1;c=c||h}return u||c}function g(t,e){const n=t.uniqueEmbeds[t.graph],i=n[e],s=i.parent,a=i.property,u={"@id":e};if(r.isArray(s)){for(let t=0;t<s.length;++t)if(o.compareValues(s[t],u)){s[t]=u;break}}else{const t=r.isArray(s[a]);o.removeValue(s,a,u,{propertyIsArray:t}),o.addValue(s,a,u,{propertyIsArray:t})}const c=t=>{const e=Object.keys(n);for(const i of e)i in n&&r.isObject(n[i].parent)&&n[i].parent["@id"]===t&&(delete n[i],c(i))};c(e)}function m(t,e){if(r.isArray(t))return t.map((t=>m(t,e)));if(r.isObject(t)){if("@preserve"in t)return t["@preserve"][0];if(i.isValue(t))return t;if(i.isList(t))return t["@list"]=m(t["@list"],e),t;if("@id"in t){const n=t["@id"];if(e.link.hasOwnProperty(n)){const i=e.link[n].indexOf(t);if(-1!==i)return e.link[n][i];e.link[n].push(t)}else e.link[n]=[t]}for(const n in t)"@id"===n&&e.bnodesToClear.includes(t[n])?delete t["@id"]:t[n]=m(t[n],e)}return t}function w(t,e,n){r.isObject(t)?o.addValue(t,e,n,{propertyIsArray:!0}):t.push(n)}function b(t,e,n,i){if(!("@id"in n))return!1;const r=t.subjects[n["@id"]];return r&&v(t,r,e,i)}function y(t,e){const n=e["@value"],i=e["@type"],o=e["@language"],s=t["@value"]?r.isArray(t["@value"])?t["@value"]:[t["@value"]]:[],a=t["@type"]?r.isArray(t["@type"])?t["@type"]:[t["@type"]]:[],u=t["@language"]?r.isArray(t["@language"])?t["@language"]:[t["@language"]]:[];return 0===s.length&&0===a.length&&0===u.length||!(!s.includes(n)&&!r.isEmptyObject(s[0]))&&!!(!i&&0===a.length||a.includes(i)||i&&r.isEmptyObject(a[0]))&&!!(!o&&0===u.length||u.includes(o)||o&&r.isEmptyObject(u[0]))}e.exports=l,l.frameMergedOrDefault=(t,e,n)=>{const i={options:n,embedded:!1,graph:"@default",graphMap:{"@default":{}},subjectStack:[],link:{},bnodeMap:{}},r=new o.IdentifierIssuer("_:b");u(t,i.graphMap,"@default",r),n.merged&&(i.graphMap["@merged"]=c(i.graphMap),i.graph="@merged"),i.subjects=i.graphMap[i.graph];const s=[];return l.frame(i,Object.keys(i.subjects).sort(),e,s),n.pruneBlankNodeIdentifiers&&(n.bnodesToClear=Object.keys(i.bnodeMap).filter((t=>1===i.bnodeMap[t].length))),n.link={},m(s,n)},l.frame=(t,e,s,u,c=null)=>{p(s);const m=t.options,b={embed:f(s=s[0],m,"embed"),explicit:f(s,m,"explicit"),requireAll:f(s,m,"requireAll")};t.link.hasOwnProperty(t.graph)||(t.link[t.graph]={});const x=t.link[t.graph],k=function(t,e,n,i){const r={};for(const o of e){const e=t.graphMap[t.graph][o];v(t,e,n,i)&&(r[o]=e)}return r}(t,e,s,b),E=Object.keys(k).sort();for(const p of E){const v=k[p];if(null===c?t.uniqueEmbeds={[t.graph]:{}}:t.uniqueEmbeds[t.graph]=t.uniqueEmbeds[t.graph]||{},"@link"===b.embed&&p in x){w(u,c,x[p]);continue}const E={"@id":p};if(0===p.indexOf("_:")&&o.addValue(t.bnodeMap,p,E,{propertyIsArray:!0}),x[p]=E,("@first"===b.embed||"@last"===b.embed)&&t.is11)throw new a("Invalid JSON-LD syntax; invalid value of @embed.","jsonld.SyntaxError",{code:"invalid @embed value",frame:s});if(t.embedded||!t.uniqueEmbeds[t.graph].hasOwnProperty(p))if(!t.embedded||"@never"!==b.embed&&!d(v,t.graph,t.subjectStack))if(!t.embedded||"@first"!=b.embed&&"@once"!=b.embed||!t.uniqueEmbeds[t.graph].hasOwnProperty(p)){if("@last"===b.embed&&p in t.uniqueEmbeds[t.graph]&&g(t,p),t.uniqueEmbeds[t.graph][p]={parent:u,property:c},t.subjectStack.push({subject:v,graph:t.graph}),p in t.graphMap){let e=!1,n=null;"@graph"in s?(n=s["@graph"][0],e=!("@merged"===p||"@default"===p),r.isObject(n)||(n={})):(e="@merged"!==t.graph,n={}),e&&l.frame({...t,graph:p,embedded:!1},Object.keys(t.graphMap[p]).sort(),[n],E,"@graph")}"@included"in s&&l.frame({...t,embedded:!1},e,s["@included"],E,"@included");for(const e of Object.keys(v).sort())if(n(e)){if(E[e]=o.clone(v[e]),"@type"===e)for(const e of v["@type"])0===e.indexOf("_:")&&o.addValue(t.bnodeMap,e,E,{propertyIsArray:!0})}else if(!b.explicit||e in s)for(const n of v[e]){const r=e in s?s[e]:h(b);if(i.isList(n)){const r=s[e]&&s[e][0]&&s[e][0]["@list"]?s[e][0]["@list"]:h(b),a={"@list":[]};w(E,e,a);const u=n["@list"];for(const e of u)i.isSubjectReference(e)?l.frame({...t,embedded:!0},[e["@id"]],r,a,"@list"):w(a,"@list",o.clone(e))}else i.isSubjectReference(n)?l.frame({...t,embedded:!0},[n["@id"]],r,E,e):y(r[0],n)&&w(E,e,o.clone(n))}for(const t of Object.keys(s).sort()){if("@type"===t){if(!r.isObject(s[t][0])||!("@default"in s[t][0]))continue}else if(n(t))continue;const e=s[t][0]||{};if(!f(e,m,"omitDefault")&&!(t in E)){let n="@null";"@default"in e&&(n=o.clone(e["@default"])),r.isArray(n)||(n=[n]),E[t]=[{"@preserve":n}]}}for(const e of Object.keys(s["@reverse"]||{}).sort()){const n=s["@reverse"][e];for(const i of Object.keys(t.subjects))o.getValues(t.subjects[i],e).some((t=>t["@id"]===p))&&(E["@reverse"]=E["@reverse"]||{},o.addValue(E["@reverse"],e,[],{propertyIsArray:!0}),l.frame({...t,embedded:!0},[i],n,E["@reverse"][e],c))}w(u,c,E),t.subjectStack.pop()}else w(u,c,E);else w(u,c,E)}},l.cleanupNull=(t,e)=>{if(r.isArray(t))return t.map((t=>l.cleanupNull(t,e))).filter((t=>t));if("@null"===t)return null;if(r.isObject(t)){if("@id"in t){const n=t["@id"];if(e.link.hasOwnProperty(n)){const i=e.link[n].indexOf(t);if(-1!==i)return e.link[n][i];e.link[n].push(t)}else e.link[n]=[t]}for(const n in t)t[n]=l.cleanupNull(t[n],e)}return t}}}),_a=Jt({"../node_modules/jsonld/lib/compact.js"(t,e){var n=sa(),{isArray:i,isObject:r,isString:o,isUndefined:s}=ra(),{isList:a,isValue:u,isGraph:c,isSimpleGraph:l,isSubjectReference:h}=oa(),{expandIri:d,getContextValue:f,isKeyword:p,process:v,processingMode:g}=ba(),{removeBase:m,prependBase:w}=la(),{addValue:b,asArray:y,compareShortestLeast:x}=aa(),k={};function E(t,e,i){if("@nest"!==d(t,e,{vocab:!0},i))throw new n("JSON-LD compact error; nested property must have an @nest value resolving to @nest.","jsonld.SyntaxError",{code:"invalid @nest value"})}e.exports=k,k.compact=async({activeCtx:t,activeProperty:e=null,element:d,options:m={},compactionMap:w=(()=>{})})=>{if(i(d)){let n=[];for(let i=0;i<d.length;++i){let r=await k.compact({activeCtx:t,activeProperty:e,element:d[i],options:m,compactionMap:w});null===r&&(r=await w({unmappedValue:d[i],activeCtx:t,activeProperty:e,parent:d,index:i,options:m}),void 0===r)||n.push(r)}return m.compactArrays&&1===n.length&&0===(f(t,e,"@container")||[]).length&&(n=n[0]),n}const x=f(t,e,"@context");if(s(x)||(t=await v({activeCtx:t,localCtx:x,propagate:!0,overrideProtected:!0,options:m})),r(d)){if(m.link&&"@id"in d&&m.link.hasOwnProperty(d["@id"])){const t=m.link[d["@id"]];for(let e=0;e<t.length;++e)if(t[e].expanded===d)return t[e].compacted}if(u(d)||h(d)){const n=k.compactValue({activeCtx:t,activeProperty:e,value:d,options:m});return m.link&&h(d)&&(m.link.hasOwnProperty(d["@id"])||(m.link[d["@id"]]=[]),m.link[d["@id"]].push({expanded:d,compacted:n})),n}if(a(d)&&(f(t,e,"@container")||[]).includes("@list"))return k.compact({activeCtx:t,activeProperty:e,element:d["@list"],options:m,compactionMap:w});const x="@reverse"===e,S={},F=t;u(d)||h(d)||(t=t.revertToPreviousContext());const A=f(F,e,"@context");s(A)||(t=await v({activeCtx:t,localCtx:A,propagate:!0,overrideProtected:!0,options:m})),m.link&&"@id"in d&&(m.link.hasOwnProperty(d["@id"])||(m.link[d["@id"]]=[]),m.link[d["@id"]].push({expanded:d,compacted:S}));let _=d["@type"]||[];_.length>1&&(_=Array.from(_).sort());const j=t;for(const e of _){const n=k.compactIri({activeCtx:j,iri:e,relativeTo:{vocab:!0}}),i=f(F,n,"@context");s(i)||(t=await v({activeCtx:t,localCtx:i,options:m,propagate:!1}))}const C=Object.keys(d).sort();for(const s of C){const h=d[s];if("@id"!==s)if("@type"!==s)if("@reverse"!==s)if("@preserve"!==s)if("@index"!==s)if("@graph"!==s&&"@list"!==s&&"@included"!==s&&p(s)){const e=k.compactIri({activeCtx:t,iri:s,relativeTo:{vocab:!0}});b(S,e,h)}else{if(!i(h))throw new n("JSON-LD expansion error; expanded value must be an array.","jsonld.SyntaxError");if(0===h.length){const e=k.compactIri({activeCtx:t,iri:s,value:h,relativeTo:{vocab:!0},reverse:x}),n=t.mappings.has(e)?t.mappings.get(e)["@nest"]:null;let i=S;n&&(E(t,n,m),r(S[n])||(S[n]={}),i=S[n]),b(i,e,h,{propertyIsArray:!0})}for(const e of h){const n=k.compactIri({activeCtx:t,iri:s,value:e,relativeTo:{vocab:!0},reverse:x}),h=t.mappings.has(n)?t.mappings.get(n)["@nest"]:null;let d=S;h&&(E(t,h,m),r(S[h])||(S[h]={}),d=S[h]);const p=f(t,n,"@container")||[],v=c(e),g=a(e);let F;g?F=e["@list"]:v&&(F=e["@graph"]);let A=await k.compact({activeCtx:t,activeProperty:n,element:g||v?F:e,options:m,compactionMap:w});if(g){if(i(A)||(A=[A]),p.includes("@list")){b(d,n,A,{valueIsArray:!0,allowDuplicate:!0});continue}A={[k.compactIri({activeCtx:t,iri:"@list",relativeTo:{vocab:!0}})]:A},"@index"in e&&(A[k.compactIri({activeCtx:t,iri:"@index",relativeTo:{vocab:!0}})]=e["@index"])}if(v)if(p.includes("@graph")&&(p.includes("@id")||p.includes("@index")&&l(e))){let i;d.hasOwnProperty(n)?i=d[n]:d[n]=i={};const r=(p.includes("@id")?e["@id"]:e["@index"])||k.compactIri({activeCtx:t,iri:"@none",relativeTo:{vocab:!0}});b(i,r,A,{propertyIsArray:!m.compactArrays||p.includes("@set")})}else p.includes("@graph")&&l(e)?(i(A)&&A.length>1&&(A={"@included":A}),b(d,n,A,{propertyIsArray:!m.compactArrays||p.includes("@set")})):(i(A)&&1===A.length&&m.compactArrays&&(A=A[0]),A={[k.compactIri({activeCtx:t,iri:"@graph",relativeTo:{vocab:!0}})]:A},"@id"in e&&(A[k.compactIri({activeCtx:t,iri:"@id",relativeTo:{vocab:!0}})]=e["@id"]),"@index"in e&&(A[k.compactIri({activeCtx:t,iri:"@index",relativeTo:{vocab:!0}})]=e["@index"]),b(d,n,A,{propertyIsArray:!m.compactArrays||p.includes("@set")}));else if(p.includes("@language")||p.includes("@index")||p.includes("@id")||p.includes("@type")){let i,r;if(d.hasOwnProperty(n)?i=d[n]:d[n]=i={},p.includes("@language"))u(A)&&(A=A["@value"]),r=e["@language"];else if(p.includes("@index")){const i=f(t,n,"@index")||"@index",s=k.compactIri({activeCtx:t,iri:i,relativeTo:{vocab:!0}});if("@index"===i)r=e["@index"],delete A[s];else{let t;if([r,...t]=y(A[i]||[]),o(r))switch(t.length){case 0:delete A[i];break;case 1:A[i]=t[0];break;default:A[i]=t}else r=null}}else if(p.includes("@id")){const e=k.compactIri({activeCtx:t,iri:"@id",relativeTo:{vocab:!0}});r=A[e],delete A[e]}else if(p.includes("@type")){const i=k.compactIri({activeCtx:t,iri:"@type",relativeTo:{vocab:!0}});let o;switch([r,...o]=y(A[i]||[]),o.length){case 0:delete A[i];break;case 1:A[i]=o[0];break;default:A[i]=o}1===Object.keys(A).length&&"@id"in e&&(A=await k.compact({activeCtx:t,activeProperty:n,element:{"@id":e["@id"]},options:m,compactionMap:w}))}r||(r=k.compactIri({activeCtx:t,iri:"@none",relativeTo:{vocab:!0}})),b(i,r,A,{propertyIsArray:p.includes("@set")})}else{const t=!m.compactArrays||p.includes("@set")||p.includes("@list")||i(A)&&0===A.length||"@list"===s||"@graph"===s;b(d,n,A,{propertyIsArray:t})}}}else{if((f(t,e,"@container")||[]).includes("@index"))continue;const n=k.compactIri({activeCtx:t,iri:s,relativeTo:{vocab:!0}});b(S,n,h)}else{const n=await k.compact({activeCtx:t,activeProperty:e,element:h,options:m,compactionMap:w});i(n)&&0===n.length||b(S,s,n)}else{const e=await k.compact({activeCtx:t,activeProperty:"@reverse",element:h,options:m,compactionMap:w});for(const n in e)if(t.mappings.has(n)&&t.mappings.get(n).reverse){const i=e[n],r=(f(t,n,"@container")||[]).includes("@set")||!m.compactArrays;b(S,n,i,{propertyIsArray:r}),delete e[n]}if(Object.keys(e).length>0){const n=k.compactIri({activeCtx:t,iri:s,relativeTo:{vocab:!0}});b(S,n,e)}}else{let e=y(h).map((t=>k.compactIri({activeCtx:F,iri:t,relativeTo:{vocab:!0}})));1===e.length&&(e=e[0]);const n=k.compactIri({activeCtx:t,iri:"@type",relativeTo:{vocab:!0}}),r=(f(t,n,"@container")||[]).includes("@set")&&g(t,1.1)||i(e)&&0===h.length;b(S,n,e,{propertyIsArray:r})}else{let e=y(h).map((e=>k.compactIri({activeCtx:t,iri:e,relativeTo:{vocab:!1},base:m.base})));1===e.length&&(e=e[0]),S[k.compactIri({activeCtx:t,iri:"@id",relativeTo:{vocab:!0}})]=e}}return S}return d},k.compactIri=({activeCtx:t,iri:e,value:i=null,relativeTo:o={vocab:!1},reverse:s=!1,base:l=null})=>{if(null===e)return e;t.isPropertyTermScoped&&t.previousContext&&(t=t.previousContext);const h=t.getInverse();if(p(e)&&e in h&&"@none"in h[e]&&"@type"in h[e]["@none"]&&"@none"in h[e]["@none"]["@type"])return h[e]["@none"]["@type"]["@none"];if(o.vocab&&e in h){const n=t["@language"]||"@none",o=[];r(i)&&"@index"in i&&!("@graph"in i)&&o.push("@index","@index@set"),r(i)&&"@preserve"in i&&(i=i["@preserve"][0]),c(i)?("@index"in i&&o.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in i&&o.push("@graph@id","@graph@id@set"),o.push("@graph","@graph@set","@set"),"@index"in i||o.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in i||o.push("@graph@id","@graph@id@set")):r(i)&&!u(i)&&o.push("@id","@id@set","@type","@set@type");let l="@language",h="@null";if(s)l="@type",h="@reverse",o.push("@set");else if(a(i)){"@index"in i||o.push("@list");const t=i["@list"];if(0===t.length)l="@any",h="@none";else{let e=0===t.length?n:null,i=null;for(let n=0;n<t.length;++n){const r=t[n];let o="@none",s="@none";if(u(r)?"@direction"in r?o=`${(r["@language"]||"").toLowerCase()}_${r["@direction"]}`:"@language"in r?o=r["@language"].toLowerCase():"@type"in r?s=r["@type"]:o="@null":s="@id",null===e?e=o:o!==e&&u(r)&&(e="@none"),null===i?i=s:s!==i&&(i="@none"),"@none"===e&&"@none"===i)break}e=e||"@none",i=i||"@none","@none"!==i?(l="@type",h=i):h=e}}else{if(u(i))if("@language"in i&&!("@index"in i)){o.push("@language","@language@set"),h=i["@language"];const t=i["@direction"];t&&(h=`${h}_${t}`)}else"@direction"in i&&!("@index"in i)?h=`_${i["@direction"]}`:"@type"in i&&(l="@type",h=i["@type"]);else l="@type",h="@id";o.push("@set")}o.push("@none"),r(i)&&!("@index"in i)&&o.push("@index","@index@set"),u(i)&&1===Object.keys(i).length&&o.push("@language","@language@set");const d=function(t,e,n,i,o,s){null===s&&(s="@null");const a=[];if(("@id"===s||"@reverse"===s)&&r(n)&&"@id"in n){"@reverse"===s&&a.push("@reverse");const e=k.compactIri({activeCtx:t,iri:n["@id"],relativeTo:{vocab:!0}});t.mappings.has(e)&&t.mappings.get(e)&&t.mappings.get(e)["@id"]===n["@id"]?a.push.apply(a,["@vocab","@id"]):a.push.apply(a,["@id","@vocab"])}else{a.push(s);const t=a.find((t=>t.includes("_")));t&&a.push(t.replace(/^[^_]+_/,"_"))}a.push("@none");const u=t.inverse[e];for(const t of i){if(!(t in u))continue;const e=u[t][o];for(const t of a)if(t in e)return e[t]}return null}(t,e,i,o,l,h);if(null!==d)return d}if(o.vocab&&"@vocab"in t){const n=t["@vocab"];if(0===e.indexOf(n)&&e!==n){const i=e.substr(n.length);if(!t.mappings.has(i))return i}}let d=null;const f=[];let v=t.fastCurieMap;const g=e.length-1;for(let t=0;t<g&&e[t]in v;++t)v=v[e[t]],""in v&&f.push(v[""][0]);for(let n=f.length-1;n>=0;--n){const r=f[n],o=r.terms;for(const n of o){const o=n+":"+e.substr(r.iri.length);t.mappings.get(n)._prefix&&(!t.mappings.has(o)||null===i&&t.mappings.get(o)["@id"]===e)&&(null===d||x(o,d)<0)&&(d=o)}}if(null!==d)return d;for(const[i,r]of t.mappings)if(r&&r._prefix&&e.startsWith(i+":"))throw new n(`Absolute IRI "${e}" confused with prefix "${i}".`,"jsonld.SyntaxError",{code:"IRI confused with prefix",context:t});return o.vocab?e:"@base"in t?t["@base"]?m(w(l,t["@base"]),e):e:m(l,e)},k.compactValue=({activeCtx:t,activeProperty:e,value:n,options:i})=>{if(u(n)){const i=f(t,e,"@type"),r=f(t,e,"@language"),s=f(t,e,"@direction"),a=f(t,e,"@container")||[],u="@index"in n&&!a.includes("@index");if(!u&&"@none"!==i){if(n["@type"]===i)return n["@value"];if("@language"in n&&n["@language"]===r&&"@direction"in n&&n["@direction"]===s)return n["@value"];if("@language"in n&&n["@language"]===r)return n["@value"];if("@direction"in n&&n["@direction"]===s)return n["@value"]}const c=Object.keys(n).length,l=1===c||2===c&&"@index"in n&&!u,h="@language"in t,d=o(n["@value"]),p=t.mappings.has(e)&&null===t.mappings.get(e)["@language"];if(l&&"@none"!==i&&(!h||!d||p))return n["@value"];const v={};return u&&(v[k.compactIri({activeCtx:t,iri:"@index",relativeTo:{vocab:!0}})]=n["@index"]),"@type"in n?v[k.compactIri({activeCtx:t,iri:"@type",relativeTo:{vocab:!0}})]=k.compactIri({activeCtx:t,iri:n["@type"],relativeTo:{vocab:!0}}):"@language"in n&&(v[k.compactIri({activeCtx:t,iri:"@language",relativeTo:{vocab:!0}})]=n["@language"]),"@direction"in n&&(v[k.compactIri({activeCtx:t,iri:"@direction",relativeTo:{vocab:!0}})]=n["@direction"]),v[k.compactIri({activeCtx:t,iri:"@value",relativeTo:{vocab:!0}})]=n["@value"],v}const r=d(t,e,{vocab:!0},i),s=f(t,e,"@type"),a=k.compactIri({activeCtx:t,iri:n["@id"],relativeTo:{vocab:"@vocab"===s},base:i.base});return"@id"===s||"@vocab"===s||"@graph"===r?a:{[k.compactIri({activeCtx:t,iri:"@id",relativeTo:{vocab:!0}})]:a}}}}),ja=Jt({"../node_modules/jsonld/lib/JsonLdProcessor.js"(t,e){e.exports=t=>{class e{toString(){return"[object JsonLdProcessor]"}}return Object.defineProperty(e,"prototype",{writable:!1,enumerable:!1}),Object.defineProperty(e.prototype,"constructor",{writable:!0,enumerable:!1,configurable:!0,value:e}),e.compact=function(e,n){return arguments.length<2?Promise.reject(new TypeError("Could not compact, too few arguments.")):t.compact(e,n)},e.expand=function(e){return arguments.length<1?Promise.reject(new TypeError("Could not expand, too few arguments.")):t.expand(e)},e.flatten=function(e){return arguments.length<1?Promise.reject(new TypeError("Could not flatten, too few arguments.")):t.flatten(e)},e}}}),Ca=Jt({"../node_modules/jsonld/lib/jsonld.js"(t,e){var n=ia(),i=da(),r=aa(),o=ma(),s=r.IdentifierIssuer,a=sa(),u=va(),c=wa(),{expand:l}=ya(),{flatten:h}=ka(),{fromRDF:d}=Ea(),{toRDF:f}=Fa(),{frameMergedOrDefault:p,cleanupNull:v}=Aa(),{isArray:g,isObject:m,isString:w}=ra(),{isSubjectReference:b}=oa(),{expandIri:y,getInitialContext:x,process:k,processingMode:E}=ba(),{compact:S,compactIri:F}=_a(),{createNodeMap:A,createMergedNodeMap:_,mergeNodeMaps:j}=xa(),C=function(t){const e={},C=new u({max:100});function R(e,{documentLoader:n=t.documentLoader,...i}){return Object.assign({},{documentLoader:n},i,e)}return t.compact=async function(e,n,i){if(arguments.length<2)throw new TypeError("Could not compact, too few arguments.");if(null===n)throw new a("The compaction context must not be null.","jsonld.CompactError",{code:"invalid local context"});if(null===e)return null;let u;(i=R(i,{base:w(e)?e:"",compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new s("_:b"),contextResolver:new o({sharedCache:C})})).link&&(i.skipExpansion=!0),i.compactToRelative||delete i.base,u=i.skipExpansion?e:await t.expand(e,i);const c=await t.processContext(x(i),n,i);let l=await S({activeCtx:c,element:u,options:i,compactionMap:i.compactionMap});i.compactArrays&&!i.graph&&g(l)?1===l.length?l=l[0]:0===l.length&&(l={}):i.graph&&m(l)&&(l=[l]),m(n)&&"@context"in n&&(n=n["@context"]),n=r.clone(n),g(n)||(n=[n]);const h=n;n=[];for(let t=0;t<h.length;++t)(!m(h[t])||Object.keys(h[t]).length>0)&&n.push(h[t]);const d=n.length>0;if(1===n.length&&(n=n[0]),g(l)){const t=F({activeCtx:c,iri:"@graph",relativeTo:{vocab:!0}}),e=l;l={},d&&(l["@context"]=n),l[t]=e}else if(m(l)&&d){const t=l;l={"@context":n};for(const e in t)l[e]=t[e]}return l},t.expand=async function(e,n){if(arguments.length<1)throw new TypeError("Could not expand, too few arguments.");!1===(n=R(n,{keepFreeFloatingNodes:!1,contextResolver:new o({sharedCache:C})})).expansionMap&&(n.expansionMap=void 0);const i={},s=[];if("expandContext"in n){const t=r.clone(n.expandContext);i.expandContext=m(t)&&"@context"in t?t:{"@context":t},s.push(i.expandContext)}let a;if(w(e)){const r=await t.get(e,n);a=r.documentUrl,i.input=r.document,r.contextUrl&&(i.remoteContext={"@context":r.contextUrl},s.push(i.remoteContext))}else i.input=r.clone(e);"base"in n||(n.base=a||"");let u=x(n);for(const t of s)u=await k({activeCtx:u,localCtx:t,options:n});let c=await l({activeCtx:u,element:i.input,options:n,expansionMap:n.expansionMap});return m(c)&&"@graph"in c&&1===Object.keys(c).length?c=c["@graph"]:null===c&&(c=[]),g(c)||(c=[c]),c},t.flatten=async function(e,n,i){if(arguments.length<1)return new TypeError("Could not flatten, too few arguments.");n="function"==typeof n?null:n||null,i=R(i,{base:w(e)?e:"",contextResolver:new o({sharedCache:C})});const r=await t.expand(e,i),s=h(r);if(null===n)return s;i.graph=!0,i.skipExpansion=!0;const a=await t.compact(s,n,i);return a},t.frame=async function(e,n,i){if(arguments.length<2)throw new TypeError("Could not frame, too few arguments.");if(i=R(i,{base:w(e)?e:"",embed:"@once",explicit:!1,requireAll:!1,omitDefault:!1,bnodesToClear:[],contextResolver:new o({sharedCache:C})}),w(n)){const e=await t.get(n,i);if(n=e.document,e.contextUrl){let t=n["@context"];t?g(t)?t.push(e.contextUrl):t=[t,e.contextUrl]:t=e.contextUrl,n["@context"]=t}}const r=n&&n["@context"]||{},s=await t.processContext(x(i),r,i);i.hasOwnProperty("omitGraph")||(i.omitGraph=E(s,1.1)),i.hasOwnProperty("pruneBlankNodeIdentifiers")||(i.pruneBlankNodeIdentifiers=E(s,1.1));const a=await t.expand(e,i),u={...i};u.isFrame=!0,u.keepFreeFloatingNodes=!0;const c=await t.expand(n,u),l=Object.keys(n).map((t=>y(s,t,{vocab:!0})));u.merged=!l.includes("@graph"),u.is11=E(s,1.1);const h=p(a,c,u);u.graph=!i.omitGraph,u.skipExpansion=!0,u.link={},u.framing=!0;let d=await t.compact(h,r,u);return u.link={},d=v(d,u),d},t.link=async function(e,n,i){const r={};return n&&(r["@context"]=n),r["@embed"]="@link",t.frame(e,r,i)},t.normalize=t.canonize=async function(e,i){if(arguments.length<1)throw new TypeError("Could not canonize, too few arguments.");if("inputFormat"in(i=R(i,{base:w(e)?e:"",algorithm:"URDNA2015",skipExpansion:!1,contextResolver:new o({sharedCache:C})}))){if("application/n-quads"!==i.inputFormat&&"application/nquads"!==i.inputFormat)throw new a("Unknown canonicalization input format.","jsonld.CanonizeError");const t=c.parse(e);return n.canonize(t,i)}const r={...i};delete r.format,r.produceGeneralizedRdf=!1;const s=await t.toRDF(e,r);return n.canonize(s,i)},t.fromRDF=async function(t,n){if(arguments.length<1)throw new TypeError("Could not convert from RDF, too few arguments.");n=R(n,{format:w(t)?"application/n-quads":void 0});const{format:i}=n;let{rdfParser:r}=n;if(i){if(r=r||e[i],!r)throw new a("Unknown input format.","jsonld.UnknownFormat",{format:i})}else r=()=>t;const o=await r(t);return d(o,n)},t.toRDF=async function(e,n){if(arguments.length<1)throw new TypeError("Could not convert to RDF, too few arguments.");let i;i=(n=R(n,{base:w(e)?e:"",skipExpansion:!1,contextResolver:new o({sharedCache:C})})).skipExpansion?e:await t.expand(e,n);const r=f(i,n);if(n.format){if("application/n-quads"===n.format||"application/nquads"===n.format)return c.serialize(r);throw new a("Unknown output format.","jsonld.UnknownFormat",{format:n.format})}return r},t.createNodeMap=async function(e,n){if(arguments.length<1)throw new TypeError("Could not create node map, too few arguments.");n=R(n,{base:w(e)?e:"",contextResolver:new o({sharedCache:C})});const i=await t.expand(e,n);return _(i,n)},t.merge=async function(e,n,i){if(arguments.length<1)throw new TypeError("Could not merge, too few arguments.");if(!g(e))throw new TypeError('Could not merge, "docs" must be an array.');n="function"==typeof n?null:n||null,i=R(i,{contextResolver:new o({sharedCache:C})});const a=await Promise.all(e.map((e=>{const n={...i};return t.expand(e,n)})));let u=!0;"mergeNodes"in i&&(u=i.mergeNodes);const c=i.issuer||new s("_:b"),l={"@default":{}};for(let t=0;t<a.length;++t){const e=r.relabelBlankNodes(a[t],{issuer:new s("_:b"+t+"-")}),n=u||0===t?l:{"@default":{}};if(A(e,n,"@default",c),n!==l)for(const t in n){const e=n[t];if(!(t in l)){l[t]=e;continue}const i=l[t];for(const t in e)t in i||(i[t]=e[t])}}const h=j(l),d=[],f=Object.keys(h).sort();for(let t=0;t<f.length;++t){const e=h[f[t]];b(e)||d.push(e)}if(null===n)return d;i.graph=!0,i.skipExpansion=!0;const p=await t.compact(d,n,i);return p},Object.defineProperty(t,"documentLoader",{get:()=>t._documentLoader,set:e=>t._documentLoader=e}),t.documentLoader=async t=>{throw new a("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed",url:t})},t.get=async function(e,n){let i;i="function"==typeof n.documentLoader?n.documentLoader:t.documentLoader;const r=await i(e);try{if(!r.document)throw new a("No remote document found at the given URL.","jsonld.NullRemoteDocument");w(r.document)&&(r.document=JSON.parse(r.document))}catch(t){throw new a("Could not retrieve a JSON-LD document from the URL.","jsonld.LoadDocumentError",{code:"loading document failed",cause:t,remoteDoc:r})}return r},t.processContext=async function(t,e,n){return n=R(n,{base:"",contextResolver:new o({sharedCache:C})}),null===e?x(n):(e=r.clone(e),m(e)&&"@context"in e||(e={"@context":e}),k({activeCtx:t,localCtx:e,options:n}))},t.getContextValue=ba().getContextValue,t.documentLoaders={},t.useDocumentLoader=function(e){if(!(e in t.documentLoaders))throw new a('Unknown document loader type: "'+e+'"',"jsonld.UnknownDocumentLoader",{type:e});t.documentLoader=t.documentLoaders[e].apply(t,Array.prototype.slice.call(arguments,1))},t.registerRDFParser=function(t,n){e[t]=n},t.unregisterRDFParser=function(t){delete e[t]},t.registerRDFParser("application/n-quads",c.parse),t.registerRDFParser("application/nquads",c.parse),t.url=la(),t.util=r,Object.assign(t,r),t.promises=t,t.RequestQueue=ca(),t.JsonLdProcessor=ja()(t),i.setupGlobals(t),i.setupDocumentLoaders(t),t},R=function(){return C((function(){return R()}))};C(R),e.exports=R}}),Ra=Jt({"../node_modules/queue-microtask/index.js"(t,e){var n;e.exports="function"==typeof queueMicrotask?queueMicrotask.bind("undefined"!=typeof window?window:global):t=>(n||(n=Promise.resolve())).then(t).catch((t=>setTimeout((()=>{throw t}),0)))}}),Ia=Jt({"../node_modules/@babel/runtime/helpers/typeof.js"(t,e){function n(t){return e.exports=n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e.exports.__esModule=!0,e.exports.default=e.exports,n(t)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}}),Ta=Jt({"../node_modules/@babel/runtime/helpers/regeneratorRuntime.js"(t,e){var n=Ia().default;function i(){e.exports=i=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},r=Object.prototype,o=r.hasOwnProperty,s="function"==typeof Symbol?Symbol:{},a=s.iterator||"@@iterator",u=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,n){return t[e]=n}}function h(t,e,n,i){var r,o,s,a,u=Object.create((e&&e.prototype instanceof p?e:p).prototype),c=new A(i||[]);return u._invoke=(r=t,o=n,s=c,a="suspendedStart",function(t,e){if("executing"===a)throw new Error("Generator is already running");if("completed"===a){if("throw"===t)throw e;return{value:void 0,done:!0}}for(s.method=t,s.arg=e;;){var n=s.delegate;if(n){var i=E(n,s);if(i){if(i===f)continue;return i}}if("next"===s.method)s.sent=s._sent=s.arg;else if("throw"===s.method){if("suspendedStart"===a)throw a="completed",s.arg;s.dispatchException(s.arg)}else"return"===s.method&&s.abrupt("return",s.arg);a="executing";var u=d(r,o,s);if("normal"===u.type){if(a=s.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:s.done}}"throw"===u.type&&(a="completed",s.method="throw",s.arg=u.arg)}}),u}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=h;var f={};function p(){}function v(){}function g(){}var m={};l(m,a,(function(){return this}));var w=Object.getPrototypeOf,b=w&&w(w(_([])));b&&b!==r&&o.call(b,a)&&(m=b);var y=g.prototype=p.prototype=Object.create(m);function x(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function k(t,e){function i(r,s,a,u){var c=d(t[r],t,s);if("throw"!==c.type){var l=c.arg,h=l.value;return h&&"object"==n(h)&&o.call(h,"__await")?e.resolve(h.__await).then((function(t){i("next",t,a,u)}),(function(t){i("throw",t,a,u)})):e.resolve(h).then((function(t){l.value=t,a(l)}),(function(t){return i("throw",t,a,u)}))}u(c.arg)}var r;this._invoke=function(t,n){function o(){return new e((function(e,r){i(t,n,e,r)}))}return r=r?r.then(o,o):o()}}function E(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,E(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var i=d(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,f;var r=i.arg;return r?r.done?(e[t.resultName]=r.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):r:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function F(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function _(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(o.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:j}}function j(){return{value:void 0,done:!0}}return v.prototype=g,l(y,"constructor",g),l(g,"constructor",v),v.displayName=l(g,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,l(t,c,"GeneratorFunction")),t.prototype=Object.create(y),t},t.awrap=function(t){return{__await:t}},x(k.prototype),l(k.prototype,u,(function(){return this})),t.AsyncIterator=k,t.async=function(e,n,i,r,o){void 0===o&&(o=Promise);var s=new k(h(e,n,i,r),o);return t.isGeneratorFunction(n)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},x(y),l(y,c,"Generator"),l(y,a,(function(){return this})),l(y,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var i=e.pop();if(i in t)return n.value=i,n.done=!1,n}return n.done=!0,n}},t.values=_,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(F),!t)for(var e in this)"t"===e.charAt(0)&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(n,i){return s.type="throw",s.arg=t,e.next=n,i&&(e.method="next",e.arg=void 0),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var r=this.tryEntries[i],s=r.completion;if("root"===r.tryLoc)return n("end");if(r.tryLoc<=this.prev){var a=o.call(r,"catchLoc"),u=o.call(r,"finallyLoc");if(a&&u){if(this.prev<r.catchLoc)return n(r.catchLoc,!0);if(this.prev<r.finallyLoc)return n(r.finallyLoc)}else if(a){if(this.prev<r.catchLoc)return n(r.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<r.finallyLoc)return n(r.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&o.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var r=i;break}}r&&("break"===t||"continue"===t)&&r.tryLoc<=e&&e<=r.finallyLoc&&(r=null);var s=r?r.completion:{};return s.type=t,s.arg=e,r?(this.method="next",this.next=r.finallyLoc,f):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),F(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;F(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:_(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports}}),Oa=Jt({"../node_modules/@babel/runtime/regenerator/index.js"(t,e){var n=Ta()();e.exports=n;try{regeneratorRuntime=n}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}}}),Na=Jt({"../node_modules/@xmldom/xmldom/lib/conventions.js"(t){function e(t,e){return void 0===e&&(e=Object),e&&"function"==typeof e.freeze?e.freeze(t):t}var n=e({HTML:"text/html",isHTML:function(t){return t===n.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),i=e({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(t){return t===i.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});t.assign=function(t,e){if(null===t||"object"!=typeof t)throw new TypeError("target is not an object");for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},t.freeze=e,t.MIME_TYPE=n,t.NAMESPACE=i}}),Pa=Jt({"../node_modules/@xmldom/xmldom/lib/dom.js"(t){var e=Na().NAMESPACE;function n(t){return""!==t}function i(t,e){return t.hasOwnProperty(e)||(t[e]=!0),t}function r(t){if(!t)return[];var e=function(t){return t?t.split(/[\t\n\f\r ]+/).filter(n):[]}(t);return Object.keys(e.reduce(i,{}))}function o(t,e){for(var n in t)e[n]=t[n]}function s(t,e){var n=t.prototype;if(!(n instanceof e)){let i=function(){};i.prototype=e.prototype,i=new i,o(n,i),t.prototype=n=i}n.constructor!=t&&("function"!=typeof t&&console.error("unknown Class:"+t),n.constructor=t)}var a={},u=a.ELEMENT_NODE=1,c=a.ATTRIBUTE_NODE=2,l=a.TEXT_NODE=3,h=a.CDATA_SECTION_NODE=4,d=a.ENTITY_REFERENCE_NODE=5,f=a.ENTITY_NODE=6,p=a.PROCESSING_INSTRUCTION_NODE=7,v=a.COMMENT_NODE=8,g=a.DOCUMENT_NODE=9,m=a.DOCUMENT_TYPE_NODE=10,w=a.DOCUMENT_FRAGMENT_NODE=11,b=a.NOTATION_NODE=12,y={},x={};y.INDEX_SIZE_ERR=(x[1]="Index size error",1),y.DOMSTRING_SIZE_ERR=(x[2]="DOMString size error",2);var k=y.HIERARCHY_REQUEST_ERR=(x[3]="Hierarchy request error",3);y.WRONG_DOCUMENT_ERR=(x[4]="Wrong document",4),y.INVALID_CHARACTER_ERR=(x[5]="Invalid character",5),y.NO_DATA_ALLOWED_ERR=(x[6]="No data allowed",6),y.NO_MODIFICATION_ALLOWED_ERR=(x[7]="No modification allowed",7);var E=y.NOT_FOUND_ERR=(x[8]="Not found",8);y.NOT_SUPPORTED_ERR=(x[9]="Not supported",9);var S=y.INUSE_ATTRIBUTE_ERR=(x[10]="Attribute in use",10);function F(t,e){if(e instanceof Error)var n=e;else n=this,Error.call(this,x[t]),this.message=x[t],Error.captureStackTrace&&Error.captureStackTrace(this,F);return n.code=t,e&&(this.message=this.message+": "+e),n}function A(){}function _(t,e){this._node=t,this._refresh=e,j(this)}function j(t){var e=t._node._inc||t._node.ownerDocument._inc;if(t._inc!=e){var n=t._refresh(t._node);at(t,"length",n.length),o(n,t),t._inc=e}}function C(){}function R(t,e){for(var n=t.length;n--;)if(t[n]===e)return n}function I(t,n,i,r){if(r?n[R(n,r)]=i:n[n.length++]=i,t){i.ownerElement=t;var o=t.ownerDocument;o&&(r&&U(o,t,r),function(t,n,i){t&&t._inc++,i.namespaceURI===e.XMLNS&&(n._nsMap[i.prefix?i.localName:""]=i.value)}(o,t,i))}}function T(t,e,n){var i=R(e,n);if(!(i>=0))throw F(E,new Error(t.tagName+"@"+n));for(var r=e.length-1;i<r;)e[i]=e[++i];if(e.length=r,t){var o=t.ownerDocument;o&&(U(o,t,n),n.ownerElement=null)}}function O(){}function N(){}function P(t){return("<"==t?"<":">"==t&&">")||"&"==t&&"&"||'"'==t&&"""||"&#"+t.charCodeAt()+";"}function D(t,e){if(e(t))return!0;if(t=t.firstChild)do{if(D(t,e))return!0}while(t=t.nextSibling)}function M(){}function U(t,n,i){t&&t._inc++,i.namespaceURI===e.XMLNS&&delete n._nsMap[i.prefix?i.localName:""]}function L(t,e,n){if(t&&t._inc){t._inc++;var i=e.childNodes;if(n)i[i.length++]=n;else{for(var r=e.firstChild,o=0;r;)i[o++]=r,r=r.nextSibling;i.length=o,delete i[i.length]}}}function B(t,e){var n=e.previousSibling,i=e.nextSibling;return n?n.nextSibling=i:t.firstChild=i,i?i.previousSibling=n:t.lastChild=n,e.parentNode=null,e.previousSibling=null,e.nextSibling=null,L(t.ownerDocument,t),e}function J(t,e,n){var i=e.parentNode;if(i&&i.removeChild(e),e.nodeType===w){var r=e.firstChild;if(null==r)return e;var o=e.lastChild}else r=o=e;var s=n?n.previousSibling:t.lastChild;r.previousSibling=s,o.nextSibling=n,s?s.nextSibling=r:t.firstChild=r,null==n?t.lastChild=o:n.previousSibling=o;do{r.parentNode=t}while(r!==o&&(r=r.nextSibling));return L(t.ownerDocument||t,t),e.nodeType==w&&(e.firstChild=e.lastChild=null),e}function $(){this._nsMap={}}function H(){}function K(){}function z(){}function W(){}function q(){}function V(){}function G(){}function X(){}function Y(){}function Z(){}function Q(){}function tt(){}function et(t,e){var n=[],i=9==this.nodeType&&this.documentElement||this,r=i.prefix,o=i.namespaceURI;if(o&&null==r&&null==(r=i.lookupPrefix(o)))var s=[{namespace:o,prefix:null}];return rt(this,n,t,e,s),n.join("")}function nt(t,n,i){var r=t.prefix||"",o=t.namespaceURI;if(!o)return!1;if("xml"===r&&o===e.XML||o===e.XMLNS)return!1;for(var s=i.length;s--;){var a=i[s];if(a.prefix===r)return a.namespace!==o}return!0}function it(t,e,n){t.push(" ",e,'="',n.replace(/[<>&"\t\n\r]/g,P),'"')}function rt(t,n,i,r,o){if(o||(o=[]),r){if(!(t=r(t)))return;if("string"==typeof t)return void n.push(t)}switch(t.nodeType){case u:var s=t.attributes,a=s.length,f=t.firstChild,b=t.tagName,y=b;if(!(i=e.isHTML(t.namespaceURI)||i)&&!t.prefix&&t.namespaceURI){for(var x,k=0;k<s.length;k++)if("xmlns"===s.item(k).name){x=s.item(k).value;break}if(!x)for(var E=o.length-1;E>=0;E--)if(""===(S=o[E]).prefix&&S.namespace===t.namespaceURI){x=S.namespace;break}if(x!==t.namespaceURI)for(E=o.length-1;E>=0;E--){var S;if((S=o[E]).namespace===t.namespaceURI){S.prefix&&(y=S.prefix+":"+b);break}}}n.push("<",y);for(var F=0;F<a;F++)"xmlns"==(A=s.item(F)).prefix?o.push({prefix:A.localName,namespace:A.value}):"xmlns"==A.nodeName&&o.push({prefix:"",namespace:A.value});for(F=0;F<a;F++){var A,_,j;nt(A=s.item(F),0,o)&&(it(n,(_=A.prefix||"")?"xmlns:"+_:"xmlns",j=A.namespaceURI),o.push({prefix:_,namespace:j})),rt(A,n,i,r,o)}if(b===y&&nt(t,0,o)&&(it(n,(_=t.prefix||"")?"xmlns:"+_:"xmlns",j=t.namespaceURI),o.push({prefix:_,namespace:j})),f||i&&!/^(?:meta|link|img|br|hr|input)$/i.test(b)){if(n.push(">"),i&&/^script$/i.test(b))for(;f;)f.data?n.push(f.data):rt(f,n,i,r,o.slice()),f=f.nextSibling;else for(;f;)rt(f,n,i,r,o.slice()),f=f.nextSibling;n.push("</",y,">")}else n.push("/>");return;case g:case w:for(f=t.firstChild;f;)rt(f,n,i,r,o.slice()),f=f.nextSibling;return;case c:return it(n,t.name,t.value);case l:return n.push(t.data.replace(/[<&>]/g,P));case h:return n.push("<![CDATA[",t.data,"]]>");case v:return n.push("\x3c!--",t.data,"--\x3e");case m:var C=t.publicId,R=t.systemId;if(n.push("<!DOCTYPE ",t.name),C)n.push(" PUBLIC ",C),R&&"."!=R&&n.push(" ",R),n.push(">");else if(R&&"."!=R)n.push(" SYSTEM ",R,">");else{var I=t.internalSubset;I&&n.push(" [",I,"]"),n.push(">")}return;case p:return n.push("<?",t.target," ",t.data,"?>");case d:return n.push("&",t.nodeName,";");default:n.push("??",t.nodeName)}}function ot(t,e,n){var i;switch(e.nodeType){case u:(i=e.cloneNode(!1)).ownerDocument=t;case w:break;case c:n=!0}if(i||(i=e.cloneNode(!1)),i.ownerDocument=t,i.parentNode=null,n)for(var r=e.firstChild;r;)i.appendChild(ot(t,r,n)),r=r.nextSibling;return i}function st(t,e,n){var i=new e.constructor;for(var r in e){var o=e[r];"object"!=typeof o&&o!=i[r]&&(i[r]=o)}switch(e.childNodes&&(i.childNodes=new A),i.ownerDocument=t,i.nodeType){case u:var s=e.attributes,a=i.attributes=new C,l=s.length;a._ownerElement=i;for(var h=0;h<l;h++)i.setAttributeNode(st(t,s.item(h),!0));break;case c:n=!0}if(n)for(var d=e.firstChild;d;)i.appendChild(st(t,d,n)),d=d.nextSibling;return i}function at(t,e,n){t[e]=n}y.INVALID_STATE_ERR=(x[11]="Invalid state",11),y.SYNTAX_ERR=(x[12]="Syntax error",12),y.INVALID_MODIFICATION_ERR=(x[13]="Invalid modification",13),y.NAMESPACE_ERR=(x[14]="Invalid namespace",14),y.INVALID_ACCESS_ERR=(x[15]="Invalid access",15),F.prototype=Error.prototype,o(y,F),A.prototype={length:0,item:function(t){return this[t]||null},toString:function(t,e){for(var n=[],i=0;i<this.length;i++)rt(this[i],n,t,e);return n.join("")}},_.prototype.item=function(t){return j(this),this[t]},s(_,A),C.prototype={length:0,item:A.prototype.item,getNamedItem:function(t){for(var e=this.length;e--;){var n=this[e];if(n.nodeName==t)return n}},setNamedItem:function(t){var e=t.ownerElement;if(e&&e!=this._ownerElement)throw new F(S);var n=this.getNamedItem(t.nodeName);return I(this._ownerElement,this,t,n),n},setNamedItemNS:function(t){var e,n=t.ownerElement;if(n&&n!=this._ownerElement)throw new F(S);return e=this.getNamedItemNS(t.namespaceURI,t.localName),I(this._ownerElement,this,t,e),e},removeNamedItem:function(t){var e=this.getNamedItem(t);return T(this._ownerElement,this,e),e},removeNamedItemNS:function(t,e){var n=this.getNamedItemNS(t,e);return T(this._ownerElement,this,n),n},getNamedItemNS:function(t,e){for(var n=this.length;n--;){var i=this[n];if(i.localName==e&&i.namespaceURI==t)return i}return null}},O.prototype={hasFeature:function(){return!0},createDocument:function(t,e,n){var i=new M;if(i.implementation=this,i.childNodes=new A,i.doctype=n||null,n&&i.appendChild(n),e){var r=i.createElementNS(t,e);i.appendChild(r)}return i},createDocumentType:function(t,e,n){var i=new V;return i.name=t,i.nodeName=t,i.publicId=e||"",i.systemId=n||"",i}},N.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(t,e){return J(this,t,e)},replaceChild:function(t,e){this.insertBefore(t,e),e&&this.removeChild(e)},removeChild:function(t){return B(this,t)},appendChild:function(t){return this.insertBefore(t,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(t){return st(this.ownerDocument||this,this,t)},normalize:function(){for(var t=this.firstChild;t;){var e=t.nextSibling;e&&e.nodeType==l&&t.nodeType==l?(this.removeChild(e),t.appendData(e.data)):(t.normalize(),t=e)}},isSupported:function(t,e){return this.ownerDocument.implementation.hasFeature(t,e)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(t){for(var e=this;e;){var n=e._nsMap;if(n)for(var i in n)if(n[i]==t)return i;e=e.nodeType==c?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(t){for(var e=this;e;){var n=e._nsMap;if(n&&t in n)return n[t];e=e.nodeType==c?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(t){return null==this.lookupPrefix(t)}},o(a,N),o(a,N.prototype),M.prototype={nodeName:"#document",nodeType:g,doctype:null,documentElement:null,_inc:1,insertBefore:function(t,e){if(t.nodeType==w){for(var n=t.firstChild;n;){var i=n.nextSibling;this.insertBefore(n,e),n=i}return t}return null==this.documentElement&&t.nodeType==u&&(this.documentElement=t),J(this,t,e),t.ownerDocument=this,t},removeChild:function(t){return this.documentElement==t&&(this.documentElement=null),B(this,t)},importNode:function(t,e){return ot(this,t,e)},getElementById:function(t){var e=null;return D(this.documentElement,(function(n){if(n.nodeType==u&&n.getAttribute("id")==t)return e=n,!0})),e},getElementsByClassName:function(t){var e=r(t);return new _(this,(function(n){var i=[];return e.length>0&&D(n.documentElement,(function(o){if(o!==n&&o.nodeType===u){var s=o.getAttribute("class");if(s){var a=t===s;if(!a){var c=r(s);a=e.every((l=c,function(t){return l&&-1!==l.indexOf(t)}))}a&&i.push(o)}}var l})),i}))},createElement:function(t){var e=new $;return e.ownerDocument=this,e.nodeName=t,e.tagName=t,e.localName=t,e.childNodes=new A,(e.attributes=new C)._ownerElement=e,e},createDocumentFragment:function(){var t=new Z;return t.ownerDocument=this,t.childNodes=new A,t},createTextNode:function(t){var e=new z;return e.ownerDocument=this,e.appendData(t),e},createComment:function(t){var e=new W;return e.ownerDocument=this,e.appendData(t),e},createCDATASection:function(t){var e=new q;return e.ownerDocument=this,e.appendData(t),e},createProcessingInstruction:function(t,e){var n=new Q;return n.ownerDocument=this,n.tagName=n.target=t,n.nodeValue=n.data=e,n},createAttribute:function(t){var e=new H;return e.ownerDocument=this,e.name=t,e.nodeName=t,e.localName=t,e.specified=!0,e},createEntityReference:function(t){var e=new Y;return e.ownerDocument=this,e.nodeName=t,e},createElementNS:function(t,e){var n=new $,i=e.split(":"),r=n.attributes=new C;return n.childNodes=new A,n.ownerDocument=this,n.nodeName=e,n.tagName=e,n.namespaceURI=t,2==i.length?(n.prefix=i[0],n.localName=i[1]):n.localName=e,r._ownerElement=n,n},createAttributeNS:function(t,e){var n=new H,i=e.split(":");return n.ownerDocument=this,n.nodeName=e,n.name=e,n.namespaceURI=t,n.specified=!0,2==i.length?(n.prefix=i[0],n.localName=i[1]):n.localName=e,n}},s(M,N),M.prototype.getElementsByTagName=($.prototype={nodeType:u,hasAttribute:function(t){return null!=this.getAttributeNode(t)},getAttribute:function(t){var e=this.getAttributeNode(t);return e&&e.value||""},getAttributeNode:function(t){return this.attributes.getNamedItem(t)},setAttribute:function(t,e){var n=this.ownerDocument.createAttribute(t);n.value=n.nodeValue=""+e,this.setAttributeNode(n)},removeAttribute:function(t){var e=this.getAttributeNode(t);e&&this.removeAttributeNode(e)},appendChild:function(t){return t.nodeType===w?this.insertBefore(t,null):function(t,e){return e.parentNode&&e.parentNode.removeChild(e),e.parentNode=t,e.previousSibling=t.lastChild,e.nextSibling=null,e.previousSibling?e.previousSibling.nextSibling=e:t.firstChild=e,t.lastChild=e,L(t.ownerDocument,t,e),e}(this,t)},setAttributeNode:function(t){return this.attributes.setNamedItem(t)},setAttributeNodeNS:function(t){return this.attributes.setNamedItemNS(t)},removeAttributeNode:function(t){return this.attributes.removeNamedItem(t.nodeName)},removeAttributeNS:function(t,e){var n=this.getAttributeNodeNS(t,e);n&&this.removeAttributeNode(n)},hasAttributeNS:function(t,e){return null!=this.getAttributeNodeNS(t,e)},getAttributeNS:function(t,e){var n=this.getAttributeNodeNS(t,e);return n&&n.value||""},setAttributeNS:function(t,e,n){var i=this.ownerDocument.createAttributeNS(t,e);i.value=i.nodeValue=""+n,this.setAttributeNode(i)},getAttributeNodeNS:function(t,e){return this.attributes.getNamedItemNS(t,e)},getElementsByTagName:function(t){return new _(this,(function(e){var n=[];return D(e,(function(i){i===e||i.nodeType!=u||"*"!==t&&i.tagName!=t||n.push(i)})),n}))},getElementsByTagNameNS:function(t,e){return new _(this,(function(n){var i=[];return D(n,(function(r){r===n||r.nodeType!==u||"*"!==t&&r.namespaceURI!==t||"*"!==e&&r.localName!=e||i.push(r)})),i}))}}).getElementsByTagName,M.prototype.getElementsByTagNameNS=$.prototype.getElementsByTagNameNS,s($,N),H.prototype.nodeType=c,s(H,N),K.prototype={data:"",substringData:function(t,e){return this.data.substring(t,t+e)},appendData:function(t){this.nodeValue=this.data=t=this.data+t,this.length=t.length},insertData:function(t,e){this.replaceData(t,0,e)},appendChild:function(){throw new Error(x[k])},deleteData:function(t,e){this.replaceData(t,e,"")},replaceData:function(t,e,n){var i=this.data.substring(0,t),r=this.data.substring(t+e);this.nodeValue=this.data=n=i+n+r,this.length=n.length}},s(K,N),z.prototype={nodeName:"#text",nodeType:l,splitText:function(t){var e=this.data,n=e.substring(t);e=e.substring(0,t),this.data=this.nodeValue=e,this.length=e.length;var i=this.ownerDocument.createTextNode(n);return this.parentNode&&this.parentNode.insertBefore(i,this.nextSibling),i}},s(z,K),W.prototype={nodeName:"#comment",nodeType:v},s(W,K),q.prototype={nodeName:"#cdata-section",nodeType:h},s(q,K),V.prototype.nodeType=m,s(V,N),G.prototype.nodeType=b,s(G,N),X.prototype.nodeType=f,s(X,N),Y.prototype.nodeType=d,s(Y,N),Z.prototype.nodeName="#document-fragment",Z.prototype.nodeType=w,s(Z,N),Q.prototype.nodeType=p,s(Q,N),tt.prototype.serializeToString=function(t,e,n){return et.call(t,e,n)},N.prototype.toString=et;try{if(Object.defineProperty){let t=function(e){switch(e.nodeType){case u:case w:var n=[];for(e=e.firstChild;e;)7!==e.nodeType&&8!==e.nodeType&&n.push(t(e)),e=e.nextSibling;return n.join("");default:return e.nodeValue}};Object.defineProperty(_.prototype,"length",{get:function(){return j(this),this.$$length}}),Object.defineProperty(N.prototype,"textContent",{get:function(){return t(this)},set:function(t){switch(this.nodeType){case u:case w:for(;this.firstChild;)this.removeChild(this.firstChild);(t||String(t))&&this.appendChild(this.ownerDocument.createTextNode(t));break;default:this.data=t,this.value=t,this.nodeValue=t}}}),at=function(t,e,n){t["$$"+e]=n}}}catch(t){}t.DocumentType=V,t.DOMException=F,t.DOMImplementation=O,t.Element=$,t.Node=N,t.NodeList=A,t.XMLSerializer=tt}}),Da=Jt({"../node_modules/@xmldom/xmldom/lib/entities.js"(t){var e=Na().freeze;t.XML_ENTITIES=e({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),t.HTML_ENTITIES=e({lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",times:"×",divide:"÷",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",euro:"€",trade:"™",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"}),t.entityMap=t.HTML_ENTITIES}}),Ma=Jt({"../node_modules/@xmldom/xmldom/lib/sax.js"(t){var e=Na().NAMESPACE,n=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,i=new RegExp("[\\-\\.0-9"+n.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),r=new RegExp("^"+n.source+i.source+"*(?::"+n.source+i.source+"*)?$");function o(t,e){this.message=t,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,o)}function s(){}function a(t,e){return e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber,e}function u(t,n,i,r,o,s){function a(t,e,n){i.attributeNames.hasOwnProperty(t)&&s.fatalError("Attribute "+t+" redefined"),i.addValue(t,e.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,o),n)}for(var u,c=++n,l=0;;){var h=t.charAt(c);switch(h){case"=":if(1===l)u=t.slice(n,c),l=3;else{if(2!==l)throw new Error("attribute equal must after attrName");l=3}break;case"'":case'"':if(3===l||1===l){if(1===l&&(s.warning('attribute value must after "="'),u=t.slice(n,c)),!((c=t.indexOf(h,n=c+1))>0))throw new Error("attribute value no end '"+h+"' match");a(u,d=t.slice(n,c),n-1),l=5}else{if(4!=l)throw new Error('attribute value must after "="');a(u,d=t.slice(n,c),n),s.warning('attribute "'+u+'" missed start quot('+h+")!!"),n=c+1,l=5}break;case"/":switch(l){case 0:i.setTagName(t.slice(n,c));case 5:case 6:case 7:l=7,i.closed=!0;case 4:case 1:case 2:break;default:throw new Error("attribute invalid close char('/')")}break;case"":return s.error("unexpected end of input"),0==l&&i.setTagName(t.slice(n,c)),c;case">":switch(l){case 0:i.setTagName(t.slice(n,c));case 5:case 6:case 7:break;case 4:case 1:"/"===(d=t.slice(n,c)).slice(-1)&&(i.closed=!0,d=d.slice(0,-1));case 2:2===l&&(d=u),4==l?(s.warning('attribute "'+d+'" missed quot(")!'),a(u,d,n)):(e.isHTML(r[""])&&d.match(/^(?:disabled|checked|selected)$/i)||s.warning('attribute "'+d+'" missed value!! "'+d+'" instead!!'),a(d,d,n));break;case 3:throw new Error("attribute value missed!!")}return c;case"":h=" ";default:if(h<=" ")switch(l){case 0:i.setTagName(t.slice(n,c)),l=6;break;case 1:u=t.slice(n,c),l=2;break;case 4:var d=t.slice(n,c);s.warning('attribute "'+d+'" missed quot(")!!'),a(u,d,n);case 5:l=6}else switch(l){case 2:e.isHTML(r[""])&&u.match(/^(?:disabled|checked|selected)$/i)||s.warning('attribute "'+u+'" missed value!! "'+u+'" instead2!!'),a(u,u,n),n=c,l=1;break;case 5:s.warning('attribute space is required"'+u+'"!!');case 6:l=1,n=c;break;case 3:l=4,n=c;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}c++}}function c(t,n,i){for(var r=t.tagName,o=null,s=t.length;s--;){var a=t[s],u=a.qName,c=a.value;if((p=u.indexOf(":"))>0)var l=a.prefix=u.slice(0,p),h=u.slice(p+1),f="xmlns"===l&&h;else h=u,l=null,f="xmlns"===u&&"";a.localName=h,!1!==f&&(null==o&&(o={},d(i,i={})),i[f]=o[f]=c,a.uri=e.XMLNS,n.startPrefixMapping(f,c))}for(s=t.length;s--;)(l=(a=t[s]).prefix)&&("xml"===l&&(a.uri=e.XML),"xmlns"!==l&&(a.uri=i[l||""]));var p;(p=r.indexOf(":"))>0?(l=t.prefix=r.slice(0,p),h=t.localName=r.slice(p+1)):(l=null,h=t.localName=r);var v=t.uri=i[l||""];if(n.startElement(v,h,r,t),!t.closed)return t.currentNSMap=i,t.localNSMap=o,!0;if(n.endElement(v,h,r),o)for(l in o)n.endPrefixMapping(l)}function l(t,e,n,i,r){if(/^(?:script|textarea)$/i.test(n)){var o=t.indexOf("</"+n+">",e),s=t.substring(e+1,o);if(/[&<]/.test(s))return/^script$/i.test(n)?(r.characters(s,0,s.length),o):(s=s.replace(/&#?\w+;/g,i),r.characters(s,0,s.length),o)}return e+1}function h(t,e,n,i){var r=i[n];return null==r&&((r=t.lastIndexOf("</"+n+">"))<e&&(r=t.lastIndexOf("</"+n)),i[n]=r),r<e}function d(t,e){for(var n in t)e[n]=t[n]}function f(t,e,n,i){switch(t.charAt(e+2)){case"-":return"-"===t.charAt(e+3)?(r=t.indexOf("--\x3e",e+4))>e?(n.comment(t,e+4,r-e-4),r+3):(i.error("Unclosed comment"),-1):-1;default:if("CDATA["==t.substr(e+3,6)){var r=t.indexOf("]]>",e+9);return n.startCDATA(),n.characters(t,e+9,r-e-9),n.endCDATA(),r+3}var o=function(t,e){var n,i=[],r=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(r.lastIndex=e,r.exec(t);n=r.exec(t);)if(i.push(n),n[1])return i}(t,e),s=o.length;if(s>1&&/!doctype/i.test(o[0][0])){var a=o[1][0],u=!1,c=!1;s>3&&(/^public$/i.test(o[2][0])?(u=o[3][0],c=s>4&&o[4][0]):/^system$/i.test(o[2][0])&&(c=o[3][0]));var l=o[s-1];return n.startDTD(a,u,c),n.endDTD(),l.index+l[0].length}}return-1}function p(t,e,n){var i=t.indexOf("?>",e);if(i){var r=t.substring(e,i).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return r?(n.processingInstruction(r[1],r[2]),i+2):-1}return-1}function v(){this.attributeNames={}}(o.prototype=new Error).name=o.name,s.prototype={parse:function(t,n,i){var r=this.domBuilder;r.startDocument(),d(n,n={}),function(t,n,i,r,s){function d(t){var e,n=t.slice(1,-1);return Object.hasOwnProperty.call(i,n)?i[n]:"#"===n.charAt(0)?(e=parseInt(n.substr(1).replace("x","0x")))>65535?(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e))):String.fromCharCode(e):(s.error("entity not found:"+t),t)}function g(e){if(e>S){var n=t.substring(S,e).replace(/&#?\w+;/g,d);x&&m(S),r.characters(n,0,e-S),S=e}}function m(e,n){for(;e>=b&&(n=y.exec(t));)b=(w=n.index)+n[0].length,x.lineNumber++;x.columnNumber=e-w+1}for(var w=0,b=0,y=/.*(?:\r\n?|\n)|.*$/g,x=r.locator,k=[{currentNSMap:n}],E={},S=0;;){try{var F=t.indexOf("<",S);if(F<0){if(!t.substr(S).match(/^\s*$/)){var A=r.doc,_=A.createTextNode(t.substr(S));A.appendChild(_),r.currentElement=_}return}switch(F>S&&g(F),t.charAt(F+1)){case"/":var j=t.indexOf(">",F+3),C=t.substring(F+2,j).replace(/[ \t\n\r]+$/g,""),R=k.pop();j<0?(C=t.substring(F+2).replace(/[\s<].*/,""),s.error("end tag name: "+C+" is not complete:"+R.tagName),j=F+1+C.length):C.match(/\s</)&&(C=C.replace(/[\s<].*/,""),s.error("end tag name: "+C+" maybe not complete"),j=F+1+C.length);var I=R.localNSMap,T=R.tagName==C;if(T||R.tagName&&R.tagName.toLowerCase()==C.toLowerCase()){if(r.endElement(R.uri,R.localName,C),I)for(var O in I)r.endPrefixMapping(O);T||s.fatalError("end tag name: "+C+" is not match the current start tagName:"+R.tagName)}else k.push(R);j++;break;case"?":x&&m(F),j=p(t,F,r);break;case"!":x&&m(F),j=f(t,F,r,s);break;default:x&&m(F);var N=new v,P=k[k.length-1].currentNSMap,D=(j=u(t,F,N,P,d,s),N.length);if(!N.closed&&h(t,j,N.tagName,E)&&(N.closed=!0,i.nbsp||s.warning("unclosed xml attribute")),x&&D){for(var M=a(x,{}),U=0;U<D;U++){var L=N[U];m(L.offset),L.locator=a(x,{})}r.locator=M,c(N,r,P)&&k.push(N),r.locator=x}else c(N,r,P)&&k.push(N);e.isHTML(N.uri)&&!N.closed?j=l(t,j,N.tagName,d,r):j++}}catch(t){if(t instanceof o)throw t;s.error("element parse error: "+t),j=-1}j>S?S=j:g(Math.max(F,S)+1)}}(t,n,i,r,this.errorHandler),r.endDocument()}},v.prototype={setTagName:function(t){if(!r.test(t))throw new Error("invalid tagName:"+t);this.tagName=t},addValue:function(t,e,n){if(!r.test(t))throw new Error("invalid attribute:"+t);this.attributeNames[t]=this.length,this[this.length++]={qName:t,value:e,offset:n}},length:0,getLocalName:function(t){return this[t].localName},getLocator:function(t){return this[t].locator},getQName:function(t){return this[t].qName},getURI:function(t){return this[t].uri},getValue:function(t){return this[t].value}},t.XMLReader=s,t.ParseError=o}}),Ua=Jt({"../node_modules/@xmldom/xmldom/lib/dom-parser.js"(t){var e=Na(),n=Pa(),i=Da(),r=Ma(),o=n.DOMImplementation,s=e.NAMESPACE,a=r.ParseError,u=r.XMLReader;function c(t){return t.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028]/g,"\n")}function l(t){this.options=t||{locator:{}}}function h(){this.cdata=!1}function d(t,e){e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber}function f(t){if(t)return"\n@"+(t.systemId||"")+"#[line:"+t.lineNumber+",col:"+t.columnNumber+"]"}function p(t,e,n){return"string"==typeof t?t.substr(e,n):t.length>=e+n||e?new java.lang.String(t,e,n)+"":t}function v(t,e){t.currentElement?t.currentElement.appendChild(e):t.doc.appendChild(e)}l.prototype.parseFromString=function(t,e){var n=this.options,r=new u,o=n.domBuilder||new h,a=n.errorHandler,l=n.locator,d=n.xmlns||{},p=/\/x?html?$/.test(e),v=p?i.HTML_ENTITIES:i.XML_ENTITIES;return l&&o.setDocumentLocator(l),r.errorHandler=function(t,e,n){if(!t){if(e instanceof h)return e;t=e}var i={},r=t instanceof Function;function o(e){var o=t[e];!o&&r&&(o=2==t.length?function(n){t(e,n)}:t),i[e]=o&&function(t){o("[xmldom "+e+"]\t"+t+f(n))}||function(){}}return n=n||{},o("warning"),o("error"),o("fatalError"),i}(a,o,l),r.domBuilder=n.domBuilder||o,p&&(d[""]=s.HTML),d.xml=d.xml||s.XML,t&&"string"==typeof t?r.parse((n.normalizeLineEndings||c)(t),d,v):r.errorHandler.error("invalid doc source"),o.doc},h.prototype={startDocument:function(){this.doc=(new o).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(t,e,n,i){var r=this.doc,o=r.createElementNS(t,n||e),s=i.length;v(this,o),this.currentElement=o,this.locator&&d(this.locator,o);for(var a=0;a<s;a++){t=i.getURI(a);var u=i.getValue(a),c=(n=i.getQName(a),r.createAttributeNS(t,n));this.locator&&d(i.getLocator(a),c),c.value=c.nodeValue=u,o.setAttributeNode(c)}},endElement:function(){this.currentElement=this.currentElement.parentNode},startPrefixMapping:function(){},endPrefixMapping:function(){},processingInstruction:function(t,e){var n=this.doc.createProcessingInstruction(t,e);this.locator&&d(this.locator,n),v(this,n)},ignorableWhitespace:function(){},characters:function(t,e,n){if(t=p.apply(this,arguments)){if(this.cdata)var i=this.doc.createCDATASection(t);else i=this.doc.createTextNode(t);this.currentElement?this.currentElement.appendChild(i):/^\s*$/.test(t)&&this.doc.appendChild(i),this.locator&&d(this.locator,i)}},skippedEntity:function(){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(t){(this.locator=t)&&(t.lineNumber=0)},comment:function(t,e,n){t=p.apply(this,arguments);var i=this.doc.createComment(t);this.locator&&d(this.locator,i),v(this,i)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(t,e,n){var i=this.doc.implementation;if(i&&i.createDocumentType){var r=i.createDocumentType(t,e,n);this.locator&&d(this.locator,r),v(this,r),this.doc.doctype=r}},warning:function(t){console.warn("[xmldom warning]\t"+t,f(this.locator))},error:function(t){console.error("[xmldom error]\t"+t,f(this.locator))},fatalError:function(t){throw new a(t,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,(function(t){h.prototype[t]=function(){return null}})),t.__DOMHandler=h,t.normalizeLineEndings=c,t.DOMParser=l}}),La=Jt({"../node_modules/@xmldom/xmldom/lib/index.js"(t){var e=Pa();t.DOMImplementation=e.DOMImplementation,t.XMLSerializer=e.XMLSerializer,t.DOMParser=Ua().DOMParser}}),Ba=Jt({"../node_modules/solid-namespace/index.js"(t,e){var n={acl:"http://www.w3.org/ns/auth/acl#",arg:"http://www.w3.org/ns/pim/arg#",as:"https://www.w3.org/ns/activitystreams#",cal:"http://www.w3.org/2002/12/cal/ical#",cert:"http://www.w3.org/ns/auth/cert#",contact:"http://www.w3.org/2000/10/swap/pim/contact#",dc:"http://purl.org/dc/elements/1.1/",dct:"http://purl.org/dc/terms/",doap:"http://usefulinc.com/ns/doap#",foaf:"http://xmlns.com/foaf/0.1/",geo:"http://www.w3.org/2003/01/geo/wgs84_pos#",gpx:"http://www.w3.org/ns/pim/gpx#",http:"http://www.w3.org/2007/ont/http#",httph:"http://www.w3.org/2007/ont/httph#",icalTZ:"http://www.w3.org/2002/12/cal/icaltzd#",ldp:"http://www.w3.org/ns/ldp#",link:"http://www.w3.org/2007/ont/link#",log:"http://www.w3.org/2000/10/swap/log#",meeting:"http://www.w3.org/ns/pim/meeting#",mo:"http://purl.org/ontology/mo/",org:"http://www.w3.org/ns/org#",owl:"http://www.w3.org/2002/07/owl#",pad:"http://www.w3.org/ns/pim/pad#",patch:"http://www.w3.org/ns/pim/patch#",prov:"http://www.w3.org/ns/prov#",qu:"http://www.w3.org/2000/10/swap/pim/qif#",trip:"http://www.w3.org/ns/pim/trip#",rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",rdfs:"http://www.w3.org/2000/01/rdf-schema#",rss:"http://purl.org/rss/1.0/",sched:"http://www.w3.org/ns/pim/schedule#",schema:"http://schema.org/",sioc:"http://rdfs.org/sioc/ns#",solid:"http://www.w3.org/ns/solid/terms#",space:"http://www.w3.org/ns/pim/space#",stat:"http://www.w3.org/ns/posix/stat#",tab:"http://www.w3.org/2007/ont/link#",tabont:"http://www.w3.org/2007/ont/link#",ui:"http://www.w3.org/ns/ui#",vcard:"http://www.w3.org/2006/vcard/ns#",wf:"http://www.w3.org/2005/01/wf/flow#",xsd:"http://www.w3.org/2001/XMLSchema#",cco:"http://www.ontologyrepository.com/CommonCoreOntologies/"};e.exports=function(t={namedNode:t=>t}){const e={};for(const i in n){const r=n[i];e[i]=function(e=""){return t.namedNode(r+e)}}return e}}}),Ja=Kt(zs());function $a(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function Ha(t,e,n){return e&&$a(t.prototype,e),n&&$a(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ka(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function za(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Wa(t,e){return(Wa=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function qa(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Wa(t,e)}function Va(t){return(Va="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ga(t,e){if(e&&("object"===Va(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return za(t)}function Xa(t){return(Xa=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Ya(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var Za={Literal:1,Collection:3,Graph:4,NamedNode:5,BlankNode:6,Variable:7},Qa=function(){function t(e){Ka(this,t),Ya(this,"termType",void 0),Ya(this,"classOrder",void 0),Ya(this,"value",void 0),this.value=e}return Ha(t,[{key:"substitute",value:function(){return console.log("@@@ node substitute"+this),this}},{key:"compareTerm",value:function(t){return this.classOrder<t.classOrder?-1:this.classOrder>t.classOrder?1:this.value<t.value?-1:this.value>t.value?1:0}},{key:"equals",value:function(t){return!!t&&this.termType===t.termType&&this.value===t.value}},{key:"hashString",value:function(){return this.toCanonical()}},{key:"sameTerm",value:function(t){return this.equals(t)}},{key:"toCanonical",value:function(){return this.toNT()}},{key:"toNT",value:function(){return this.toString()}},{key:"toNQ",value:function(){return this.toNT()}},{key:"toString",value:function(){throw new Error("Node.toString() is abstract - see the subclasses instead")}}]),t}();Ya(Qa,"fromValue",void 0),Ya(Qa,"toJS",void 0);var tu=function(){qa(i,Qa);var t,e,n=(t=i,e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var n,i=Xa(t);if(e){var r=Xa(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return Ga(this,n)});function i(t){var e;return Ka(this,i),Ya(za(e=n.call(this,i.getId(t))),"termType","BlankNode"),Ya(za(e),"classOrder",Za.BlankNode),Ya(za(e),"isBlank",1),Ya(za(e),"isVar",1),e}return Ha(i,[{key:"id",get:function(){return this.value},set:function(t){this.value=t}},{key:"compareTerm",value:function(t){return this.classOrder<t.classOrder?-1:this.classOrder>t.classOrder?1:this.id<t.id?-1:this.id>t.id?1:0}},{key:"copy",value:function(t){var e=new i;return t.copyTo(this,e),e}},{key:"toCanonical",value:function(){return i.NTAnonymousNodePrefix+this.value}},{key:"toString",value:function(){return i.NTAnonymousNodePrefix+this.id}}],[{key:"getId",value:function(t){if(t){if("string"!=typeof t)throw console.log("Bad blank id:",t),new Error("Bad id argument to new blank node: "+t);if(t.includes("#")){var e=t.split("#");return e[e.length-1]}return t}return"n"+i.nextId++}}]),i}();function eu(t){return"string"==typeof t?t:t.value}function nu(t){return"object"===Va(t)&&null!==t&&"subject"in t}function iu(t){return"object"===Va(t)&&null!==t&&"statements"in t}function ru(t){return su(t)&&"Collection"===t.termType}function ou(t){return t&&Object.prototype.hasOwnProperty.call(t,"termType")&&("NamedNode"===t.termType||"Variable"===t.termType||"BlankNode"===t.termType||"Collection"===t.termType||"Literal"===t.termType||"Graph"===t.termType)}function su(t){return"object"===Va(t)&&null!==t&&"termType"in t}function au(t){return"Literal"===t.termType}function uu(t){return"object"===Va(t)&&null!==t&&"subject"in t&&"predicate"in t&&"object"in t}function cu(t){return su(t)&&"NamedNode"===t.termType}function lu(t){return su(t)&&("NamedNode"===t.termType||"Variable"===t.termType||"BlankNode"===t.termType)}function hu(t){return su(t)&&("NamedNode"===t.termType||"Variable"===t.termType)}function du(t){return su(t)&&("NamedNode"===t.termType||"Variable"===t.termType||"BlankNode"===t.termType||"DefaultGraph"===t.termType)}Ya(tu,"nextId",0),Ya(tu,"NTAnonymousNodePrefix","_:");var fu=function(){qa(i,Qa);var t,e,n=(t=i,e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var n,i=Xa(t);if(e){var r=Xa(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return Ga(this,n)});function i(t){var e;if(Ka(this,i),Ya(za(e=n.call(this,eu(t))),"termType","NamedNode"),Ya(za(e),"classOrder",Za.NamedNode),!e.value)throw new Error("Missing IRI for NamedNode");if(!e.value.includes(":"))throw new Error('NamedNode IRI "'+t+'" must be absolute.');if(e.value.includes(" "))throw new Error('Error: NamedNode IRI "'+t+'" must not contain unencoded spaces.');return e}return Ha(i,[{key:"dir",value:function(){var t=this.value.split("#")[0],e=t.slice(0,-1).lastIndexOf("/"),n=t.indexOf("//");return n>=0&&e<n+2||e<0?null:new i(t.slice(0,e+1))}},{key:"site",value:function(){var t=this.value.split("#")[0],e=t.indexOf("//");if(e<0)throw new Error("This URI does not have a web site part (origin)");var n=t.indexOf("/",e+2);return new i(n<0?t.slice(0)+"/":t.slice(0,n+1))}},{key:"doc",value:function(){return this.value.indexOf("#")<0?this:new i(this.value.split("#")[0])}},{key:"toString",value:function(){return"<"+this.value+">"}},{key:"id",value:function(){return this.value.split("#")[1]}},{key:"uri",get:function(){return this.value},set:function(t){this.value=t}}],[{key:"fromValue",value:function(t){return null==t||su(t)?t:new i(t)}}]),i}(),pu={boolean:new fu("http://www.w3.org/2001/XMLSchema#boolean"),dateTime:new fu("http://www.w3.org/2001/XMLSchema#dateTime"),decimal:new fu("http://www.w3.org/2001/XMLSchema#decimal"),double:new fu("http://www.w3.org/2001/XMLSchema#double"),integer:new fu("http://www.w3.org/2001/XMLSchema#integer"),langString:new fu("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),string:new fu("http://www.w3.org/2001/XMLSchema#string")};var vu=function(){qa(i,Qa);var t,e,n=(t=i,e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var n,i=Xa(t);if(e){var r=Xa(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return Ga(this,n)});function i(t,e,r){var o;return Ka(this,i),Ya(za(o=n.call(this,t)),"termType","Literal"),Ya(za(o),"classOrder",Za.Literal),Ya(za(o),"datatype",pu.string),Ya(za(o),"isVar",0),Ya(za(o),"language",""),e?(o.language=e,o.datatype=pu.langString):o.datatype=r?fu.fromValue(r):pu.string,o}return Ha(i,[{key:"copy",value:function(){return new i(this.value,this.lang,this.datatype)}},{key:"equals",value:function(t){return!!t&&this.termType===t.termType&&this.value===t.value&&this.language===t.language&&(!this.datatype&&!t.datatype||this.datatype&&this.datatype.equals(t.datatype))}},{key:"lang",get:function(){return this.language},set:function(t){this.language=t||""}},{key:"toNT",value:function(){return i.toNT(this)}},{key:"toString",value:function(){return""+this.value}}],[{key:"toNT",value:function(t){if("number"==typeof t.value)return""+t.value;if("string"!=typeof t.value)throw new Error("Value of RDF literal is not string or number: "+t.value);var e=t.value;return e='"'+(e=(e=(e=(e=e.replace(/\\/g,"\\\\")).replace(/\"/g,'\\"')).replace(/\n/g,"\\n")).replace(/\r/g,"\\r"))+'"',t.language?e+="@"+t.language:t.datatype.equals(pu.string)||(e+="^^"+t.datatype.toCanonical()),e}},{key:"fromBoolean",value:function(t){return new i(t?"1":"0",null,pu.boolean)}},{key:"fromDate",value:function(t){if(!(t instanceof Date))throw new TypeError("Invalid argument to Literal.fromDate()");var e=function(t){return(""+(100+t)).slice(1,3)};return new i(t.getUTCFullYear()+"-"+e(t.getUTCMonth()+1)+"-"+e(t.getUTCDate())+"T"+e(t.getUTCHours())+":"+e(t.getUTCMinutes())+":"+e(t.getUTCSeconds())+"Z",null,pu.dateTime)}},{key:"fromNumber",value:function(t){if("number"!=typeof t)throw new TypeError("Invalid argument to Literal.fromNumber()");var e,n=t.toString();return e=n.indexOf("e")<0&&Math.abs(t)<=Number.MAX_SAFE_INTEGER?Number.isInteger(t)?pu.integer:pu.decimal:pu.double,new i(n,null,e)}},{key:"fromValue",value:function(t){if(au(t))return t;switch(Va(t)){case"object":if(t instanceof Date)return i.fromDate(t);case"boolean":return i.fromBoolean(t);case"number":return i.fromNumber(t);case"string":return new i(t)}throw new Error("Can't make literal from "+t+" of type "+Va(t))}}]),i}();function gu(t){return null==t||su(t)?t:Array.isArray(t)?new mu(t):vu.fromValue(t)}var mu=function(){qa(i,Qa);var t,e,n=(t=i,e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var n,i=Xa(t);if(e){var r=Xa(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return Ga(this,n)});function i(t){var e;return Ka(this,i),Ya(za(e=n.call(this,(tu.nextId++).toString())),"termType","Collection"),Ya(za(e),"classOrder",Za.Collection),Ya(za(e),"closed",!1),Ya(za(e),"compareTerm",tu.prototype.compareTerm),Ya(za(e),"elements",[]),Ya(za(e),"isVar",0),t&&t.length>0&&t.forEach((function(t){e.elements.push(gu(t))})),e}return Ha(i,[{key:"id",get:function(){return this.value},set:function(t){this.value=t}},{key:"append",value:function(t){return this.elements.push(t)}},{key:"close",value:function(){return this.closed=!0,this.closed}},{key:"shift",value:function(){return this.elements.shift()}},{key:"substitute",value:function(t){return new i(this.elements.map((function(e){return e.substitute(t)})))}},{key:"toNT",value:function(){return i.toNT(this)}},{key:"toString",value:function(){return"("+this.elements.join(" ")+")"}},{key:"unshift",value:function(t){return this.elements.unshift(t)}}],[{key:"toNT",value:function(t){return tu.NTAnonymousNodePrefix+t.id}}]),i}();function wu(t){return function(...e){var n=e.pop();return t.call(this,e,n)}}Ya(mu,"termType","Collection");var bu="function"==typeof queueMicrotask&&queueMicrotask,yu="function"==typeof setImmediate&&setImmediate,xu="object"==typeof process&&"function"==typeof process.nextTick;function ku(t){setTimeout(t,0)}function Eu(t){return(e,...n)=>t((()=>e(...n)))}var Su=Eu(bu?queueMicrotask:yu?setImmediate:xu?process.nextTick:ku);function Fu(t){return ju(t)?function(...e){const n=e.pop();return Au(t.apply(this,e),n)}:wu((function(e,n){var i;try{i=t.apply(this,e)}catch(t){return n(t)}if(i&&"function"==typeof i.then)return Au(i,n);n(null,i)}))}function Au(t,e){return t.then((t=>{_u(e,null,t)}),(t=>{_u(e,t&&t.message?t:new Error(t))}))}function _u(t,e,n){try{t(e,n)}catch(t){Su((t=>{throw t}),t)}}function ju(t){return"AsyncFunction"===t[Symbol.toStringTag]}function Cu(t){if("function"!=typeof t)throw new Error("expected a function");return ju(t)?Fu(t):t}function Ru(t,e=t.length){if(!e)throw new Error("arity is undefined");return function(...n){return"function"==typeof n[e-1]?t.apply(this,n):new Promise(((i,r)=>{n[e-1]=(t,...e)=>{if(t)return r(t);i(e.length>1?e:e[0])},t.apply(this,n)}))}}function Iu(t){return function(e,...n){return Ru((function(i){var r=this;return t(e,((t,e)=>{Cu(t).apply(r,n.concat(e))}),i)}))}}function Tu(t,e,n,i){e=e||[];var r=[],o=0,s=Cu(n);return t(e,((t,e,n)=>{var i=o++;s(t,((t,e)=>{r[i]=e,n(t)}))}),(t=>{i(t,r)}))}function Ou(t){return t&&"number"==typeof t.length&&t.length>=0&&t.length%1==0}var Nu={};function Pu(t){function e(...e){if(null!==t){var n=t;t=null,n.apply(this,e)}}return Object.assign(e,t),e}function Du(t){return function(...e){if(null===t)throw new Error("Callback was already called.");var n=t;t=null,n.apply(this,e)}}function Mu(t,e,n,i){let r=!1,o=!1,s=!1,a=0,u=0;function c(){a>=e||s||r||(s=!0,t.next().then((({value:t,done:e})=>{if(!o&&!r){if(s=!1,e)return r=!0,void(a<=0&&i(null));a++,n(t,u,l),u++,c()}})).catch(h))}function l(t,e){if(a-=1,!o)return t?h(t):!1===t?(r=!0,void(o=!0)):e===Nu||r&&a<=0?(r=!0,i(null)):void c()}function h(t){o||(s=!1,r=!0,i(t))}c()}var Uu=t=>(e,n,i)=>{if(i=Pu(i),t<=0)throw new RangeError("concurrency limit cannot be less than 1");if(!e)return i(null);if("AsyncGenerator"===e[Symbol.toStringTag])return Mu(e,t,n,i);if(function(t){return"function"==typeof t[Symbol.asyncIterator]}(e))return Mu(e[Symbol.asyncIterator](),t,n,i);var r=function(t){if(Ou(t))return function(t){var e=-1,n=t.length;return function(){return++e<n?{value:t[e],key:e}:null}}(t);var e=function(t){return t[Symbol.iterator]&&t[Symbol.iterator]()}(t);return e?function(t){var e=-1;return function(){var n=t.next();return n.done?null:(e++,{value:n.value,key:e})}}(e):function(t){var e=t?Object.keys(t):[],n=-1,i=e.length;return function r(){var o=e[++n];return"__proto__"===o?r():n<i?{value:t[o],key:o}:null}}(t)}(e),o=!1,s=!1,a=0,u=!1;function c(t,e){if(!s)if(a-=1,t)o=!0,i(t);else if(!1===t)o=!0,s=!0;else{if(e===Nu||o&&a<=0)return o=!0,i(null);u||l()}}function l(){for(u=!0;a<t&&!o;){var e=r();if(null===e)return o=!0,void(a<=0&&i(null));a+=1,n(e.value,e.key,Du(c))}u=!1}l()},Lu=Ru((function(t,e,n,i){return Uu(e)(t,Cu(n),i)}),4);function Bu(t,e,n){n=Pu(n);var i=0,r=0,{length:o}=t,s=!1;function a(t,e){!1===t&&(s=!0),!0!==s&&(t?n(t):++r!==o&&e!==Nu||n(null))}for(0===o&&n(null);i<o;i++)e(t[i],i,Du(a))}function Ju(t,e,n){return Lu(t,1/0,e,n)}var $u=Ru((function(t,e,n){return(Ou(t)?Bu:Ju)(t,Cu(e),n)}),3),Hu=Ru((function(t,e,n){return Tu($u,t,e,n)}),3),Ku=Iu(Hu),zu=Ru((function(t,e,n){return Lu(t,1,e,n)}),3),Wu=Ru((function(t,e,n){return Tu(zu,t,e,n)}),3),qu=Iu(Wu),Vu=Symbol("promiseCallback");function Gu(){let t,e;function n(n,...i){if(n)return e(n);t(i.length>1?i:i[0])}return n[Vu]=new Promise(((n,i)=>{t=n,e=i})),n}function Xu(t,e,n){"number"!=typeof e&&(n=e,e=null),n=Pu(n||Gu());var i=Object.keys(t).length;if(!i)return n(null);e||(e=i);var r={},o=0,s=!1,a=!1,u=Object.create(null),c=[],l=[],h={};function d(t,e){c.push((()=>function(t,e){if(!a){var i=Du(((e,...i)=>{if(o--,!1!==e)if(i.length<2&&([i]=i),e){var c={};if(Object.keys(r).forEach((t=>{c[t]=r[t]})),c[t]=i,a=!0,u=Object.create(null),s)return;n(e,c)}else r[t]=i,(u[t]||[]).forEach((t=>t())),f();else s=!0}));o++;var c=Cu(e[e.length-1]);e.length>1?c(r,i):c(i)}}(t,e)))}function f(){if(!s){if(0===c.length&&0===o)return n(null,r);for(;c.length&&o<e;)c.shift()()}}function p(e){var n=[];return Object.keys(t).forEach((i=>{const r=t[i];Array.isArray(r)&&r.indexOf(e)>=0&&n.push(i)})),n}return Object.keys(t).forEach((e=>{var n=t[e];if(!Array.isArray(n))return d(e,[n]),void l.push(e);var i=n.slice(0,n.length-1),r=i.length;if(0===r)return d(e,n),void l.push(e);h[e]=r,i.forEach((o=>{if(!t[o])throw new Error("async.auto task `"+e+"` has a non-existent dependency `"+o+"` in "+i.join(", "));var s,a;(a=u[s=o])||(a=u[s]=[]),a.push((()=>{0==--r&&d(e,n)}))}))})),function(){for(var t=0;l.length;)t++,p(l.pop()).forEach((t=>{0==--h[t]&&l.push(t)}));if(t!==i)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}(),f(),n[Vu]}var Yu=/^(?:async\s+)?(?:function)?\s*\w*\s*\(\s*([^)]+)\s*\)(?:\s*{)/,Zu=/^(?:async\s+)?\(?\s*([^)=]+)\s*\)?(?:\s*=>)/,Qu=/,/,tc=/(=.+)?(\s*)$/,ec=class{constructor(){this.head=this.tail=null,this.length=0}removeLink(t){return t.prev?t.prev.next=t.next:this.head=t.next,t.next?t.next.prev=t.prev:this.tail=t.prev,t.prev=t.next=null,this.length-=1,t}empty(){for(;this.head;)this.shift();return this}insertAfter(t,e){e.prev=t,e.next=t.next,t.next?t.next.prev=e:this.tail=e,t.next=e,this.length+=1}insertBefore(t,e){e.prev=t.prev,e.next=t,t.prev?t.prev.next=e:this.head=e,t.prev=e,this.length+=1}unshift(t){this.head?this.insertBefore(this.head,t):nc(this,t)}push(t){this.tail?this.insertAfter(this.tail,t):nc(this,t)}shift(){return this.head&&this.removeLink(this.head)}pop(){return this.tail&&this.removeLink(this.tail)}toArray(){return[...this]}*[Symbol.iterator](){for(var t=this.head;t;)yield t.data,t=t.next}remove(t){for(var e=this.head;e;){var{next:n}=e;t(e)&&this.removeLink(e),e=n}return this}};function nc(t,e){t.length=1,t.head=t.tail=e}function ic(t,e,n){if(null==e)e=1;else if(0===e)throw new RangeError("Concurrency must not be zero");var i=Cu(t),r=0,o=[];const s={error:[],drain:[],saturated:[],unsaturated:[],empty:[]};function a(t,e){return t?e?void(s[t]=s[t].filter((t=>t!==e))):s[t]=[]:Object.keys(s).forEach((t=>s[t]=[]))}function u(t,...e){s[t].forEach((t=>t(...e)))}var c=!1;function l(t,e,n,i){if(null!=i&&"function"!=typeof i)throw new Error("task callback must be a function");var r,o;function s(t,...e){return t?n?o(t):r():e.length<=1?r(e[0]):void r(e)}v.started=!0;var a=v._createTaskItem(t,n?s:i||s);if(e?v._tasks.unshift(a):v._tasks.push(a),c||(c=!0,Su((()=>{c=!1,v.process()}))),n||!i)return new Promise(((t,e)=>{r=t,o=e}))}function h(t){return function(e,...n){r-=1;for(var i=0,s=t.length;i<s;i++){var a=t[i],c=o.indexOf(a);0===c?o.shift():c>0&&o.splice(c,1),a.callback(e,...n),null!=e&&u("error",e,a.data)}r<=v.concurrency-v.buffer&&u("unsaturated"),v.idle()&&u("drain"),v.process()}}function d(t){return!(0!==t.length||!v.idle()||(Su((()=>u("drain"))),0))}const f=t=>e=>{if(!e)return new Promise(((e,n)=>{!function(t){const i=(...r)=>{a(t,i),((t,i)=>{if(t)return n(t);e(i)})(...r)};s[t].push(i)}(t)}));a(t),function(t,e){s[t].push(e)}(t,e)};var p=!1,v={_tasks:new ec,_createTaskItem:(t,e)=>({data:t,callback:e}),*[Symbol.iterator](){yield*v._tasks[Symbol.iterator]()},concurrency:e,payload:n,buffer:e/4,started:!1,paused:!1,push(t,e){if(Array.isArray(t)){if(d(t))return;return t.map((t=>l(t,!1,!1,e)))}return l(t,!1,!1,e)},pushAsync(t,e){if(Array.isArray(t)){if(d(t))return;return t.map((t=>l(t,!1,!0,e)))}return l(t,!1,!0,e)},kill(){a(),v._tasks.empty()},unshift(t,e){if(Array.isArray(t)){if(d(t))return;return t.map((t=>l(t,!0,!1,e)))}return l(t,!0,!1,e)},unshiftAsync(t,e){if(Array.isArray(t)){if(d(t))return;return t.map((t=>l(t,!0,!0,e)))}return l(t,!0,!0,e)},remove(t){v._tasks.remove(t)},process(){if(!p){for(p=!0;!v.paused&&r<v.concurrency&&v._tasks.length;){var t=[],e=[],n=v._tasks.length;v.payload&&(n=Math.min(n,v.payload));for(var s=0;s<n;s++){var a=v._tasks.shift();t.push(a),o.push(a),e.push(a.data)}r+=1,0===v._tasks.length&&u("empty"),r===v.concurrency&&u("saturated");var c=Du(h(t));i(e,c)}p=!1}},length:()=>v._tasks.length,running:()=>r,workersList:()=>o,idle:()=>v._tasks.length+r===0,pause(){v.paused=!0},resume(){!1!==v.paused&&(v.paused=!1,Su(v.process))}};return Object.defineProperties(v,{saturated:{writable:!1,value:f("saturated")},unsaturated:{writable:!1,value:f("unsaturated")},empty:{writable:!1,value:f("empty")},drain:{writable:!1,value:f("drain")},error:{writable:!1,value:f("error")}}),v}var rc=Ru((function(t,e,n,i){i=Pu(i);var r=Cu(n);return zu(t,((t,n,i)=>{r(e,t,((t,n)=>{e=n,i(t)}))}),(t=>i(t,e)))}),4);function oc(...t){var e=t.map(Cu);return function(...t){var n=this,i=t[t.length-1];return"function"==typeof i?t.pop():i=Gu(),rc(e,t,((t,e,i)=>{e.apply(n,t.concat(((t,...e)=>{i(t,e)})))}),((t,e)=>i(t,...e))),i[Vu]}}var sc=Ru((function(t,e,n,i){return Tu(Uu(e),t,n,i)}),4),ac=Ru((function(t,e,n,i){var r=Cu(n);return sc(t,e,((t,e)=>{r(t,((t,...n)=>t?e(t):e(t,n)))}),((t,e)=>{for(var n=[],r=0;r<e.length;r++)e[r]&&(n=n.concat(...e[r]));return i(t,n)}))}),4),uc=Ru((function(t,e,n){return ac(t,1/0,e,n)}),3),cc=Ru((function(t,e,n){return ac(t,1,e,n)}),3);function lc(t,e){return(n,i,r,o)=>{var s,a=!1;const u=Cu(r);n(i,((n,i,r)=>{u(n,((i,o)=>i||!1===i?r(i):t(o)&&!s?(a=!0,s=e(!0,n),r(null,Nu)):void r()))}),(t=>{if(t)return o(t);o(null,a?s:e(!1))}))}}var hc=Ru((function(t,e,n){return lc((t=>t),((t,e)=>e))($u,t,e,n)}),3),dc=Ru((function(t,e,n,i){return lc((t=>t),((t,e)=>e))(Uu(e),t,n,i)}),4),fc=Ru((function(t,e,n){return lc((t=>t),((t,e)=>e))(Uu(1),t,e,n)}),3);function pc(t){return(e,...n)=>Cu(e)(...n,((e,...n)=>{"object"==typeof console&&(e?console.error&&console.error(e):console[t]&&n.forEach((e=>console[t](e))))}))}var vc=pc("dir"),gc=Ru((function(t,e,n){n=Du(n);var i,r=Cu(t),o=Cu(e);function s(t,...e){if(t)return n(t);!1!==t&&(i=e,o(...e,a))}function a(t,e){return t?n(t):!1!==t?e?void r(s):n(null,...i):void 0}return a(null,!0)}),3);function mc(t){return(e,n,i)=>t(e,i)}var wc=Ru((function(t,e,n){return $u(t,mc(Cu(e)),n)}),3),bc=Ru((function(t,e,n,i){return Uu(e)(t,mc(Cu(n)),i)}),4),yc=Ru((function(t,e,n){return bc(t,1,e,n)}),3);function xc(t){return ju(t)?t:function(...e){var n=e.pop(),i=!0;e.push(((...t)=>{i?Su((()=>n(...t))):n(...t)})),t.apply(this,e),i=!1}}var kc=Ru((function(t,e,n){return lc((t=>!t),(t=>!t))($u,t,e,n)}),3),Ec=Ru((function(t,e,n,i){return lc((t=>!t),(t=>!t))(Uu(e),t,n,i)}),4),Sc=Ru((function(t,e,n){return lc((t=>!t),(t=>!t))(zu,t,e,n)}),3);function Fc(t,e,n,i){var r=new Array(e.length);t(e,((t,e,i)=>{n(t,((t,n)=>{r[e]=!!n,i(t)}))}),(t=>{if(t)return i(t);for(var n=[],o=0;o<e.length;o++)r[o]&&n.push(e[o]);i(null,n)}))}function Ac(t,e,n,i){var r=[];t(e,((t,e,i)=>{n(t,((n,o)=>{if(n)return i(n);o&&r.push({index:e,value:t}),i(n)}))}),(t=>{if(t)return i(t);i(null,r.sort(((t,e)=>t.index-e.index)).map((t=>t.value)))}))}function _c(t,e,n,i){return(Ou(e)?Fc:Ac)(t,e,Cu(n),i)}var jc=Ru((function(t,e,n){return _c($u,t,e,n)}),3),Cc=Ru((function(t,e,n,i){return _c(Uu(e),t,n,i)}),4),Rc=Ru((function(t,e,n){return _c(zu,t,e,n)}),3),Ic=Ru((function(t,e){var n=Du(e),i=Cu(xc(t));return function t(e){if(e)return n(e);!1!==e&&i(t)}()}),2),Tc=Ru((function(t,e,n,i){var r=Cu(n);return sc(t,e,((t,e)=>{r(t,((n,i)=>n?e(n):e(n,{key:i,val:t})))}),((t,e)=>{for(var n={},{hasOwnProperty:r}=Object.prototype,o=0;o<e.length;o++)if(e[o]){var{key:s}=e[o],{val:a}=e[o];r.call(n,s)?n[s].push(a):n[s]=[a]}return i(t,n)}))}),4),Oc=pc("log"),Nc=Ru((function(t,e,n,i){i=Pu(i);var r={},o=Cu(n);return Uu(e)(t,((t,e,n)=>{o(t,e,((t,i)=>{if(t)return n(t);r[e]=i,n(t)}))}),(t=>i(t,r)))}),4),Pc=Eu(xu?process.nextTick:yu?setImmediate:ku),Dc=Ru(((t,e,n)=>{var i=Ou(e)?[]:{};t(e,((t,e,n)=>{Cu(t)(((t,...r)=>{r.length<2&&([r]=r),i[e]=r,n(t)}))}),(t=>n(t,i)))}),3);function Mc(t,e){var n=Cu(t);return ic(((t,e)=>{n(t[0],e)}),e,1)}var Uc=class{constructor(){this.heap=[],this.pushCount=Number.MIN_SAFE_INTEGER}get length(){return this.heap.length}empty(){return this.heap=[],this}percUp(t){let e;for(;t>0&&Jc(this.heap[t],this.heap[e=Bc(t)]);){let n=this.heap[t];this.heap[t]=this.heap[e],this.heap[e]=n,t=e}}percDown(t){let e;for(;(e=Lc(t))<this.heap.length&&(e+1<this.heap.length&&Jc(this.heap[e+1],this.heap[e])&&(e+=1),!Jc(this.heap[t],this.heap[e]));){let n=this.heap[t];this.heap[t]=this.heap[e],this.heap[e]=n,t=e}}push(t){t.pushCount=++this.pushCount,this.heap.push(t),this.percUp(this.heap.length-1)}unshift(t){return this.heap.push(t)}shift(){let[t]=this.heap;return this.heap[0]=this.heap[this.heap.length-1],this.heap.pop(),this.percDown(0),t}toArray(){return[...this]}*[Symbol.iterator](){for(let t=0;t<this.heap.length;t++)yield this.heap[t].data}remove(t){let e=0;for(let n=0;n<this.heap.length;n++)t(this.heap[n])||(this.heap[e]=this.heap[n],e++);this.heap.splice(e);for(let t=Bc(this.heap.length-1);t>=0;t--)this.percDown(t);return this}};function Lc(t){return 1+(t<<1)}function Bc(t){return(t+1>>1)-1}function Jc(t,e){return t.priority!==e.priority?t.priority<e.priority:t.pushCount<e.pushCount}var $c=Ru((function(t,e){if(e=Pu(e),!Array.isArray(t))return e(new TypeError("First argument to race must be an array of functions"));if(!t.length)return e();for(var n=0,i=t.length;n<i;n++)Cu(t[n])(e)}),2);function Hc(t,e,n,i){var r=[...t].reverse();return rc(r,e,n,i)}function Kc(t){var e=Cu(t);return wu((function(t,n){return t.push(((t,...e)=>{let i={};if(t&&(i.error=t),e.length>0){var r=e;e.length<=1&&([r]=e),i.value=r}n(null,i)})),e.apply(this,t)}))}function zc(t,e,n,i){const r=Cu(n);return _c(t,e,((t,e)=>{r(t,((t,n)=>{e(t,!n)}))}),i)}var Wc=Ru((function(t,e,n){return zc($u,t,e,n)}),3),qc=Ru((function(t,e,n,i){return zc(Uu(e),t,n,i)}),4),Vc=Ru((function(t,e,n){return zc(zu,t,e,n)}),3);function Gc(t){return function(){return t}}function Xc(t,e,n){var i={times:5,intervalFunc:Gc(0)};if(arguments.length<3&&"function"==typeof t?(n=e||Gu(),e=t):(Yc(i,t),n=n||Gu()),"function"!=typeof e)throw new Error("Invalid arguments for async.retry");var r=Cu(e),o=1;function s(){r(((t,...e)=>{!1!==t&&(t&&o++<i.times&&("function"!=typeof i.errorFilter||i.errorFilter(t))?setTimeout(s,i.intervalFunc(o-1)):n(t,...e))}))}return s(),n[Vu]}function Yc(t,e){if("object"==typeof e)t.times=+e.times||5,t.intervalFunc="function"==typeof e.interval?e.interval:Gc(+e.interval||0),t.errorFilter=e.errorFilter;else{if("number"!=typeof e&&"string"!=typeof e)throw new Error("Invalid arguments for async.retry");t.times=+e||5}}var Zc=Ru((function(t,e,n){return lc(Boolean,(t=>t))($u,t,e,n)}),3),Qc=Ru((function(t,e,n,i){return lc(Boolean,(t=>t))(Uu(e),t,n,i)}),4),tl=Ru((function(t,e,n){return lc(Boolean,(t=>t))(zu,t,e,n)}),3),el=Ru((function(t,e,n){var i=Cu(e);return Hu(t,((t,e)=>{i(t,((n,i)=>{if(n)return e(n);e(n,{value:t,criteria:i})}))}),((t,e)=>{if(t)return n(t);n(null,e.sort(r).map((t=>t.value)))}));function r(t,e){var n=t.criteria,i=e.criteria;return n<i?-1:n>i?1:0}}),3);function nl(t,e,n,i){var r=Cu(n);return sc(function(t){for(var e=Array(t);t--;)e[t]=t;return e}(t),e,r,i)}var il,rl=Ru((function(t,e){var n,i=null;return yc(t,((t,e)=>{Cu(t)(((t,...r)=>{if(!1===t)return e(t);r.length<2?[n]=r:n=r,i=t,e(t?null:{})}))}),(()=>e(i,n)))})),ol=Ru((function(t,e,n){n=Du(n);var i=Cu(e),r=Cu(t),o=[];function s(t,...e){if(t)return n(t);o=e,!1!==t&&r(a)}function a(t,e){return t?n(t):!1!==t?e?void i(s):n(null,...o):void 0}return r(a)}),3),sl=Ru((function(t,e){if(e=Pu(e),!Array.isArray(t))return e(new Error("First argument to waterfall must be an array of functions"));if(!t.length)return e();var n=0;function i(e){Cu(t[n++])(...e,Du(r))}function r(r,...o){if(!1!==r)return r||n===t.length?e(r,...o):void i(o)}i([])})),al={apply:function(t,...e){return(...n)=>t(...e,...n)},applyEach:Ku,applyEachSeries:qu,asyncify:Fu,auto:Xu,autoInject:function(t,e){var n={};return Object.keys(t).forEach((e=>{var i,r=t[e],o=ju(r),s=!o&&1===r.length||o&&0===r.length;if(Array.isArray(r))i=[...r],r=i.pop(),n[e]=i.concat(i.length>0?a:r);else if(s)n[e]=r;else{if(i=function(t){const e=function(t){let e="",n=0,i=t.indexOf("*/");for(;n<t.length;)if("/"===t[n]&&"/"===t[n+1]){let e=t.indexOf("\n",n);n=-1===e?t.length:e}else if(-1!==i&&"/"===t[n]&&"*"===t[n+1]){let r=t.indexOf("*/",n);-1!==r?(n=r+2,i=t.indexOf("*/",n)):(e+=t[n],n++)}else e+=t[n],n++;return e}(t.toString());let n=e.match(Yu);if(n||(n=e.match(Zu)),!n)throw new Error("could not parse args in autoInject\nSource:\n"+e);let[,i]=n;return i.replace(/\s/g,"").split(Qu).map((t=>t.replace(tc,"").trim()))}(r),0===r.length&&!o&&0===i.length)throw new Error("autoInject task functions require explicit parameters.");o||i.pop(),n[e]=i.concat(a)}function a(t,e){var n=i.map((e=>t[e]));n.push(e),Cu(r)(...n)}})),Xu(n,e)},cargo:function(t,e){return ic(t,1,e)},cargoQueue:function(t,e,n){return ic(t,e,n)},compose:function(...t){return oc(...t.reverse())},concat:uc,concatLimit:ac,concatSeries:cc,constant:function(...t){return function(...e){return e.pop()(null,...t)}},detect:hc,detectLimit:dc,detectSeries:fc,dir:vc,doUntil:function(t,e,n){const i=Cu(e);return gc(t,((...t)=>{const e=t.pop();i(...t,((t,n)=>e(t,!n)))}),n)},doWhilst:gc,each:wc,eachLimit:bc,eachOf:$u,eachOfLimit:Lu,eachOfSeries:zu,eachSeries:yc,ensureAsync:xc,every:kc,everyLimit:Ec,everySeries:Sc,filter:jc,filterLimit:Cc,filterSeries:Rc,forever:Ic,groupBy:function(t,e,n){return Tc(t,1/0,e,n)},groupByLimit:Tc,groupBySeries:function(t,e,n){return Tc(t,1,e,n)},log:Oc,map:Hu,mapLimit:sc,mapSeries:Wu,mapValues:function(t,e,n){return Nc(t,1/0,e,n)},mapValuesLimit:Nc,mapValuesSeries:function(t,e,n){return Nc(t,1,e,n)},memoize:function(t,e=(t=>t)){var n=Object.create(null),i=Object.create(null),r=Cu(t),o=wu(((t,o)=>{var s=e(...t);s in n?Su((()=>o(null,...n[s]))):s in i?i[s].push(o):(i[s]=[o],r(...t,((t,...e)=>{t||(n[s]=e);var r=i[s];delete i[s];for(var o=0,a=r.length;o<a;o++)r[o](t,...e)})))}));return o.memo=n,o.unmemoized=t,o},nextTick:Pc,parallel:function(t,e){return Dc($u,t,e)},parallelLimit:function(t,e,n){return Dc(Uu(e),t,n)},priorityQueue:function(t,e){var n=Mc(t,e),{push:i,pushAsync:r}=n;function o(t,e){return Array.isArray(t)?t.map((t=>({data:t,priority:e}))):{data:t,priority:e}}return n._tasks=new Uc,n._createTaskItem=({data:t,priority:e},n)=>({data:t,priority:e,callback:n}),n.push=function(t,e=0,n){return i(o(t,e),n)},n.pushAsync=function(t,e=0,n){return r(o(t,e),n)},delete n.unshift,delete n.unshiftAsync,n},queue:Mc,race:$c,reduce:rc,reduceRight:Hc,reflect:Kc,reflectAll:function(t){var e;return Array.isArray(t)?e=t.map(Kc):(e={},Object.keys(t).forEach((n=>{e[n]=Kc.call(this,t[n])}))),e},reject:Wc,rejectLimit:qc,rejectSeries:Vc,retry:Xc,retryable:function(t,e){e||(e=t,t=null);let n=t&&t.arity||e.length;ju(e)&&(n+=1);var i=Cu(e);return wu(((e,r)=>{function o(t){i(...e,t)}return(e.length<n-1||null==r)&&(e.push(r),r=Gu()),t?Xc(t,o,r):Xc(o,r),r[Vu]}))},seq:oc,series:function(t,e){return Dc(zu,t,e)},setImmediate:Su,some:Zc,someLimit:Qc,someSeries:tl,sortBy:el,timeout:function(t,e,n){var i=Cu(t);return wu(((r,o)=>{var s,a=!1;r.push(((...t)=>{a||(o(...t),clearTimeout(s))})),s=setTimeout((function(){var e=new Error('Callback function "'+(t.name||"anonymous")+'" timed out.');e.code="ETIMEDOUT",n&&(e.info=n),a=!0,o(e)}),e),i(...r)}))},times:function(t,e,n){return nl(t,1/0,e,n)},timesLimit:nl,timesSeries:function(t,e,n){return nl(t,1,e,n)},transform:function(t,e,n,i){arguments.length<=3&&"function"==typeof e&&(i=n,n=e,e=Array.isArray(t)?[]:{}),i=Pu(i||Gu());var r=Cu(n);return $u(t,((t,n,i)=>{r(e,t,n,i)}),(t=>i(t,e))),i[Vu]},tryEach:rl,unmemoize:function(t){return(...e)=>(t.unmemoized||t)(...e)},until:function(t,e,n){const i=Cu(t);return ol((t=>i(((e,n)=>t(e,!n)))),e,n)},waterfall:sl,whilst:ol,all:kc,allLimit:Ec,allSeries:Sc,any:Zc,anyLimit:Qc,anySeries:tl,find:hc,findLimit:dc,findSeries:fc,flatMap:uc,flatMapLimit:ac,flatMapSeries:cc,forEach:wc,forEachSeries:yc,forEachLimit:bc,forEachOf:$u,forEachOfSeries:zu,forEachOfLimit:Lu,inject:rc,foldl:rc,foldr:Hc,select:jc,selectLimit:Cc,selectSeries:Rc,wrapSync:Fu,during:ol,doDuring:gc},ul=Kt(Ca()),cl="http://www.w3.org/1999/02/22-rdf-syntax-ns#",ll="http://www.w3.org/2001/XMLSchema#",hl="http://www.w3.org/2000/10/swap/",dl={xsd:{decimal:`${ll}decimal`,boolean:`${ll}boolean`,double:`${ll}double`,integer:`${ll}integer`,string:`${ll}string`},rdf:{type:`${cl}type`,nil:`${cl}nil`,first:`${cl}first`,rest:`${cl}rest`,langString:`${cl}langString`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${hl}reify#forSome`,forAll:`${hl}reify#forAll`},log:{implies:`${hl}log#implies`}},fl=Kt(Ra()),{xsd:pl}=dl,vl=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,gl={"\\":"\\","'":"'",'"':'"',n:"\n",r:"\r",t:"\t",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},ml=/[\x00-\x20<>\\"\{\}\|\^\`]/,wl={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},bl=/$0^/,{rdf:yl,xsd:xl}=dl,kl=0,El={namedNode:function(t){return new Fl(t)},blankNode:function(t){return new _l(t||"n3-"+kl++)},variable:function(t){return new jl(t)},literal:function(t,e){if("string"==typeof e)return new Al(`"${t}"@${e.toLowerCase()}`);let n=e?e.value:"";return""===n&&("boolean"==typeof t?n=xl.boolean:"number"==typeof t&&(Number.isFinite(t)?n=Number.isInteger(t)?xl.integer:xl.double:(n=xl.double,Number.isNaN(t)||(t=t>0?"INF":"-INF")))),new Al(""===n||n===xl.string?`"${t}"`:`"${t}"^^${n}`)},defaultGraph:function(){return il},quad:Rl,triple:Rl},Sl=class{constructor(t){this.id=t}get value(){return this.id}equals(t){return t instanceof Sl?this.id===t.id:!!t&&this.termType===t.termType&&this.value===t.value}hashCode(){return 0}toJSON(){return{termType:this.termType,value:this.value}}},Fl=class extends Sl{get termType(){return"NamedNode"}},Al=class extends Sl{get termType(){return"Literal"}get value(){return this.id.substring(1,this.id.lastIndexOf('"'))}get language(){const t=this.id;let e=t.lastIndexOf('"')+1;return e<t.length&&"@"===t[e++]?t.substr(e).toLowerCase():""}get datatype(){return new Fl(this.datatypeString)}get datatypeString(){const t=this.id,e=t.lastIndexOf('"')+1,n=e<t.length?t[e]:"";return"^"===n?t.substr(e+2):"@"!==n?xl.string:yl.langString}equals(t){return t instanceof Al?this.id===t.id:!!t&&!!t.datatype&&this.termType===t.termType&&this.value===t.value&&this.language===t.language&&this.datatype.value===t.datatype.value}toJSON(){return{termType:this.termType,value:this.value,language:this.language,datatype:{termType:"NamedNode",value:this.datatypeString}}}},_l=class extends Sl{constructor(t){super(`_:${t}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}},jl=class extends Sl{constructor(t){super(`?${t}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}};il=new class extends Sl{constructor(){return super(""),il||this}get termType(){return"DefaultGraph"}equals(t){return this===t||!!t&&this.termType===t.termType}};var Cl=class extends Sl{constructor(t,e,n,i){super(""),this._subject=t,this._predicate=e,this._object=n,this._graph=i||il}get termType(){return"Quad"}get subject(){return this._subject}get predicate(){return this._predicate}get object(){return this._object}get graph(){return this._graph}toJSON(){return{termType:this.termType,subject:this._subject.toJSON(),predicate:this._predicate.toJSON(),object:this._object.toJSON(),graph:this._graph.toJSON()}}equals(t){return!!t&&this._subject.equals(t.subject)&&this._predicate.equals(t.predicate)&&this._object.equals(t.object)&&this._graph.equals(t.graph)}};function Rl(t,e,n,i){return new Cl(t,e,n,i)}var Il=0,Tl=class{constructor(t){this._contextStack=[],this._graph=null,this._setBase((t=t||{}).baseIRI),t.factory&&Nl(this,t.factory);const e="string"==typeof t.format?t.format.match(/\w*$/)[0].toLowerCase():"",n=/turtle/.test(e),i=/trig/.test(e),r=/triple/.test(e),o=/quad/.test(e),s=this._n3Mode=/n3/.test(e),a=r||o;(this._supportsNamedGraphs=!(n||s))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(n||i||r||s),this._supportsRDFStar=""===e||/star|\*$/.test(e),a&&(this._resolveRelativeIRI=()=>null),this._blankNodePrefix="string"!=typeof t.blankNodePrefix?"":t.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=t.lexer||new class{constructor(t){if(this._iri=/^<((?:[^ <>{}\\]|\\[uU])+)>[ \t]*/,this._unescapedIri=/^<([^\x00-\x20<>\\"\{\}\|\^\`]*)>[ \t]*/,this._simpleQuotedString=/^"([^"\\\r\n]*)"(?=[^"])/,this._simpleApostropheString=/^'([^'\\\r\n]*)'(?=[^'])/,this._langcode=/^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9\-])/i,this._prefix=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:(?=[#\s<])/,this._prefixed=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:((?:(?:[0-:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])(?:(?:[\.\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])*(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~]))?)?)(?:[ \t]+|(?=\.?[,;!\^\s#()\[\]\{\}"'<>]))/,this._variable=/^\?(?:(?:[A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?=[.,;!\^\s#()\[\]\{\}"'<>])/,this._blank=/^_:((?:[0-9A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?:[ \t]+|(?=\.?[,;:\s#()\[\]\{\}"'<>]))/,this._number=/^[\-+]?(?:(\d+\.\d*|\.?\d+)[eE][\-+]?|\d*(\.)?)\d+(?=\.?[,;:\s#()\[\]\{\}"'<>])/,this._boolean=/^(?:true|false)(?=[.,;\s#()\[\]\{\}"'<>])/,this._keyword=/^@[a-z]+(?=[\s#<:])/i,this._sparqlKeyword=/^(?:PREFIX|BASE|GRAPH)(?=[\s#<])/i,this._shortPredicates=/^a(?=[\s#()\[\]\{\}"'<>])/,this._newline=/^[ \t]*(?:#[^\n\r]*)?(?:\r\n|\n|\r)[ \t]*/,this._comment=/#([^\n\r]*)/,this._whitespace=/^[ \t]+/,this._endOfFile=/^(?:#[^\n\r]*)?$/,this._lineMode=!!(t=t||{}).lineMode){this._n3Mode=!1;for(const t in this)!(t in wl)&&this[t]instanceof RegExp&&(this[t]=bl)}else this._n3Mode=!1!==t.n3;this._comments=!!t.comments,this._literalClosingPos=0}_tokenizeToEnd(t,e){let n=this._input,i=n.length;for(;;){let t,s;for(;t=this._newline.exec(n);)this._comments&&(s=this._comment.exec(t[0]))&&r("comment",s[1],"",this._line,t[0].length),n=n.substr(t[0].length,n.length),i=n.length,this._line++;if(!t&&(t=this._whitespace.exec(n))&&(n=n.substr(t[0].length,n.length)),this._endOfFile.test(n))return e&&(this._comments&&(s=this._comment.exec(n))&&r("comment",s[1],"",this._line,n.length),n=null,r("eof","","",this._line,0)),this._input=n;const a=this._line,u=n[0];let c="",l="",h="",d=null,f=0,p=!1;switch(u){case"^":if(n.length<3)break;if("^"!==n[1]){this._n3Mode&&(f=1,c="^");break}if(this._previousMarker="^^",n=n.substr(2),"<"!==n[0]){p=!0;break}case"<":if(d=this._unescapedIri.exec(n))c="IRI",l=d[1];else if(d=this._iri.exec(n)){if(l=this._unescape(d[1]),null===l||ml.test(l))return o(this);c="IRI"}else n.length>1&&"<"===n[1]?(c="<<",f=2):this._n3Mode&&n.length>1&&"="===n[1]&&(c="inverse",f=2,l=">");break;case">":n.length>1&&">"===n[1]&&(c=">>",f=2);break;case"_":((d=this._blank.exec(n))||e&&(d=this._blank.exec(`${n} `)))&&(c="blank",h="_",l=d[1]);break;case'"':if(d=this._simpleQuotedString.exec(n))l=d[1];else if(({value:l,matchLength:f}=this._parseLiteral(n)),null===l)return o(this);null===d&&0===f||(c="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(d=this._simpleApostropheString.exec(n))l=d[1];else if(({value:l,matchLength:f}=this._parseLiteral(n)),null===l)return o(this);null===d&&0===f||(c="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(d=this._variable.exec(n))&&(c="var",l=d[0]);break;case"@":"literal"===this._previousMarker&&(d=this._langcode.exec(n))?(c="langcode",l=d[1]):(d=this._keyword.exec(n))&&(c=d[0]);break;case".":if(1===n.length?e:n[1]<"0"||n[1]>"9"){c=".",f=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":(d=this._number.exec(n)||e&&(d=this._number.exec(`${n} `)))&&(c="literal",l=d[0],h="string"==typeof d[1]?pl.double:"string"==typeof d[2]?pl.decimal:pl.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(d=this._sparqlKeyword.exec(n))?c=d[0].toUpperCase():p=!0;break;case"f":case"t":(d=this._boolean.exec(n))?(c="literal",l=d[0],h=pl.boolean):p=!0;break;case"a":(d=this._shortPredicates.exec(n))?(c="abbreviation",l="a"):p=!0;break;case"=":this._n3Mode&&n.length>1&&(c="abbreviation",">"!==n[1]?(f=1,l="="):(f=2,l=">"));break;case"!":if(!this._n3Mode)break;case",":case";":case"[":case"]":case"(":case")":case"{":case"}":this._lineMode||(f=1,c=u);break;default:p=!0}if(p&&("@prefix"!==this._previousMarker&&"PREFIX"!==this._previousMarker||!(d=this._prefix.exec(n))?((d=this._prefixed.exec(n))||e&&(d=this._prefixed.exec(`${n} `)))&&(c="prefixed",h=d[1]||"",l=this._unescape(d[2])):(c="prefix",l=d[1]||"")),"^^"===this._previousMarker)switch(c){case"prefixed":c="type";break;case"IRI":c="typeIRI";break;default:c=""}if(!c)return e||!/^'''|^"""/.test(n)&&/\n|\r/.test(n)?o(this):this._input=n;const v=f||d[0].length,g=r(c,l,h,a,v);this.previousToken=g,this._previousMarker=c,n=n.substr(v,n.length)}function r(e,r,o,s,a){const u=n?i-n.length:i,c={type:e,value:r,prefix:o,line:s,start:u,end:u+a};return t(null,c),c}function o(e){t(e._syntaxError(/^\S*/.exec(n)[0]))}}_unescape(t){let e=!1;const n=t.replace(vl,((t,n,i,r)=>{if("string"==typeof n)return String.fromCharCode(Number.parseInt(n,16));if("string"==typeof i){let t=Number.parseInt(i,16);return t<=65535?String.fromCharCode(Number.parseInt(i,16)):String.fromCharCode(55296+((t-=65536)>>10),56320+(1023&t))}return r in gl?gl[r]:(e=!0,"")}));return e?null:n}_parseLiteral(t){if(t.length>=3){const e=t.match(/^(?:"""|"|'''|'|)/)[0],n=e.length;let i=Math.max(this._literalClosingPos,n);for(;(i=t.indexOf(e,i))>0;){let e=0;for(;"\\"===t[i-e-1];)e++;if(e%2==0){const e=t.substring(n,i),r=e.split(/\r\n|\r|\n/).length-1,o=i+n;if(1===n&&0!==r||3===n&&this._lineMode)break;return this._line+=r,{value:this._unescape(e),matchLength:o}}i++}this._literalClosingPos=t.length-n+1}return{value:"",matchLength:0}}_syntaxError(t){this._input=null;const e=new Error(`Unexpected "${t}" on line ${this._line}.`);return e.context={token:void 0,line:this._line,previousToken:this.previousToken},e}_readStartingBom(t){return t.startsWith("\ufeff")?t.substr(1):t}tokenize(t,e){if(this._line=1,"string"==typeof t){if(this._input=this._readStartingBom(t),"function"!=typeof e){const t=[];let e;if(this._tokenizeToEnd(((n,i)=>n?e=n:t.push(i)),!0),e)throw e;return t}(0,fl.default)((()=>this._tokenizeToEnd(e,!0)))}else this._pendingBuffer=null,"function"==typeof t.setEncoding&&t.setEncoding("utf8"),t.on("data",(t=>{null!==this._input&&0!==t.length&&(this._pendingBuffer&&(t=Buffer.concat([this._pendingBuffer,t]),this._pendingBuffer=null),128&t[t.length-1]?this._pendingBuffer=t:(void 0===this._input?this._input=this._readStartingBom("string"==typeof t?t:t.toString()):this._input+=t,this._tokenizeToEnd(e,!1)))})),t.on("end",(()=>{"string"==typeof this._input&&this._tokenizeToEnd(e,!0)})),t.on("error",e)}}({lineMode:a,n3:s}),this._explicitQuantifiers=!!t.explicitQuantifiers}static _resetBlankNodePrefix(){Il=0}_setBase(t){if(t){const e=t.indexOf("#");e>=0&&(t=t.substr(0,e)),this._base=t,this._basePath=t.indexOf("/")<0?t:t.replace(/[^\/?]*(?:\?.*)?$/,""),t=t.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i),this._baseRoot=t[0],this._baseScheme=t[1]}else this._base="",this._basePath=""}_saveContext(t,e,n,i,r){const o=this._n3Mode;this._contextStack.push({type:t,subject:n,predicate:i,object:r,graph:e,inverse:!!o&&this._inversePredicate,blankPrefix:o?this._prefixes._:"",quantified:o?this._quantified:null}),o&&(this._inversePredicate=!1,this._prefixes._=this._graph?`${this._graph.id.substr(2)}.`:".",this._quantified=Object.create(this._quantified))}_restoreContext(t,e){const n=this._contextStack.pop();if(!n||n.type!==t)return this._error(`Unexpected ${e.type}`,e);this._subject=n.subject,this._predicate=n.predicate,this._object=n.object,this._graph=n.graph,this._n3Mode&&(this._inversePredicate=n.inverse,this._prefixes._=n.blankPrefix,this._quantified=n.quantified)}_readInTopContext(t){switch(t.type){case"eof":return null!==this._graph?this._error("Unclosed graph",t):(delete this._prefixes._,this._callback(null,null,this._prefixes));case"PREFIX":this._sparqlStyle=!0;case"@prefix":return this._readPrefix;case"BASE":this._sparqlStyle=!0;case"@base":return this._readBaseIRI;case"{":if(this._supportsNamedGraphs)return this._graph="",this._subject=null,this._readSubject;case"GRAPH":if(this._supportsNamedGraphs)return this._readNamedGraphLabel;default:return this._readSubject(t)}}_readEntity(t,e){let n;switch(t.type){case"IRI":case"typeIRI":const e=this._resolveIRI(t.value);if(null===e)return this._error("Invalid IRI",t);n=this._namedNode(e);break;case"type":case"prefixed":const i=this._prefixes[t.prefix];if(void 0===i)return this._error(`Undefined prefix "${t.prefix}:"`,t);n=this._namedNode(i+t.value);break;case"blank":n=this._blankNode(this._prefixes[t.prefix]+t.value);break;case"var":n=this._variable(t.value.substr(1));break;default:return this._error(`Expected entity but got ${t.type}`,t)}return!e&&this._n3Mode&&n.id in this._quantified&&(n=this._quantified[n.id]),n}_readSubject(t){switch(this._predicate=null,t.type){case"[":return this._saveContext("blank",this._graph,this._subject=this._blankNode(),null,null),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this.RDF_NIL,null,null),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._graph=this._blankNode(),null,null),this._readSubject):this._error("Unexpected graph",t);case"}":return this._readPunctuation(t);case"@forSome":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORSOME,this._quantifier=this._blankNode,this._readQuantifierList):this._error('Unexpected "@forSome"',t);case"@forAll":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORALL,this._quantifier=this._variable,this._readQuantifierList):this._error('Unexpected "@forAll"',t);case"literal":if(!this._n3Mode)return this._error("Unexpected literal",t);if(0===t.prefix.length)return this._literalValue=t.value,this._completeSubjectLiteral;this._subject=this._literal(t.value,this._namedNode(t.prefix));break;case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,null,null,null),this._graph=null,this._readSubject):this._error("Unexpected RDF* syntax",t);default:if(void 0===(this._subject=this._readEntity(t)))return;if(this._n3Mode)return this._getPathReader(this._readPredicateOrNamedGraph)}return this._readPredicateOrNamedGraph}_readPredicate(t){const e=t.type;switch(e){case"inverse":this._inversePredicate=!0;case"abbreviation":this._predicate=this.ABBREVIATIONS[t.value];break;case".":case"]":case"}":return null===this._predicate?this._error(`Unexpected ${e}`,t):(this._subject=null,"]"===e?this._readBlankNodeTail(t):this._readPunctuation(t));case";":return null!==this._predicate?this._readPredicate:this._error("Expected predicate but got ;",t);case"[":if(this._n3Mode)return this._saveContext("blank",this._graph,this._subject,this._subject=this._blankNode(),null),this._readBlankNodeHead;case"blank":if(!this._n3Mode)return this._error("Disallowed blank node as predicate",t);default:if(void 0===(this._predicate=this._readEntity(t)))return}return this._readObject}_readObject(t){switch(t.type){case"literal":if(0===t.prefix.length)return this._literalValue=t.value,this._readDataTypeOrLang;this._object=this._literal(t.value,this._namedNode(t.prefix));break;case"[":return this._saveContext("blank",this._graph,this._subject,this._predicate,this._subject=this._blankNode()),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this._subject,this._predicate,this.RDF_NIL),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._blankNode()),this._readSubject):this._error("Unexpected graph",t);case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject):this._error("Unexpected RDF* syntax",t);default:if(void 0===(this._object=this._readEntity(t)))return;if(this._n3Mode)return this._getPathReader(this._getContextEndReader())}return this._getContextEndReader()}_readPredicateOrNamedGraph(t){return"{"===t.type?this._readGraph(t):this._readPredicate(t)}_readGraph(t){return"{"!==t.type?this._error(`Expected graph but got ${t.type}`,t):(this._graph=this._subject,this._subject=null,this._readSubject)}_readBlankNodeHead(t){return"]"===t.type?(this._subject=null,this._readBlankNodeTail(t)):(this._predicate=null,this._readPredicate(t))}_readBlankNodeTail(t){if("]"!==t.type)return this._readBlankNodePunctuation(t);null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph);const e=null===this._predicate;return this._restoreContext("blank",t),null!==this._object?this._getContextEndReader():null!==this._predicate?this._readObject:e?this._readPredicateOrNamedGraph:this._readPredicateAfterBlank}_readPredicateAfterBlank(t){switch(t.type){case".":case"}":return this._subject=null,this._readPunctuation(t);default:return this._readPredicate(t)}}_readListItem(t){let e=null,n=null,i=this._readListItem;const r=this._subject,o=this._contextStack,s=o[o.length-1];switch(t.type){case"[":this._saveContext("blank",this._graph,n=this._blankNode(),this.RDF_FIRST,this._subject=e=this._blankNode()),i=this._readBlankNodeHead;break;case"(":this._saveContext("list",this._graph,n=this._blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case")":if(this._restoreContext("list",t),0!==o.length&&"list"===o[o.length-1].type&&this._emit(this._subject,this._predicate,this._object,this._graph),null===this._predicate){if(i=this._readPredicate,this._subject===this.RDF_NIL)return i}else if(i=this._getContextEndReader(),this._object===this.RDF_NIL)return i;n=this.RDF_NIL;break;case"literal":0===t.prefix.length?(this._literalValue=t.value,i=this._readListItemDataTypeOrLang):(e=this._literal(t.value,this._namedNode(t.prefix)),i=this._getContextEndReader());break;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._blankNode()),this._readSubject):this._error("Unexpected graph",t);default:if(void 0===(e=this._readEntity(t)))return}if(null===n&&(this._subject=n=this._blankNode()),null===r?null===s.predicate?s.subject=n:s.object=n:this._emit(r,this.RDF_REST,n,this._graph),null!==e){if(this._n3Mode&&("IRI"===t.type||"prefixed"===t.type))return this._saveContext("item",this._graph,n,this.RDF_FIRST,e),this._subject=e,this._predicate=null,this._getPathReader(this._readListItem);this._emit(n,this.RDF_FIRST,e,this._graph)}return i}_readDataTypeOrLang(t){return this._completeObjectLiteral(t,!1)}_readListItemDataTypeOrLang(t){return this._completeObjectLiteral(t,!0)}_completeLiteral(t){let e=this._literal(this._literalValue);switch(t.type){case"type":case"typeIRI":const n=this._readEntity(t);if(void 0===n)return;e=this._literal(this._literalValue,n),t=null;break;case"langcode":e=this._literal(this._literalValue,t.value),t=null}return{token:t,literal:e}}_completeSubjectLiteral(t){return this._subject=this._completeLiteral(t).literal,this._readPredicateOrNamedGraph}_completeObjectLiteral(t,e){const n=this._completeLiteral(t);if(n)return this._object=n.literal,e&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),null===n.token?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(n.token))}_readFormulaTail(t){return"}"!==t.type?this._readPunctuation(t):(null!==this._subject&&this._emit(this._subject,this._predicate,this._object,this._graph),this._restoreContext("formula",t),null===this._object?this._readPredicate:this._getContextEndReader())}_readPunctuation(t){let e,n=this._graph;const i=this._subject,r=this._inversePredicate;switch(t.type){case"}":if(null===this._graph)return this._error("Unexpected graph closing",t);if(this._n3Mode)return this._readFormulaTail(t);this._graph=null;case".":this._subject=null,e=this._contextStack.length?this._readSubject:this._readInTopContext,r&&(this._inversePredicate=!1);break;case";":e=this._readPredicate;break;case",":e=this._readObject;break;default:if(this._supportsQuads&&null===this._graph&&void 0!==(n=this._readEntity(t))){e=this._readQuadPunctuation;break}return this._error(`Expected punctuation to follow "${this._object.id}"`,t)}if(null!==i){const t=this._predicate,e=this._object;r?this._emit(e,t,i,n):this._emit(i,t,e,n)}return e}_readBlankNodePunctuation(t){let e;switch(t.type){case";":e=this._readPredicate;break;case",":e=this._readObject;break;default:return this._error(`Expected punctuation to follow "${this._object.id}"`,t)}return this._emit(this._subject,this._predicate,this._object,this._graph),e}_readQuadPunctuation(t){return"."!==t.type?this._error("Expected dot to follow quad",t):this._readInTopContext}_readPrefix(t){return"prefix"!==t.type?this._error("Expected prefix to follow @prefix",t):(this._prefix=t.value,this._readPrefixIRI)}_readPrefixIRI(t){if("IRI"!==t.type)return this._error(`Expected IRI to follow prefix "${this._prefix}:"`,t);const e=this._readEntity(t);return this._prefixes[this._prefix]=e.value,this._prefixCallback(this._prefix,e),this._readDeclarationPunctuation}_readBaseIRI(t){const e="IRI"===t.type&&this._resolveIRI(t.value);return e?(this._setBase(e),this._readDeclarationPunctuation):this._error("Expected valid IRI to follow base declaration",t)}_readNamedGraphLabel(t){switch(t.type){case"IRI":case"blank":case"prefixed":return this._readSubject(t),this._readGraph;case"[":return this._readNamedGraphBlankLabel;default:return this._error("Invalid graph label",t)}}_readNamedGraphBlankLabel(t){return"]"!==t.type?this._error("Invalid graph label",t):(this._subject=this._blankNode(),this._readGraph)}_readDeclarationPunctuation(t){return this._sparqlStyle?(this._sparqlStyle=!1,this._readInTopContext(t)):"."!==t.type?this._error("Expected declaration to end with a dot",t):this._readInTopContext}_readQuantifierList(t){let e;switch(t.type){case"IRI":case"prefixed":if(void 0!==(e=this._readEntity(t,!0)))break;default:return this._error(`Unexpected ${t.type}`,t)}return this._explicitQuantifiers?(null===this._subject?this._emit(this._graph||this.DEFAULTGRAPH,this._predicate,this._subject=this._blankNode(),this.QUANTIFIERS_GRAPH):this._emit(this._subject,this.RDF_REST,this._subject=this._blankNode(),this.QUANTIFIERS_GRAPH),this._emit(this._subject,this.RDF_FIRST,e,this.QUANTIFIERS_GRAPH)):this._quantified[e.id]=this._quantifier(this._blankNode().value),this._readQuantifierPunctuation}_readQuantifierPunctuation(t){return","===t.type?this._readQuantifierList:(this._explicitQuantifiers&&(this._emit(this._subject,this.RDF_REST,this.RDF_NIL,this.QUANTIFIERS_GRAPH),this._subject=null),this._readCallback=this._getContextEndReader(),this._readCallback(t))}_getPathReader(t){return this._afterPath=t,this._readPath}_readPath(t){switch(t.type){case"!":return this._readForwardPath;case"^":return this._readBackwardPath;default:const e=this._contextStack,n=e.length&&e[e.length-1];if(n&&"item"===n.type){const e=this._subject;this._restoreContext("item",t),this._emit(this._subject,this.RDF_FIRST,e,this._graph)}return this._afterPath(t)}}_readForwardPath(t){let e,n;const i=this._blankNode();if(void 0!==(n=this._readEntity(t)))return null===this._predicate?(e=this._subject,this._subject=i):(e=this._object,this._object=i),this._emit(e,n,i,this._graph),this._readPath}_readBackwardPath(t){const e=this._blankNode();let n,i;if(void 0!==(n=this._readEntity(t)))return null===this._predicate?(i=this._subject,this._subject=e):(i=this._object,this._object=e),this._emit(e,n,i,this._graph),this._readPath}_readRDFStarTailOrGraph(t){return">>"!==t.type?this._supportsQuads&&null===this._graph&&void 0!==(this._graph=this._readEntity(t))?this._readRDFStarTail:this._error(`Expected >> to follow "${this._object.id}"`,t):this._readRDFStarTail(t)}_readRDFStarTail(t){if(">>"!==t.type)return this._error(`Expected >> but got ${t.type}`,t);const e=this._quad(this._subject,this._predicate,this._object,this._graph||this.DEFAULTGRAPH);return this._restoreContext("<<",t),null===this._subject?(this._subject=e,this._readPredicate):(this._object=e,this._getContextEndReader())}_getContextEndReader(){const t=this._contextStack;if(!t.length)return this._readPunctuation;switch(t[t.length-1].type){case"blank":return this._readBlankNodeTail;case"list":return this._readListItem;case"formula":return this._readFormulaTail;case"<<":return this._readRDFStarTailOrGraph}}_emit(t,e,n,i){this._callback(null,this._quad(t,e,n,i||this.DEFAULTGRAPH))}_error(t,e){const n=new Error(`${t} on line ${e.line}.`);n.context={token:e,line:e.line,previousToken:this._lexer.previousToken},this._callback(n),this._callback=Ol}_resolveIRI(t){return/^[a-z][a-z0-9+.-]*:/i.test(t)?t:this._resolveRelativeIRI(t)}_resolveRelativeIRI(t){if(!t.length)return this._base;switch(t[0]){case"#":return this._base+t;case"?":return this._base.replace(/(?:\?.*)?$/,t);case"/":return("/"===t[1]?this._baseScheme:this._baseRoot)+this._removeDotSegments(t);default:return/^[^/:]*:/.test(t)?null:this._removeDotSegments(this._basePath+t)}}_removeDotSegments(t){if(!/(^|\/)\.\.?($|[/#?])/.test(t))return t;const e=t.length;let n="",i=-1,r=-1,o=0,s="/";for(;i<e;){switch(s){case":":if(r<0&&"/"===t[++i]&&"/"===t[++i])for(;(r=i+1)<e&&"/"!==t[r];)i=r;break;case"?":case"#":i=e;break;case"/":if("."===t[i+1])switch(s=t[1+ ++i],s){case"/":n+=t.substring(o,i-1),o=i+1;break;case void 0:case"?":case"#":return n+t.substring(o,i)+t.substr(i+1);case".":if(s=t[1+ ++i],void 0===s||"/"===s||"?"===s||"#"===s){if(n+=t.substring(o,i-2),(o=n.lastIndexOf("/"))>=r&&(n=n.substr(0,o)),"/"!==s)return`${n}/${t.substr(i+1)}`;o=i+1}}}s=t[++i]}return n+t.substring(o)}parse(t,e,n){if(this._readCallback=this._readInTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${Il++}_`,this._prefixCallback=n||Ol,this._inversePredicate=!1,this._quantified=Object.create(null),!e){const e=[];let n;if(this._callback=(t,i)=>{t?n=t:i&&e.push(i)},this._lexer.tokenize(t).every((t=>this._readCallback=this._readCallback(t))),n)throw n;return e}this._callback=e,this._lexer.tokenize(t,((t,e)=>{null!==t?(this._callback(t),this._callback=Ol):this._readCallback&&(this._readCallback=this._readCallback(e))}))}};function Ol(){}function Nl(t,e){const n=e.namedNode;t._namedNode=n,t._blankNode=e.blankNode,t._literal=e.literal,t._variable=e.variable,t._quad=e.quad,t.DEFAULTGRAPH=e.defaultGraph(),t.RDF_FIRST=n(dl.rdf.first),t.RDF_REST=n(dl.rdf.rest),t.RDF_NIL=n(dl.rdf.nil),t.N3_FORALL=n(dl.r.forAll),t.N3_FORSOME=n(dl.r.forSome),t.ABBREVIATIONS={a:n(dl.rdf.type),"=":n(dl.owl.sameAs),">":n(dl.log.implies)},t.QUANTIFIERS_GRAPH=n("urn:n3:quantifiers")}Nl(Tl.prototype,El);var Pl=El.defaultGraph(),{rdf:Dl,xsd:Ml}=dl,Ul=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,Ll=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,Bl={"\\":"\\\\",'"':'\\"',"\t":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"},Jl=class extends Sl{equals(){return!1}};function $l(t){let e=Bl[t];return void 0===e&&(1===t.length?(e=t.charCodeAt(0).toString(16),e="\\u0000".substr(0,6-e.length)+e):(e=(1024*(t.charCodeAt(0)-55296)+t.charCodeAt(1)+9216).toString(16),e="\\U00000000".substr(0,10-e.length)+e)),e}function Hl(t){return t.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}function Kl(t,e,n,i,r,o,s){try{var a=t[o](s),u=a.value}catch(t){return void n(t)}a.done?e(u):Promise.resolve(u).then(i,r)}var zl=Kt(Oa());new fu("chrome:theSession");var Wl=function(){qa(i,Qa);var t,e,n=(t=i,e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var n,i=Xa(t);if(e){var r=Xa(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return Ga(this,n)});function i(){var t;return Ka(this,i),Ya(za(t=n.call(this,"")),"value",""),Ya(za(t),"termType","DefaultGraph"),Ya(za(t),"uri","chrome:theSession"),t}return Ha(i,[{key:"toCanonical",value:function(){return this.value}},{key:"toString",value:function(){return"DefaultGraph"}}]),i}();function ql(t){return!!t&&"DefaultGraph"===t.termType}var Vl=new Wl,Gl=function(){function t(e,n,i,r){Ka(this,t),Ya(this,"subject",void 0),Ya(this,"predicate",void 0),Ya(this,"object",void 0),Ya(this,"graph",void 0),this.subject=Qa.fromValue(e),this.predicate=Qa.fromValue(n),this.object=Qa.fromValue(i),this.graph=null==r?Vl:Qa.fromValue(r)}return Ha(t,[{key:"why",get:function(){return this.graph},set:function(t){this.graph=t}},{key:"equals",value:function(t){return t.subject.equals(this.subject)&&t.predicate.equals(this.predicate)&&t.object.equals(this.object)&&t.graph.equals(this.graph)}},{key:"substitute",value:function(e){var n=new t(this.subject.substitute(e),this.predicate.substitute(e),this.object.substitute(e),ql(this.graph)?this.graph:this.graph.substitute(e));return console.log("@@@ statement substitute:"+n),n}},{key:"toCanonical",value:function(){var t=[this.subject.toCanonical(),this.predicate.toCanonical(),this.object.toCanonical()];return this.graph&&"DefaultGraph"!==this.graph.termType&&t.push(this.graph.toCanonical()),t.join(" ")+" ."}},{key:"toNT",value:function(){return[this.subject.toNT(),this.predicate.toNT(),this.object.toNT()].join(" ")+" ."}},{key:"toNQ",value:function(){return[this.subject.toNT(),this.predicate.toNT(),this.object.toNT(),ql(this.graph)?"":this.graph.toNT()].join(" ")+" ."}},{key:"toString",value:function(){return this.toNT()}}]),t}(),Xl={};$t(Xl,{docpart:()=>Zl,document:()=>Ql,hostpart:()=>th,join:()=>eh,protocol:()=>nh,refTo:()=>ih});var Yl=Yl||console.log;function Zl(t){var e;return(e=t.indexOf("#"))<0?t:t.slice(0,e)}function Ql(t){return new fu(Zl(t))}function th(t){var e=/[^\/]*\/\/([^\/]*)\//.exec(t);return e?e[1]:""}function eh(t,e){var n,i,r,o,s,a=e.indexOf("#");if(a>0&&(e=e.slice(0,a)),0===t.length)return e;if(0===t.indexOf("#"))return e+t;if(t.indexOf(":")>=0)return t;if(n=e.indexOf(":"),0===e.length)return t;if(n<0)return Yl("Invalid base: "+e+" in join with given: "+t),t;if(i=e.slice(0,+n+1||9e9),0===t.indexOf("//"))return i+t;if(e.indexOf("//",n)===n+1){if((r=e.indexOf("/",n+3))<0)return e.length-n-3>0?e+"/"+t:i+t}else if((r=e.indexOf("/",n+1))<0)return e.length-n-1>0?e+"/"+t:i+t;if(0===t.indexOf("/"))return e.slice(0,r)+t;if((o=(s=e.slice(r)).lastIndexOf("/"))<0)return i+t;for(o>=0&&o<s.length-1&&(s=s.slice(0,+o+1||9e9)),s+=t;s.match(/[^\/]*\/\.\.\//);)s=s.replace(/[^\/]*\/\.\.\//,"");return s=(s=s.replace(/\.\//g,"")).replace(/\/\.$/,"/"),e.slice(0,r)+s}function nh(t){var e=t.indexOf(":");return e<0?null:t.slice(0,e)}function ih(t,e){var n,i,r,o,s,a,u,c,l,h,d,f,p=new RegExp("^[-_a-zA-Z0-9.]+:(//[^/]*)?/[^/]*$");if(!t)return e;if(t===e)return"";for(n=u=0,o=e.length;u<o&&e[n]===t[n];n=++u);if(t.slice(0,n).match(p)&&((i=e.indexOf("//"))<0&&(i=-2),r=e.indexOf("/",i+2),"/"!==e[r+1]&&"/"!==t[r+1]&&e.slice(0,r)===t.slice(0,r)))return e.slice(r);if("#"===e[n]&&t.length===n)return e.slice(n);for(;n>0&&"/"!==e[n-1];)n--;if(n<3)return e;if(t.indexOf("//",n-2)>0||e.indexOf("//",n-2)>0)return e;if(t.indexOf(":",n)>0)return e;for(a=0,c=0,s=(h=t.slice(n)).length;c<s;c++)"/"===h[c]&&a++;if(0===a&&n<e.length&&"#"===e[n])return"./"+e.slice(n);if(0===a&&n===e.length)return"./";if(f="",a>0)for(l=1,d=a;d>=1?l<=d:l>=d;d>=1?++l:--l)f+="../";return f+e.slice(n)}var rh,oh,sh,ah=function(){qa(i,Qa);var t,e,n=(t=i,e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var n,i=Xa(t);if(e){var r=Xa(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return Ga(this,n)});function i(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return Ka(this,i),Ya(za(t=n.call(this,e)),"termType","Variable"),Ya(za(t),"base","varid:"),Ya(za(t),"classOrder",Za.Variable),Ya(za(t),"isVar",1),Ya(za(t),"uri",void 0),t.base="varid:",t.uri=eh(e,t.base),t}return Ha(i,[{key:"equals",value:function(t){return!!t&&this.termType===t.termType&&this.value===t.value}},{key:"hashString",value:function(){return this.toString()}},{key:"substitute",value:function(t){var e;return null!=(e=t[this.toNT()])?e:this}},{key:"toString",value:function(){return i.toString(this)}}],[{key:"toString",value:function(t){return t.uri.slice(0,t.base.length)===t.base?"?".concat(t.uri.slice(t.base.length)):"?".concat(t.uri)}}]),i}();(oh=rh||(rh={})).collections="COLLECTIONS",oh.defaultGraphType="DEFAULT_GRAPH_TYPE",oh.equalsMethod="EQUALS_METHOD",oh.id="ID",oh.identity="IDENTITY",oh.reversibleId="REVERSIBLE_ID",oh.variableType="VARIABLE_TYPE";var uh=new Wl,ch={supports:(sh={},Ya(sh,rh.collections,!1),Ya(sh,rh.defaultGraphType,!1),Ya(sh,rh.equalsMethod,!0),Ya(sh,rh.identity,!1),Ya(sh,rh.id,!0),Ya(sh,rh.reversibleId,!1),Ya(sh,rh.variableType,!0),sh),blankNode:function(t){return new tu(t)},defaultGraph:function(){return uh},equals:function(t,e){return t===e||!t||!e||(uu(t)||uu(e)?!(!uu(t)||!uu(e))&&this.equals(t.subject,e.subject)&&this.equals(t.predicate,e.predicate)&&this.equals(t.object,e.object)&&this.equals(t.graph,e.graph):!(!su(t)||!su(e))&&this.id(t)===this.id(e))},id:function(t){if(!t)return"undefined";if(uu(t))return this.quadToNQ(t);switch(t.termType){case"DefaultGraph":return"defaultGraph";case"Variable":return ah.toString(t);default:var e=this.termToNQ(t);if(e)return e;throw new Error("Can't id term with type '".concat(t.termType,"'"))}},isQuad:function(t){return t instanceof Gl},literal:function(t,e){if("string"!=typeof t&&!e)return vu.fromValue(t);var n="string"==typeof t?t:""+t;return"string"==typeof e?-1===e.indexOf(":")?new vu(n,e):new vu(n,null,this.namedNode(e)):new vu(n,null,e)},namedNode:function(t){return new fu(t)},quad:function(t,e,n,i){return new Gl(t,e,n,i||uh)},triple:function(t,e,n,i){return this.quad(t,e,n,i)},quadToNQ:function(t){return"".concat(this.termToNQ(t.subject)," ").concat(this.termToNQ(t.predicate)," ").concat(this.termToNQ(t.object)," ").concat(this.termToNQ(t.graph)," .")},termToNQ:function(t){var e=this;switch(t.termType){case"BlankNode":return"_:"+t.value;case"DefaultGraph":return"";case"Empty":return"<http://www.w3.org/1999/02/22-rdf-syntax-ns#nil>";case"Literal":return vu.toNT(t);case"Graph":case"NamedNode":return"<"+t.value+">";case"Collection":return"("+t.elements.map((function(t){return e.termToNQ(t)})).join(" ")+")";default:throw new Error("Can't serialize nonstandard term type (was '".concat(t.termType,"')"))}},toNQ:function(t){return this.isQuad(t)?this.quadToNQ(t):this.termToNQ(t)},variable:function(t){return new ah(t)}},lh=function(){},hh=function(){},dh=function(){},fh=function(){};function ph(t,e){var n=e||{namedNode:function(t){return new fu(t)}};return function(e){return n.namedNode(t+(e||""))}}var vh=Kt(La());function gh(t,e){t.callbacks={};for(var n=e.length-1;n>=0;n--)t.callbacks[e[n]]=[];t.addHook=function(e){t.callbacks[e]||(t.callbacks[e]=[])},t.addCallback=function(e,n){t.callbacks[e].push(n)},t.removeCallback=function(e,n){for(var i=0;i<t.callbacks[e].length;i++)if(t.callbacks[e][i].name===n)return t.callbacks[e].splice(i,1),!0;return!1},t.insertCallback=function(e,n){t.callbacks[e].unshift(n)},t.fireCallbacks=function(e,n){var i,r,o=[],s=[],a=t.callbacks[e].length;for(i=a-1;i>=0;i--)(r=t.callbacks[e][i])&&r.apply(t,n)&&o.push(r);for(i=o.length-1;i>=0;i--)s.push(o[i]);for(i=a;i<t.callbacks[e].length;i++)s.push(t.callbacks[e][i]);t.callbacks[e]=s}}function mh(t,e){var n=[];(e=e||{})&&e.selfClosing&&e.selfClosing.split(" ").forEach((function(t){n[t]=!0}));var i=[];return e&&e.skipAttributes&&e.skipAttributes.split(" ").forEach((function(t){i[t]=!0})),wh(t,e,n,i)}function wh(t,e,n,i){var r,o="",s=[!1];if(void 0===t.nodeType)return o;if(1===t.nodeType){if(t.hasAttribute("class")&&e&&e.classWithChildText&&t.matches(e.classWithChildText.class))o+=t.querySelector(e.classWithChildText.element).textContent;else if(!(e&&e.skipNodeWithClass&&t.matches("."+e.skipNodeWithClass))){var a=t.nodeName.toLowerCase();o+="<"+a;var u=[];for(r=t.attributes.length-1;r>=0;r--){var c=t.attributes[r];if(!(i&&i.length>0&&i[c.name]||/^\d+$/.test(c.name))){if("class"===c.name&&e&&e.replaceClassItemWith&&c.value.split(" ").indexOf(e.replaceClassItemWith.source)>-1){var l=new RegExp(e.replaceClassItemWith.source,"g");c.value=c.value.replace(l,e.replaceClassItemWith.target).trim()}"class"===c.name&&e&&e.skipClassWithValue&&e.skipClassWithValue===c.value||u.push(c.name+"='"+c.value.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,""")+"'")}}if(u.length>0&&(e&&e.sortAttributes&&u.sort((function(t,e){return t.toLowerCase().localeCompare(e.toLowerCase())})),o+=" "+u.join(" ")),n&&n.ename)o+=" />";else{for(o+=">",o+="html"===a?"\n ":"",s.push("style"===a||"script"===a),r=0;r<t.childNodes.length;r++)o+=wh(t.childNodes[r]);s.pop(),o+="body"===a?"</"+a+">\n":"</"+a+">"}}}else if(8===t.nodeType)o+="\x3c!--"+t.nodeValue+"--\x3e";else if(3===t.nodeType||4===t.nodeType){var h=t.nodeValue.replace(/\n+$/,"");o+=s[s.length-1]?h:h.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}else console.log("Warning; Cannot handle serialising nodes of type: "+t.nodeType),console.log(t);return o}function bh(t,e,n,i){var r=function(t){return"BlankNode"===t.termType?null:t},o=function(t){var e=n.statementsMatching(t).map((function(t){return r(t.subject)+" "+r(t.predicate)+" "+r(t.object)})).concat(n.statementsMatching(void 0,void 0,t).map((function(t){return r(t.subject)+" "+r(t.predicate)+" "+r(t.object)})));return e.sort(),e.join("\n")},s=Object.prototype.hasOwnProperty.call(n,"compareTerms")?n.compareTerms(t,e):t.compareTerm(e);return"BlankNode"===t.termType&&"BlankNode"===e.termType?0===s?0:o(t)>o(e)?1:o(t)<o(e)?-1:s:i&&t.uri&&e.uri?(i[t.uri]||t.uri).localeCompare(i[e.uri]||e.uri):s}function yh(t,e){return e=e||{},"undefined"!=typeof module&&module&&module.exports?(new vh.DOMParser).parseFromString(t,e.contentType||"application/xhtml+xml"):("undefined"!=typeof window&&window.DOMParser?new window.DOMParser:new vh.DOMParser).parseFromString(t,"application/xml")}function xh(t,e){for(var n=0;n<t.length;n++)if(t[n].subject.equals(e.subject)&&t[n].predicate.equals(e.predicate)&&t[n].object.equals(e.object)&&t[n].why.equals(e.why))return void t.splice(n,1);throw new Error("RDFArrayRemove: Array did not contain "+e+" "+e.why)}function kh(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ch;return{boolean:t.namedNode("http://www.w3.org/2001/XMLSchema#boolean"),dateTime:t.namedNode("http://www.w3.org/2001/XMLSchema#dateTime"),decimal:t.namedNode("http://www.w3.org/2001/XMLSchema#decimal"),double:t.namedNode("http://www.w3.org/2001/XMLSchema#double"),integer:t.namedNode("http://www.w3.org/2001/XMLSchema#integer"),langString:t.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),string:t.namedNode("http://www.w3.org/2001/XMLSchema#string")}}kh(ch);var Eh=Kt(Ba()),Sh=function(){function t(e){Ka(this,t),Ya(this,"_notQNameChars","\t\r\n !\"#$%&'()*.,+/;<=>?@[\\]^`{|}~"),Ya(this,"_notNameChars",this._notQNameChars+":"),Ya(this,"validPrefix",new RegExp(/^[a-zA-Z][a-zA-Z0-9]*$/)),Ya(this,"forbidden1",new RegExp(/[\\"\b\f\r\v\t\n\u0080-\uffff]/gm)),Ya(this,"forbidden3",new RegExp(/[\\"\b\f\r\v\u0080-\uffff]/gm)),this.flags="",this.base=null,this.prefixes=[],this.namespaces=[];var n=Object.keys((0,Eh.default)());for(var i in n){var r=(0,Eh.default)()[n[i]](""),o=n[i];this.prefixes[r]=o,this.namespaces[o]=r}this.suggestPrefix("rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#"),this.suggestPrefix("xml","reserved:reservedForFutureUse"),this.namespacesUsed=[],this.keywords=["a"],this.prefixchars="abcdefghijklmnopqustuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",this.incoming=null,this.formulas=[],this.store=e,this.rdfFactory=e.rdfFactory||ch,this.xsd=kh(this.rdfFactory)}return Ha(t,[{key:"setBase",value:function(t){return this.base=t,this}},{key:"setFlags",value:function(t){return this.flags=t||"",this}},{key:"toStr",value:function(t){var e=t.toNT();return"Graph"===t.termType&&(this.formulas[e]=t),e}},{key:"fromStr",value:function(t){if("{"===t[0]){var e=this.formulas[t];return e||console.log("No formula object for "+t),e}return this.store.fromNT(t)}},{key:"setNamespaces",value:function(t){for(var e in t)this.setPrefix(e,t[e]);return this}},{key:"setPrefix",value:function(t,e){if("default"!==t.slice(0,7)&&"ns"!==t.slice(0,2)&&t&&e){for(var n in this.prefixes)this.prefixes[n]==t&&delete this.prefixes[n];this.prefixes[e]=t,this.namespaces[t]=e}}},{key:"suggestPrefix",value:function(t,e){"default"!==t.slice(0,7)&&"ns"!==t.slice(0,2)&&t&&e&&(t in this.namespaces||e in this.prefixes||(this.prefixes[e]=t,this.namespaces[t]=e))}},{key:"suggestNamespaces",value:function(t){for(var e in t)this.suggestPrefix(e,t[e]);return this}},{key:"checkIntegrity",value:function(){var t,e;for(t in this.namespaces)if(this.prefixes[this.namespaces[t]]!==t)throw new Error("Serializer integity error 1: "+t+", "+this.namespaces[t]+", "+this.prefixes[this.namespaces[t]]+"!");for(e in this.prefixes)if(this.namespaces[this.prefixes[e]]!==e)throw new Error("Serializer integity error 2: "+e+", "+this.prefixs[e]+", "+this.namespaces[this.prefixes[e]]+"!")}},{key:"makeUpPrefix",value:function(t){var e=t,n=function(e){return!!this.validPrefix.test(e)&&"ns"!==e&&!(e in this.namespaces)&&(this.prefixes[t]=e,this.namespaces[e]=t,e)}.bind(this);"#/".indexOf(e[e.length-1])>=0&&(e=e.slice(0,-1));var i=e.lastIndexOf("/");i>=0&&(e=e.slice(i+1));for(var r=0;r<e.length&&this.prefixchars.indexOf(e[r]);)r++;if((e=e.slice(0,r)).length<6&&n(e))return e;if(n(e.slice(0,3)))return e.slice(0,3);if(n(e.slice(0,2)))return e.slice(0,2);if(n(e.slice(0,4)))return e.slice(0,4);if(n(e.slice(0,1)))return e.slice(0,1);if(n(e.slice(0,5)))return e.slice(0,5);this.validPrefix.test(e)||(e="n");for(var o=0;;o++)if(n(e.slice(0,3)+o))return e.slice(0,3)+o}},{key:"rootSubjects",value:function(t){for(var e={},n={},i={},r=0;r<t.length;r++){var o=t[r],s=function(t){e.hasOwnProperty(t)||(e[t]=[]),e[t].push(o.subject)};[o.subject,o.predicate,o.object].map((function(t){"BlankNode"===t.termType?i[t.toNT()]=!0:"Collection"===t.termType&&t.elements.forEach((function(t){s(t)}))})),s(t[r].object);var a=n[this.toStr(o.subject)];a||(a=[]),a.push(o),n[this.toStr(o.subject)]=a}var u=[];for(var c in n)if(n.hasOwnProperty(c)){var l=this.fromStr(c);"BlankNode"===l.termType&&e[l]&&1===e[l].length||u.push(l)}this.incoming=e;for(var h={},d=0;d<u.length;d++)h[u[d].toNT()]=!0;return{roots:u,subjects:n,rootsHash:h,incoming:e}}},{key:"toN3",value:function(t){return this.statementsToN3(t.statements)}},{key:"explicitURI",value:function(t){return"<"+(t=this.flags.indexOf("r")<0&&this.base?ih(this.base,t):this.flags.indexOf("u")>=0?function(t){for(var e,n="",i=0;i<t.length;i++)n+=(e=t.charCodeAt(i))>65535?"\\U"+("00000000"+e.toString(16)).slice(-8):e>126?"\\u"+("0000"+e.toString(16)).slice(-4):t[i];return n}(t):encodeURI(t))+">"}},{key:"statementsToNTriples",value:function(t){var e=t.slice();e.sort();for(var n="",i="http://www.w3.org/1999/02/22-rdf-syntax-ns#",r=this,o=this.store,s=this.rdfFactory,a=function t(e){if("Collection"!==e.termType)return r.atomicTermToN3(e);for(var a=e.elements,u=o.sym(i+"nill"),c=a.length-1;c>=0;c--){var l=s.blankNode();n+=t(l)+" "+t(o.sym(i+"first"))+" "+t(a[c])+".\n",n+=t(l)+" "+t(o.sym(i+"rest"))+" "+t(u)+".\n",u=l}return r.atomicTermToN3(u)},u=0;u<e.length;u++){var c=e[u],l="";l+=a(c.subject)+" ",l+=a(c.predicate)+" ",l+=a(c.object)+" ",this.flags.indexOf("q")>=0&&(l+=a(c.why)+" "),n+=l+=".\n"}return n}},{key:"statementsToN3",value:function(e){var n=this.store,i={"http://www.w3.org/1999/02/22-rdf-syntax-ns#type":"aaa:00"};e.sort((function(t,e){return function(t,e,n,i){return bh(t.subject,e.subject,n,i)||bh(t.predicate,e.predicate,n,i)||bh(t.object,e.object,n,i)}(t,e,n,i)})),this.base&&!this.defaultNamespace&&(this.defaultNamespace=this.base+"#");var r={};this.flags.indexOf("s")<0&&(r["http://www.w3.org/2002/07/owl#sameAs"]="="),this.flags.indexOf("t")<0&&(r["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"]="a"),this.flags.indexOf("i")<0&&(r["http://www.w3.org/2000/10/swap/log#implies"]="=>");var o=function(t){for(var e="",n=0;n<t;n++)e+=" ";return e},s=function t(e){for(var n="",i=0;i<e.length;i++){var r=e[i],o="string"==typeof r?r:t(r);if(0!==i){var s=n.slice(-1)||" ";","===o||";"===o||("."!==o||"0123456789.:".includes(s))&&(n+=" ")}n+=o}return n},a=function(t){for(var e=this.rootSubjects(t),n=e.roots,i=[],r=0;r<n.length;r++)i.push(u(n[r],e));return i}.bind(this);function u(t,e){return"BlankNode"!==t.termType||e.incoming[t]?[h(t,e)].concat([c(t,e)]).concat(["."]):l(t,e,!0).concat(["."])}var c=function(t,e){var n=[],i=null,o=e.subjects[this.toStr(t)]||[];if(void 0===o)throw new Error("Cant find statements for "+t);for(var s=[],a=0;a<o.length;a++){var u=o[a];u.predicate.uri===i?s.push(","):(i&&(n=n.concat([s]).concat([";"]),s=[]),n.push(r[u.predicate.uri]?r[u.predicate.uri]:h(u.predicate,e))),i=u.predicate.uri,s.push(l(u.object,e))}return n.concat([s])}.bind(this),l=function(t,e,n){return"BlankNode"!==t.termType||!n&&void 0!==e.rootsHash[t.toNT()]?h(t,e):e.subjects[this.toStr(t)]?["[",c(t,e),"]"]:"[]"}.bind(this);t.prototype.termToN3=h;var h=function(t,e){var n,i;switch(t.termType){case"Graph":return(i=(i=["{"]).concat(a(t.statements))).concat(["}"]);case"Collection":for(i=["("],n=0;n<t.elements.length;n++)i.push([l(t.elements[n],e)]);return i.push(")"),i;default:return this.atomicTermToN3(t)}}.bind(this),d=function(){var t="";for(var e in this.defaultNamespace&&(t+="@prefix : "+this.explicitURI(this.defaultNamespace)+".\n"),this.prefixes)this.prefixes.hasOwnProperty(e)&&this.namespacesUsed[e]&&(t+="@prefix "+this.prefixes[e]+": "+this.explicitURI(e)+".\n");return t+"\n"}.bind(this),f=a(e);return d()+function t(e,n){var i="",r=1e5;void 0===n&&(n=-1);for(var a=0;a<e.length;a++){var u=e[a];if("string"!=typeof u){var c=t(u,n+1);if(c.length<10*(80-4*n)&&c.indexOf('"""')<0){var l=s(u);l.length<80-4*n&&(u=l,c="")}c&&(r=1e4),i+=c}if("string"==typeof u){if(1===u.length&&"\n"===i.slice(-1)&&",.;".indexOf(u)>=0){i=i.slice(0,-1),"."==u&&"0123456789.:".includes(i.charAt(i.length-1))&&(i+=" ",r+=1),i+=u+"\n",r+=1;continue}if(r<4*n+4||r+u.length+1<80&&";.".indexOf(i[i.length-2])<0)i=i.slice(0,-1)+" "+u+"\n",r+=u.length+1;else{var h=o(4*n)+u;i+=h+"\n",r=h.length,n<0&&(i+="\n",r=1e5)}}}return i}(f)}},{key:"atomicTermToN3",value:function(t,e){switch(t.termType){case"BlankNode":case"Variable":return t.toNT();case"Literal":var n=t.value;if("string"!=typeof n)throw new TypeError("Value of RDF literal node must be a string");if(t.datatype&&this.flags.indexOf("x")<0)switch(t.datatype.uri){case"http://www.w3.org/2001/XMLSchema#integer":return n;case"http://www.w3.org/2001/XMLSchema#decimal":return n.indexOf(".")<0&&(n+=".0"),n;case"http://www.w3.org/2001/XMLSchema#double":var i=n.toLowerCase().indexOf("e")>0;return n.indexOf(".")<0&&!i&&(n+=".0"),i||(n+="e0"),n;case"http://www.w3.org/2001/XMLSchema#boolean":return"1"===t.value?"true":"false"}var r=this.stringToN3(t.value);return t.language?r+="@"+t.language:t.datatype.equals(this.xsd.string)||(r+="^^"+this.atomicTermToN3(t.datatype,e)),r;case"NamedNode":return this.symbolToN3(t);case"DefaultGraph":return"";default:throw new Error("Internal: atomicTermToN3 cannot handle "+t+" of termType: "+t.termType)}}},{key:"stringToN3",value:function(t,e){e||(e="e");var n,i,r,o,s,a="";for(t.length>20&&'"'!==t.slice(-1)&&e.indexOf("n")<0&&(t.indexOf("\n")>0||t.indexOf('"')>0)?(o='"""',s=this.forbidden3):(o='"',s=this.forbidden1),n=0;n<t.length&&(s.lastIndex=0,null!=s.exec(t.slice(n)));){a+=t.slice(n,i=n+s.lastIndex-1);var u=t[i];'"'===u&&'"""'===o&&'"""'!==t.slice(i,i+3)?a+=u:(r='\b\f\r\t\v\n\\"'.indexOf(u))>=0?a+="\\"+'bfrtvn\\"'[r]:e.indexOf("e")>=0?a+="\\u"+("000"+u.charCodeAt(0).toString(16).toLowerCase()).slice(-4):a+=u,n=i+1}return o+a+t.slice(n)+o}},{key:"symbolToN3",value:function(t){var e=t.uri,n=e.indexOf("#");if(n<0&&this.flags.indexOf("/")<0&&(n=e.lastIndexOf("/")),n>=0&&this.flags.indexOf("p")<0&&(0===e.indexOf("http")||0===e.indexOf("ws")||0===e.indexOf("file"))){for(var i=!0,r=n+1;r<e.length;r++)if(this._notNameChars.indexOf(e[r])>=0){i=!1;break}if(i){var o=e.slice(n+1),s=e.slice(0,n+1);if(this.defaultNamespace&&this.defaultNamespace===s&&this.flags.indexOf("d")<0)return this.flags.indexOf("k")>=0&&this.keyords.indexOf(o)<0?o:":"+o;var a=this.prefixes[s];if(a||(a=this.makeUpPrefix(s)),a)return this.namespacesUsed[s]=!0,a+":"+o}}return this.explicitURI(e)}},{key:"writeStore",value:function(t){var e=this.store,n=e.fetcher,i=n&&n.appNode,r=this.store.index[3];for(var o in r){var s=e.fromNT(o);i&&s.equals(i)||t("\n"+this.atomicTermToN3(s)+" "+this.atomicTermToN3(e.sym("http://www.w3.org/2000/10/swap/log#semantics"))+" { "+this.statementsToN3(e.statementsMatching(void 0,void 0,void 0,s))+" }.\n")}e.statementsMatching(void 0,e.sym("http://www.w3.org/2007/ont/link#requestedURI")).map((function(n){t("\n<"+n.object.value+"> log:metadata {\n");var i=e.statementsMatching(void 0,void 0,void 0,n.subject);t(this.statementsToN3(this.statementsToN3(i))),t("}.\n")}));var a=[];i&&a.push(i);var u=[];a.map((function(t){u=u.concat(e.statementsMatching(void 0,void 0,void 0,t))})),t(this.statementsToN3(u))}},{key:"statementsToXML",value:function(t){var e=[];e["http://www.w3.org/1999/02/22-rdf-syntax-ns#"]=!0;var n="http://www.w3.org/1999/02/22-rdf-syntax-ns#_",i=function(t){for(var e="",n=0;n<t;n++)e+=" ";return e},r=function t(e){for(var n="",i=0;i<e.length;i++){var r=e[i];n+="string"==typeof r?r:t(r)}return n},o=function(t){this.suggestPrefix("rdf","http://www.w3.org/1999/02/22-rdf-syntax-ns#");for(var e=this.rootSubjects(t),n=e.roots,i=[],r=0;r<n.length;r++)i.push(u(n[r],e));return i}.bind(this);function s(t){return void 0===t?"@@@undefined@@@@":t.replace(/[&<"]/g,(function(t){switch(t[0]){case"&":return"&";case"<":return"<";case'"':return"""}}))}var a=function(t){return s(this.base?Xl.refTo(this.base,t.uri):t.uri)}.bind(this),u=function(t,e){var i,r,o,d,f=[],p=e.subjects[this.toStr(t)];if(void 0===p)return l(t,e);p.sort((function(t,e){var i=t.predicate.uri,r=e.predicate.uri;if(i.substring(0,n.length)===n||r.substring(0,n.length)===n)return i.localeCompare(r);var o=i.substring(n.length),s=r.substring(n.length),a=parseInt(o,10),u=parseInt(s,10);return isNaN(a)||isNaN(u)||a!==o||u!==s?i.localeCompare(r):a-u}));for(var v=0;v<p.length;v++)if("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"!==(o=p[v]).predicate.uri||i||"NamedNode"!==o.object.termType){if((d=o.predicate).uri.substr(0,n.length)===n){var g=d.uri.substr(n.length);g===parseInt(g,10).toString()&&(d=this.rdfFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#li"))}switch(r=h(d),o.object.termType){case"BlankNode":f=f.concat(1===e.incoming[o.object].length?["<"+r+' rdf:parseType="Resource">',u(o.object,e),"</"+r+">"]:["<"+r+' rdf:nodeID="'+o.object.toNT().slice(2)+'"/>']);break;case"NamedNode":f=f.concat(["<"+r+' rdf:resource="'+a(o.object)+'"/>']);break;case"Literal":f=f.concat(["<"+r+(o.object.datatype.equals(this.xsd.string)?"":' rdf:datatype="'+s(o.object.datatype.uri)+'"')+(o.object.language?' xml:lang="'+o.object.language+'"':"")+">"+s(o.object.value)+"</"+r+">"]);break;case"Collection":f=f.concat(["<"+r+' rdf:parseType="Collection">',c(o.object,e),"</"+r+">"]);break;default:throw new Error("Can't serialize object of type "+o.object.termType+" into XML")}}else i=o.object;var m=i?h(i):"rdf:Description",w="";return"BlankNode"===t.termType?e.incoming[t]&&1===e.incoming[t].length||(w=' rdf:nodeID="'+t.toNT().slice(2)+'"'):w=' rdf:about="'+a(t)+'"',["<"+m+w+">"].concat([f]).concat(["</"+m+">"])}.bind(this);function c(t,e){for(var n=[],i=0;i<t.elements.length;i++)n.push(u(t.elements[i],e));return n}var l=function(t,e){var n=[],i=e.subjects[this.toStr(t)];if(!i)return n;i.sort();for(var r=0;r<i.length;r++){var o=i[r];switch(o.object.termType){case"BlankNode":n=e.rootsHash[o.object.toNT()]?n.concat(["<"+h(o.predicate)+' rdf:nodeID="'+o.object.toNT().slice(2)+'">',"</"+h(o.predicate)+">"]):n.concat(["<"+h(o.predicate)+' rdf:parseType="Resource">',l(o.object,e),"</"+h(o.predicate)+">"]);break;case"NamedNode":n=n.concat(["<"+h(o.predicate)+' rdf:resource="'+a(o.object)+'"/>']);break;case"Literal":n=n.concat(["<"+h(o.predicate)+(o.object.datatype.equals(this.xsd.string)?"":' rdf:datatype="'+s(o.object.datatype.value)+'"')+(o.object.language?' xml:lang="'+o.object.language+'"':"")+">"+s(o.object.value)+"</"+h(o.predicate)+">"]);break;case"Collection":n=n.concat(["<"+h(o.predicate)+' rdf:parseType="Collection">',c(o.object,e),"</"+h(o.predicate)+">"]);break;default:throw new Error("Can't serialize object of type "+o.object.termType+" into XML")}}return n}.bind(this),h=function(t){var n=t.uri,i=n.indexOf("#");if(i<0&&this.flags.indexOf("/")<0&&(i=n.lastIndexOf("/")),i<0)throw new Error("Cannot make qname out of <"+n+">");for(var r=i+1;r<n.length;r++)if(this._notNameChars.indexOf(n[r])>=0)throw new Error('Invalid character "'+n[r]+'" cannot be in XML qname for URI: '+n);var o=n.slice(i+1),s=n.slice(0,i+1);if(this.defaultNamespace&&this.defaultNamespace===s&&this.flags.indexOf("d")<0)return o;var a=this.prefixes[s];return a||(a=this.makeUpPrefix(s)),e[s]=!0,a+":"+o}.bind(this),d=o(t),f="<rdf:RDF";for(var p in this.defaultNamespace&&(f+=' xmlns="'+s(this.defaultNamespace)+'"'),e)if(e.hasOwnProperty(p)){var v=this.base&&this.flags.includes("z")?Xl.refTo(this.base,p):p;f+="\n xmlns:"+this.prefixes[p]+'="'+s(v)+'"'}return function t(e,n){var o,s="",a=1e5;n||(n=0);for(var u=0;u<e.length;u++){var c=e[u];if("string"!=typeof c){var l=t(c,n+1);l.length<10*(80-4*n)&&l.indexOf('"""')<0&&(o=r(c)).length<80-4*n&&(c=" "+o,l=""),l&&(a=1e4),s+=l}"string"==typeof c&&(a<4*n+4?(s=s.slice(0,-1)+" "+c+"\n",a+=c.length+1):(s+=(o=i(4*n)+c)+"\n",a=o.length))}return s}([f+=">",d,"</rdf:RDF>"],-1)}}]),t}();function Fh(t,e,n,i,r,o){n=n||(null==t?void 0:t.value);var s,a,u,c,l,h=o||{};i=i||"text/turtle";try{var d=function(t){return new Sh(t)}(e);h.flags&&d.setFlags(h.flags);var f=e.statementsMatching(void 0,void 0,void 0,t);switch("namespaces"in e&&d.suggestNamespaces(e.namespaces),h.namespaces&&d.setNamespaces(h.namespaces),d.setBase(n),i){case"application/rdf+xml":return p(null,d.statementsToXML(f));case"text/n3":case"application/n3":return p(null,d.statementsToN3(f));case"text/turtle":case"application/x-turtle":return d.setFlags("si"),p(null,d.statementsToN3(f));case"application/n-triples":return d.setFlags("deinprstux"),p(null,d.statementsToNTriples(f));case"application/ld+json":d.setFlags("deinprstux"),s=d.statementsToNTriples(f),a=r,c=new Tl,l=new class{constructor(t,e){if(this._prefixRegex=/$0^/,t&&"function"!=typeof t.write&&(e=t,t=null),this._lists=(e=e||{}).lists,t)this._outputStream=t,this._endStream=void 0===e.end||!!e.end;else{let t="";this._outputStream={write(e,n,i){t+=e,i&&i()},end:e=>{e&&e(null,t)}},this._endStream=!0}this._subject=null,/triple|quad/i.test(e.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine):(this._lineMode=!1,this._graph=Pl,this._prefixIRIs=Object.create(null),e.prefixes&&this.addPrefixes(e.prefixes),e.baseIRI&&(this._baseMatcher=new RegExp(`^${Hl(e.baseIRI)}${e.baseIRI.endsWith("/")?"":"[#?]"}`),this._baseLength=e.baseIRI.length))}get _inDefaultGraph(){return Pl.equals(this._graph)}_write(t,e){this._outputStream.write(t,"utf8",e)}_writeQuad(t,e,n,i,r){try{i.equals(this._graph)||(this._write((null===this._subject?"":this._inDefaultGraph?".\n":"\n}\n")+(Pl.equals(i)?"":`${this._encodeIriOrBlank(i)} {\n`)),this._graph=i,this._subject=null),t.equals(this._subject)?e.equals(this._predicate)?this._write(`, ${this._encodeObject(n)}`,r):this._write(`;\n ${this._encodePredicate(this._predicate=e)} ${this._encodeObject(n)}`,r):this._write(`${(null===this._subject?"":".\n")+this._encodeSubject(this._subject=t)} ${this._encodePredicate(this._predicate=e)} ${this._encodeObject(n)}`,r)}catch(t){r&&r(t)}}_writeQuadLine(t,e,n,i,r){delete this._prefixMatch,this._write(this.quadToString(t,e,n,i),r)}quadToString(t,e,n,i){return`${this._encodeSubject(t)} ${this._encodeIriOrBlank(e)} ${this._encodeObject(n)}${i&&i.value?` ${this._encodeIriOrBlank(i)} .\n`:" .\n"}`}quadsToString(t){return t.map((t=>this.quadToString(t.subject,t.predicate,t.object,t.graph))).join("")}_encodeSubject(t){return"Quad"===t.termType?this._encodeQuad(t):this._encodeIriOrBlank(t)}_encodeIriOrBlank(t){if("NamedNode"!==t.termType)return this._lists&&t.value in this._lists&&(t=this.list(this._lists[t.value])),"id"in t?t.id:`_:${t.value}`;let e=t.value;this._baseMatcher&&this._baseMatcher.test(e)&&(e=e.substr(this._baseLength)),Ul.test(e)&&(e=e.replace(Ll,$l));const n=this._prefixRegex.exec(e);return n?n[1]?this._prefixIRIs[n[1]]+n[2]:e:`<${e}>`}_encodeLiteral(t){let e=t.value;if(Ul.test(e)&&(e=e.replace(Ll,$l)),t.language)return`"${e}"@${t.language}`;if(this._lineMode){if(t.datatype.value===Ml.string)return`"${e}"`}else switch(t.datatype.value){case Ml.string:return`"${e}"`;case Ml.boolean:if("true"===e||"false"===e)return e;break;case Ml.integer:if(/^[+-]?\d+$/.test(e))return e;break;case Ml.decimal:if(/^[+-]?\d*\.\d+$/.test(e))return e;break;case Ml.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(e))return e}return`"${e}"^^${this._encodeIriOrBlank(t.datatype)}`}_encodePredicate(t){return t.value===Dl.type?"a":this._encodeIriOrBlank(t)}_encodeObject(t){switch(t.termType){case"Quad":return this._encodeQuad(t);case"Literal":return this._encodeLiteral(t);default:return this._encodeIriOrBlank(t)}}_encodeQuad({subject:t,predicate:e,object:n,graph:i}){return`<<${this._encodeSubject(t)} ${this._encodePredicate(e)} ${this._encodeObject(n)}${r=i,r&&"DefaultGraph"===r.termType?"":` ${this._encodeIriOrBlank(i)}`}>>`;var r}_blockedWrite(){throw new Error("Cannot write because the writer has been closed.")}addQuad(t,e,n,i,r){void 0===n?this._writeQuad(t.subject,t.predicate,t.object,t.graph,e):"function"==typeof i?this._writeQuad(t,e,n,Pl,i):this._writeQuad(t,e,n,i||Pl,r)}addQuads(t){for(let e=0;e<t.length;e++)this.addQuad(t[e])}addPrefix(t,e,n){const i={};i[t]=e,this.addPrefixes(i,n)}addPrefixes(t,e){if(!this._prefixIRIs)return e&&e();let n=!1;for(let e in t){let i=t[e];"string"!=typeof i&&(i=i.value),n=!0,null!==this._subject&&(this._write(this._inDefaultGraph?".\n":"\n}\n"),this._subject=null,this._graph=""),this._prefixIRIs[i]=e+=":",this._write(`@prefix ${e} <${i}>.\n`)}if(n){let t="",e="";for(const n in this._prefixIRIs)t+=t?`|${n}`:n,e+=(e?"|":"")+this._prefixIRIs[n];t=Hl(t),this._prefixRegex=new RegExp(`^(?:${e})[^/]*$|^(${t})([a-zA-Z][\\-_a-zA-Z0-9]*)$`)}this._write(n?"\n":"",e)}blank(t,e){let n,i,r=t;switch(void 0===t?r=[]:t.termType?r=[{predicate:t,object:e}]:"length"in t||(r=[t]),i=r.length){case 0:return new Jl("[]");case 1:if(n=r[0],!(n.object instanceof Jl))return new Jl(`[ ${this._encodePredicate(n.predicate)} ${this._encodeObject(n.object)} ]`);default:let e="[";for(let o=0;o<i;o++)n=r[o],n.predicate.equals(t)?e+=`, ${this._encodeObject(n.object)}`:(e+=`${(o?";\n ":"\n ")+this._encodePredicate(n.predicate)} ${this._encodeObject(n.object)}`,t=n.predicate);return new Jl(`${e}\n]`)}}list(t){const e=t&&t.length||0,n=new Array(e);for(let i=0;i<e;i++)n[i]=this._encodeObject(t[i]);return new Jl(`(${n.join(" ")})`)}end(t){null!==this._subject&&(this._write(this._inDefaultGraph?".\n":"\n}\n"),this._subject=null),this._write=this._blockedWrite;let e=t&&((n,i)=>{e=null,t(n,i)});if(this._endStream)try{return this._outputStream.end(e)}catch(t){}e&&e()}}({format:"N-Quads"}),al.waterfall([function(t){c.parse(s,(function(e,n){e?t(e):null!==n?l.addQuad(n):l.end(t)}))},function(t,e){try{ul.default.fromRDF(t,{format:"application/nquads"}).then((function(t){e(null,t)}))}catch(t){e(t)}},function(t){u=JSON.stringify(t),a(null,u)}],(function(t){a(t,u)}));break;case"application/n-quads":case"application/nquads":return d.setFlags("deinprstux q"),p(null,d.statementsToNTriples(f));default:throw new Error("Serialize: Content-type "+i+" not supported for data write.")}}catch(t){if(r)return r(t,void 0);throw t}function p(t,e){return r?void r(t,e):e}}var Ah=["blankNode","defaultGraph","literal","namedNode","quad","variable","supports"],_h="http://www.w3.org/1999/02/22-rdf-syntax-ns#rest";function jh(t,e,n){var i=[];return n.reduce((function(e,n,r,o){var s;return i.push(t.quad(e,t.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#first"),o[r])),r<o.length-1?(s=t.blankNode(),i.push(t.quad(e,t.namedNode(_h),s))):i.push(t.quad(e,t.namedNode(_h),t.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"))),s}),e),i}function Ch(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=t.length;for(n<0&&(n=i+n);n<i;n++)if(t[n]===e)return n;return-1}function Rh(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Ih(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ih(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function Ih(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}var Th=function(){qa(i,Qa);var t,e,n=(t=i,e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var n,i=Xa(t);if(e){var r=Xa(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return Ga(this,n)});function i(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};Ka(this,i),(t=n.call(this,"")).statements=e,t.constraints=r,t.initBindings=o,t.optional=s,Ya(za(t),"termType","Graph"),Ya(za(t),"classOrder",Za.Graph),Ya(za(t),"fetcher",void 0),Ya(za(t),"isVar",0),Ya(za(t),"ns",ph),Ya(za(t),"rdfFactory",void 0),t.rdfFactory=a&&a.rdfFactory||ch;var u,c=Rh(Ah);try{var l=function(){var e=u.value;t[e]=function(){var n;return(n=t.rdfFactory)[e].apply(n,arguments)}};for(c.s();!(u=c.n()).done;)l()}catch(t){c.e(t)}finally{c.f()}return t}return Ha(i,[{key:"add",value:function(t,e,n,i){var r=this;return 1===arguments.length&&t.forEach((function(t){return r.add(t.subject,t.predicate,t.object,t.graph)})),this.statements.push(this.rdfFactory.quad(t,e,n,i))}},{key:"addStatement",value:function(t){return this.add(t)}},{key:"bnode",value:function(t){return this.rdfFactory.blankNode(t)}},{key:"addAll",value:function(t){var e=this;t.forEach((function(t){e.add(t.subject,t.predicate,t.object,t.graph)}))}},{key:"any",value:function(t,e,n,i){var r=this.anyStatementMatching(t,e,n,i);return null==r?null:null==t?r.subject:null==e?r.predicate:null==n?r.object:null}},{key:"anyValue",value:function(t,e,n,i){var r=this.any(t,e,n,i);return r?r.value:void 0}},{key:"anyJS",value:function(t,e,n,i){var r=this.any(t,e,n,i);return r?Qa.toJS(r):void 0}},{key:"anyStatementMatching",value:function(t,e,n,i){var r=this.statementsMatching(t,e,n,i,!0);if(r&&0!==r.length)return r[0]}},{key:"id",value:function(t){return this.rdfFactory.id(t)}},{key:"statementsMatching",value:function(t,e,n,i,r){var o=this.statements.filter((function(r){return(!t||t.equals(r.subject))&&(!e||e.equals(r.predicate))&&(!n||n.equals(r.object))&&(!i||i.equals(r.graph))}));return r?0===o.length?[]:[o[0]]:o}},{key:"bottomTypeURIs",value:function(t){var e,n,i,r,o,s;for(var a in e=[],t)if(t.hasOwnProperty(a)){for(s=t[a],n=!0,i=0,r=(o=this.each(void 0,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#subClassOf"),this.rdfFactory.namedNode(a))).length;i<r;i++)if(o[i].uri in t){n=!1;break}n&&(e[a]=s)}return e}},{key:"collection",value:function(){return new mu}},{key:"each",value:function(t,e,n,i){var r=[],o=this.statementsMatching(t,e,n,i,!1);if(null==t)for(var s=0,a=o.length;s<a;s++)r.push(o[s].subject);else if(null==e)for(var u=0,c=o.length;u<c;u++)r.push(o[u].predicate);else if(null==n)for(var l=0,h=o.length;l<h;l++)r.push(o[l].object);else if(null==i)for(var d=0,f=o.length;d<f;d++)r.push(new fu(o[d].graph.value));return r}},{key:"equals",value:function(t){return!!t&&this.hashString()===t.hashString()}},{key:"findMembersNT",value:function(t){var e,n,i,r,o,s,a,u,c,l,h,d,f;for(var p in(h={})[t.toNT()]=!0,r={},o=this.transitiveClosure(h,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#subClassOf"),!0))if(o.hasOwnProperty(p)){for(var v=0,g=(s=this.statementsMatching(void 0,this.rdfFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),this.fromNT(p))).length;v<g;v++)r[(d=s[v]).subject.toNT()]=d;for(var m=0,w=(a=this.each(void 0,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#domain"),this.fromNT(p))).length;m<w;m++)for(i=0,e=(u=this.statementsMatching(void 0,a[m])).length;i<e;i++)r[(d=u[i]).subject.toNT()]=d;for(var b=0,y=(c=this.each(void 0,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#range"),this.fromNT(p))).length;b<y;b++)for(f=0,n=(l=this.statementsMatching(void 0,c[b])).length;f<n;f++)r[(d=l[f]).object.toNT()]=d}return r}},{key:"findMemberURIs",value:function(t){return this.NTtoURI(this.findMembersNT(t))}},{key:"findSubClassesNT",value:function(t){var e={};return e[t.toNT()]=!0,this.transitiveClosure(e,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#subClassOf"),!0)}},{key:"findSuperClassesNT",value:function(t){var e={};return e[t.toNT()]=!0,this.transitiveClosure(e,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#subClassOf"),!1)}},{key:"findTypesNT",value:function(t){var e,n,i,r,o,s;s=[];for(var a=0,u=(e=this.statementsMatching(t,void 0,void 0)).length;a<u;a++)if("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"===(o=e[a]).predicate.uri)s[o.object.toNT()]=o;else for(var c=0,l=(n=this.each(o.predicate,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#domain"))).length;c<l;c++)s[n[c].toNT()]=o;for(var h=0,d=(i=this.statementsMatching(void 0,void 0,t)).length;h<d;h++)for(var f=0,p=(r=this.each((o=i[h]).predicate,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#range"))).length;f<p;f++)s[r[f].toNT()]=o;return this.transitiveClosure(s,this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#subClassOf"),!1)}},{key:"findTypeURIs",value:function(t){return this.NTtoURI(this.findTypesNT(t))}},{key:"connectedStatements",value:function(t,e,n){n=n||[];for(var i=[t],r={},o={},s=[],a=this,u=function(t){var u=function(t){"BlankNode"!==t.termType||r[t.value]||(r[t.value]=!0,i.push(t))},c=a.statementsMatching(null,null,t,e).concat(a.statementsMatching(t,null,null,e));(c=c.filter((function(t){if(n[t.predicate.value])return!1;var e=t.toNT();return!o[e]&&(o[e]=!0,!0)}))).forEach((function(t){u(t.subject),u(t.object)})),s=s.concat(c)};i.length;)u(i.shift());return s}},{key:"formula",value:function(){return new i}},{key:"fromNT",value:function(t){var e,n,i;switch(t[0]){case"<":return this.sym(t.slice(1,-1));case'"':if(i=void 0,e=void 0,(n=t.lastIndexOf('"'))<t.length-1)if("@"===t[n+1])i=t.slice(n+2);else{if("^^"!==t.slice(n+1,n+3))throw new Error("Can't convert string from NT: "+t);e=this.fromNT(t.slice(n+3))}return t=(t=(t=(t=t.slice(1,n)).replace(/\\"/g,'"')).replace(/\\n/g,"\n")).replace(/\\\\/g,"\\"),this.rdfFactory.literal(t,i||e);case"_":return this.rdfFactory.blankNode(t.slice(2));case"?":return new ah(t.slice(1))}throw new Error("Can't convert from NT: "+t)}},{key:"holds",value:function(t,e,n,i){var r;if(1===arguments.length){if(!t)return!0;if(t instanceof Array){for(r=0;r<t.length;r++)if(!this.holds(t[r]))return!1;return!0}if(nu(t))return this.holds(t.subject,t.predicate,t.object,t.graph);if(t.statements)return this.holds(t.statements)}var o=this.anyStatementMatching(t,e,n,i);return null!=o}},{key:"holdsStatement",value:function(t){return this.holds(t.subject,t.predicate,t.object,t.graph)}},{key:"list",value:function(t,e){if(e.rdfFactory.supports.COLLECTIONS){var n=e.rdfFactory.collection();return t.forEach((function(t){n.append(t)})),n}var i=e.rdfFactory.blankNode(),r=jh(e.rdfFactory,i,t);return e.addAll(r),i}},{key:"NTtoURI",value:function(t){var e,n,i={};for(e in t)t.hasOwnProperty(e)&&(n=t[e],"<"===e[0]&&(i[e.slice(1,-1)]=n));return i}},{key:"serialize",value:function(t,e,n,i){return Fh(n,this,t,e,void 0,i)}},{key:"substitute",value:function(t){var e=this.statements.map((function(e){return e.substitute(t)}));console.log("Formula subs statmnts:"+e);var n=new i;return n.addAll(e),console.log("indexed-form subs formula:"+n),n}},{key:"sym",value:function(t,e){if(e)throw new Error("This feature (kb.sym with 2 args) is removed. Do not assume prefix mappings.");return this.rdfFactory.namedNode(t)}},{key:"the",value:function(t,e,n,i){var r=this.any(t,e,n,i);return null==r&&fh("No value found for the() {"+t+" "+e+" "+n+"}."),r}},{key:"transitiveClosure",value:function(t,e,n){var i,r,o,s,a,u={};Object.assign(u,t);for(var c={};;){if(null==(a=function(){for(var t in u)if(u.hasOwnProperty(t))return t}()))return c;for(i=0,r=(s=n?this.each(void 0,e,this.fromNT(a)):this.each(this.fromNT(a),e)).length;i<r;i++)(o=s[i].toNT())in c||o in u||(u[o]=u[a]);c[a]=u[a],delete u[a]}}},{key:"topTypeURIs",value:function(t){var e,n,i,r,o,s,a;for(n in s=[],t)if(t.hasOwnProperty(n)){for(a=t[n],r=0,e=0,i=(o=this.each(this.rdfFactory.namedNode(n),this.rdfFactory.namedNode("http://www.w3.org/2000/01/rdf-schema#subClassOf"))).length;e<i;e++)if("http://www.w3.org/2000/01/rdf-schema#Resource"!==o[e].uri){r++;break}r||(s[n]=a)}return s["http://www.w3.org/2000/01/rdf-schema#Resource"]&&delete s["http://www.w3.org/2000/01/rdf-schema#Resource"],s["http://www.w3.org/2002/07/owl#Thing"]&&delete s["http://www.w3.org/2002/07/owl#Thing"],s}},{key:"toString",value:function(){return"{"+this.statements.join("\n")+"}"}},{key:"variable",value:function(t){return new ah(t)}},{key:"whether",value:function(t,e,n,i){return this.statementsMatching(t,e,n,i,!1).length}}]),i}();Qa.fromValue=gu;var Oh=Qa,Nh={xsd:ph("http://www.w3.org/2001/XMLSchema#")};Qa.toJS=function(t){return ru(t)?t.elements.map(Qa.toJS):au(t)?t.datatype.equals(Nh.xsd("boolean"))?"1"===t.value||"true"===t.value:t.datatype.equals(Nh.xsd("dateTime"))||t.datatype.equals(Nh.xsd("date"))?new Date(t.value):t.datatype.equals(Nh.xsd("integer"))||t.datatype.equals(Nh.xsd("float"))||t.datatype.equals(Nh.xsd("decimal"))?Number(t.value):t.value:t};var Ph=Ha((function t(e,n){Ka(this,t),this.pat=new zh,this.vars=[],this.name=e,this.id=n}));function Dh(t,e,n,i){function r(t){var e,n="";for(e in t)t.hasOwnProperty(e)&&(n+=" "+e+" -> "+t[e]);return n}function o(t){var e,n="Bindings: ",i=t.length;for(e=0;e<i;e++)n+=r(t[e][0])+";\n\t";return n}function s(t,e,n,i){var r;if(t.length!==e.length)return[];if(!t.length)return[[[],null]];var o=function(t,e,n,i){var r=n[t];if(void 0===r){if(t.isVar){var o=[];return o[t]=e,[[o,null]]}r=t}if(!r.complexType)return i.redirections[r]&&(r=i.redirections[r]),i.redirections[e]&&(e=i.redirections[e]),r.equals(e)||r.uri&&"chrome:theSession"===r.uri?[[[],null]]:[];if(t instanceof Array)return e instanceof Array?s(t,e,n):[];throw new Error("query.js: oops - code not written yet")}(t[0],e[0],n,i);if(0===o.length)return o;var a,u,c,l,h,d,f,p=[],v=o.length;for(a=0;a<v;a++){for(h in f=[],u=o[a][0])u.hasOwnProperty(h)&&(f[h]=u[h]);for(h in n)n.hasOwnProperty(h)&&(f[h]=n[h]);for(l=(r=s(t.slice(1),e.slice(1),f,i)).length,c=0;c<l;c++){for(h in d=r[c][0],u)u.hasOwnProperty(h)&&(d[h]=u[h]);p.push([d,null])}}return p}function a(t,e){var n,i={};for(n in t)t.hasOwnProperty(n)&&(i[n]=t[n]);for(n in e)e.hasOwnProperty(n)&&(i[n]=e[n]);return i}function u(t,e){return this.trunkBindings=e,this.originalCallback=t,this.branches=[],this}function c(t,e){return this.count=0,this.success=!1,this.done=!1,this.callback=t,this.onDone=e,this}u.prototype.checkAllDone=function(){var t;for(t=0;t<this.branches.length;t++)if(!this.branches[t].done)return;lh("OPTIONAL BIDNINGS ALL DONE:"),this.doCallBacks(this.branches.length-1,this.trunkBindings)},u.prototype.doCallBacks=function(t,e){var n;if(t<0)return this.originalCallback(e);for(n=0;n<this.branches[t].results.length;n++)this.doCallBacks(t-1,a(e,this.branches[t].results[n]))},c.prototype.reportMatch=function(t){this.callback(t),this.success=!0},c.prototype.reportDone=function(){this.done=!0,dh("Mandatory query branch finished.***"),void 0!==this.onDone&&this.onDone()};var l=function(t){return this.count=0,this.done=!1,this.results=[],this.junction=t,t.branches.push(this),this};function h(t,e,n){var i,r,o,s,a,u;for(e.nvars=0,e.index=null,i=[e.subject,e.predicate,e.object,e.why],s=[t.subjectIndex,t.predicateIndex,t.objectIndex,t.whyIndex],o=0;o<4;o++){var c=i[o];if(c.uri&&"chrome:theSession"===c.uri);else if(c.isVar&&void 0===n[c])e.nvars++;else{if(void 0,t.redirections[t.id(c=void 0===(u=n[a=i[o]])?a:u)]&&(c=t.redirections[t.id(c)]),!(r=s[o][t.id(c)]))return e.index=[],!1;(null===e.index||e.index.length>r.length)&&(e.index=r)}}return null===e.index&&(e.index=t.statements),!0}function d(t,e){return t.nvars!==e.nvars?t.nvars-e.nvars:t.index.length-e.index.length}l.prototype.reportMatch=function(t){this.results.push(t)},l.prototype.reportDone=function(){lh("Optional branch finished - results.length = "+this.results.length),0===this.results.length&&(this.results.push({}),lh("Optional branch FAILED - that's OK.")),this.done=!0,this.junction.checkAllDone()};var f=function t(n,i,o,s,a,c,h){lh("Match begins, Branch count now: "+h.count+" for "+h.pattern_debug);var d,f,p=i.statements;if(0===p.length){if(lh("FOUND MATCH WITH BINDINGS:"+r(o)),0===i.optional.length)h.reportMatch(o);else{lh("OPTIONAL: "+i.optional);var g,m=new u(e,o),w=[];for(g=0;g<i.optional.length;g++)w[g]=new l(m),w[g].pattern_debug=i.optional[g];for(g=0;g<i.optional.length;g++)w[g].count=w[g].count+1,t(n,i.optional[g],o,"",a,e,w[g])}return h.count--,void lh("Match ends -- success , Branch count now: "+h.count+" for "+h.pattern_debug)}var b=p.length;if(a){var y=function(e){var r=e.uri.split("#")[0];a.nowOrWhenFetched(r,void 0,(function(r,u){r||console.log("Error following link to <"+e.uri+"> in query: "+u),t(n,i,o,s,a,c,h)}))};for(f=0;f<b;f++){if(void 0!==o[(d=p[f]).subject]&&o[d.subject].uri&&a&&"unrequested"===a.getState(Zl(o[d.subject].uri)))return void y(o[d.subject]);if(void 0!==o[d.object]&&o[d.object].uri&&a&&"unrequested"===a.getState(Zl(o[d.object].uri)))return void y(o[d.object])}}v(n,i,o,s,a,c,h)},p=function(t,e){var n,i,r=!0;for(n in t)t.hasOwnProperty(n)&&e[n]&&(i=e[n].test)&&!i(t[n])&&(r=!1);return r},v=function(t,e,n,i,a,u,c){var l,v,g,m,w,b,y,x=e.statements,k=x.length;for(l=0;l<k;l++)h(t,y=x[l],n);x.sort(d),y=x[0];var E,S=t.formula();S.optional=e.optional,S.constraints=e.constraints,S.statements=x.slice(1),lh(i+"match2 searching "+y.index.length+" for "+y+"; bindings so far="+r(n));var F,A,_=y.index.length,j=0;for(E=0;E<_;E++)for(F=s([y.subject,y.predicate,y.object,y.why],[(A=y.index[E]).subject,A.predicate,A.object,A.why],n,t),dh(i+" From first: "+F.length+": "+o(F)),g=F.length,v=0;v<g;v++)if(w=[],p(b=F[v][0],e.constraints)){for(m in b)b.hasOwnProperty(m)&&(w[m]=b[m]);for(m in n)n.hasOwnProperty(m)&&(w[m]=n[m]);c.count++,j++,f(t,S,w,i+" ",a,u,c)}else lh("Branch count CS: "+c.count);c.count--,0===j&&lh("Match2 fails completely on "+y),lh("Match2 ends, Branch count: "+c.count+" for "+c.pattern_debug),0===c.count&&(lh("Branch finished."),c.reportDone())},g=this;lh("Query on "+this.statements.length);var m=new c(e,i);m.count++,t.sync?f(g,t.pat,t.pat.initBindings,"",n,e,m):setTimeout((function(){f(g,t.pat,t.pat.initBindings,"",n,e,m)}),0)}function Mh(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function Uh(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Mh(Object(n),!0).forEach((function(e){Ya(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Mh(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function Lh(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return Bh(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Bh(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function Bh(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}var Jh="http://www.w3.org/2002/07/owl#";function $h(t,e,n,i){var r=t.any(e,n,void 0);return!!r&&(t.equate(r,i),!0)}function Hh(t,e,n,i){var r=t.any(void 0,n,i);return!!r&&(t.equate(r,e),!0)}function Kh(t,e,n,i,r){t.typeCallback&&t.typeCallback(t,i,r);var o=t.classActions[t.id(i)],s=!1;if(o)for(var a=0;a<o.length;a++)s=s||o[a](t,e,n,i,r);return s}var zh=function(){qa(i,Th);var t,e,n=(t=i,e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var n,i=Xa(t);if(e){var r=Xa(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return Ga(this,n)});function i(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Ka(this,i),Ya(za(e=n.call(this,void 0,void 0,void 0,void 0,r)),"updater",void 0),Ya(za(e),"namespaces",void 0),Ya(za(e),"classActions",void 0),Ya(za(e),"propertyActions",void 0),Ya(za(e),"redirections",void 0),Ya(za(e),"aliases",void 0),Ya(za(e),"HTTPRedirects",void 0),Ya(za(e),"subjectIndex",void 0),Ya(za(e),"predicateIndex",void 0),Ya(za(e),"objectIndex",void 0),Ya(za(e),"whyIndex",void 0),Ya(za(e),"index",void 0),Ya(za(e),"features",void 0),Ya(za(e),"_universalVariables",void 0),Ya(za(e),"_existentialVariables",void 0),Ya(za(e),"rdfArrayRemove",void 0),Ya(za(e),"dataCallbacks",void 0),e.propertyActions={},e.classActions={},e.redirections=[],e.aliases=[],e.HTTPRedirects=[],e.subjectIndex=[],e.predicateIndex=[],e.objectIndex=[],e.whyIndex=[],e.index=[e.subjectIndex,e.predicateIndex,e.objectIndex,e.whyIndex],e.namespaces={},e.features=t||[],e.rdfArrayRemove=r.rdfArrayRemove||xh,r.dataCallback&&(e.dataCallbacks=[r.dataCallback]),e.initPropertyActions(e.features),e}return Ha(i,[{key:"substitute",value:function(t){var e=this.statements.map((function(e){return e.substitute(t)})),n=new i;return n.add(e),n}},{key:"addDataCallback",value:function(t){this.dataCallbacks||(this.dataCallbacks=[]),this.dataCallbacks.push(t)}},{key:"applyPatch",value:function(t,e,n){var i,r=this,o=null;function s(s){if(t.delete){i=t.delete,o&&(i=i.substitute(o));var a=[],u=(i=i.statements).map((function(t){var n=r.statementsMatching(t.subject,t.predicate,t.object,e);return 0===n.length?(a.push(t),null):n[0]}));if(a.length)return n("Could not find to delete: "+a.join("\n or "));u.map((function(t){r.remove(t)}))}t.insert&&(i=t.insert,o&&(i=i.substitute(o)),(i=i.statements).map((function(t){t.graph=e,r.add(t.subject,t.predicate,t.object,t.graph)}))),s()}if(t.where){var a=new Ph("patch");a.pat=t.where,a.pat.statements.map((function(t){t.graph=Xd(e.value)})),a.sync=!0;var u=[];r.query(a,(function(t){u.push(t)}),r.fetcher,(function(){return 0===u.length?n("No match found to be patched:"+t.where):u.length>1?n("Patch ambiguous. No patch done."):(o=u[0],void s(n))}))}else s(n)}},{key:"declareExistential",value:function(t){return this._existentialVariables||(this._existentialVariables=[]),this._existentialVariables.push(t),t}},{key:"initPropertyActions",value:function(t){this.propertyActions[this.rdfFactory.id(this.rdfFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"))]=[Kh],Ch(t,"sameAs")>=0&&(this.propertyActions[this.rdfFactory.id(this.rdfFactory.namedNode("".concat(Jh,"sameAs")))]=[function(t,e,n,i){return t.equate(e,i),!0}]),Ch(t,"InverseFunctionalProperty")>=0&&(this.classActions[this.rdfFactory.id(this.rdfFactory.namedNode("".concat(Jh,"InverseFunctionalProperty")))]=[function(t,e){return t.newPropertyAction(e,Hh)}]),Ch(t,"FunctionalProperty")>=0&&(this.classActions[this.rdfFactory.id(this.rdfFactory.namedNode("".concat(Jh,"FunctionalProperty")))]=[function(t,e){return t.newPropertyAction(e,$h)}])}},{key:"addStatement",value:function(t){return this.add(t.subject,t.predicate,t.object,t.graph),this.statements.length}},{key:"add",value:function(t,e,n,i){var r,o,s;if(1===arguments.length){if(t instanceof Array)for(r=0;r<t.length;r++)this.add(t[r]);else uu(t)?this.add(t.subject,t.predicate,t.object,t.graph):iu(t)&&this.add(t.statements);return this}i||(i=this.fetcher?this.fetcher.appNode:this.rdfFactory.defaultGraph()),"string"==typeof t&&(t=this.rdfFactory.namedNode(t)),e=Oh.fromValue(e);var a=Oh.fromValue(n);if(i=Oh.fromValue(i),!lu(t))throw new Error("Subject is not a subject type");if(!hu(e))throw new Error("Predicate ".concat(e," is not a predicate type"));if(!ou(a))throw new Error("Object ".concat(a," is not an object type"));if(!du(i))throw new Error("Why is not a graph type");this.predicateCallback&&this.predicateCallback(this,e,i);var u=this.id(this.canon(e)),c=!1;if(o=this.propertyActions[u])for(r=0;r<o.length;r++)c=c||o[r](this,t,e,a,i);if(this.holds(t,e,a,i))return null;var l=[this.id(this.canon(t)),u,this.id(this.canon(a)),this.id(this.canon(i))];for(s=this.rdfFactory.quad(t,e,a,i),r=0;r<4;r++){var h=this.index[r],d=l[r];h[d]||(h[d]=[]),h[d].push(s)}if(this.statements.push(s),this.dataCallbacks){var f,p=Lh(this.dataCallbacks);try{for(p.s();!(f=p.n()).done;){var v=f.value;v(s)}}catch(t){p.e(t)}finally{p.f()}}return s}},{key:"canon",value:function(t){if(!t)return t;var e=this.redirections[this.id(t)];if(e)return e;switch(t.termType){case"BlankNode":return new tu(t.value);case"Collection":return t;case"DefaultGraph":return new Wl;case"Empty":case"Graph":return t;case"Literal":return new vu(t.value,t.language,t.datatype);case"NamedNode":return new fu(t.value);case"Variable":return new ah(t.value);default:throw new Error("Term Type not recognized for canonization: ".concat(t.termType))}}},{key:"check",value:function(){this.checkStatementList(this.statements);for(var t=0;t<4;t++){var e=this.index[t];for(var n in e)e.hasOwnProperty(n)&&this.checkStatementList(e[n],t)}}},{key:"checkStatementList",value:function(t,e){void 0===e&&(e=0);for(var n,i=" found in "+["subject","predicate","object","why"][e]+" index.",r=0;r<t.length;r++){for(var o=[(n=t[r]).subject,n.predicate,n.object,n.graph],s=function(t,e){for(var n=0;n<t.length;n++)if(t[n].subject.equals(e.subject)&&t[n].predicate.equals(e.predicate)&&t[n].object.equals(e.object)&&t[n].why.equals(e.graph))return!0},a=0;a<4;a++){var u=this.canon(o[a]),c=this.id(u);this.index[a][c]&&s(this.index[a][c],n)}if(!s(this.statements,n))throw new Error("Statement list does not statement "+n+"@"+n.graph+i)}}},{key:"close",value:function(){return this}},{key:"compareTerms",value:function(t,e){return Object.prototype.hasOwnProperty.call(t,"compareTerm")?t.compareTerm(e):Za[t.termType]<Za[e.termType]?-1:Za[t.termType]>Za[e.termType]?1:t.value<e.value?-1:t.value>e.value?1:0}},{key:"copyTo",value:function(t,e,n){n||(n=[]);var i=this.statementsMatching(t);-1!==Ch(n,"two-direction")&&i.concat(this.statementsMatching(void 0,void 0,t));for(var r=0;r<i.length;r++){var o=i[r];switch(o.object.termType){case"NamedNode":this.add(e,o.predicate,o.object);break;case"Literal":case"BlankNode":case"Collection":this.add(e,o.predicate,o.object.copy(this))}-1!==Ch(n,"delete")&&this.remove(o)}}},{key:"equate",value:function(t,e){var n=this.canon(t),i=this.canon(e),r=this.compareTerms(n,i);return!r||(r<0?this.replaceWith(i,n):this.replaceWith(n,i))}},{key:"formula",value:function(t){return new i(t)}},{key:"length",get:function(){return this.statements.length}},{key:"match",value:function(t,e,n,i){return this.statementsMatching(Oh.fromValue(t),Oh.fromValue(e),Oh.fromValue(n),Oh.fromValue(i))}},{key:"mentionsURI",value:function(t){var e="<"+t+">";return!!this.subjectIndex[e]||!!this.objectIndex[e]||!!this.predicateIndex[e]}},{key:"newExistential",value:function(t){if(!t)return this.bnode();var e=this.sym(t);return this.declareExistential(e)}},{key:"newPropertyAction",value:function(t,e){var n=this.id(t);this.propertyActions[n]||(this.propertyActions[n]=[]),this.propertyActions[n].push(e);for(var i=this.statementsMatching(void 0,t,void 0),r=!1,o=0;o<i.length;o++)r=r||e(this,i[o].subject,t,i[o].object);return r}},{key:"newUniversal",value:function(t){var e=this.sym(t);return this._universalVariables||(this._universalVariables=[]),this._universalVariables.push(e),e}},{key:"variable",value:function(t){return new ah(t)}},{key:"nextSymbol",value:function(t){for(var e=0;;e++){var n=t.value+"#n"+e;if(!this.mentionsURI(n))return this.sym(n)}}},{key:"query",value:function(t,e,n,i){return Dh.call(this,t,e,n,i)}},{key:"querySync",value:function(t){var e=[],n=!1;if(t.sync=!0,Dh.call(this,t,(function(t){e.push(t)}),null,(function(){n=!0})),!n)throw new Error("Sync query should have called done function");return e}},{key:"remove",value:function(t){if(t instanceof Array){for(var e=0;e<t.length;e++)this.remove(t[e]);return this}if(iu(t))return this.remove(t.statements);var n=this.statementsMatching(t.subject,t.predicate,t.object,t.graph);if(!n.length)throw new Error("Statement to be removed is not on store: "+t);return this.removeStatement(n[0]),this}},{key:"removeDocument",value:function(t){for(var e=this.statementsMatching(void 0,void 0,void 0,t).slice(),n=0;n<e.length;n++)this.removeStatement(e[n]);return this}},{key:"removeMany",value:function(t,e,n,i,r){for(var o=this.statementsMatching(t,e,n,i,!1),s=[],a=0;a<o.length;a++)s.push(o[a]);for(r&&(s=s.slice(0,r)),a=0;a<s.length;a++)this.remove(s[a])}},{key:"removeMatches",value:function(t,e,n,i){return this.removeStatements(this.statementsMatching(t,e,n,i)),this}},{key:"removeStatement",value:function(t){for(var e=[t.subject,t.predicate,t.object,t.graph],n=0;n<4;n++){var i=this.canon(e[n]),r=this.id(i);this.index[n][r]&&this.rdfArrayRemove(this.index[n][r],t)}return this.rdfArrayRemove(this.statements,t),this}},{key:"removeStatements",value:function(t){for(var e=0;e<t.length;e++)this.remove(t[e]);return this}},{key:"replaceWith",value:function(t,e){for(var n=this.id(t),i=this.id(e),r=function(t){var e=t[n];if(e){var r=t[i];t[i]=r?e.concat(r):e,delete t[n]}},o=0;o<4;o++)r(this.index[o]);if(this.redirections[n]=e,t.value){if(this.aliases[i]||(this.aliases[i]=[]),this.aliases[i].push(t),this.aliases[n])for(o=0;o<this.aliases[n].length;o++)this.redirections[this.id(this.aliases[n][o])]=e,this.aliases[i].push(this.aliases[n][o]);this.add(e,this.sym("http://www.w3.org/2007/ont/link#uri"),t),this.fetcher&&this.fetcher.nowKnownAs(t,e)}return r(this.classActions),r(this.propertyActions),!0}},{key:"allAliases",value:function(t){var e=this.aliases[this.id(this.canon(t))]||[];return e.push(this.canon(t)),e}},{key:"sameThings",value:function(t,e){if(t.equals(e))return!0;var n=this.canon(t);if(!n)return!1;var i=this.canon(e);return!!i&&n.value===i.value}},{key:"setPrefixForURI",value:function(t,e){if(("tab"!==t||!this.namespaces.tab)&&"ns"!==t.slice(0,2)&&"default"!==t.slice(0,7)){for(var n in this.namespaces)this.namespaces[n]==e&&delete this.namespaces[n];this.namespaces[t]=e}}},{key:"statementsMatching",value:function(t,e,n,i,r){var o,s,a=[t,e,n,i],u=[],c=[],l=[];for(o=0;o<4;o++)u[o]=this.canon(Oh.fromValue(a[o])),u[o]&&(l.push(o),c[o]=this.id(u[o]));if(0===l.length)return this.statements;if(1===l.length)return(s=this.index[o=l[0]][c[o]])&&r&&s.length>1&&(s=s.slice(0,1)),s||[];var h,d,f=1e10;for(d=0;d<l.length;d++){if(!(s=this.index[o=l[d]][c[o]]))return[];s.length<f&&(f=s.length,h=d)}for(var p=l[h],v=this.index[p][c[p]],g=l.slice(0,h).concat(l.slice(h+1)),m=[],w=["subject","predicate","object","why"],b=0;b<v.length;b++){var y=v[b];for(d=0;d<g.length;d++)if(!this.canon(y[w[o=g[d]]]).equals(u[o])){y=null;break}if(null!=y&&(m.push(y),r))break}return m}},{key:"uris",value:function(t){var e=this.canon(t),n=this.aliases[this.id(e)];if(!e.value)return[];var i=[e.value];if(n)for(var r=0;r<n.length;r++)i.push(n[r].uri);return i}},{key:"serialize",value:function(t,e,n,i){var r,o=null!==(r=i)&&void 0!==r&&r.namespaces?Uh(Uh({},this.namespaces),i.namespaces):Uh({},this.namespaces);return Fh(n,this,t,e,void 0,i=Uh(Uh({},i||{}),{},{namespaces:o}))}}],[{key:"defaultGraphURI",get:function(){return"chrome:theSession"}}]),i}();Ya(zh,"handleRDFType",void 0),zh.handleRDFType=Kh;var Wh="http://www.w3.org/2000/10/swap/log#",qh=function(t){return t},Vh=function(t){return t},Gh=function(t){if(t.length>0)throw"missing.js: oops nnonempty dict not imp";return[]},Xh=function(t){return t.length},Yh=function(t,e,n){if(void 0===t.slice)throw"@@ mising.js: No .slice function for "+t+" of type "+Va(t);return void 0===n||null==n?t.slice(e):t.slice(e,n)},Zh=Error("dummy error stop iteration"),Qh=function(t){return this.last=0,this.li=t,this.next=function(){if(this.last==this.li.length)throw Zh;return this.li[this.last++]},this},td=function(t,e){return t.indexOf(e)},ed=function(t,e){if(!t){if(e)throw"python Assertion failed: "+e;throw"(python) Assertion failed."}};String.prototype.encode=function(t){if("utf-8"!=t)throw"UTF8_converter: can only do utf-8";return function(t){t=t.replace(/\r\n/g,"\n");for(var e="",n=0;n<t.length;n++){var i=t.charCodeAt(n);i<128?e+=String.fromCharCode(i):i>127&&i<2048?(e+=String.fromCharCode(i>>6|192),e+=String.fromCharCode(63&i|128)):(e+=String.fromCharCode(i>>12|224),e+=String.fromCharCode(i>>6&63|128),e+=String.fromCharCode(63&i|128))}return e}(this)},String.prototype.decode=function(t){if("utf-8"!=t)throw"UTF8_converter: can only do utf-8";return this};var nd,id=function(t,e){return eh(e,t)},rd="\t\r\n !\"#$%&'()*.,+/;<=>?@[\\]^`{|}~:",od=new RegExp("^([-+]?[0-9]+)(\\.[0-9]+)?(e[-+]?[0-9]+)?","g"),sd=new RegExp("^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9](T[0-9][0-9]:[0-9][0-9](:[0-9][0-9](\\.[0-9]*)?)?)?Z?"),ad=new RegExp('[\\\\\\r\\n\\"]',"g"),ud=new RegExp("^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*","g"),cd=function(t,e,n,i,r,o,s,a){return new ld(t,e,n,i,r,o,s,a)},ld=function(){function t(e,n,i,r,o,s,a,u){Ka(this,t),void 0===n&&(n=null),void 0===i&&(i=""),void 0===r&&(r=null),void 0===o&&(o=""),void 0===a&&(a=""),void 0===u&&(u=null),this._bindings=new Gh([]),this._flags=a,""!=i&&(ed(i.indexOf(":")>=0,"Document URI not absolute: "+i),this._bindings[""]=i+"#"),this._store=e,o&&e.setGenPrefix(o),this._thisDoc=i,this.source=e.sym(i),this.lines=0,this.statementCount=0,this.startOfLine=0,this.previousLine=0,this._genPrefix=o,this.keywords=new Vh(["a","this","bind","has","is","of","true","false"]),this.keywordsSet=0,this._anonymousNodes=new Gh([]),this._variables=new Gh([]),this._parentVariables=new Gh([]),this._reason=u,this._reason2=null,this._baseURI=r||i||null,ed(!this._baseURI||this._baseURI.indexOf(":")>=0),this._genPrefix||(this._genPrefix=this._thisDoc?this._thisDoc+"#_g":RDFSink_uniqueURI()),this._formula=null==n?this._thisDoc?e.formula(i+"#_formula"):e.formula():n,this._context=this._formula,this._parentContext=null}return Ha(t,[{key:"here",value:function(t){return this._genPrefix+"_L"+this.lines+"C"+(t-this.startOfLine+1)}},{key:"formula",value:function(){return this._formula}},{key:"loadStream",value:function(t){return this.loadBuf(t.read())}},{key:"loadBuf",value:function(t){return this.startDoc(),this.feed(t),this.endDoc()}},{key:"feed",value:function(t){for(var e=t.decode("utf-8"),n=0;n>=0;){var i=this.skipSpace(e,n);if(i<0)return;if((n=this.directiveOrStatement(e,i))<0)throw hd(this._thisDoc,this.lines,e,i,"expected directive or statement")}}},{key:"directiveOrStatement",value:function(t,e){var n,i=this.skipSpace(t,e);return i<0?i:(n=this.directive(t,i))>=0||(n=this.statement(t,i))>=0?this.checkDot(t,n):n}},{key:"tok",value:function(t,e,n){if("@"==e.slice(n,n+1))n+=1;else if(Ch(this.keywords,t)<0)return-1;var i=n+Xh(t);return e.slice(n,i)==t&&"\t\r\n !\"#$%&'()*.,+/;<=>?@[\\]^`{|}~".indexOf(e.charAt(i))>=0?i:-1}},{key:"directive",value:function(t,e){if((o=this.skipSpace(t,e))<0)return o;var n=new Vh([]);if((o=this.tok("bind",t,e))>0)throw hd(this._thisDoc,this.lines,t,e,"keyword bind is obsolete: use @prefix");if((o=this.tok("keywords",t,e))>0){if((e=this.commaSeparatedList(t,o,n,!1))<0)throw hd(this._thisDoc,this.lines,t,e,"'@keywords' needs comma separated list of words");return this.setKeywords(Yh(n,null,null)),e}if((o=this.tok("forAll",t,e))>0){if((e=this.commaSeparatedList(t,o,n,!0))<0)throw hd(this._thisDoc,this.lines,t,e,"Bad variable list after @forAll");var i=new Qh(n);try{for(;;){var r=i.next();(Ch(this._variables,r)<0||Ch(this._parentVariables,r)>=0)&&(this._variables[r]=this._context.newUniversal(r))}}catch(t){if(t!=Zh)throw t}return e}if((o=this.tok("forSome",t,e))>0){if((e=this.commaSeparatedList(t,o,n,this.uri_ref2))<0)throw hd(this._thisDoc,this.lines,t,e,"Bad variable list after @forSome");i=new Qh(n);try{for(;;)r=i.next(),this._context.declareExistential(r)}catch(t){if(t!=Zh)throw t}return e}if((o=this.tok("prefix",t,e))>=0){var o,s=new Vh([]);if((e=this.qname(t,o,s))<0)throw hd(this._thisDoc,this.lines,t,o,"expected qname after @prefix");if((o=this.uri_ref2(t,e,s))<0)throw hd(this._thisDoc,this.lines,t,e,"expected <uriref> after @prefix _qname_");var a=s[1].uri;return this._baseURI?a=id(this._baseURI,a):ed(a.indexOf(":")>=0,"With no base URI, cannot handle relative URI for NS"),ed(a.indexOf(":")>=0),this._bindings[s[0][0]]=a,this.bind(s[0][0],function(t){return encodeURI(t)}(a)),o}if((o=this.tok("base",t,e))>=0){if(s=new Vh([]),(e=this.uri_ref2(t,o,s))<0)throw hd(this._thisDoc,this.lines,t,o,"expected <uri> after @base ");if(a=s[0].uri,!this._baseURI)throw hd(this._thisDoc,this.lines,t,o,"With no previous base URI, cannot use relative URI in @base <"+a+">");return a=id(this._baseURI,a),ed(a.indexOf(":")>=0),this._baseURI=a,e}return-1}},{key:"bind",value:function(t,e){""==t||this._store.setPrefixForURI(t,e)}},{key:"setKeywords",value:function(t){null==t?this.keywordsSet=0:(this.keywords=t,this.keywordsSet=1)}},{key:"startDoc",value:function(){}},{key:"endDoc",value:function(){return this._formula}},{key:"makeStatement",value:function(t){t[0].add(t[2],t[1],t[3],this.source),this.statementCount+=1}},{key:"statement",value:function(t,e){var n=new Vh([]);if((e=this.object(t,e,n))<0)return e;var i=this.property_list(t,e,n[0]);if(i<0)throw hd(this._thisDoc,this.lines,t,e,"expected propertylist");return i}},{key:"subject",value:function(t,e,n){return this.item(t,e,n)}},{key:"verb",value:function(t,e,n){if((r=this.skipSpace(t,e))<0)return r;var i=new Vh([]);if((r=this.tok("has",t,e))>=0){if((e=this.prop(t,r,i))<0)throw hd(this._thisDoc,this.lines,t,r,"expected property after 'has'");return n.push(new qh(["->",i[0]])),e}if((r=this.tok("is",t,e))>=0){var r;if((e=this.prop(t,r,i))<0)throw hd(this._thisDoc,this.lines,t,r,"expected <property> after 'is'");if((r=this.skipSpace(t,e))<0)throw hd(this._thisDoc,this.lines,t,e,"End of file found, expected property after 'is'");if((r=this.tok("of",t,e=r))<0)throw hd(this._thisDoc,this.lines,t,e,"expected 'of' after 'is' <prop>");return n.push(new qh(["<-",i[0]])),r}if((r=this.tok("a",t,e))>=0)return n.push(new qh(["->",this._store.sym("http://www.w3.org/1999/02/22-rdf-syntax-ns#type")])),r;if("<="==t.slice(e,e+2))return n.push(new qh(["<-",this._store.sym(Wh+"implies")])),e+2;if("="==t.slice(e,e+1))return">"==t.slice(e+1,e+2)?(n.push(new qh(["->",this._store.sym(Wh+"implies")])),e+2):(n.push(new qh(["->",this._store.sym("http://www.w3.org/2002/07/owl#sameAs")])),e+1);if(":="==t.slice(e,e+2))return n.push(new qh(["->",Wh+"becomes"])),e+2;if((r=this.prop(t,e,i))>=0)return n.push(new qh(["->",i[0]])),r;if(">-"==t.slice(e,e+2)||"<-"==t.slice(e,e+2))throw hd(this._thisDoc,this.lines,t,r,">- ... -> syntax is obsolete.");return-1}},{key:"prop",value:function(t,e,n){return this.item(t,e,n)}},{key:"item",value:function(t,e,n){return this.path(t,e,n)}},{key:"blankNode",value:function(t){return this._context.bnode(t,this._reason2)}},{key:"path",value:function(t,e,n){if((o=this.nodeOrLiteral(t,e,n))<0)return o;for(;"!^.".indexOf(t.slice(o,o+1))>=0;){var i=t.slice(o,o+1);if("."==i){var r=t.slice(o+1,o+2);if(!r||rd.indexOf(r)>=0&&":?<[{(".indexOf(r)<0)break}var o,s=n.pop(),a=this.blankNode(this.here(o));if((o=this.node(t,o+1,n))<0)throw hd(this._thisDoc,this.lines,t,o,"EOF found in middle of path syntax");var u=n.pop();this.makeStatement(new qh("^"==i?[this._context,u,a,s]:[this._context,u,s,a])),n.push(a)}return o}},{key:"anonymousNode",value:function(t){if(e=this._anonymousNodes[t])return e;var e=this._store.bnode(t);return this._anonymousNodes[t]=e,e}},{key:"node",value:function(t,e,n,i){void 0===i&&(i=null);var r=i;if((l=this.skipSpace(t,e))<0)return l;var o=t.slice(e=l,e+1);if("["==o){var s=this.here(e);if((l=this.skipSpace(t,e+1))<0)throw hd(this._thisDoc,this.lines,t,e,"EOF after '['");if("="==t.slice(l,l+1)){e=l+1;var a=new Vh([]);if(!((l=this.objectList(t,e,a))>=0))throw hd(this._thisDoc,this.lines,t,e,"objectList expected after [= ");if(r=a[0],Xh(a)>1){var u=new Qh(a);try{for(;;){var c=u.next();this.makeStatement(new qh([this._context,this._store.sym("http://www.w3.org/2002/07/owl#sameAs"),r,c]))}}catch(t){if(t!=Zh)throw t}}if((l=this.skipSpace(t,l))<0)throw hd(this._thisDoc,this.lines,t,e,"EOF when objectList expected after [ = ");if(";"==t.slice(l,l+1))var l=l+1}if(null==r&&(r=this.blankNode(s)),(e=this.property_list(t,l,r))<0)throw hd(this._thisDoc,this.lines,t,l,"property_list expected");if((l=this.skipSpace(t,e))<0)throw hd(this._thisDoc,this.lines,t,e,"EOF when ']' expected after [ <propertyList>");if("]"!=t.slice(l,l+1))throw hd(this._thisDoc,this.lines,t,l,"']' expected");return n.push(r),l+1}if("{"==o){if("$"==t.slice(e+1,e+2)){l=(e+=1)+1;for(var h=new Vh([]),d=!0;;){if((e=this.skipSpace(t,l))<0)throw hd(this._thisDoc,this.lines,t,e,"needed '$}', found end.");if("$}"==t.slice(e,e+2)){l=e+2;break}if(d)d=!1;else{if(","!=t.slice(e,e+1))throw hd(this._thisDoc,this.lines,t,e,"expected: ','");e+=1}var f=new Vh([]);if((l=this.item(t,e,f))<0)throw hd(this._thisDoc,this.lines,t,e,"expected item in set or '$}'");h.push(f[0])}return n.push(this._store.newSet(h,this._context)),l}l=e+1;var p=this._parentContext;this._parentContext=this._context;var v=this._anonymousNodes,g=this._parentVariables;this._parentVariables=this._variables,this._anonymousNodes=new Gh([]),this._variables=this._variables.slice();var m=this._reason2;for(this._reason2=null,null==r&&(r=this._store.formula()),this._context=r;;){if((e=this.skipSpace(t,l))<0)throw hd(this._thisDoc,this.lines,t,e,"needed '}', found end.");if("}"==t.slice(e,e+1)){l=e+1;break}if((l=this.directiveOrStatement(t,e))<0)throw hd(this._thisDoc,this.lines,t,e,"expected statement or '}'")}return this._anonymousNodes=v,this._variables=this._parentVariables,this._parentVariables=g,this._context=this._parentContext,this._reason2=m,this._parentContext=p,n.push(r.close()),l}if("("==o){var w=this._store.list;for("$"==t.slice(e+1,e+2)&&(w=this._store.newSet,e+=1),l=e+1,h=new Vh([]);;){if((e=this.skipSpace(t,l))<0)throw hd(this._thisDoc,this.lines,t,e,"needed ')', found end.");if(")"==t.slice(e,e+1)){l=e+1;break}if(f=new Vh([]),(l=this.item(t,e,f))<0)throw hd(this._thisDoc,this.lines,t,e,"expected item in list or ')'");h.push(f[0])}return n.push(w(h,this._context)),l}if((l=this.tok("this",t,e))>=0)throw hd(this._thisDoc,this.lines,t,e,"Keyword 'this' was ancient N3. Now use @forSome and @forAll keywords.");return(l=this.tok("true",t,e))>=0?(n.push(!0),l):(l=this.tok("false",t,e))>=0?(n.push(!1),l):null==r&&(l=this.uri_ref2(t,e,n))>=0?l:-1}},{key:"property_list",value:function(t,e,n){for(;;){if((c=this.skipSpace(t,e))<0)throw hd(this._thisDoc,this.lines,t,e,"EOF found when expected verb in property list");if(":-"!=t.slice(c,c+2)){e=c;var i=new Vh([]);if((c=this.verb(t,e,i))<=0)return e;var r=new Vh([]);if((e=this.objectList(t,c,r))<0)throw hd(this._thisDoc,this.lines,t,c,"objectList expected");var o=new Qh(r);try{for(;;){var s=o.next(),a=i[0],u=a[1];this.makeStatement(new qh("->"==a[0]?[this._context,u,n,s]:[this._context,u,s,n]))}}catch(t){if(t!=Zh)throw t}if((c=this.skipSpace(t,e))<0)throw hd(this._thisDoc,this.lines,t,c,"EOF found in list of objects");if(";"!=t.slice(e,e+1))return e;e+=1}else{e=c+2;var c,l=new Vh([]);if((c=this.node(t,e,l,n))<0)throw hd(this._thisDoc,this.lines,t,e,"bad {} or () or [] node after :- ");e=c}}}},{key:"commaSeparatedList",value:function(t,e,n,i){if((r=this.skipSpace(t,e))<0)throw hd(this._thisDoc,this.lines,t,r,"EOF found expecting comma sep list");if("."==t.charAt(r))return e;if(i)var r=this.uri_ref2(t,r,n);else r=this.bareWord(t,r,n);if(r<0)return-1;for(;;){if((e=this.skipSpace(t,r))<0)return e;var o=t.slice(e,e+1);if(","!=o)return"."!=o?-1:e;if((r=i?this.uri_ref2(t,e+1,n):this.bareWord(t,e+1,n))<0)throw hd(this._thisDoc,this.lines,t,r,"bad list content")}}},{key:"objectList",value:function(t,e,n){if((e=this.object(t,e,n))<0)return-1;for(;;){var i=this.skipSpace(t,e);if(i<0)throw hd(this._thisDoc,this.lines,t,i,"EOF found after object");if(","!=t.slice(i,i+1))return i;if((e=this.object(t,i+1,n))<0)return e}}},{key:"checkDot",value:function(t,e){var n=this.skipSpace(t,e);if(n<0)return n;if("."==t.slice(n,n+1))return n+1;if("}"==t.slice(n,n+1))return n;if("]"==t.slice(n,n+1))return n;throw hd(this._thisDoc,this.lines,t,n,"expected '.' or '}' or ']' at end of statement")}},{key:"uri_ref2",value:function(t,e,n){var i=new Vh([]);if((d=this.qname(t,e,i))>=0){var r=i[0],o=r[0],s=r[1];if(null==o){ed(0,"not used?");var a=this._baseURI+"#"}else if(!(a=this._bindings[o])){if("_"==o)return n.push(this.anonymousNode(s)),d;throw hd(this._thisDoc,this.lines,t,e,"Prefix "+o+" not bound.")}var u=this._store.sym(a+s);return Ch(this._variables,u)>=0?n.push(this._variables[u]):n.push(u),d}if((e=this.skipSpace(t,e))<0)return-1;if("?"==t.charAt(e)){var c=new Vh([]);return(d=this.variable(t,e,c))>0?(n.push(c[0]),d):-1}if("<"==t.charAt(e)){for(var l=e+=1;e<Xh(t);){if(">"==t.charAt(e)){var h=t.slice(l,e);return this._baseURI?h=id(this._baseURI,h):ed(h.indexOf(":")>=0,"With no base URI, cannot deal with relative URIs"),"#"==t.slice(e-1,e)&&"#"!=Yh(h,-1,null)&&(h+="#"),u=this._store.sym(h),Ch(this._variables,u)>=0?n.push(this._variables[u]):n.push(u),e+1}e+=1}throw hd(this._thisDoc,this.lines,t,d,"unterminated URI reference")}if(this.keywordsSet){var d;if(c=new Vh([]),(d=this.bareWord(t,e,c))<0)return-1;if(Ch(this.keywords,c[0])>=0)throw hd(this._thisDoc,this.lines,t,e,'Keyword "'+c[0]+'" not allowed here.');return n.push(this._store.sym(this._bindings[""]+c[0])),d}return-1}},{key:"skipSpace",value:function(t,e){for(var n=e||0;n<t.length;n++){var i=t.charAt(n);if(" \n\r\t\f\v \u2028\u2029 ".indexOf(i)<0){if("#"!==t.charAt(n))return n;for(;;n++){if(n===t.length)return-1;if("\n"===t.charAt(n)){this.lines=this.lines+1;break}}}else"\n"===t.charAt(n)&&(this.lines=this.lines+1)}return-1}},{key:"variable",value:function(t,e,n){if((i=this.skipSpace(t,e))<0)return-1;if("?"!=t.slice(i,i+1))return-1;var i;if(e=i+=1,"0123456789-".indexOf(t.charAt(i))>=0)throw hd(this._thisDoc,this.lines,t,i,"Varible name can't start with '"+t.charAt(i)+"s'");for(;e<Xh(t)&&rd.indexOf(t.charAt(e))<0;)e+=1;if(null==this._parentContext)throw hd(this._thisDoc,this.lines,t,i,"Can't use ?xxx syntax for variable in outermost level: "+t.slice(i-1,e));return n.push(this._store.variable(t.slice(i,e))),e}},{key:"bareWord",value:function(t,e,n){var i=this.skipSpace(t,e);if(i<0)return-1;var r=t.charAt(i);if("0123456789-".indexOf(r)>=0)return-1;if(rd.indexOf(r)>=0)return-1;for(e=i;e<Xh(t)&&rd.indexOf(t.charAt(e))<0;)e+=1;return n.push(t.slice(i,e)),e}},{key:"qname",value:function(t,e,n){if((e=this.skipSpace(t,e))<0)return-1;var i=t.charAt(e);if("0123456789-+".indexOf(i)>=0)return-1;if(rd.indexOf(i)<0){var r=i;for(e+=1;e<Xh(t)&&(i=t.charAt(e),rd.indexOf(i)<0);)r+=i,e+=1}else r="";if(e<Xh(t)&&":"==t.charAt(e)){var o=r;for(e+=1,r="";e<Xh(t)&&(i=t.charAt(e),rd.indexOf(i)<0);)r+=i,e+=1;return n.push(new qh([o,r])),e}return r&&this.keywordsSet&&Ch(this.keywords,r)<0?(n.push(new qh(["",r])),e):-1}},{key:"object",value:function(t,e,n){if((s=this.subject(t,e,n))>=0)return s;if((s=this.skipSpace(t,e))<0)return-1;var i=null,r=t.charAt(e=s);if('"'==r||"'"==r){i=t.slice(e,e+3==r+r)?r+r+r:r,e+=Xh(i);var o=this.strconst(t,e,i),s=o[0];return n.push(this._store.literal(o[1])),s}return-1}},{key:"nodeOrLiteral",value:function(t,e,n){if((h=this.node(t,e,n))>=0)return h;if((h=this.skipSpace(t,e))<0)return-1;var i=t.charAt(e=h);if("-+0987654321".indexOf(i)>=0){if(sd.lastIndex=0,null!=(l=sd.exec(t.slice(e))))h=e+(r=l[0]).length,r.indexOf("T")>=0?n.push(this._store.literal(r,this._store.sym("http://www.w3.org/2001/XMLSchema#dateTime"))):n.push(this._store.literal(r,this._store.sym("http://www.w3.org/2001/XMLSchema#date")));else{var r;if(od.lastIndex=0,null==(l=od.exec(t.slice(e))))throw hd(this._thisDoc,this.lines,t,e,"Bad number or date syntax");(r=t.slice(e,h=e+od.lastIndex)).indexOf("e")>=0?n.push(this._store.literal(parseFloat(r),this._store.sym("http://www.w3.org/2001/XMLSchema#double"))):t.slice(e,h).indexOf(".")>=0?n.push(this._store.literal(parseFloat(r),this._store.sym("http://www.w3.org/2001/XMLSchema#decimal"))):n.push(this._store.literal(parseInt(r),this._store.sym("http://www.w3.org/2001/XMLSchema#integer")))}return h}if('"'==t.charAt(e)){if('"""'==t.slice(e,e+3))var o='"""';else o='"';e+=Xh(o);var s=null,a=this.strconst(t,e,o),u=a[1],c=null;if("@"==t.slice(h=a[0],h+1)){var l;if(ud.lastIndex=0,null==(l=ud.exec(t.slice(h+1))))throw hd(this._thisDoc,startline,t,e,"Bad language code syntax on string literal, after @");c=t.slice(h+1,e=ud.lastIndex+h+1);var h=e}if("^^"==t.slice(h,h+2)){var d=new Vh([]);h=this.uri_ref2(t,h+2,d),s=d[0]}return n.push(this._store.literal(u,c||s)),h}return-1}},{key:"strconst",value:function(t,e,n){for(var i=e,r="",o=this.lines;i<Xh(t);){if(e=i+Xh(n),t.slice(i,e)==n)return new qh([e,r]);if('"'!=t.charAt(i)){if(ad.lastIndex=0,!ad.exec(t.slice(i)))throw hd(this._thisDoc,o,t,i,"Closing quote missing in string at ^ in "+t.slice(i-20,i)+"^"+t.slice(i,i+20));if(r+=t.slice(i,e=i+ad.lastIndex-1),'"'!=(u=t.charAt(e)))if("\r"!=u){if("\n"==u){if('"'==n)throw hd(this._thisDoc,o,t,e,"newline found in string literal");this.lines=this.lines+1,r+=u,i=e+1,this.previousLine=this.startOfLine,this.startOfLine=i}else if("\\"==u){if(!(u=t.slice(i=e+1,i+1)))throw hd(this._thisDoc,o,t,e,"unterminated string literal (2)");var s=td('abfrtvn\\"',u);if(s>=0)r+='a\b\f\r\t\v\n\\"'.charAt(s),i+=1;else if("u"==u)i=(a=this.uEscape(t,i+1,o))[0],r+=u=a[1];else{if("U"!=u)throw hd(this._thisDoc,this.lines,t,e,"bad escape");var a,u;i=(a=this.UEscape(t,i+1,o))[0],r+=u=a[1]}}}else i=e+1;else i=e}else r=r+'"',i=i+1}throw hd(this._thisDoc,this.lines,t,e,"unterminated string literal")}},{key:"uEscape",value:function(t,e,n){for(var i=e,r=0,o=0;r<4;){var s=t.slice(i,i+1).toLowerCase();if(i+=1,""==s)throw hd(this._thisDoc,n,t,e,"unterminated string literal(3)");var a=td("0123456789abcdef",s);if(a<0)throw hd(this._thisDoc,n,t,e,"bad string literal hex escape");o=16*o+a,r+=1}var u=String.fromCharCode(o);return new qh([i,u])}},{key:"UEscape",value:function(t,e,n){for(var i=e,r=0,o="\\U";r<8;){var s=t.slice(i,i+1).toLowerCase();if(i+=1,""==s)throw hd(this._thisDoc,n,t,e,"unterminated string literal(3)");if(td("0123456789abcdef",s)<0)throw hd(this._thisDoc,n,t,e,"bad string literal hex escape");o+=s,r+=1}var a,u=(a="0x"+Yh(o,2,10)-0,String.fromCharCode(a));return new qh([i,u])}}]),t}();function hd(t,e,n,i,r){var o=e+1,s="Line "+o+" of <"+t+">: Bad syntax: "+r+'\nat: "'+n.slice(i,i+30)+'"',a=new SyntaxError(s,t,o);return a.lineNo=o,a.characterInFile=i,a.syntaxProblem=r,a}function dd(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function fd(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?dd(Object(n),!0).forEach((function(e){Ya(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):dd(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var pd,vd=fd(fd({},ch),{},{supports:(nd={},Ya(nd,rh.collections,!0),Ya(nd,rh.defaultGraphType,!1),Ya(nd,rh.equalsMethod,!0),Ya(nd,rh.identity,!1),Ya(nd,rh.id,!0),Ya(nd,rh.reversibleId,!1),Ya(nd,rh.variableType,!0),nd),collection:function(t){return new mu(t)},id:function(t){var e,n=this;return ru(t)?"( ".concat(t.elements.map((function(t){return n.id(t)})).join(", ")," )"):su(e=t)&&"Variable"===e.termType?ah.toString(t):ch.id(t)},termToNQ:function(t){return"Collection"===t.termType?mu.toNT(t):ch.termToNQ(t)}}),gd=Kt(Ca());function md(t,e){return"string"==typeof e?t.rdfFactory.literal(e):Object.prototype.hasOwnProperty.call(e,"@list")?!0===t.rdfFactory.supports.COLLECTIONS?function(t,e){if(!Array.isArray(e))throw new TypeError("Object must be an array");return t.rdfFactory.collection(e.map((function(e){return md(t,e)})))}(t,e["@list"]):function(t,e){var n=e["@id"]?t.rdfFactory.namedNode(e["@id"]):t.rdfFactory.blankNode(),i=e["@list"].map((function(e){return md(t,e)})),r=jh(t.rdfFactory,n,i);return t.addAll(r),n}(t,e):Object.prototype.hasOwnProperty.call(e,"@id")?t.rdfFactory.namedNode(e["@id"]):Object.prototype.hasOwnProperty.call(e,"@language")?t.rdfFactory.literal(e["@value"],e["@language"]):Object.prototype.hasOwnProperty.call(e,"@type")?t.rdfFactory.literal(e["@value"],t.rdfFactory.namedNode(e["@type"])):Object.prototype.hasOwnProperty.call(e,"@value")?t.rdfFactory.literal(e["@value"]):t.rdfFactory.literal(e)}function wd(t,e,n,i){var r=n&&Object.prototype.hasOwnProperty.call(n,"termType")?n.value:n;return gd.default.flatten(JSON.parse(t),null,{base:r}).then((function(t){return t.reduce((function(t,i){return e=bd(e,n,i)}),e)})).then(i).catch(i)}function bd(t,e,n){for(var i=n["@id"]?t.rdfFactory.namedNode(n["@id"]):t.rdfFactory.blankNode(),r=0,o=Object.keys(n);r<o.length;r++){var s=o[r];if("@id"!==s){if("@graph"==s)for(var a=i,u=n[s],c=0;c<u.length;c++)t=bd(t,a,u[c]);var l=n[s];if(Array.isArray(l))for(var h=0;h<l.length;h++)t.addStatement(yd(t,i,s,l[h],e));else t.addStatement(yd(t,i,s,l,e))}}return t}function yd(t,e,n,i,r){var o,s;return"@type"===n?(o=t.rdfFactory.namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),s=t.rdfFactory.namedNode(i)):(o=t.rdfFactory.namedNode(n),s=md(t,i)),t.rdfFactory.quad(e,o,s,t.rdfFactory.namedNode(r))}void 0===pd&&(pd={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12});var xd=function(){function t(e,n){Ka(this,t),this.options=n||{},this.kb=e,this.target=n.target||{graph:{subjects:{},prefixes:{},terms:{}}},this.blankNodes=[],this.htmlOptions={selfClosing:"br img input area base basefont col colgroup source wbr isindex link meta param hr"},this.theOne="_:"+(new Date).getTime(),this.language=null,this.vocabulary=null,this.blankCounter=0,this.langAttributes=[{namespaceURI:"http://www.w3.org/XML/1998/namespace",localName:"lang"}],this.inXHTMLMode=!1,this.absURIRE=/[\w\_\-]+:\S+/,this.finishedHandlers=[],this.init()}return Ha(t,[{key:"addTriple",value:function(t,e,n,i){var r,o,s,a;r=void 0===e?ch.namedNode(this.options.base):this.toRDFNodeObject(e),s=this.toRDFNodeObject(n),o=this.toRDFNodeObject(i),a=ch.namedNode(this.options.base),this.kb.add(r,s,o,a)}},{key:"ancestorPath",value:function(t){for(var e="";t&&t.nodeType!==pd.DOCUMENT_NODE;)e="/"+t.localName+e,t=t.parentNode;return e}},{key:"copyMappings",value:function(t){var e={};for(var n in t)e[n]=t[n];return e}},{key:"copyProperties",value:function(){}},{key:"deriveDateTimeType",value:function(e){for(var n=0;n<t.dateTimeTypes.length;n++){var i=t.dateTimeTypes[n].pattern.exec(e);if(i&&i[0].length===e.length)return t.dateTimeTypes[n].type}return null}},{key:"init",value:function(){}},{key:"newBlankNode",value:function(){return this.blankCounter++,"_:"+this.blankCounter}},{key:"newSubjectOrigin",value:function(){}},{key:"parseCURIE",value:function(e,n){var i,r=e.indexOf(":");if(r>=0){var o=e.substring(0,r);if(""===o)return(i=n[""])?i+e.substring(r+1):null;if("_"===o)return"_:"+e.substring(r+1);if(t.NCNAME.test(o)&&(i=n[o]))return i+e.substring(r+1)}return null}},{key:"parseCURIEOrURI",value:function(t,e,n){return this.parseCURIE(t,e,n)||this.resolveAndNormalize(n,t)}},{key:"parsePredicate",value:function(t,e,n,i,r,o){if(""===t)return null;var s=this.parseTermOrCURIEOrAbsURI(t,e,o?null:n,i,r);return s&&0===s.indexOf("_:")?null:s}},{key:"parsePrefixMappings",value:function(t,e){for(var n=this.tokenize(t),i=null,r=0;r<n.length;r++)":"===n[r][n[r].length-1]?i=n[r].substring(0,n[r].length-1):i&&(e[i]=this.options.base?eh(n[r],this.options.base):n[r],i=null)}},{key:"parseSafeCURIEOrCURIEOrURI",value:function(t,e,n){return"["===(t=this.trim(t)).charAt(0)&&"]"===t.charAt(t.length-1)?0===(t=(t=t.substring(1,t.length-1)).trim(t)).length?null:"_:"===t?this.theOne:this.parseCURIE(t,e,n):this.parseCURIEOrURI(t,e,n)}},{key:"parseTermOrCURIEOrAbsURI",value:function(t,e,n,i,r){t=this.trim(t);var o=this.parseCURIE(t,i,r);if(o)return o;if(n){if(e&&!this.absURIRE.exec(t))return e+t;var s=n[t];if(s)return s;if(s=n[t.toLowerCase()])return s}return this.absURIRE.exec(t)?this.resolveAndNormalize(r,t):null}},{key:"parseTermOrCURIEOrURI",value:function(t,e,n,i,r){t=this.trim(t);var o=this.parseCURIE(t,i,r);if(o)return o;var s=n[t];return s||((s=n[t.toLowerCase()])?s:e&&!this.absURIRE.exec(t)?e+t:this.resolveAndNormalize(r,t))}},{key:"parseURI",value:function(t){return t}},{key:"process",value:function(e,n){var i;n=n||{},e.nodeType===pd.DOCUMENT_NODE?(e.baseURI&&!n.baseURI&&(n.baseURI=e.baseURI),i=e.baseURI,(e=e.documentElement).baseURI||(e.baseURI=i),this.setContext(e)):e.parentNode.nodeType===pd.DOCUMENT_NODE&&this.setContext(e);var r=[],o=function(t){if(!t&&n&&n.baseURI)return n.baseURI;var e=t.indexOf("#");return e>=0&&(t=t.substring(0,e)),n&&n.baseURIMap&&(t=n.baseURIMap(t)),t};for(r.push({current:e,context:this.push(null,o(e.baseURI))});r.length>0;){var s=r.shift();if(s.parent){if(s.context.parent&&s.context.parent.listMapping===s.listMapping)continue;for(var a in s.listMapping){var u=s.listMapping[a];if(0!==u.length){for(var c=[],l=0;l<u.length;l++)c.push(this.newBlankNode());for(var h=0;h<c.length;h++)this.addTriple(s.parent,c[h],"http://www.w3.org/1999/02/22-rdf-syntax-ns#first",u[h]),this.addTriple(s.parent,c[h],"http://www.w3.org/1999/02/22-rdf-syntax-ns#rest",{type:t.objectURI,value:h+1<c.length?c[h+1]:"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"});this.addTriple(s.parent,s.subject,a,{type:t.objectURI,value:c[0]})}else this.addTriple(s.parent,s.subject,a,{type:t.objectURI,value:"http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"})}}else{var d=s.current,f=s.context,p=!1,v=null,g=null,m=null,w=f.prefixes,b=!1,y=[],x=f.listMapping,k=!f.parent,E=f.language,S=f.vocabulary;i=this.parseURI(o(d.baseURI)),d.item=null;var F=d.getAttributeNode("vocab");if(F){var A=this.trim(F.value);A.length>0?this.addTriple(d,i.spec,"http://www.w3.org/ns/rdfa#usesVocabulary",{type:t.objectURI,value:S=A}):S=this.vocabulary}for(var _=0;_<d.attributes.length;_++){var j=d.attributes[_];if("x"===j.nodeName.charAt(0)&&0===j.nodeName.indexOf("xmlns:")){b||(w=this.copyMappings(w),b=!0);var C=j.nodeName.substring(6),R=t.trim(j.value);w[C]=this.options.base?eh(R,this.options.base):R}}var I=d.getAttributeNode("prefix");I&&(b||(w=this.copyMappings(w),b=!0),this.parsePrefixMappings(I.value,w));for(var T=null,O=0;!T&&O<this.langAttributes.length;O++)T=d.getAttributeNodeNS(this.langAttributes[O].namespaceURI,this.langAttributes[O].localName);if(T){var N=t.trim(T.value);E=N.length>0?N:null}var P,D,M=d.getAttributeNode("rel"),U=d.getAttributeNode("rev"),L=d.getAttributeNode("typeof"),B=d.getAttributeNode("property"),J=d.getAttributeNode("datatype"),$=this.inHTMLMode?d.getAttributeNode("datetime"):null,H=d.getAttributeNode("content"),K=d.getAttributeNode("about"),z=d.getAttributeNode("src"),W=d.getAttributeNode("resource"),q=d.getAttributeNode("href"),V=d.getAttributeNode("inlist"),G=[];if(M){D=this.tokenize(M.value);for(var X=0;X<D.length;X++)(P=this.parsePredicate(D[X],S,f.terms,w,i,this.inHTMLMode&&null!==B))&&G.push(P)}var Y=[];if(U){D=this.tokenize(U.value);for(var Z=0;Z<D.length;Z++)(P=this.parsePredicate(D[Z],S,f.terms,w,i,this.inHTMLMode&&B))&&Y.push(P)}if(this.inHTMLMode&&(M||U)&&B&&(0===G.length&&(M=null),0===Y.length&&(U=null)),M||U?(K&&(v=this.parseSafeCURIEOrCURIEOrURI(K.value,w,i)),L&&(m=v),v||(d.parentNode.nodeType===pd.DOCUMENT_NODE?v=o(d.baseURI):f.parentObject&&(v=o(d.parentNode.baseURI)===f.parentObject?o(d.baseURI):f.parentObject)),W&&(g=this.parseSafeCURIEOrCURIEOrURI(W.value,w,i)),g||(q?g=this.resolveAndNormalize(i,encodeURI(q.value)):z?g=this.resolveAndNormalize(i,encodeURI(z.value)):!L||K||this.inXHTMLMode&&("head"===d.localName||"body"===d.localName)||(g=this.newBlankNode())),!L||K||!this.inXHTMLMode||"head"!==d.localName&&"body"!==d.localName?L&&!K&&(m=g):m=v):!B||H||J?(K&&(v=this.parseSafeCURIEOrCURIEOrURI(K.value,w,i)),!v&&W&&(v=this.parseSafeCURIEOrCURIEOrURI(W.value,w,i)),!v&&q&&(v=this.resolveAndNormalize(i,encodeURI(q.value))),!v&&z&&(v=this.resolveAndNormalize(i,encodeURI(z.value))),v||(d.parentNode.nodeType===pd.DOCUMENT_NODE?v=o(d.baseURI):!this.inXHTMLMode&&!this.inHTMLMode||"head"!==d.localName&&"body"!==d.localName?L?v=this.newBlankNode():f.parentObject&&(v=o(d.parentNode.baseURI)===f.parentObject?o(d.baseURI):f.parentObject,B||(p=!0)):v=o(d.parentNode.baseURI)===f.parentObject?o(d.baseURI):f.parentObject),L&&(m=v)):(K&&(v=this.parseSafeCURIEOrCURIEOrURI(K.value,w,i),L&&(m=v)),v||d.parentNode.nodeType!==pd.DOCUMENT_NODE?!v&&f.parentObject&&(v=o(d.parentNode.baseURI)===f.parentObject?o(d.baseURI):f.parentObject):(v=o(d.baseURI),L&&(m=v)),L&&!m&&(W&&(m=this.parseSafeCURIEOrCURIEOrURI(W.value,w,i)),!m&&q&&(m=this.resolveAndNormalize(i,encodeURI(q.value))),!m&&z&&(m=this.resolveAndNormalize(i,encodeURI(z.value))),m||!this.inXHTMLMode&&!this.inHTMLMode||"head"!==d.localName&&"body"!==d.localName||(m=v),m||(m=this.newBlankNode()),g=m)),v&&(K||W||m)){var Q=v;L&&!K&&!W&&g&&(Q=g),this.newSubjectOrigin(d,Q)}if(m){D=this.tokenize(L.value);for(var tt=0;tt<D.length;tt++){var et=this.parseTermOrCURIEOrAbsURI(D[tt],S,f.terms,w,i);et&&this.addTriple(d,m,t.typeURI,{type:t.objectURI,value:et})}}if(v&&v!==f.parentObject&&(x={},k=!0),g){if(M&&V)for(var nt=0;nt<G.length;nt++){var it=x[G[nt]];it||(x[G[nt]]=it=[]),it.push({type:t.objectURI,value:g})}else if(M)for(var rt=0;rt<G.length;rt++)this.addTriple(d,v,G[rt],{type:t.objectURI,value:g});if(U)for(var ot=0;ot<Y.length;ot++)this.addTriple(d,g,Y[ot],{type:t.objectURI,value:v})}else{if(v&&!g&&(M||U)&&(g=this.newBlankNode()),M&&V)for(var st=0;st<G.length;st++){var at=x[G[st]];at||(x[P]=at=[]),y.push({predicate:G[st],list:at})}else if(M)for(var ut=0;ut<G.length;ut++)y.push({predicate:G[ut],forward:!0});if(U)for(var ct=0;ct<Y.length;ct++)y.push({predicate:Y[ct],forward:!1})}if(B){var lt=null,ht=null;J?(lt=""===J.value?t.PlainLiteralURI:this.parseTermOrCURIEOrAbsURI(J.value,S,f.terms,w,i),ht=$&&!H?$.value:lt===t.XMLLiteralURI||lt===t.HTMLLiteralURI?null:H?H.value:d.textContent):H?(lt=t.PlainLiteralURI,ht=H.value):$?(lt=t.deriveDateTimeType(ht=$.value))||(lt=t.PlainLiteralURI):M||U||(W&&(ht=this.parseSafeCURIEOrCURIEOrURI(W.value,w,i)),!ht&&q?ht=this.resolveAndNormalize(i,encodeURI(q.value)):!ht&&z&&(ht=this.resolveAndNormalize(i,encodeURI(z.value))),ht&&(lt=t.objectURI)),lt||(L&&!K?(lt=t.objectURI,ht=m):(ht=d.textContent,this.inHTMLMode&&"time"===d.localName&&(lt=t.deriveDateTimeType(ht)),lt||(lt=t.PlainLiteralURI))),D=this.tokenize(B.value);for(var dt=0;dt<D.length;dt++){var ft=this.parsePredicate(D[dt],S,f.terms,w,i);if(ft)if(V){var pt=x[ft];pt||(x[ft]=pt=[]),pt.push(lt===t.XMLLiteralURI||lt===t.HTMLLiteralURI?{type:lt,value:d.childNodes}:{type:lt||t.PlainLiteralURI,value:ht,language:E})}else this.addTriple(d,v,ft,lt===t.XMLLiteralURI||lt===t.HTMLLiteralURI?{type:lt,value:d.childNodes}:{type:lt||t.PlainLiteralURI,value:ht,language:E})}}if(v&&!p)for(var vt=0;vt<f.incomplete.length;vt++)f.incomplete[vt].list?f.incomplete[vt].list.push({type:t.objectURI,value:v}):f.incomplete[vt].forward?this.addTriple(d,f.subject,f.incomplete[vt].predicate,{type:t.objectURI,value:v}):this.addTriple(d,v,f.incomplete[vt].predicate,{type:t.objectURI,value:f.subject});var gt=null,mt=v;p?((gt=this.push(f,f.subject)).parentObject=o(d.parentNode.baseURI)===f.parentObject?o(d.baseURI):f.parentObject,gt.incomplete=f.incomplete,gt.language=E,gt.prefixes=w,gt.vocabulary=S):((gt=this.push(f,v)).parentObject=g||v||f.subject,gt.prefixes=w,gt.incomplete=y,g&&(mt=g,x={},k=!0),gt.listMapping=x,gt.language=E,gt.vocabulary=S),k&&r.unshift({parent:d,context:f,subject:mt,listMapping:x});for(var wt=d.lastChild;wt;wt=wt.previousSibling)wt.nodeType===pd.ELEMENT_NODE&&r.unshift({current:wt,context:gt})}}this.inHTMLMode&&this.copyProperties();for(var bt=0;bt<this.finishedHandlers.length;bt++)this.finishedHandlers[bt](e)}},{key:"push",value:function(t,e){return{parent:t,subject:e||(t?t.subject:null),parentObject:null,incomplete:[],listMapping:t?t.listMapping:{},language:t?t.language:this.language,prefixes:t?t.prefixes:this.target.graph.prefixes,terms:t?t.terms:this.target.graph.terms,vocabulary:t?t.vocabulary:this.vocabulary}}},{key:"resolveAndNormalize",value:function(t,e){return eh(e,t)}},{key:"setContext",value:function(t){"html"===t.localName&&"XHTML+RDFa 1.1"===t.getAttribute("version")?this.setXHTMLContext():"html"===t.localName||"http://www.w3.org/1999/xhtml"===t.namespaceURI?"undefined"!=typeof document&&document.doctype?"-//W3C//DTD XHTML+RDFa 1.0//EN"===document.doctype.publicId&&"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd"===document.doctype.systemId?(console.log("WARNING: RDF 1.0 is not supported. Defaulting to HTML5 mode."),this.setHTMLContext()):"-//W3C//DTD XHTML+RDFa 1.1//EN"===document.doctype.publicId&&"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd"===document.doctype.systemId?this.setXHTMLContext():this.setHTMLContext():this.setHTMLContext():this.setXMLContext()}},{key:"setHTMLContext",value:function(){this.setInitialContext(),this.langAttributes=[{namespaceURI:"http://www.w3.org/XML/1998/namespace",localName:"lang"},{namespaceURI:null,localName:"lang"}],this.inXHTMLMode=!1,this.inHTMLMode=!0}},{key:"setInitialContext",value:function(){this.vocabulary=null,this.langAttributes=[{namespaceURI:"http://www.w3.org/XML/1998/namespace",localName:"lang"}]}},{key:"setXHTMLContext",value:function(){this.setInitialContext(),this.inXHTMLMode=!0,this.inHTMLMode=!1,this.langAttributes=[{namespaceURI:"http://www.w3.org/XML/1998/namespace",localName:"lang"},{namespaceURI:null,localName:"lang"}],this.target.graph.terms.alternate="http://www.w3.org/1999/xhtml/vocab#alternate",this.target.graph.terms.appendix="http://www.w3.org/1999/xhtml/vocab#appendix",this.target.graph.terms.bookmark="http://www.w3.org/1999/xhtml/vocab#bookmark",this.target.graph.terms.cite="http://www.w3.org/1999/xhtml/vocab#cite",this.target.graph.terms.chapter="http://www.w3.org/1999/xhtml/vocab#chapter",this.target.graph.terms.contents="http://www.w3.org/1999/xhtml/vocab#contents",this.target.graph.terms.copyright="http://www.w3.org/1999/xhtml/vocab#copyright",this.target.graph.terms.first="http://www.w3.org/1999/xhtml/vocab#first",this.target.graph.terms.glossary="http://www.w3.org/1999/xhtml/vocab#glossary",this.target.graph.terms.help="http://www.w3.org/1999/xhtml/vocab#help",this.target.graph.terms.icon="http://www.w3.org/1999/xhtml/vocab#icon",this.target.graph.terms.index="http://www.w3.org/1999/xhtml/vocab#index",this.target.graph.terms.last="http://www.w3.org/1999/xhtml/vocab#last",this.target.graph.terms.license="http://www.w3.org/1999/xhtml/vocab#license",this.target.graph.terms.meta="http://www.w3.org/1999/xhtml/vocab#meta",this.target.graph.terms.next="http://www.w3.org/1999/xhtml/vocab#next",this.target.graph.terms.prev="http://www.w3.org/1999/xhtml/vocab#prev",this.target.graph.terms.previous="http://www.w3.org/1999/xhtml/vocab#previous",this.target.graph.terms.section="http://www.w3.org/1999/xhtml/vocab#section",this.target.graph.terms.stylesheet="http://www.w3.org/1999/xhtml/vocab#stylesheet",this.target.graph.terms.subsection="http://www.w3.org/1999/xhtml/vocab#subsection",this.target.graph.terms.start="http://www.w3.org/1999/xhtml/vocab#start",this.target.graph.terms.top="http://www.w3.org/1999/xhtml/vocab#top",this.target.graph.terms.up="http://www.w3.org/1999/xhtml/vocab#up",this.target.graph.terms.p3pv1="http://www.w3.org/1999/xhtml/vocab#p3pv1",this.target.graph.terms.related="http://www.w3.org/1999/xhtml/vocab#related",this.target.graph.terms.role="http://www.w3.org/1999/xhtml/vocab#role",this.target.graph.terms.transformation="http://www.w3.org/1999/xhtml/vocab#transformation"}},{key:"setXMLContext",value:function(){this.setInitialContext(),this.inXHTMLMode=!1,this.inHTMLMode=!1}},{key:"tokenize",value:function(t){return this.trim(t).split(/\s+/)}},{key:"toRDFNodeObject",value:function(e){var n=this;if(void 0!==e){if("string"==typeof e)return"_:"===e.substring(0,2)?(void 0===this.blankNodes[e.substring(2)]&&(this.blankNodes[e.substring(2)]=new tu(e.substring(2))),this.blankNodes[e.substring(2)]):ch.namedNode(e);switch(e.type){case t.objectURI:return"_:"===e.value.substring(0,2)?(void 0===this.blankNodes[e.value.substring(2)]&&(this.blankNodes[e.value.substring(2)]=new tu(e.value.substring(2))),this.blankNodes[e.value.substring(2)]):ch.namedNode(e.value);case t.PlainLiteralURI:return new vu(e.value,e.language||"");case t.XMLLiteralURI:case t.HTMLLiteralURI:var i="";return Object.keys(e.value).forEach((function(t){i+=mh(e.value[t],n.htmlOptions)})),new vu(i,"",new fu(e.type));default:return new vu(e.value,"",new fu(e.type))}}}},{key:"trim",value:function(t){return t.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}}],[{key:"parseRDFaDOM",value:function(e,n,i){var r=new t(n,{base:i});e.baseURI||(e.baseURI=i),r.process(e,{baseURI:i})}},{key:"tokenize",value:function(t){return this.trim(t).split(/\s+/)}},{key:"trim",value:function(t){return t.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}}]),t}();xd.XMLLiteralURI="http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral",xd.HTMLLiteralURI="http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML",xd.PlainLiteralURI="http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral",xd.objectURI="http://www.w3.org/1999/02/22-rdf-syntax-ns#object",xd.typeURI="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",xd.nameChar="[-A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�က0-F.0-9·̀-ͯ‿-⁀]",xd.nameStartChar="[A-Za-zÀ-ÖØ-öø-ÿĀ-ıĴ-ľŁ-ňŊ-žƀ-ǃǍ-ǰǴ-ǵǺ-ȗɐ-ʨʻ-ˁΆΈ-ΊΌΎ-ΡΣ-ώϐ-ϖϚϜϞϠϢ-ϳЁ-ЌЎ-яё-ќў-ҁҐ-ӄӇ-ӈӋ-ӌӐ-ӫӮ-ӵӸ-ӹԱ-Ֆՙա-ֆא-תװ-ײء-غف-يٱ-ڷں-ھۀ-ێې-ۓەۥ-ۦअ-हऽक़-ॡঅ-ঌএ-ঐও-নপ-রলশ-হড়-ঢ়য়-ৡৰ-ৱਅ-ਊਏ-ਐਓ-ਨਪ-ਰਲ-ਲ਼ਵ-ਸ਼ਸ-ਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઋઍએ-ઑઓ-નપ-રલ-ળવ-હઽૠଅ-ଌଏ-ଐଓ-ନପ-ରଲ-ଳଶ-ହଽଡ଼-ଢ଼ୟ-ୡஅ-ஊஎ-ஐஒ-கங-சஜஞ-டண-தந-பம-வஷ-ஹఅ-ఌఎ-ఐఒ-నప-ళవ-హౠ-ౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹೞೠ-ೡഅ-ഌഎ-ഐഒ-നപ-ഹൠ-ൡก-ฮะา-ำเ-ๅກ-ຂຄງ-ຈຊຍດ-ທນ-ຟມ-ຣລວສ-ຫອ-ຮະາ-ຳຽເ-ໄཀ-ཇཉ-ཀྵႠ-Ⴥა-ჶᄀᄂ-ᄃᄅ-ᄇᄉᄋ-ᄌᄎ-ᄒᄼᄾᅀᅌᅎᅐᅔ-ᅕᅙᅟ-ᅡᅣᅥᅧᅩᅭ-ᅮᅲ-ᅳᅵᆞᆨᆫᆮ-ᆯᆷ-ᆸᆺᆼ-ᇂᇫᇰᇹḀ-ẛẠ-ỹἀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼΩK-Å℮ↀ-ↂぁ-ゔァ-ヺㄅ-ㄬ가-힣一-龥〇〡-〩_]",xd.NCNAME=new RegExp("^"+xd.nameStartChar+xd.nameChar+"*$"),xd.dateTimeTypes=[{pattern:/-?P(?:[0-9]+Y)?(?:[0-9]+M)?(?:[0-9]+D)?(?:T(?:[0-9]+H)?(?:[0-9]+M)?(?:[0-9]+(?:\.[0-9]+)?S)?)?/,type:"http://www.w3.org/2001/XMLSchema#duration"},{pattern:/-?(?:[1-9][0-9][0-9][0-9]|0[1-9][0-9][0-9]|00[1-9][0-9]|000[1-9])-[0-9][0-9]-[0-9][0-9]T(?:[0-1][0-9]|2[0-4]):[0-5][0-9]:[0-5][0-9](?:\.[0-9]+)?(?:Z|[+\-][0-9][0-9]:[0-9][0-9])?/,type:"http://www.w3.org/2001/XMLSchema#dateTime"},{pattern:/-?(?:[1-9][0-9][0-9][0-9]|0[1-9][0-9][0-9]|00[1-9][0-9]|000[1-9])-[0-9][0-9]-[0-9][0-9](?:Z|[+\-][0-9][0-9]:[0-9][0-9])?/,type:"http://www.w3.org/2001/XMLSchema#date"},{pattern:/(?:[0-1][0-9]|2[0-4]):[0-5][0-9]:[0-5][0-9](?:\.[0-9]+)?(?:Z|[+\-][0-9][0-9]:[0-9][0-9])?/,type:"http://www.w3.org/2001/XMLSchema#time"},{pattern:/-?(?:[1-9][0-9][0-9][0-9]|0[1-9][0-9][0-9]|00[1-9][0-9]|000[1-9])-[0-9][0-9]/,type:"http://www.w3.org/2001/XMLSchema#gYearMonth"},{pattern:/-?[1-9][0-9][0-9][0-9]|0[1-9][0-9][0-9]|00[1-9][0-9]|000[1-9]/,type:"http://www.w3.org/2001/XMLSchema#gYear"}];var kd=xd.parseRDFaDOM,Ed=function(){function t(e){Ka(this,t),this.store=e,this.bnodes={},this.why=null,this.reify=!1}return Ha(t,[{key:"frameFactory",value:function(e,n,i){return{NODE:1,ARC:2,parent:n,parser:e,store:e.store,element:i,lastChild:0,base:null,lang:null,node:null,nodeType:null,listIndex:1,rdfid:null,datatype:null,collection:!1,terminateFrame:function(){this.collection&&this.node.close()},addSymbol:function(t,e){e=eh(e,this.base),this.node=this.store.sym(e),this.nodeType=t},loadTriple:function(){if(this.parent.parent.collection?this.parent.parent.node.append(this.node):this.store.add(this.parent.parent.node,this.parent.node,this.node,this.parser.why),null!=this.parent.rdfid){var e=this.store.sym(eh("#"+this.parent.rdfid,this.base));this.store.add(e,this.store.sym(t.ns.RDF+"type"),this.store.sym(t.ns.RDF+"Statement"),this.parser.why),this.store.add(e,this.store.sym(t.ns.RDF+"subject"),this.parent.parent.node,this.parser.why),this.store.add(e,this.store.sym(t.ns.RDF+"predicate"),this.parent.node,this.parser.why),this.store.add(e,this.store.sym(t.ns.RDF+"object"),this.node,this.parser.why)}},isTripleToLoad:function(){return null!=this.parent&&null!=this.parent.parent&&this.nodeType===this.NODE&&this.parent.nodeType===this.ARC&&this.parent.parent.nodeType===this.NODE},addNode:function(t){this.addSymbol(this.NODE,t),this.isTripleToLoad()&&this.loadTriple()},addCollection:function(){this.nodeType=this.NODE,this.node=this.store.collection(),this.collection=!0,this.isTripleToLoad()&&this.loadTriple()},addCollectionArc:function(){this.nodeType=this.ARC},addBNode:function(t){this.node=null!=t?null!=this.parser.bnodes[t]?this.parser.bnodes[t]:this.parser.bnodes[t]=this.store.bnode():this.store.bnode(),this.nodeType=this.NODE,this.isTripleToLoad()&&this.loadTriple()},addArc:function(e){e===t.ns.RDF+"li"&&(e=t.ns.RDF+"_"+this.parent.listIndex,this.parent.listIndex++),this.addSymbol(this.ARC,e)},addLiteral:function(e){this.node=this.store.literal(e,this.parent.datatype&&this.parent.datatype!==t.ns.RDF+"langString"?this.store.sym(this.parent.datatype):this.lang),this.nodeType=this.NODE,this.isTripleToLoad()&&this.loadTriple()}}}},{key:"getAttributeNodeNS",value:function(t,e,n){var i=null;if(t.getAttributeNodeNS)i=t.getAttributeNodeNS(e,n);else for(var r,o=t.attributes,s=0;s<o.length;++s)if((r=o[s]).namespaceURI===e&&(r.prefix?r.prefix+":"+n:n)===r.nodeName){i=r;break}return i}},{key:"parse",value:function(e,n,i){var r,o=e.childNodes;if(this.cleanParser(),e.nodeType===t.nodeType.DOCUMENT){for(var s=0;s<o.length;s++)if(o[s].nodeType===t.nodeType.ELEMENT){r=o[s];break}}else{if(e.nodeType!==t.nodeType.ELEMENT)throw new Error("RDFParser: can't find root in "+n+". Halting. ");r=e}this.why=i;var a=this.frameFactory(this);return this.base=n,a.base=n,a.lang=null,this.parseDOM(this.buildFrame(a,r)),!0}},{key:"parseDOM",value:function(e){for(var n,i=function(t){var e="";if(null==t.namespaceURI)throw new Error("RDF/XML syntax error: No namespace for "+t.localName+" in "+this.base);return t.namespaceURI&&(e+=t.namespaceURI),t.localName?e+=t.localName:t.nodeName&&(t.nodeName.indexOf(":")>=0?e+=t.nodeName.split(":")[1]:e+=t.nodeName),e}.bind(this),r=!0;e.parent;){var o=e.element,s=o.attributes;if(o.nodeType===t.nodeType.TEXT||o.nodeType===t.nodeType.CDATA_SECTION)e.parent.nodeType===e.NODE&&(e.addArc(t.ns.RDF+"value"),e=this.buildFrame(e)),e.addLiteral(o.nodeValue);else if(i(o)!==t.ns.RDF+"RDF")if(e.parent&&e.parent.collection&&(e.addCollectionArc(),(e=this.buildFrame(e,e.element)).parent.element=null),e.parent&&e.parent.nodeType&&e.parent.nodeType!==e.ARC){e.addArc(i(o)),this.reify&&(n=this.getAttributeNodeNS(o,t.ns.RDF,"ID"))&&(e.rdfid=n.nodeValue,o.removeAttributeNode(n));var a=this.getAttributeNodeNS(o,t.ns.RDF,"parseType"),u=this.getAttributeNodeNS(o,t.ns.RDF,"datatype");if(u&&(e.datatype=u.nodeValue,o.removeAttributeNode(u)),a){var c=a.nodeValue;"Literal"===c?(e.datatype=t.ns.RDF+"XMLLiteral",(e=this.buildFrame(e)).addLiteral(o.childNodes),r=!1):"Resource"===c?((e=this.buildFrame(e,e.element)).parent.element=null,e.addBNode()):"Collection"===c&&((e=this.buildFrame(e,e.element)).parent.element=null,e.addCollection()),o.removeAttributeNode(a)}if(0!==s.length){var l=this.getAttributeNodeNS(o,t.ns.RDF,"resource"),h=this.getAttributeNodeNS(o,t.ns.RDF,"nodeID");e=this.buildFrame(e),l?(e.addNode(l.nodeValue),o.removeAttributeNode(l)):h?(e.addBNode(h.nodeValue),o.removeAttributeNode(h)):e.addBNode();for(var d=s.length-1;d>=0;d--){var f=this.buildFrame(e);f.addArc(i(s[d])),i(s[d])===t.ns.RDF+"type"?this.buildFrame(f).addNode(s[d].nodeValue):this.buildFrame(f).addLiteral(s[d].nodeValue)}}else 0===o.childNodes.length&&this.buildFrame(e).addLiteral("")}else{var p=this.getAttributeNodeNS(o,t.ns.RDF,"about");if(n=this.getAttributeNodeNS(o,t.ns.RDF,"ID"),p&&n)throw new Error("RDFParser: "+o.nodeName+" has both rdf:id and rdf:about. Halting. Only one of these properties may be specified on a node.");if(!p&&n)e.addNode("#"+n.nodeValue),o.removeAttributeNode(n);else if(null==p&&null==n){var v=this.getAttributeNodeNS(o,t.ns.RDF,"nodeID");v?(e.addBNode(v.nodeValue),o.removeAttributeNode(v)):e.addBNode()}else e.addNode(p.nodeValue),o.removeAttributeNode(p);var g=this.getAttributeNodeNS(o,t.ns.RDF,"type");t.ns.RDF+"Description"!==i(o)&&(g={nodeValue:i(o)}),null!=g&&(this.store.add(e.node,this.store.sym(t.ns.RDF+"type"),this.store.sym(eh(g.nodeValue,e.base)),this.why),g.nodeName&&o.removeAttributeNode(g));for(var m=s.length-1;m>=0;m--)this.store.add(e.node,this.store.sym(i(s[m])),this.store.literal(s[m].nodeValue,e.lang),this.why)}for(o=e.element;e.parent;){for(var w=e;null==o;)o=(e=e.parent).element;var b=o.childNodes&&o.childNodes[e.lastChild];if(b&&r){if((b.nodeType===t.nodeType.ELEMENT||b.nodeType===t.nodeType.TEXT||b.nodeType===t.nodeType.CDATA_SECTION)&&(b.nodeType!==t.nodeType.TEXT&&b.nodeType!==t.nodeType.CDATA_SECTION||1===o.childNodes.length)){e.lastChild++,e=this.buildFrame(w,o.childNodes[e.lastChild-1]);break}e.lastChild++}else{if(e.terminateFrame(),!(e=e.parent))break;o=e.element,r=!0}}}}},{key:"cleanParser",value:function(){this.bnodes={},this.why=null}},{key:"buildFrame",value:function(e,n){var i=this.frameFactory(this,e,n);if(e&&(i.base=e.base,i.lang=e.lang),!n||n.nodeType===t.nodeType.TEXT||n.nodeType===t.nodeType.CDATA_SECTION)return i;var r=n.attributes,o=n.getAttributeNode("xml:base");null!=o&&(i.base=o.nodeValue,n.removeAttribute("xml:base"));var s=n.getAttributeNode("xml:lang");null!=s&&(i.lang=s.nodeValue,n.removeAttribute("xml:lang"));for(var a=r.length-1;a>=0;a--)if("xml"===r[a].nodeName.substr(0,3)){if("xmlns:"===r[a].name.slice(0,6)){var u=r[a].nodeValue;this.base&&(u=eh(u,this.base)),this.store.setPrefixForURI(r[a].name.slice(6),u)}n.removeAttributeNode(r[a])}return i}}]),t}();function Sd(t,e,n){var i,r,o,s=["INSERT","DELETE","WHERE"],a=ph("http://www.w3.org/ns/pim/patch#"),u=cd(e,e,n,n,null,null,"",null),c={},l=function(t,e,n,i,r){return"Line "+(e+1)+" of <"+t+">: Bad syntax:\n "+r+'\n at: "'+n.slice(i,i+30)+'"'};i=0;var h=e.sym(n+"#query");for(c.query=h;;){if((r=u.skipSpace(t,i))<0)return c;if(";"===t[r]){if((i=u.skipSpace(t,r+1))<0)return c;r=i}var d=!1;for(o=0;o<s.length;o++){var f=s[o];if(t.slice(r,r+f.length)===f){if((i=u.skipSpace(t,r+f.length))<0)throw l(u._thisDoc,u.lines,t,r+f.length,"found EOF, needed {...} after "+f);if(("INSERT"===f||"DELETE"===f)&&"DATA"===t.slice(i,i+4)){if((r=u.skipSpace(t,i+4))<0)throw l(u._thisDoc,u.lines,t,i+4,"needed {...} after INSERT DATA "+f);i=r}var p=[];if((r=u.node(t,i,p))<0)throw l(u._thisDoc,u.lines,t,i,"bad syntax or EOF in {...} after "+f);c[f.toLowerCase()]=p[0],e.add(h,a(f.toLowerCase()),p[0]),d=!0,i=r}}if(!d&&"@prefix"===t.slice(r,r+7)){if((i=u.directive(t,r))<0)throw l(u._thisDoc,u.lines,t,i,"bad syntax or EOF after @prefix ");i=u.checkDot(t,i),d=!0}if(!d)throw l(u._thisDoc,u.lines,t,r,"Unknown syntax at start of statememt: '"+t.slice(r).slice(0,20)+"'")}}function Fd(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"text/turtle",r=arguments.length>4?arguments[4]:void 0;i=(i=i||"text/turtle").split(";")[0];try{if("text/n3"===i||"text/turtle"===i){var o=cd(e,e,n,n,null,null,"",null);o.loadBuf(t),u()}else if("application/rdf+xml"===i){var s=new Ed(e);s.parse(yh(t),n,e.sym(n)),u()}else if("application/xhtml+xml"===i)kd(yh(t,{contentType:"application/xhtml+xml"}),e,n),u();else if("text/html"===i)kd(yh(t,{contentType:"text/html"}),e,n),u();else if("application/sparql-update"===i||"application/sparql-update-single-match"===i)Sd(t,e,n),u();else if("application/ld+json"===i)wd(t,e,n,u);else{if("application/n-quads"!==i&&"application/nquads"!==i)throw void 0===i?new Error("contentType is undefined"):new Error("Don't know how to parse "+i+" yet");var a=new Tl({factory:vd});l(null,t)}}catch(t){c(t)}function u(){r&&r(null,e)}function c(t){if("application/ld+json"!==i||"application/n-quads"!==i||"application/nquads"!==i){if(!r){var o=new Error(t+" while trying to parse <"+n+"> as "+i);throw o.cause=t,o}r(t,e)}}function l(t,n){t&&r(t,e);try{a.parse(n,h)}catch(t){r(t,e)}}function h(t,n){n?e.add(n.subject,n.predicate,n.object,n.graph):r(t,e)}Fd.handled={"text/n3":!0,"text/turtle":!0,"application/rdf+xml":!0,"application/xhtml+xml":!0,"text/html":!0,"application/sparql-update":!0,"application/sparql-update-single-match":!0,"application/ld+json":!0,"application/nquads":!0,"application/n-quads":!0}}Ya(Ed,"ns",{RDF:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",RDFS:"http://www.w3.org/2000/01/rdf-schema#"}),Ya(Ed,"nodeType",{ELEMENT:1,ATTRIBUTE:2,TEXT:3,CDATA_SECTION:4,ENTITY_REFERENCE:5,ENTITY:6,PROCESSING_INSTRUCTION:7,COMMENT:8,DOCUMENT:9,DOCUMENT_TYPE:10,DOCUMENT_FRAGMENT:11,NOTATION:12});var Ad=Kt(Yt());function _d(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=Xa(t);if(e){var r=Xa(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return Ga(this,n)}}var jd={"text/n3":!0,"text/turtle":!0,"application/rdf+xml":!0,"application/xhtml+xml":!0,"text/html":!0,"application/ld+json":!0},Cd={rdf:"application/rdf+xml",owl:"application/rdf+xml",n3:"text/n3",ttl:"text/turtle",nt:"text/n3",acl:"text/n3",html:"text/html",xml:"text/xml"},Rd=function(t){return{link:ph("http://www.w3.org/2007/ont/link#",t),http:ph("http://www.w3.org/2007/ont/http#",t),httph:ph("http://www.w3.org/2007/ont/httph#",t),rdf:ph("http://www.w3.org/1999/02/22-rdf-syntax-ns#",t),rdfs:ph("http://www.w3.org/2000/01/rdf-schema#",t),dc:ph("http://purl.org/dc/elements/1.1/",t),ldp:ph("http://www.w3.org/ns/ldp#",t)}},Id=Rd(),Td=Ha((function t(e,n){Ka(this,t),Ya(this,"response",void 0),Ya(this,"dom",void 0),this.response=e,this.dom=n}));Ya(Td,"pattern",void 0);var Od=function(){qa(e,Td);var t=_d(e);function e(){return Ka(this,e),t.apply(this,arguments)}return Ha(e,[{key:"parse",value:function(t,e,n){var i=t.store;if(this.dom||(this.dom=yh(e)),"parsererror"===this.dom.documentElement.nodeName)return t.failFetch(n,"Badly formed XML in "+n.resource.value,"parse_error");var r=new Ed(i);try{r.parse(this.dom,n.original.value,n.original)}catch(e){return t.failFetch(n,"Syntax error parsing RDF/XML! "+e,"parse_error")}return n.noMeta||i.add(n.original,Id.rdf("type"),Id.link("RDFDocument"),t.appNode),t.doneFetch(n,this.response)}}],[{key:"toString",value:function(){return"RDFXMLHandler"}},{key:"register",value:function(t){t.mediatypes["application/rdf+xml"]={q:.9}}}]),e}();Od.pattern=new RegExp("application/rdf\\+xml");var Nd=function(){qa(e,Td);var t=_d(e);function e(){return Ka(this,e),t.apply(this,arguments)}return Ha(e,[{key:"parse",value:function(t,e,n){var i,r;this.dom||(this.dom=yh(e));var o=t.store,s=this.dom.getElementsByTagName("title");s.length>0&&o.add(n.resource,Id.dc("title"),o.rdfFactory.literal(s[0].textContent),n.resource);for(var a=this.dom.getElementsByTagName("link"),u=a.length-1;u>=0;u--)r=!1,(i=a[u].getAttribute("rel"))||(i=a[u].getAttribute("rev"),r=!0),i&&t.linkData(n.original,i,a[u].getAttribute("href"),n.resource,r);for(var c=this.dom.getElementsByTagName("script"),l=0;l<c.length;l++){var h=c[l].getAttribute("type");jd[h]&&(Fd(c[l].textContent,o,n.original.value,h),Fd(c[l].textContent,o,n.original.value,h))}if(n.noMeta||o.add(n.resource,Id.rdf("type"),Id.link("WebPage"),t.appNode),!n.noRDFa&&kd)try{kd(this.dom,o,n.original.value)}catch(e){return t.failFetch(n,"Error trying to parse "+n.resource+" as RDFa:\n"+e+":\n"+e.stack,"parse_error")}return t.doneFetch(n,this.response)}}],[{key:"toString",value:function(){return"XHTMLHandler"}},{key:"register",value:function(t){t.mediatypes["application/xhtml+xml"]={}}}]),e}();Nd.pattern=new RegExp("application/xhtml");var Pd=function(){qa(e,Td);var t=_d(e);function e(){return Ka(this,e),t.apply(this,arguments)}return Ha(e,[{key:"parse",value:function(t,n,i){for(var r=yh(n),o=0;o<r.childNodes.length;o++){var s=r.childNodes[o];if(e.isElement(s)){var a=s.namespaceURI;if(a&&a===a.rdf)return t.addStatus(i.req,"Has XML root element in the RDF namespace, so assume RDF/XML."),new Od(this.response,r).parse(t,n,i);break}}if(r.doctype&&"html"===r.doctype.name&&r.doctype.publicId.match(/^-\/\/W3C\/\/DTD XHTML/)&&r.doctype.systemId.match(/http:\/\/www.w3.org\/TR\/xhtml/))return t.addStatus(i.req,"Has XHTML DOCTYPE. Switching to XHTML Handler.\n"),new Nd(this.response,r).parse(t,n,i);var u=r.getElementsByTagName("html")[0];if(u){var c=u.getAttribute("xmlns");if(c&&c.match(/^http:\/\/www.w3.org\/1999\/xhtml/))return t.addStatus(i.req,"Has a default namespace for XHTML. Switching to XHTMLHandler.\n"),new Nd(this.response,r).parse(t,n,i)}return t.failFetch(i,"Unsupported dialect of XML: not RDF or XHTML namespace, etc.\n"+n.slice(0,80),901)}}],[{key:"toString",value:function(){return"XMLHandler"}},{key:"register",value:function(t){t.mediatypes["text/xml"]={q:.5},t.mediatypes["application/xml"]={q:.5}}},{key:"isElement",value:function(t){return t.nodeType===Node.ELEMENT_NODE}}]),e}();Pd.pattern=new RegExp("(text|application)/(.*)xml");var Dd=function(){qa(e,Td);var t=_d(e);function e(){return Ka(this,e),t.apply(this,arguments)}return Ha(e,[{key:"parse",value:function(t,e,n){var i=t.store;if(Jd(e))return t.addStatus(n.req,"Has an XML declaration. We'll assume it's XHTML as the content-type was text/html.\n"),new Nd(this.response).parse(t,e,n);if(function(t){var e=t.indexOf("<!DOCTYPE html"),n=t.indexOf(">");return!(-1===e||-1===n||e>n)&&-1!==t.substr(e,n-e).indexOf("XHTML")}(e))return t.addStatus(n.req,"Has XHTML DOCTYPE. Switching to XHTMLHandler.\n"),new Nd(this.response).parse(t,e,n);if(function(t){return!!t.match(/[^(<html)]*<html\s+[^<]*xmlns=['"]http:\/\/www.w3.org\/1999\/xhtml["'][^<]*>/)}(e))return t.addStatus(n.req,"Has default namespace for XHTML, so switching to XHTMLHandler.\n"),new Nd(this.response).parse(t,e,n);var r=new RegExp("<title>([\\s\\S]+?)</title>","im").exec(e);return r&&i.add(n.resource,Id.dc("title"),i.rdfFactory.literal(r[1]),n.resource),i.add(n.resource,Id.rdf("type"),Id.link("WebPage"),t.appNode),t.addStatus(n.req,"non-XML HTML document, not parsed for data."),t.doneFetch(n,this.response)}}],[{key:"toString",value:function(){return"HTMLHandler"}},{key:"register",value:function(t){t.mediatypes["text/html"]={q:.9}}}]),e}();Dd.pattern=new RegExp("text/html");var Md=function(){qa(e,Td);var t=_d(e);function e(){return Ka(this,e),t.apply(this,arguments)}return Ha(e,[{key:"parse",value:function(t,e,n,i){var r=t.store;return new Promise((function(o){try{wd(e,r,n.original.value,(function(){o(t.doneFetch(n,i))}))}catch(e){o(t.failFetch(n,"Error trying to parse "+n.resource+" as JSON-LD:\n"+e,"parse_error",i))}}))}}],[{key:"toString",value:function(){return"JsonLdHandler"}},{key:"register",value:function(t){t.mediatypes["application/ld+json"]={q:.9}}}]),e}();Md.pattern=/application\/ld\+json/;var Ud=function(){qa(e,Td);var t=_d(e);function e(){return Ka(this,e),t.apply(this,arguments)}return Ha(e,[{key:"parse",value:function(t,e,n){return Jd(e)?(t.addStatus(n.req,"Warning: "+n.resource+" has an XML declaration. We'll assume it's XML but its content-type wasn't XML.\n"),new Pd(this.response).parse(t,e,n)):e.slice(0,500).match(/xmlns:/)?(t.addStatus(n.req,"May have an XML namespace. We'll assume it's XML but its content-type wasn't XML.\n"),new Pd(this.response).parse(t,e,n)):(t.addStatus(n.req,"Plain text document, no known RDF semantics."),t.doneFetch(n,this.response))}}],[{key:"toString",value:function(){return"TextHandler"}},{key:"register",value:function(t){t.mediatypes["text/plain"]={q:.5}}}]),e}();Ud.pattern=new RegExp("text/plain");var Ld=function(){qa(e,Td);var t=_d(e);function e(){return Ka(this,e),t.apply(this,arguments)}return Ha(e,[{key:"parse",value:function(t,e,n,i){var r=t.store,o=cd(r,r,n.original.value,n.original.value,null,null,"",null);try{o.loadBuf(e)}catch(e){return t.failFetch(n,"Error trying to parse "+n.resource+" as Notation3:\n"+e,"parse_error",i)}return t.addStatus(n.req,"N3 parsed: "+o.statementCount+" triples in "+o.lines+" lines."),t.store.add(n.original,Id.rdf("type"),Id.link("RDFDocument"),t.appNode),t.doneFetch(n,this.response)}}],[{key:"toString",value:function(){return"N3Handler"}},{key:"register",value:function(t){t.mediatypes["text/n3"]={q:"1.0"},t.mediatypes["text/turtle"]={q:1}}}]),e}();Ld.pattern=new RegExp("(application|text)/(x-)?(rdf\\+)?(n3|turtle)");var Bd={RDFXMLHandler:Od,XHTMLHandler:Nd,XMLHandler:Pd,HTMLHandler:Dd,TextHandler:Ud,N3Handler:Ld,JsonLdHandler:Md};function Jd(t){return!!t.match(/\s*<\?xml\s+version\s*=[^<>]+\?>/)}var $d=function(){function t(e){var n=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(Ka(this,t),Ya(this,"store",void 0),Ya(this,"timeout",void 0),Ya(this,"_fetch",void 0),Ya(this,"mediatypes",void 0),Ya(this,"appNode",void 0),Ya(this,"requested",void 0),Ya(this,"timeouts",void 0),Ya(this,"redirectedTo",void 0),Ya(this,"fetchQueue",void 0),Ya(this,"fetchCallbacks",void 0),Ya(this,"nonexistent",void 0),Ya(this,"lookedUp",void 0),Ya(this,"handlers",void 0),Ya(this,"ns",void 0),Ya(this,"fireCallbacks",void 0),this.store=e||new zh,this.ns=Rd(this.store.rdfFactory),this.timeout=i.timeout||3e4,this._fetch=i.fetch||"undefined"!=typeof global&&(global.solidFetcher||global.solidFetch)||"undefined"!=typeof window&&(window.solidFetcher||window.solidFetch)||Ad.default,!this._fetch)throw new Error("No _fetch function available for Fetcher");this.appNode=this.store.rdfFactory.blankNode(),this.store.fetcher=this,this.requested={},this.timeouts={},this.redirectedTo={},this.fetchQueue={},this.fetchCallbacks={},this.nonexistent={},this.lookedUp={},this.handlers=[],this.mediatypes={"image/*":{q:.9},"*/*":{q:.1}},gh(this,["request","fail","refresh","retract","done"]),Object.keys(i.handlers||Bd).map((function(t){return n.addHandler(Bd[t])}))}var e,n;return Ha(t,[{key:"load",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(n=Object.assign({},n),t instanceof Array)return Promise.all(t.map((function(t){return e.load(t,Object.assign({},n))})));var i=t,r=eu(i);r=r.split("#")[0],n=this.initFetchOptions(r,n);var o=this.initFetchOptions(r,n);return this.pendingFetchPromise(r,o.baseURI,o)}},{key:"pendingFetchPromise",value:function(t,e,n){var i,r=this;return!n.force&&this.fetchQueue[e]?i=this.fetchQueue[e]:(i=Promise.race([this.setRequestTimeout(t,n),this.fetchUri(t,n)]),this.fetchQueue[e]=i,this.cleanupFetchRequest(e,void 0,this.timeout)),i.then((function(e){return t in r.timeouts&&(r.timeouts[t].forEach(clearTimeout),delete r.timeouts[t]),e}))}},{key:"cleanupFetchRequest",value:function(t,e,n){var i=this;void 0!==e&&console.warn("_options is deprecated"),this.timeouts[t]=(this.timeouts[t]||[]).concat(setTimeout((function(){i.isPending(t)||delete i.fetchQueue[t]}),n))}},{key:"initFetchOptions",value:function(e,n){var i=this.store;!n.method||"GET"===n.method.toUpperCase()||(n.force=!0),n.resource=i.rdfFactory.namedNode(e),n.baseURI=n.baseURI||e,n.original=i.rdfFactory.namedNode(n.baseURI),n.req=i.bnode(),n.headers=n.headers||new Ad.Headers,n.contentType&&(n.headers["content-type"]=n.contentType),n.force&&(n.cache="no-cache");var r=this.acceptString();n.headers.accept=r;var o=t.offlineOverride(e);n.requestedURI=o,t.setCredentials(o,n);var s=t.proxyIfNecessary(o);return o!==s&&(n.proxyUsed=!0),n.actualProxyURI=s,n}},{key:"fetchUri",value:function(e,n){var i=this;if(!e)return Promise.reject(new Error("Cannot fetch an empty uri"));if(t.unsupportedProtocol(e))return this.failFetch(n,"fetcher: Unsupported protocol","unsupported_protocol");var r=this.getState(e);if(n.force)delete this.nonexistent[e];else{if("fetched"===r)return Promise.resolve(this.doneFetch(n,{status:200,ok:!0,statusText:"Already loaded into quadstore."}));if("failed"===r&&404===this.requested[e]){var o="Previously failed: "+this.requested[e],s={url:e,status:this.requested[e],statusText:o,responseText:o,headers:new Ad.Headers,ok:!1,body:null,bodyUsed:!1,size:0,timeout:0};return this.failFetch(n,o,this.requested[e],s)}}this.fireCallbacks("request",[e]),this.requested[e]=!0,n.noMeta||this.saveRequestMetadata(e,n);var a=n.actualProxyURI;return this._fetch(a,n).then((function(t){return i.handleResponse(t,e,n)}),(function(t){var r={url:a,status:999,statusText:(t.name||"network failure")+": "+(t.errno||t.code||t.type),responseText:t.message,headers:new Ad.Headers,ok:!1,body:null,bodyUsed:!1,size:0,timeout:0};return console.log("Fetcher: <"+a+"> Non-HTTP fetch exception: "+t),i.handleError(r,e,n)}))}},{key:"nowOrWhenFetched",value:function(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=eu(t);"function"==typeof e?n=e:void 0===e||(cu(e)?i.referringTerm=e:i=e),this.load(r,i).then((function(t){if(n)if(t)if(t.ok)n(!0,"OK",t);else{var e="HTTP error: Status "+t.status+" ("+t.statusText+")";t.responseText&&(e+=" "+t.responseText),console.log(e+" fetching "+r),n(!1,e,t)}else{var i="@@ nowOrWhenFetched: no response object!";console.log(i),n(!1,i)}}),(function(t){var e=t.message||t.statusText;e="Failed to load <"+r+"> "+e,console.log(e),t.response&&t.response.status&&(e+=" status: "+t.response.status),n(!1,e,t.response)}))}},{key:"addStatus",value:function(t,e){var n=new Date;e="["+n.getHours()+":"+n.getMinutes()+":"+n.getSeconds()+"."+n.getMilliseconds()+"] "+e;var i=this.store,r=i.the(t,this.ns.link("status"));ru(r)?r.append(i.rdfFactory.literal(e)):hh("web.js: No list to add to: "+r+","+e)}},{key:"failFetch",value:function(t,e,n,i){this.addStatus(t.req,e),t.noMeta||this.store.add(t.original,this.ns.link("error"),this.store.rdfFactory.literal(e));var r=(t.method||"GET").toUpperCase();("GET"===r||"HEAD"===r)&&(t.resource.equals(t.original),this.requested[Zl(t.original.value)]=n,this.fireCallbacks("fail",[t.original.value,e]));var o=new Error("Fetcher: "+e);return o.status=n,o.statusText=e,o.response=i,Promise.reject(o)}},{key:"linkData",value:function(t,e,n,i,r){if(n){var o,s=this.store,a=s.rdfFactory.namedNode(eh(n,t.value));if("alternate"===e||"seeAlso"===e||"meta"===e||"describedby"===e){if(a.value===t.value)return;o=this.ns.rdfs("seeAlso")}else o=s.rdfFactory.namedNode("type"===e?"http://www.w3.org/1999/02/22-rdf-syntax-ns#type":eh(encodeURIComponent(e),"http://www.iana.org/assignments/link-relations/"));r?s.add(a,o,t,i):s.add(t,o,a,i)}}},{key:"parseLinkHeader",value:function(t,e,n){if(t){var i=/[^\(\)<>@,;:"\/\[\]\?={} \t]+=(([^\(\)<>@,;:"\/\[\]\?={} \t]+)|("[^"]*"))/g,r=t.match(/<[^>]*>\s*(\s*;\s*[^()<>@,;:"/[\]?={} \t]+=(([^\(\)<>@,;:"\/\[\]\?={} \t]+)|("[^"]*")))*(,|$)/g);if(null!=r)for(var o=0;o<r.length;o++){var s=r[o].split(">"),a=s[0].substring(1),u=s[1].match(i);if(null==u)return;for(var c=0;c<u.length;c++){var l=u[c].split("=")[1].replace(/["']/g,"");this.linkData(e,l,a,n)}}}}},{key:"doneFetch",value:function(t,e){return this.addStatus(t.req,"Done."),this.requested[t.original.value]="done",this.fireCallbacks("done",[t.original.value]),e.req=t.req,e}},{key:"nowKnownAs",value:function(t,e){this.lookedUp[t.value]?this.lookedUp[e.value]||this.lookUpThing(e,t):this.lookedUp[e.value]&&(this.lookedUp[t.value]||this.lookUpThing(t,e))}},{key:"putBack",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=eu(t),r=new fu(i).doc();return n.contentType=n["content-type"]||n["Content-Type"]||n.contentType||"text/turtle","application/ld+json"===n.contentType?new Promise((function(i,o){Fh(r,e.store,r.uri,n.contentType,(function(r,s){r?o(r):(n.data=s,e.webOperation("PUT",t,n).then((function(t){return i(t)})).catch((function(t){return o(t)})))}))})):(n.data=Fh(r,this.store,r.value,n.contentType),this.webOperation("PUT",i,n))}},{key:"webCopy",value:function(t,e,n){var i=this;return this.webOperation("GET",t).then((function(t){return i.webOperation("PUT",e,{data:t.responseText,contentType:n})}))}},{key:"delete",value:function(t,e){var n=this;return this.webOperation("DELETE",t,e).then((function(e){return n.requested[t]=404,n.nonexistent[t]=!0,n.unload(n.store.rdfFactory.namedNode(t)),e}))}},{key:"createIfNotExists",value:(e=zl.default.mark((function t(e){var n,i,r,o,s=arguments;return zl.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:"text/turtle",i=s.length>2&&void 0!==s[2]?s[2]:"",r=this,t.prev=3,t.next=6,r.load(e);case 6:o=t.sent,t.next=29;break;case 9:if(t.prev=9,t.t0=t.catch(3),404!==t.t0.response.status){t.next=27;break}return console.log("createIfNotExists: doc does NOT exist, will create... "+e),t.prev=13,t.next=16,r.webOperation("PUT",e.value,{data:i,contentType:n});case 16:o=t.sent,t.next=23;break;case 19:throw t.prev=19,t.t1=t.catch(13),console.log("createIfNotExists doc FAILED: "+e+": "+t.t1),t.t1;case 23:return delete r.requested[e.value],t.abrupt("return",o);case 27:throw console.log("createIfNotExists doc load error NOT 404: "+e+": "+t.t0),t.t0;case 29:return t.abrupt("return",o);case 30:case"end":return t.stop()}}),t,this,[[3,9],[13,19]])})),n=function(){var t=this,n=arguments;return new Promise((function(i,r){var o=e.apply(t,n);function s(t){Kl(o,i,r,s,a,"next",t)}function a(t){Kl(o,i,r,s,a,"throw",t)}s(void 0)}))},function(t){return n.apply(this,arguments)})},{key:"createContainer",value:function(t,e,n){var i={"content-type":"text/turtle",link:this.ns.ldp("BasicContainer")+'; rel="type"'};e&&(i.slug=e);var r={headers:i};return n&&(r.body=n),this.webOperation("POST",t,r)}},{key:"invalidateCache",value:function(t){var e=eu(t),n=this;if(n.fetchQueue&&n.fetchQueue[e]&&(console.log("Internal error - fetchQueue exists "+e),"resolved"===n.fetchQueue[e].PromiseStatus?delete n.fetchQueue[e]:(delete n.fetchQueue[e],console.log("*** Fetcher: pending fetchQueue deleted "+e))),n.requested[e]&&"done"!==n.requested[e]&&"failed"!==n.requested[e]&&404!==n.requested[e]){var i="Rdflib: fetcher: Destructive operation on <".concat(n.requested[e],"> file being fetched! ")+e;console.error(i)}else delete n.requested[e],delete n.nonexistent[e]}},{key:"webOperation",value:function(e,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=eu(n);i.method=e,i.body=i.data||i.body,i.force=!0;var o=this;if(i.body&&!i.contentType)throw new Error("Web operation sending data must have a defined contentType.");return i.contentType&&(i.headers=i.headers||{},i.headers["content-type"]=i.contentType),t.setCredentials(r,i),new Promise((function(t,n){o._fetch(r,i).then((function(i){if(i.ok)"PUT"!==e&&"PATCH"!==e&&"POST"!==e&&"DELETE"!==e||o.invalidateCache(r),i.text?i.text().then((function(e){i.responseText=e,t(i)})):t(i);else{var s="Web error: "+i.status;i.statusText&&(s+=" ("+i.statusText+")"),s+=" on "+e+" of <"+r+">",i.responseText&&(s+=": "+i.responseText);var a=new Error(s);a.response=i,n(a)}}),(function(t){n(new Error("Fetch error for "+e+" of <"+r+">:"+t))}))}))}},{key:"lookUpThing",value:function(t,e){var n=this,i=this.store.uris(t);return(i=i.map((function(t){return Zl(t)}))).forEach((function(t){n.lookedUp[t]=!0})),this.load(i,{referringTerm:e})}},{key:"getHeader",value:function(t,e){for(var n=this.store,i=t.value,r=n.each(void 0,this.ns.link("requestedURI"),n.rdfFactory.literal(i)),o=0;o<r.length;o++){var s=r[o];if(void 0!==s){var a=n.any(s,this.ns.link("response"));if(void 0!==a&&n.anyValue(a,this.ns.http("status"))&&n.anyValue(a,this.ns.http("status")).startsWith("2")){var u=n.each(a,this.ns.httph(e.toLowerCase()));return u.length?u.map((function(t){return t.value})):[]}}}}},{key:"saveRequestMetadata",value:function(t,e){var n=e.req,i=this.store,r=e.referringTerm;this.addStatus(e.req,"Accept: "+e.headers.accept),cu(r)&&i.add(i.rdfFactory.namedNode(t),this.ns.link("requestedBy"),r,this.appNode),e.original&&e.original.value!==t&&i.add(n,this.ns.link("orginalURI"),i.rdfFactory.literal(e.original.value),this.appNode);var o=new Date,s="["+o.getHours()+":"+o.getMinutes()+":"+o.getSeconds()+"] ";i.add(n,this.ns.rdfs("label"),i.rdfFactory.literal(s+" Request for "+t),this.appNode),i.add(n,this.ns.link("requestedURI"),i.rdfFactory.literal(t),this.appNode),i.add(n,this.ns.link("status"),i.collection(),this.appNode)}},{key:"saveResponseMetadata",value:function(t,e){var n=this,i=this.store,r=i.bnode();return i.add(e.req,this.ns.link("response"),r,r),i.add(r,this.ns.http("status"),i.rdfFactory.literal(t.status),r),i.add(r,this.ns.http("statusText"),i.rdfFactory.literal(t.statusText),r),t.headers.forEach((function(t,o){var s;i.add(r,n.ns.httph(o),n.store.rdfFactory.literal(t),r),"content-type"===o&&i.add(e.resource,n.ns.rdf("type"),i.rdfFactory.namedNode((s=t,s=s.split(";")[0].trim(),new fu("http://www.w3.org/ns/iana/media-types/"+s+"#Resource")).value),r)})),r}},{key:"objectRefresh",value:function(t){var e=this.store.uris(t);if(void 0!==e)for(var n=0;n<e.length;n++)this.refresh(this.store.rdfFactory.namedNode(Zl(e[n])))}},{key:"refresh",value:function(t,e){this.fireCallbacks("refresh",arguments),this.nowOrWhenFetched(t,{force:!0,clearPreviousData:!0},e)}},{key:"refreshIfExpired",value:function(t,e){var n=this.getHeader(t,"Expires");!n||new Date(n[0]).getTime()<=(new Date).getTime()?this.refresh(t,e):e(!0,"Not expired",{})}},{key:"retract",value:function(t){this.store.removeMany(void 0,void 0,void 0,t),t.value&&delete this.requested[Zl(t.value)],this.fireCallbacks("retract",arguments)}},{key:"getState",value:function(t){return void 0===this.requested[t]?"unrequested":!0===this.requested[t]?"requested":"done"===this.requested[t]?"fetched":"redirected"===this.requested[t]?this.getState(this.redirectedTo[t]):"failed"}},{key:"isPending",value:function(t){return!0===this.requested[t]}},{key:"unload",value:function(t){this.store.removeDocument(t),delete this.requested[t.value]}},{key:"addHandler",value:function(t){this.handlers.push(t),t.register(this)}},{key:"retryNoCredentials",value:function(t,e){console.log("Fetcher: CORS: RETRYING with NO CREDENTIALS for "+e.resource),e.retriedWithNoCredentials=!0,delete this.requested[t],delete this.fetchQueue[t];var n=Object.assign({},e,{credentials:"omit"});return this.addStatus(e.req,"Abort: Will retry with credentials SUPPRESSED to see if that helps"),this.load(t,n)}},{key:"isCrossSite",value:function(t){if("undefined"==typeof document||!document.location)return!1;var e=th,n=""+document.location;return(e(n)&&e(t)&&e(n))!==e(t)}},{key:"handleError",value:function(e,n,i){if(this.isCrossSite(n)){if(i.credentials&&"include"===i.credentials&&!i.retriedWithNoCredentials)return this.retryNoCredentials(n,i);var r=t.crossSiteProxy(n);if(r&&!i.proxyUsed)return console.log("web: Direct failed so trying proxy "+r),this.redirectToProxy(r,i)}var o;return e instanceof Error?o="Fetch error: "+e.message:(o=e.statusText,e.responseText&&(o+=" ".concat(e.responseText))),this.failFetch(i,o,e.status||998,e)}},{key:"addType",value:function(t,e,n,i){var r=e;if(i){var o=n.any(r,this.ns.link("requestedURI"));o&&o.value!==i&&n.add(n.rdfFactory.namedNode(i),this.ns.rdf("type"),t,this.appNode)}for(;;){var s=n.any(r,this.ns.link("requestedURI"));if(s&&s.value&&n.add(n.rdfFactory.namedNode(s.value),this.ns.rdf("type"),t,this.appNode),!(r=n.any(void 0,n.rdfFactory.namedNode("http://www.w3.org/2007/ont/link#redirectedRequest"),r)))break;var a=n.any(r,n.rdfFactory.namedNode("http://www.w3.org/2007/ont/link#response"));if(!a)break;var u=n.any(a,n.rdfFactory.namedNode("http://www.w3.org/2007/ont/http#status"));if(!u)break;if("301"!==u&&"302"!==u)break}}},{key:"handleResponse",value:function(t,e,n){var i=this,r=this.store,o=t.headers,s=n.req,a=this.saveResponseMetadata(t,n),u=this.normalizedContentType(n,o)||"",c=o.get("content-location");if(0===t.status)return console.log("Masked error - status 0 for "+e),this.handleError(t,e,n);if(t.status>=400)return 404===t.status&&(this.nonexistent[n.original.value]=!0,this.nonexistent[e]=!0),this.saveErrorResponse(t,a).then((function(){return i.failFetch(n,n.resource+" "+t.statusText,t.status,t)}));var l=null,h=null;if(c&&(h=eh(c,e))!==e&&(l=h),200===t.status){this.addType(this.ns.link("Document"),s,r,e),l&&this.addType(this.ns.link("Document"),s,r,l),n.clearPreviousData&&r.removeDocument(n.resource);var d=u.includes("image/")||u.includes("application/pdf");u&&d&&(this.addType(r.rdfFactory.namedNode("http://purl.org/dc/terms/Image"),s,r,e),l&&this.addType(r.rdfFactory.namedNode("http://purl.org/dc/terms/Image"),s,r,l))}if(c){if(!n.force&&l&&"done"===this.requested[h])return this.doneFetch(n,t);this.requested[h]=!0}this.parseLinkHeader(o.get("link"),n.original,s);var f=this.handlerForContentType(u,t);return f?t.text().then((function(e){return t.responseText=e,f.parse(i,e,n,t)})):(this.addStatus(s,"Fetch over. No data handled."),this.doneFetch(n,t))}},{key:"saveErrorResponse",value:function(t,e){var n=this,i=this.store;return t.text().then((function(t){t.length>10&&i.add(e,n.ns.http("content"),i.rdfFactory.literal(t),e)}))}},{key:"handlerForContentType",value:function(t,e){if(!t)return null;var n=this.handlers.find((function(e){return t.match(e.pattern)}));return n?new n(e):null}},{key:"guessContentType",value:function(t){return Cd[t.split(".").pop()]}},{key:"normalizedContentType",value:function(t,e){if(t.forceContentType)return t.forceContentType;var n=e.get("content-type");if(!n||n.includes("application/octet-stream")){var i=this.guessContentType(t.resource.value);if(i)return i}var r=nh(t.resource.value);return!n&&["file","chrome"].includes(r)?"text/xml":n}},{key:"redirectToProxy",value:function(t,e){var n=this;this.addStatus(e.req,"BLOCKED -> Cross-site Proxy to <"+t+">"),e.proxyUsed=!0;var i=this.store,r=e.req;e.noMeta||(i.add(r,this.ns.link("redirectedTo"),i.rdfFactory.namedNode(t),r),this.addStatus(r,"redirected to new request")),this.requested[e.resource.value]="redirected",this.redirectedTo[e.resource.value]=t;var o=Object.assign({},e);return o.baseURI=e.resource.value,this.fetchUri(t,o).then((function(t){return o.noMeta||i.add(r,n.ns.link("redirectedRequest"),o.req,n.appNode),t}))}},{key:"setRequestTimeout",value:function(t,e){var n=this;return new Promise((function(i){n.timeouts[t]=(n.timeouts[t]||[]).concat(setTimeout((function(){!n.isPending(t)||e.retriedWithNoCredentials||e.proxyUsed||i(n.failFetch(e,"Request to ".concat(t," timed out"),"timeout"))}),n.timeout))}))}},{key:"addFetchCallback",value:function(t,e){this.fetchCallbacks[t]?this.fetchCallbacks[t].push(e):this.fetchCallbacks[t]=[e]}},{key:"acceptString",value:function(){var t="";for(var e in this.mediatypes)for(var n in""!==t&&(t+=", "),t+=e,this.mediatypes[e])t+=";"+n+"="+this.mediatypes[e][n];return t}}],[{key:"crossSiteProxy",value:function(e){return t.crossSiteProxyTemplate?t.crossSiteProxyTemplate.replace("{uri}",encodeURIComponent(e)):void 0}},{key:"offlineOverride",value:function(t){var e,n=t;return"undefined"!=typeof window&&window.panes&&(e=window.panes.UI)&&e.preferences&&e.preferences.get("offlineModeUsingLocalhost")&&"http://"===n.slice(0,7)&&"localhost/"!==n.slice(7,17)&&(n="http://localhost/"+n.slice(7),hh("Localhost kludge for offline use: actually getting <"+n+">")),n}},{key:"proxyIfNecessary",value:function(e){var n;if("undefined"!=typeof window&&window.panes&&(n=window.panes.UI)&&n.isExtension)return e;if("undefined"!=typeof $SolidTestEnvironment&&$SolidTestEnvironment.localSiteMap){var i=function t(e,n){var i=n[e.shift()];return i?"string"==typeof i?i+e.join("/"):e?t(e,i):null:null}(e.split("/").slice(2),$SolidTestEnvironment.localSiteMap);if(i)return i}return t.crossSiteProxyTemplate&&"undefined"!=typeof document&&document.location&&"https:"===(""+document.location).slice(0,6)&&"http:"===e.slice(0,5)?t.crossSiteProxyTemplate.replace("{uri}",encodeURIComponent(e)):e}},{key:"unsupportedProtocol",value:function(t){var e=nh(t);return"tel"===e||"mailto"===e||"urn"===e}},{key:"setCredentials",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};void 0===e.credentials&&(e.credentials=void 0!==e.withCredentials?e.withCredentials?"include":"omit":"include")}}]),t}();function Hd(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function Kd(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Hd(Object(n),!0).forEach((function(e){Ya(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Hd(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}Ya($d,"HANDLERS",void 0),Ya($d,"CONTENT_TYPE_BY_EXT",void 0),Ya($d,"crossSiteProxyTemplate",void 0),$d.HANDLERS=Bd,$d.CONTENT_TYPE_BY_EXT=Cd;var zd,Wd=Kd(Kd({},vd),{},{fetcher:function(t,e){return new $d(t,e)},graph:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return new zh(t,e||{rdfFactory:vd})},lit:function(t,e,n){return this.literal(""+t,e||n)},st:function(t,e,n,i){return this.quad(t,e,n,i)}}),qd={};for(zd in Wd)"function"==typeof Wd[zd]&&(qd[zd]=Wd[zd].bind(Wd));var Vd=qd.fetcher,Gd=qd.graph,Xd=qd.namedNode;new Th;var Yd=(t,e)=>{const n=t[e.predicate.uri];return Lt(Ut({},t),{[e.predicate.uri]:n?[...n,e.subject.value]:[e.subject.value]})},Zd=(t,e)=>{const n=t[e.predicate.uri];return Lt(Ut({},t),{[e.predicate.uri]:n?[...n,e.object.value]:[e.object.value]})};
|
|
2
|
+
/*!
|
|
3
|
+
* The buffer module from node.js, for the browser.
|
|
4
|
+
*
|
|
5
|
+
* @author Feross Aboukhadijeh <http://feross.org>
|
|
6
|
+
* @license MIT
|
|
7
|
+
*/
|
|
8
|
+
/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
|
|
9
|
+
*/
|
|
10
|
+
/*! Mike Samuel (c) 2009 | code.google.com/p/json-sans-eval
|
|
11
|
+
*/
|
|
12
|
+
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
13
|
+
/*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
14
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
15
|
+
/**
|
|
16
|
+
* A JavaScript implementation of the JSON-LD API.
|
|
17
|
+
*
|
|
18
|
+
* @author Dave Longley
|
|
19
|
+
*
|
|
20
|
+
* @license BSD 3-Clause License
|
|
21
|
+
* Copyright (c) 2011-2019 Digital Bazaar, Inc.
|
|
22
|
+
* All rights reserved.
|
|
23
|
+
*
|
|
24
|
+
* Redistribution and use in source and binary forms, with or without
|
|
25
|
+
* modification, are permitted provided that the following conditions are met:
|
|
26
|
+
*
|
|
27
|
+
* Redistributions of source code must retain the above copyright notice,
|
|
28
|
+
* this list of conditions and the following disclaimer.
|
|
29
|
+
*
|
|
30
|
+
* Redistributions in binary form must reproduce the above copyright
|
|
31
|
+
* notice, this list of conditions and the following disclaimer in the
|
|
32
|
+
* documentation and/or other materials provided with the distribution.
|
|
33
|
+
*
|
|
34
|
+
* Neither the name of the Digital Bazaar, Inc. nor the names of its
|
|
35
|
+
* contributors may be used to endorse or promote products derived from
|
|
36
|
+
* this software without specific prior written permission.
|
|
37
|
+
*
|
|
38
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
|
39
|
+
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
40
|
+
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
41
|
+
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
42
|
+
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
43
|
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
|
44
|
+
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
45
|
+
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
46
|
+
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
47
|
+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
48
|
+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
49
|
+
*/
|
|
50
|
+
/**
|
|
51
|
+
* Removes the @preserve keywords from expanded result of framing.
|
|
52
|
+
*
|
|
53
|
+
* @param input the framed, framed output.
|
|
54
|
+
* @param options the framing options used.
|
|
55
|
+
*
|
|
56
|
+
* @return the resulting output.
|
|
57
|
+
*/
|
|
58
|
+
// disallow aliasing @context and @preserve
|
|
59
|
+
// remove @preserve
|
|
60
|
+
// remove @preserve from results
|
|
61
|
+
const Qd=()=>new class{constructor(){this.session=new class{get authenticatedFetch(){return this._authenticatedFetch}constructor(){this.session=new Ja.Session,this._authenticatedFetch=this.session.fetch}handleIncomingRedirect(){return Wt(this,null,(function*(){return this.session.handleIncomingRedirect({restorePreviousSession:!1})}))}login(t){return Wt(this,null,(function*(){return this.session.login({oidcIssuer:t,redirectUrl:window.location.href,clientName:`Pod OS at ${window.location.host}`})}))}logout(){return Wt(this,null,(function*(){return this.session.logout()}))}trackSession(t){this.session.onLogin((()=>t(this.session.info))),this.session.onLogout((()=>t(this.session.info))),this.session.onSessionRestore((()=>t(this.session.info))),t(this.session.info)}},this.store=new class{constructor(t){this.graph=Gd(),this.fetcher=Vd(this.graph,{fetch:t.authenticatedFetch})}fetch(t){return this.fetcher.load(Xd(t),{force:!0})}get(t){return new class{constructor(t,e){this.uri=t,this.store=e}label(){const t=this.anyValue("http://www.w3.org/2006/vcard/ns#fn","http://xmlns.com/foaf/0.1/name","http://xmlns.com/foaf/0.1/nick","https://schema.org/name","http://schema.org/name","http://purl.org/dc/terms/title","http://purl.org/dc/elements/1.1/title","http://www.w3.org/2000/01/rdf-schema#label","https://www.w3.org/ns/activitystreams#name","http://schema.org/caption","https://schema.org/caption");return null!=t?t:this.uri}literals(){const t=this.store.statementsMatching(Xd(this.uri)).filter((t=>au(t.object))).reduce(Zd,{});return Object.keys(t).map((e=>({predicate:e,values:t[e]})))}relations(){const t=this.store.statementsMatching(Xd(this.uri)).filter((t=>cu(t.object))).reduce(Zd,{});return Object.keys(t).map((e=>({predicate:e,uris:t[e]})))}reverseRelations(){const t=this.store.statementsMatching(void 0,void 0,Xd(this.uri)).reduce(Yd,{});return Object.keys(t).map((e=>({predicate:e,uris:t[e]})))}anyValue(...t){let e;return t.some((t=>(e=this.store.anyValue(Xd(this.uri),Xd(t)),Boolean(e)))),e}description(){return this.anyValue("http://purl.org/dc/terms/description","http://purl.org/dc/elements/1.1/description","http://schema.org/description","https://schema.org/description","https://schema.org/text","http://www.w3.org/2000/01/rdf-schema#comment","https://www.w3.org/ns/activitystreams#summary","https://www.w3.org/ns/activitystreams#content","http://www.w3.org/2006/vcard/ns#note")}}(t,this.graph)}}(this.session)}handleIncomingRedirect(){this.session.handleIncomingRedirect()}fetch(t){return this.store.fetch(t)}trackSession(t){return this.session.trackSession(t)}logout(){return this.session.logout()}login(t="http://localhost:3000"){return this.session.login(t)}},tf=class{constructor(e){t(this,e)}componentWillLoad(){this.os=Qd(),this.os.handleIncomingRedirect(),this.os.trackSession((t=>{yt.state.isLoggedIn=t.isLoggedIn,yt.state.webId=t.webId}))}async initializeOs(t){t.stopPropagation(),t.detail(this.os)}render(){return e("ion-app",null,e("slot",null))}},ef=class{constructor(e){t(this,e)}render(){return e("ion-grid",null,e("ion-row",null,e("ion-col",{size:"12","size-sm":!0},e("ion-card",null,e("ion-card-header",null,e("img",{src:"https://dummyimage.com/250/ffffff/000000"}),e("ion-card-title",null,e("pos-label",null))),e("ion-card-content",null,e("pos-description",null)))),e("ion-col",{size:"12","size-sm":!0},e("pos-literals",null)),e("ion-col",{size:"12","size-sm":!0},e("pos-relations",null),e("pos-reverse-relations",null))))}},nf=class{constructor(e){t(this,e)}render(){return e("pos-app",null,e("ion-header",null,e("ion-toolbar",null,e("ion-title",{slot:"start"},"pod os"),e("pos-login",null))),e("ion-content",null,e("pos-router",null)),e("ion-footer",null,e("ion-toolbar",null,e("ion-title",null,"Footer"))))}},rf=class{constructor(e){t(this,e),this.getResource=r(this,"pod-os:resource",7),this.setResource=async t=>{this.resource=t}}componentWillLoad(){this.getResource.emit(this.setResource)}render(){return this.resource?this.resource.description():null}},of=class{constructor(e){t(this,e),this.getResource=r(this,"pod-os:resource",7),this.setResource=async t=>{this.resource=t}}componentWillLoad(){this.getResource.emit(this.setResource)}render(){return this.resource?this.resource.label():null}},sf=class{constructor(e){t(this,e),this.getResource=r(this,"pod-os:resource",7),this.data=[],this.setResource=async t=>{this.data=t.literals()}}componentWillLoad(){this.getResource.emit(this.setResource)}render(){const t=this.data.map((t=>e("ion-item-group",null,e("ion-item-divider",null,e("ion-label",null,t.predicate)),t.values.map((t=>e("ion-item",null,e("ion-label",{class:"ion-text-wrap"},t)," "))))));return this.data.length>0?e("ion-list",null,t):null}},af=class{constructor(e){t(this,e),this.initializeOsEmitter=r(this,"pod-os:init",7),this.setOs=async t=>{this.os=t}}componentWillLoad(){this.initializeOsEmitter.emit(this.setOs)}login(){const t=yt.state.getIdpUrl();this.os.login(t)}logout(){this.os.logout()}render(){return e(n,null,yt.state.isLoggedIn?e("pos-resource",{uri:yt.state.webId},e("pos-label",null)):"",!yt.state.isLoggedIn&&e("ion-button",{onClick:()=>this.login()},"Login"),yt.state.isLoggedIn&&e("ion-button",{onClick:()=>this.logout()},"Logout"))}},uf=class{constructor(e){t(this,e),this.getResource=r(this,"pod-os:resource",7),this.data=[],this.setResource=async t=>{this.data=t.relations()}}componentWillLoad(){this.getResource.emit(this.setResource)}render(){const t=this.data.map((t=>e("ion-item-group",null,e("ion-item-divider",null,e("ion-label",null,t.predicate)),t.uris.map((t=>e("pos-rich-link",{uri:t}))))));return this.data.length>0?e("ion-list",null,t):null}},cf=class{constructor(e){t(this,e),this.initializeOsEmitter=r(this,"pod-os:init",7),this.consumers=[],this.lazy=!1,this.loading=!0,this.setOs=async t=>{this.os=t}}componentWillLoad(){yt.onChange("isLoggedIn",(()=>this.loadResource())),this.initializeOsEmitter.emit(this.setOs)}async provideResource(t){t.stopPropagation(),this.resource&&t.detail(this.resource),this.consumers.push(t)}async loadResource(){await this.getResource(!this.lazy)}async fetch(){await this.getResource(!0)}async getResource(t=!1){try{t&&(this.loading=!0,await this.os.fetch(this.uri)),this.resource=this.os.store.get(this.uri),this.error=null,this.consumers.forEach((t=>{t.detail(this.resource)}))}catch(t){this.error=t}finally{this.loading=!1}}render(){return this.loading?e("ion-progress-bar",{type:"indeterminate"}):this.error?e("div",null,this.error.message):e("slot",null)}static get watchers(){return{os:["loadResource"],uri:["loadResource"]}}},lf=class{constructor(e){t(this,e),this.getResource=r(this,"pod-os:resource",7),this.data=[],this.setResource=async t=>{this.data=t.reverseRelations()}}componentWillLoad(){this.getResource.emit(this.setResource)}render(){const t=this.data.map((t=>e("ion-item-group",null,e("ion-item-divider",null,e("ion-label",null,"is ",t.predicate," of")),t.uris.map((t=>e("pos-rich-link",{uri:t}))))));return this.data.length>0?e("ion-list",null,t):null}},hf=class{constructor(e){t(this,e),this.linkEmitter=r(this,"pod-os:link",7)}render(){return e("pos-resource",{lazy:!0,uri:this.uri},e("ion-item",{href:this.uri,onClick:t=>{t.preventDefault(),this.linkEmitter.emit(this.uri)}},e("ion-label",null,e("h2",null,e("pos-label",null)),e("p",null,e("ion-label",{style:{maxWidth:"50rem"}},e("pos-description",null))),e("p",null,e("a",{href:this.uri},this.uri)))))}},df=(t,e)=>{var n;return"to"in t?{path:t.path,to:t.to}:{path:t.path,id:t.id,jsx:null!==(n=t.render)&&void 0!==n?n:e}},ff=(t,e)=>{if("string"==typeof e){if(e===t)return{}}else if("function"==typeof e){const n=e(t);if(n)return!0===n?{}:{...n}}else{const n=e.exec(t);if(n)return e.lastIndex=0,{...n}}},pf=t=>t.pathname.toLowerCase(),vf=new RegExp(["(\\\\.)","(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?"].join("|"),"g"),gf=t=>t.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1"),mf=t=>t.replace(/([=!:$/()])/g,"\\$1"),wf=t=>t&&t.sensitive?"":"i",bf=(t,e,n)=>{for(var i=(n=n||{}).strict,r=!1!==n.end,o=gf(n.delimiter||"/"),s=n.delimiters||"./",a=[].concat(n.endsWith||[]).map(gf).concat("$").join("|"),u="",c=!1,l=0;l<t.length;l++){var h=t[l];if("string"==typeof h)u+=gf(h),c=l===t.length-1&&s.indexOf(h[h.length-1])>-1;else{var d=gf(h.prefix||""),f=h.repeat?"(?:"+h.pattern+")(?:"+d+"(?:"+h.pattern+"))*":h.pattern;e&&e.push(h),u+=h.optional?h.partial?d+"("+f+")?":"(?:"+d+"("+f+"))?":d+"("+f+")"}}return r?(i||(u+="(?:"+o+")?"),u+="$"===a?"$":"(?="+a+")"):(i||(u+="(?:"+o+"(?="+a+"))?"),c||(u+="(?="+o+"|"+a+")")),new RegExp("^"+u,wf(n))},yf=(t,e,n)=>t instanceof RegExp?((t,e)=>{if(!e)return t;var n=t.source.match(/\((?!\?)/g);if(n)for(var i=0;i<n.length;i++)e.push({name:i,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,pattern:null});return t})(t,e):Array.isArray(t)?((t,e,n)=>{for(var i=[],r=0;r<t.length;r++)i.push(yf(t[r],e,n).source);return new RegExp("(?:"+i.join("|")+")",wf(n))})(t,e,n):((t,e,n)=>bf(((t,e)=>{for(var n,i=[],r=0,o=0,s="",a=e&&e.delimiter||"/",u=e&&e.delimiters||"./",c=!1;null!==(n=vf.exec(t));){var l=n[0],h=n[1],d=n.index;if(s+=t.slice(o,d),o=d+l.length,h)s+=h[1],c=!0;else{var f="",p=t[o],v=n[2],g=n[3],m=n[4],w=n[5];if(!c&&s.length){var b=s.length-1;u.indexOf(s[b])>-1&&(f=s[b],s=s.slice(0,b))}s&&(i.push(s),s="",c=!1);var y=f||a,x=g||m;i.push({name:v||r++,prefix:f,delimiter:y,optional:"?"===w||"*"===w,repeat:"+"===w||"*"===w,partial:""!==f&&void 0!==p&&p!==f,pattern:x?mf(x):"[^"+gf(y)+"]+?"})}}return(s||o<t.length)&&i.push(s+t.substr(o)),i})(t,n),e,n))(t,e,n);let xf=0;const kf={},Ef=(t,e={})=>{const{exact:n=!1,strict:i=!1}=e,{re:r,keys:o}=((t,e)=>{const n=`${e.end}${e.strict}`,i=kf[n]||(kf[n]={}),r=JSON.stringify(t);if(i[r])return i[r];const o=[],s={re:yf(t,o,e),keys:o};return xf<1e4&&(i[r]=s,xf+=1),s})(t,{end:n,strict:i});return t=>{const e=r.exec(t);if(!e)return;const[i,...s]=e;return n&&t!==i?void 0:o.reduce(((t,e,n)=>(t[e.name]=s[n],t)),{})}},Sf=(()=>{const t=window,e=new URL(t.location.href),n=(void 0,pf),{state:i,onChange:r,dispose:o}=bt({url:e,activePath:n(e)},((t,e,n)=>"url"===n?t.href!==e.href:t!==e)),s=t=>{history.pushState(null,null,t);const e=new URL(t,document.baseURI);i.url=e,i.activePath=n(e)},a=t=>{const{activePath:e}=i;for(let n of t){const i=ff(e,n.path);if(i){if(null!=n.to){const i="string"==typeof n.to?n.to:n.to(e);return s(i),a(t)}return{params:i,route:n}}}},u=()=>{const e=new URL(t.location.href);i.url=e,i.activePath=n(e)},c={Switch:(t,e)=>{const n=a(e);if(n)return"function"==typeof n.route.jsx?n.route.jsx(n.params):n.route.jsx},get url(){return i.url},get activePath(){return i.activePath},push:s,onChange:r,dispose:()=>{t.removeEventListener("popstate",u),o()}};return u(),t.addEventListener("popstate",u),c})(),Ff=class{constructor(e){t(this,e)}linkClicked(t){this.navigate(t.detail)}componentWillLoad(){this.updateUri(),Sf.onChange("url",(()=>{this.updateUri()}))}navigate(t){Sf.push("?uri="+encodeURIComponent(t))}updateUri(){this.uri=new URLSearchParams(window.location.search).get("uri")||window.location.href}render(){return console.log("render router",this.uri),e(Sf.Switch,null,e(df,{path:Ef("",{exact:!1})},e("pos-resource",{key:this.uri,uri:this.uri},e("pos-app-generic",null))))}};export{y as ion_app,E as ion_button,S as ion_card,F as ion_card_content,A as ion_card_header,_ as ion_card_title,O as ion_col,N as ion_content,M as ion_footer,U as ion_grid,H as ion_header,Q as ion_icon,nt as ion_item,it as ion_item_divider,rt as ion_item_group,ot as ion_label,st as ion_list,at as ion_progress_bar,lt as ion_ripple_effect,pt as ion_row,vt as ion_title,gt as ion_toolbar,tf as pos_app,ef as pos_app_generic,nf as pos_demo_app,rf as pos_description,of as pos_label,sf as pos_literals,af as pos_login,uf as pos_relations,cf as pos_resource,lf as pos_reverse_relations,hf as pos_rich_link,Ff as pos_router}
|