@sitecore-feaas/clientside 0.4.12 → 0.5.0

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,5 +1,5 @@
1
- var ke=Object.defineProperty;var K=(t,e)=>{for(var r in e)ke(t,r,{get:e[r],enumerable:!0})};var Wt={};K(Wt,{Component:()=>it,ComponentProps:()=>fe,Context:()=>I,ControlledPromise:()=>S,DEFAULT_CDN_URL:()=>P,DOM:()=>ft,DataPath:()=>pt,DataScope:()=>ht,DataSettings:()=>x,Element:()=>E,FEAASComponent:()=>it,FEAASComponentsProps:()=>fe,FEAASContext:()=>I,FEAASContextProps:()=>Se,FEAASEditor:()=>ot,FEAASEditorProps:()=>Ce,FEAASElement:()=>E,FEAASLoader:()=>nt,FEAASLoaderProps:()=>me,FEAASPicker:()=>st,FEAASPickerProps:()=>xe,FEAASStylesheet:()=>At,FEAASStylesheetProps:()=>ge,InvalidResponse:()=>mt,JSONPath:()=>m,Loader:()=>nt,MyComponent:()=>ct,Picker:()=>st,Stylesheet:()=>At,Thumbnail:()=>Et,WebComponent:()=>Vt,adjustNumbers:()=>Xt,autoloadScripts:()=>Gt,cleanCollectionBit:()=>X,clearFetchCache:()=>Me,createStylesheet:()=>he,fetchAndRevalidate:()=>tt,fetchAndRevalidateComponent:()=>V,fetchAndRevalidateStylesheet:()=>yt,fetchBypassingCache:()=>gt,fetchCache:()=>Z,fetchComponent:()=>$e,fetchData:()=>Ut,fetchToValidateCache:()=>et,fetchWithCacheAwareness:()=>j,findStylesheet:()=>ce,getComponentSource:()=>De,getComponentURL:()=>Dt,getFetchCache:()=>le,getFramePosition:()=>we,getHumanizedLabel:()=>Zt,getLastPathBit:()=>te,getQualifier:()=>Qt,getStylesheetSource:()=>Le,getStylesheetURL:()=>z,loadScript:()=>Q,loadStylesheet:()=>bt,loadStylesheetAllowStale:()=>Lt,normalizeCollectionScope:()=>ut,observeDOMElement:()=>qt,parseComponentSource:()=>rt,parseLimit:()=>Kt,parseRange:()=>Yt,parseStylesheetSource:()=>vt,queryObject:()=>B,queryObjectRaw:()=>Pt,queryScopes:()=>Y,renderComponent:()=>$t,renderComponentElement:()=>Ue,renderComponentPromise:()=>ue,renderDOMContent:()=>U,renderDOMElement:()=>R,renderHTMLContent:()=>se,renderStylesheet:()=>Fe,renderStylesheetPromise:()=>de,serializeCH1RichText:()=>L,setDOMAttribute:()=>F});function S(t,e=r=>{}){var r;let i=()=>{var n,o;let s=new Promise((l,d)=>{n=h=>{t==null||t(h),l(h)},o=d});var a=Object.assign(s,{resolve:n,reject:o,restart:i,first:r});return r=a,a.catch(e),a};return i()}var Vt=typeof HTMLElement=="undefined"?typeof windowJSDOM!="undefined"?windowJSDOM.HTMLElement:class{}:HTMLElement,E=class extends Vt{getProps(e){return{}}constructor(){super(),this.defaultProps={},this.connected=!1,this.refs={},this.descendants=[],this.whenLoaded=S(e=>{this.payload=e}),this.whenRendered=S(()=>this.initialized=!0,()=>this.cancelRender()),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.dispatchEventIndirectly(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)}}dispatchEventIndirectly(e){this.dispatchEvent(e);let r=this.getParent();r&&!r.contains(this)&&(Object.defineProperty(e,"target",{value:this,writable:!1}),Object.defineProperty(e,"composedPath",{value:()=>[this],writable:!1}),r.handleEvent(e))}isJSONAttribute(e){return!1}log(...e){let r=e[0];(typeof location!="undefined"&&(location!=null&&location.hostname.startsWith("components-"))||localStorage["Sitecore.Components.Debug"])&&console.log(r+" "+e.slice(1).map(i=>i&&typeof i=="object"?"%O":"%s").join(" "),...e.slice(1))}unmount(){this.connected&&(this.log("FEAAS: Unmount",this),this.dispatchEventIndirectly(new Event("feaasUnmount",{bubbles:!0,composed:!0})),this.connected&&this.initialized&&this.render&&this.update(),this.cancelRender(),this.connected=!1,this.initialized&&this.render&&this.update())}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;if(this.tagName!="FEAAS-CONTEXT")return document.querySelector("feaas-context")}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 o=e.refs.parent;o;o=o.refs.parent)o.render&&((i=e.refs).parentReact||(i.parentReact=o),e.refs.topReact=o)}getComponentName(){return this.tagName.replace("FEAAS-","").toLowerCase()}isReadyToLoad(){return this.payload===void 0&&this.getAttribute("hidden")==null}onError(e,r="uncaught",i=!1){let n=new CustomEvent("feaasError",{bubbles:!0,composed:!0,detail:e});if(this.dispatchEventIndirectly(n),this.whenLoaded.reject(e),!n.defaultPrevented&&!i){this.whenRendered.reject(e);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.dispatchEventIndirectly(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;if(!this.connected)return;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: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.getAttribute("hydrate")!="false"&&(!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&&this.connected?(e=this.forceUpdateReact)===null||e===void 0||e.call(this):(i=(r=this.refs.topReact)===null||r===void 0?void 0:r.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(n=>n.refs.parentReact==this&&n.payload&&n.connected).map((n,o)=>this.getReactElement(n));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:n}=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:n}=e.payload||{},o=this.getReactErrorBoundary(),s=this.getReactWrapper(e);return i.createElement(o,{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:n}=e.payload||{};return e.reactWrapper=o=>{if(e.render){let[s,a]=i.useReducer(l=>l+1,0);return e.forceUpdateReact=a,n.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 n=this.isJSONAttribute(r),o=this.props[r],s=n?JSON.stringify(o):String(o),a=this.defaultProps[r],l=n?JSON.stringify(a):String(a),d=r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),h=this.getAttribute(d);try{var i=n?JSON.stringify(JSON.parse(h)):h}catch(f){var i=null}o==null||s===l?this.removeAttribute(d):(typeof o=="string"||typeof o=="number"||typeof o=="boolean"||n)&&i!=s&&this.setAttribute(d,s)}}catch(n){this.whenRendered.reject(n),this.onError(n,"set")}return this}import(e){return import( /*@vite-ignore*/ /* webpackIgnore: true */ e)}scheduleRender(){this.nextRender==null&&(this.whenRendered=this.whenRendered.restart()),this.cancelRender(),this.nextRender=requestAnimationFrame(()=>{this.nextRender=null,this.advance().catch(e=>{})})}cancelRender(){cancelAnimationFrame(this.nextRender)}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 H=class extends E{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)}},ct=class extends H{constructor(){super(...arguments),this.useShadowRoot=!0}getProps(){return{counter:parseFloat(this.getAttribute("counter"))}}render({counter:e},{React:r}){let[i,n]=r.useState(0);return r.useEffect(()=>{n(o=>o+1)},[e]),r.createElement(r.Fragment,null,r.createElement("p",null,"Rendering attribute: ",e),r.createElement("p",null,"Triggered updates: ",i))}};ct.observedAttributes=["counter"];var ft={};K(ft,{renderDOMContent:()=>U,renderDOMElement:()=>R,renderHTMLContent:()=>se,setDOMAttribute:()=>F});var ht={};K(ht,{JSONPath:()=>m,queryObject:()=>B,queryObjectRaw:()=>Pt,queryScopes:()=>Y,serializeCH1RichText:()=>L});import _e from"vm";var{hasOwnProperty:C}=Object.prototype;function D(t,e){return t=t.slice(),t.push(e),t}function _t(t,e){return e=e.slice(),e.unshift(t),e}var Nt=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 m(t,e,r,i,n){if(!(this instanceof m))try{return new m(t,e,r,i,n)}catch(s){if(!s.avoidNew)throw s;return s.value}typeof t=="string"&&(n=i,i=r,r=e,e=t,t=null);let o=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=C.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||n||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},t.autostart!==!1){let s={path:o?t.path:e};o?"json"in t&&(s.json=t.json):s.json=r;let a=this.evaluate(s);if(!a||typeof a!="object")throw new Nt(a);return a}}m.prototype.evaluate=function(t,e,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,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(!C.call(t,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:e}=t),s=C.call(t,"flatten")?t.flatten:s,this.currResultType=C.call(t,"resultType")?t.resultType:this.currResultType,this.currSandbox=C.call(t,"sandbox")?t.sandbox:this.currSandbox,a=C.call(t,"wrap")?t.wrap:a,this.currPreventEval=C.call(t,"preventEval")?t.preventEval:this.currPreventEval,r=C.call(t,"callback")?t.callback:r,this.currOtherTypeCallback=C.call(t,"otherTypeCallback")?t.otherTypeCallback:this.currOtherTypeCallback,n=C.call(t,"parent")?t.parent:n,o=C.call(t,"parentProperty")?t.parentProperty:o,t=t.path}if(n=n||null,o=o||null,Array.isArray(t)&&(t=m.toPathString(t)),!t&&t!==""||!e)return;let l=m.toPathArray(t);l[0]==="$"&&l.length>1&&l.shift(),this._hasParentSelector=null;let d=this._trace(l,e,["$"],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};m.prototype._getPreferredOutput=function(t){let e=this.currResultType;switch(e){case"all":{let r=Array.isArray(t.path)?t.path:m.toPathArray(t.path);return t.pointer=m.toPointer(r),t.path=typeof t.path=="string"?t.path:m.toPathString(t.path),t}case"value":case"parent":case"parentProperty":return t[e];case"path":return m.toPathString(t[e]);case"pointer":return m.toPointer(t.path);default:throw new TypeError("Unknown result type")}};m.prototype._handleCallback=function(t,e,r){if(e){let i=this._getPreferredOutput(t);t.path=typeof t.path=="string"?t.path:m.toPathString(t.path),e(i,r,t)}};m.prototype._trace=function(t,e,r,i,n,o,s,a){let l;if(!t.length)return l={path:r,value:e,parent:i,parentProperty:n,hasArrExpr:s},this._handleCallback(l,o,"value"),l;let d=t[0],h=t.slice(1),f=[];function u(c){Array.isArray(c)?c.forEach(p=>{f.push(p)}):f.push(c)}if((typeof d!="string"||a)&&e&&C.call(e,d))u(this._trace(h,e[d],D(r,d),e,d,o,s));else if(d==="*")this._walk(e,c=>{u(this._trace(h,e[c],D(r,c),e,c,o,!0,!0))});else if(d==="..")u(this._trace(h,e,r,i,n,o,s)),this._walk(e,c=>{typeof e[c]=="object"&&u(this._trace(t.slice(),e[c],D(r,c),e,c,o,!0))});else{if(d==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:h,isParentSelector:!0};if(d==="~")return l={path:D(r,d),value:n,parent:i,parentProperty:null},this._handleCallback(l,o,"property"),l;if(d==="$")u(this._trace(h,e,r,null,null,o,s));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(d))u(this._slice(d,h,e,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(e,p=>{this._eval(c,e[p],p,r,i,n)&&u(this._trace(h,e[p],D(r,p),e,p,o,!0))})}else if(d[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");u(this._trace(_t(this._eval(d,e,r[r.length-1],r.slice(0,-1),i,n),h),e,r,i,n,o,s))}else if(d[0]==="@"){let c=!1,p=d.slice(1,-2);switch(p){case"scalar":(!e||!["object","function"].includes(typeof e))&&(c=!0);break;case"boolean":case"string":case"undefined":case"function":typeof e===p&&(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===p&&(c=!0);break;case"array":Array.isArray(e)&&(c=!0);break;case"other":c=this.currOtherTypeCallback(e,r,i,n);break;case"null":e===null&&(c=!0);break;default:throw new TypeError("Unknown value type "+p)}if(c)return l={path:r,value:e,parent:i,parentProperty:n},this._handleCallback(l,o,"value"),l}else if(d[0]==="`"&&e&&C.call(e,d.slice(1))){let c=d.slice(1);u(this._trace(h,e[c],D(r,c),e,c,o,s,!0))}else if(d.includes(",")){let c=d.split(",");for(let p of c)u(this._trace(_t(p,h),e,r,i,n,o,!0))}else!a&&e&&C.call(e,d)&&u(this._trace(h,e[d],D(r,d),e,d,o,s,!0))}if(this._hasParentSelector)for(let c=0;c<f.length;c++){let p=f[c];if(p&&p.isParentSelector){let v=this._trace(p.expr,e,p.path,i,n,o,s);if(Array.isArray(v)){f[c]=v[0];let y=v.length;for(let b=1;b<y;b++)c++,f.splice(c,0,v[b])}else f[c]=v}}return f};m.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)})};m.prototype._slice=function(t,e,r,i,n,o,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(_t(c,e),r,i,n,o,s,!0).forEach(v=>{u.push(v)});return u};m.prototype._eval=function(t,e,r,i,n,o){this.currSandbox._$_parentProperty=o,this.currSandbox._$_parent=n,this.currSandbox._$_property=r,this.currSandbox._$_root=this.json,this.currSandbox._$_v=e;let s=t.includes("@path");s&&(this.currSandbox._$_path=m.toPathString(i.concat([r])));let a="script:"+t;if(!m.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")),m.cache[a]=new this.vm.Script(l)}try{return m.cache[a].runInNewContext(this.currSandbox)}catch(l){throw new Error("jsonPath: "+l.message+": "+t)}};m.cache={};m.toPathString=function(t){let e=t,r=e.length,i="$";for(let n=1;n<r;n++)/^(~|\^|@.*?\(\))$/u.test(e[n])||(i+=/^[0-9*]+$/u.test(e[n])?"["+e[n]+"]":"['"+e[n]+"']");return i};m.toPointer=function(t){let e=t,r=e.length,i="";for(let n=1;n<r;n++)/^(~|\^|@.*?\(\))$/u.test(e[n])||(i+="/"+e[n].toString().replace(/~/gu,"~0").replace(/\//gu,"~1"));return i};m.toPathArray=function(t){let{cache:e}=m;if(e[t])return e[t].concat();let r=[],n=t.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 e[t]=n,e[t].concat()};m.prototype.vm=_e;function Pt(t,e){try{return m({path:e,json:t})}catch(r){return[]}}function B(t,e){var r;return((r=Pt(t,e))===null||r===void 0?void 0:r.flat(1/0))||[]}function Y(t,e,r=!1,i=t){var n=e;let o=Object.keys(t).sort((a,l)=>l.length-a.length);for(let a of o)if(e.startsWith(a)){if(a==e){if(r)return t[a];continue}n=e.substring(a.length+1),i=t[a];break}var s=B(i,n);return Array.isArray(s)&&(s==null?void 0:s.length)==0&&(s=[n.replace(/^.*?\./,"_."),n.replace(/^.*?\./,""),n.replace(/^([^.]+).*?\.\$([\.\[])/,"$1$2"),n.replace(/^.*?\.\$([\.\[])/,"_$1"),n.replace(/^.*?\.\$([\.\[])/,"$$$1"),n.replace(/^[^.]+$/,"_")].filter((a,l,d)=>d.indexOf(a)===l).reduce((a,l)=>a.length>0?a:B(i,l),[])),r&&Array.isArray(s)?s[0]:s}function Tt(t,e={},r){return r?`<${r}${Object.entries(e).map(([i,n])=>n!=null&&` ${i}="${n}"`).filter(Boolean).join("")}>${L(t)}</${r}>`.replace(/^<([a-z0-9][^>]*)><\/[^>]+>$/,"<$1 />"):L(t)}function L(t){var e;if(Array.isArray(t))return t.map(L).join(`
2
- `).trim();if(typeof t=="string")return t;if(t==null)return"";switch(t.type){case"heading":let{level:r,...i}=t.attrs;return Tt(t.content,i,"h"+r);case"text":return(t.marks||[]).reduce((n,o)=>Tt(n,o.attrs,{link:"a",bold:"strong",italic:"em",strike:"s",underline:"u"}[o.type]),(e=t.text)===null||e===void 0?void 0:e.replace(/\s+/," "));default:return Tt(t.content||t.text,t.attrs,{bulletList:"ul",orderedList:"ol",listItem:"li",horizontalRule:"hr",paragraph:"p",codeBlock:"code",blockquote:"blockquote"}[t.type])}}var $=class{constructor(e,r=1,i){this.ownerDocument={createElement(n){return new $(n)}},this.nodeName=e,this.nodeType=r,this.textContent=i,this.attributes=[],this.childNodes=[]}setAttribute(e,r){let i=this.attributes.find(n=>n.name===e);i?i.value=r:this.attributes.push({name:e,value:r})}getAttribute(e){let r=this.attributes.find(i=>i.name===e);return r?r.value:void 0}insertBefore(e,r){if(e.parentNode=this,r===null)this.childNodes.push(e);else{let i=this.childNodes.indexOf(r);i!==-1&&this.childNodes.splice(i,0,e)}}removeAttribute(e){let r=this.attributes.findIndex(i=>i.name===e);r!==-1&&this.attributes.splice(r,1)}appendChild(e){e.parentNode=this,this.childNodes.push(e)}get tagName(){var e;return(e=this.nodeName)===null||e===void 0?void 0:e.toUpperCase()}get localName(){var e;return(e=this.nodeName)===null||e===void 0?void 0:e.toLowerCase()}get innerHTML(){return Ot(this.childNodes)}set innerHTML(e){this.childNodes=Mt(String(e!=null?e:""))}get outerHTML(){return Ot([this])}get children(){return this.childNodes.filter(e=>e.nodeType==1)}closest(e){let r=this;for(;r;){if(Jt(e,r))return r;r=r.parentNode}return null}querySelectorAll(e){let r=e.split(/\s*,\s*/),i=[],n=o=>{for(let s of r)if(Jt(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(e){return this.querySelectorAll(e)[0]}findSibling(e,r){if(!this.parentNode)return null;let i=this.parentNode.childNodes,n=i.indexOf(this);if(n===-1)return null;for(let o=n+e;o>=0&&o<i.length;o+=e){let s=i[o];if(!r||s.nodeType===1)return s}return null}removeChild(e){let r=this.childNodes.indexOf(e);if(r!==-1)return this.childNodes.splice(r,1),e.parentNode=void 0,e}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(e=!1){let r=new $(this.nodeName,this.nodeType);if(r.attributes=JSON.parse(JSON.stringify(this.attributes)),this.textContent&&(r.textContent=this.textContent),e)for(let i of this.childNodes){let n=i.cloneNode(!0);r.appendChild(n)}return r}get parentElement(){var e;return((e=this.parentNode)===null||e===void 0?void 0:e.nodeType)==1?this.parentNode:null}};function Jt(t,e){let r=t.match(/([.#]?[\w-]+|\[([\w-]+)(="([^"]*)")?\])/g);if(!r)return!1;for(let i of r)if(i.startsWith("#")){if(e.getAttribute("id")!==i.slice(1))return!1}else if(i.startsWith(".")){if(!(e.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=e.getAttribute(o);if(typeof s=="undefined"){if(a===void 0)return!1}else if(a!==s)return!1}else return!1}else if(e.nodeName!==i)return!1;return!0}function Mt(t){var e;let r=[],i=[];for(;t;){let n=t.match(/^<([\w-]+)(\s[^>]*)?>/),o=t.match(/^<\/([\w-]+)>/);if(n){let s=n[1].toLowerCase(),l=((e=(n[2]||"").match(/([\w-]+)(="([^"]*)")?/g))===null||e===void 0?void 0:e.map(h=>{let[f,u,,c]=h.match(/([\w-]+)(="([^"]*)")?/);return{name:u,value:Te(c||"")}}))||[],d=new $(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);["img","input","br"].includes(s)||i.push(d),t=t.slice(n[0].length)}else if(o)i.pop(),t=t.slice(o[0].length);else{let s=t.indexOf("<"),a=t.slice(0,s!==-1?s:void 0),l=new $("#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);t=t.slice(a.length)}}return r}function Ne(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function Te(t){return t.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#x27;/g,"'")}function Ot(t){return t.map(e=>{if(e.nodeType===3)return e.textContent||"";let{nodeName:r,attributes:i}=e,n=i.map(({name:s,value:a})=>` ${s}="${Ne(String(a))}"`).join(""),o=Ot(e.childNodes);return["img","input","br"].includes(r)?`<${r}${n} />`:`<${r}${n}>${o}</${r}>`}).join("")}function qt(t){let e=new t.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(i=>{let n=i.target,o=n.getAttribute("data-embed-src");o&&Q(n,o),i.addedNodes&&i.addedNodes.forEach(s=>{s.nodeType==1&&Gt(s,!1)})})});return e.observe(t,{attributes:!0,subtree:!0,childList:!0}),e}function Gt(t,e=!0){let r=t.querySelectorAll("[data-embed-src]");for(var i=0;i<r.length;i++){let n=r[i];Q(n,n.getAttribute("data-embed-src"))}if(e)return qt(t)}function Q(t,e){for(var r=t;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")==e)return!0;r.tagName=="HTML"&&(r=r.querySelector("head")||r);let o=r.ownerDocument.createElement("script");o.setAttribute("type","module"),o.setAttribute("src",e),r.appendChild(o);break}}var pt={};K(pt,{adjustNumbers:()=>Xt,cleanCollectionBit:()=>X,getHumanizedLabel:()=>Zt,getLastPathBit:()=>te,getQualifier:()=>Qt,normalizeCollectionScope:()=>ut,parseLimit:()=>Kt,parseRange:()=>Yt});var Kt=t=>{var e;let r=parseInt((e=t==null?void 0:t.match(/\[0:(\d+)\]/))===null||e===void 0?void 0:e[1],10);return!isNaN(r)&&r>0?String(r):null},Yt=t=>{var e;let r=(e=t==null?void 0:t.match(/\[([^\]]+)\]/))===null||e===void 0?void 0:e[1].split(/\s*,\s*/g).filter(Boolean).map(i=>{if(i.match(/^-?\d+$/))return i;let n=i.match(/^(\d+):(\d+)$/);return n&&parseInt(n[1],10)<parseInt(n[2],10)?n[1]+"-"+n[2]:null});return r!=null&&r.every(Boolean)?r.join(","):null},Qt=t=>{var e;return(e=t==null?void 0:t.match(/(\.\*|\[[^\]]*\])$/))===null||e===void 0?void 0:e[0]};function X(t){return t.replace(/(\.?\[[^\]\[]*\]|\.\*)$/g,"")}function ut(t){return X(t)+".*"}function Xt(t,e){return t==null?void 0:t.replace(/(.|^)(\d+)/g,(r,i,n)=>i+(i==":"?n:String(parseInt(n)+e)))}function Zt(t,e=2){var r=X(t).split(/]\.|\.\*\./g).pop().split(/\./g).slice(-3);return r=r.filter(i=>isNaN(parseInt(i))),r.map(i=>i.charAt(0).toUpperCase()+i.slice(1)).slice(-e).join(" ")}function te(t){return X(t).split(".").pop()}var Pe=["January","February","March","April","May","June","July","August","September","October","November","December"],ee=t=>{if(!t||typeof t.getDay!="function")return;let e=t.getFullYear(),r=Pe[t.getMonth()],i=t.getDate();return`${r} ${i}, ${e}`},re=function(t){return String(new Date(t))!=="Invalid Date"&&!isNaN(Number(new Date(t)))};function ne(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 Oe(t,e,r){let i=t.getAttribute("data-path-scope");if(i==null)return;var n=ne(t);if(n!=0)return;let o=t.parentNode;if(o!=null){e==0?t.setAttribute("hidden","hidden"):t.getAttribute("hidden")!=null&&t.removeAttribute("hidden");for(var s=n+1,a=t,l=t;l=l.nextElementSibling;)l.getAttribute("data-path-scope")==i&&(s++,a=l);for(var d=s;d<e;d++)o.insertBefore(a.cloneNode(!0),a.nextElementSibling);for(var d=Math.max(1,e);d<s;d++)a=a.previousElementSibling,o.removeChild(a.nextElementSibling)}}function F(t,e,r,i){var n,o,s;if(!t)return;var a=t;(r==null?void 0:r.type)=="doc"&&Array.isArray(r.content)&&(r=L(r)),i!=null&&i.processValue&&(r=i==null?void 0:i.processValue(t,e,r));var l=e.replace("data-path-","");if(e=="data-path-src"||e=="data-path-alt"){let y=Array.from(t.children).find(b=>b.localName=="picture")||t;a=t.localName=="img"?t:y.querySelector("img, video")}else if(e=="data-path-href")a=t.querySelector("a")||t.closest("a");else if(e=="data-path-hidden")r=r?null:!0;else if(e=="data-path"||e=="data-embed-html"||e=="html")l="innerHTML";else if(e=="data-embed-src")Q(t,r);else if(e=="data-path-attributes"){let y=((n=t.getAttribute("data-attributes-keys"))===null||n===void 0?void 0:n.split(",").filter(Boolean))||[];if(!Array.isArray(r))for(var d in r){var h=r[d];F(t,d,typeof h=="object"&&h?JSON.stringify(h):h,i)}for(var f=0;f<y.length;f++)(r==null||!(y[f]in r))&&F(t,y[f],null,i);F(t,"data-attributes-keys",Object.keys(r||{}).join(","));return}if(typeof r=="boolean"&&(r=r?"":null),!a)return;if((l=="innerHTML"||l=="src")&&(r==null||r==="")){var c=String((s=(o=t.getAttribute("data-path-placeholder")||a[l])!==null&&o!==void 0?o:a.getAttribute(l))!==null&&s!==void 0?s:"");l=="innerHTML"?a.innerHTML=c:c?a.setAttribute(l,c):a.removeAttribute(l)}else if(r!=null)if(l=="innerHTML"){for(var p=String(r),v=a;v.parentElement&&v.localName.match(/^(a|var|strong|em|i|b)$/);)v=v.parentElement;v.localName.match(/p|h\d|button|time|li/)&&(p=p.replace(/<(p|h\d|li|ul)[^>]*?>|<\/(p|h\d|li|ul)[^>]*?>/g," ").trim().replace(/\s+/g," ")),String(v.getAttribute("class")).includes("-inline--time")&&re(p)&&(p=ee(new Date(p))),a.innerHTML!=p&&(a.innerHTML=p)}else a.getAttribute(l)!=r&&a.setAttribute(l,r);else a.removeAttribute(l)}var ie=["data-attributes-keys","data-path-attributes","data-path-scope"];function R(t,e,r,i){var n,o,s;let a=t;if(i||(e=((n=r==null?void 0:r.processData)===null||n===void 0?void 0:n.call(r,a,e))||e),a.nodeType==1){let h=a.getAttribute("data-path-scope");if(h){let u=ne(a),c=Y(e,h,!1);u==0&&Oe(a,((o=r==null?void 0:r.shouldRepeat)===null||o===void 0?void 0:o.call(r,a,c))===!1?1:c.length,r),e={...e,[ut(h)]:c[u]}}let f=Array.prototype.slice.call(a.attributes).sort((u,c)=>ie.indexOf(u.name)-ie.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,Y(e,c,!0),r),u=="data-embed-src"&&F(a,u,a.getAttribute(u),r)}}for(var l=0,d;d=a.childNodes[l++];)oe(d)&&R(d,e,r,!0);return i||(s=r==null?void 0:r.onRender)===null||s===void 0||s.call(r,a,e),a}function oe(t){return t.nodeType==1}function U(t,e,r,i){var n;let o=((n=i==null?void 0:i.processTemplate)===null||n===void 0?void 0:n.call(i,t,e,r))||e;if(t.innerHTML=o,t.classList.add("-feaas"),(t.closest(".component.feaas")||t).className.includes("-theme--"))for(var a=0,l;l=t.childNodes[a++];)oe(l)&&(l.className=l.className.replace(/(\s|^)-theme--[^\s]+\s*/g,"$1"));return R(t,r,i)}function se(t,e,r,i=!1){var n;let o=((n=r==null?void 0:r.processTemplate)===null||n===void 0?void 0:n.call(r,null,t,e))||t;if(typeof document=="undefined"||i){let s=Mt(o);return R(s[0],e,r).outerHTML}else{let s=document.createElement("div");return s.innerHTML=o,R(s,e,r),s.innerHTML}}var ae=["initial","check","updated"],Z={};function Me(){Z={}}async function tt(t,e,r,i,n=Z){return j({url:t,options:e,validator:r,callback:i,cache:n}).then(et).then(o=>o.response)}function le(t,e=!1){let r=String(t).replace("?head","");var i=Z[r];return!i&&!e&&(i=Z[r]={phase:null,initial:S(),check:S(),updated:S(),final:S()}),i}var mt=class extends Error{};async function j({url:t,options:e,validator:r,callback:i,cache:n},o="initial"){let s=new Date;if(n!=null){var a=le(t);if(ae.indexOf(a.phase)>=ae.indexOf(o))var l=a[o];else a.phase=o}let d=await(l||fetch(t,e));if(!l&&a&&(d.ok?a[o].resolve(d):a[o].reject(new Error("Fetch failed"))),!d.ok)throw new Error("Fetch failed");let h=new Date(d.headers.get("date"))<s||l&&o=="initial"&&(a.phase=="updated"||a.phase=="check");if((r==null?void 0:r(d,h))===!1)throw new mt("Response is not valid");return await(i==null?void 0:i(d,o,h)),{url:t,options:e,isCached:h,response:d,validator:r,callback:i,cache:n}}async function et(t){let{url:e,isCached:r,options:i,validator:n,response:o,cache:s}=t;if(r){let{response:a}=await j({url:e+"?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 gt(t)}return t}async function gt(t){return j({...t,options:{...t.options,cache:"reload"}},"updated")}var P="https://feaas.blob.core.windows.net";function rt(t){let e=t.match(/^(?:(.*?)\/components)?\/?([^\/]+)\/([^\/]+)(?:\/([^\/]+)(?:\/(published|staged|saved|\d+)(?:\.html?)?)?)?$/);if(e){var[,r,i,n,o,s]=e;return{cdn:r,library:i,component:n,version:o,revision:s}}}function De(t){if(!t||!t.library||!t.component)throw new Error("Component requires `library` and `component` properties");return`${t.cdn&&t.cdn!=P?`${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 Le(t){return`${t.cdn&&t.cdn!=P?`${t.cdn}/styles/`:""}${t.library}/${!t.revision||t.revision=="published"?"":t.revision}`.replace(/\/$|\/\/(?!.+\/styles\/)/g,"")}function vt(t){let e=t.match(/^(?:(.*?)\/styles\/)?([^\/]+)(?:\/(published|staged|saved|\d+)(?:.css)?)?$/);if(e){var[,r,i,n]=e;return{cdn:r,library:i,revision:n}}else{let o=rt(t);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 Dt(t){return typeof t=="string"&&(t={src:t}),"src"in t&&(t={...rt(t.src)}),`${t.cdn||t.hostname||P}/components/${t.library}/${t.component}/${t.version}/${t.revision||"published"}.html`}function z(t){return typeof t=="string"&&(t={src:t}),"src"in t&&(t={...vt(t.src)}),`${t.cdn||t.hostname||P}/styles/${t.library}/${t.revision=="staged"?"staged":t.revision=="saved"?"saved":"published"}.css`}async function V(t,e,r=!1){let i=a=>a.headers.get("x-ms-meta-versionDeletedAt")==null,n=a=>a.clone().text().then(e),o=await Promise.all([t.instance&&j({options:{headers:{Accept:"text/html"},credentials:"omit"},url:Dt({...t,version:t.instance}),validator:i}).catch(a=>a),j({url:Dt(t),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:et({...s,callback:n}).catch(a=>{if(o[0]==s&&(gt({...s,callback:null,validator:null}),console.log("Fork was deleted"),!(o[1]instanceof Error)))return n(o[1].response),et({...o[1],callback:n});throw a})}async function $e(t){typeof t=="string"&&(t={src:t});var e;let{response:r}=await V(t,i=>{e=i},!0);return{...t,template:e,lastModified:r.headers.get("last-modified")}}async function yt(t,e){return typeof t=="string"&&(t={src:t}),tt(z(t),{headers:{Accept:"text/css"},credentials:"omit"},r=>r.headers.get("x-ms-meta-deletedAt")==null,(r,i)=>r.clone().text().then(n=>e(n,i)))}function Fe(t,e){return de(t,e||(e=document.createElement("style"))),e}function de(t,e){return e||(e=document.createElement("style")),yt(t,(r,i)=>{e.textContent=r}).then(()=>e)}function bt(t,e){var r=ce(t);if(r){if(r.tagName=="LINK")return e(null,"initial"),Promise.resolve(r)}else var i=he(t);return yt(t,(n,o)=>{i&&(i.textContent=n),e==null||e(n,o)}).then(()=>r||i)}function Lt(t){return new Promise((e,r)=>{bt(t,e).catch(r)})}function ce(t){return document.head.querySelector(`style[data-href="${z(t)}"]`)||document.querySelector(`link[rel="stylesheet"][href="${z(t)}"]`)}function he(t){let e=z(t),r=document.createElement("style");return r.setAttribute("data-href",e),document.head.appendChild(r),r}function Ue(t,e){let r=document.createElement("div");r.innerHTML=t;let i=document.createDocumentFragment();for(;r.firstChild;)i.appendChild(r.firstChild);return R(i,e),r}function $t(t,e){return ue(t,e||(e=document.createElement("div"))),e}async function ue(t,e){return e||(e=document.createElement("div")),e.childNodes.length?R(e,t.data,t):"template"in t?U(e,t.template,t.data,t):V(t,r=>U(e,r,t.data,t)).then(()=>e)}function je(t){let{params:e,method:r,headers:i,body:n,url:o}=x(t);var s={url:o},a={...i};return i["Content-Type"]==="application/json"&&delete a["Content-Type"],i.Accept==="application/json"&&delete a.Accept,Object.keys(a).length>0&&(s.headers=a),r!=="GET"&&(s.method=r),r==="GET"||r==="HEAD"||Object.keys(n).length===0||(s.body=n),Object.keys(e).length>0&&(s={...s,params:e}),s}var J=t=>{if(typeof t.url!="string")return!1;for(var e in t)if(!(e=="body"||e=="params"||e=="headers"||e=="url"||e==="method"||e=="jsonpath"&&typeof t[e]=="string"))return!1;return!0};function pe(t){let{url:e,headers:r,params:i,method:n,body:o}=x(t),s,a=r["Content-Type"];n!="GET"&&n!="HEAD"&&(a==="application/json"&&(s=JSON.stringify(o)),a==="multipart/form-data"&&(s=Object.keys(o).reduce((d,h)=>(d.append(h,o[h]),d),new FormData)),a==="application/x-www-form-urlencoded"&&(s=new URLSearchParams(o)));let l=Object.keys(i).length?`?${new URLSearchParams(i)}`:"";return[`${e}${l}`,{headers:r,body:s,method:n}]}function x(t){let e={};for(let r in(t==null?void 0:t.headers)||{})if(t.headers.hasOwnProperty(r)){let i=r.replace(/^[a-z]|\-[a-z]/g,n=>n.toUpperCase());e[i]=t.headers[r]}return e.Accept||(e.Accept="application/json"),{params:(t==null?void 0:t.params)||{},headers:e,jsonpath:String((t==null?void 0:t.jsonpath)||"$"),method:((t==null?void 0:t.method)||"GET").toUpperCase(),body:(t==null?void 0:t.body)||{},url:String((t==null?void 0:t.url)||"")}}var Ft=async t=>{try{let[e,r]=pe(t),n=await(await x.fetchImplementation(e,{...r,method:r.method.toLowerCase()})).json();return t.jsonpath&&t.jsonpath!="$"?B(n,t.jsonpath):n}catch(e){return{}}};async function Ut(t){if(!t)return t;if(J(t))return Ft(t);let e=Object.keys(t),r=await Promise.all(e.map(i=>J(t[i])?Ft(t[i]):null).filter(Boolean));return e.reduce((i,n)=>({...i,[n]:J(t[n])?r.shift():t[n]}),{})}async function Ie(t){return t?J(t)||Object.values(t).some(J):!1}x.clean=je;x.toFetchArguments=pe;x.fetchOne=Ft;x.fetch=Ut;x.isDataSettings=J;x.hasDataSettings=Ie;x.fetchImplementation=(...t)=>fetch(...t);function fe(t){var e,r,i,n,o,s,a,l;let d,h=t.getAttribute("src");if(h){let O=rt(h);if(!O)throw new Error(`Could not parse FEAAS Component source: ${h}`);var{cdn:f,library:u,component:c,version:p,revision:v}=O}let y=t.getAttribute("data");if(y!=null&&y!="")try{d=typeof y=="string"?JSON.parse(y):{}}catch(O){console.error(O)}let b=t.getAttribute("fetch");return{data:d||{},cdn:(r=(e=t.getContextAttribute("cdn"))!==null&&e!==void 0?e:f)!==null&&r!==void 0?r:P,library:(i=t.getAttribute("library"))!==null&&i!==void 0?i:u,component:(n=t.getAttribute("component"))!==null&&n!==void 0?n:c,version:(s=(o=t.getAttribute("version"))!==null&&o!==void 0?o:p)!==null&&s!==void 0?s:"responsive",revision:(l=(a=t.getAttribute("revision"))!==null&&a!==void 0?a:v)!==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"),fetch:b=="false"?[]:b==null||b=="true"?["data","template","stylesheet"]:b.split(/(\s+|\-)+/g).filter(Boolean)}}var it=class extends E{setData(e){this.set({data:e})}getProps(){return fe(this)}isJSONAttribute(e){return e=="data"}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),e==="data"&&this.props.fetch.includes("data")&&this.fetchData())}async fetchData(){this.readyData=void 0,this.whenDataReady=this.whenDataReady.restart();let e=await x.fetch(this.props.data),r=this.alreadyRendered;await this.whenDataReady.resolve(e),r&&this.advance()}getEditor(){var e;return(e=document.querySelector("feaas-context"))===null||e===void 0?void 0:e.refs.editor}constructor(){super(),this.readyData={},this.whenDataReady=S(e=>this.readyData=e,e=>this.onError(e)),this.defaultProps={cdn:P,revision:"published",version:"responsive",editable:!1,suspended:!1,data:{}},this.onLoad=e=>{this.payload=e,this.advance()},this.getAttribute("data")||this.whenDataReady.resolve({}),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(){var e;if(this.getOriginal())return;let r=()=>{this.payload!=null&&(i||this.readyData&&this.onLoad(this.payload))};if(this.props.fetch.includes("stylesheet"))var i=Lt({...this.props}).then(()=>{i=null,r()});if(this.props.fetch.includes("template"))var n=V(this.props,o=>{this.payload=o,r()});else this.payload=(e=this.props.template)!==null&&e!==void 0?e:this.innerHTML;return Promise.all([i,this.whenDataReady.then(()=>r()),n]).then(()=>this.payload)}flush(){this.readyData&&super.flush()}update(){if(this.alreadyRendered=!0,!(!this.props.fetch.includes("data")&&!this.props.fetch.includes("template")&&this.firstElementChild))if(Array.from(this.children).filter(e=>e.tagName!="BR").length>0&&!this.needsRefresh)R(this,this.readyData);else{if(this.needsRefresh=!0,this.getOriginal())return;U(this,this.payload,this.readyData)}}};it.observedAttributes=["library","component","version","revision","hostname","cdn","template","data","instance","editable","with-stylesheet"];it.register("feaas-component");function me(t){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 nt=class extends E{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return me(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=`
1
+ var _e=Object.defineProperty;var Q=(t,e)=>{for(var r in e)_e(t,r,{get:e[r],enumerable:!0})};var Ht={};Q(Ht,{Component:()=>ot,ComponentProps:()=>fe,Context:()=>j,ControlledPromise:()=>S,DEFAULT_CDN_URL:()=>k,DOM:()=>mt,DataPath:()=>ft,DataScope:()=>ut,DataSettings:()=>x,Element:()=>E,FEAASComponent:()=>ot,FEAASComponentsProps:()=>fe,FEAASContext:()=>j,FEAASContextProps:()=>Se,FEAASEditor:()=>at,FEAASEditorProps:()=>Ce,FEAASElement:()=>E,FEAASLoader:()=>st,FEAASLoaderProps:()=>me,FEAASPicker:()=>lt,FEAASPickerProps:()=>xe,FEAASStylesheet:()=>Et,FEAASStylesheetProps:()=>ge,InvalidResponse:()=>gt,JSONPath:()=>m,Loader:()=>st,MyComponent:()=>ht,Picker:()=>lt,Stylesheet:()=>Et,Thumbnail:()=>wt,WebComponent:()=>Vt,adjustNumbers:()=>Xt,autoloadScripts:()=>Gt,cleanCollectionBit:()=>tt,clearFetchCache:()=>Me,createStylesheet:()=>he,fetchAndRevalidate:()=>rt,fetchAndRevalidateComponent:()=>z,fetchAndRevalidateStylesheet:()=>bt,fetchBypassingCache:()=>vt,fetchCache:()=>et,fetchComponent:()=>$e,fetchData:()=>jt,fetchToValidateCache:()=>it,fetchWithCacheAwareness:()=>U,findStylesheet:()=>ce,getComponentSource:()=>De,getComponentURL:()=>Lt,getFetchCache:()=>le,getFramePosition:()=>we,getHumanizedLabel:()=>Zt,getLastPathBit:()=>te,getQualifier:()=>Qt,getStylesheetSource:()=>Le,getStylesheetURL:()=>B,loadScript:()=>Z,loadStylesheet:()=>At,loadStylesheetAllowStale:()=>$t,normalizeCollectionScope:()=>pt,observeDOMElement:()=>qt,parseComponentSource:()=>nt,parseLimit:()=>Kt,parseRange:()=>Yt,parseStylesheetSource:()=>yt,queryObject:()=>H,queryObjectRaw:()=>Ot,queryScopes:()=>X,renderComponent:()=>Ft,renderComponentElement:()=>Ue,renderComponentPromise:()=>ue,renderDOMContent:()=>F,renderDOMElement:()=>R,renderHTMLContent:()=>se,renderStylesheet:()=>Fe,renderStylesheetPromise:()=>de,serializeCH1RichText:()=>D,setDOMAttribute:()=>$});function S(t,e=r=>{}){var r;let i=()=>{var n,o;let s=new Promise((l,d)=>{n=h=>{t==null||t(h),l(h)},o=d});var a=Object.assign(s,{resolve:n,reject:o,restart:i,first:r});return r=a,a.catch(e),a};return i()}var Vt=typeof HTMLElement=="undefined"?typeof windowJSDOM!="undefined"?windowJSDOM.HTMLElement:class{}:HTMLElement,E=class extends Vt{getProps(e){return{}}constructor(){super(),this.defaultProps={},this.connected=!1,this.refs={},this.descendants=[],this.whenLoaded=S(e=>{this.payload=e}),this.whenRendered=S(()=>this.initialized=!0,()=>this.cancelRender()),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.dispatchEventIndirectly(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)}}dispatchEventIndirectly(e){this.dispatchEvent(e);let r=this.getParent();r&&!r.contains(this)&&(Object.defineProperty(e,"target",{value:this,writable:!1}),Object.defineProperty(e,"composedPath",{value:()=>[this],writable:!1}),r.handleEvent(e))}isJSONAttribute(e){return!1}log(...e){let r=e[0];(typeof location!="undefined"&&(location!=null&&location.hostname.startsWith("components-"))||localStorage["Sitecore.Components.Debug"])&&console.log(r+" "+e.slice(1).map(i=>i&&typeof i=="object"?"%O":"%s").join(" "),...e.slice(1))}unmount(){this.connected&&(this.log("FEAAS: Unmount",this),this.dispatchEventIndirectly(new Event("feaasUnmount",{bubbles:!0,composed:!0})),this.connected&&this.initialized&&this.render&&this.update(),this.cancelRender(),this.connected=!1,this.initialized&&this.render&&this.update())}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;if(this.tagName!="FEAAS-CONTEXT")return document.querySelector("feaas-context")}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 o=e.refs.parent;o;o=o.refs.parent)o.render&&((i=e.refs).parentReact||(i.parentReact=o),e.refs.topReact=o)}getComponentName(){return this.tagName.replace("FEAAS-","").toLowerCase()}isReadyToLoad(){return this.payload===void 0&&this.getAttribute("hidden")==null}onError(e,r="uncaught",i=!1){let n=new CustomEvent("feaasError",{bubbles:!0,composed:!0,detail:e});if(this.dispatchEventIndirectly(n),this.whenLoaded.reject(e),!n.defaultPrevented&&!i){this.whenRendered.reject(e);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.dispatchEventIndirectly(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;if(!this.connected)return;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: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.getAttribute("hydrate")!="false"&&(!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&&this.connected?(e=this.forceUpdateReact)===null||e===void 0||e.call(this):(i=(r=this.refs.topReact)===null||r===void 0?void 0:r.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(n=>n.refs.parentReact==this&&n.payload&&n.connected).map((n,o)=>this.getReactElement(n));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:n}=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:n}=e.payload||{},o=this.getReactErrorBoundary(),s=this.getReactWrapper(e);return i.createElement(o,{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:n}=e.payload||{};return e.reactWrapper=o=>{if(e.render){let[s,a]=i.useReducer(l=>l+1,0);return e.forceUpdateReact=a,n.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 n=this.isJSONAttribute(r),o=this.props[r],s=n?JSON.stringify(o):String(o),a=this.defaultProps[r],l=n?JSON.stringify(a):String(a),d=r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),h=this.getAttribute(d);try{var i=n?JSON.stringify(JSON.parse(h)):h}catch(f){var i=null}o==null||s===l?this.removeAttribute(d):(typeof o=="string"||typeof o=="number"||typeof o=="boolean"||n)&&i!=s&&this.setAttribute(d,s)}}catch(n){this.whenRendered.reject(n),this.onError(n,"set")}return this}import(e){return import( /*@vite-ignore*/ /* webpackIgnore: true */ e)}scheduleRender(){this.nextRender==null&&(this.whenRendered=this.whenRendered.restart()),this.cancelRender(),this.nextRender=requestAnimationFrame(()=>{this.nextRender=null,this.advance().catch(e=>{})})}cancelRender(){cancelAnimationFrame(this.nextRender)}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 W=class extends E{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)}},ht=class extends W{constructor(){super(...arguments),this.useShadowRoot=!0}getProps(){return{counter:parseFloat(this.getAttribute("counter"))}}render({counter:e},{React:r}){let[i,n]=r.useState(0);return r.useEffect(()=>{n(o=>o+1)},[e]),r.createElement(r.Fragment,null,r.createElement("p",null,"Rendering attribute: ",e),r.createElement("p",null,"Triggered updates: ",i))}};ht.observedAttributes=["counter"];var mt={};Q(mt,{renderDOMContent:()=>F,renderDOMElement:()=>R,renderHTMLContent:()=>se,setDOMAttribute:()=>$});var ut={};Q(ut,{JSONPath:()=>m,queryObject:()=>H,queryObjectRaw:()=>Ot,queryScopes:()=>X,serializeCH1RichText:()=>D});import ke from"vm";var{hasOwnProperty:C}=Object.prototype;function M(t,e){return t=t.slice(),t.push(e),t}function Nt(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 m(t,e,r,i,n){if(!(this instanceof m))try{return new m(t,e,r,i,n)}catch(s){if(!s.avoidNew)throw s;return s.value}typeof t=="string"&&(n=i,i=r,r=e,e=t,t=null);let o=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=C.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||n||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},t.autostart!==!1){let s={path:o?t.path:e};o?"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}}m.prototype.evaluate=function(t,e,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,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(!C.call(t,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:e}=t),s=C.call(t,"flatten")?t.flatten:s,this.currResultType=C.call(t,"resultType")?t.resultType:this.currResultType,this.currSandbox=C.call(t,"sandbox")?t.sandbox:this.currSandbox,a=C.call(t,"wrap")?t.wrap:a,this.currPreventEval=C.call(t,"preventEval")?t.preventEval:this.currPreventEval,r=C.call(t,"callback")?t.callback:r,this.currOtherTypeCallback=C.call(t,"otherTypeCallback")?t.otherTypeCallback:this.currOtherTypeCallback,n=C.call(t,"parent")?t.parent:n,o=C.call(t,"parentProperty")?t.parentProperty:o,t=t.path}if(n=n||null,o=o||null,Array.isArray(t)&&(t=m.toPathString(t)),!t&&t!==""||!e)return;let l=m.toPathArray(t);l[0]==="$"&&l.length>1&&l.shift(),this._hasParentSelector=null;let d=this._trace(l,e,["$"],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};m.prototype._getPreferredOutput=function(t){let e=this.currResultType;switch(e){case"all":{let r=Array.isArray(t.path)?t.path:m.toPathArray(t.path);return t.pointer=m.toPointer(r),t.path=typeof t.path=="string"?t.path:m.toPathString(t.path),t}case"value":case"parent":case"parentProperty":return t[e];case"path":return m.toPathString(t[e]);case"pointer":return m.toPointer(t.path);default:throw new TypeError("Unknown result type")}};m.prototype._handleCallback=function(t,e,r){if(e){let i=this._getPreferredOutput(t);t.path=typeof t.path=="string"?t.path:m.toPathString(t.path),e(i,r,t)}};m.prototype._trace=function(t,e,r,i,n,o,s,a){let l;if(!t.length)return l={path:r,value:e,parent:i,parentProperty:n,hasArrExpr:s},this._handleCallback(l,o,"value"),l;let d=t[0],h=t.slice(1),f=[];function u(c){Array.isArray(c)?c.forEach(p=>{f.push(p)}):f.push(c)}if((typeof d!="string"||a)&&e&&C.call(e,d))u(this._trace(h,e[d],M(r,d),e,d,o,s));else if(d==="*")this._walk(e,c=>{u(this._trace(h,e[c],M(r,c),e,c,o,!0,!0))});else if(d==="..")u(this._trace(h,e,r,i,n,o,s)),this._walk(e,c=>{typeof e[c]=="object"&&u(this._trace(t.slice(),e[c],M(r,c),e,c,o,!0))});else{if(d==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:h,isParentSelector:!0};if(d==="~")return l={path:M(r,d),value:n,parent:i,parentProperty:null},this._handleCallback(l,o,"property"),l;if(d==="$")u(this._trace(h,e,r,null,null,o,s));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(d))u(this._slice(d,h,e,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(e,p=>{this._eval(c,e[p],p,r,i,n)&&u(this._trace(h,e[p],M(r,p),e,p,o,!0))})}else if(d[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");u(this._trace(Nt(this._eval(d,e,r[r.length-1],r.slice(0,-1),i,n),h),e,r,i,n,o,s))}else if(d[0]==="@"){let c=!1,p=d.slice(1,-2);switch(p){case"scalar":(!e||!["object","function"].includes(typeof e))&&(c=!0);break;case"boolean":case"string":case"undefined":case"function":typeof e===p&&(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===p&&(c=!0);break;case"array":Array.isArray(e)&&(c=!0);break;case"other":c=this.currOtherTypeCallback(e,r,i,n);break;case"null":e===null&&(c=!0);break;default:throw new TypeError("Unknown value type "+p)}if(c)return l={path:r,value:e,parent:i,parentProperty:n},this._handleCallback(l,o,"value"),l}else if(d[0]==="`"&&e&&C.call(e,d.slice(1))){let c=d.slice(1);u(this._trace(h,e[c],M(r,c),e,c,o,s,!0))}else if(d.includes(",")){let c=d.split(",");for(let p of c)u(this._trace(Nt(p,h),e,r,i,n,o,!0))}else!a&&e&&C.call(e,d)&&u(this._trace(h,e[d],M(r,d),e,d,o,s,!0))}if(this._hasParentSelector)for(let c=0;c<f.length;c++){let p=f[c];if(p&&p.isParentSelector){let y=this._trace(p.expr,e,p.path,i,n,o,s);if(Array.isArray(y)){f[c]=y[0];let b=y.length;for(let A=1;A<b;A++)c++,f.splice(c,0,y[A])}else f[c]=y}}return f};m.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)})};m.prototype._slice=function(t,e,r,i,n,o,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(Nt(c,e),r,i,n,o,s,!0).forEach(y=>{u.push(y)});return u};m.prototype._eval=function(t,e,r,i,n,o){this.currSandbox._$_parentProperty=o,this.currSandbox._$_parent=n,this.currSandbox._$_property=r,this.currSandbox._$_root=this.json,this.currSandbox._$_v=e;let s=t.includes("@path");s&&(this.currSandbox._$_path=m.toPathString(i.concat([r])));let a="script:"+t;if(!m.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")),m.cache[a]=new this.vm.Script(l)}try{return m.cache[a].runInNewContext(this.currSandbox)}catch(l){throw new Error("jsonPath: "+l.message+": "+t)}};m.cache={};m.toPathString=function(t){let e=t,r=e.length,i="$";for(let n=1;n<r;n++)/^(~|\^|@.*?\(\))$/u.test(e[n])||(i+=/^[0-9*]+$/u.test(e[n])?"["+e[n]+"]":"['"+e[n]+"']");return i};m.toPointer=function(t){let e=t,r=e.length,i="";for(let n=1;n<r;n++)/^(~|\^|@.*?\(\))$/u.test(e[n])||(i+="/"+e[n].toString().replace(/~/gu,"~0").replace(/\//gu,"~1"));return i};m.toPathArray=function(t){let{cache:e}=m;if(e[t])return e[t].concat();let r=[],n=t.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 e[t]=n,e[t].concat()};m.prototype.vm=ke;function Ot(t,e){try{return m({path:e,json:t})}catch(r){return[]}}function H(t,e){var r;return((r=Ot(t,e))===null||r===void 0?void 0:r.flat(1/0))||[]}function X(t,e,r=!1,i=t){var n=e;let o=Object.keys(t).sort((a,l)=>l.length-a.length);for(let a of o)if(e.startsWith(a)){if(a==e){if(r)return t[a];continue}n=e.substring(a.length+1),i=t[a];break}var s=H(i,n);return Array.isArray(s)&&(s==null?void 0:s.length)==0&&(s=[n.replace(/^.*?\./,"_."),n.replace(/^.*?\./,""),n.replace(/^([^.]+).*?\.\$([\.\[])/,"$1$2"),n.replace(/^.*?\.\$([\.\[])/,"_$1"),n.replace(/^.*?\.\$([\.\[])/,"$$$1"),n.replace(/^[^.]+$/,"_")].filter((a,l,d)=>d.indexOf(a)===l).reduce((a,l)=>a.length>0?a:H(i,l),[])),r&&Array.isArray(s)?s[0]:s}function Pt(t,e={},r){return r?`<${r}${Object.entries(e).map(([i,n])=>n!=null&&` ${i}="${n}"`).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
+ `).trim();if(typeof t=="string")return t;if(t==null)return"";switch(t.type){case"heading":let{level:r,...i}=t.attrs;return Pt(t.content,i,"h"+r);case"text":return(t.marks||[]).reduce((n,o)=>Pt(n,o.attrs,{link:"a",bold:"strong",italic:"em",strike:"s",underline:"u"}[o.type]),(e=t.text)===null||e===void 0?void 0:e.replace(/\s+/," "));default:return Pt(t.content||t.text,t.attrs,{bulletList:"ul",orderedList:"ol",listItem:"li",horizontalRule:"hr",paragraph:"p",codeBlock:"code",blockquote:"blockquote"}[t.type])}}var L=class{constructor(e,r=1,i){this.ownerDocument={createElement(n){return new L(n)}},this.nodeName=e,this.nodeType=r,this.textContent=i,this.attributes=[],this.childNodes=[]}setAttribute(e,r){let i=this.attributes.find(n=>n.name===e);i?i.value=r:this.attributes.push({name:e,value:r})}getAttribute(e){let r=this.attributes.find(i=>i.name===e);return r?r.value:void 0}insertBefore(e,r){if(e.parentNode=this,r===null)this.childNodes.push(e);else{let i=this.childNodes.indexOf(r);i!==-1&&this.childNodes.splice(i,0,e)}}removeAttribute(e){let r=this.attributes.findIndex(i=>i.name===e);r!==-1&&this.attributes.splice(r,1)}appendChild(e){e.parentNode=this,this.childNodes.push(e)}get tagName(){var e;return(e=this.nodeName)===null||e===void 0?void 0:e.toUpperCase()}get localName(){var e;return(e=this.nodeName)===null||e===void 0?void 0:e.toLowerCase()}get innerHTML(){return Mt(this.childNodes)}set innerHTML(e){this.childNodes=Dt(String(e!=null?e:""))}get outerHTML(){return Mt([this])}get children(){return this.childNodes.filter(e=>e.nodeType==1)}closest(e){let r=this;for(;r;){if(Jt(e,r))return r;r=r.parentNode}return null}querySelectorAll(e){let r=e.split(/\s*,\s*/),i=[],n=o=>{for(let s of r)if(Jt(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(e){return this.querySelectorAll(e)[0]}findSibling(e,r){if(!this.parentNode)return null;let i=this.parentNode.childNodes,n=i.indexOf(this);if(n===-1)return null;for(let o=n+e;o>=0&&o<i.length;o+=e){let s=i[o];if(!r||s.nodeType===1)return s}return null}removeChild(e){let r=this.childNodes.indexOf(e);if(r!==-1)return this.childNodes.splice(r,1),e.parentNode=void 0,e}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(e=!1){let r=new L(this.nodeName,this.nodeType);if(r.attributes=JSON.parse(JSON.stringify(this.attributes)),this.textContent&&(r.textContent=this.textContent),e)for(let i of this.childNodes){let n=i.cloneNode(!0);r.appendChild(n)}return r}get parentElement(){var e;return((e=this.parentNode)===null||e===void 0?void 0:e.nodeType)==1?this.parentNode:null}};function Jt(t,e){let r=t.match(/([.#]?[\w-]+|\[([\w-]+)(="([^"]*)")?\])/g);if(!r)return!1;for(let i of r)if(i.startsWith("#")){if(e.getAttribute("id")!==i.slice(1))return!1}else if(i.startsWith(".")){if(!(e.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=e.getAttribute(o);if(typeof s=="undefined"){if(a===void 0)return!1}else if(a!==s)return!1}else return!1}else if(e.nodeName!==i)return!1;return!0}function Dt(t){var e;let r=[],i=[];for(;t;){let n=t.match(/^<([\w-]+)(\s[^>]*)?>/),o=t.match(/^<\/([\w-]+)>/);if(n){let s=n[1].toLowerCase(),l=((e=(n[2]||"").match(/([\w-]+)(="([^"]*)")?/g))===null||e===void 0?void 0:e.map(h=>{let[f,u,,c]=h.match(/([\w-]+)(="([^"]*)")?/);return{name:u,value:Te(c||"")}}))||[],d=new L(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);["img","input","br"].includes(s)||i.push(d),t=t.slice(n[0].length)}else if(o)i.pop(),t=t.slice(o[0].length);else{let s=t.indexOf("<"),a=t.slice(0,s!==-1?s:void 0),l=new L("#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);t=t.slice(a.length)}}return r}function Ne(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function Te(t){return t.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#x27;/g,"'")}function Mt(t){return t.map(e=>{if(e.nodeType===3)return e.textContent||"";let{nodeName:r,attributes:i}=e,n=i.map(({name:s,value:a})=>` ${s}="${Ne(String(a))}"`).join(""),o=Mt(e.childNodes);return["img","input","br"].includes(r)?`<${r}${n} />`:`<${r}${n}>${o}</${r}>`}).join("")}function qt(t){let e=new t.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(i=>{let n=i.target,o=n.getAttribute("data-embed-src");o&&Z(n,o),i.addedNodes&&i.addedNodes.forEach(s=>{s.nodeType==1&&Gt(s,!1)})})});return e.observe(t,{attributes:!0,subtree:!0,childList:!0}),e}function Gt(t,e=!0){let r=t.querySelectorAll("[data-embed-src]");for(var i=0;i<r.length;i++){let n=r[i];Z(n,n.getAttribute("data-embed-src"))}if(e)return qt(t)}function Z(t,e){for(var r=t;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")==e)return!0;r.tagName=="HTML"&&(r=r.querySelector("head")||r);let o=r.ownerDocument.createElement("script");o.setAttribute("type","module"),o.setAttribute("src",e),r.appendChild(o);break}}var ft={};Q(ft,{adjustNumbers:()=>Xt,cleanCollectionBit:()=>tt,getHumanizedLabel:()=>Zt,getLastPathBit:()=>te,getQualifier:()=>Qt,normalizeCollectionScope:()=>pt,parseLimit:()=>Kt,parseRange:()=>Yt});var Kt=t=>{var e;let r=parseInt((e=t==null?void 0:t.match(/\[0:(\d+)\]/))===null||e===void 0?void 0:e[1],10);return!isNaN(r)&&r>0?String(r):null},Yt=t=>{var e;let r=(e=t==null?void 0:t.match(/\[([^\]]+)\]/))===null||e===void 0?void 0:e[1].split(/\s*,\s*/g).filter(Boolean).map(i=>{if(i.match(/^-?\d+$/))return i;let n=i.match(/^(\d+):(\d+)$/);return n&&parseInt(n[1],10)<parseInt(n[2],10)?n[1]+"-"+n[2]:null});return r!=null&&r.every(Boolean)?r.join(","):null},Qt=t=>{var e;return(e=t==null?void 0:t.match(/(\.\*|\[[^\]]*\])$/))===null||e===void 0?void 0:e[0]};function tt(t){return t.replace(/(\.?\[[^\]\[]*\]|\.\*)$/g,"")}function pt(t){return tt(t)+".*"}function Xt(t,e){return t==null?void 0:t.replace(/(.|^)(\d+)/g,(r,i,n)=>i+(i==":"?n:String(parseInt(n)+e)))}function Zt(t,e=2){var r=tt(t).split(/]\.|\.\*\./g).pop().split(/\./g).slice(-3);return r=r.filter(i=>isNaN(parseInt(i))),r.map(i=>i.charAt(0).toUpperCase()+i.slice(1)).slice(-e).join(" ")}function te(t){return tt(t).split(".").pop()}var Pe=["January","February","March","April","May","June","July","August","September","October","November","December"],ee=t=>{if(!t||typeof t.getDay!="function")return;let e=t.getFullYear(),r=Pe[t.getMonth()],i=t.getDate();return`${r} ${i}, ${e}`},re=function(t){return String(new Date(t))!=="Invalid Date"&&!isNaN(Number(new Date(t)))};function ne(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 Oe(t,e,r){let i=t.getAttribute("data-path-scope");if(i==null)return;var n=ne(t);if(n!=0)return;let o=t.parentNode;if(o!=null){e==0?t.setAttribute("hidden","hidden"):t.getAttribute("hidden")!=null&&t.removeAttribute("hidden");for(var s=n+1,a=t,l=t;l=l.nextElementSibling;)l.getAttribute("data-path-scope")==i&&(s++,a=l);for(var d=s;d<e;d++)o.insertBefore(a.cloneNode(!0),a.nextElementSibling);for(var d=Math.max(1,e);d<s;d++)a=a.previousElementSibling,o.removeChild(a.nextElementSibling)}}function $(t,e,r,i){var n,o,s;if(!t)return;var a=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 l=e.replace("data-path-","");if(e=="data-path-src"||e=="data-path-alt"){let b=Array.from(t.children).find(A=>A.localName=="picture")||t;a=t.localName=="img"?t:b.querySelector("img, video")}else if(e=="data-path-href")a=t.querySelector("a")||t.closest("a");else if(e=="data-path-hidden")r=r?null:!0;else if(e=="data-path"||e=="data-embed-html"||e=="html")l="innerHTML";else if(e=="data-embed-src")Z(t,r);else if(e=="data-path-attributes"){let b=((n=t.getAttribute("data-attributes-keys"))===null||n===void 0?void 0:n.split(",").filter(Boolean))||[];if(!Array.isArray(r))for(var d in r){var h=r[d];$(t,d,typeof h=="object"&&h?JSON.stringify(h):h,i)}for(var f=0;f<b.length;f++)(r==null||!(b[f]in r))&&$(t,b[f],null,i);$(t,"data-attributes-keys",Object.keys(r||{}).join(","));return}if(typeof r=="boolean"&&(r=r?"":null),!a)return;if((l=="innerHTML"||l=="src")&&(r==null||r==="")){var c=String((s=(o=t.getAttribute("data-path-placeholder")||a[l])!==null&&o!==void 0?o:a.getAttribute(l))!==null&&s!==void 0?s:"");l=="innerHTML"?a.innerHTML=c:c?a.setAttribute(l,c):a.removeAttribute(l)}else if(r!=null)if(l=="innerHTML"){for(var p=String(r),y=a;y.parentElement&&y.localName.match(/^(a|var|strong|em|i|b)$/);)y=y.parentElement;y.localName.match(/p|h\d|button|time|li/)&&(p=p.replace(/<(p|h\d|li|ul)[^>]*?>|<\/(p|h\d|li|ul)[^>]*?>/g," ").trim().replace(/\s+/g," ")),String(y.getAttribute("class")).includes("-inline--time")&&re(p)&&(p=ee(new Date(p))),a.innerHTML!=p&&(a.innerHTML=p)}else a.getAttribute(l)!=r&&a.setAttribute(l,r);else a.removeAttribute(l)}var ie=["data-attributes-keys","data-path-attributes","data-path-scope"];function R(t,e,r,i){var n,o,s;let a=t;if(i||(e=((n=r==null?void 0:r.processData)===null||n===void 0?void 0:n.call(r,a,e))||e),a.nodeType==1){let h=a.getAttribute("data-path-scope");if(h){let u=ne(a),c=X(e,h,!1);u==0&&Oe(a,((o=r==null?void 0:r.shouldRepeat)===null||o===void 0?void 0:o.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)=>ie.indexOf(u.name)-ie.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,X(e,c,!0),r),u=="data-embed-src"&&$(a,u,a.getAttribute(u),r)}}for(var l=0,d;d=a.childNodes[l++];)oe(d)&&R(d,e,r,!0);return i||(s=r==null?void 0:r.onRender)===null||s===void 0||s.call(r,a,e),a}function oe(t){return t.nodeType==1}function F(t,e,r,i){var n;let o=((n=i==null?void 0:i.processTemplate)===null||n===void 0?void 0:n.call(i,t,e,r))||e;if(t.innerHTML=o,t.classList.add("-feaas"),(t.closest(".component.feaas")||t).className.includes("-theme--"))for(var a=0,l;l=t.childNodes[a++];)oe(l)&&(l.className=l.className.replace(/(\s|^)-theme--[^\s]+\s*/g,"$1"));return R(t,r,i)}function se(t,e,r,i=!1){var n;let o=((n=r==null?void 0:r.processTemplate)===null||n===void 0?void 0:n.call(r,null,t,e))||t;if(typeof document=="undefined"||i){let s=Dt(o);return R(s[0],e,r).outerHTML}else{let s=document.createElement("div");return s.innerHTML=o,R(s,e,r),s.innerHTML}}var ae=["initial","check","updated"],et={};function Me(){et={}}async function rt(t,e,r,i,n=et){return U({url:t,options:e,validator:r,callback:i,cache:n}).then(it).then(o=>o.response)}function le(t,e=!1){let r=String(t).replace("?head","");var i=et[r];return!i&&!e&&(i=et[r]={phase:null,initial:S(),check:S(),updated:S(),final:S()}),i}var gt=class extends Error{};async function U({url:t,options:e,validator:r,callback:i,cache:n},o="initial"){let s=new Date;if(n!=null){var a=le(t);if(ae.indexOf(a.phase)>=ae.indexOf(o))var l=a[o];else a.phase=o}let d=await(l||fetch(t,e));if(!l&&a&&(d.ok?a[o].resolve(d):a[o].reject(new Error("Fetch failed"))),!d.ok)throw new Error("Fetch failed");let h=new Date(d.headers.get("date"))<s||l&&o=="initial"&&(a.phase=="updated"||a.phase=="check");if((r==null?void 0:r(d,h))===!1)throw new gt("Response is not valid");return await(i==null?void 0:i(d,o,h)),{url:t,options:e,isCached:h,response:d,validator:r,callback:i,cache:n}}async function it(t){let{url:e,isCached:r,options:i,validator:n,response:o,cache:s}=t;if(r){let{response:a}=await U({url:e+"?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 vt(t)}return t}async function vt(t){return U({...t,options:{...t.options,cache:"reload"}},"updated")}var k="https://feaas.blob.core.windows.net";function nt(t){let e=t.match(/^(?:(.*?)\/components)?\/?([^\/]+)\/([^\/]+)(?:\/([^\/]+)(?:\/(published|staged|saved|\d+)(?:\.html?)?)?)?$/);if(e){var[,r,i,n,o,s]=e;return{cdn:r,library:i,component:n,version:o,revision:s}}}function De(t){if(!t||!t.library||!t.component)throw new Error("Component requires `library` and `component` properties");return`${t.cdn&&t.cdn!=k?`${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 Le(t){return`${t.cdn&&t.cdn!=k?`${t.cdn}/styles/`:""}${t.library}/${!t.revision||t.revision=="published"?"":t.revision}`.replace(/\/$|\/\/(?!.+\/styles\/)/g,"")}function yt(t){let e=t.match(/^(?:(.*?)\/styles\/)?([^\/]+)(?:\/(published|staged|saved|\d+)(?:.css)?)?$/);if(e){var[,r,i,n]=e;return{cdn:r,library:i,revision:n}}else{let o=nt(t);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 Lt(t){return typeof t=="string"&&(t={src:t}),"src"in t&&(t={...nt(t.src)}),`${t.cdn||t.hostname||k}/components/${t.library}/${t.component}/${t.version}/${t.revision||"published"}.html`}function B(t){return typeof t=="string"&&(t={src:t}),"src"in t&&(t={...yt(t.src)}),`${t.cdn||t.hostname||k}/styles/${t.library}/${t.revision=="staged"?"staged":t.revision=="saved"?"saved":"published"}.css`}async function z(t,e,r=!1){let i=a=>a.headers.get("x-ms-meta-versionDeletedAt")==null,n=a=>a.clone().text().then(e),o=await Promise.all([t.instance&&U({options:{headers:{Accept:"text/html"},credentials:"omit"},url:Lt({...t,version:t.instance}),validator:i}).catch(a=>a),U({url:Lt(t),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:it({...s,callback:n}).catch(a=>{if(o[0]==s&&(vt({...s,callback:null,validator:null}),console.log("Fork was deleted"),!(o[1]instanceof Error)))return n(o[1].response),it({...o[1],callback:n});throw a})}async function $e(t){typeof t=="string"&&(t={src:t});var e;let{response:r}=await z(t,i=>{e=i},!0);return{...t,template:e,lastModified:r.headers.get("last-modified")}}async function bt(t,e){return typeof t=="string"&&(t={src:t}),rt(B(t),{headers:{Accept:"text/css"},credentials:"omit"},r=>r.headers.get("x-ms-meta-deletedAt")==null,(r,i)=>r.clone().text().then(n=>e(n,i)))}function Fe(t,e){return de(t,e||(e=document.createElement("style"))),e}function de(t,e){return e||(e=document.createElement("style")),bt(t,(r,i)=>{e.textContent=r}).then(()=>e)}function At(t,e){var r=ce(t);if(r){if(r.tagName=="LINK")return e(null,"initial"),Promise.resolve(r)}else var i=he(t);return bt(t,(n,o)=>{i&&(i.textContent=n),e==null||e(n,o)}).then(()=>r||i)}function $t(t){return new Promise((e,r)=>{At(t,e).catch(r)})}function ce(t){return document.head.querySelector(`style[data-href="${B(t)}"]`)||document.querySelector(`link[rel="stylesheet"][href="${B(t)}"]`)}function he(t){let e=B(t),r=document.createElement("style");return r.setAttribute("data-href",e),document.head.appendChild(r),r}function Ue(t,e){let r=document.createElement("div");r.innerHTML=t;let i=document.createDocumentFragment();for(;r.firstChild;)i.appendChild(r.firstChild);return R(i,e),r}function Ft(t,e){return ue(t,e||(e=document.createElement("div"))),e}async function ue(t,e){return e||(e=document.createElement("div")),e.childNodes.length?R(e,t.data,t):"template"in t?F(e,t.template,t.data,t):z(t,r=>F(e,r,t.data,t)).then(()=>e)}function je(t){let{params:e,method:r,headers:i,body:n,url:o}=x(t);var s={url:o},a={...i};return i["Content-Type"]==="application/json"&&delete a["Content-Type"],i.Accept==="application/json"&&delete a.Accept,Object.keys(a).length>0&&(s.headers=a),r!=="GET"&&(s.method=r),r==="GET"||r==="HEAD"||Object.keys(n).length===0||(s.body=n),Object.keys(e).length>0&&(s={...s,params:e}),s}var V=t=>{if(typeof t.url!="string")return!1;for(var e in t)if(!(e=="body"||e=="params"||e=="headers"||e=="url"||e==="method"||e=="jsonpath"&&typeof t[e]=="string"))return!1;return!0};function pe(t){let{url:e,headers:r,params:i,method:n,body:o}=x(t),s,a=r["Content-Type"];n!="GET"&&n!="HEAD"&&(a==="application/json"&&(s=JSON.stringify(o)),a==="multipart/form-data"&&(s=Object.keys(o).reduce((d,h)=>(d.append(h,o[h]),d),new FormData)),a==="application/x-www-form-urlencoded"&&(s=new URLSearchParams(o)));let l=Object.keys(i).length?`?${new URLSearchParams(i)}`:"";return[`${e}${l}`,{headers:r,body:s,method:n}]}function x(t){let e={};for(let r in(t==null?void 0:t.headers)||{})if(t.headers.hasOwnProperty(r)){let i=r.replace(/^[a-z]|\-[a-z]/g,n=>n.toUpperCase());e[i]=t.headers[r]}return e.Accept||(e.Accept="application/json"),{params:(t==null?void 0:t.params)||{},headers:e,jsonpath:String((t==null?void 0:t.jsonpath)||"$"),method:((t==null?void 0:t.method)||"GET").toUpperCase(),body:(t==null?void 0:t.body)||{},url:String((t==null?void 0:t.url)||"")}}var Ut=async t=>{try{let[e,r]=pe(t),n=await(await x.fetchImplementation(e,{...r,method:r.method.toLowerCase()})).json();return t.jsonpath&&t.jsonpath!="$"?H(n,t.jsonpath):n}catch(e){return{}}};async function jt(t){if(!t)return t;if(V(t))return Ut(t);let e=Object.keys(t),r=await Promise.all(e.map(i=>V(t[i])?Ut(t[i]):null).filter(Boolean));return e.reduce((i,n)=>({...i,[n]:V(t[n])?r.shift():t[n]}),{})}async function Ie(t){return t?V(t)||Object.values(t).some(V):!1}x.clean=je;x.toFetchArguments=pe;x.fetchOne=Ut;x.fetch=jt;x.isDataSettings=V;x.hasDataSettings=Ie;x.fetchImplementation=(...t)=>fetch(...t);function fe(t){var e,r,i,n,o,s,a,l;let d,h=t.getAttribute("src");if(h){let N=nt(h);if(!N)throw new Error(`Could not parse FEAAS Component source: ${h}`);var{cdn:f,library:u,component:c,version:p,revision:y}=N}let b=t.getAttribute("data");if(b!=null&&b!="")try{d=typeof b=="string"?JSON.parse(b):{}}catch(N){console.error(N)}let A=t.getAttribute("fetch");return{data:d||{},cdn:(r=(e=t.getContextAttribute("cdn"))!==null&&e!==void 0?e:f)!==null&&r!==void 0?r:k,library:(i=t.getAttribute("library"))!==null&&i!==void 0?i:u,component:(n=t.getAttribute("component"))!==null&&n!==void 0?n:c,version:(s=(o=t.getAttribute("version"))!==null&&o!==void 0?o:p)!==null&&s!==void 0?s:"responsive",revision:(l=(a=t.getAttribute("revision"))!==null&&a!==void 0?a:y)!==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"),fetch:A=="false"?[]:A==null||A=="true"?["data","template","stylesheet"]:A.split(/(\s+|\-)+/g).filter(Boolean)}}var ot=class extends E{setData(e){this.set({data:e})}getProps(){return fe(this)}isJSONAttribute(e){return e=="data"}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),e==="data"&&this.props.fetch.includes("data")&&this.fetchData())}async fetchData(){this.readyData=void 0,this.whenDataReady=this.whenDataReady.restart();let e=await x.fetch(this.props.data),r=this.alreadyRendered;await this.whenDataReady.resolve(e),r&&this.advance()}getEditor(){var e;return(e=document.querySelector("feaas-context"))===null||e===void 0?void 0:e.refs.editor}constructor(){super(),this.readyData={},this.whenDataReady=S(e=>this.readyData=e,e=>this.onError(e)),this.defaultProps={cdn:k,revision:"published",version:"responsive",editable:!1,suspended:!1,data:{}},this.onLoad=e=>{this.payload=e,this.advance()},this.getAttribute("data")||this.whenDataReady.resolve({}),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(){var e;if(this.getOriginal())return;let r=()=>{this.payload!=null&&(i||this.readyData&&this.onLoad(this.payload))};if(this.props.fetch.includes("stylesheet"))var i=$t({...this.props}).then(()=>{i=null,r()});if(this.props.fetch.includes("template"))var n=z(this.props,o=>{this.payload=o,r()});else this.payload=(e=this.props.template)!==null&&e!==void 0?e:this.innerHTML;return Promise.all([i,this.whenDataReady.then(()=>r()),n]).then(()=>this.payload)}flush(){this.readyData&&super.flush()}update(){if(this.alreadyRendered=!0,!(!this.props.fetch.includes("data")&&!this.props.fetch.includes("template")&&this.firstElementChild))if(Array.from(this.children).filter(e=>e.tagName!="BR").length>0&&!this.needsRefresh)R(this,this.readyData);else{if(this.needsRefresh=!0,this.getOriginal())return;F(this,this.payload,this.readyData)}}};ot.observedAttributes=["library","component","version","revision","hostname","cdn","template","data","instance","editable","with-stylesheet"];ot.register("feaas-component");function me(t){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 st=class extends E{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return me(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;
5
5
  top: 0;
@@ -63,10 +63,10 @@ var ke=Object.defineProperty;var K=(t,e)=>{for(var r in e)ke(t,r,{get:e[r],enume
63
63
  style="animation: 1.5s linear 0s infinite normal none running loader-circular-track"
64
64
  ></circle>
65
65
  </svg>
66
- </div>`,this.getRoot().appendChild(this.stylesheet),this.getRoot().appendChild(this.loader)}update(){this.loader.style.opacity=String(this.props.opacity)}};nt.observedAttributes=["hidden","opacity"];nt.register("feaas-loader");function ge(t){var e,r,i,n;let o=t.getAttribute("src");if(o)var{cdn:s,library:a,revision:l}=vt(o);return{library:t==null?void 0:t.getContextAttribute("library"),revision:(r=(e=t==null?void 0:t.getAttribute("revision"))!==null&&e!==void 0?e:l)!==null&&r!==void 0?r:"published",cdn:(n=(i=t==null?void 0:t.getContextAttribute("cdn"))!==null&&i!==void 0?i:t==null?void 0:t.getContextAttribute("hostname"))!==null&&n!==void 0?n:P}}var At=class extends E{constructor(){super(...arguments),this.onLoad=e=>{this.payload=e,this.advance()}}getProps(){return ge(this)}isReadyToLoad(){return this.props.library!=null&&this.props.revision!=null&&this.props.cdn!=null}load(){return bt(this.props,this.onLoad)}};At.register("feaas-stylesheet");var Et={};K(Et,{convertBase64toBlob:()=>ve,generate:()=>Ae,get:()=>We,getVersionForThumbnail:()=>ye,load:()=>be,responseToImage:()=>jt,upload:()=>Ee});var ve=t=>fetch(t).then(e=>e.blob()),jt=t=>t.blob().then(e=>new Promise((r,i)=>{let n=new Image;n.onerror=i,n.onload=()=>{r(n)},n.src=URL.createObjectURL(e)}));async function ye(t){return t.versions.length||await t.versions.fetch(),t.getVersionForWidth(800)}async function We(t,e,r){try{if(!t.isNew)return await be(t,e,r)}catch(n){t.sdk.log(`FEAAS: Thumbnail ${t.id}, version: ${(e==null?void 0:e.id)||"responsive"}, status: generating ${status}, reason: ${n}`)}let i=await Ae(t,e);return r==null||r(i,!1),i&&!t.isNew&&ve(i.src).then(n=>Ee(t,e,n)),i}async function be(t,e,r){let i=e?e.getThumbnailURL():t.getThumbnailURL(),n=t.library.stylesheet,o=new Date(Math.max(Number(t.modifiedAt),Number(n.modifiedAt)));t.sdk.log(`FEAAS: Thumbnail ${t.id}/${(e==null?void 0:e.id)||"responsive"}, loading`);var s;return await tt(i,{},(a,l)=>{let d=Math.abs(Number(new Date(a.headers.get("x-ms-meta-componentRenderedAt")))-Number(o))<2e3;return l&&!d&&jt(a).then(h=>{s=h,r(h,l)}),d},(a,l,d)=>{t.sdk.log(`FEAAS: Thumbnail ${t.id}/${(e==null?void 0:e.id)||"responsive"}, status: ${l}`),jt(a).then(h=>{s=h,r(h,d)})},null),s}async function Ae(t,e,r){let i=e||(t.isNew?null:await ye(t));if(!i||i.isViewEmpty())return null;let n=r||t.library.stylesheets.first,{datasources:o}=t.sdk;return await He(i.classList,n.getBreakpointForWidth(800,i.getBreakpoints()),i.view,o.reduce((a,l)=>Object.assign(a,{[l.id]:l.sample}),{}),n.css,t.sdk)}function He(t,e,r,i,n,o){let s=document.createElement("iframe");return s.style.position="absolute",s.style.top="-2000px",s.style.left="-2000px",s.style.width=e.props.minWidth+"px",s.style.height="720px",s.style.zIndex="100011",document.body.appendChild(s),new Promise((a,l)=>{let d=document.createElement("script");d.onerror=l,d.src=o.frontend+"/assets/html2canvas.js",d.onload=()=>{var c;(((c=s.contentWindow.document.fonts)===null||c===void 0?void 0:c.ready)||Promise.resolve()).then(function(){return s.contentWindow.html2canvas(u,{scale:Math.max(1.1,1e3/Math.min(1401,Math.max(320,e.props.minWidth))),width:Math.min(1401,Math.max(320,e.props.minWidth)),height:Math.max(1,Math.min(2e3,u.offsetHeight)),windowWidth:e.props.minWidth+"px",windowHeight:1e3,proxy:o.backend+"/proxy/media",backgroundColor:"#ffffff"}).then(p=>{let v=p.toDataURL("image/jpeg",.6);s.parentElement.removeChild(s);let y=new Image;y.onload=()=>{a(y)},y.onerror=l,y.src=v})})},s.contentWindow.document.head.appendChild(d);let h=s.contentWindow.document.createElement("style");h.textContent=`
66
+ </div>`,this.getRoot().appendChild(this.stylesheet),this.getRoot().appendChild(this.loader)}update(){this.loader.style.opacity=String(this.props.opacity)}};st.observedAttributes=["hidden","opacity"];st.register("feaas-loader");function ge(t){var e,r,i,n;let o=t.getAttribute("src");if(o)var{cdn:s,library:a,revision:l}=yt(o);return{library:t==null?void 0:t.getContextAttribute("library"),revision:(r=(e=t==null?void 0:t.getAttribute("revision"))!==null&&e!==void 0?e:l)!==null&&r!==void 0?r:"published",cdn:(n=(i=t==null?void 0:t.getContextAttribute("cdn"))!==null&&i!==void 0?i:t==null?void 0:t.getContextAttribute("hostname"))!==null&&n!==void 0?n:k}}var Et=class extends E{constructor(){super(...arguments),this.onLoad=e=>{this.payload=e,this.advance()}}getProps(){return ge(this)}isReadyToLoad(){return this.props.library!=null&&this.props.revision!=null&&this.props.cdn!=null}load(){return At(this.props,this.onLoad)}};Et.register("feaas-stylesheet");var wt={};Q(wt,{convertBase64toBlob:()=>ve,generate:()=>Ae,get:()=>We,getVersionForThumbnail:()=>ye,load:()=>be,responseToImage:()=>It,upload:()=>Ee});var ve=t=>fetch(t).then(e=>e.blob()),It=t=>t.blob().then(e=>new Promise((r,i)=>{let n=new Image;n.onerror=i,n.onload=()=>{r(n)},n.src=URL.createObjectURL(e)}));async function ye(t){return t.versions.length||await t.versions.fetch(),t.getVersionForWidth(800)}async function We(t,e,r){try{if(!t.isNew)return await be(t,e,r)}catch(n){t.sdk.log(`FEAAS: Thumbnail ${t.id}, version: ${(e==null?void 0:e.id)||"responsive"}, status: generating ${status}, reason: ${n}`)}let i=await Ae(t,e);return r==null||r(i,!1),i&&!t.isNew&&ve(i.src).then(n=>Ee(t,e,n)),i}async function be(t,e,r){let i=e?e.getThumbnailURL():t.getThumbnailURL(),n=t.library.stylesheet,o=new Date(Math.max(Number(t.modifiedAt),Number(n.modifiedAt)));t.sdk.log(`FEAAS: Thumbnail ${t.id}/${(e==null?void 0:e.id)||"responsive"}, loading`);var s;return await rt(i,{},(a,l)=>{let d=Math.abs(Number(new Date(a.headers.get("x-ms-meta-componentRenderedAt")))-Number(o))<2e3;return l&&!d&&It(a).then(h=>{s=h,r(h,l)}),d},(a,l,d)=>{t.sdk.log(`FEAAS: Thumbnail ${t.id}/${(e==null?void 0:e.id)||"responsive"}, status: ${l}`),It(a).then(h=>{s=h,r(h,d)})},null),s}async function Ae(t,e,r){let i=e||(t.isNew?null:await ye(t));if(!i||i.isViewEmpty())return null;let n=r||t.library.stylesheets.first,{datasources:o}=t.sdk;return await He(i.classList,n.getBreakpointForWidth(800,i.getBreakpoints()),i.view,o.reduce((a,l)=>Object.assign(a,{[l.id]:l.sample}),{}),n.css,t.sdk)}function He(t,e,r,i,n,o){let s=document.createElement("iframe");return s.style.position="absolute",s.style.top="-2000px",s.style.left="-2000px",s.style.width=e.props.minWidth+"px",s.style.height="720px",s.style.zIndex="100011",document.body.appendChild(s),new Promise((a,l)=>{let d=document.createElement("script");d.onerror=l,d.src=o.frontend+"/assets/html2canvas.js",d.onload=()=>{var c;(((c=s.contentWindow.document.fonts)===null||c===void 0?void 0:c.ready)||Promise.resolve()).then(function(){return s.contentWindow.html2canvas(u,{scale:Math.max(1.1,1e3/Math.min(1401,Math.max(320,e.props.minWidth))),width:Math.min(1401,Math.max(320,e.props.minWidth)),height:Math.max(1,Math.min(2e3,u.offsetHeight)),windowWidth:e.props.minWidth+"px",windowHeight:1e3,proxy:o.backend+"/proxy/media",backgroundColor:"#ffffff"}).then(p=>{let y=p.toDataURL("image/jpeg",.6);s.parentElement.removeChild(s);let b=new Image;b.onload=()=>{a(b)},b.onerror=l,b.src=y})})},s.contentWindow.document.head.appendChild(d);let h=s.contentWindow.document.createElement("style");h.textContent=`
67
67
  ${n}
68
68
  body, html { padding: 0; margin: 0; overflow: hidden }
69
69
  `;let f=s.contentWindow.document.createElement("style");f.textContent=`
70
70
  body, html { padding: 0; margin: 0; overflow: hidden }
71
- `,s.contentWindow.document.head.appendChild(h),s.contentWindow.document.head.appendChild(f);let u=$t({template:r,data:i});u.classList.add(...t,"-feaas--preview","-emulate--"+e.details.slug),s.contentWindow.document.body.appendChild(u)})}async function Ee(t,e,r){let i=e?e.getThumbnailURL():t.getThumbnailURL(),n=new Date(Math.max(Number(t.modifiedAt),Number(t.library.stylesheet.modifiedAt)));try{await t.sdk.uploadBlob("thumbnails",i.split(/\/thumbnails\//)[1],r,{headers:{"x-ms-blob-content-type":"image/jpg","x-ms-blob-cache-control":"public,max-age=31536000,immutable","x-ms-meta-versionId":e?e.id:null,"x-ms-meta-versionRevision":e?e.revision.toString():null,"x-ms-meta-componentId":t.id,"x-ms-meta-componentRenderedAt":n.toUTCString(),"x-ms-meta-componentModifiedAt":t.modifiedAt.toUTCString(),"x-ms-meta-componentCreatedAt":t.createdAt.toUTCString(),"x-ms-meta-modifiedAt":t.modifiedAt.toUTCString()}}),fetch(i,{cache:"no-cache"}).then(()=>{t.sdk.log("FEAAS: Thumbnail uploaded",i)})}catch(o){t.sdk.log("FEAAS: Thumbnail failed to upload",i,o)}return i}var It;typeof window!="undefined"&&(window.FEAASReactElement=H,(It=window.FEAASLoading)!==null&&It!==void 0||(window.FEAASLoading=Promise.resolve()));function we(t){let e=[];if(t){let r=t.ownerDocument.defaultView,i,n;for(;r!==window.top;){i=r.parent;for(let o=0;o<i.frames.length;o++)if(i.frames[o]===r){for(let s of i.document.getElementsByTagName("iframe"))if(s.contentWindow===r){n=s.getBoundingClientRect();let a=s.contentWindow.getComputedStyle(s);e.push({left:n.left+parseInt(a.borderLeftWidth),top:n.top+parseInt(a.borderTopWidth)})}r=i;break}}}return e.reduce((r,i)=>({left:r.left+i.left,top:r.top+i.top}),{left:0,top:0})}function Ce(t){var e;return{context:HTMLElement,frontend:t==null?void 0:t.getContextAttribute("frontend"),src:(e=t==null?void 0:t.getAttribute("src"))!==null&&e!==void 0?e:"/editor.js",library:t==null?void 0:t.getAttribute("library"),component:t==null?void 0:t.getAttribute("component"),version:t==null?void 0:t.getAttribute("version"),instance:t==null?void 0:t.getAttribute("instance"),forked:t==null?void 0:t.getAttribute("forked"),revision:(t==null?void 0:t.getAttribute("revision"))||"saved",hidden:(t==null?void 0:t.getAttribute("hidden"))!=null,for:t==null?void 0:t.getAttribute("for"),state:(t==null?void 0:t.getAttribute("state"))||"idle",changed:(t==null?void 0:t.getAttribute("changed"))!=null}}var ot=class extends E{constructor(){super(...arguments),this.framePoint={top:0,left:0},this.wrapperRect={top:0,left:0,width:0,height:0},this.bodyRect={top:0,left:0,width:0,height:0},this.defaultProps={hidden:!1},this.setTarget=(e,r={component:e.getAttribute("component"),version:e.getAttribute("version"),revision:e.getAttribute("revision"),instance:e.getAttribute("instance")})=>{if(!this.closing&&(!this.target||e==null))return this.set(r),this.target=e,!0},this.onChromeMeasureElement=(e,r=e.getBoundingClientRect())=>e.ownerDocument==document?{left:r.left-this.bodyRect.left,top:r.top-this.bodyRect.top,width:r.width,height:r.height}:{left:r.left+this.framePoint.left-this.bodyRect.left,top:r.top+this.framePoint.top-this.bodyRect.top,width:r.width,height:r.height},this.onBeforeMeasure=e=>{e.memoized.focusable&&(this.framePoint=we(e.memoized.focusable)),this.chrome&&(this.wrapperRect=this.chrome.positionable.getBoundingClientRect(),this.bodyRect=this.chrome.positionable.ownerDocument.body.parentElement.getBoundingClientRect())},this.onMeasure=()=>{},this.onPosition=({focusable:e,root:r})=>{!this.chrome||this.props.hidden||(e?(this.chrome.wrapper.style.width=e.width+16*2+"px",this.chrome.wrapper.style.height=e.height+16*1+64+"px",this.chrome.wrapper.style.left=e.left-16+"px",this.chrome.wrapper.style.top=e.top-64+"px",this.chrome.wrapper.style.opacity="1",this.chrome.absolute=this.querySelector(".ui.overlays"),this.chrome.absolute&&(this.chrome.absolute.style.left=r.left+"px",this.chrome.absolute.style.top=r.top+"px")):(this.chrome.wrapper.style.opacity="0",this.chrome.wrapper.style.left="-1000px",this.chrome.wrapper.style.top="-1000px"))},this.onWindowMessage=e=>{var r;switch((r=e.data)===null||r===void 0?void 0:r.type){case"feaasEdit":let i=this.getPlaceholder();this.setTarget(i.editable,e.data)&&(this.loader=i.loader,document.body.appendChild(i.clipper),this.editedUID=e.data.id,this.setPlaceholder(),this.open());break;case"feaasMeasurements":this.measurements=e.data.measurements,this.props.hidden||this.setPlaceholder();break}},this.onContentChange=()=>{this.setAttribute("changed","changed"),requestAnimationFrame(()=>{this.setIframeComponentContent()})},this.onClose=()=>{var e;this.setAttribute("hidden","hidden"),this.placeholder&&(this.placeholder.positionable.style.opacity="0",this.placeholder.positionable.style.pointerEvents="none"),this.chrome&&(this.chrome.wrapper.style.opacity="0"),!((e=this.target)===null||e===void 0)&&e.parentNode&&(this.target.outerHTML=this.target.outerHTML),this.setTarget(null,{component:null,version:null,instance:null,revision:null}),this.setEditorContext({isFocused:!1})},this.onVersionStateChange=(e,r)=>{this.versionContext=e,this.setVersionContext=r},this.onEditorStateChange=(e,r)=>{this.editorContext=e,this.setEditorContext=r,e.editor&&this.props.state=="loading"&&!this.props.hidden&&(this.setAttribute("state","ready"),this.ownerDocument.fonts.ready.then(()=>setTimeout(()=>{this.setReadyState(),this.setIframeComponentContent()},100)))}}getProps(){return Ce(this)}getReactRootElement(){return this.reactRootElement||(this.reactRootElement=document.createElement("div"),this.getRoot().appendChild(this.reactRootElement)),this.reactRootElement}showLoader(){this.loader||(this.loader=document.createElement("feaas-loader"),this.loader.setAttribute("opacity","0.6"),this.loader.style.zIndex="1000",this.target.appendChild(this.loader),this.target.tagName=="FEAAS-COMPONENT"&&(this.target.style.position="relative"))}hideLoader(){this.loader&&(this.loader.setAttribute("hidden","hidden"),this.target.tagName=="FEAAS-COMPONENT"&&(this.target.style.position="relative",this.target.style.position=""))}load(){return import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}connectedCallback(){super.connectedCallback(),window.addEventListener("message",this.onWindowMessage)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("message",this.onWindowMessage)}setIframe(e){this.iframe=e}setIframeComponentContent(){this.placeholder&&this.iframe&&this.placeholder.editable.innerHTML&&this.iframe.contentWindow.postMessage({type:"feaasUpdate",id:this.editedUID,content:this.placeholder.editable.innerHTML})}setPlaceholder(){if(!this.iframe)return;let e=this.iframe.clientWidth,r=this.iframe.clientHeight,i=this.iframe.getBoundingClientRect(),n=this.getPlaceholder(),o=document.body.getBoundingClientRect(),s=this.measurements[this.editedUID];s&&(Object.assign(n.clipper.style,{position:"absolute",top:i.top+this.iframe.clientTop-o.top+"px",left:i.left+this.iframe.clientLeft-o.left+"px",width:e+"px",height:r+"px",pointerEvents:"none",zIndex:1,overflow:"hidden"}),Object.assign(n.positionable.style,{position:"absolute",top:s.top+"px",left:s.left+"px",width:s.width+"px",zIndex:2,transition:"opacity 0.4s",pointerEvents:this.props.hidden?"none":"all"}),Object.assign(n.loader.style,{position:"absolute",top:s.top+"px",left:s.left+"px",width:s.width+"px",height:s.height+"px",filter:"opacity(0.6)",zIndex:3,pointerEvents:"none"}),document.dispatchEvent(new Event("feaasRefresh",{bubbles:!0})))}getPlaceholder(){return this.placeholder?this.placeholder:(this.placeholder={clipper:document.createElement("div"),positionable:document.createElement("div"),editable:Object.assign(document.createElement("div"),{className:"-feaas"}),loader:document.createElement("feaas-loader")},this.placeholder.clipper.appendChild(this.placeholder.positionable),this.placeholder.positionable.appendChild(this.placeholder.editable),this.placeholder.clipper.appendChild(this.placeholder.loader),this.placeholder)}attributeChangedCallback(e,r,i){r!==i&&(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))}open(){clearTimeout(this.closing),this.removeAttribute("hidden"),this.removeAttribute("changed"),this.setLoadingState()}shouldFork(e){return e.forkOriginId==null&&this.props.instance!=null}cleanup(){var e;this.placeholder&&((e=this.placeholder.clipper)===null||e===void 0||e.remove(),this.placeholder=null)}close(){console.log("Editor is not ready")}unfork(){console.log("Editor is not ready")}discard(){console.log("Editor is not ready")}save(){console.log("Editor is not ready")}setVersionContext(e){console.log("Editor is not ready")}setEditorContext(e){console.log("Editor is not ready")}setLoadingState(){this.showLoader(),this.setAttribute("state","loading")}setReadyState(){this.hideLoader(),this.setEditorContext({activeVersionId:this.component.versions[0].id}),this.setAttribute("state","ready")}render({children:e,component:r,version:i,instance:n},{Editor:o,VersionStatusList:s,VersionStatusButton:a,Version:l,VersionMenu:d,EditorUIUndo:h,EditorUIMode:f,React:{useEffect:u,useMemo:c,useState:p,useContext:v},Chakra:{HStack:y,Box:b,Button:O,MenuItem:at},Chrome:wt,ReactDOM:Ht,useSDK:lt,useLibrary:Ct,useSlots:W,useModelObserver:xt,ConfirmationContext:St,VersionContext:Bt}){if(!this.payload)return;let{React:g}=this.payload,M=lt(),dt=Ct(),[A,w]=p(),{setConfirm:_}=v(St),N=n||i;A&&(this.component=A),u(()=>{if(this.props.hidden)return;let T=dt.components.getItem(r).clone();return T.versions.search({ids:[i,n].filter(Boolean),componentIds:[r]}).then(Rt=>{T.versions.setItems(Rt);let k=T.findVersion(n,["staged","published"]),G=T.findVersion(i,["staged","published"]);if(k)k.deletedAt?(k.getDraft().changeAndNotify(G.toProperties()).restore(),console.error("FEAAS Editor: Restoring fork")):(console.error("FEAAS Editor: Pre-forked"),this.setAttribute("forked",k.id));else if(this.removeAttribute("forked"),this.shouldFork(G)){console.error("FEAAS Editor: Forking");let kt=G.fork(n).id;this.setAttribute("instance",kt)}else console.error("FEAAS Editor: Regular");w(T)}),()=>{this.closing=setTimeout(()=>{this.closing=null,this.cleanup(),w(null)},400)}},[i,this.props.hidden]);let zt=xt(A==null?void 0:A.versions,[]).filter(T=>T.id==N),q=zt[0];q&&!this.props.hidden&&(this.version=q),u(()=>(this.unfork=()=>{_({title:"Reverting component customizations",button:"Discard",body:"Are you sure to reset component to its original state? All changes will be lost.",action:()=>{let T=A.findVersion(i,["staged","published"]);A.findVersion(n).unstage().unpublish().changeAndNotify(T.toProperties()),A.saveVersions(!1),this.setVersionContext({needsWrite:!0}),this.removeAttribute("forked"),requestAnimationFrame(this.onClose)}})},this.discard=()=>{this.props.changed&&(A.findVersion(N).revert(),A.saveVersions(!1),this.setVersionContext({needsWrite:!0}))},this.close=()=>{_({title:"Component has unsaved changes",button:"Discard",body:"Are you sure to close editor and discard changes?",bypass:!this.props.changed,action:()=>{this.discard(),requestAnimationFrame(this.onClose)}})},this.save=()=>{_({bypass:!!this.props.forked,title:"Customizing component",button:"Save",body:"Changes to the component will only be visible on that page. Changes to component done in Component Builder will not be reflected here. It will be possible to revert the customization.",action:()=>{A.findVersion(N).commitData({view:this.editorContext.editor.getData({rootName:N}),model:""}).stage().publish(),this.removeAttribute("changed"),this.setAttribute("forked",N),A.saveVersions(!1)}})},()=>{delete this.unfork,delete this.discard,delete this.save,delete this.editorContext,delete this.versionContext,delete this.setEditorContext,delete this.setVersionContext}),[A]);let Re=c(()=>this.target,[A]);return c(()=>A&&W(e,({picker:T,children:Rt})=>g.createElement(b,{ref:k=>{this.chrome=k?{positionable:k,wrapper:k.querySelector(".editor-chrome"),absolute:this.querySelector(".ui.overlays")}:null}},g.createElement(b,{className:"editor-wrapper",position:"absolute",left:0,top:0},g.createElement(o,{datasources:M.datasources,sdk:M,library:dt,component:A,versions:zt,context:{isAutosaveEnabled:!1,onChromeMeasure:this.onMeasure,onChromeBeforeMeasure:this.onBeforeMeasure,onChromeMeasureElement:this.onChromeMeasureElement,onChromePosition:this.onPosition,onContentChange:this.onContentChange}},{exports:this.onEditorStateChange,after:Rt,chrome:({editor:k})=>k&&g.createElement(wt,null),children:({isArchivedDisplayed:k,editor:G,status:kt})=>g.createElement(b,{position:"absolute",left:0,top:0,className:"editor-chrome",p:4,boxShadow:"2xl",pointerEvents:"none",opacity:0,transition:"opacity 0.3s"},g.createElement(b,{left:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),g.createElement(b,{right:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),g.createElement(b,{top:0,height:"16",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),g.createElement(b,{bottom:0,height:"4",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),q&&g.createElement(l,{version:q,node:Re,ignoreBreakpoints:!0,deps:[this.props.forked,this.props.changed]},{exports:this.onVersionStateChange,left:g.createElement(y,{justifyContent:"space-between"},g.createElement(h,{size:"sm",editor:kt=="ready"?G:null}),g.createElement(f,{size:"sm"})),middle:(Be,ze)=>[!1],right:g.createElement(g.Fragment,null,g.createElement(O,{variant:"secondary",size:"sm",onClick:this.close},"Close"),g.createElement(O,{variant:"primary",size:"sm",onClick:this.save,isDisabled:!this.props.changed},this.props.changed?this.props.forked?"Save":"Save customization":"Up to date"),g.createElement(d,{isDisabled:!this.props.forked&&!this.props.changed},g.createElement(at,{onClick:this.unfork,isDisabled:!this.props.forked},"Unfork"),g.createElement(at,{onClick:this.discard,isDisabled:!this.props.changed},"Discard")))}))})))),[q,this.props.forked,this.props.changed])}isReadyToLoad(){return this.props.component!=null&&this.props.version!=null&&!this.props.hidden}};ot.observedAttributes=["library","component","version","revision","hidden","state","changed","forked"];ot.register("feaas-editor");function xe(t){var e,r;return{part:(t==null?void 0:t.getAttribute("part"))||"picker",slot:(t==null?void 0:t.getAttribute("part"))||"picker",mode:t==null?void 0:t.getAttribute("mode"),dialog:t==null?void 0:t.getAttribute("dialog"),placeholder:(t==null?void 0:t.getAttribute("placeholder"))||"No theme",frontend:(e=t==null?void 0:t.getContextAttribute("frontend"))!==null&&e!==void 0?e:"https://components.sitecorecloud.io",src:(r=t==null?void 0:t.getAttribute("src"))!==null&&r!==void 0?r:"/picker.js",hidden:(t==null?void 0:t.getAttribute("hidden"))!=null,variant:t==null?void 0:t.getAttribute("variant"),context:void 0,onClose:void 0,setAttribute:void 0,getAttribute:void 0}}var st=class extends E{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return xe(this)}load(){return this.import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}connectedCallback(){this.setAttribute("feaas-role","ui"),super.connectedCallback()}render({placeholder:e,context:r,mode:i,dialog:n,children:o,variant:s},{Picker:a,React:l,useContext:d,EnvironmentContext:h,useLibrary:f,useSDK:u,BYOC:c}){var p,v,y;let[b,O]=l.useReducer(w=>w+1,0),at=u(),wt=d(h),Ht=f("collections"),lt=f("components"),Ct=u("datasources"),W=f(),xt=((v=(p=W.stylesheets)===null||p===void 0?void 0:p.first)===null||v===void 0?void 0:v.rules)||((y=W==null?void 0:W.stylesheet)===null||y===void 0?void 0:y.styles),St=lt.find(w=>w.id==(r==null?void 0:r.getAttribute("component"))),Bt=u("externalComponents");var g=r==null?void 0:r.getAttribute("data");if(g)try{g=JSON.parse(g)}catch(w){}if(r)var M=at.ExternalComponent.getDefinition(r),dt=M&&!M.getConfiguration(r),A=(M==null?void 0:M.type)=="feaas"?lt.find(w=>w.id==r.getAttribute("component")):c==null?void 0:c.getComponent(String(r.getAttribute("data-external-id")));return l.createElement(a,{cdn:wt.cdn,rules:xt,collections:Ht,themeContext:r,placeholder:e,component:St,embed:A,externalComponents:Bt,datasources:Ct,data:g,versionId:r==null?void 0:r.getAttribute("version"),mode:i||(dt?"library":A?"context":null),setAttribute:(w,_,N)=>{_=="data"&&N&&(N=JSON.stringify(N)),this.props.setAttribute(w,_,N),O()},getAttribute:(w,_)=>r==null?void 0:r.getAttribute(_),dialog:n,context:r,variant:s,onModeChange:(w,_)=>{this.set({mode:w,dialog:_})}},o)}};st.observedAttributes=["library","mode","frontend","src","hidden","variant","dialog"];st.register("feaas-picker");function Se(t){var e,r,i,n,o;return{library:t==null?void 0:t.getAttribute("library"),src:(e=t==null?void 0:t.getAttribute("src"))!==null&&e!==void 0?e:"/context.js",environment:(r=t==null?void 0:t.getAttribute("environment"))!==null&&r!==void 0?r:void 0,frontend:(i=t==null?void 0:t.getAttribute("frontend"))!==null&&i!==void 0?i:"https://components.sitecorecloud.io",backend:(n=t==null?void 0:t.getAttribute("backend"))!==null&&n!==void 0?n:"https://components.sitecorecloud.io/api",cdn:(o=t==null?void 0:t.getAttribute("cdn"))!==null&&o!==void 0?o:"https://feaas.blob.core.windows.net",auth:null,isolate:(t==null?void 0:t.getAttribute("isolate"))==null||(t==null?void 0:t.getAttribute("isolate"))=="true"}}var I=class extends E{constructor(){super(...arguments),this.defaultProps={isolate:!0},this.onStatusChange=(e,r)=>{e=="ready"&&(this.whenSDKReady.resolve(r),this.dispatchEvent(new CustomEvent("feaasReady",{bubbles:!0,composed:!0,detail:r})))},this.whenSDKReady=S(e=>{this.sdk=e})}getProps(){return Se(this)}load(){return this.import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}isReadyToLoad(){return super.isReadyToLoad()&&this.props.library!=null}getTheme(e){return e}getRoot(){return this.getAttribute("isolate")==="false"?this:this.shadowRoot||this.attachShadow({mode:"open"})}getReactRootElement(){return this.reactRootElement||(this.reactRootElement=document.createElement("div"),this.getRoot().appendChild(this.reactRootElement)),this.reactRootElement}connectedCallback(){this.setAttribute("feaas-role","ui"),Array.from(this.children).forEach(e=>{this.getRoot().appendChild(e)}),document.addEventListener("feaasMount",this),document.addEventListener("feaasUnmount",this),super.connectedCallback()}disconnectedCallback(){document.removeEventListener("feaasMount",this),document.removeEventListener("feaasUnmount",this),super.disconnectedCallback()}getPortalRoot(){return this.getRoot()}render({children:e,library:r},{AppContext:i,Chakra:{Button:n,Tooltip:o},React:s}){let a={containerRef:{current:this.getPortalRoot()}};return o.defaultProps={hasArrow:!0,placement:"top",portalProps:a},s.createElement(i,{environment:this.props.environment,backend:this.props.backend,libraryId:this.props.library,container:this.getRoot(),auth:this.props.auth,getTheme:this.getTheme,onStatusChange:this.onStatusChange,modalProps:{portalProps:a},chakraProps:{resetScope:':where([feaas-role="ui"])',cssVarsRoot:":host",resetCSS:!0,toastOptions:{portalProps:a}}},e)}};I.observedAttributes=["library","component","version","revision","hostname","template"];I.register("feaas-context");I.prototype.clientside=Wt;export{it as Component,fe as ComponentProps,I as Context,S as ControlledPromise,P as DEFAULT_CDN_URL,ft as DOM,pt as DataPath,ht as DataScope,x as DataSettings,E as Element,it as FEAASComponent,fe as FEAASComponentsProps,I as FEAASContext,Se as FEAASContextProps,ot as FEAASEditor,Ce as FEAASEditorProps,E as FEAASElement,nt as FEAASLoader,me as FEAASLoaderProps,st as FEAASPicker,xe as FEAASPickerProps,At as FEAASStylesheet,ge as FEAASStylesheetProps,mt as InvalidResponse,m as JSONPath,nt as Loader,ct as MyComponent,st as Picker,At as Stylesheet,Et as Thumbnail,Vt as WebComponent,Xt as adjustNumbers,Gt as autoloadScripts,X as cleanCollectionBit,Me as clearFetchCache,he as createStylesheet,tt as fetchAndRevalidate,V as fetchAndRevalidateComponent,yt as fetchAndRevalidateStylesheet,gt as fetchBypassingCache,Z as fetchCache,$e as fetchComponent,Ut as fetchData,et as fetchToValidateCache,j as fetchWithCacheAwareness,ce as findStylesheet,De as getComponentSource,Dt as getComponentURL,le as getFetchCache,we as getFramePosition,Zt as getHumanizedLabel,te as getLastPathBit,Qt as getQualifier,Le as getStylesheetSource,z as getStylesheetURL,Q as loadScript,bt as loadStylesheet,Lt as loadStylesheetAllowStale,ut as normalizeCollectionScope,qt as observeDOMElement,rt as parseComponentSource,Kt as parseLimit,Yt as parseRange,vt as parseStylesheetSource,B as queryObject,Pt as queryObjectRaw,Y as queryScopes,$t as renderComponent,Ue as renderComponentElement,ue as renderComponentPromise,U as renderDOMContent,R as renderDOMElement,se as renderHTMLContent,Fe as renderStylesheet,de as renderStylesheetPromise,L as serializeCH1RichText,F as setDOMAttribute};
71
+ `,s.contentWindow.document.head.appendChild(h),s.contentWindow.document.head.appendChild(f);let u=Ft({template:r,data:i});u.classList.add(...t,"-feaas--preview","-emulate--"+e.details.slug),s.contentWindow.document.body.appendChild(u)})}async function Ee(t,e,r){let i=e?e.getThumbnailURL():t.getThumbnailURL(),n=new Date(Math.max(Number(t.modifiedAt),Number(t.library.stylesheet.modifiedAt)));try{await t.sdk.uploadBlob("thumbnails",i.split(/\/thumbnails\//)[1],r,{headers:{"x-ms-blob-content-type":"image/jpg","x-ms-blob-cache-control":"public,max-age=31536000,immutable","x-ms-meta-versionId":e?e.id:null,"x-ms-meta-versionRevision":e?e.revision.toString():null,"x-ms-meta-componentId":t.id,"x-ms-meta-componentRenderedAt":n.toUTCString(),"x-ms-meta-componentModifiedAt":t.modifiedAt.toUTCString(),"x-ms-meta-componentCreatedAt":t.createdAt.toUTCString(),"x-ms-meta-modifiedAt":t.modifiedAt.toUTCString()}}),fetch(i,{cache:"no-cache"}).then(()=>{t.sdk.log("FEAAS: Thumbnail uploaded",i)})}catch(o){t.sdk.log("FEAAS: Thumbnail failed to upload",i,o)}return i}var Wt;typeof window!="undefined"&&(window.FEAASReactElement=W,(Wt=window.FEAASLoading)!==null&&Wt!==void 0||(window.FEAASLoading=Promise.resolve()));function we(t){let e=[];if(t){let r=t.ownerDocument.defaultView,i,n;for(;r!==window.top;){i=r.parent;for(let o=0;o<i.frames.length;o++)if(i.frames[o]===r){for(let s of i.document.getElementsByTagName("iframe"))if(s.contentWindow===r){n=s.getBoundingClientRect();let a=s.contentWindow.getComputedStyle(s);e.push({left:n.left+parseInt(a.borderLeftWidth),top:n.top+parseInt(a.borderTopWidth)})}r=i;break}}}return e.reduce((r,i)=>({left:r.left+i.left,top:r.top+i.top}),{left:0,top:0})}function Ce(t){var e;return{context:HTMLElement,frontend:t==null?void 0:t.getContextAttribute("frontend"),src:(e=t==null?void 0:t.getAttribute("src"))!==null&&e!==void 0?e:"/editor.js",library:t==null?void 0:t.getAttribute("library"),component:t==null?void 0:t.getAttribute("component"),version:t==null?void 0:t.getAttribute("version"),instance:t==null?void 0:t.getAttribute("instance"),forked:t==null?void 0:t.getAttribute("forked"),revision:(t==null?void 0:t.getAttribute("revision"))||"saved",hidden:(t==null?void 0:t.getAttribute("hidden"))!=null,for:t==null?void 0:t.getAttribute("for"),state:(t==null?void 0:t.getAttribute("state"))||"idle",changed:(t==null?void 0:t.getAttribute("changed"))!=null}}var at=class extends E{constructor(){super(...arguments),this.framePoint={top:0,left:0},this.wrapperRect={top:0,left:0,width:0,height:0},this.bodyRect={top:0,left:0,width:0,height:0},this.defaultProps={hidden:!1},this.setTarget=(e,r={component:e.getAttribute("component"),version:e.getAttribute("version"),revision:e.getAttribute("revision"),instance:e.getAttribute("instance")})=>{if(!this.closing&&(!this.target||e==null))return this.set(r),this.target=e,!0},this.onChromeMeasureElement=(e,r=e.getBoundingClientRect())=>e.ownerDocument==document?{left:r.left-this.bodyRect.left,top:r.top-this.bodyRect.top,width:r.width,height:r.height}:{left:r.left+this.framePoint.left-this.bodyRect.left,top:r.top+this.framePoint.top-this.bodyRect.top,width:r.width,height:r.height},this.onBeforeMeasure=e=>{e.memoized.focusable&&(this.framePoint=we(e.memoized.focusable)),this.chrome&&(this.wrapperRect=this.chrome.positionable.getBoundingClientRect(),this.bodyRect=this.chrome.positionable.ownerDocument.body.parentElement.getBoundingClientRect())},this.onMeasure=()=>{},this.onPosition=({focusable:e,root:r})=>{!this.chrome||this.props.hidden||(e?(this.chrome.wrapper.style.width=e.width+16*2+"px",this.chrome.wrapper.style.height=e.height+16*1+64+"px",this.chrome.wrapper.style.left=e.left-16+"px",this.chrome.wrapper.style.top=e.top-64+"px",this.chrome.wrapper.style.opacity="1",this.chrome.absolute=this.querySelector(".ui.overlays"),this.chrome.absolute&&(this.chrome.absolute.style.left=r.left+"px",this.chrome.absolute.style.top=r.top+"px")):(this.chrome.wrapper.style.opacity="0",this.chrome.wrapper.style.left="-1000px",this.chrome.wrapper.style.top="-1000px"))},this.onWindowMessage=e=>{var r;switch((r=e.data)===null||r===void 0?void 0:r.type){case"feaasEdit":let i=this.getPlaceholder();this.setTarget(i.editable,e.data)&&(this.loader=i.loader,document.body.appendChild(i.clipper),this.editedUID=e.data.id,this.setPlaceholder(),this.open());break;case"feaasMeasurements":this.measurements=e.data.measurements,this.props.hidden||this.setPlaceholder();break}},this.onContentChange=()=>{this.setAttribute("changed","changed"),requestAnimationFrame(()=>{this.setIframeComponentContent()})},this.onClose=()=>{var e;this.setAttribute("hidden","hidden"),this.placeholder&&(this.placeholder.positionable.style.opacity="0",this.placeholder.positionable.style.pointerEvents="none"),this.chrome&&(this.chrome.wrapper.style.opacity="0"),!((e=this.target)===null||e===void 0)&&e.parentNode&&(this.target.outerHTML=this.target.outerHTML),this.setTarget(null,{component:null,version:null,instance:null,revision:null}),this.setEditorContext({isFocused:!1})},this.onVersionStateChange=(e,r)=>{this.versionContext=e,this.setVersionContext=r},this.onEditorStateChange=(e,r)=>{this.editorContext=e,this.setEditorContext=r,e.editor&&this.props.state=="loading"&&!this.props.hidden&&(this.setAttribute("state","ready"),this.ownerDocument.fonts.ready.then(()=>setTimeout(()=>{this.setReadyState(),this.setIframeComponentContent()},100)))}}getProps(){return Ce(this)}getReactRootElement(){return this.reactRootElement||(this.reactRootElement=document.createElement("div"),this.getRoot().appendChild(this.reactRootElement)),this.reactRootElement}showLoader(){this.loader||(this.loader=document.createElement("feaas-loader"),this.loader.setAttribute("opacity","0.6"),this.loader.style.zIndex="1000",this.target.appendChild(this.loader),this.target.tagName=="FEAAS-COMPONENT"&&(this.target.style.position="relative"))}hideLoader(){this.loader&&(this.loader.setAttribute("hidden","hidden"),this.target.tagName=="FEAAS-COMPONENT"&&(this.target.style.position="relative",this.target.style.position=""))}load(){return import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}connectedCallback(){super.connectedCallback(),window.addEventListener("message",this.onWindowMessage)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("message",this.onWindowMessage)}setIframe(e){this.iframe=e}setIframeComponentContent(){this.placeholder&&this.iframe&&this.placeholder.editable.innerHTML&&this.iframe.contentWindow.postMessage({type:"feaasUpdate",id:this.editedUID,content:this.placeholder.editable.innerHTML})}setPlaceholder(){if(!this.iframe)return;let e=this.iframe.clientWidth,r=this.iframe.clientHeight,i=this.iframe.getBoundingClientRect(),n=this.getPlaceholder(),o=document.body.getBoundingClientRect(),s=this.measurements[this.editedUID];s&&(Object.assign(n.clipper.style,{position:"absolute",top:i.top+this.iframe.clientTop-o.top+"px",left:i.left+this.iframe.clientLeft-o.left+"px",width:e+"px",height:r+"px",pointerEvents:"none",zIndex:1,overflow:"hidden"}),Object.assign(n.positionable.style,{position:"absolute",top:s.top+"px",left:s.left+"px",width:s.width+"px",zIndex:2,transition:"opacity 0.4s",pointerEvents:this.props.hidden?"none":"all"}),Object.assign(n.loader.style,{position:"absolute",top:s.top+"px",left:s.left+"px",width:s.width+"px",height:s.height+"px",filter:"opacity(0.6)",zIndex:3,pointerEvents:"none"}),document.dispatchEvent(new Event("feaasRefresh",{bubbles:!0})))}getPlaceholder(){return this.placeholder?this.placeholder:(this.placeholder={clipper:document.createElement("div"),positionable:document.createElement("div"),editable:Object.assign(document.createElement("div"),{className:"-feaas"}),loader:document.createElement("feaas-loader")},this.placeholder.clipper.appendChild(this.placeholder.positionable),this.placeholder.positionable.appendChild(this.placeholder.editable),this.placeholder.clipper.appendChild(this.placeholder.loader),this.placeholder)}attributeChangedCallback(e,r,i){r!==i&&(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))}open(){clearTimeout(this.closing),this.removeAttribute("hidden"),this.removeAttribute("changed"),this.setLoadingState()}shouldFork(e){return e.forkOriginId==null&&this.props.instance!=null}cleanup(){var e;this.placeholder&&((e=this.placeholder.clipper)===null||e===void 0||e.remove(),this.placeholder=null)}close(){console.log("Editor is not ready")}unfork(){console.log("Editor is not ready")}discard(){console.log("Editor is not ready")}save(){console.log("Editor is not ready")}setVersionContext(e){console.log("Editor is not ready")}setEditorContext(e){console.log("Editor is not ready")}setLoadingState(){this.showLoader(),this.setAttribute("state","loading")}setReadyState(){this.hideLoader(),this.setEditorContext({activeVersionId:this.component.versions[0].id}),this.setAttribute("state","ready")}render({children:e,component:r,version:i,instance:n},{Editor:o,VersionStatusList:s,VersionStatusButton:a,Version:l,VersionMenu:d,EditorUIUndo:h,EditorUIMode:f,React:{useEffect:u,useMemo:c,useState:p,useContext:y},Chakra:{HStack:b,Box:A,Button:N,MenuItem:dt},Chrome:Ct,ReactDOM:Bt,useSDK:xt,useLibrary:St,useSlots:I,useModelObserver:Rt,ConfirmationContext:_t,VersionContext:J}){if(!this.payload)return;let{React:g}=this.payload,ct=xt(),q=St(),[v,T]=p(),{setConfirm:P}=y(_t),G=n||i;v&&(this.component=v),u(()=>{if(this.props.hidden)return;let w=q.components.getItem(r).clone();return w.versions.search({ids:[i,n].filter(Boolean),componentIds:[r]}).then(O=>{w.versions.setItems(O);let _=w.findVersion(n,["staged","published"]),Y=w.findVersion(i,["staged","published"]);if(_)_.deletedAt?(_.getDraft().changeAndNotify(Y.toProperties()).restore(),console.error("FEAAS Editor: Restoring fork")):(console.error("FEAAS Editor: Pre-forked"),this.setAttribute("forked",_.id));else if(this.removeAttribute("forked"),this.shouldFork(Y)){console.error("FEAAS Editor: Forking");let kt=Y.fork(n).id;this.setAttribute("instance",kt)}else console.error("FEAAS Editor: Regular");T(w)}),()=>{this.closing=setTimeout(()=>{this.closing=null,this.cleanup(),T(null)},400)}},[i,this.props.hidden]);let zt=Rt(v==null?void 0:v.versions,[]).filter(w=>w.id==G),K=zt[0];K&&!this.props.hidden&&(this.version=K),u(()=>(this.unfork=()=>{P({title:"Reverting component customizations",button:"Discard",body:"Are you sure to reset component to its original state? All changes will be lost.",action:()=>{let w=v.findVersion(i,["staged","published"]);v.findVersion(n).unstage().unpublish().changeAndNotify(w.toProperties()),v.saveVersions(!1),this.setVersionContext({needsWrite:!0}),this.removeAttribute("forked"),requestAnimationFrame(this.onClose)}})},this.discard=()=>{this.props.changed&&(v.findVersion(G).revert(),v.saveVersions(!1),this.setVersionContext({needsWrite:!0}))},this.close=()=>{P({title:"Component has unsaved changes",button:"Discard",body:"Are you sure to close editor and discard changes?",bypass:!this.props.changed,action:()=>{this.discard(),requestAnimationFrame(this.onClose)}})},this.save=()=>{P({bypass:!!this.props.forked,title:"Customizing component",button:"Save",body:"Changes to the component will only be visible on that page. Changes to component done in Component Builder will not be reflected here. It will be possible to revert the customization.",action:()=>{var w,O;(O=(w=v.findVersion(G).commitData({view:this.editorContext.editor.getData({rootName:G}),model:""}))===null||w===void 0?void 0:w.stage())===null||O===void 0||O.publish(),this.removeAttribute("changed"),this.setAttribute("forked",G),v.saveVersions(!1)}})},()=>{delete this.unfork,delete this.discard,delete this.save,delete this.editorContext,delete this.versionContext,delete this.setEditorContext,delete this.setVersionContext}),[v]);let Re=c(()=>this.target,[v]);return c(()=>v&&I(e,({picker:w,children:O})=>g.createElement(A,{ref:_=>{this.chrome=_?{positionable:_,wrapper:_.querySelector(".editor-chrome"),absolute:this.querySelector(".ui.overlays")}:null}},g.createElement(A,{className:"editor-wrapper",position:"absolute",left:0,top:0},g.createElement(o,{datasources:ct.datasources,sdk:ct,library:q,component:v,versions:zt,context:{isAutosaveEnabled:!1,onChromeMeasure:this.onMeasure,onChromeBeforeMeasure:this.onBeforeMeasure,onChromeMeasureElement:this.onChromeMeasureElement,onChromePosition:this.onPosition,onContentChange:this.onContentChange}},{exports:this.onEditorStateChange,after:O,chrome:({editor:_})=>_&&g.createElement(Ct,null),children:({isArchivedDisplayed:_,editor:Y,status:kt})=>g.createElement(A,{position:"absolute",left:0,top:0,className:"editor-chrome",p:4,boxShadow:"2xl",pointerEvents:"none",opacity:0,transition:"opacity 0.3s"},g.createElement(A,{left:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),g.createElement(A,{right:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),g.createElement(A,{top:0,height:"16",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),g.createElement(A,{bottom:0,height:"4",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),K&&g.createElement(l,{version:K,node:Re,ignoreBreakpoints:!0,deps:[this.props.forked,this.props.changed]},{exports:this.onVersionStateChange,left:g.createElement(b,{justifyContent:"space-between"},g.createElement(h,{size:"sm",editor:kt=="ready"?Y:null}),g.createElement(f,{size:"sm"})),middle:(Be,ze)=>[!1],right:g.createElement(g.Fragment,null,g.createElement(N,{variant:"secondary",size:"sm",onClick:this.close},"Close"),g.createElement(N,{variant:"primary",size:"sm",onClick:this.save,isDisabled:!this.props.changed},this.props.changed?this.props.forked?"Save":"Save customization":"Up to date"),g.createElement(d,{isDisabled:!this.props.forked&&!this.props.changed},g.createElement(dt,{onClick:this.unfork,isDisabled:!this.props.forked},"Unfork"),g.createElement(dt,{onClick:this.discard,isDisabled:!this.props.changed},"Discard")))}))})))),[K,this.props.forked,this.props.changed])}isReadyToLoad(){return this.props.component!=null&&this.props.version!=null&&!this.props.hidden}};at.observedAttributes=["library","component","version","revision","hidden","state","changed","forked"];at.register("feaas-editor");function xe(t){var e,r;return{part:(t==null?void 0:t.getAttribute("part"))||"picker",slot:(t==null?void 0:t.getAttribute("part"))||"picker",mode:t==null?void 0:t.getAttribute("mode"),dialog:t==null?void 0:t.getAttribute("dialog"),placeholder:(t==null?void 0:t.getAttribute("placeholder"))||"No theme",frontend:(e=t==null?void 0:t.getContextAttribute("frontend"))!==null&&e!==void 0?e:"https://components.sitecorecloud.io",src:(r=t==null?void 0:t.getAttribute("src"))!==null&&r!==void 0?r:"/picker.js",hidden:(t==null?void 0:t.getAttribute("hidden"))!=null,variant:t==null?void 0:t.getAttribute("variant"),context:void 0,onClose:void 0,setAttribute:void 0,getAttribute:void 0}}var lt=class extends E{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return xe(this)}load(){return this.import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}connectedCallback(){this.setAttribute("feaas-role","ui"),super.connectedCallback()}render({placeholder:e,context:r,mode:i,dialog:n,children:o,variant:s},{Picker:a,React:l,useContext:d,EnvironmentContext:h,useLibrary:f,useSDK:u,BYOC:c}){var p,y,b;let[A,N]=l.useReducer(v=>v+1,0),dt=u(),Ct=d(h),Bt=f("collections"),xt=f("components"),St=u("datasources"),I=f(),Rt=((y=(p=I.stylesheets)===null||p===void 0?void 0:p.first)===null||y===void 0?void 0:y.rules)||((b=I==null?void 0:I.stylesheet)===null||b===void 0?void 0:b.styles),_t=u("externalComponents");var J=r==null?void 0:r.getAttribute("data");if(J)try{J=JSON.parse(J)}catch(v){}if(r)var g=dt.ExternalComponent.getDefinition(r),ct=g&&!g.getConfiguration(r),q=(g==null?void 0:g.type)=="feaas"?xt.find(v=>v.id==r.getAttribute("component")):c==null?void 0:c.getComponent(String(r.getAttribute("data-external-id")));return l.createElement(a,{cdn:Ct.cdn,rules:Rt,collections:Bt,themeContext:r,placeholder:e,embed:q,externalComponents:_t,datasources:St,data:J,versionId:r==null?void 0:r.getAttribute("version"),mode:i||(ct?"library":q?"context":null),setAttribute:(v,T,P)=>{T=="data"&&P&&(P=JSON.stringify(P)),this.props.setAttribute(v,T,P),N()},getAttribute:(v,T)=>r==null?void 0:r.getAttribute(T),dialog:n,context:r,variant:s,onModeChange:(v,T)=>{this.set({mode:v,dialog:T})}},o)}};lt.observedAttributes=["library","mode","frontend","src","hidden","variant","dialog"];lt.register("feaas-picker");function Se(t){var e,r,i,n,o;return{library:t==null?void 0:t.getAttribute("library"),src:(e=t==null?void 0:t.getAttribute("src"))!==null&&e!==void 0?e:"/context.js",environment:(r=t==null?void 0:t.getAttribute("environment"))!==null&&r!==void 0?r:void 0,frontend:(i=t==null?void 0:t.getAttribute("frontend"))!==null&&i!==void 0?i:"https://components.sitecorecloud.io",backend:(n=t==null?void 0:t.getAttribute("backend"))!==null&&n!==void 0?n:"https://components.sitecorecloud.io/api",cdn:(o=t==null?void 0:t.getAttribute("cdn"))!==null&&o!==void 0?o:"https://feaas.blob.core.windows.net",auth:null,isolate:(t==null?void 0:t.getAttribute("isolate"))==null||(t==null?void 0:t.getAttribute("isolate"))=="true"}}var j=class extends E{constructor(){super(...arguments),this.defaultProps={isolate:!0},this.onStatusChange=(e,r)=>{e=="ready"&&(this.whenSDKReady.resolve(r),this.dispatchEvent(new CustomEvent("feaasReady",{bubbles:!0,composed:!0,detail:r})))},this.whenSDKReady=S(e=>{this.sdk=e})}getProps(){return Se(this)}load(){return this.import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}isReadyToLoad(){return super.isReadyToLoad()&&this.props.library!=null}getTheme(e){return e}getRoot(){return this.getAttribute("isolate")==="false"?this:this.shadowRoot||this.attachShadow({mode:"open"})}getReactRootElement(){return this.reactRootElement||(this.reactRootElement=document.createElement("div"),this.getRoot().appendChild(this.reactRootElement)),this.reactRootElement}connectedCallback(){this.setAttribute("feaas-role","ui"),Array.from(this.children).forEach(e=>{this.getRoot().appendChild(e)}),document.addEventListener("feaasMount",this),document.addEventListener("feaasUnmount",this),super.connectedCallback()}disconnectedCallback(){document.removeEventListener("feaasMount",this),document.removeEventListener("feaasUnmount",this),super.disconnectedCallback()}getPortalRoot(){return this.getRoot()}render({children:e,library:r},{AppContext:i,Chakra:{Button:n,Tooltip:o},React:s}){let a={containerRef:{current:this.getPortalRoot()}};return o.defaultProps={hasArrow:!0,placement:"top",portalProps:a},s.createElement(i,{environment:this.props.environment,backend:this.props.backend,libraryId:this.props.library,container:this.getRoot(),auth:this.props.auth,getTheme:this.getTheme,onStatusChange:this.onStatusChange,modalProps:{portalProps:a},chakraProps:{resetScope:':where([feaas-role="ui"])',cssVarsRoot:":host",resetCSS:!0,toastOptions:{portalProps:a}}},e)}};j.observedAttributes=["library","component","version","revision","hostname","template"];j.register("feaas-context");j.prototype.clientside=Ht;export{ot as Component,fe as ComponentProps,j as Context,S as ControlledPromise,k as DEFAULT_CDN_URL,mt as DOM,ft as DataPath,ut as DataScope,x as DataSettings,E as Element,ot as FEAASComponent,fe as FEAASComponentsProps,j as FEAASContext,Se as FEAASContextProps,at as FEAASEditor,Ce as FEAASEditorProps,E as FEAASElement,st as FEAASLoader,me as FEAASLoaderProps,lt as FEAASPicker,xe as FEAASPickerProps,Et as FEAASStylesheet,ge as FEAASStylesheetProps,gt as InvalidResponse,m as JSONPath,st as Loader,ht as MyComponent,lt as Picker,Et as Stylesheet,wt as Thumbnail,Vt as WebComponent,Xt as adjustNumbers,Gt as autoloadScripts,tt as cleanCollectionBit,Me as clearFetchCache,he as createStylesheet,rt as fetchAndRevalidate,z as fetchAndRevalidateComponent,bt as fetchAndRevalidateStylesheet,vt as fetchBypassingCache,et as fetchCache,$e as fetchComponent,jt as fetchData,it as fetchToValidateCache,U as fetchWithCacheAwareness,ce as findStylesheet,De as getComponentSource,Lt as getComponentURL,le as getFetchCache,we as getFramePosition,Zt as getHumanizedLabel,te as getLastPathBit,Qt as getQualifier,Le as getStylesheetSource,B as getStylesheetURL,Z as loadScript,At as loadStylesheet,$t as loadStylesheetAllowStale,pt as normalizeCollectionScope,qt as observeDOMElement,nt as parseComponentSource,Kt as parseLimit,Yt as parseRange,yt as parseStylesheetSource,H as queryObject,Ot as queryObjectRaw,X as queryScopes,Ft as renderComponent,Ue as renderComponentElement,ue as renderComponentPromise,F as renderDOMContent,R as renderDOMElement,se as renderHTMLContent,Fe as renderStylesheet,de as renderStylesheetPromise,D as serializeCH1RichText,$ as setDOMAttribute};
72
72
  //# sourceMappingURL=index.esm.js.map