@sitecore-feaas/clientside 0.1.24 → 0.1.25

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.
Files changed (56) hide show
  1. package/build/components/FEAASBase.js +6 -5
  2. package/build/components/FEAASBase.js.map +1 -1
  3. package/build/components/FEAASComponent.js +10 -9
  4. package/build/components/FEAASComponent.js.map +1 -1
  5. package/build/components/FEAASElement.js +2 -1
  6. package/build/components/FEAASElement.js.map +1 -1
  7. package/build/components/FEAASLoader.js +2 -1
  8. package/build/components/FEAASLoader.js.map +1 -1
  9. package/build/fetch.js +0 -1
  10. package/build/fetch.js.map +1 -1
  11. package/build/ui/FEAASContext.js +4 -0
  12. package/build/ui/FEAASContext.js.map +1 -1
  13. package/dist/browser/basic.esm.js +3 -3
  14. package/dist/browser/basic.esm.js.map +1 -1
  15. package/dist/browser/basic.js +3 -3
  16. package/dist/browser/basic.js.map +1 -1
  17. package/dist/browser/index.esm.js +4 -4
  18. package/dist/browser/index.esm.js.map +1 -1
  19. package/dist/browser/index.js +4 -4
  20. package/dist/browser/index.js.map +1 -1
  21. package/dist/node/basic.esm.js +3 -3
  22. package/dist/node/basic.esm.js.map +1 -1
  23. package/dist/node/basic.js +3 -3
  24. package/dist/node/basic.js.map +1 -1
  25. package/dist/node/index.esm.js +3 -3
  26. package/dist/node/index.esm.js.map +1 -1
  27. package/dist/node/index.js +3 -3
  28. package/dist/node/index.js.map +1 -1
  29. package/package.json +4 -4
  30. package/src/components/FEAASBase.tsx +2 -1
  31. package/src/fetch.ts +0 -1
  32. package/src/ui/FEAASContext.tsx +5 -0
  33. package/src/ui/FEAASEditor.tsx +1 -1
  34. package/src/ui/FEAASPicker.tsx +1 -1
  35. package/test/tsconfig.json +1 -1
  36. package/types/components/FEAASBase.d.ts +2 -2
  37. package/types/components/FEAASBase.d.ts.map +1 -1
  38. package/types/components/FEAASComponent.d.ts +1 -1
  39. package/types/components/FEAASComponent.d.ts.map +1 -1
  40. package/types/components/FEAASElement.d.ts +3 -3
  41. package/types/components/FEAASElement.d.ts.map +1 -1
  42. package/types/components/FEAASLoader.d.ts +1 -1
  43. package/types/components/FEAASLoader.d.ts.map +1 -1
  44. package/types/components/FEAASStylesheet.d.ts +3 -3
  45. package/types/components/FEAASStylesheet.d.ts.map +1 -1
  46. package/types/dom.d.ts +3 -3
  47. package/types/dom.d.ts.map +1 -1
  48. package/types/fetch.d.ts.map +1 -1
  49. package/types/tsbuildinfo +1 -1
  50. package/types/tsbuildinfo_ui +1 -1
  51. package/types/ui/FEAASContext.d.ts +1 -0
  52. package/types/ui/FEAASContext.d.ts.map +1 -1
  53. package/types/ui/FEAASEditor.d.ts +1 -1
  54. package/types/ui/FEAASEditor.d.ts.map +1 -1
  55. package/types/ui/FEAASPicker.d.ts +1 -1
  56. package/types/ui/FEAASPicker.d.ts.map +1 -1
