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