@sitecore-feaas/clientside 0.1.39 → 0.1.40

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.
@@ -1,4 +1,4 @@
1
- var Pt=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});function _(t,e=r=>{}){var r;let i=()=>{var o,n;let s=new Promise((l,d)=>{o=h=>{t==null||t(h),l(h)},n=d});var a=Object.assign(s,{resolve:o,reject:n,restart:i,first:r});return r=a,a.catch(e),a};return i()}var Tt=typeof HTMLElement=="undefined"?typeof windowJSDOM!="undefined"?windowJSDOM.HTMLElement:class{}:HTMLElement,b=class extends Tt{getProps(e){return{}}constructor(){super(),this.defaultProps={},this.connected=!1,this.refs={},this.descendants=[],this.whenLoaded=_(e=>{this.payload=e}),this.whenRendered=_(()=>this.initialized=!0,()=>cancelAnimationFrame(this.nextRender)),this.addEventListener("feaasMount",this),this.addEventListener("feaasUnmount",this)}getRoot(){return this}attributeChangedCallback(e,r,i){this.set()}connectedCallback(){this.mount()}disconnectedCallback(){this.unmount()}mount(){try{let e=this.getParent();if(e&&!e.connected||this.connected)return;this.connected=!0,this.log("FEAAS: Mount",this.tagName,this),this.dispatchEvent(new Event("feaasMount",{bubbles:!0,composed:!0})),this.getElements().map(r=>{var i;return(i=r.mount)===null||i===void 0?void 0:i.call(r)}),this.set()}catch(e){this.onError(e)}}log(...e){console.log(...e)}unmount(){this.connected&&(this.log("FEAAS: Unmount",this),this.dispatchEvent(new Event("feaasUnmount",{bubbles:!0,composed:!0})),this.connected=!1)}getParent(e=!0){for(var r=this;r=r.parentElement||(r.parentNode instanceof ShadowRoot?r.parentNode.host:null);)if(!e||r.tagName.startsWith("FEAAS-"))return r}getElements(e=this.getRoot(),r=!0){return Array.from(e.querySelectorAll("*")).map(i=>[!r||i.tagName.startsWith("FEAAS-")?i:null,i.shadowRoot?this.getElements(i.shadowRoot,r):null]).flat().filter(Boolean)}handleEvent(e){let r=e.composedPath()[0];switch(e.type){case"feaasMount":r!=this&&this.nestedCallback(r);break;case"feaasUnmount":r!=this&&this.unnestedCallback(r);break}}unnestedCallback(e){let r=this.descendants.indexOf(e);r!=-1&&(this.log("FEAAS: Unnest",this,e),this.descendants.splice(r,-1),this.refs[e.getComponentName()]=null,e.refs.parent==this&&(e.refs.parent=null),e.refs.top==this&&(e.refs.top=e.refs.parent))}nestedCallback(e){var r,i;if(this.descendants.indexOf(e)==-1&&(this.descendants.push(e),this.log("FEAAS: Nest",this,e),this.refs[e.getComponentName()]=e,e.refs.top=this,(r=e.refs).parent||(r.parent=this),e.render))for(var n=e.refs.parent;n;n=n.refs.parent)n.render&&((i=e.refs).parentReact||(i.parentReact=n),e.refs.topReact=n)}getComponentName(){return this.tagName.replace("FEAAS-","").toLowerCase()}isReadyToLoad(){return this.payload===void 0&&this.getAttribute("hidden")==null}onError(e,r="uncaught",i=!1){let o=new CustomEvent("feaasError",{bubbles:!0,composed:!0,detail:e});if(this.dispatchEvent(o),this.whenLoaded.reject(e),!o.defaultPrevented&&!i){this.whenRendered.reject(e);try{this.unmount()}catch(n){}return!0}return!1}shouldUpdateOnLoad(){return!0}async advance(){try{if(this.payload===void 0){if(!this.isReadyToLoad())return;this.payload=null,this.dispatchEvent(new Event("feaasLoad",{bubbles:!0,composed:!0}));let e=await this.load().catch(r=>{throw this.payload=void 0,r});if(this.whenLoaded.resolve(e),this.onLoad)return}else if(this.payload==null)return;this.flush(),this.whenRendered.resolve(this)}catch(e){this.onError(e)}}flush(){var e,r;let i=(r=(e=this.payload)===null||e===void 0?void 0:e.ReactDOM)===null||r===void 0?void 0:r.flushSync;i?i(()=>this.update()):this.update()}load(){return Promise.resolve(null)}update(){var e,r,i;if(this.payload==null||!this.render)return;let{React:o,ReactDOM:n,ReactDOMClient:s}=this.payload||{};if(!o)throw new Error(`${this.tagName}: React is not present in payload`);if(!n)throw new Error(`${this.tagName}: ReactDOM is not present in payload`);!this.refs.topReact&&!this.forceUpdateReact?s?(this.reactRoot||(this.reactRoot=s.createRoot(this.getReactRootElement())),this.reactRoot.render(this.getReactElement())):n.render(this.getReactElement(),this.getReactRootElement()):this.forceUpdateReact?(e=this.forceUpdateReact)===null||e===void 0||e.call(this):(i=(r=this.refs.topReact).forceUpdateReact)===null||i===void 0||i.call(r)}invokeReactRendering(){let{React:e,ReactDOM:r}=this.payload||{};if(!this.connected)return null;let i=this.descendants.filter(o=>o.refs.parentReact==this&&o.payload).map((o,n)=>this.getReactElement(o));return this.render({...this.props,children:i},this.payload)}getReactErrorBoundary(e=this,r=e.tagName){if(this.reactErrorBoundary)return this.reactErrorBoundary;let{React:i,ReactDOM:o}=e.payload||{};return this.reactErrorBoundary||(this.reactErrorBoundary=class extends i.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromError(s){return{error:s}}componentDidCatch(s,a){console.error(`FEAAS: ${e.tagName} Error:`,s,a),e.onError(s,"react")}render(){if(!this.state.error)return this.props.children}})}getReactElement(e=this,r){let{React:i,ReactDOM:o}=e.payload||{},n=this.getReactErrorBoundary(),s=this.getReactWrapper(e);return i.createElement(n,{key:e.tagName+"-"+e.getUID(),slot:e.getAttribute("slot")},i.createElement(s,null))}getReactWrapper(e=this,r=e.tagName){if(e.reactWrapper)return e.reactWrapper;let{React:i,ReactDOM:o}=e.payload||{};return e.reactWrapper=n=>{if(e.render){let[s,a]=i.useReducer(l=>l+1,0);return e.forceUpdateReact=a,o.createPortal(i.createElement(i.Fragment,null,e.invokeReactRendering()),e.getReactRootElement())}else return e.update()},Object.assign(e.reactWrapper,{key:e.tagName+"-"+e.getUID(),displayName:r}),e.reactWrapper}getUID(){return this.uid||(this.uid=String(Math.random()))}getShadowRoot(){return this.shadowRoot||this.attachShadow({mode:"open"}),this.shadowRoot}getReactRootElement(){return this.useShadowRoot?this.getShadowRoot():this.getRoot()}set(e){try{this.scheduleRender(),this.overrides={...this.overrides,...e},this.props={...this.getProps(),...this.overrides};for(var r in this.props){let i=this.props[r],o=r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();i==null||i===this.defaultProps[r]?this.removeAttribute(o):(typeof i=="string"||typeof i=="number"||typeof i=="boolean")&&this.getAttribute(o)!=String(i)&&this.setAttribute(o,String(i))}}catch(i){this.whenRendered.reject(i),this.onError(i,"set")}return this}import(e){return import( /*@vite-ignore*/ /* webpackIgnore: true */ e)}scheduleRender(){this.nextRender==null&&(this.whenRendered=this.whenRendered.restart()),cancelAnimationFrame(this.nextRender),this.nextRender=requestAnimationFrame(()=>{this.nextRender=null,this.advance().catch(e=>{})})}formatURL(e,r){return typeof e=="string"&&e.match(/^\/[^\/]/)?r+e:e}getContextAttribute(e,r=this){for(var i=this;i=i.parentElement||(i.parentNode instanceof ShadowRoot?i.parentNode.host:null);)if(i.getAttribute(e)!=null)return i.getAttribute(e);return this.getAttribute(e)}static register(e,r){r==null&&(r=typeof window!="undefined"?window:null),r!=null&&r.customElements.get(e)||r.customElements.define(e,this)}};var P=class extends b{load(){return Promise.all([import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react"),import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react-dom")]).then(([e,r])=>({React:e,ReactDOM:r}))}render({},{React:e}){return e.createElement(e.Fragment,null)}},Q=class extends P{constructor(){super(...arguments),this.useShadowRoot=!0}getProps(){return{counter:parseFloat(this.getAttribute("counter"))}}render({counter:e},{React:r}){let[i,o]=r.useState(0);return r.useEffect(()=>{o(n=>n+1)},[e]),r.createElement(r.Fragment,null,r.createElement("p",null,"Rendering attribute: ",e),r.createElement("p",null,"Triggered updates: ",i))}};Q.observedAttributes=["counter"];import Mt from"vm";var{hasOwnProperty:A}=Object.prototype;function k(t,e){return t=t.slice(),t.push(e),t}function X(t,e){return e=e.slice(),e.unshift(t),e}var tt=class extends Error{constructor(e){super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),this.avoidNew=!0,this.value=e,this.name="NewError"}};function p(t,e,r,i,o){if(!(this instanceof p))try{return new p(t,e,r,i,o)}catch(s){if(!s.avoidNew)throw s;return s.value}typeof t=="string"&&(o=i,i=r,r=e,e=t,t=null);let n=t&&typeof t=="object";if(t=t||{},this.json=t.json||r,this.path=t.path||e,this.resultType=t.resultType||"value",this.flatten=t.flatten||!1,this.wrap=A.call(t,"wrap")?t.wrap:!0,this.sandbox=t.sandbox||{},this.preventEval=t.preventEval||!1,this.parent=t.parent||null,this.parentProperty=t.parentProperty||null,this.callback=t.callback||i||null,this.otherTypeCallback=t.otherTypeCallback||o||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},t.autostart!==!1){let s={path:n?t.path:e};n?"json"in t&&(s.json=t.json):s.json=r;let a=this.evaluate(s);if(!a||typeof a!="object")throw new tt(a);return a}}p.prototype.evaluate=function(t,e,r,i){let o=this.parent,n=this.parentProperty,{flatten:s,wrap:a}=this;if(this.currResultType=this.resultType,this.currPreventEval=this.preventEval,this.currSandbox=this.sandbox,r=r||this.callback,this.currOtherTypeCallback=i||this.otherTypeCallback,e=e||this.json,t=t||this.path,t&&typeof t=="object"&&!Array.isArray(t)){if(!t.path&&t.path!=="")throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!A.call(t,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:e}=t),s=A.call(t,"flatten")?t.flatten:s,this.currResultType=A.call(t,"resultType")?t.resultType:this.currResultType,this.currSandbox=A.call(t,"sandbox")?t.sandbox:this.currSandbox,a=A.call(t,"wrap")?t.wrap:a,this.currPreventEval=A.call(t,"preventEval")?t.preventEval:this.currPreventEval,r=A.call(t,"callback")?t.callback:r,this.currOtherTypeCallback=A.call(t,"otherTypeCallback")?t.otherTypeCallback:this.currOtherTypeCallback,o=A.call(t,"parent")?t.parent:o,n=A.call(t,"parentProperty")?t.parentProperty:n,t=t.path}if(o=o||null,n=n||null,Array.isArray(t)&&(t=p.toPathString(t)),!t&&t!==""||!e)return;let l=p.toPathArray(t);l[0]==="$"&&l.length>1&&l.shift(),this._hasParentSelector=null;let d=this._trace(l,e,["$"],o,n,r).filter(function(h){return h&&!h.isParentSelector});return d.length?!a&&d.length===1&&!d[0].hasArrExpr?this._getPreferredOutput(d[0]):d.reduce((h,f)=>{let u=this._getPreferredOutput(f);return s&&Array.isArray(u)?h=h.concat(u):h.push(u),h},[]):a?[]:void 0};p.prototype._getPreferredOutput=function(t){let e=this.currResultType;switch(e){case"all":{let r=Array.isArray(t.path)?t.path:p.toPathArray(t.path);return t.pointer=p.toPointer(r),t.path=typeof t.path=="string"?t.path:p.toPathString(t.path),t}case"value":case"parent":case"parentProperty":return t[e];case"path":return p.toPathString(t[e]);case"pointer":return p.toPointer(t.path);default:throw new TypeError("Unknown result type")}};p.prototype._handleCallback=function(t,e,r){if(e){let i=this._getPreferredOutput(t);t.path=typeof t.path=="string"?t.path:p.toPathString(t.path),e(i,r,t)}};p.prototype._trace=function(t,e,r,i,o,n,s,a){let l;if(!t.length)return l={path:r,value:e,parent:i,parentProperty:o,hasArrExpr:s},this._handleCallback(l,n,"value"),l;let d=t[0],h=t.slice(1),f=[];function u(c){Array.isArray(c)?c.forEach(m=>{f.push(m)}):f.push(c)}if((typeof d!="string"||a)&&e&&A.call(e,d))u(this._trace(h,e[d],k(r,d),e,d,n,s));else if(d==="*")this._walk(e,c=>{u(this._trace(h,e[c],k(r,c),e,c,n,!0,!0))});else if(d==="..")u(this._trace(h,e,r,i,o,n,s)),this._walk(e,c=>{typeof e[c]=="object"&&u(this._trace(t.slice(),e[c],k(r,c),e,c,n,!0))});else{if(d==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:h,isParentSelector:!0};if(d==="~")return l={path:k(r,d),value:o,parent:i,parentProperty:null},this._handleCallback(l,n,"property"),l;if(d==="$")u(this._trace(h,e,r,null,null,n,s));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(d))u(this._slice(d,h,e,r,i,o,n));else if(d.indexOf("?(")===0){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");let c=d.replace(/^\?\((.*?)\)$/u,"$1");this._walk(e,m=>{this._eval(c,e[m],m,r,i,o)&&u(this._trace(h,e[m],k(r,m),e,m,n,!0))})}else if(d[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");u(this._trace(X(this._eval(d,e,r[r.length-1],r.slice(0,-1),i,o),h),e,r,i,o,n,s))}else if(d[0]==="@"){let c=!1,m=d.slice(1,-2);switch(m){case"scalar":(!e||!["object","function"].includes(typeof e))&&(c=!0);break;case"boolean":case"string":case"undefined":case"function":typeof e===m&&(c=!0);break;case"integer":Number.isFinite(e)&&!(e%1)&&(c=!0);break;case"number":Number.isFinite(e)&&(c=!0);break;case"nonFinite":typeof e=="number"&&!Number.isFinite(e)&&(c=!0);break;case"object":e&&typeof e===m&&(c=!0);break;case"array":Array.isArray(e)&&(c=!0);break;case"other":c=this.currOtherTypeCallback(e,r,i,o);break;case"null":e===null&&(c=!0);break;default:throw new TypeError("Unknown value type "+m)}if(c)return l={path:r,value:e,parent:i,parentProperty:o},this._handleCallback(l,n,"value"),l}else if(d[0]==="`"&&e&&A.call(e,d.slice(1))){let c=d.slice(1);u(this._trace(h,e[c],k(r,c),e,c,n,s,!0))}else if(d.includes(",")){let c=d.split(",");for(let m of c)u(this._trace(X(m,h),e,r,i,o,n,!0))}else!a&&e&&A.call(e,d)&&u(this._trace(h,e[d],k(r,d),e,d,n,s,!0))}if(this._hasParentSelector)for(let c=0;c<f.length;c++){let m=f[c];if(m&&m.isParentSelector){let E=this._trace(m.expr,e,m.path,i,o,n,s);if(Array.isArray(E)){f[c]=E[0];let S=E.length;for(let v=1;v<S;v++)c++,f.splice(c,0,E[v])}else f[c]=E}}return f};p.prototype._walk=function(t,e){if(Array.isArray(t)){let r=t.length;for(let i=0;i<r;i++)e(i)}else t&&typeof t=="object"&&Object.keys(t).forEach(r=>{e(r)})};p.prototype._slice=function(t,e,r,i,o,n,s){if(!Array.isArray(r))return;let a=r.length,l=t.split(":"),d=l[2]&&Number.parseInt(l[2])||1,h=l[0]&&Number.parseInt(l[0])||0,f=l[1]&&Number.parseInt(l[1])||a;h=h<0?Math.max(0,h+a):Math.min(a,h),f=f<0?Math.max(0,f+a):Math.min(a,f);let u=[];for(let c=h;c<f;c+=d)this._trace(X(c,e),r,i,o,n,s,!0).forEach(E=>{u.push(E)});return u};p.prototype._eval=function(t,e,r,i,o,n){this.currSandbox._$_parentProperty=n,this.currSandbox._$_parent=o,this.currSandbox._$_property=r,this.currSandbox._$_root=this.json,this.currSandbox._$_v=e;let s=t.includes("@path");s&&(this.currSandbox._$_path=p.toPathString(i.concat([r])));let a="script:"+t;if(!p.cache[a]){let l=t.replace(/@parentProperty/gu,"_$_parentProperty").replace(/@parent/gu,"_$_parent").replace(/@property/gu,"_$_property").replace(/@root/gu,"_$_root").replace(/@([.\s)[])/gu,"_$_v$1");s&&(l=l.replace(/@path/gu,"_$_path")),p.cache[a]=new this.vm.Script(l)}try{return p.cache[a].runInNewContext(this.currSandbox)}catch(l){throw new Error("jsonPath: "+l.message+": "+t)}};p.cache={};p.toPathString=function(t){let e=t,r=e.length,i="$";for(let o=1;o<r;o++)/^(~|\^|@.*?\(\))$/u.test(e[o])||(i+=/^[0-9*]+$/u.test(e[o])?"["+e[o]+"]":"['"+e[o]+"']");return i};p.toPointer=function(t){let e=t,r=e.length,i="";for(let o=1;o<r;o++)/^(~|\^|@.*?\(\))$/u.test(e[o])||(i+="/"+e[o].toString().replace(/~/gu,"~0").replace(/\//gu,"~1"));return i};p.toPathArray=function(t){let{cache:e}=p;if(e[t])return e[t].concat();let r=[],o=t.replace(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu,";$&;").replace(/[['](\??\(.*?\))[\]']/gu,function(n,s){return"[#"+(r.push(s)-1)+"]"}).replace(/\[['"]([^'\]]*)['"]\]/gu,function(n,s){return"['"+s.replace(/\./gu,"%@%").replace(/~/gu,"%%@@%%")+"']"}).replace(/~/gu,";~;").replace(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replace(/%@%/gu,".").replace(/%%@@%%/gu,"~").replace(/(?:;)?(\^+)(?:;)?/gu,function(n,s){return";"+s.split("").join(";")+";"}).replace(/;;;|;;/gu,";..;").replace(/;$|'?\]|'$/gu,"").split(";").map(function(n){let s=n.match(/#(\d+)/u);return!s||!s[1]?n:r[s[1]]});return e[t]=o,e[t].concat()};p.prototype.vm=Mt;function Ot(t){return t.replace(/(\[[^\]\[]+\]|\.\*)$/g,"")}function pt(t){return Ot(t)+".*"}function rt(t,e,r=!1,i=t){var o=e;let n=Object.keys(t).sort((a,l)=>l.length-a.length);for(let a of n)if(e.startsWith(a)){if(a==e){if(r)return t[a];continue}o=e.substring(a.length+1),i=t[a];break}var s=p({path:o,json:i});return Array.isArray(s)&&(s==null?void 0:s.length)==0&&(s=[o.replace(/^.*?\./,"_."),o.replace(/^.*?\./,""),o.replace(/^([^.]+).*?\.\$\./,"$1."),o.replace(/^.*?\.\$\./,"_."),o.replace(/^.*?\.\$\./,""),o.replace(/^[^.]+$/,"_")].filter((a,l,d)=>d.indexOf(a)===l).reduce((a,l)=>a.length>0?a:p({path:l,json:i}),[])),r&&Array.isArray(s)?s[0]:s}function et(t,e={},r){return r?`<${r}${Object.entries(e).map(([i,o])=>o!=null&&` ${i}="${o}"`).filter(Boolean).join("")}>${D(t)}</${r}>`.replace(/^<([a-z0-9][^>]*)><\/[^>]+>$/,"<$1 />"):D(t)}function D(t){var e;if(Array.isArray(t))return t.map(D).join(`
1
+ var Pt=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});function _(t,e=r=>{}){var r;let i=()=>{var o,n;let s=new Promise((l,d)=>{o=h=>{t==null||t(h),l(h)},n=d});var a=Object.assign(s,{resolve:o,reject:n,restart:i,first:r});return r=a,a.catch(e),a};return i()}var Tt=typeof HTMLElement=="undefined"?typeof windowJSDOM!="undefined"?windowJSDOM.HTMLElement:class{}:HTMLElement,b=class extends Tt{getProps(e){return{}}constructor(){super(),this.defaultProps={},this.connected=!1,this.refs={},this.descendants=[],this.whenLoaded=_(e=>{this.payload=e}),this.whenRendered=_(()=>this.initialized=!0,()=>cancelAnimationFrame(this.nextRender)),this.addEventListener("feaasMount",this),this.addEventListener("feaasUnmount",this)}getRoot(){return this}attributeChangedCallback(e,r,i){this.set()}connectedCallback(){this.mount()}disconnectedCallback(){this.unmount()}mount(){try{let e=this.getParent();if(e&&!e.connected||this.connected)return;this.connected=!0,this.log("FEAAS: Mount",this.tagName,this),this.dispatchEvent(new Event("feaasMount",{bubbles:!0,composed:!0})),this.getElements().map(r=>{var i;return(i=r.mount)===null||i===void 0?void 0:i.call(r)}),this.set()}catch(e){this.onError(e)}}log(...e){console.log(...e)}unmount(){this.connected&&(this.log("FEAAS: Unmount",this),this.dispatchEvent(new Event("feaasUnmount",{bubbles:!0,composed:!0})),this.connected=!1)}getParent(e=!0){for(var r=this;r=r.parentElement||(r.parentNode instanceof ShadowRoot?r.parentNode.host:null);)if(!e||r.tagName.startsWith("FEAAS-"))return r}getElements(e=this.getRoot(),r=!0){return Array.from(e.querySelectorAll("*")).map(i=>[!r||i.tagName.startsWith("FEAAS-")?i:null,i.shadowRoot?this.getElements(i.shadowRoot,r):null]).flat().filter(Boolean)}handleEvent(e){let r=e.composedPath()[0];switch(e.type){case"feaasMount":r!=this&&this.nestedCallback(r);break;case"feaasUnmount":r!=this&&this.unnestedCallback(r);break}}unnestedCallback(e){let r=this.descendants.indexOf(e);r!=-1&&(this.log("FEAAS: Unnest",this,e),this.descendants.splice(r,-1),this.refs[e.getComponentName()]=null,e.refs.parent==this&&(e.refs.parent=null),e.refs.top==this&&(e.refs.top=e.refs.parent))}nestedCallback(e){var r,i;if(this.descendants.indexOf(e)==-1&&(this.descendants.push(e),this.log("FEAAS: Nest",this,e),this.refs[e.getComponentName()]=e,e.refs.top=this,(r=e.refs).parent||(r.parent=this),e.render))for(var n=e.refs.parent;n;n=n.refs.parent)n.render&&((i=e.refs).parentReact||(i.parentReact=n),e.refs.topReact=n)}getComponentName(){return this.tagName.replace("FEAAS-","").toLowerCase()}isReadyToLoad(){return this.payload===void 0&&this.getAttribute("hidden")==null}onError(e,r="uncaught",i=!1){let o=new CustomEvent("feaasError",{bubbles:!0,composed:!0,detail:e});if(this.dispatchEvent(o),this.whenLoaded.reject(e),!o.defaultPrevented&&!i){this.whenRendered.reject(e);try{this.unmount()}catch(n){}return!0}return!1}shouldUpdateOnLoad(){return!0}async advance(){try{if(this.payload===void 0){if(!this.isReadyToLoad())return;this.payload=null,this.dispatchEvent(new Event("feaasLoad",{bubbles:!0,composed:!0}));let e=await this.load().catch(r=>{throw this.payload=void 0,r});if(this.whenLoaded.resolve(e),this.onLoad)return}else if(this.payload==null)return;this.flush(),this.whenRendered.resolve(this)}catch(e){this.onError(e)}}flush(){var e,r;let i=(r=(e=this.payload)===null||e===void 0?void 0:e.ReactDOM)===null||r===void 0?void 0:r.flushSync;i?i(()=>this.update()):this.update()}load(){return Promise.resolve(null)}update(){var e,r,i;if(this.payload==null||!this.render)return;let{React:o,ReactDOM:n,ReactDOMClient:s}=this.payload||{};if(!o)throw new Error(`${this.tagName}: React is not present in payload`);if(!n)throw new Error(`${this.tagName}: ReactDOM is not present in payload`);!this.refs.topReact&&!this.forceUpdateReact?s?(this.reactRoot||(this.reactRoot=s.createRoot(this.getReactRootElement())),this.reactRoot.render(this.getReactElement())):n.render(this.getReactElement(),this.getReactRootElement()):this.forceUpdateReact?(e=this.forceUpdateReact)===null||e===void 0||e.call(this):(i=(r=this.refs.topReact).forceUpdateReact)===null||i===void 0||i.call(r)}invokeReactRendering(){let{React:e,ReactDOM:r}=this.payload||{};if(!this.connected)return null;let i=this.descendants.filter(o=>o.refs.parentReact==this&&o.payload).map((o,n)=>this.getReactElement(o));return this.render({...this.props,children:i},this.payload)}getReactErrorBoundary(e=this,r=e.tagName){if(this.reactErrorBoundary)return this.reactErrorBoundary;let{React:i,ReactDOM:o}=e.payload||{};return this.reactErrorBoundary||(this.reactErrorBoundary=class extends i.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromError(s){return{error:s}}componentDidCatch(s,a){console.error(`FEAAS: ${e.tagName} Error:`,s,a),e.onError(s,"react")}render(){if(!this.state.error)return this.props.children}})}getReactElement(e=this,r){let{React:i,ReactDOM:o}=e.payload||{},n=this.getReactErrorBoundary(),s=this.getReactWrapper(e);return i.createElement(n,{key:e.tagName+"-"+e.getUID(),slot:e.getAttribute("slot")},i.createElement(s,null))}getReactWrapper(e=this,r=e.tagName){if(e.reactWrapper)return e.reactWrapper;let{React:i,ReactDOM:o}=e.payload||{};return e.reactWrapper=n=>{if(e.render){let[s,a]=i.useReducer(l=>l+1,0);return e.forceUpdateReact=a,o.createPortal(i.createElement(i.Fragment,null,e.invokeReactRendering()),e.getReactRootElement())}else return e.update()},Object.assign(e.reactWrapper,{key:e.tagName+"-"+e.getUID(),displayName:r}),e.reactWrapper}getUID(){return this.uid||(this.uid=String(Math.random()))}getShadowRoot(){return this.shadowRoot||this.attachShadow({mode:"open"}),this.shadowRoot}getReactRootElement(){return this.useShadowRoot?this.getShadowRoot():this.getRoot()}set(e){try{this.scheduleRender(),this.overrides={...this.overrides,...e},this.props={...this.getProps(),...this.overrides};for(var r in this.props){let i=this.props[r],o=r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();i==null||i===this.defaultProps[r]?this.removeAttribute(o):(typeof i=="string"||typeof i=="number"||typeof i=="boolean")&&this.getAttribute(o)!=String(i)&&this.setAttribute(o,String(i))}}catch(i){this.whenRendered.reject(i),this.onError(i,"set")}return this}import(e){return import( /*@vite-ignore*/ /* webpackIgnore: true */ e)}scheduleRender(){this.nextRender==null&&(this.whenRendered=this.whenRendered.restart()),cancelAnimationFrame(this.nextRender),this.nextRender=requestAnimationFrame(()=>{this.nextRender=null,this.advance().catch(e=>{})})}formatURL(e,r){return typeof e=="string"&&e.match(/^\/[^\/]/)?r+e:e}getContextAttribute(e,r=this){for(var i=this;i=i.parentElement||(i.parentNode instanceof ShadowRoot?i.parentNode.host:null);)if(i.getAttribute(e)!=null)return i.getAttribute(e);return this.getAttribute(e)}static register(e,r){r==null&&(r=typeof window!="undefined"?window:null),r&&!r.customElements.get(e)&&r.customElements.define(e,this)}};var P=class extends b{load(){return Promise.all([import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react"),import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react-dom")]).then(([e,r])=>({React:e,ReactDOM:r}))}render({},{React:e}){return e.createElement(e.Fragment,null)}},Q=class extends P{constructor(){super(...arguments),this.useShadowRoot=!0}getProps(){return{counter:parseFloat(this.getAttribute("counter"))}}render({counter:e},{React:r}){let[i,o]=r.useState(0);return r.useEffect(()=>{o(n=>n+1)},[e]),r.createElement(r.Fragment,null,r.createElement("p",null,"Rendering attribute: ",e),r.createElement("p",null,"Triggered updates: ",i))}};Q.observedAttributes=["counter"];import Mt from"vm";var{hasOwnProperty:A}=Object.prototype;function k(t,e){return t=t.slice(),t.push(e),t}function X(t,e){return e=e.slice(),e.unshift(t),e}var tt=class extends Error{constructor(e){super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),this.avoidNew=!0,this.value=e,this.name="NewError"}};function p(t,e,r,i,o){if(!(this instanceof p))try{return new p(t,e,r,i,o)}catch(s){if(!s.avoidNew)throw s;return s.value}typeof t=="string"&&(o=i,i=r,r=e,e=t,t=null);let n=t&&typeof t=="object";if(t=t||{},this.json=t.json||r,this.path=t.path||e,this.resultType=t.resultType||"value",this.flatten=t.flatten||!1,this.wrap=A.call(t,"wrap")?t.wrap:!0,this.sandbox=t.sandbox||{},this.preventEval=t.preventEval||!1,this.parent=t.parent||null,this.parentProperty=t.parentProperty||null,this.callback=t.callback||i||null,this.otherTypeCallback=t.otherTypeCallback||o||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},t.autostart!==!1){let s={path:n?t.path:e};n?"json"in t&&(s.json=t.json):s.json=r;let a=this.evaluate(s);if(!a||typeof a!="object")throw new tt(a);return a}}p.prototype.evaluate=function(t,e,r,i){let o=this.parent,n=this.parentProperty,{flatten:s,wrap:a}=this;if(this.currResultType=this.resultType,this.currPreventEval=this.preventEval,this.currSandbox=this.sandbox,r=r||this.callback,this.currOtherTypeCallback=i||this.otherTypeCallback,e=e||this.json,t=t||this.path,t&&typeof t=="object"&&!Array.isArray(t)){if(!t.path&&t.path!=="")throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!A.call(t,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:e}=t),s=A.call(t,"flatten")?t.flatten:s,this.currResultType=A.call(t,"resultType")?t.resultType:this.currResultType,this.currSandbox=A.call(t,"sandbox")?t.sandbox:this.currSandbox,a=A.call(t,"wrap")?t.wrap:a,this.currPreventEval=A.call(t,"preventEval")?t.preventEval:this.currPreventEval,r=A.call(t,"callback")?t.callback:r,this.currOtherTypeCallback=A.call(t,"otherTypeCallback")?t.otherTypeCallback:this.currOtherTypeCallback,o=A.call(t,"parent")?t.parent:o,n=A.call(t,"parentProperty")?t.parentProperty:n,t=t.path}if(o=o||null,n=n||null,Array.isArray(t)&&(t=p.toPathString(t)),!t&&t!==""||!e)return;let l=p.toPathArray(t);l[0]==="$"&&l.length>1&&l.shift(),this._hasParentSelector=null;let d=this._trace(l,e,["$"],o,n,r).filter(function(h){return h&&!h.isParentSelector});return d.length?!a&&d.length===1&&!d[0].hasArrExpr?this._getPreferredOutput(d[0]):d.reduce((h,f)=>{let u=this._getPreferredOutput(f);return s&&Array.isArray(u)?h=h.concat(u):h.push(u),h},[]):a?[]:void 0};p.prototype._getPreferredOutput=function(t){let e=this.currResultType;switch(e){case"all":{let r=Array.isArray(t.path)?t.path:p.toPathArray(t.path);return t.pointer=p.toPointer(r),t.path=typeof t.path=="string"?t.path:p.toPathString(t.path),t}case"value":case"parent":case"parentProperty":return t[e];case"path":return p.toPathString(t[e]);case"pointer":return p.toPointer(t.path);default:throw new TypeError("Unknown result type")}};p.prototype._handleCallback=function(t,e,r){if(e){let i=this._getPreferredOutput(t);t.path=typeof t.path=="string"?t.path:p.toPathString(t.path),e(i,r,t)}};p.prototype._trace=function(t,e,r,i,o,n,s,a){let l;if(!t.length)return l={path:r,value:e,parent:i,parentProperty:o,hasArrExpr:s},this._handleCallback(l,n,"value"),l;let d=t[0],h=t.slice(1),f=[];function u(c){Array.isArray(c)?c.forEach(m=>{f.push(m)}):f.push(c)}if((typeof d!="string"||a)&&e&&A.call(e,d))u(this._trace(h,e[d],k(r,d),e,d,n,s));else if(d==="*")this._walk(e,c=>{u(this._trace(h,e[c],k(r,c),e,c,n,!0,!0))});else if(d==="..")u(this._trace(h,e,r,i,o,n,s)),this._walk(e,c=>{typeof e[c]=="object"&&u(this._trace(t.slice(),e[c],k(r,c),e,c,n,!0))});else{if(d==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:h,isParentSelector:!0};if(d==="~")return l={path:k(r,d),value:o,parent:i,parentProperty:null},this._handleCallback(l,n,"property"),l;if(d==="$")u(this._trace(h,e,r,null,null,n,s));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(d))u(this._slice(d,h,e,r,i,o,n));else if(d.indexOf("?(")===0){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");let c=d.replace(/^\?\((.*?)\)$/u,"$1");this._walk(e,m=>{this._eval(c,e[m],m,r,i,o)&&u(this._trace(h,e[m],k(r,m),e,m,n,!0))})}else if(d[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");u(this._trace(X(this._eval(d,e,r[r.length-1],r.slice(0,-1),i,o),h),e,r,i,o,n,s))}else if(d[0]==="@"){let c=!1,m=d.slice(1,-2);switch(m){case"scalar":(!e||!["object","function"].includes(typeof e))&&(c=!0);break;case"boolean":case"string":case"undefined":case"function":typeof e===m&&(c=!0);break;case"integer":Number.isFinite(e)&&!(e%1)&&(c=!0);break;case"number":Number.isFinite(e)&&(c=!0);break;case"nonFinite":typeof e=="number"&&!Number.isFinite(e)&&(c=!0);break;case"object":e&&typeof e===m&&(c=!0);break;case"array":Array.isArray(e)&&(c=!0);break;case"other":c=this.currOtherTypeCallback(e,r,i,o);break;case"null":e===null&&(c=!0);break;default:throw new TypeError("Unknown value type "+m)}if(c)return l={path:r,value:e,parent:i,parentProperty:o},this._handleCallback(l,n,"value"),l}else if(d[0]==="`"&&e&&A.call(e,d.slice(1))){let c=d.slice(1);u(this._trace(h,e[c],k(r,c),e,c,n,s,!0))}else if(d.includes(",")){let c=d.split(",");for(let m of c)u(this._trace(X(m,h),e,r,i,o,n,!0))}else!a&&e&&A.call(e,d)&&u(this._trace(h,e[d],k(r,d),e,d,n,s,!0))}if(this._hasParentSelector)for(let c=0;c<f.length;c++){let m=f[c];if(m&&m.isParentSelector){let E=this._trace(m.expr,e,m.path,i,o,n,s);if(Array.isArray(E)){f[c]=E[0];let S=E.length;for(let v=1;v<S;v++)c++,f.splice(c,0,E[v])}else f[c]=E}}return f};p.prototype._walk=function(t,e){if(Array.isArray(t)){let r=t.length;for(let i=0;i<r;i++)e(i)}else t&&typeof t=="object"&&Object.keys(t).forEach(r=>{e(r)})};p.prototype._slice=function(t,e,r,i,o,n,s){if(!Array.isArray(r))return;let a=r.length,l=t.split(":"),d=l[2]&&Number.parseInt(l[2])||1,h=l[0]&&Number.parseInt(l[0])||0,f=l[1]&&Number.parseInt(l[1])||a;h=h<0?Math.max(0,h+a):Math.min(a,h),f=f<0?Math.max(0,f+a):Math.min(a,f);let u=[];for(let c=h;c<f;c+=d)this._trace(X(c,e),r,i,o,n,s,!0).forEach(E=>{u.push(E)});return u};p.prototype._eval=function(t,e,r,i,o,n){this.currSandbox._$_parentProperty=n,this.currSandbox._$_parent=o,this.currSandbox._$_property=r,this.currSandbox._$_root=this.json,this.currSandbox._$_v=e;let s=t.includes("@path");s&&(this.currSandbox._$_path=p.toPathString(i.concat([r])));let a="script:"+t;if(!p.cache[a]){let l=t.replace(/@parentProperty/gu,"_$_parentProperty").replace(/@parent/gu,"_$_parent").replace(/@property/gu,"_$_property").replace(/@root/gu,"_$_root").replace(/@([.\s)[])/gu,"_$_v$1");s&&(l=l.replace(/@path/gu,"_$_path")),p.cache[a]=new this.vm.Script(l)}try{return p.cache[a].runInNewContext(this.currSandbox)}catch(l){throw new Error("jsonPath: "+l.message+": "+t)}};p.cache={};p.toPathString=function(t){let e=t,r=e.length,i="$";for(let o=1;o<r;o++)/^(~|\^|@.*?\(\))$/u.test(e[o])||(i+=/^[0-9*]+$/u.test(e[o])?"["+e[o]+"]":"['"+e[o]+"']");return i};p.toPointer=function(t){let e=t,r=e.length,i="";for(let o=1;o<r;o++)/^(~|\^|@.*?\(\))$/u.test(e[o])||(i+="/"+e[o].toString().replace(/~/gu,"~0").replace(/\//gu,"~1"));return i};p.toPathArray=function(t){let{cache:e}=p;if(e[t])return e[t].concat();let r=[],o=t.replace(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu,";$&;").replace(/[['](\??\(.*?\))[\]']/gu,function(n,s){return"[#"+(r.push(s)-1)+"]"}).replace(/\[['"]([^'\]]*)['"]\]/gu,function(n,s){return"['"+s.replace(/\./gu,"%@%").replace(/~/gu,"%%@@%%")+"']"}).replace(/~/gu,";~;").replace(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replace(/%@%/gu,".").replace(/%%@@%%/gu,"~").replace(/(?:;)?(\^+)(?:;)?/gu,function(n,s){return";"+s.split("").join(";")+";"}).replace(/;;;|;;/gu,";..;").replace(/;$|'?\]|'$/gu,"").split(";").map(function(n){let s=n.match(/#(\d+)/u);return!s||!s[1]?n:r[s[1]]});return e[t]=o,e[t].concat()};p.prototype.vm=Mt;function Ot(t){return t.replace(/(\[[^\]\[]+\]|\.\*)$/g,"")}function pt(t){return Ot(t)+".*"}function rt(t,e,r=!1,i=t){var o=e;let n=Object.keys(t).sort((a,l)=>l.length-a.length);for(let a of n)if(e.startsWith(a)){if(a==e){if(r)return t[a];continue}o=e.substring(a.length+1),i=t[a];break}var s=p({path:o,json:i});return Array.isArray(s)&&(s==null?void 0:s.length)==0&&(s=[o.replace(/^.*?\./,"_."),o.replace(/^.*?\./,""),o.replace(/^([^.]+).*?\.\$\./,"$1."),o.replace(/^.*?\.\$\./,"_."),o.replace(/^.*?\.\$\./,""),o.replace(/^[^.]+$/,"_")].filter((a,l,d)=>d.indexOf(a)===l).reduce((a,l)=>a.length>0?a:p({path:l,json:i}),[])),r&&Array.isArray(s)?s[0]:s}function et(t,e={},r){return r?`<${r}${Object.entries(e).map(([i,o])=>o!=null&&` ${i}="${o}"`).filter(Boolean).join("")}>${D(t)}</${r}>`.replace(/^<([a-z0-9][^>]*)><\/[^>]+>$/,"<$1 />"):D(t)}function D(t){var e;if(Array.isArray(t))return t.map(D).join(`
2
2
  `).trim();if(typeof t=="string")return t;if(t==null)return"";switch(t.type){case"heading":let{level:r,...i}=t.attrs;return et(t.content,i,"h"+r);case"text":return(t.marks||[]).reduce((o,n)=>et(o,n.attrs,{link:"a",bold:"strong",italic:"em",strike:"s",underline:"u"}[n.type]),(e=t.text)===null||e===void 0?void 0:e.replace(/\s+/," "));default:return et(t.content||t.text,t.attrs,{bulletList:"ul",orderedList:"ol",listItem:"li",horizontalRule:"hr",paragraph:"p",codeBlock:"code",blockquote:"blockquote"}[t.type])}}function Lt(t){let e=new t.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(i=>{let o=i.target,n=o.getAttribute("data-embed-src");n&&I(o,n),i.addedNodes&&i.addedNodes.forEach(s=>{s.nodeType==1&&Dt(s,!1)})})});return e.observe(t,{attributes:!0,subtree:!0,childList:!0}),e}function Dt(t,e=!0){let r=t.querySelectorAll("[data-embed-src]");for(var i=0;i<r.length;i++){let o=r[i];I(o,o.getAttribute("data-embed-src"))}if(e)return Lt(t)}function I(t,e){for(var r=t;r;r=r.parentElement)if(!r.parentElement){let o=r.querySelectorAll("script");for(var i=0;i<o.length;i++)if(o[i].getAttribute("src")==e)return!0;r.tagName=="HTML"&&(r=r.querySelector("head")||r);let n=r.ownerDocument.createElement("script");n.type="module",n.src=e,r.appendChild(n);break}}function mt(t){let e=t.getAttribute("data-path-scope");for(var r=0,i=t;i=i.previousElementSibling;)i.getAttribute("data-path-scope")==e&&r++;return r}function $t(t,e,r){let i=t.getAttribute("data-path-scope");if(i==null)return;var o=mt(t);if(o!=0)return;let n=t.parentElement;if(n!=null){e==0?t.setAttribute("hidden","hidden"):t.getAttribute("hidden")!=null&&t.removeAttribute("hidden");for(var s=o+1,a=t,l=t;l=l.nextElementSibling;)l.getAttribute("data-path-scope")==i&&(s++,a=l);for(var d=s;d<e;d++)n.insertBefore(a.cloneNode(!0),a.nextElementSibling);for(var d=Math.max(1,e);d<s;d++)a=a.previousElementSibling,n.removeChild(a.nextElementSibling)}}function $(t,e,r,i){var o;if(t){var n=t;(r==null?void 0:r.type)=="doc"&&Array.isArray(r.content)&&(r=D(r)),i!=null&&i.processValue&&(r=i==null?void 0:i.processValue(t,e,r));var s=e.replace("data-path-","");if(e=="data-path-src")n=t.tagName=="IMG"?t:t.querySelector("img, video");else if(e=="data-path-href")n=t.querySelector("a")||t.closest("a");else if(e=="data-path-alt")n=t.querySelector("img, picture");else if(e=="data-path-hidden")r=r?null:!0;else if(e=="data-path"||e=="data-embed-html"||e=="html")s="innerHTML";else if(e=="data-embed-src")I(t,r);else if(e=="data-path-attributes"){let f=((o=t.getAttribute("data-attributes-keys"))===null||o===void 0?void 0:o.split(",").filter(Boolean))||[];if(!Array.isArray(r))for(var a in r){var l=r[a];$(t,a,typeof l=="object"&&l?JSON.stringify(l):l,i)}for(var d=0;d<f.length;d++)(r==null||!(f[d]in r))&&$(t,f[d],null,i);$(t,"data-attributes-keys",Object.keys(r||{}).join(","));return}if(typeof r=="boolean"&&(r=r?"":null),!!n){var h=String(t.getAttribute("data-path-placeholder")||n[s]);r!=null?s=="innerHTML"?n.innerHTML!=r&&(n.innerHTML=r):n.getAttribute(s)!=r&&n.setAttribute(s,r):s=="innerHTML"?n.innerHTML=h:n.removeAttribute(s)}}}var ft=["data-attributes-keys","data-path-attributes","data-path-scope"];function x(t,e,r,i){var o,n,s;let a=t;if(i||(e=((o=r==null?void 0:r.processData)===null||o===void 0?void 0:o.call(r,a,e))||e),a.nodeType==1){let h=a.getAttribute("data-path-scope");if(h){let u=mt(a),c=rt(e,h,!1)||[];u==0&&$t(a,((n=r==null?void 0:r.shouldRepeat)===null||n===void 0?void 0:n.call(r,a,c))===!1?1:c.length,r),e={...e,[pt(h)]:c[u]}}let f=Array.prototype.slice.call(a.attributes).sort((u,c)=>ft.indexOf(u.name)-ft.indexOf(c.name));for(var l=0;l<f.length;l++){let{name:u,value:c}=f[l];u.startsWith("data-path")&&u!="data-path-scope"&&$(a,u,rt(e,c,!0),r),u=="data-embed-src"&&$(a,u,a.getAttribute(u),r)}}for(var l=0,d;d=a.childNodes[l++];)yt(d)&&x(d,e,r,!0);return i||(s=r==null?void 0:r.onRender)===null||s===void 0||s.call(r,a,e),a}function yt(t){return t.nodeType==1}function N(t,e,r,i){var o;let n=((o=i==null?void 0:i.processTemplate)===null||o===void 0?void 0:o.call(i,t,e,r))||e;if(t.innerHTML=n,t.classList.add("-feaas"),(t.closest(".component.feaas")||t).className.includes("-theme--"))for(var a=0,l;l=t.childNodes[a++];)yt(l)&&(l.className=l.className.replace(/(\s|^)-theme--[^\s]+\s*/g,"$1"));return x(t,r,i)}function gt(t,e,r,i=!1){var o;let n=((o=r==null?void 0:r.processTemplate)===null||o===void 0?void 0:o.call(r,null,t,e))||t;if(typeof document=="undefined"||i){let{parseHTML:s}=Pt("linkedom"),{document:a}=s(n);return x(a,e,r).toString()}else{let s=document.createElement("div");return s.innerHTML=n,x(s,e,r),s.innerHTML}}var bt=["initial","check","updated"],B={};function ge(){B={}}async function vt(t,e,r,i,o=B){return T({url:t,options:e,validator:r,callback:i,cache:o}).then(j).then(n=>n.response)}function Nt(t,e=!1){let r=String(t).replace("?head","");var i=B[r];return!i&&!e&&(i=B[r]={phase:null,initial:_(),check:_(),updated:_(),final:_()}),i}async function T({url:t,options:e,validator:r,callback:i,cache:o},n="initial"){let s=new Date;if(o!=null){var a=Nt(t);if(bt.indexOf(a.phase)>=bt.indexOf(n))var l=a[n];else a.phase=n}let d=await(l||fetch(t,e));if(!l&&a&&(d.ok?a[n].resolve(d):a[n].reject(new Error("Fetch failed"))),!d.ok)throw new Error("Fetch failed");if((r==null?void 0:r(d))===!1)throw new Error("Response is not valid");let h=new Date(d.headers.get("date"))<s||l&&n=="initial"&&(a.phase=="updated"||a.phase=="check");return await(i==null?void 0:i(d,n,h)),{url:t,options:e,isCached:h,response:d,validator:r,callback:i,cache:o}}async function j(t){let{url:e,isCached:r,options:i,validator:o,response:n,cache:s}=t;if(r){let{response:a}=await T({url:e+"?head",options:{...i,method:"HEAD",cache:"no-cache"},validator:o,cache:s},"check");if(a.headers.get("last-modified")!=n.headers.get("last-modified"))return it(t)}return t}async function it(t){return T({...t,options:{...t.options,cache:"reload"}},"updated")}var R="https://feaas.blob.core.windows.net";function W(t){let e=t.match(/^(?:(.*?)\/components)?\/?([^\/]+)\/([^\/]+)(?:\/([^\/]+)(?:\/(published|staged|saved|\d+)(?:\.html?)?)?)?$/);if(e){var[,r,i,o,n,s]=e;return{cdn:r,library:i,component:o,version:n,revision:s}}}function Ae(t){if(!t||!t.library||!t.component)throw new Error("Component requires `library` and `component` properties");return`${t.cdn&&t.cdn!=R?`${t.cdn}/components`:""}/${t.library}/${t.component}/${!t.version||t.version=="responsive"&&(!t.revision||t.revision=="published")?"":t.version}/${!t.revision||t.revision=="published"?"":t.revision}`.replace(/(^\/|\/$|\/\/)(?!.+\/components\/)/g,"")}function Ee(t){return`${t.cdn&&t.cdn!=R?`${t.cdn}/styles/`:""}${t.library}/${!t.revision||t.revision=="published"?"":t.revision}`.replace(/\/$|\/\/(?!.+\/styles\/)/g,"")}function ot(t){let e=t.match(/^(?:(.*?)\/styles\/)?([^\/]+)(?:\/(published|staged|saved|\d+)(?:.css)?)?$/);if(e){var[,r,i,o]=e;return{cdn:r,library:i,revision:o}}else{let n=W(t);if(n){var{cdn:r,library:i,revision:o}=n;return o!=null&&o.match(/\d/)&&(o=void 0),{cdn:r,library:i,revision:o}}}}function At(t){return typeof t=="string"&&(t={src:t}),"src"in t&&(t={...W(t.src)}),`${t.cdn||t.hostname||R}/components/${t.library}/${t.component}/${t.version}/${t.revision||"published"}.html`}function H(t){return typeof t=="string"&&(t={src:t}),"src"in t&&(t={...ot(t.src)}),`${t.cdn||t.hostname||R}/styles/${t.library}/${t.revision||"published"}.css`}async function F(t,e,r=!1){let i=a=>a.headers.get("x-ms-meta-versionDeletedAt")==null,o=a=>a.clone().text().then(e),n=await Promise.all([t.instance&&T({options:{headers:{Accept:"text/html"},credentials:"omit"},url:At({...t,version:t.instance}),validator:i}).catch(a=>a),T({url:At(t),validator:i}).catch(a=>a)]),s=n.find(a=>a&&"isCached"in a&&a);if(!s||s instanceof Error)throw n.find(l=>l&&l instanceof Error)||new Error("Can not fetch component");return n[0]==s&&console.log("Using fork!",n),await o(s.response),r?s:j({...s,callback:o}).catch(a=>{if(n[0]==s&&(it({...s,callback:null,validator:null}),console.log("Fork was deleted"),!(n[1]instanceof Error)))return o(n[1].response),j({...n[1],callback:o});throw a})}async function Ce(t){typeof t=="string"&&(t={src:t});var e;let{response:r}=await F(t,i=>{e=i},!0);return{...t,template:e,lastModified:r.headers.get("last-modified")}}async function nt(t,e){return typeof t=="string"&&(t={src:t}),vt(H(t),{headers:{Accept:"text/css"},credentials:"omit"},r=>r.headers.get("x-ms-meta-deletedAt")==null,(r,i)=>r.clone().text().then(o=>e(o,i)))}function Re(t,e){return Ft(t,e||(e=document.createElement("style"))),e}function Ft(t,e){return e||(e=document.createElement("style")),nt(t,(r,i)=>{e.textContent=r}).then(()=>e)}function st(t,e){var r=Ut(t);if(!r)var i=It(t);return nt(t,(o,n)=>{i&&(i.textContent=o),e==null||e(o,n)}).then(()=>r||i)}function Et(t){return new Promise((e,r)=>{st(t,e).catch(r)})}function Ut(t){return document.head.querySelector(`style[data-href="${H(t)}"]`)}function It(t){let e=H(t),r=document.createElement("style");return r.setAttribute("data-href",e),document.head.appendChild(r),r}function Pe(t,e){let r=document.createElement("div");r.innerHTML=t;let i=document.createDocumentFragment();for(;r.firstChild;)i.appendChild(r.firstChild);return x(i,e),r}function Te(t,e){return Bt(t,e||(e=document.createElement("div"))),e}async function Bt(t,e){return e||(e=document.createElement("div")),e.childNodes.length?x(e,t.data,t):"template"in t?N(e,t.template,t.data,t):F(t,r=>N(e,r,t.data,t)).then(()=>e)}function jt(t=this){var e,r,i,o,n,s,a,l;let d,h=t.getAttribute("src");if(h){let v=W(h);if(!v)throw new Error(`Could not parse FEAAS Component source: ${h}`);var{cdn:f,library:u,component:c,version:m,revision:E}=v}let S=t.getAttribute("data");if(S!=null&&S!="")try{d=typeof S=="string"?JSON.parse(S):{}}catch(v){}return{data:d||{},cdn:(r=(e=t.getContextAttribute("cdn"))!==null&&e!==void 0?e:f)!==null&&r!==void 0?r:R,library:(i=t.getAttribute("library"))!==null&&i!==void 0?i:u,component:(o=t.getAttribute("component"))!==null&&o!==void 0?o:c,version:(s=(n=t.getAttribute("version"))!==null&&n!==void 0?n:m)!==null&&s!==void 0?s:"responsive",revision:(l=(a=t.getAttribute("revision"))!==null&&a!==void 0?a:E)!==null&&l!==void 0?l:"published",hostname:t.getAttribute("hostname"),template:t.getAttribute("template"),instance:t.getAttribute("instance"),editable:t.getAttribute("editable")!=null,suspended:t.getAttribute("suspended")!=null,lastModified:t.getAttribute("last-modified"),withStylesheet:t.getAttribute("with-stylesheet")!="false"}}var z=class extends b{setData(e){this.set({data:e})}getProps(){return jt(this)}attributeChangedCallback(e,r,i){r!==i&&((e=="library"||e=="component"||e=="revision"||e=="version")&&(this.payload=void 0),this.needsRefresh=!0,super.attributeChangedCallback(e,r,i))}getEditor(){var e;return(e=document.querySelector("feaas-context"))===null||e===void 0?void 0:e.refs.editor}constructor(){super(),this.defaultProps={cdn:R,revision:"published",version:"responsive",withStylesheet:!0,editable:!1,suspended:!1},this.onLoad=e=>{this.payload=e,this.advance()},this.addEventListener("click",()=>{this.props.editable&&this.edit()})}edit(){let e=this.getEditor();if(e!=null&&e.setTarget(this))return e.open(),!0}getOriginal(){let e=this.getAttribute("data-path-scope");if(e){for(var r=this;(r=r.previousElementSibling)&&r.getAttribute("data-path-scope")==e;)var i=r;return i}}isReadyToLoad(){return super.isReadyToLoad()&&this.props.library!=null&&this.props.component!=null&&this.props.version!=null}async load(){if(!this.getOriginal()){if(this.props.withStylesheet)var e=Et({...this.props,revision:"published"}).then(()=>{e=null,this.payload&&this.onLoad(this.payload)});return Promise.all([e,F(this.props,r=>{this.payload=r,e||this.onLoad(r)})]).then(()=>this.payload)}}update(){if(Array.from(this.children).filter(e=>e.tagName!="BR").length>0&&!this.needsRefresh)x(this,this.props.data);else{if(this.needsRefresh=!0,this.getOriginal())return;N(this,this.payload,this.props.data)}}};z.observedAttributes=["library","component","version","revision","hostname","cdn","template","data","instance","editable","with-stylesheet"];z.register("feaas-component");function Wt(t=this){return{opacity:t!=null&&t.getAttribute("opacity")?parseFloat(t==null?void 0:t.getAttribute("opacity")):1,hidden:(t==null?void 0:t.getAttribute("hidden"))!=null}}var V=class extends b{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return Wt(this)}attributeChangedCallback(e,r,i){if(r!==i)return e=="hidden"&&(this.style.setProperty("display","block","important"),this.style.setProperty("transition","opacity 0.3s","important"),i?(this.style.setProperty("opacity","0","important"),this.style.pointerEvents="none"):(this.style.setProperty("opacity","1","important"),this.style.pointerEvents="all")),super.attributeChangedCallback(e,r,i)}connectedCallback(){this.payload=null,super.connectedCallback(),this.attributeChangedCallback("hidden",this.getAttribute("hidden"),this.getAttribute("hidden")),this.stylesheet=document.createElement("style"),this.stylesheet.textContent=`
3
3
  #loader {
4
4
  position: absolute;