@@ -1,5 +1,5 @@
1
- var yt=typeof HTMLElement=="undefined"?class{}:HTMLElement,m=class extends yt{constructor(){super(),this.connected=!1,this.refs={},this.descendants=[],this.onLoad=t=>{t!=null&&(this.payload=t,this.update())},this.addEventListener("feaasConnected",this),this.addEventListener("feaasDisconnected",this)}getProps(t){return{}}getRoot(){return this}attributeChangedCallback(t,r,i){this.set()}connectedCallback(){this.initialize()}initialize(){let t=this.getParent();if(!(t&&!t.connected)&&!this.connected)return this.connected=!0,console.log("FEAAS: Connected",this.tagName,this),this.dispatchEvent(new Event("feaasConnected",{bubbles:!0,composed:!0})),this.getElements().map(r=>{var i;return(i=r.initialize)===null||i===void 0?void 0:i.call(r)}),this.set(),!0}getParent(t=!0){for(var r=this;r=r.parentElement||(r.parentNode instanceof ShadowRoot?r.parentNode.host:null);)if(!t||r.tagName.startsWith("FEAAS-"))return r}getElements(t=this.getRoot(),r=!0){return Array.from(t.querySelectorAll("*")).map(i=>[!r||i.tagName.startsWith("FEAAS-")?i:null,i.shadowRoot?this.getElements(i.shadowRoot,r):null]).flat().filter(Boolean)}disconnectedCallback(){this.connected&&(console.log("FEAAS: Disconnected",this),this.dispatchEvent(new Event("feaasDisconnected",{bubbles:!0,composed:!0})),this.connected=null)}handleEvent(t){let r=t.composedPath()[0];switch(t.type){case"feaasConnected":r!=this&&this.nestedCallback(r);break;case"feaasDisconnected":r!=this&&this.unnestedCallback(r);break}}unnestedCallback(t){let r=this.descendants.indexOf(t);r!=-1&&(console.log("FEAAS: Unnest",this,t),this.descendants.splice(r,-1),this.refs[t.getComponentName()]=null,t.refs.parent==this&&(t.refs.parent=null),t.refs.top==this&&(t.refs.top=t.refs.parent))}nestedCallback(t){var r,i;if(this.descendants.indexOf(t)==-1&&(this.descendants.push(t),console.log("FEAAS: Nest",this,t),this.refs[t.getComponentName()]=t,t.refs.top=this,(r=t.refs).parent||(r.parent=this),t.render))for(var s=t.refs.parent;s;s=s.refs.parent)s.render&&((i=t.refs).parentReact||(i.parentReact=s),t.refs.topReact=s)}getComponentName(){return this.tagName.replace("FEAAS-","").toLowerCase()}isReadyToLoad(){return this.payload===void 0&&this.getAttribute("hidden")==null}async reify(){this.payload!==void 0?this.update():this.isReadyToLoad()&&(this.payload=null,this.load().then(this.onLoad))}load(){return Promise.resolve(null)}update(t=!1){var r,i,o;if(console.log("FEAAS: React",this.tagName,this.payload),this.payload==null)return;let{React:s,ReactDOM:n,ReactDOMClient:a}=this.payload||{};if(!s)throw new Error(`${this.tagName}: React is not present in payload`);if(!n)throw new Error(`${this.tagName}: ReactDOM is not present in payload`);!this.refs.topReact&&!this.forceUpdateReact?a?(this.reactRoot||(this.reactRoot=a.createRoot(this.getReactRootElement())),this.reactRoot.render(s.createElement(this.getReactWrapper()))):n.render(s.createElement(this.getReactWrapper()),this.getReactRootElement()):this.forceUpdateReact?(r=this.forceUpdateReact)===null||r===void 0||r.call(this):(o=(i=this.refs.topReact).forceUpdateReact)===null||o===void 0||o.call(i)}invokeReactRendering(){let{React:t,ReactDOM:r}=this.payload||{},i=this.descendants.filter(o=>o.refs.parentReact==this&&o.payload).map((o,s)=>t.createElement(this.getReactWrapper(o),{key:this.tagName+"-"+s,slot:o.getAttribute("slot")}));return this.render({...this.props,children:i},this.payload)}getReactWrapper(t=this,r=t.tagName){let i=t.reactWrapper||(t.reactWrapper=o=>{if(t.render){let{React:s,ReactDOM:n}=t.payload||{},[a,d]=s.useReducer(l=>l+1,0);return t.forceUpdateReact=d,n.createPortal(s.createElement(s.Fragment,null,t.invokeReactRendering()),t.getReactRootElement())}else return t.update()});return Object.assign(i,{displayName:r}),i}getUID(){return this.uid||(this.uid=String(Math.random()))}getShadowRoot(){return this.shadowRoot||this.attachShadow({mode:"open"}),this.shadowRoot}getReactRootElement(){return this.useShadowRoot?this.getShadowRoot():this.getRoot()}set(t){this.overrides={...this.overrides,...t},this.props={...this.getProps(),...this.overrides};for(var r in this.props){let i=this.props[r];this.props[r]==null?this.removeAttribute(r):(typeof i=="string"||typeof i=="number")&&this.getAttribute(r)!=String(i)&&this.setAttribute(r,String(i))}this.scheduleRender()}scheduleRender(){cancelAnimationFrame(this.nextRender),this.nextRender=requestAnimationFrame(()=>{this.reify()})}formatURL(t,r){return typeof t=="string"&&t.match(/^\/[^\/]/)?r+t:t}getContextAttribute(t,r=this){for(var i=this;i=i.parentElement||(i.parentNode instanceof ShadowRoot?i.parentNode.host:null);)if(i.getAttribute(t)!=null)return i.getAttribute(t);return this.getAttribute(t)}static register(t){typeof window!="undefined"&&!window.customElements.get(t)&&window.customElements.define(t,this)}};var R=class extends m{load(){return Promise.all([import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react"),import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react-dom")]).then(([t,r])=>({React:t,ReactDOM:r}))}render({},{React:t}){return t.createElement(t.Fragment,null)}},J=class extends R{constructor(){super(...arguments),this.useShadowRoot=!0}getProps(){return{counter:parseFloat(this.getAttribute("counter"))}}render({counter:t},{React:r}){let[i,o]=r.useState(0);return r.useEffect(()=>{o(s=>s+1)},[t]),r.createElement(r.Fragment,null,r.createElement("p",null,"Rendering attribute: ",t),r.createElement("p",null,"Triggered updates: ",i))}};J.observedAttributes=["counter"];import mt from"vm";var{hasOwnProperty:v}=Object.prototype;function x(e,t){return e=e.slice(),e.push(t),e}function K(e,t){return t=t.slice(),t.unshift(e),t}var G=class extends Error{constructor(t){super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),this.avoidNew=!0,this.value=t,this.name="NewError"}};function p(e,t,r,i,o){if(!(this instanceof p))try{return new p(e,t,r,i,o)}catch(n){if(!n.avoidNew)throw n;return n.value}typeof e=="string"&&(o=i,i=r,r=t,t=e,e=null);let s=e&&typeof e=="object";if(e=e||{},this.json=e.json||r,this.path=e.path||t,this.resultType=e.resultType||"value",this.flatten=e.flatten||!1,this.wrap=v.call(e,"wrap")?e.wrap:!0,this.sandbox=e.sandbox||{},this.preventEval=e.preventEval||!1,this.parent=e.parent||null,this.parentProperty=e.parentProperty||null,this.callback=e.callback||i||null,this.otherTypeCallback=e.otherTypeCallback||o||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},e.autostart!==!1){let n={path:s?e.path:t};s?"json"in e&&(n.json=e.json):n.json=r;let a=this.evaluate(n);if(!a||typeof a!="object")throw new G(a);return a}}p.prototype.evaluate=function(e,t,r,i){let o=this.parent,s=this.parentProperty,{flatten:n,wrap:a}=this;if(this.currResultType=this.resultType,this.currPreventEval=this.preventEval,this.currSandbox=this.sandbox,r=r||this.callback,this.currOtherTypeCallback=i||this.otherTypeCallback,t=t||this.json,e=e||this.path,e&&typeof e=="object"&&!Array.isArray(e)){if(!e.path&&e.path!=="")throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!v.call(e,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:t}=e),n=v.call(e,"flatten")?e.flatten:n,this.currResultType=v.call(e,"resultType")?e.resultType:this.currResultType,this.currSandbox=v.call(e,"sandbox")?e.sandbox:this.currSandbox,a=v.call(e,"wrap")?e.wrap:a,this.currPreventEval=v.call(e,"preventEval")?e.preventEval:this.currPreventEval,r=v.call(e,"callback")?e.callback:r,this.currOtherTypeCallback=v.call(e,"otherTypeCallback")?e.otherTypeCallback:this.currOtherTypeCallback,o=v.call(e,"parent")?e.parent:o,s=v.call(e,"parentProperty")?e.parentProperty:s,e=e.path}if(o=o||null,s=s||null,Array.isArray(e)&&(e=p.toPathString(e)),!e&&e!==""||!t)return;let d=p.toPathArray(e);d[0]==="$"&&d.length>1&&d.shift(),this._hasParentSelector=null;let l=this._trace(d,t,["$"],o,s,r).filter(function(u){return u&&!u.isParentSelector});return l.length?!a&&l.length===1&&!l[0].hasArrExpr?this._getPreferredOutput(l[0]):l.reduce((u,h)=>{let f=this._getPreferredOutput(h);return n&&Array.isArray(f)?u=u.concat(f):u.push(f),u},[]):a?[]:void 0};p.prototype._getPreferredOutput=function(e){let t=this.currResultType;switch(t){case"all":{let r=Array.isArray(e.path)?e.path:p.toPathArray(e.path);return e.pointer=p.toPointer(r),e.path=typeof e.path=="string"?e.path:p.toPathString(e.path),e}case"value":case"parent":case"parentProperty":return e[t];case"path":return p.toPathString(e[t]);case"pointer":return p.toPointer(e.path);default:throw new TypeError("Unknown result type")}};p.prototype._handleCallback=function(e,t,r){if(t){let i=this._getPreferredOutput(e);e.path=typeof e.path=="string"?e.path:p.toPathString(e.path),t(i,r,e)}};p.prototype._trace=function(e,t,r,i,o,s,n,a){let d;if(!e.length)return d={path:r,value:t,parent:i,parentProperty:o,hasArrExpr:n},this._handleCallback(d,s,"value"),d;let l=e[0],u=e.slice(1),h=[];function f(c){Array.isArray(c)?c.forEach(g=>{h.push(g)}):h.push(c)}if((typeof l!="string"||a)&&t&&v.call(t,l))f(this._trace(u,t[l],x(r,l),t,l,s,n));else if(l==="*")this._walk(t,c=>{f(this._trace(u,t[c],x(r,c),t,c,s,!0,!0))});else if(l==="..")f(this._trace(u,t,r,i,o,s,n)),this._walk(t,c=>{typeof t[c]=="object"&&f(this._trace(e.slice(),t[c],x(r,c),t,c,s,!0))});else{if(l==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:u,isParentSelector:!0};if(l==="~")return d={path:x(r,l),value:o,parent:i,parentProperty:null},this._handleCallback(d,s,"property"),d;if(l==="$")f(this._trace(u,t,r,null,null,s,n));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(l))f(this._slice(l,u,t,r,i,o,s));else if(l.indexOf("?(")===0){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");let c=l.replace(/^\?\((.*?)\)$/u,"$1");this._walk(t,g=>{this._eval(c,t[g],g,r,i,o)&&f(this._trace(u,t[g],x(r,g),t,g,s,!0))})}else if(l[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");f(this._trace(K(this._eval(l,t,r[r.length-1],r.slice(0,-1),i,o),u),t,r,i,o,s,n))}else if(l[0]==="@"){let c=!1,g=l.slice(1,-2);switch(g){case"scalar":(!t||!["object","function"].includes(typeof t))&&(c=!0);break;case"boolean":case"string":case"undefined":case"function":typeof t===g&&(c=!0);break;case"integer":Number.isFinite(t)&&!(t%1)&&(c=!0);break;case"number":Number.isFinite(t)&&(c=!0);break;case"nonFinite":typeof t=="number"&&!Number.isFinite(t)&&(c=!0);break;case"object":t&&typeof t===g&&(c=!0);break;case"array":Array.isArray(t)&&(c=!0);break;case"other":c=this.currOtherTypeCallback(t,r,i,o);break;case"null":t===null&&(c=!0);break;default:throw new TypeError("Unknown value type "+g)}if(c)return d={path:r,value:t,parent:i,parentProperty:o},this._handleCallback(d,s,"value"),d}else if(l[0]==="`"&&t&&v.call(t,l.slice(1))){let c=l.slice(1);f(this._trace(u,t[c],x(r,c),t,c,s,n,!0))}else if(l.includes(",")){let c=l.split(",");for(let g of c)f(this._trace(K(g,u),t,r,i,o,s,!0))}else!a&&t&&v.call(t,l)&&f(this._trace(u,t[l],x(r,l),t,l,s,n,!0))}if(this._hasParentSelector)for(let c=0;c<h.length;c++){let g=h[c];if(g&&g.isParentSelector){let w=this._trace(g.expr,t,g.path,i,o,s,n);if(Array.isArray(w)){h[c]=w[0];let V=w.length;for(let A=1;A<V;A++)c++,h.splice(c,0,w[A])}else h[c]=w}}return h};p.prototype._walk=function(e,t){if(Array.isArray(e)){let r=e.length;for(let i=0;i<r;i++)t(i)}else e&&typeof e=="object"&&Object.keys(e).forEach(r=>{t(r)})};p.prototype._slice=function(e,t,r,i,o,s,n){if(!Array.isArray(r))return;let a=r.length,d=e.split(":"),l=d[2]&&Number.parseInt(d[2])||1,u=d[0]&&Number.parseInt(d[0])||0,h=d[1]&&Number.parseInt(d[1])||a;u=u<0?Math.max(0,u+a):Math.min(a,u),h=h<0?Math.max(0,h+a):Math.min(a,h);let f=[];for(let c=u;c<h;c+=l)this._trace(K(c,t),r,i,o,s,n,!0).forEach(w=>{f.push(w)});return f};p.prototype._eval=function(e,t,r,i,o,s){this.currSandbox._$_parentProperty=s,this.currSandbox._$_parent=o,this.currSandbox._$_property=r,this.currSandbox._$_root=this.json,this.currSandbox._$_v=t;let n=e.includes("@path");n&&(this.currSandbox._$_path=p.toPathString(i.concat([r])));let a="script:"+e;if(!p.cache[a]){let d=e.replace(/@parentProperty/gu,"_$_parentProperty").replace(/@parent/gu,"_$_parent").replace(/@property/gu,"_$_property").replace(/@root/gu,"_$_root").replace(/@([.\s)[])/gu,"_$_v$1");n&&(d=d.replace(/@path/gu,"_$_path")),p.cache[a]=new this.vm.Script(d)}try{return p.cache[a].runInNewContext(this.currSandbox)}catch(d){throw new Error("jsonPath: "+d.message+": "+e)}};p.cache={};p.toPathString=function(e){let t=e,r=t.length,i="$";for(let o=1;o<r;o++)/^(~|\^|@.*?\(\))$/u.test(t[o])||(i+=/^[0-9*]+$/u.test(t[o])?"["+t[o]+"]":"['"+t[o]+"']");return i};p.toPointer=function(e){let t=e,r=t.length,i="";for(let o=1;o<r;o++)/^(~|\^|@.*?\(\))$/u.test(t[o])||(i+="/"+t[o].toString().replace(/~/gu,"~0").replace(/\//gu,"~1"));return i};p.toPathArray=function(e){let{cache:t}=p;if(t[e])return t[e].concat();let r=[],o=e.replace(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu,";$&;").replace(/[['](\??\(.*?\))[\]']/gu,function(s,n){return"[#"+(r.push(n)-1)+"]"}).replace(/\[['"]([^'\]]*)['"]\]/gu,function(s,n){return"['"+n.replace(/\./gu,"%@%").replace(/~/gu,"%%@@%%")+"']"}).replace(/~/gu,";~;").replace(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replace(/%@%/gu,".").replace(/%%@@%%/gu,"~").replace(/(?:;)?(\^+)(?:;)?/gu,function(s,n){return";"+n.split("").join(";")+";"}).replace(/;;;|;;/gu,";..;").replace(/;$|'?\]|'$/gu,"").split(";").map(function(s){let n=s.match(/#(\d+)/u);return!n||!n[1]?s:r[n[1]]});return t[e]=o,t[e].concat()};p.prototype.vm=mt;async function st(e,t,r,i){return k({url:e,options:t,validator:r,callback:i}).then(L).then(o=>o.response)}async function k({url:e,options:t,validator:r,callback:i},o="initial"){let s=new Date;console.log("fetch",o,e);let n=await fetch(e,t);if(!n.ok)throw new Error("Fetch failed");if((r==null?void 0:r(n))===!1)throw new Error("Response is not valid");let a=new Date(n.headers.get("date"))<s;return i==null||i(n,o),{url:e,options:t,isCached:a,response:n,validator:r}}async function L(e){let{url:t,isCached:r,options:i,validator:o,response:s,callback:n}=e;if(r){let{response:a}=await k({url:t+"?"+Math.random(),options:{...i,method:"HEAD",cache:"no-cache"},validator:o},"check");if(a.headers.get("last-modified")!=s.headers.get("last-modified"))return Y(e)}return e}async function Y(e){let{url:t,options:r,validator:i,callback:o}=e;return k({url:t,options:{...r,cache:"reload"},validator:i,callback:o},"updated")}function nt({cdn:e="https://feaascomponentsapidev.blob.core.windows.net",hostname:t,library:r,component:i,version:o,revision:s="published"}){return`${e||t}/components/${r}/${i}/${o}/${s}.html`}function vt({cdn:e="https://feaascomponentsapidev.blob.core.windows.net",hostname:t,library:r,revision:i="published"}){return`${e||t}/styles/${r}/${i}.css`}async function N(e,t){let r=n=>n.headers.get("x-ms-meta-versionDeletedAt")==null,i=n=>{n.text().then(t)},o=await Promise.all([e.instance&&k({options:{headers:{Accept:"text/html"}},url:nt({...e,version:e.instance}),validator:r}).catch(n=>n),k({url:nt(e),validator:r}).catch(n=>n)]),s=o.find(n=>n&&"isCached"in n&&n);if(!s||s instanceof Error)throw o.find(a=>a&&a instanceof Error)||new Error("Can not fetch component");return o[0]==s&&console.log("Using fork!",o),i(s.response),L({...s,callback:i}).catch(n=>{if(o[0]==s&&(Y({...s,callback:null,validator:null}),console.log("Fork was deleted"),!(o[1]instanceof Error)))return i(o[1].response),L({...o[1],callback:i});throw n})}async function D(e,t){return st(vt(e),{headers:{Accept:"text/css"}},r=>r.headers.get("x-ms-meta-deletedAt")==null,r=>{r.text().then(t)})}function Gt(e,t){let r=document.createElement("div");r.innerHTML=e;let i=document.createDocumentFragment();for(;r.firstChild;)i.appendChild(r.firstChild);return S(i,t),r}function At(e){return e.replace(/(\[[^\]\[]+\]|\.\*)$/g,"")}function Et(e){return At(e)+".*"}function dt(e){let t=e.getAttribute("data-path-scope");for(var r=0,i=e;i=i.previousElementSibling;)i.getAttribute("data-path-scope")==t&&r++;return r}function Ct(e,t,r){let i=e.getAttribute("data-path-scope");if(i==null)return;var o=dt(e);if(o!=0)return;let s=e.parentElement;if(s!=null){t==0?e.setAttribute("hidden","hidden"):e.getAttribute("hidden")!=null&&e.removeAttribute("hidden");for(var n=o+1,a=e,d=e;d=d.nextElementSibling;)d.getAttribute("data-path-scope")==i&&(n++,a=d);for(var l=n;l<t;l++)s.insertBefore(a.cloneNode(!0),a.nextElementSibling);for(var l=Math.max(1,t);l<n;l++)a=a.previousElementSibling,s.removeChild(a.nextElementSibling)}}function at(e,t,r=!1,i=e){var o=t;let s=Object.keys(e).sort((a,d)=>d.length-a.length);for(let a of s)if(t.startsWith(a)){if(a==t){if(r)return e[a];continue}o=t.substring(a.length+1),i=e[a];break}var n=p({path:o,json:i});return Array.isArray(n)&&(n==null?void 0:n.length)==0&&(n=[o.replace(/^.*?\./,"_."),o.replace(/^.*?\./,""),o.replace(/^([^.]+).*?\.\$\./,"$1."),o.replace(/^.*?\.\$\./,"_."),o.replace(/^.*?\.\$\./,""),o.replace(/^[^.]+$/,"_")].filter((a,d,l)=>l.indexOf(a)===d).reduce((a,d)=>a.length>0?a:p({path:d,json:i}),[])),r&&Array.isArray(n)?n[0]:n}function O(e,t,r,i){var o;if(e){var s=e;(r==null?void 0:r.type)=="doc"&&Array.isArray(r.content)&&(r=F(r)),i!=null&&i.processValue&&(r=i==null?void 0:i.processValue(e,t,r));var n=t.replace("data-path-","");if(t=="data-path-src")s=e.tagName=="IMG"?e:e.querySelector("img, video");else if(t=="data-path-href")s=e.querySelector("a")||e.closest("a");else if(t=="data-path-alt")s=e.querySelector("img, picture");else if(t=="data-path-hidden")r=r?null:!0;else if(t=="data-path"||t=="data-embed-html"||t=="html")n="innerHTML";else if(t=="data-embed-src")X(e,r);else if(t=="data-path-attributes"){let h=((o=e.getAttribute("data-attributes-keys"))===null||o===void 0?void 0:o.split(",").filter(Boolean))||[];if(!Array.isArray(r))for(var a in r){var d=r[a];O(e,a,typeof d=="object"&&d?JSON.stringify(d):d,i)}for(var l=0;l<h.length;l++)(r==null||!(h[l]in r))&&O(e,h[l],null,i);O(e,"data-attributes-keys",Object.keys(r||{}).join(","));return}if(typeof r=="boolean"&&(r=r?"":null),!!s){var u=String(e.getAttribute("data-path-placeholder")||s[n]);r!=null?n=="innerHTML"?s.innerHTML!=r&&(s.innerHTML=r):s.getAttribute(n)!=r&&s.setAttribute(n,r):n=="innerHTML"?s.innerHTML=u:s.removeAttribute(n)}}}function wt(e){let t=new e.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(i=>{let o=i.target,s=o.getAttribute("data-embed-src");s&&X(o,s),i.addedNodes&&i.addedNodes.forEach(n=>{n.nodeType==1&&xt(n,!1)})})});return t.observe(e,{attributes:!0,subtree:!0,childList:!0}),t}function xt(e,t=!0){let r=e.querySelectorAll("[data-embed-src]");for(var i=0;i<r.length;i++){let o=r[i];X(o,o.getAttribute("data-embed-src"))}if(t)return wt(e)}function X(e,t){for(var r=e;r;r=r.parentElement)if(!r.parentElement){let o=r.querySelectorAll("script");for(var i=0;i<o.length;i++)if(o[i].getAttribute("src")==t)return!0;r.tagName=="HTML"&&(r=r.querySelector("head")||r);let s=r.ownerDocument.createElement("script");s.type="module",s.src=t,r.appendChild(s);break}}var lt=["data-attributes-keys","data-path-attributes","data-path-scope"];function S(e,t,r,i){var o,s,n;let a=e;if(i||(t=((o=r==null?void 0:r.processData)===null||o===void 0?void 0:o.call(r,a,t))||t),a.nodeType==1){let l=a.getAttribute("data-path-scope");if(l){let h=dt(a),f=at(t,l,!1)||[];h==0&&Ct(a,((s=r==null?void 0:r.shouldRepeat)===null||s===void 0?void 0:s.call(r,a,f))===!1?1:f.length,r),t={...t,[Et(l)]:f[h]}}let u=Array.prototype.slice.call(a.attributes).sort((h,f)=>lt.indexOf(h.name)-lt.indexOf(f.name));for(var d=0;d<u.length;d++){let{name:h,value:f}=u[d];h.startsWith("data-path")&&h!="data-path-scope"&&O(a,h,at(t,f,!0),r),h=="data-embed-src"&&O(a,h,a.getAttribute(h),r)}}for(var d=0;d<a.children.length;d++)S(a.children[d],t,r,!0);return i||(n=r==null?void 0:r.onRender)===null||n===void 0||n.call(r,a,t),a}function $(e,t,r,i){var o;let s=((o=i==null?void 0:i.processTemplate)===null||o===void 0?void 0:o.call(i,e,t,r))||t;if(e.innerHTML=s,e.classList.add("-feaas"),(e.closest(".component.feaas")||e).className.includes("-theme--"))for(let a of e.children)a.className=a.className.replace(/(\s|^)-theme--[^\s]+\s*/g,"$1");return S(e,r,i)}function Yt(e,t){return Rt(e,t||(t=document.createElement("style"))),t}function Rt(e,t){return t||(t=document.createElement("style")),D(e,r=>{t.textContent=r}).then(()=>t)}function Qt(e,t){return kt(e,t||(t=document.createElement("div"))),t}async function kt(e,t){return t||(t=document.createElement("div")),t.childNodes.length?S(t,e.data,e):"template"in e?$(t,e.template,e.data,e):N(e,r=>$(t,r,e.data,e)).then(()=>t)}function Q(e,t={},r){return r?`<${r}${Object.entries(t).map(([i,o])=>o!=null&&` ${i}="${o}"`).filter(Boolean).join("")}>${F(e)}</${r}>`.replace(/^<([a-z0-9][^>]*)><\/[^>]+>$/,"<$1 />"):F(e)}function F(e){var t;if(Array.isArray(e))return e.map(F).join(`
2
- `).trim();if(typeof e=="string")return e;if(e==null)return"";switch(e.type){case"heading":let{level:r,...i}=e.attrs;return Q(e.content,i,"h"+r);case"text":return(e.marks||[]).reduce((o,s)=>Q(o,s.attrs,{link:"a",bold:"strong",italic:"em",strike:"s",underline:"u"}[s.type]),(t=e.text)===null||t===void 0?void 0:t.replace(/\s+/," "));default:return Q(e.content||e.text,e.attrs,{bulletList:"ul",orderedList:"ol",listItem:"li",horizontalRule:"hr",paragraph:"p",codeBlock:"code",blockquote:"blockquote"}[e.type])}}function St(e=this){let t,r=e.getAttribute("data");if(r!=null)try{t=typeof r=="string"?JSON.parse(r):{}}catch(i){}return{data:t!=null?t:{},library:e.getAttribute("library"),component:e.getAttribute("component"),version:e.getAttribute("version"),revision:e.getAttribute("revision"),hostname:e.getAttribute("hostname"),cdn:e.getContextAttribute("cdn"),template:e.getAttribute("template"),instance:e.getAttribute("instance"),editable:e.getAttribute("editable")!=null,suspended:e.getAttribute("suspended")!=null}}var I=class extends m{constructor(){super(),this.addEventListener("click",()=>{this.props.editable&&this.edit()})}setData(t){this.set({data:t})}getProps(){return St(this)}attributeChangedCallback(t,r,i){r!==i&&(this.payload=void 0,this.needsRefresh=!0,super.attributeChangedCallback(t,r,i))}getEditor(){var t;return(t=document.querySelector("feaas-context"))===null||t===void 0?void 0:t.refs.editor}edit(){let t=this.getEditor();if(t!=null&&t.setTarget(this))return t.open(),!0}getOriginal(){let t=this.getAttribute("data-path-scope");if(t){for(var r=this;(r=r.previousElementSibling)&&r.getAttribute("data-path-scope")==t;)var i=r;return i}}isReadyToLoad(){return super.isReadyToLoad()&&this.props.library!=null&&this.props.component!=null&&this.props.version!=null}async load(){if(!this.getOriginal())try{N(this.props,this.onLoad)}catch(t){console.error(`FEAAS: Could not fetch component: ${this.props.component}/${this.props.version}/${this.props.revision}`)}}update(){if(Array.from(this.children).filter(t=>t.tagName!="BR").length>0&&!this.needsRefresh)S(this,this.props.data);else{if(this.needsRefresh=!0,this.getOriginal())return;$(this,this.payload,this.props.data)}}};I.observedAttributes=["library","component","version","revision","hostname","cdn","template","data","instance","editable"];I.register("feaas-component");function _t(e=this){return{opacity:e!=null&&e.getAttribute("opacity")?parseFloat(e==null?void 0:e.getAttribute("opacity")):1,hidden:(e==null?void 0:e.getAttribute("hidden"))!=null}}var U=class extends m{getProps(){return _t(this)}attributeChangedCallback(t,r,i){if(r!==i)return t=="hidden"&&(this.style.setProperty("display","block","important"),this.style.setProperty("transition","opacity 0.3s","important"),i?(this.style.setProperty("opacity","0","important"),this.style.pointerEvents="none"):(this.style.setProperty("opacity","1","important"),this.style.pointerEvents="all")),super.attributeChangedCallback(t,r,i)}connectedCallback(){this.payload=null,super.connectedCallback(),this.attributeChangedCallback("hidden",this.getAttribute("hidden"),this.getAttribute("hidden")),this.stylesheet=document.createElement("style"),this.stylesheet.textContent=`
1
+ var yt=typeof HTMLElement=="undefined"?class{}:HTMLElement,m=class extends yt{getProps(t){return{}}constructor(){super(),this.connected=!1,this.refs={},this.descendants=[],this.onLoad=t=>{t!=null&&(this.payload=t,this.update())},this.addEventListener("feaasConnected",this),this.addEventListener("feaasDisconnected",this)}getRoot(){return this}attributeChangedCallback(t,r,i){this.set()}connectedCallback(){this.initialize()}initialize(){let t=this.getParent();if(!(t&&!t.connected)&&!this.connected)return this.connected=!0,console.log("FEAAS: Connected",this.tagName,this),this.dispatchEvent(new Event("feaasConnected",{bubbles:!0,composed:!0})),this.getElements().map(r=>{var i;return(i=r.initialize)===null||i===void 0?void 0:i.call(r)}),this.set(),!0}getParent(t=!0){for(var r=this;r=r.parentElement||(r.parentNode instanceof ShadowRoot?r.parentNode.host:null);)if(!t||r.tagName.startsWith("FEAAS-"))return r}getElements(t=this.getRoot(),r=!0){return Array.from(t.querySelectorAll("*")).map(i=>[!r||i.tagName.startsWith("FEAAS-")?i:null,i.shadowRoot?this.getElements(i.shadowRoot,r):null]).flat().filter(Boolean)}disconnectedCallback(){this.connected&&(console.log("FEAAS: Disconnected",this),this.dispatchEvent(new Event("feaasDisconnected",{bubbles:!0,composed:!0})),this.connected=null)}handleEvent(t){let r=t.composedPath()[0];switch(t.type){case"feaasConnected":r!=this&&this.nestedCallback(r);break;case"feaasDisconnected":r!=this&&this.unnestedCallback(r);break}}unnestedCallback(t){let r=this.descendants.indexOf(t);r!=-1&&(console.log("FEAAS: Unnest",this,t),this.descendants.splice(r,-1),this.refs[t.getComponentName()]=null,t.refs.parent==this&&(t.refs.parent=null),t.refs.top==this&&(t.refs.top=t.refs.parent))}nestedCallback(t){var r,i;if(this.descendants.indexOf(t)==-1&&(this.descendants.push(t),console.log("FEAAS: Nest",this,t),this.refs[t.getComponentName()]=t,t.refs.top=this,(r=t.refs).parent||(r.parent=this),t.render))for(var s=t.refs.parent;s;s=s.refs.parent)s.render&&((i=t.refs).parentReact||(i.parentReact=s),t.refs.topReact=s)}getComponentName(){return this.tagName.replace("FEAAS-","").toLowerCase()}isReadyToLoad(){return this.payload===void 0&&this.getAttribute("hidden")==null}async reify(){this.payload!==void 0?this.update():this.isReadyToLoad()&&(this.payload=null,this.load().then(this.onLoad))}load(){return Promise.resolve(null)}update(t=!1){var r,i,o;if(console.log("FEAAS: React",this.tagName,this.payload),this.payload==null)return;let{React:s,ReactDOM:n,ReactDOMClient:a}=this.payload||{};if(!s)throw new Error(`${this.tagName}: React is not present in payload`);if(!n)throw new Error(`${this.tagName}: ReactDOM is not present in payload`);!this.refs.topReact&&!this.forceUpdateReact?a?(this.reactRoot||(this.reactRoot=a.createRoot(this.getReactRootElement())),this.reactRoot.render(s.createElement(this.getReactWrapper()))):n.render(s.createElement(this.getReactWrapper()),this.getReactRootElement()):this.forceUpdateReact?(r=this.forceUpdateReact)===null||r===void 0||r.call(this):(o=(i=this.refs.topReact).forceUpdateReact)===null||o===void 0||o.call(i)}invokeReactRendering(){let{React:t,ReactDOM:r}=this.payload||{},i=this.descendants.filter(o=>o.refs.parentReact==this&&o.payload).map((o,s)=>t.createElement(this.getReactWrapper(o),{key:o.tagName+"-"+o.getUID(),slot:o.getAttribute("slot")}));return this.render({...this.props,children:i},this.payload)}getReactWrapper(t=this,r=t.tagName){let i=t.reactWrapper||(t.reactWrapper=o=>{if(t.render){let{React:s,ReactDOM:n}=t.payload||{},[a,d]=s.useReducer(l=>l+1,0);return t.forceUpdateReact=d,n.createPortal(s.createElement(s.Fragment,null,t.invokeReactRendering()),t.getReactRootElement())}else return t.update()});return Object.assign(i,{key:this.tagName+"-"+this.getUID(),displayName:r}),i}getUID(){return this.uid||(this.uid=String(Math.random()))}getShadowRoot(){return this.shadowRoot||this.attachShadow({mode:"open"}),this.shadowRoot}getReactRootElement(){return this.useShadowRoot?this.getShadowRoot():this.getRoot()}set(t){this.overrides={...this.overrides,...t},this.props={...this.getProps(),...this.overrides};for(var r in this.props){let i=this.props[r];this.props[r]==null?this.removeAttribute(r):(typeof i=="string"||typeof i=="number")&&this.getAttribute(r)!=String(i)&&this.setAttribute(r,String(i))}this.scheduleRender()}scheduleRender(){cancelAnimationFrame(this.nextRender),this.nextRender=requestAnimationFrame(()=>{this.reify()})}formatURL(t,r){return typeof t=="string"&&t.match(/^\/[^\/]/)?r+t:t}getContextAttribute(t,r=this){for(var i=this;i=i.parentElement||(i.parentNode instanceof ShadowRoot?i.parentNode.host:null);)if(i.getAttribute(t)!=null)return i.getAttribute(t);return this.getAttribute(t)}static register(t){typeof window!="undefined"&&!window.customElements.get(t)&&window.customElements.define(t,this)}};var R=class extends m{load(){return Promise.all([import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react"),import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react-dom")]).then(([t,r])=>({React:t,ReactDOM:r}))}render({},{React:t}){return t.createElement(t.Fragment,null)}},J=class extends R{constructor(){super(...arguments),this.useShadowRoot=!0}getProps(){return{counter:parseFloat(this.getAttribute("counter"))}}render({counter:t},{React:r}){let[i,o]=r.useState(0);return r.useEffect(()=>{o(s=>s+1)},[t]),r.createElement(r.Fragment,null,r.createElement("p",null,"Rendering attribute: ",t),r.createElement("p",null,"Triggered updates: ",i))}};J.observedAttributes=["counter"];import mt from"vm";var{hasOwnProperty:v}=Object.prototype;function x(e,t){return e=e.slice(),e.push(t),e}function K(e,t){return t=t.slice(),t.unshift(e),t}var G=class extends Error{constructor(t){super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),this.avoidNew=!0,this.value=t,this.name="NewError"}};function p(e,t,r,i,o){if(!(this instanceof p))try{return new p(e,t,r,i,o)}catch(n){if(!n.avoidNew)throw n;return n.value}typeof e=="string"&&(o=i,i=r,r=t,t=e,e=null);let s=e&&typeof e=="object";if(e=e||{},this.json=e.json||r,this.path=e.path||t,this.resultType=e.resultType||"value",this.flatten=e.flatten||!1,this.wrap=v.call(e,"wrap")?e.wrap:!0,this.sandbox=e.sandbox||{},this.preventEval=e.preventEval||!1,this.parent=e.parent||null,this.parentProperty=e.parentProperty||null,this.callback=e.callback||i||null,this.otherTypeCallback=e.otherTypeCallback||o||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},e.autostart!==!1){let n={path:s?e.path:t};s?"json"in e&&(n.json=e.json):n.json=r;let a=this.evaluate(n);if(!a||typeof a!="object")throw new G(a);return a}}p.prototype.evaluate=function(e,t,r,i){let o=this.parent,s=this.parentProperty,{flatten:n,wrap:a}=this;if(this.currResultType=this.resultType,this.currPreventEval=this.preventEval,this.currSandbox=this.sandbox,r=r||this.callback,this.currOtherTypeCallback=i||this.otherTypeCallback,t=t||this.json,e=e||this.path,e&&typeof e=="object"&&!Array.isArray(e)){if(!e.path&&e.path!=="")throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!v.call(e,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:t}=e),n=v.call(e,"flatten")?e.flatten:n,this.currResultType=v.call(e,"resultType")?e.resultType:this.currResultType,this.currSandbox=v.call(e,"sandbox")?e.sandbox:this.currSandbox,a=v.call(e,"wrap")?e.wrap:a,this.currPreventEval=v.call(e,"preventEval")?e.preventEval:this.currPreventEval,r=v.call(e,"callback")?e.callback:r,this.currOtherTypeCallback=v.call(e,"otherTypeCallback")?e.otherTypeCallback:this.currOtherTypeCallback,o=v.call(e,"parent")?e.parent:o,s=v.call(e,"parentProperty")?e.parentProperty:s,e=e.path}if(o=o||null,s=s||null,Array.isArray(e)&&(e=p.toPathString(e)),!e&&e!==""||!t)return;let d=p.toPathArray(e);d[0]==="$"&&d.length>1&&d.shift(),this._hasParentSelector=null;let l=this._trace(d,t,["$"],o,s,r).filter(function(u){return u&&!u.isParentSelector});return l.length?!a&&l.length===1&&!l[0].hasArrExpr?this._getPreferredOutput(l[0]):l.reduce((u,h)=>{let f=this._getPreferredOutput(h);return n&&Array.isArray(f)?u=u.concat(f):u.push(f),u},[]):a?[]:void 0};p.prototype._getPreferredOutput=function(e){let t=this.currResultType;switch(t){case"all":{let r=Array.isArray(e.path)?e.path:p.toPathArray(e.path);return e.pointer=p.toPointer(r),e.path=typeof e.path=="string"?e.path:p.toPathString(e.path),e}case"value":case"parent":case"parentProperty":return e[t];case"path":return p.toPathString(e[t]);case"pointer":return p.toPointer(e.path);default:throw new TypeError("Unknown result type")}};p.prototype._handleCallback=function(e,t,r){if(t){let i=this._getPreferredOutput(e);e.path=typeof e.path=="string"?e.path:p.toPathString(e.path),t(i,r,e)}};p.prototype._trace=function(e,t,r,i,o,s,n,a){let d;if(!e.length)return d={path:r,value:t,parent:i,parentProperty:o,hasArrExpr:n},this._handleCallback(d,s,"value"),d;let l=e[0],u=e.slice(1),h=[];function f(c){Array.isArray(c)?c.forEach(g=>{h.push(g)}):h.push(c)}if((typeof l!="string"||a)&&t&&v.call(t,l))f(this._trace(u,t[l],x(r,l),t,l,s,n));else if(l==="*")this._walk(t,c=>{f(this._trace(u,t[c],x(r,c),t,c,s,!0,!0))});else if(l==="..")f(this._trace(u,t,r,i,o,s,n)),this._walk(t,c=>{typeof t[c]=="object"&&f(this._trace(e.slice(),t[c],x(r,c),t,c,s,!0))});else{if(l==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:u,isParentSelector:!0};if(l==="~")return d={path:x(r,l),value:o,parent:i,parentProperty:null},this._handleCallback(d,s,"property"),d;if(l==="$")f(this._trace(u,t,r,null,null,s,n));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(l))f(this._slice(l,u,t,r,i,o,s));else if(l.indexOf("?(")===0){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");let c=l.replace(/^\?\((.*?)\)$/u,"$1");this._walk(t,g=>{this._eval(c,t[g],g,r,i,o)&&f(this._trace(u,t[g],x(r,g),t,g,s,!0))})}else if(l[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");f(this._trace(K(this._eval(l,t,r[r.length-1],r.slice(0,-1),i,o),u),t,r,i,o,s,n))}else if(l[0]==="@"){let c=!1,g=l.slice(1,-2);switch(g){case"scalar":(!t||!["object","function"].includes(typeof t))&&(c=!0);break;case"boolean":case"string":case"undefined":case"function":typeof t===g&&(c=!0);break;case"integer":Number.isFinite(t)&&!(t%1)&&(c=!0);break;case"number":Number.isFinite(t)&&(c=!0);break;case"nonFinite":typeof t=="number"&&!Number.isFinite(t)&&(c=!0);break;case"object":t&&typeof t===g&&(c=!0);break;case"array":Array.isArray(t)&&(c=!0);break;case"other":c=this.currOtherTypeCallback(t,r,i,o);break;case"null":t===null&&(c=!0);break;default:throw new TypeError("Unknown value type "+g)}if(c)return d={path:r,value:t,parent:i,parentProperty:o},this._handleCallback(d,s,"value"),d}else if(l[0]==="`"&&t&&v.call(t,l.slice(1))){let c=l.slice(1);f(this._trace(u,t[c],x(r,c),t,c,s,n,!0))}else if(l.includes(",")){let c=l.split(",");for(let g of c)f(this._trace(K(g,u),t,r,i,o,s,!0))}else!a&&t&&v.call(t,l)&&f(this._trace(u,t[l],x(r,l),t,l,s,n,!0))}if(this._hasParentSelector)for(let c=0;c<h.length;c++){let g=h[c];if(g&&g.isParentSelector){let w=this._trace(g.expr,t,g.path,i,o,s,n);if(Array.isArray(w)){h[c]=w[0];let V=w.length;for(let A=1;A<V;A++)c++,h.splice(c,0,w[A])}else h[c]=w}}return h};p.prototype._walk=function(e,t){if(Array.isArray(e)){let r=e.length;for(let i=0;i<r;i++)t(i)}else e&&typeof e=="object"&&Object.keys(e).forEach(r=>{t(r)})};p.prototype._slice=function(e,t,r,i,o,s,n){if(!Array.isArray(r))return;let a=r.length,d=e.split(":"),l=d[2]&&Number.parseInt(d[2])||1,u=d[0]&&Number.parseInt(d[0])||0,h=d[1]&&Number.parseInt(d[1])||a;u=u<0?Math.max(0,u+a):Math.min(a,u),h=h<0?Math.max(0,h+a):Math.min(a,h);let f=[];for(let c=u;c<h;c+=l)this._trace(K(c,t),r,i,o,s,n,!0).forEach(w=>{f.push(w)});return f};p.prototype._eval=function(e,t,r,i,o,s){this.currSandbox._$_parentProperty=s,this.currSandbox._$_parent=o,this.currSandbox._$_property=r,this.currSandbox._$_root=this.json,this.currSandbox._$_v=t;let n=e.includes("@path");n&&(this.currSandbox._$_path=p.toPathString(i.concat([r])));let a="script:"+e;if(!p.cache[a]){let d=e.replace(/@parentProperty/gu,"_$_parentProperty").replace(/@parent/gu,"_$_parent").replace(/@property/gu,"_$_property").replace(/@root/gu,"_$_root").replace(/@([.\s)[])/gu,"_$_v$1");n&&(d=d.replace(/@path/gu,"_$_path")),p.cache[a]=new this.vm.Script(d)}try{return p.cache[a].runInNewContext(this.currSandbox)}catch(d){throw new Error("jsonPath: "+d.message+": "+e)}};p.cache={};p.toPathString=function(e){let t=e,r=t.length,i="$";for(let o=1;o<r;o++)/^(~|\^|@.*?\(\))$/u.test(t[o])||(i+=/^[0-9*]+$/u.test(t[o])?"["+t[o]+"]":"['"+t[o]+"']");return i};p.toPointer=function(e){let t=e,r=t.length,i="";for(let o=1;o<r;o++)/^(~|\^|@.*?\(\))$/u.test(t[o])||(i+="/"+t[o].toString().replace(/~/gu,"~0").replace(/\//gu,"~1"));return i};p.toPathArray=function(e){let{cache:t}=p;if(t[e])return t[e].concat();let r=[],o=e.replace(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu,";$&;").replace(/[['](\??\(.*?\))[\]']/gu,function(s,n){return"[#"+(r.push(n)-1)+"]"}).replace(/\[['"]([^'\]]*)['"]\]/gu,function(s,n){return"['"+n.replace(/\./gu,"%@%").replace(/~/gu,"%%@@%%")+"']"}).replace(/~/gu,";~;").replace(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replace(/%@%/gu,".").replace(/%%@@%%/gu,"~").replace(/(?:;)?(\^+)(?:;)?/gu,function(s,n){return";"+n.split("").join(";")+";"}).replace(/;;;|;;/gu,";..;").replace(/;$|'?\]|'$/gu,"").split(";").map(function(s){let n=s.match(/#(\d+)/u);return!n||!n[1]?s:r[n[1]]});return t[e]=o,t[e].concat()};p.prototype.vm=mt;async function st(e,t,r,i){return k({url:e,options:t,validator:r,callback:i}).then(L).then(o=>o.response)}async function k({url:e,options:t,validator:r,callback:i},o="initial"){let s=new Date,n=await fetch(e,t);if(!n.ok)throw new Error("Fetch failed");if((r==null?void 0:r(n))===!1)throw new Error("Response is not valid");let a=new Date(n.headers.get("date"))<s;return i==null||i(n,o),{url:e,options:t,isCached:a,response:n,validator:r}}async function L(e){let{url:t,isCached:r,options:i,validator:o,response:s,callback:n}=e;if(r){let{response:a}=await k({url:t+"?"+Math.random(),options:{...i,method:"HEAD",cache:"no-cache"},validator:o},"check");if(a.headers.get("last-modified")!=s.headers.get("last-modified"))return Y(e)}return e}async function Y(e){let{url:t,options:r,validator:i,callback:o}=e;return k({url:t,options:{...r,cache:"reload"},validator:i,callback:o},"updated")}function nt({cdn:e="https://feaascomponentsapidev.blob.core.windows.net",hostname:t,library:r,component:i,version:o,revision:s="published"}){return`${e||t}/components/${r}/${i}/${o}/${s}.html`}function vt({cdn:e="https://feaascomponentsapidev.blob.core.windows.net",hostname:t,library:r,revision:i="published"}){return`${e||t}/styles/${r}/${i}.css`}async function D(e,t){let r=n=>n.headers.get("x-ms-meta-versionDeletedAt")==null,i=n=>{n.text().then(t)},o=await Promise.all([e.instance&&k({options:{headers:{Accept:"text/html"}},url:nt({...e,version:e.instance}),validator:r}).catch(n=>n),k({url:nt(e),validator:r}).catch(n=>n)]),s=o.find(n=>n&&"isCached"in n&&n);if(!s||s instanceof Error)throw o.find(a=>a&&a instanceof Error)||new Error("Can not fetch component");return o[0]==s&&console.log("Using fork!",o),i(s.response),L({...s,callback:i}).catch(n=>{if(o[0]==s&&(Y({...s,callback:null,validator:null}),console.log("Fork was deleted"),!(o[1]instanceof Error)))return i(o[1].response),L({...o[1],callback:i});throw n})}async function N(e,t){return st(vt(e),{headers:{Accept:"text/css"}},r=>r.headers.get("x-ms-meta-deletedAt")==null,r=>{r.text().then(t)})}function Gt(e,t){let r=document.createElement("div");r.innerHTML=e;let i=document.createDocumentFragment();for(;r.firstChild;)i.appendChild(r.firstChild);return S(i,t),r}function At(e){return e.replace(/(\[[^\]\[]+\]|\.\*)$/g,"")}function Et(e){return At(e)+".*"}function dt(e){let t=e.getAttribute("data-path-scope");for(var r=0,i=e;i=i.previousElementSibling;)i.getAttribute("data-path-scope")==t&&r++;return r}function Ct(e,t,r){let i=e.getAttribute("data-path-scope");if(i==null)return;var o=dt(e);if(o!=0)return;let s=e.parentElement;if(s!=null){t==0?e.setAttribute("hidden","hidden"):e.getAttribute("hidden")!=null&&e.removeAttribute("hidden");for(var n=o+1,a=e,d=e;d=d.nextElementSibling;)d.getAttribute("data-path-scope")==i&&(n++,a=d);for(var l=n;l<t;l++)s.insertBefore(a.cloneNode(!0),a.nextElementSibling);for(var l=Math.max(1,t);l<n;l++)a=a.previousElementSibling,s.removeChild(a.nextElementSibling)}}function at(e,t,r=!1,i=e){var o=t;let s=Object.keys(e).sort((a,d)=>d.length-a.length);for(let a of s)if(t.startsWith(a)){if(a==t){if(r)return e[a];continue}o=t.substring(a.length+1),i=e[a];break}var n=p({path:o,json:i});return Array.isArray(n)&&(n==null?void 0:n.length)==0&&(n=[o.replace(/^.*?\./,"_."),o.replace(/^.*?\./,""),o.replace(/^([^.]+).*?\.\$\./,"$1."),o.replace(/^.*?\.\$\./,"_."),o.replace(/^.*?\.\$\./,""),o.replace(/^[^.]+$/,"_")].filter((a,d,l)=>l.indexOf(a)===d).reduce((a,d)=>a.length>0?a:p({path:d,json:i}),[])),r&&Array.isArray(n)?n[0]:n}function O(e,t,r,i){var o;if(e){var s=e;(r==null?void 0:r.type)=="doc"&&Array.isArray(r.content)&&(r=F(r)),i!=null&&i.processValue&&(r=i==null?void 0:i.processValue(e,t,r));var n=t.replace("data-path-","");if(t=="data-path-src")s=e.tagName=="IMG"?e:e.querySelector("img, video");else if(t=="data-path-href")s=e.querySelector("a")||e.closest("a");else if(t=="data-path-alt")s=e.querySelector("img, picture");else if(t=="data-path-hidden")r=r?null:!0;else if(t=="data-path"||t=="data-embed-html"||t=="html")n="innerHTML";else if(t=="data-embed-src")X(e,r);else if(t=="data-path-attributes"){let h=((o=e.getAttribute("data-attributes-keys"))===null||o===void 0?void 0:o.split(",").filter(Boolean))||[];if(!Array.isArray(r))for(var a in r){var d=r[a];O(e,a,typeof d=="object"&&d?JSON.stringify(d):d,i)}for(var l=0;l<h.length;l++)(r==null||!(h[l]in r))&&O(e,h[l],null,i);O(e,"data-attributes-keys",Object.keys(r||{}).join(","));return}if(typeof r=="boolean"&&(r=r?"":null),!!s){var u=String(e.getAttribute("data-path-placeholder")||s[n]);r!=null?n=="innerHTML"?s.innerHTML!=r&&(s.innerHTML=r):s.getAttribute(n)!=r&&s.setAttribute(n,r):n=="innerHTML"?s.innerHTML=u:s.removeAttribute(n)}}}function wt(e){let t=new e.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(i=>{let o=i.target,s=o.getAttribute("data-embed-src");s&&X(o,s),i.addedNodes&&i.addedNodes.forEach(n=>{n.nodeType==1&&xt(n,!1)})})});return t.observe(e,{attributes:!0,subtree:!0,childList:!0}),t}function xt(e,t=!0){let r=e.querySelectorAll("[data-embed-src]");for(var i=0;i<r.length;i++){let o=r[i];X(o,o.getAttribute("data-embed-src"))}if(t)return wt(e)}function X(e,t){for(var r=e;r;r=r.parentElement)if(!r.parentElement){let o=r.querySelectorAll("script");for(var i=0;i<o.length;i++)if(o[i].getAttribute("src")==t)return!0;r.tagName=="HTML"&&(r=r.querySelector("head")||r);let s=r.ownerDocument.createElement("script");s.type="module",s.src=t,r.appendChild(s);break}}var lt=["data-attributes-keys","data-path-attributes","data-path-scope"];function S(e,t,r,i){var o,s,n;let a=e;if(i||(t=((o=r==null?void 0:r.processData)===null||o===void 0?void 0:o.call(r,a,t))||t),a.nodeType==1){let l=a.getAttribute("data-path-scope");if(l){let h=dt(a),f=at(t,l,!1)||[];h==0&&Ct(a,((s=r==null?void 0:r.shouldRepeat)===null||s===void 0?void 0:s.call(r,a,f))===!1?1:f.length,r),t={...t,[Et(l)]:f[h]}}let u=Array.prototype.slice.call(a.attributes).sort((h,f)=>lt.indexOf(h.name)-lt.indexOf(f.name));for(var d=0;d<u.length;d++){let{name:h,value:f}=u[d];h.startsWith("data-path")&&h!="data-path-scope"&&O(a,h,at(t,f,!0),r),h=="data-embed-src"&&O(a,h,a.getAttribute(h),r)}}for(var d=0;d<a.children.length;d++)S(a.children[d],t,r,!0);return i||(n=r==null?void 0:r.onRender)===null||n===void 0||n.call(r,a,t),a}function $(e,t,r,i){var o;let s=((o=i==null?void 0:i.processTemplate)===null||o===void 0?void 0:o.call(i,e,t,r))||t;if(e.innerHTML=s,e.classList.add("-feaas"),(e.closest(".component.feaas")||e).className.includes("-theme--"))for(let a of e.children)a.className=a.className.replace(/(\s|^)-theme--[^\s]+\s*/g,"$1");return S(e,r,i)}function Yt(e,t){return Rt(e,t||(t=document.createElement("style"))),t}function Rt(e,t){return t||(t=document.createElement("style")),N(e,r=>{t.textContent=r}).then(()=>t)}function Qt(e,t){return kt(e,t||(t=document.createElement("div"))),t}async function kt(e,t){return t||(t=document.createElement("div")),t.childNodes.length?S(t,e.data,e):"template"in e?$(t,e.template,e.data,e):D(e,r=>$(t,r,e.data,e)).then(()=>t)}function Q(e,t={},r){return r?`<${r}${Object.entries(t).map(([i,o])=>o!=null&&` ${i}="${o}"`).filter(Boolean).join("")}>${F(e)}</${r}>`.replace(/^<([a-z0-9][^>]*)><\/[^>]+>$/,"<$1 />"):F(e)}function F(e){var t;if(Array.isArray(e))return e.map(F).join(`
2
+ `).trim();if(typeof e=="string")return e;if(e==null)return"";switch(e.type){case"heading":let{level:r,...i}=e.attrs;return Q(e.content,i,"h"+r);case"text":return(e.marks||[]).reduce((o,s)=>Q(o,s.attrs,{link:"a",bold:"strong",italic:"em",strike:"s",underline:"u"}[s.type]),(t=e.text)===null||t===void 0?void 0:t.replace(/\s+/," "));default:return Q(e.content||e.text,e.attrs,{bulletList:"ul",orderedList:"ol",listItem:"li",horizontalRule:"hr",paragraph:"p",codeBlock:"code",blockquote:"blockquote"}[e.type])}}function St(e=this){let t,r=e.getAttribute("data");if(r!=null)try{t=typeof r=="string"?JSON.parse(r):{}}catch(i){}return{data:t!=null?t:{},library:e.getAttribute("library"),component:e.getAttribute("component"),version:e.getAttribute("version"),revision:e.getAttribute("revision"),hostname:e.getAttribute("hostname"),cdn:e.getContextAttribute("cdn"),template:e.getAttribute("template"),instance:e.getAttribute("instance"),editable:e.getAttribute("editable")!=null,suspended:e.getAttribute("suspended")!=null}}var I=class extends m{setData(t){this.set({data:t})}getProps(){return St(this)}attributeChangedCallback(t,r,i){r!==i&&(this.payload=void 0,this.needsRefresh=!0,super.attributeChangedCallback(t,r,i))}getEditor(){var t;return(t=document.querySelector("feaas-context"))===null||t===void 0?void 0:t.refs.editor}constructor(){super(),this.addEventListener("click",()=>{this.props.editable&&this.edit()})}edit(){let t=this.getEditor();if(t!=null&&t.setTarget(this))return t.open(),!0}getOriginal(){let t=this.getAttribute("data-path-scope");if(t){for(var r=this;(r=r.previousElementSibling)&&r.getAttribute("data-path-scope")==t;)var i=r;return i}}isReadyToLoad(){return super.isReadyToLoad()&&this.props.library!=null&&this.props.component!=null&&this.props.version!=null}async load(){if(!this.getOriginal())try{D(this.props,this.onLoad)}catch(t){console.error(`FEAAS: Could not fetch component: ${this.props.component}/${this.props.version}/${this.props.revision}`)}}update(){if(Array.from(this.children).filter(t=>t.tagName!="BR").length>0&&!this.needsRefresh)S(this,this.props.data);else{if(this.needsRefresh=!0,this.getOriginal())return;$(this,this.payload,this.props.data)}}};I.observedAttributes=["library","component","version","revision","hostname","cdn","template","data","instance","editable"];I.register("feaas-component");function _t(e=this){return{opacity:e!=null&&e.getAttribute("opacity")?parseFloat(e==null?void 0:e.getAttribute("opacity")):1,hidden:(e==null?void 0:e.getAttribute("hidden"))!=null}}var U=class extends m{getProps(){return _t(this)}attributeChangedCallback(t,r,i){if(r!==i)return t=="hidden"&&(this.style.setProperty("display","block","important"),this.style.setProperty("transition","opacity 0.3s","important"),i?(this.style.setProperty("opacity","0","important"),this.style.pointerEvents="none"):(this.style.setProperty("opacity","1","important"),this.style.pointerEvents="all")),super.attributeChangedCallback(t,r,i)}connectedCallback(){this.payload=null,super.connectedCallback(),this.attributeChangedCallback("hidden",this.getAttribute("hidden"),this.getAttribute("hidden")),this.stylesheet=document.createElement("style"),this.stylesheet.textContent=`
3
3
  #loader {
4
4
  position: absolute;
5
5
  top: 0;
@@ -63,5 +63,5 @@ var yt=typeof HTMLElement=="undefined"?class{}:HTMLElement,m=class extends yt{co
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)}};U.observedAttributes=["hidden","opacity"];U.register("feaas-loader");function Pt(e=this){var t;return{library:e==null?void 0:e.getContextAttribute("library"),revision:(t=e==null?void 0:e.getAttribute("revision"))!==null&&t!==void 0?t:"published",cdn:(e==null?void 0:e.getContextAttribute("cdn"))||(e==null?void 0:e.getContextAttribute("hostname"))}}var Z=class extends m{getProps(){return Pt(this)}isReadyToLoad(){return this.props.library!=null&&this.props.revision!=null&&this.props.cdn!=null}async load(){D(this.props,this.onLoad)}update(){this.stylesheet||(this.stylesheet=document.createElement("style"),this.appendChild(this.stylesheet)),this.stylesheet.textContent=this.payload}};Z.register("feaas-stylesheet");var tt;typeof window!="undefined"&&(window.FEAASElement=R,(tt=window.FEAASLoading)!==null&&tt!==void 0||(window.FEAASLoading=Promise.resolve()));function Tt(e){let t=[];if(e){let r=e.ownerDocument.defaultView,i,o;for(;r!==window.top;){i=r.parent;for(let s=0;s<i.frames.length;s++)if(i.frames[s]===r){for(let n of i.document.getElementsByTagName("iframe"))if(n.contentWindow===r){o=n.getBoundingClientRect();let a=n.contentWindow.getComputedStyle(n);t.push({left:o.left+parseInt(a.borderLeftWidth),top:o.top+parseInt(a.borderTopWidth)})}r=i;break}}}return t.reduce((r,i)=>({left:r.left+i.left,top:r.top+i.top}),{left:0,top:0})}function Ot(e=this){var t;return{context:HTMLElement,frontend:e==null?void 0:e.getContextAttribute("frontend"),src:(t=e==null?void 0:e.getAttribute("src"))!==null&&t!==void 0?t:"/editor.js",library:e==null?void 0:e.getAttribute("library"),component:e==null?void 0:e.getAttribute("component"),version:e==null?void 0:e.getAttribute("version"),instance:e==null?void 0:e.getAttribute("instance"),forked:e==null?void 0:e.getAttribute("forked"),revision:(e==null?void 0:e.getAttribute("revision"))||"saved",hidden:(e==null?void 0:e.getAttribute("hidden"))!=null,for:e==null?void 0:e.getAttribute("for"),state:(e==null?void 0:e.getAttribute("state"))||"idle",changed:(e==null?void 0:e.getAttribute("changed"))!=null}}var W=class extends m{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.setTarget=(t,r={component:t.getAttribute("component"),version:t.getAttribute("version"),revision:t.getAttribute("revision"),instance:t.getAttribute("instance")})=>{if(!this.closing&&(!this.target||t==null))return this.set(r),this.target=t,!0},this.onChromeMeasureElement=(t,r=t.getBoundingClientRect())=>t.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=t=>{t.memoized.focusable&&(this.framePoint=Tt(t.memoized.focusable)),this.chrome&&(this.wrapperRect=this.chrome.positionable.getBoundingClientRect(),this.bodyRect=this.chrome.positionable.ownerDocument.body.parentElement.getBoundingClientRect())},this.onMeasure=()=>{},this.onPosition=({focusable:t,root:r})=>{!this.chrome||this.props.hidden||(t?(this.chrome.wrapper.style.width=t.width+16*2+"px",this.chrome.wrapper.style.height=t.height+16*1+64+"px",this.chrome.wrapper.style.left=t.left-16+"px",this.chrome.wrapper.style.top=t.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=t=>{var r;switch((r=t.data)===null||r===void 0?void 0:r.type){case"feaasEdit":let i=this.getPlaceholder();this.setTarget(i.editable,t.data)&&(this.loader=i.loader,document.body.appendChild(i.clipper),this.editedUID=t.data.id,this.setPlaceholder(),this.open());break;case"feaasMeasurements":this.measurements=t.data.measurements,this.props.hidden||this.setPlaceholder();break}},this.onContentChange=()=>{this.setAttribute("changed","changed"),requestAnimationFrame(()=>{this.setIframeComponentContent()})},this.onClose=()=>{var t;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"),!((t=this.target)===null||t===void 0)&&t.parentNode&&(this.target.outerHTML=this.target.outerHTML),this.setTarget(null,{component:null,version:null,instance:null,revision:null}),this.setEditorContext({isFocused:!1})},this.onVersionStateChange=(t,r)=>{this.versionContext=t,this.setVersionContext=r},this.onEditorStateChange=(t,r)=>{this.editorContext=t,this.setEditorContext=r,t.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 Ot(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(t){this.iframe=t}setIframeComponentContent(){this.placeholder&&this.iframe&&this.placeholder.editable.innerHTML&&this.iframe.contentWindow.postMessage({type:"feaasUpdate",id:this.editedUID,content:this.placeholder.editable.innerHTML})}setPlaceholder(){let t=this.iframe.clientWidth,r=this.iframe.clientHeight,i=this.iframe.getBoundingClientRect(),o=this.getPlaceholder(),s=document.body.getBoundingClientRect(),n=this.measurements[this.editedUID];n&&(Object.assign(o.clipper.style,{position:"absolute",top:i.top+this.iframe.clientTop-s.top+"px",left:i.left+this.iframe.clientLeft-s.left+"px",width:t+"px",height:r+"px",pointerEvents:"none",zIndex:1,overflow:"hidden"}),Object.assign(o.positionable.style,{position:"absolute",top:n.top+"px",left:n.left+"px",width:n.width+"px",zIndex:2,transition:"opacity 0.4s",pointerEvents:this.props.hidden?"none":"all"}),Object.assign(o.loader.style,{position:"absolute",top:n.top+"px",left:n.left+"px",width:n.width+"px",height:n.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(t,r,i){r!==i&&(t=="hidden"&&(this.style.setProperty("display","block","important"),this.style.setProperty("transition","opacity 0.3s","important"),i?(this.style.setProperty("opacity","0","important"),this.style.pointerEvents="none"):(this.style.setProperty("opacity","1","important"),this.style.pointerEvents="all")),super.attributeChangedCallback(t,r,i))}open(){clearTimeout(this.closing),this.removeAttribute("hidden"),this.removeAttribute("changed"),this.setLoadingState()}shouldFork(t){return t.forkOriginId==null&&this.props.instance!=null}cleanup(){var t;this.placeholder&&((t=this.placeholder.clipper)===null||t===void 0||t.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(t){console.log("Editor is not ready")}setEditorContext(t){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:t,component:r,version:i,instance:o},{Editor:s,VersionStatusList:n,VersionStatusButton:a,Version:d,VersionMenu:l,EditorUIUndo:u,EditorUIMode:h,React:{useEffect:f,useMemo:c,useState:g,useContext:w},Chakra:{HStack:V,Box:A,Button:et,MenuItem:rt},Chrome:ct,ReactDOM:Nt,useSDK:ht,useSlots:ut,useModelObserver:pt,ConfirmationContext:ft,VersionContext:Dt}){if(!this.payload)return;let{React:b}=this.payload,{sdk:M}=ht(),[y,it]=g(),{setConfirm:z}=w(ft),_=o||i,gt=M.library;y&&(this.component=y),f(()=>{if(this.props.hidden)return;let C=gt.components.getItem(r).clone();return C.versions.search({ids:[i,o].filter(Boolean),componentIds:[r]}).then(H=>{C.versions.setItems(H);let E=C.findVersion(o,["staged","published"]),T=C.findVersion(i,["staged","published"]);if(E)E.deletedAt?(E.getDraft().changeAndNotify(T.toProperties()).restore(),console.error("FEAAS Editor: Restoring fork")):(console.error("FEAAS Editor: Pre-forked"),this.setAttribute("forked",E.id));else if(this.removeAttribute("forked"),this.shouldFork(T)){console.error("FEAAS Editor: Forking");let q=T.fork(o).id;this.setAttribute("instance",q)}else console.error("FEAAS Editor: Regular");it(C)}),()=>{this.closing=setTimeout(()=>{this.closing=null,this.cleanup(),it(null)},400)}},[i,this.props.hidden]);let ot=pt(y==null?void 0:y.versions,[]).filter(C=>C.id==_),P=ot[0];P&&!this.props.hidden&&(this.version=P),f(()=>(this.unfork=()=>{z({title:"Reverting component customizations",button:"Discard",body:"Are you sure to reset component to its original state? All changes will be lost.",action:()=>{let C=y.findVersion(i,["staged","published"]);y.findVersion(o).unstage().unpublish().changeAndNotify(C.toProperties()),y.saveVersions(!1),this.setVersionContext({needsWrite:!0}),this.removeAttribute("forked"),requestAnimationFrame(this.onClose)}})},this.discard=()=>{this.props.changed&&(y.findVersion(_).revert(),y.saveVersions(!1),this.setVersionContext({needsWrite:!0}))},this.close=()=>{z({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=()=>{z({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:()=>{y.findVersion(_).commitData({view:this.editorContext.editor.getData({rootName:_}),model:""}).stage().publish(),this.removeAttribute("changed"),this.setAttribute("forked",_),y.saveVersions(!1)}})},()=>{delete this.unfork,delete this.discard,delete this.save,delete this.editorContext,delete this.versionContext,delete this.setEditorContext,delete this.setVersionContext}),[y]);let bt=c(()=>this.target,[y]);return c(()=>y&&ut(t,({picker:C,children:H})=>b.createElement(A,{ref:E=>{this.chrome=E?{positionable:E,wrapper:E.querySelector(".editor-chrome"),absolute:this.querySelector(".ui.overlays")}:null}},b.createElement(A,{className:"editor-wrapper",position:"absolute",left:0,top:0},b.createElement(s,{datasources:M.datasources,sdk:M,library:M.library,component:y,versions:ot,context:{isAutosaveEnabled:!1,onChromeMeasure:this.onMeasure,onChromeBeforeMeasure:this.onBeforeMeasure,onChromeMeasureElement:this.onChromeMeasureElement,onChromePosition:this.onPosition,onContentChange:this.onContentChange}},{exports:this.onEditorStateChange,after:H,chrome:({editor:E})=>E&&b.createElement(ct,null),children:({isArchivedDisplayed:E,editor:T,status:q})=>b.createElement(A,{position:"absolute",left:0,top:0,className:"editor-chrome",p:4,boxShadow:"2xl",pointerEvents:"none",opacity:0,transition:"opacity 0.3s"},b.createElement(A,{left:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),b.createElement(A,{right:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),b.createElement(A,{top:0,height:"16",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),b.createElement(A,{bottom:0,height:"4",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),P&&b.createElement(d,{version:P,node:bt,ignoreBreakpoints:!0,deps:[this.props.forked,this.props.changed]},{exports:this.onVersionStateChange,left:b.createElement(V,{justifyContent:"space-between"},b.createElement(u,{size:"sm",editor:q=="ready"?T:null}),b.createElement(h,{size:"sm"})),middle:($t,Ft)=>[!1],right:b.createElement(b.Fragment,null,b.createElement(et,{variant:"secondary",size:"sm",onClick:this.close},"Close"),b.createElement(et,{variant:"primary",size:"sm",onClick:this.save,isDisabled:!this.props.changed},this.props.changed?this.props.forked?"Save":"Save customization":"Up to date"),b.createElement(l,{isDisabled:!this.props.forked&&!this.props.changed},b.createElement(rt,{onClick:this.unfork,isDisabled:!this.props.forked},"Unfork"),b.createElement(rt,{onClick:this.discard,isDisabled:!this.props.changed},"Discard")))}))})))),[P,this.props.forked,this.props.changed])}isReadyToLoad(){return this.props.component!=null&&this.props.version!=null&&!this.props.hidden}};W.observedAttributes=["library","component","version","revision","hidden","state","changed","forked"];W.register("feaas-editor");function Mt(e=this){var t,r;return{part:(e==null?void 0:e.getAttribute("part"))||"picker",slot:(e==null?void 0:e.getAttribute("part"))||"picker",mode:e==null?void 0:e.getAttribute("mode"),placeholder:(e==null?void 0:e.getAttribute("placeholder"))||"No theme",frontend:(t=e==null?void 0:e.getContextAttribute("frontend"))!==null&&t!==void 0?t:"https://components.sitecorecloud.io",src:(r=e==null?void 0:e.getAttribute("src"))!==null&&r!==void 0?r:"/picker.js",hidden:(e==null?void 0:e.getAttribute("hidden"))!=null,variant:e==null?void 0:e.getAttribute("variant"),context:void 0,onClose:void 0,onContextAttributeSet:void 0}}var j=class extends m{getProps(){return Mt(this)}load(){return import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}render({placeholder:t,context:r,mode:i,children:o,variant:s},{Picker:n,React:a,ReactDOM:d}){return a.createElement(n,{placeholder:t,mode:i||void 0,onClose:this.props.onClose,onContextAttributeSet:this.props.onContextAttributeSet,context:r,variant:s},o)}};j.observedAttributes=["library","mode","frontend","src","hidden","variant"];j.register("feaas-picker");function Lt(e=this){var t,r,i,o;return{library:e==null?void 0:e.getAttribute("library"),src:(t=e==null?void 0:e.getAttribute("src"))!==null&&t!==void 0?t:"/context.js",frontend:(r=e==null?void 0:e.getAttribute("frontend"))!==null&&r!==void 0?r:"https://components.sitecoreclud.io",backend:(i=e==null?void 0:e.getAttribute("backend"))!==null&&i!==void 0?i:"https://components-api.sitecoreclud.io",cdn:(o=e==null?void 0:e.getAttribute("cdn"))!==null&&o!==void 0?o:"https://feaascompontsapiprod.blob.core.windows.net",getToken:null}}var B=class extends m{constructor(){super(...arguments),this.onStatusChange=t=>{t=="ready"&&this.dispatchEvent(new Event("feaasReady",{bubbles:!0,composed:!0}))}}getProps(){return Lt(this)}load(){return import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}getTheme(t){return t}getRoot(){return this.shadowRoot||this.attachShadow({mode:"open"})}getReactRootElement(){return this.reactRootElement||(this.reactRootElement=document.createElement("div"),this.getRoot().appendChild(this.reactRootElement)),this.reactRootElement}connectedCallback(){Array.from(this.children).forEach(t=>{this.getRoot().appendChild(t)}),super.connectedCallback()}render({children:t,library:r},{AppContext:i,Chakra:{Button:o,Tooltip:s},React:n}){let a={containerRef:{current:this.getRoot()}};return s.defaultProps={hasArrow:!0,placement:"top",portalProps:a},n.createElement(i,{backend:this.props.backend,libraryId:this.props.library,container:this.getRoot(),getToken:this.props.getToken,getTheme:this.getTheme,onStatusChange:this.onStatusChange,modalProps:{portalProps:a},chakraProps:{cssVarsRoot:":host",resetCSS:!0,toastOptions:{portalProps:a}}},t)}};B.observedAttributes=["library","component","version","revision","hostname","template"];B.register("feaas-context");export{m as Base,I as Component,m as FEAASBase,I as FEAASComponent,St as FEAASComponentsProps,B as FEAASContext,Lt as FEAASContextProps,W as FEAASEditor,Ot as FEAASEditorProps,U as FEAASLoader,_t as FEAASLoaderProps,j as FEAASPicker,Mt as FEAASPickerProps,Z as FEAASStylesheet,Pt as FEAASStylesheetProps,p as JSONPath,U as Loader,J as MyComponent,Z as Stylesheet,xt as autoloadScripts,At as cleanCollectionBit,st as fetchAndRevalidate,k as fetchAndValidate,Tt as getFramePosition,Y as invalidateRequest,X as loadScript,Et as normalizeCollectionScope,wt as observeDOMElement,at as queryScopes,L as refetchAndValidate,Qt as renderComponent,Gt as renderComponentElement,kt as renderComponentPromise,$ as renderDOMContent,S as renderDOMElement,Yt as renderStylesheet,Rt as renderStylesheetPromise,F as serializeCH1RichText,O as setDOMAttribute};
66
+ </div>`,this.getRoot().appendChild(this.stylesheet),this.getRoot().appendChild(this.loader)}update(){this.loader.style.opacity=String(this.props.opacity)}};U.observedAttributes=["hidden","opacity"];U.register("feaas-loader");function Pt(e=this){var t;return{library:e==null?void 0:e.getContextAttribute("library"),revision:(t=e==null?void 0:e.getAttribute("revision"))!==null&&t!==void 0?t:"published",cdn:(e==null?void 0:e.getContextAttribute("cdn"))||(e==null?void 0:e.getContextAttribute("hostname"))}}var Z=class extends m{getProps(){return Pt(this)}isReadyToLoad(){return this.props.library!=null&&this.props.revision!=null&&this.props.cdn!=null}async load(){N(this.props,this.onLoad)}update(){this.stylesheet||(this.stylesheet=document.createElement("style"),this.appendChild(this.stylesheet)),this.stylesheet.textContent=this.payload}};Z.register("feaas-stylesheet");var tt;typeof window!="undefined"&&(window.FEAASElement=R,(tt=window.FEAASLoading)!==null&&tt!==void 0||(window.FEAASLoading=Promise.resolve()));function Tt(e){let t=[];if(e){let r=e.ownerDocument.defaultView,i,o;for(;r!==window.top;){i=r.parent;for(let s=0;s<i.frames.length;s++)if(i.frames[s]===r){for(let n of i.document.getElementsByTagName("iframe"))if(n.contentWindow===r){o=n.getBoundingClientRect();let a=n.contentWindow.getComputedStyle(n);t.push({left:o.left+parseInt(a.borderLeftWidth),top:o.top+parseInt(a.borderTopWidth)})}r=i;break}}}return t.reduce((r,i)=>({left:r.left+i.left,top:r.top+i.top}),{left:0,top:0})}function Ot(e=this){var t;return{context:HTMLElement,frontend:e==null?void 0:e.getContextAttribute("frontend"),src:(t=e==null?void 0:e.getAttribute("src"))!==null&&t!==void 0?t:"/editor.js",library:e==null?void 0:e.getAttribute("library"),component:e==null?void 0:e.getAttribute("component"),version:e==null?void 0:e.getAttribute("version"),instance:e==null?void 0:e.getAttribute("instance"),forked:e==null?void 0:e.getAttribute("forked"),revision:(e==null?void 0:e.getAttribute("revision"))||"saved",hidden:(e==null?void 0:e.getAttribute("hidden"))!=null,for:e==null?void 0:e.getAttribute("for"),state:(e==null?void 0:e.getAttribute("state"))||"idle",changed:(e==null?void 0:e.getAttribute("changed"))!=null}}var W=class extends m{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.setTarget=(t,r={component:t.getAttribute("component"),version:t.getAttribute("version"),revision:t.getAttribute("revision"),instance:t.getAttribute("instance")})=>{if(!this.closing&&(!this.target||t==null))return this.set(r),this.target=t,!0},this.onChromeMeasureElement=(t,r=t.getBoundingClientRect())=>t.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=t=>{t.memoized.focusable&&(this.framePoint=Tt(t.memoized.focusable)),this.chrome&&(this.wrapperRect=this.chrome.positionable.getBoundingClientRect(),this.bodyRect=this.chrome.positionable.ownerDocument.body.parentElement.getBoundingClientRect())},this.onMeasure=()=>{},this.onPosition=({focusable:t,root:r})=>{!this.chrome||this.props.hidden||(t?(this.chrome.wrapper.style.width=t.width+16*2+"px",this.chrome.wrapper.style.height=t.height+16*1+64+"px",this.chrome.wrapper.style.left=t.left-16+"px",this.chrome.wrapper.style.top=t.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=t=>{var r;switch((r=t.data)===null||r===void 0?void 0:r.type){case"feaasEdit":let i=this.getPlaceholder();this.setTarget(i.editable,t.data)&&(this.loader=i.loader,document.body.appendChild(i.clipper),this.editedUID=t.data.id,this.setPlaceholder(),this.open());break;case"feaasMeasurements":this.measurements=t.data.measurements,this.props.hidden||this.setPlaceholder();break}},this.onContentChange=()=>{this.setAttribute("changed","changed"),requestAnimationFrame(()=>{this.setIframeComponentContent()})},this.onClose=()=>{var t;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"),!((t=this.target)===null||t===void 0)&&t.parentNode&&(this.target.outerHTML=this.target.outerHTML),this.setTarget(null,{component:null,version:null,instance:null,revision:null}),this.setEditorContext({isFocused:!1})},this.onVersionStateChange=(t,r)=>{this.versionContext=t,this.setVersionContext=r},this.onEditorStateChange=(t,r)=>{this.editorContext=t,this.setEditorContext=r,t.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 Ot(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(t){this.iframe=t}setIframeComponentContent(){this.placeholder&&this.iframe&&this.placeholder.editable.innerHTML&&this.iframe.contentWindow.postMessage({type:"feaasUpdate",id:this.editedUID,content:this.placeholder.editable.innerHTML})}setPlaceholder(){let t=this.iframe.clientWidth,r=this.iframe.clientHeight,i=this.iframe.getBoundingClientRect(),o=this.getPlaceholder(),s=document.body.getBoundingClientRect(),n=this.measurements[this.editedUID];n&&(Object.assign(o.clipper.style,{position:"absolute",top:i.top+this.iframe.clientTop-s.top+"px",left:i.left+this.iframe.clientLeft-s.left+"px",width:t+"px",height:r+"px",pointerEvents:"none",zIndex:1,overflow:"hidden"}),Object.assign(o.positionable.style,{position:"absolute",top:n.top+"px",left:n.left+"px",width:n.width+"px",zIndex:2,transition:"opacity 0.4s",pointerEvents:this.props.hidden?"none":"all"}),Object.assign(o.loader.style,{position:"absolute",top:n.top+"px",left:n.left+"px",width:n.width+"px",height:n.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(t,r,i){r!==i&&(t=="hidden"&&(this.style.setProperty("display","block","important"),this.style.setProperty("transition","opacity 0.3s","important"),i?(this.style.setProperty("opacity","0","important"),this.style.pointerEvents="none"):(this.style.setProperty("opacity","1","important"),this.style.pointerEvents="all")),super.attributeChangedCallback(t,r,i))}open(){clearTimeout(this.closing),this.removeAttribute("hidden"),this.removeAttribute("changed"),this.setLoadingState()}shouldFork(t){return t.forkOriginId==null&&this.props.instance!=null}cleanup(){var t;this.placeholder&&((t=this.placeholder.clipper)===null||t===void 0||t.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(t){console.log("Editor is not ready")}setEditorContext(t){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:t,component:r,version:i,instance:o},{Editor:s,VersionStatusList:n,VersionStatusButton:a,Version:d,VersionMenu:l,EditorUIUndo:u,EditorUIMode:h,React:{useEffect:f,useMemo:c,useState:g,useContext:w},Chakra:{HStack:V,Box:A,Button:et,MenuItem:rt},Chrome:ct,ReactDOM:Dt,useSDK:ht,useSlots:ut,useModelObserver:pt,ConfirmationContext:ft,VersionContext:Nt}){if(!this.payload)return;let{React:b}=this.payload,{sdk:M}=ht(),[y,it]=g(),{setConfirm:z}=w(ft),_=o||i,gt=M.library;y&&(this.component=y),f(()=>{if(this.props.hidden)return;let C=gt.components.getItem(r).clone();return C.versions.search({ids:[i,o].filter(Boolean),componentIds:[r]}).then(H=>{C.versions.setItems(H);let E=C.findVersion(o,["staged","published"]),T=C.findVersion(i,["staged","published"]);if(E)E.deletedAt?(E.getDraft().changeAndNotify(T.toProperties()).restore(),console.error("FEAAS Editor: Restoring fork")):(console.error("FEAAS Editor: Pre-forked"),this.setAttribute("forked",E.id));else if(this.removeAttribute("forked"),this.shouldFork(T)){console.error("FEAAS Editor: Forking");let q=T.fork(o).id;this.setAttribute("instance",q)}else console.error("FEAAS Editor: Regular");it(C)}),()=>{this.closing=setTimeout(()=>{this.closing=null,this.cleanup(),it(null)},400)}},[i,this.props.hidden]);let ot=pt(y==null?void 0:y.versions,[]).filter(C=>C.id==_),P=ot[0];P&&!this.props.hidden&&(this.version=P),f(()=>(this.unfork=()=>{z({title:"Reverting component customizations",button:"Discard",body:"Are you sure to reset component to its original state? All changes will be lost.",action:()=>{let C=y.findVersion(i,["staged","published"]);y.findVersion(o).unstage().unpublish().changeAndNotify(C.toProperties()),y.saveVersions(!1),this.setVersionContext({needsWrite:!0}),this.removeAttribute("forked"),requestAnimationFrame(this.onClose)}})},this.discard=()=>{this.props.changed&&(y.findVersion(_).revert(),y.saveVersions(!1),this.setVersionContext({needsWrite:!0}))},this.close=()=>{z({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=()=>{z({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:()=>{y.findVersion(_).commitData({view:this.editorContext.editor.getData({rootName:_}),model:""}).stage().publish(),this.removeAttribute("changed"),this.setAttribute("forked",_),y.saveVersions(!1)}})},()=>{delete this.unfork,delete this.discard,delete this.save,delete this.editorContext,delete this.versionContext,delete this.setEditorContext,delete this.setVersionContext}),[y]);let bt=c(()=>this.target,[y]);return c(()=>y&&ut(t,({picker:C,children:H})=>b.createElement(A,{ref:E=>{this.chrome=E?{positionable:E,wrapper:E.querySelector(".editor-chrome"),absolute:this.querySelector(".ui.overlays")}:null}},b.createElement(A,{className:"editor-wrapper",position:"absolute",left:0,top:0},b.createElement(s,{datasources:M.datasources,sdk:M,library:M.library,component:y,versions:ot,context:{isAutosaveEnabled:!1,onChromeMeasure:this.onMeasure,onChromeBeforeMeasure:this.onBeforeMeasure,onChromeMeasureElement:this.onChromeMeasureElement,onChromePosition:this.onPosition,onContentChange:this.onContentChange}},{exports:this.onEditorStateChange,after:H,chrome:({editor:E})=>E&&b.createElement(ct,null),children:({isArchivedDisplayed:E,editor:T,status:q})=>b.createElement(A,{position:"absolute",left:0,top:0,className:"editor-chrome",p:4,boxShadow:"2xl",pointerEvents:"none",opacity:0,transition:"opacity 0.3s"},b.createElement(A,{left:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),b.createElement(A,{right:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),b.createElement(A,{top:0,height:"16",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),b.createElement(A,{bottom:0,height:"4",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),P&&b.createElement(d,{version:P,node:bt,ignoreBreakpoints:!0,deps:[this.props.forked,this.props.changed]},{exports:this.onVersionStateChange,left:b.createElement(V,{justifyContent:"space-between"},b.createElement(u,{size:"sm",editor:q=="ready"?T:null}),b.createElement(h,{size:"sm"})),middle:($t,Ft)=>[!1],right:b.createElement(b.Fragment,null,b.createElement(et,{variant:"secondary",size:"sm",onClick:this.close},"Close"),b.createElement(et,{variant:"primary",size:"sm",onClick:this.save,isDisabled:!this.props.changed},this.props.changed?this.props.forked?"Save":"Save customization":"Up to date"),b.createElement(l,{isDisabled:!this.props.forked&&!this.props.changed},b.createElement(rt,{onClick:this.unfork,isDisabled:!this.props.forked},"Unfork"),b.createElement(rt,{onClick:this.discard,isDisabled:!this.props.changed},"Discard")))}))})))),[P,this.props.forked,this.props.changed])}isReadyToLoad(){return this.props.component!=null&&this.props.version!=null&&!this.props.hidden}};W.observedAttributes=["library","component","version","revision","hidden","state","changed","forked"];W.register("feaas-editor");function Mt(e=this){var t,r;return{part:(e==null?void 0:e.getAttribute("part"))||"picker",slot:(e==null?void 0:e.getAttribute("part"))||"picker",mode:e==null?void 0:e.getAttribute("mode"),placeholder:(e==null?void 0:e.getAttribute("placeholder"))||"No theme",frontend:(t=e==null?void 0:e.getContextAttribute("frontend"))!==null&&t!==void 0?t:"https://components.sitecorecloud.io",src:(r=e==null?void 0:e.getAttribute("src"))!==null&&r!==void 0?r:"/picker.js",hidden:(e==null?void 0:e.getAttribute("hidden"))!=null,variant:e==null?void 0:e.getAttribute("variant"),context:void 0,onClose:void 0,onContextAttributeSet:void 0}}var j=class extends m{getProps(){return Mt(this)}load(){return import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}render({placeholder:t,context:r,mode:i,children:o,variant:s},{Picker:n,React:a,ReactDOM:d}){return a.createElement(n,{placeholder:t,mode:i||void 0,onClose:this.props.onClose,onContextAttributeSet:this.props.onContextAttributeSet,context:r,variant:s},o)}};j.observedAttributes=["library","mode","frontend","src","hidden","variant"];j.register("feaas-picker");function Lt(e=this){var t,r,i,o;return{library:e==null?void 0:e.getAttribute("library"),src:(t=e==null?void 0:e.getAttribute("src"))!==null&&t!==void 0?t:"/context.js",frontend:(r=e==null?void 0:e.getAttribute("frontend"))!==null&&r!==void 0?r:"https://components.sitecoreclud.io",backend:(i=e==null?void 0:e.getAttribute("backend"))!==null&&i!==void 0?i:"https://components-api.sitecoreclud.io",cdn:(o=e==null?void 0:e.getAttribute("cdn"))!==null&&o!==void 0?o:"https://feaascompontsapiprod.blob.core.windows.net",getToken:null}}var B=class extends m{constructor(){super(...arguments),this.onStatusChange=t=>{t=="ready"&&this.dispatchEvent(new Event("feaasReady",{bubbles:!0,composed:!0}))}}getProps(){return Lt(this)}load(){return import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}isReadyToLoad(){return console.log("Is ready?",this.props,super.isReadyToLoad()&&this.props.library!=null),super.isReadyToLoad()&&this.props.library!=null}getTheme(t){return t}getRoot(){return this.shadowRoot||this.attachShadow({mode:"open"})}getReactRootElement(){return this.reactRootElement||(this.reactRootElement=document.createElement("div"),this.getRoot().appendChild(this.reactRootElement)),this.reactRootElement}connectedCallback(){Array.from(this.children).forEach(t=>{this.getRoot().appendChild(t)}),super.connectedCallback()}render({children:t,library:r},{AppContext:i,Chakra:{Button:o,Tooltip:s},React:n}){let a={containerRef:{current:this.getRoot()}};return s.defaultProps={hasArrow:!0,placement:"top",portalProps:a},n.createElement(i,{backend:this.props.backend,libraryId:this.props.library,container:this.getRoot(),getToken:this.props.getToken,getTheme:this.getTheme,onStatusChange:this.onStatusChange,modalProps:{portalProps:a},chakraProps:{cssVarsRoot:":host",resetCSS:!0,toastOptions:{portalProps:a}}},t)}};B.observedAttributes=["library","component","version","revision","hostname","template"];B.register("feaas-context");export{m as Base,I as Component,m as FEAASBase,I as FEAASComponent,St as FEAASComponentsProps,B as FEAASContext,Lt as FEAASContextProps,W as FEAASEditor,Ot as FEAASEditorProps,U as FEAASLoader,_t as FEAASLoaderProps,j as FEAASPicker,Mt as FEAASPickerProps,Z as FEAASStylesheet,Pt as FEAASStylesheetProps,p as JSONPath,U as Loader,J as MyComponent,Z as Stylesheet,xt as autoloadScripts,At as cleanCollectionBit,st as fetchAndRevalidate,k as fetchAndValidate,Tt as getFramePosition,Y as invalidateRequest,X as loadScript,Et as normalizeCollectionScope,wt as observeDOMElement,at as queryScopes,L as refetchAndValidate,Qt as renderComponent,Gt as renderComponentElement,kt as renderComponentPromise,$ as renderDOMContent,S as renderDOMElement,Yt as renderStylesheet,Rt as renderStylesheetPromise,F as serializeCH1RichText,O as setDOMAttribute};
67
67
  //# sourceMappingURL=index.esm.js.map