@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,7 +1,7 @@
1
- var ct=Object.defineProperty;var Vt=Object.getOwnPropertyDescriptor;var Ht=Object.getOwnPropertyNames;var zt=Object.prototype.hasOwnProperty;var qt=(t,e)=>{for(var r in e)ct(t,r,{get:e[r],enumerable:!0})},Jt=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Ht(e))!zt.call(t,n)&&n!==r&&ct(t,n,{get:()=>e[n],enumerable:!(i=Vt(e,n))||i.enumerable});return t};var Kt=t=>Jt(ct({},"__esModule",{value:!0}),t);var fe={};qt(fe,{Base:()=>y,Component:()=>z,FEAASBase:()=>y,FEAASComponent:()=>z,FEAASComponentsProps:()=>Mt,FEAASContext:()=>G,FEAASContextProps:()=>jt,FEAASEditor:()=>J,FEAASEditorProps:()=>It,FEAASLoader:()=>q,FEAASLoaderProps:()=>Nt,FEAASPicker:()=>K,FEAASPickerProps:()=>Bt,FEAASStylesheet:()=>nt,FEAASStylesheetProps:()=>Lt,JSONPath:()=>f,Loader:()=>q,MyComponent:()=>Z,Stylesheet:()=>nt,autoloadScripts:()=>Dt,cleanCollectionBit:()=>_t,fetchAndRevalidate:()=>pt,fetchAndValidate:()=>F,getFramePosition:()=>$t,invalidateRequest:()=>tt,loadScript:()=>it,normalizeCollectionScope:()=>kt,observeDOMElement:()=>Pt,queryScopes:()=>bt,refetchAndValidate:()=>W,renderComponent:()=>pe,renderComponentElement:()=>ue,renderComponentPromise:()=>Tt,renderDOMContent:()=>V,renderDOMElement:()=>P,renderStylesheet:()=>he,renderStylesheetPromise:()=>Ot,serializeCH1RichText:()=>H,setDOMAttribute:()=>N});module.exports=Kt(fe);var Gt=typeof HTMLElement=="undefined"?class{}:HTMLElement,y=class extends Gt{constructor(){super(),this.connected=!1,this.refs={},this.descendants=[],this.onLoad=e=>{e!=null&&(this.payload=e,this.update())},this.addEventListener("feaasConnected",this),this.addEventListener("feaasDisconnected",this)}getProps(e){return{}}getRoot(){return this}attributeChangedCallback(e,r,i){this.set()}connectedCallback(){this.initialize()}initialize(){let e=this.getParent();if(!(e&&!e.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(e=!0){for(var r=this;r=r.parentElement||(r.parentNode instanceof ShadowRoot?r.parentNode.host:null);)if(!e||r.tagName.startsWith("FEAAS-"))return r}getElements(e=this.getRoot(),r=!0){return Array.from(e.querySelectorAll("*")).map(i=>[!r||i.tagName.startsWith("FEAAS-")?i:null,i.shadowRoot?this.getElements(i.shadowRoot,r):null]).flat().filter(Boolean)}disconnectedCallback(){this.connected&&(console.log("FEAAS: Disconnected",this),this.dispatchEvent(new Event("feaasDisconnected",{bubbles:!0,composed:!0})),this.connected=null)}handleEvent(e){let r=e.composedPath()[0];switch(e.type){case"feaasConnected":r!=this&&this.nestedCallback(r);break;case"feaasDisconnected":r!=this&&this.unnestedCallback(r);break}}unnestedCallback(e){let r=this.descendants.indexOf(e);r!=-1&&(console.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),console.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}async reify(){this.payload!==void 0?this.update():this.isReadyToLoad()&&(this.payload=null,this.load().then(this.onLoad))}load(){return Promise.resolve(null)}update(e=!1){var r,i,n;if(console.log("FEAAS: React",this.tagName,this.payload),this.payload==null)return;let{React:o,ReactDOM:s,ReactDOMClient:a}=this.payload||{};if(!o)throw new Error(`${this.tagName}: React is not present in payload`);if(!s)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(o.createElement(this.getReactWrapper()))):s.render(o.createElement(this.getReactWrapper()),this.getReactRootElement()):this.forceUpdateReact?(r=this.forceUpdateReact)===null||r===void 0||r.call(this):(n=(i=this.refs.topReact).forceUpdateReact)===null||n===void 0||n.call(i)}invokeReactRendering(){let{React:e,ReactDOM:r}=this.payload||{},i=this.descendants.filter(n=>n.refs.parentReact==this&&n.payload).map((n,o)=>e.createElement(this.getReactWrapper(n),{key:this.tagName+"-"+o,slot:n.getAttribute("slot")}));return this.render({...this.props,children:i},this.payload)}getReactWrapper(e=this,r=e.tagName){let i=e.reactWrapper||(e.reactWrapper=n=>{if(e.render){let{React:o,ReactDOM:s}=e.payload||{},[a,l]=o.useReducer(d=>d+1,0);return e.forceUpdateReact=l,s.createPortal(o.createElement(o.Fragment,null,e.invokeReactRendering()),e.getReactRootElement())}else return e.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(e){this.overrides={...this.overrides,...e},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(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){typeof window!="undefined"&&!window.customElements.get(e)&&window.customElements.define(e,this)}};var M=class extends y{load(){return Promise.all([import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react"),import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react-dom")]).then(([e,r])=>({React:e,ReactDOM:r}))}render({},{React:e}){return e.createElement(e.Fragment,null)}},Z=class extends M{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))}};Z.observedAttributes=["counter"];function C(t){return C=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},C(t)}function Et(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function At(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function wt(t,e,r){return e&&At(t.prototype,e),r&&At(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Yt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&U(t,e)}function j(t){return j=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},j(t)}function U(t,e){return U=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,n){return i.__proto__=n,i},U(t,e)}function Ct(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function B(t,e,r){return Ct()?B=Reflect.construct.bind():B=function(n,o,s){var a=[null];a.push.apply(a,o);var l=Function.bind.apply(n,a),d=new l;return s&&U(d,s.prototype),d},B.apply(null,arguments)}function Qt(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function ut(t){var e=typeof Map=="function"?new Map:void 0;return ut=function(i){if(i===null||!Qt(i))return i;if(typeof i!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(i))return e.get(i);e.set(i,n)}function n(){return B(i,arguments,j(this).constructor)}return n.prototype=Object.create(i.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),U(n,i)},ut(t)}function Xt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Zt(t,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Xt(t)}function te(t){var e=Ct();return function(){var i=j(t),n;if(e){var o=j(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return Zt(this,n)}}function ee(t){return re(t)||ie(t)||xt(t)||ne()}function re(t){if(Array.isArray(t))return dt(t)}function ie(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function xt(t,e){if(t){if(typeof t=="string")return dt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return dt(t,e)}}function dt(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,i=new Array(e);r<e;r++)i[r]=t[r];return i}function ne(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1
+ var ct=Object.defineProperty;var Vt=Object.getOwnPropertyDescriptor;var Ht=Object.getOwnPropertyNames;var zt=Object.prototype.hasOwnProperty;var qt=(t,e)=>{for(var r in e)ct(t,r,{get:e[r],enumerable:!0})},Jt=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Ht(e))!zt.call(t,n)&&n!==r&&ct(t,n,{get:()=>e[n],enumerable:!(i=Vt(e,n))||i.enumerable});return t};var Kt=t=>Jt(ct({},"__esModule",{value:!0}),t);var fe={};qt(fe,{Base:()=>b,Component:()=>z,FEAASBase:()=>b,FEAASComponent:()=>z,FEAASComponentsProps:()=>Mt,FEAASContext:()=>G,FEAASContextProps:()=>jt,FEAASEditor:()=>J,FEAASEditorProps:()=>It,FEAASLoader:()=>q,FEAASLoaderProps:()=>Nt,FEAASPicker:()=>K,FEAASPickerProps:()=>Bt,FEAASStylesheet:()=>nt,FEAASStylesheetProps:()=>Lt,JSONPath:()=>f,Loader:()=>q,MyComponent:()=>Z,Stylesheet:()=>nt,autoloadScripts:()=>Dt,cleanCollectionBit:()=>kt,fetchAndRevalidate:()=>pt,fetchAndValidate:()=>F,getFramePosition:()=>$t,invalidateRequest:()=>tt,loadScript:()=>it,normalizeCollectionScope:()=>_t,observeDOMElement:()=>Pt,queryScopes:()=>yt,refetchAndValidate:()=>W,renderComponent:()=>pe,renderComponentElement:()=>ue,renderComponentPromise:()=>Tt,renderDOMContent:()=>V,renderDOMElement:()=>P,renderStylesheet:()=>he,renderStylesheetPromise:()=>Ot,serializeCH1RichText:()=>H,setDOMAttribute:()=>N});module.exports=Kt(fe);var Gt=typeof HTMLElement=="undefined"?class{}:HTMLElement,b=class extends Gt{getProps(e){return{}}constructor(){super(),this.connected=!1,this.refs={},this.descendants=[],this.onLoad=e=>{e!=null&&(this.payload=e,this.update())},this.addEventListener("feaasConnected",this),this.addEventListener("feaasDisconnected",this)}getRoot(){return this}attributeChangedCallback(e,r,i){this.set()}connectedCallback(){this.initialize()}initialize(){let e=this.getParent();if(!(e&&!e.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(e=!0){for(var r=this;r=r.parentElement||(r.parentNode instanceof ShadowRoot?r.parentNode.host:null);)if(!e||r.tagName.startsWith("FEAAS-"))return r}getElements(e=this.getRoot(),r=!0){return Array.from(e.querySelectorAll("*")).map(i=>[!r||i.tagName.startsWith("FEAAS-")?i:null,i.shadowRoot?this.getElements(i.shadowRoot,r):null]).flat().filter(Boolean)}disconnectedCallback(){this.connected&&(console.log("FEAAS: Disconnected",this),this.dispatchEvent(new Event("feaasDisconnected",{bubbles:!0,composed:!0})),this.connected=null)}handleEvent(e){let r=e.composedPath()[0];switch(e.type){case"feaasConnected":r!=this&&this.nestedCallback(r);break;case"feaasDisconnected":r!=this&&this.unnestedCallback(r);break}}unnestedCallback(e){let r=this.descendants.indexOf(e);r!=-1&&(console.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),console.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}async reify(){this.payload!==void 0?this.update():this.isReadyToLoad()&&(this.payload=null,this.load().then(this.onLoad))}load(){return Promise.resolve(null)}update(e=!1){var r,i,n;if(console.log("FEAAS: React",this.tagName,this.payload),this.payload==null)return;let{React:o,ReactDOM:s,ReactDOMClient:a}=this.payload||{};if(!o)throw new Error(`${this.tagName}: React is not present in payload`);if(!s)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(o.createElement(this.getReactWrapper()))):s.render(o.createElement(this.getReactWrapper()),this.getReactRootElement()):this.forceUpdateReact?(r=this.forceUpdateReact)===null||r===void 0||r.call(this):(n=(i=this.refs.topReact).forceUpdateReact)===null||n===void 0||n.call(i)}invokeReactRendering(){let{React:e,ReactDOM:r}=this.payload||{},i=this.descendants.filter(n=>n.refs.parentReact==this&&n.payload).map((n,o)=>e.createElement(this.getReactWrapper(n),{key:n.tagName+"-"+n.getUID(),slot:n.getAttribute("slot")}));return this.render({...this.props,children:i},this.payload)}getReactWrapper(e=this,r=e.tagName){let i=e.reactWrapper||(e.reactWrapper=n=>{if(e.render){let{React:o,ReactDOM:s}=e.payload||{},[a,l]=o.useReducer(d=>d+1,0);return e.forceUpdateReact=l,s.createPortal(o.createElement(o.Fragment,null,e.invokeReactRendering()),e.getReactRootElement())}else return e.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(e){this.overrides={...this.overrides,...e},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(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){typeof window!="undefined"&&!window.customElements.get(e)&&window.customElements.define(e,this)}};var M=class extends b{load(){return Promise.all([import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react"),import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react-dom")]).then(([e,r])=>({React:e,ReactDOM:r}))}render({},{React:e}){return e.createElement(e.Fragment,null)}},Z=class extends M{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))}};Z.observedAttributes=["counter"];function C(t){return C=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},C(t)}function Et(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function At(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function wt(t,e,r){return e&&At(t.prototype,e),r&&At(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Yt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&U(t,e)}function j(t){return j=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},j(t)}function U(t,e){return U=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,n){return i.__proto__=n,i},U(t,e)}function Ct(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function B(t,e,r){return Ct()?B=Reflect.construct.bind():B=function(n,o,s){var a=[null];a.push.apply(a,o);var l=Function.bind.apply(n,a),d=new l;return s&&U(d,s.prototype),d},B.apply(null,arguments)}function Qt(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function ut(t){var e=typeof Map=="function"?new Map:void 0;return ut=function(i){if(i===null||!Qt(i))return i;if(typeof i!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(i))return e.get(i);e.set(i,n)}function n(){return B(i,arguments,j(this).constructor)}return n.prototype=Object.create(i.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),U(n,i)},ut(t)}function Xt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Zt(t,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Xt(t)}function te(t){var e=Ct();return function(){var i=j(t),n;if(e){var o=j(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return Zt(this,n)}}function ee(t){return re(t)||ie(t)||xt(t)||ne()}function re(t){if(Array.isArray(t))return dt(t)}function ie(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function xt(t,e){if(t){if(typeof t=="string")return dt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return dt(t,e)}}function dt(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,i=new Array(e);r<e;r++)i[r]=t[r];return i}function ne(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function oe(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=xt(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var i=0,n=function(){};return{s:n,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
3
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){r=r.call(t)},n:function(){var l=r.next();return o=l.done,l},e:function(l){s=!0,a=l},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw a}}}}var m=Object.prototype.hasOwnProperty;function k(t,e){return t=t.slice(),t.push(e),t}function ht(t,e){return e=e.slice(),e.unshift(t),e}var se=function(t){Yt(r,t);var e=te(r);function r(i){var n;return Et(this,r),n=e.call(this,'JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),n.avoidNew=!0,n.value=i,n.name="NewError",n}return wt(r)}(ut(Error));function f(t,e,r,i,n){if(!(this instanceof f))try{return new f(t,e,r,i,n)}catch(l){if(!l.avoidNew)throw l;return l.value}typeof t=="string"&&(n=i,i=r,r=e,e=t,t=null);var o=t&&C(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=m.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){var s={path:o?t.path:e};o?"json"in t&&(s.json=t.json):s.json=r;var a=this.evaluate(s);if(!a||C(a)!=="object")throw new se(a);return a}}f.prototype.evaluate=function(t,e,r,i){var n=this,o=this.parent,s=this.parentProperty,a=this.flatten,l=this.wrap;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&&C(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(!m.call(t,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');var d=t;e=d.json,a=m.call(t,"flatten")?t.flatten:a,this.currResultType=m.call(t,"resultType")?t.resultType:this.currResultType,this.currSandbox=m.call(t,"sandbox")?t.sandbox:this.currSandbox,l=m.call(t,"wrap")?t.wrap:l,this.currPreventEval=m.call(t,"preventEval")?t.preventEval:this.currPreventEval,r=m.call(t,"callback")?t.callback:r,this.currOtherTypeCallback=m.call(t,"otherTypeCallback")?t.otherTypeCallback:this.currOtherTypeCallback,o=m.call(t,"parent")?t.parent:o,s=m.call(t,"parentProperty")?t.parentProperty:s,t=t.path}if(o=o||null,s=s||null,Array.isArray(t)&&(t=f.toPathString(t)),!(!t&&t!==""||!e)){var c=f.toPathArray(t);c[0]==="$"&&c.length>1&&c.shift(),this._hasParentSelector=null;var u=this._trace(c,e,["$"],o,s,r).filter(function(p){return p&&!p.isParentSelector});return u.length?!l&&u.length===1&&!u[0].hasArrExpr?this._getPreferredOutput(u[0]):u.reduce(function(p,b){var x=n._getPreferredOutput(b);return a&&Array.isArray(x)?p=p.concat(x):p.push(x),p},[]):l?[]:void 0}};f.prototype._getPreferredOutput=function(t){var e=this.currResultType;switch(e){case"all":{var r=Array.isArray(t.path)?t.path:f.toPathArray(t.path);return t.pointer=f.toPointer(r),t.path=typeof t.path=="string"?t.path:f.toPathString(t.path),t}case"value":case"parent":case"parentProperty":return t[e];case"path":return f.toPathString(t[e]);case"pointer":return f.toPointer(t.path);default:throw new TypeError("Unknown result type")}};f.prototype._handleCallback=function(t,e,r){if(e){var i=this._getPreferredOutput(t);t.path=typeof t.path=="string"?t.path:f.toPathString(t.path),e(i,r,t)}};f.prototype._trace=function(t,e,r,i,n,o,s,a){var l=this,d;if(!t.length)return d={path:r,value:e,parent:i,parentProperty:n,hasArrExpr:s},this._handleCallback(d,o,"value"),d;var c=t[0],u=t.slice(1),p=[];function b(h){Array.isArray(h)?h.forEach(function(T){p.push(T)}):p.push(h)}if((typeof c!="string"||a)&&e&&m.call(e,c))b(this._trace(u,e[c],k(r,c),e,c,o,s));else if(c==="*")this._walk(e,function(h){b(l._trace(u,e[h],k(r,h),e,h,o,!0,!0))});else if(c==="..")b(this._trace(u,e,r,i,n,o,s)),this._walk(e,function(h){C(e[h])==="object"&&b(l._trace(t.slice(),e[h],k(r,h),e,h,o,!0))});else{if(c==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:u,isParentSelector:!0};if(c==="~")return d={path:k(r,c),value:n,parent:i,parentProperty:null},this._handleCallback(d,o,"property"),d;if(c==="$")b(this._trace(u,e,r,null,null,o,s));else if(/^(\x2D?[0-9]*):(\x2D?[0-9]*):?([0-9]*)$/.test(c))b(this._slice(c,u,e,r,i,n,o));else if(c.indexOf("?(")===0){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");var x=c.replace(/^\?\(((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?)\)$/,"$1");this._walk(e,function(h){l._eval(x,e[h],h,r,i,n)&&b(l._trace(u,e[h],k(r,h),e,h,o,!0))})}else if(c[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");b(this._trace(ht(this._eval(c,e,r[r.length-1],r.slice(0,-1),i,n),u),e,r,i,n,o,s))}else if(c[0]==="@"){var v=!1,D=c.slice(1,-2);switch(D){case"scalar":(!e||!["object","function"].includes(C(e)))&&(v=!0);break;case"boolean":case"string":case"undefined":case"function":C(e)===D&&(v=!0);break;case"integer":Number.isFinite(e)&&!(e%1)&&(v=!0);break;case"number":Number.isFinite(e)&&(v=!0);break;case"nonFinite":typeof e=="number"&&!Number.isFinite(e)&&(v=!0);break;case"object":e&&C(e)===D&&(v=!0);break;case"array":Array.isArray(e)&&(v=!0);break;case"other":v=this.currOtherTypeCallback(e,r,i,n);break;case"null":e===null&&(v=!0);break;default:throw new TypeError("Unknown value type "+D)}if(v)return d={path:r,value:e,parent:i,parentProperty:n},this._handleCallback(d,o,"value"),d}else if(c[0]==="`"&&e&&m.call(e,c.slice(1))){var A=c.slice(1);b(this._trace(u,e[A],k(r,A),e,A,o,s,!0))}else if(c.includes(",")){var Y=c.split(","),R=oe(Y),Q;try{for(R.s();!(Q=R.n()).done;){var gt=Q.value;b(this._trace(ht(gt,u),e,r,i,n,o,!0))}}catch(h){R.e(h)}finally{R.f()}}else!a&&e&&m.call(e,c)&&b(this._trace(u,e[c],k(r,c),e,c,o,s,!0))}if(this._hasParentSelector)for(var S=0;S<p.length;S++){var O=p[S];if(O&&O.isParentSelector){var _=this._trace(O.expr,e,O.path,i,n,o,s);if(Array.isArray(_)){p[S]=_[0];for(var ot=_.length,X=1;X<ot;X++)S++,p.splice(S,0,_[X])}else p[S]=_}}return p};f.prototype._walk=function(t,e){if(Array.isArray(t))for(var r=t.length,i=0;i<r;i++)e(i);else t&&C(t)==="object"&&Object.keys(t).forEach(function(n){e(n)})};f.prototype._slice=function(t,e,r,i,n,o,s){if(Array.isArray(r)){var a=r.length,l=t.split(":"),d=l[2]&&Number.parseInt(l[2])||1,c=l[0]&&Number.parseInt(l[0])||0,u=l[1]&&Number.parseInt(l[1])||a;c=c<0?Math.max(0,c+a):Math.min(a,c),u=u<0?Math.max(0,u+a):Math.min(a,u);for(var p=[],b=c;b<u;b+=d){var x=this._trace(ht(b,e),r,i,n,o,s,!0);x.forEach(function(v){p.push(v)})}return p}};f.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;var s=t.includes("@path");s&&(this.currSandbox._$_path=f.toPathString(i.concat([r])));var a="script:"+t;if(!f.cache[a]){var l=t.replace(/@parentProperty/g,"_$_parentProperty").replace(/@parent/g,"_$_parent").replace(/@property/g,"_$_property").replace(/@root/g,"_$_root").replace(/@([\t-\r \)\.\[\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF])/g,"_$_v$1");s&&(l=l.replace(/@path/g,"_$_path")),f.cache[a]=new this.vm.Script(l)}try{return f.cache[a].runInNewContext(this.currSandbox)}catch(d){throw new Error("jsonPath: "+d.message+": "+t)}};f.cache={};f.toPathString=function(t){for(var e=t,r=e.length,i="$",n=1;n<r;n++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(e[n])||(i+=/^[\*0-9]+$/.test(e[n])?"["+e[n]+"]":"['"+e[n]+"']");return i};f.toPointer=function(t){for(var e=t,r=e.length,i="",n=1;n<r;n++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(e[n])||(i+="/"+e[n].toString().replace(/~/g,"~0").replace(/\//g,"~1"));return i};f.toPathArray=function(t){var e=f.cache;if(e[t])return e[t].concat();var r=[],i=t.replace(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/g,";$&;").replace(/['\[](\??\((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\))['\]]/g,function(o,s){return"[#"+(r.push(s)-1)+"]"}).replace(/\[["']((?:(?!['\]])[\s\S])*)["']\]/g,function(o,s){return"['"+s.replace(/\./g,"%@%").replace(/~/g,"%%@@%%")+"']"}).replace(/~/g,";~;").replace(/["']?\.["']?(?!(?:(?!\[)[\s\S])*\])|\[["']?/g,";").replace(/%@%/g,".").replace(/%%@@%%/g,"~").replace(/(?:;)?(\^+)(?:;)?/g,function(o,s){return";"+s.split("").join(";")+";"}).replace(/;;;|;;/g,";..;").replace(/;$|'?\]|'$/g,""),n=i.split(";").map(function(o){var s=o.match(/#([0-9]+)/);return!s||!s[1]?o:r[s[1]]});return e[t]=n,e[t].concat()};var ae=function(e,r,i){for(var n=e.length,o=0;o<n;o++){var s=e[o];i(s)&&r.push(e.splice(o--,1)[0])}},le=function(){function t(e){Et(this,t),this.code=e}return wt(t,[{key:"runInNewContext",value:function(r){var i=this.code,n=Object.keys(r),o=[];ae(n,o,function(c){return typeof r[c]=="function"});var s=n.map(function(c,u){return r[c]}),a=o.reduce(function(c,u){var p=r[u].toString();return/function/.test(p)||(p="function "+p),"var "+u+"="+p+";"+c},"");i=a+i,!/(["'])use strict\1/.test(i)&&!n.includes("arguments")&&(i="var arguments = undefined;"+i),i=i.replace(/;[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*$/,"");var l=i.lastIndexOf(";"),d=l>-1?i.slice(0,l+1)+" return "+i.slice(l+1):" return "+i;return B(Function,n.concat([d])).apply(void 0,ee(s))}}]),t}();f.prototype.vm={Script:le};async function pt(t,e,r,i){return F({url:t,options:e,validator:r,callback:i}).then(W).then(n=>n.response)}async function F({url:t,options:e,validator:r,callback:i},n="initial"){let o=new Date;console.log("fetch",n,t);let s=await fetch(t,e);if(!s.ok)throw new Error("Fetch failed");if((r==null?void 0:r(s))===!1)throw new Error("Response is not valid");let a=new Date(s.headers.get("date"))<o;return i==null||i(s,n),{url:t,options:e,isCached:a,response:s,validator:r}}async function W(t){let{url:e,isCached:r,options:i,validator:n,response:o,callback:s}=t;if(r){let{response:a}=await F({url:e+"?"+Math.random(),options:{...i,method:"HEAD",cache:"no-cache"},validator:n},"check");if(a.headers.get("last-modified")!=o.headers.get("last-modified"))return tt(t)}return t}async function tt(t){let{url:e,options:r,validator:i,callback:n}=t;return F({url:e,options:{...r,cache:"reload"},validator:i,callback:n},"updated")}function St({cdn:t="https://feaascomponentsapidev.blob.core.windows.net",hostname:e,library:r,component:i,version:n,revision:o="published"}){return`${t||e}/components/${r}/${i}/${n}/${o}.html`}function ce({cdn:t="https://feaascomponentsapidev.blob.core.windows.net",hostname:e,library:r,revision:i="published"}){return`${t||e}/styles/${r}/${i}.css`}async function et(t,e){let r=s=>s.headers.get("x-ms-meta-versionDeletedAt")==null,i=s=>{s.text().then(e)},n=await Promise.all([t.instance&&F({options:{headers:{Accept:"text/html"}},url:St({...t,version:t.instance}),validator:r}).catch(s=>s),F({url:St(t),validator:r}).catch(s=>s)]),o=n.find(s=>s&&"isCached"in s&&s);if(!o||o instanceof Error)throw n.find(a=>a&&a instanceof Error)||new Error("Can not fetch component");return n[0]==o&&console.log("Using fork!",n),i(o.response),W({...o,callback:i}).catch(s=>{if(n[0]==o&&(tt({...o,callback:null,validator:null}),console.log("Fork was deleted"),!(n[1]instanceof Error)))return i(n[1].response),W({...n[1],callback:i});throw s})}async function rt(t,e){return pt(ce(t),{headers:{Accept:"text/css"}},r=>r.headers.get("x-ms-meta-deletedAt")==null,r=>{r.text().then(e)})}function ue(t,e){let r=document.createElement("div");r.innerHTML=t;let i=document.createDocumentFragment();for(;r.firstChild;)i.appendChild(r.firstChild);return P(i,e),r}function _t(t){return t.replace(/(\[[^\]\[]+\]|\.\*)$/g,"")}function kt(t){return _t(t)+".*"}function Ft(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 de(t,e,r){let i=t.getAttribute("data-path-scope");if(i==null)return;var n=Ft(t);if(n!=0)return;let o=t.parentElement;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 bt(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=f({path:n,json:i});return Array.isArray(s)&&(s==null?void 0:s.length)==0&&(s=[n.replace(/^.*?\./,"_."),n.replace(/^.*?\./,""),n.replace(/^([^.]+).*?\.\$\./,"$1."),n.replace(/^.*?\.\$\./,"_."),n.replace(/^.*?\.\$\./,""),n.replace(/^[^.]+$/,"_")].filter((a,l,d)=>d.indexOf(a)===l).reduce((a,l)=>a.length>0?a:f({path:l,json:i}),[])),r&&Array.isArray(s)?s[0]:s}function N(t,e,r,i){var n;if(t){var o=t;(r==null?void 0:r.type)=="doc"&&Array.isArray(r.content)&&(r=H(r)),i!=null&&i.processValue&&(r=i==null?void 0:i.processValue(t,e,r));var s=e.replace("data-path-","");if(e=="data-path-src")o=t.tagName=="IMG"?t:t.querySelector("img, video");else if(e=="data-path-href")o=t.querySelector("a")||t.closest("a");else if(e=="data-path-alt")o=t.querySelector("img, picture");else if(e=="data-path-hidden")r=r?null:!0;else if(e=="data-path"||e=="data-embed-html"||e=="html")s="innerHTML";else if(e=="data-embed-src")it(t,r);else if(e=="data-path-attributes"){let u=((n=t.getAttribute("data-attributes-keys"))===null||n===void 0?void 0:n.split(",").filter(Boolean))||[];if(!Array.isArray(r))for(var a in r){var l=r[a];N(t,a,typeof l=="object"&&l?JSON.stringify(l):l,i)}for(var d=0;d<u.length;d++)(r==null||!(u[d]in r))&&N(t,u[d],null,i);N(t,"data-attributes-keys",Object.keys(r||{}).join(","));return}if(typeof r=="boolean"&&(r=r?"":null),!!o){var c=String(t.getAttribute("data-path-placeholder")||o[s]);r!=null?s=="innerHTML"?o.innerHTML!=r&&(o.innerHTML=r):o.getAttribute(s)!=r&&o.setAttribute(s,r):s=="innerHTML"?o.innerHTML=c:o.removeAttribute(s)}}}function Pt(t){let e=new t.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(i=>{let n=i.target,o=n.getAttribute("data-embed-src");o&&it(n,o),i.addedNodes&&i.addedNodes.forEach(s=>{s.nodeType==1&&Dt(s,!1)})})});return e.observe(t,{attributes:!0,subtree:!0,childList:!0}),e}function Dt(t,e=!0){let r=t.querySelectorAll("[data-embed-src]");for(var i=0;i<r.length;i++){let n=r[i];it(n,n.getAttribute("data-embed-src"))}if(e)return Pt(t)}function it(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.type="module",o.src=e,r.appendChild(o);break}}var Rt=["data-attributes-keys","data-path-attributes","data-path-scope"];function P(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 d=a.getAttribute("data-path-scope");if(d){let u=Ft(a),p=bt(e,d,!1)||[];u==0&&de(a,((o=r==null?void 0:r.shouldRepeat)===null||o===void 0?void 0:o.call(r,a,p))===!1?1:p.length,r),e={...e,[kt(d)]:p[u]}}let c=Array.prototype.slice.call(a.attributes).sort((u,p)=>Rt.indexOf(u.name)-Rt.indexOf(p.name));for(var l=0;l<c.length;l++){let{name:u,value:p}=c[l];u.startsWith("data-path")&&u!="data-path-scope"&&N(a,u,bt(e,p,!0),r),u=="data-embed-src"&&N(a,u,a.getAttribute(u),r)}}for(var l=0;l<a.children.length;l++)P(a.children[l],e,r,!0);return i||(s=r==null?void 0:r.onRender)===null||s===void 0||s.call(r,a,e),a}function V(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(let a of t.children)a.className=a.className.replace(/(\s|^)-theme--[^\s]+\s*/g,"$1");return P(t,r,i)}function he(t,e){return Ot(t,e||(e=document.createElement("style"))),e}function Ot(t,e){return e||(e=document.createElement("style")),rt(t,r=>{e.textContent=r}).then(()=>e)}function pe(t,e){return Tt(t,e||(e=document.createElement("div"))),e}async function Tt(t,e){return e||(e=document.createElement("div")),e.childNodes.length?P(e,t.data,t):"template"in t?V(e,t.template,t.data,t):et(t,r=>V(e,r,t.data,t)).then(()=>e)}function ft(t,e={},r){return r?`<${r}${Object.entries(e).map(([i,n])=>n!=null&&` ${i}="${n}"`).filter(Boolean).join("")}>${H(t)}</${r}>`.replace(/^<([a-z0-9][^>]*)><\/[^>]+>$/,"<$1 />"):H(t)}function H(t){var e;if(Array.isArray(t))return t.map(H).join(`
4
- `).trim();if(typeof t=="string")return t;if(t==null)return"";switch(t.type){case"heading":let{level:r,...i}=t.attrs;return ft(t.content,i,"h"+r);case"text":return(t.marks||[]).reduce((n,o)=>ft(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 ft(t.content||t.text,t.attrs,{bulletList:"ul",orderedList:"ol",listItem:"li",horizontalRule:"hr",paragraph:"p",codeBlock:"code",blockquote:"blockquote"}[t.type])}}function Mt(t=this){let e,r=t.getAttribute("data");if(r!=null)try{e=typeof r=="string"?JSON.parse(r):{}}catch(i){}return{data:e!=null?e:{},library:t.getAttribute("library"),component:t.getAttribute("component"),version:t.getAttribute("version"),revision:t.getAttribute("revision"),hostname:t.getAttribute("hostname"),cdn:t.getContextAttribute("cdn"),template:t.getAttribute("template"),instance:t.getAttribute("instance"),editable:t.getAttribute("editable")!=null,suspended:t.getAttribute("suspended")!=null}}var z=class extends y{constructor(){super(),this.addEventListener("click",()=>{this.props.editable&&this.edit()})}setData(e){this.set({data:e})}getProps(){return Mt(this)}attributeChangedCallback(e,r,i){r!==i&&(this.payload=void 0,this.needsRefresh=!0,super.attributeChangedCallback(e,r,i))}getEditor(){var e;return(e=document.querySelector("feaas-context"))===null||e===void 0?void 0:e.refs.editor}edit(){let e=this.getEditor();if(e!=null&&e.setTarget(this))return e.open(),!0}getOriginal(){let e=this.getAttribute("data-path-scope");if(e){for(var r=this;(r=r.previousElementSibling)&&r.getAttribute("data-path-scope")==e;)var i=r;return i}}isReadyToLoad(){return super.isReadyToLoad()&&this.props.library!=null&&this.props.component!=null&&this.props.version!=null}async load(){if(!this.getOriginal())try{et(this.props,this.onLoad)}catch(e){console.error(`FEAAS: Could not fetch component: ${this.props.component}/${this.props.version}/${this.props.revision}`)}}update(){if(Array.from(this.children).filter(e=>e.tagName!="BR").length>0&&!this.needsRefresh)P(this,this.props.data);else{if(this.needsRefresh=!0,this.getOriginal())return;V(this,this.payload,this.props.data)}}};z.observedAttributes=["library","component","version","revision","hostname","cdn","template","data","instance","editable"];z.register("feaas-component");function Nt(t=this){return{opacity:t!=null&&t.getAttribute("opacity")?parseFloat(t==null?void 0:t.getAttribute("opacity")):1,hidden:(t==null?void 0:t.getAttribute("hidden"))!=null}}var q=class extends y{getProps(){return Nt(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
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){r=r.call(t)},n:function(){var l=r.next();return o=l.done,l},e:function(l){s=!0,a=l},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw a}}}}var m=Object.prototype.hasOwnProperty;function _(t,e){return t=t.slice(),t.push(e),t}function ht(t,e){return e=e.slice(),e.unshift(t),e}var se=function(t){Yt(r,t);var e=te(r);function r(i){var n;return Et(this,r),n=e.call(this,'JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),n.avoidNew=!0,n.value=i,n.name="NewError",n}return wt(r)}(ut(Error));function f(t,e,r,i,n){if(!(this instanceof f))try{return new f(t,e,r,i,n)}catch(l){if(!l.avoidNew)throw l;return l.value}typeof t=="string"&&(n=i,i=r,r=e,e=t,t=null);var o=t&&C(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=m.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){var s={path:o?t.path:e};o?"json"in t&&(s.json=t.json):s.json=r;var a=this.evaluate(s);if(!a||C(a)!=="object")throw new se(a);return a}}f.prototype.evaluate=function(t,e,r,i){var n=this,o=this.parent,s=this.parentProperty,a=this.flatten,l=this.wrap;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&&C(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(!m.call(t,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');var d=t;e=d.json,a=m.call(t,"flatten")?t.flatten:a,this.currResultType=m.call(t,"resultType")?t.resultType:this.currResultType,this.currSandbox=m.call(t,"sandbox")?t.sandbox:this.currSandbox,l=m.call(t,"wrap")?t.wrap:l,this.currPreventEval=m.call(t,"preventEval")?t.preventEval:this.currPreventEval,r=m.call(t,"callback")?t.callback:r,this.currOtherTypeCallback=m.call(t,"otherTypeCallback")?t.otherTypeCallback:this.currOtherTypeCallback,o=m.call(t,"parent")?t.parent:o,s=m.call(t,"parentProperty")?t.parentProperty:s,t=t.path}if(o=o||null,s=s||null,Array.isArray(t)&&(t=f.toPathString(t)),!(!t&&t!==""||!e)){var c=f.toPathArray(t);c[0]==="$"&&c.length>1&&c.shift(),this._hasParentSelector=null;var u=this._trace(c,e,["$"],o,s,r).filter(function(p){return p&&!p.isParentSelector});return u.length?!l&&u.length===1&&!u[0].hasArrExpr?this._getPreferredOutput(u[0]):u.reduce(function(p,y){var x=n._getPreferredOutput(y);return a&&Array.isArray(x)?p=p.concat(x):p.push(x),p},[]):l?[]:void 0}};f.prototype._getPreferredOutput=function(t){var e=this.currResultType;switch(e){case"all":{var r=Array.isArray(t.path)?t.path:f.toPathArray(t.path);return t.pointer=f.toPointer(r),t.path=typeof t.path=="string"?t.path:f.toPathString(t.path),t}case"value":case"parent":case"parentProperty":return t[e];case"path":return f.toPathString(t[e]);case"pointer":return f.toPointer(t.path);default:throw new TypeError("Unknown result type")}};f.prototype._handleCallback=function(t,e,r){if(e){var i=this._getPreferredOutput(t);t.path=typeof t.path=="string"?t.path:f.toPathString(t.path),e(i,r,t)}};f.prototype._trace=function(t,e,r,i,n,o,s,a){var l=this,d;if(!t.length)return d={path:r,value:e,parent:i,parentProperty:n,hasArrExpr:s},this._handleCallback(d,o,"value"),d;var c=t[0],u=t.slice(1),p=[];function y(h){Array.isArray(h)?h.forEach(function(T){p.push(T)}):p.push(h)}if((typeof c!="string"||a)&&e&&m.call(e,c))y(this._trace(u,e[c],_(r,c),e,c,o,s));else if(c==="*")this._walk(e,function(h){y(l._trace(u,e[h],_(r,h),e,h,o,!0,!0))});else if(c==="..")y(this._trace(u,e,r,i,n,o,s)),this._walk(e,function(h){C(e[h])==="object"&&y(l._trace(t.slice(),e[h],_(r,h),e,h,o,!0))});else{if(c==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:u,isParentSelector:!0};if(c==="~")return d={path:_(r,c),value:n,parent:i,parentProperty:null},this._handleCallback(d,o,"property"),d;if(c==="$")y(this._trace(u,e,r,null,null,o,s));else if(/^(\x2D?[0-9]*):(\x2D?[0-9]*):?([0-9]*)$/.test(c))y(this._slice(c,u,e,r,i,n,o));else if(c.indexOf("?(")===0){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");var x=c.replace(/^\?\(((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?)\)$/,"$1");this._walk(e,function(h){l._eval(x,e[h],h,r,i,n)&&y(l._trace(u,e[h],_(r,h),e,h,o,!0))})}else if(c[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");y(this._trace(ht(this._eval(c,e,r[r.length-1],r.slice(0,-1),i,n),u),e,r,i,n,o,s))}else if(c[0]==="@"){var v=!1,D=c.slice(1,-2);switch(D){case"scalar":(!e||!["object","function"].includes(C(e)))&&(v=!0);break;case"boolean":case"string":case"undefined":case"function":C(e)===D&&(v=!0);break;case"integer":Number.isFinite(e)&&!(e%1)&&(v=!0);break;case"number":Number.isFinite(e)&&(v=!0);break;case"nonFinite":typeof e=="number"&&!Number.isFinite(e)&&(v=!0);break;case"object":e&&C(e)===D&&(v=!0);break;case"array":Array.isArray(e)&&(v=!0);break;case"other":v=this.currOtherTypeCallback(e,r,i,n);break;case"null":e===null&&(v=!0);break;default:throw new TypeError("Unknown value type "+D)}if(v)return d={path:r,value:e,parent:i,parentProperty:n},this._handleCallback(d,o,"value"),d}else if(c[0]==="`"&&e&&m.call(e,c.slice(1))){var A=c.slice(1);y(this._trace(u,e[A],_(r,A),e,A,o,s,!0))}else if(c.includes(",")){var Y=c.split(","),R=oe(Y),Q;try{for(R.s();!(Q=R.n()).done;){var gt=Q.value;y(this._trace(ht(gt,u),e,r,i,n,o,!0))}}catch(h){R.e(h)}finally{R.f()}}else!a&&e&&m.call(e,c)&&y(this._trace(u,e[c],_(r,c),e,c,o,s,!0))}if(this._hasParentSelector)for(var S=0;S<p.length;S++){var O=p[S];if(O&&O.isParentSelector){var k=this._trace(O.expr,e,O.path,i,n,o,s);if(Array.isArray(k)){p[S]=k[0];for(var ot=k.length,X=1;X<ot;X++)S++,p.splice(S,0,k[X])}else p[S]=k}}return p};f.prototype._walk=function(t,e){if(Array.isArray(t))for(var r=t.length,i=0;i<r;i++)e(i);else t&&C(t)==="object"&&Object.keys(t).forEach(function(n){e(n)})};f.prototype._slice=function(t,e,r,i,n,o,s){if(Array.isArray(r)){var a=r.length,l=t.split(":"),d=l[2]&&Number.parseInt(l[2])||1,c=l[0]&&Number.parseInt(l[0])||0,u=l[1]&&Number.parseInt(l[1])||a;c=c<0?Math.max(0,c+a):Math.min(a,c),u=u<0?Math.max(0,u+a):Math.min(a,u);for(var p=[],y=c;y<u;y+=d){var x=this._trace(ht(y,e),r,i,n,o,s,!0);x.forEach(function(v){p.push(v)})}return p}};f.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;var s=t.includes("@path");s&&(this.currSandbox._$_path=f.toPathString(i.concat([r])));var a="script:"+t;if(!f.cache[a]){var l=t.replace(/@parentProperty/g,"_$_parentProperty").replace(/@parent/g,"_$_parent").replace(/@property/g,"_$_property").replace(/@root/g,"_$_root").replace(/@([\t-\r \)\.\[\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF])/g,"_$_v$1");s&&(l=l.replace(/@path/g,"_$_path")),f.cache[a]=new this.vm.Script(l)}try{return f.cache[a].runInNewContext(this.currSandbox)}catch(d){throw new Error("jsonPath: "+d.message+": "+t)}};f.cache={};f.toPathString=function(t){for(var e=t,r=e.length,i="$",n=1;n<r;n++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(e[n])||(i+=/^[\*0-9]+$/.test(e[n])?"["+e[n]+"]":"['"+e[n]+"']");return i};f.toPointer=function(t){for(var e=t,r=e.length,i="",n=1;n<r;n++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(e[n])||(i+="/"+e[n].toString().replace(/~/g,"~0").replace(/\//g,"~1"));return i};f.toPathArray=function(t){var e=f.cache;if(e[t])return e[t].concat();var r=[],i=t.replace(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/g,";$&;").replace(/['\[](\??\((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\))['\]]/g,function(o,s){return"[#"+(r.push(s)-1)+"]"}).replace(/\[["']((?:(?!['\]])[\s\S])*)["']\]/g,function(o,s){return"['"+s.replace(/\./g,"%@%").replace(/~/g,"%%@@%%")+"']"}).replace(/~/g,";~;").replace(/["']?\.["']?(?!(?:(?!\[)[\s\S])*\])|\[["']?/g,";").replace(/%@%/g,".").replace(/%%@@%%/g,"~").replace(/(?:;)?(\^+)(?:;)?/g,function(o,s){return";"+s.split("").join(";")+";"}).replace(/;;;|;;/g,";..;").replace(/;$|'?\]|'$/g,""),n=i.split(";").map(function(o){var s=o.match(/#([0-9]+)/);return!s||!s[1]?o:r[s[1]]});return e[t]=n,e[t].concat()};var ae=function(e,r,i){for(var n=e.length,o=0;o<n;o++){var s=e[o];i(s)&&r.push(e.splice(o--,1)[0])}},le=function(){function t(e){Et(this,t),this.code=e}return wt(t,[{key:"runInNewContext",value:function(r){var i=this.code,n=Object.keys(r),o=[];ae(n,o,function(c){return typeof r[c]=="function"});var s=n.map(function(c,u){return r[c]}),a=o.reduce(function(c,u){var p=r[u].toString();return/function/.test(p)||(p="function "+p),"var "+u+"="+p+";"+c},"");i=a+i,!/(["'])use strict\1/.test(i)&&!n.includes("arguments")&&(i="var arguments = undefined;"+i),i=i.replace(/;[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*$/,"");var l=i.lastIndexOf(";"),d=l>-1?i.slice(0,l+1)+" return "+i.slice(l+1):" return "+i;return B(Function,n.concat([d])).apply(void 0,ee(s))}}]),t}();f.prototype.vm={Script:le};async function pt(t,e,r,i){return F({url:t,options:e,validator:r,callback:i}).then(W).then(n=>n.response)}async function F({url:t,options:e,validator:r,callback:i},n="initial"){let o=new Date,s=await fetch(t,e);if(!s.ok)throw new Error("Fetch failed");if((r==null?void 0:r(s))===!1)throw new Error("Response is not valid");let a=new Date(s.headers.get("date"))<o;return i==null||i(s,n),{url:t,options:e,isCached:a,response:s,validator:r}}async function W(t){let{url:e,isCached:r,options:i,validator:n,response:o,callback:s}=t;if(r){let{response:a}=await F({url:e+"?"+Math.random(),options:{...i,method:"HEAD",cache:"no-cache"},validator:n},"check");if(a.headers.get("last-modified")!=o.headers.get("last-modified"))return tt(t)}return t}async function tt(t){let{url:e,options:r,validator:i,callback:n}=t;return F({url:e,options:{...r,cache:"reload"},validator:i,callback:n},"updated")}function St({cdn:t="https://feaascomponentsapidev.blob.core.windows.net",hostname:e,library:r,component:i,version:n,revision:o="published"}){return`${t||e}/components/${r}/${i}/${n}/${o}.html`}function ce({cdn:t="https://feaascomponentsapidev.blob.core.windows.net",hostname:e,library:r,revision:i="published"}){return`${t||e}/styles/${r}/${i}.css`}async function et(t,e){let r=s=>s.headers.get("x-ms-meta-versionDeletedAt")==null,i=s=>{s.text().then(e)},n=await Promise.all([t.instance&&F({options:{headers:{Accept:"text/html"}},url:St({...t,version:t.instance}),validator:r}).catch(s=>s),F({url:St(t),validator:r}).catch(s=>s)]),o=n.find(s=>s&&"isCached"in s&&s);if(!o||o instanceof Error)throw n.find(a=>a&&a instanceof Error)||new Error("Can not fetch component");return n[0]==o&&console.log("Using fork!",n),i(o.response),W({...o,callback:i}).catch(s=>{if(n[0]==o&&(tt({...o,callback:null,validator:null}),console.log("Fork was deleted"),!(n[1]instanceof Error)))return i(n[1].response),W({...n[1],callback:i});throw s})}async function rt(t,e){return pt(ce(t),{headers:{Accept:"text/css"}},r=>r.headers.get("x-ms-meta-deletedAt")==null,r=>{r.text().then(e)})}function ue(t,e){let r=document.createElement("div");r.innerHTML=t;let i=document.createDocumentFragment();for(;r.firstChild;)i.appendChild(r.firstChild);return P(i,e),r}function kt(t){return t.replace(/(\[[^\]\[]+\]|\.\*)$/g,"")}function _t(t){return kt(t)+".*"}function Ft(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 de(t,e,r){let i=t.getAttribute("data-path-scope");if(i==null)return;var n=Ft(t);if(n!=0)return;let o=t.parentElement;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 yt(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=f({path:n,json:i});return Array.isArray(s)&&(s==null?void 0:s.length)==0&&(s=[n.replace(/^.*?\./,"_."),n.replace(/^.*?\./,""),n.replace(/^([^.]+).*?\.\$\./,"$1."),n.replace(/^.*?\.\$\./,"_."),n.replace(/^.*?\.\$\./,""),n.replace(/^[^.]+$/,"_")].filter((a,l,d)=>d.indexOf(a)===l).reduce((a,l)=>a.length>0?a:f({path:l,json:i}),[])),r&&Array.isArray(s)?s[0]:s}function N(t,e,r,i){var n;if(t){var o=t;(r==null?void 0:r.type)=="doc"&&Array.isArray(r.content)&&(r=H(r)),i!=null&&i.processValue&&(r=i==null?void 0:i.processValue(t,e,r));var s=e.replace("data-path-","");if(e=="data-path-src")o=t.tagName=="IMG"?t:t.querySelector("img, video");else if(e=="data-path-href")o=t.querySelector("a")||t.closest("a");else if(e=="data-path-alt")o=t.querySelector("img, picture");else if(e=="data-path-hidden")r=r?null:!0;else if(e=="data-path"||e=="data-embed-html"||e=="html")s="innerHTML";else if(e=="data-embed-src")it(t,r);else if(e=="data-path-attributes"){let u=((n=t.getAttribute("data-attributes-keys"))===null||n===void 0?void 0:n.split(",").filter(Boolean))||[];if(!Array.isArray(r))for(var a in r){var l=r[a];N(t,a,typeof l=="object"&&l?JSON.stringify(l):l,i)}for(var d=0;d<u.length;d++)(r==null||!(u[d]in r))&&N(t,u[d],null,i);N(t,"data-attributes-keys",Object.keys(r||{}).join(","));return}if(typeof r=="boolean"&&(r=r?"":null),!!o){var c=String(t.getAttribute("data-path-placeholder")||o[s]);r!=null?s=="innerHTML"?o.innerHTML!=r&&(o.innerHTML=r):o.getAttribute(s)!=r&&o.setAttribute(s,r):s=="innerHTML"?o.innerHTML=c:o.removeAttribute(s)}}}function Pt(t){let e=new t.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(i=>{let n=i.target,o=n.getAttribute("data-embed-src");o&&it(n,o),i.addedNodes&&i.addedNodes.forEach(s=>{s.nodeType==1&&Dt(s,!1)})})});return e.observe(t,{attributes:!0,subtree:!0,childList:!0}),e}function Dt(t,e=!0){let r=t.querySelectorAll("[data-embed-src]");for(var i=0;i<r.length;i++){let n=r[i];it(n,n.getAttribute("data-embed-src"))}if(e)return Pt(t)}function it(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.type="module",o.src=e,r.appendChild(o);break}}var Rt=["data-attributes-keys","data-path-attributes","data-path-scope"];function P(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 d=a.getAttribute("data-path-scope");if(d){let u=Ft(a),p=yt(e,d,!1)||[];u==0&&de(a,((o=r==null?void 0:r.shouldRepeat)===null||o===void 0?void 0:o.call(r,a,p))===!1?1:p.length,r),e={...e,[_t(d)]:p[u]}}let c=Array.prototype.slice.call(a.attributes).sort((u,p)=>Rt.indexOf(u.name)-Rt.indexOf(p.name));for(var l=0;l<c.length;l++){let{name:u,value:p}=c[l];u.startsWith("data-path")&&u!="data-path-scope"&&N(a,u,yt(e,p,!0),r),u=="data-embed-src"&&N(a,u,a.getAttribute(u),r)}}for(var l=0;l<a.children.length;l++)P(a.children[l],e,r,!0);return i||(s=r==null?void 0:r.onRender)===null||s===void 0||s.call(r,a,e),a}function V(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(let a of t.children)a.className=a.className.replace(/(\s|^)-theme--[^\s]+\s*/g,"$1");return P(t,r,i)}function he(t,e){return Ot(t,e||(e=document.createElement("style"))),e}function Ot(t,e){return e||(e=document.createElement("style")),rt(t,r=>{e.textContent=r}).then(()=>e)}function pe(t,e){return Tt(t,e||(e=document.createElement("div"))),e}async function Tt(t,e){return e||(e=document.createElement("div")),e.childNodes.length?P(e,t.data,t):"template"in t?V(e,t.template,t.data,t):et(t,r=>V(e,r,t.data,t)).then(()=>e)}function ft(t,e={},r){return r?`<${r}${Object.entries(e).map(([i,n])=>n!=null&&` ${i}="${n}"`).filter(Boolean).join("")}>${H(t)}</${r}>`.replace(/^<([a-z0-9][^>]*)><\/[^>]+>$/,"<$1 />"):H(t)}function H(t){var e;if(Array.isArray(t))return t.map(H).join(`
4
+ `).trim();if(typeof t=="string")return t;if(t==null)return"";switch(t.type){case"heading":let{level:r,...i}=t.attrs;return ft(t.content,i,"h"+r);case"text":return(t.marks||[]).reduce((n,o)=>ft(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 ft(t.content||t.text,t.attrs,{bulletList:"ul",orderedList:"ol",listItem:"li",horizontalRule:"hr",paragraph:"p",codeBlock:"code",blockquote:"blockquote"}[t.type])}}function Mt(t=this){let e,r=t.getAttribute("data");if(r!=null)try{e=typeof r=="string"?JSON.parse(r):{}}catch(i){}return{data:e!=null?e:{},library:t.getAttribute("library"),component:t.getAttribute("component"),version:t.getAttribute("version"),revision:t.getAttribute("revision"),hostname:t.getAttribute("hostname"),cdn:t.getContextAttribute("cdn"),template:t.getAttribute("template"),instance:t.getAttribute("instance"),editable:t.getAttribute("editable")!=null,suspended:t.getAttribute("suspended")!=null}}var z=class extends b{setData(e){this.set({data:e})}getProps(){return Mt(this)}attributeChangedCallback(e,r,i){r!==i&&(this.payload=void 0,this.needsRefresh=!0,super.attributeChangedCallback(e,r,i))}getEditor(){var e;return(e=document.querySelector("feaas-context"))===null||e===void 0?void 0:e.refs.editor}constructor(){super(),this.addEventListener("click",()=>{this.props.editable&&this.edit()})}edit(){let e=this.getEditor();if(e!=null&&e.setTarget(this))return e.open(),!0}getOriginal(){let e=this.getAttribute("data-path-scope");if(e){for(var r=this;(r=r.previousElementSibling)&&r.getAttribute("data-path-scope")==e;)var i=r;return i}}isReadyToLoad(){return super.isReadyToLoad()&&this.props.library!=null&&this.props.component!=null&&this.props.version!=null}async load(){if(!this.getOriginal())try{et(this.props,this.onLoad)}catch(e){console.error(`FEAAS: Could not fetch component: ${this.props.component}/${this.props.version}/${this.props.revision}`)}}update(){if(Array.from(this.children).filter(e=>e.tagName!="BR").length>0&&!this.needsRefresh)P(this,this.props.data);else{if(this.needsRefresh=!0,this.getOriginal())return;V(this,this.payload,this.props.data)}}};z.observedAttributes=["library","component","version","revision","hostname","cdn","template","data","instance","editable"];z.register("feaas-component");function Nt(t=this){return{opacity:t!=null&&t.getAttribute("opacity")?parseFloat(t==null?void 0:t.getAttribute("opacity")):1,hidden:(t==null?void 0:t.getAttribute("hidden"))!=null}}var q=class extends b{getProps(){return Nt(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=`
5
5
  #loader {
6
6
  position: absolute;
7
7
  top: 0;
@@ -65,5 +65,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
65
65
  style="animation: 1.5s linear 0s infinite normal none running loader-circular-track"
66
66
  ></circle>
67
67
  </svg>
68
- </div>`,this.getRoot().appendChild(this.stylesheet),this.getRoot().appendChild(this.loader)}update(){this.loader.style.opacity=String(this.props.opacity)}};q.observedAttributes=["hidden","opacity"];q.register("feaas-loader");function Lt(t=this){var e;return{library:t==null?void 0:t.getContextAttribute("library"),revision:(e=t==null?void 0:t.getAttribute("revision"))!==null&&e!==void 0?e:"published",cdn:(t==null?void 0:t.getContextAttribute("cdn"))||(t==null?void 0:t.getContextAttribute("hostname"))}}var nt=class extends y{getProps(){return Lt(this)}isReadyToLoad(){return this.props.library!=null&&this.props.revision!=null&&this.props.cdn!=null}async load(){rt(this.props,this.onLoad)}update(){this.stylesheet||(this.stylesheet=document.createElement("style"),this.appendChild(this.stylesheet)),this.stylesheet.textContent=this.payload}};nt.register("feaas-stylesheet");var yt;typeof window!="undefined"&&(window.FEAASElement=M,(yt=window.FEAASLoading)!==null&&yt!==void 0||(window.FEAASLoading=Promise.resolve()));function $t(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 It(t=this){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 J=class extends y{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=(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=$t(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 It(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(){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:c,EditorUIMode:u,React:{useEffect:p,useMemo:b,useState:x,useContext:v},Chakra:{HStack:D,Box:A,Button:Y,MenuItem:R},Chrome:Q,ReactDOM:gt,useSDK:S,useSlots:O,useModelObserver:_,ConfirmationContext:ot,VersionContext:X}){if(!this.payload)return;let{React:h}=this.payload,{sdk:T}=S(),[g,vt]=x(),{setConfirm:st}=v(ot),L=n||i,Ut=T.library;g&&(this.component=g),p(()=>{if(this.props.hidden)return;let w=Ut.components.getItem(r).clone();return w.versions.search({ids:[i,n].filter(Boolean),componentIds:[r]}).then(at=>{w.versions.setItems(at);let E=w.findVersion(n,["staged","published"]),I=w.findVersion(i,["staged","published"]);if(E)E.deletedAt?(E.getDraft().changeAndNotify(I.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(I)){console.error("FEAAS Editor: Forking");let lt=I.fork(n).id;this.setAttribute("instance",lt)}else console.error("FEAAS Editor: Regular");vt(w)}),()=>{this.closing=setTimeout(()=>{this.closing=null,this.cleanup(),vt(null)},400)}},[i,this.props.hidden]);let mt=_(g==null?void 0:g.versions,[]).filter(w=>w.id==L),$=mt[0];$&&!this.props.hidden&&(this.version=$),p(()=>(this.unfork=()=>{st({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=g.findVersion(i,["staged","published"]);g.findVersion(n).unstage().unpublish().changeAndNotify(w.toProperties()),g.saveVersions(!1),this.setVersionContext({needsWrite:!0}),this.removeAttribute("forked"),requestAnimationFrame(this.onClose)}})},this.discard=()=>{this.props.changed&&(g.findVersion(L).revert(),g.saveVersions(!1),this.setVersionContext({needsWrite:!0}))},this.close=()=>{st({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=()=>{st({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:()=>{g.findVersion(L).commitData({view:this.editorContext.editor.getData({rootName:L}),model:""}).stage().publish(),this.removeAttribute("changed"),this.setAttribute("forked",L),g.saveVersions(!1)}})},()=>{delete this.unfork,delete this.discard,delete this.save,delete this.editorContext,delete this.versionContext,delete this.setEditorContext,delete this.setVersionContext}),[g]);let Wt=b(()=>this.target,[g]);return b(()=>g&&O(e,({picker:w,children:at})=>h.createElement(A,{ref:E=>{this.chrome=E?{positionable:E,wrapper:E.querySelector(".editor-chrome"),absolute:this.querySelector(".ui.overlays")}:null}},h.createElement(A,{className:"editor-wrapper",position:"absolute",left:0,top:0},h.createElement(o,{datasources:T.datasources,sdk:T,library:T.library,component:g,versions:mt,context:{isAutosaveEnabled:!1,onChromeMeasure:this.onMeasure,onChromeBeforeMeasure:this.onBeforeMeasure,onChromeMeasureElement:this.onChromeMeasureElement,onChromePosition:this.onPosition,onContentChange:this.onContentChange}},{exports:this.onEditorStateChange,after:at,chrome:({editor:E})=>E&&h.createElement(Q,null),children:({isArchivedDisplayed:E,editor:I,status:lt})=>h.createElement(A,{position:"absolute",left:0,top:0,className:"editor-chrome",p:4,boxShadow:"2xl",pointerEvents:"none",opacity:0,transition:"opacity 0.3s"},h.createElement(A,{left:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),h.createElement(A,{right:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),h.createElement(A,{top:0,height:"16",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),h.createElement(A,{bottom:0,height:"4",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),$&&h.createElement(l,{version:$,node:Wt,ignoreBreakpoints:!0,deps:[this.props.forked,this.props.changed]},{exports:this.onVersionStateChange,left:h.createElement(D,{justifyContent:"space-between"},h.createElement(c,{size:"sm",editor:lt=="ready"?I:null}),h.createElement(u,{size:"sm"})),middle:(be,ye)=>[!1],right:h.createElement(h.Fragment,null,h.createElement(Y,{variant:"secondary",size:"sm",onClick:this.close},"Close"),h.createElement(Y,{variant:"primary",size:"sm",onClick:this.save,isDisabled:!this.props.changed},this.props.changed?this.props.forked?"Save":"Save customization":"Up to date"),h.createElement(d,{isDisabled:!this.props.forked&&!this.props.changed},h.createElement(R,{onClick:this.unfork,isDisabled:!this.props.forked},"Unfork"),h.createElement(R,{onClick:this.discard,isDisabled:!this.props.changed},"Discard")))}))})))),[$,this.props.forked,this.props.changed])}isReadyToLoad(){return this.props.component!=null&&this.props.version!=null&&!this.props.hidden}};J.observedAttributes=["library","component","version","revision","hidden","state","changed","forked"];J.register("feaas-editor");function Bt(t=this){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"),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,onContextAttributeSet:void 0}}var K=class extends y{getProps(){return Bt(this)}load(){return import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}render({placeholder:e,context:r,mode:i,children:n,variant:o},{Picker:s,React:a,ReactDOM:l}){return a.createElement(s,{placeholder:e,mode:i||void 0,onClose:this.props.onClose,onContextAttributeSet:this.props.onContextAttributeSet,context:r,variant:o},n)}};K.observedAttributes=["library","mode","frontend","src","hidden","variant"];K.register("feaas-picker");function jt(t=this){var e,r,i,n;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",frontend:(r=t==null?void 0:t.getAttribute("frontend"))!==null&&r!==void 0?r:"https://components.sitecoreclud.io",backend:(i=t==null?void 0:t.getAttribute("backend"))!==null&&i!==void 0?i:"https://components-api.sitecoreclud.io",cdn:(n=t==null?void 0:t.getAttribute("cdn"))!==null&&n!==void 0?n:"https://feaascompontsapiprod.blob.core.windows.net",getToken:null}}var G=class extends y{constructor(){super(...arguments),this.onStatusChange=e=>{e=="ready"&&this.dispatchEvent(new Event("feaasReady",{bubbles:!0,composed:!0}))}}getProps(){return jt(this)}load(){return import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}getTheme(e){return e}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(e=>{this.getRoot().appendChild(e)}),super.connectedCallback()}render({children:e,library:r},{AppContext:i,Chakra:{Button:n,Tooltip:o},React:s}){let a={containerRef:{current:this.getRoot()}};return o.defaultProps={hasArrow:!0,placement:"top",portalProps:a},s.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}}},e)}};G.observedAttributes=["library","component","version","revision","hostname","template"];G.register("feaas-context");
68
+ </div>`,this.getRoot().appendChild(this.stylesheet),this.getRoot().appendChild(this.loader)}update(){this.loader.style.opacity=String(this.props.opacity)}};q.observedAttributes=["hidden","opacity"];q.register("feaas-loader");function Lt(t=this){var e;return{library:t==null?void 0:t.getContextAttribute("library"),revision:(e=t==null?void 0:t.getAttribute("revision"))!==null&&e!==void 0?e:"published",cdn:(t==null?void 0:t.getContextAttribute("cdn"))||(t==null?void 0:t.getContextAttribute("hostname"))}}var nt=class extends b{getProps(){return Lt(this)}isReadyToLoad(){return this.props.library!=null&&this.props.revision!=null&&this.props.cdn!=null}async load(){rt(this.props,this.onLoad)}update(){this.stylesheet||(this.stylesheet=document.createElement("style"),this.appendChild(this.stylesheet)),this.stylesheet.textContent=this.payload}};nt.register("feaas-stylesheet");var bt;typeof window!="undefined"&&(window.FEAASElement=M,(bt=window.FEAASLoading)!==null&&bt!==void 0||(window.FEAASLoading=Promise.resolve()));function $t(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 It(t=this){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 J=class extends b{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=(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=$t(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 It(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(){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:c,EditorUIMode:u,React:{useEffect:p,useMemo:y,useState:x,useContext:v},Chakra:{HStack:D,Box:A,Button:Y,MenuItem:R},Chrome:Q,ReactDOM:gt,useSDK:S,useSlots:O,useModelObserver:k,ConfirmationContext:ot,VersionContext:X}){if(!this.payload)return;let{React:h}=this.payload,{sdk:T}=S(),[g,vt]=x(),{setConfirm:st}=v(ot),L=n||i,Ut=T.library;g&&(this.component=g),p(()=>{if(this.props.hidden)return;let w=Ut.components.getItem(r).clone();return w.versions.search({ids:[i,n].filter(Boolean),componentIds:[r]}).then(at=>{w.versions.setItems(at);let E=w.findVersion(n,["staged","published"]),I=w.findVersion(i,["staged","published"]);if(E)E.deletedAt?(E.getDraft().changeAndNotify(I.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(I)){console.error("FEAAS Editor: Forking");let lt=I.fork(n).id;this.setAttribute("instance",lt)}else console.error("FEAAS Editor: Regular");vt(w)}),()=>{this.closing=setTimeout(()=>{this.closing=null,this.cleanup(),vt(null)},400)}},[i,this.props.hidden]);let mt=k(g==null?void 0:g.versions,[]).filter(w=>w.id==L),$=mt[0];$&&!this.props.hidden&&(this.version=$),p(()=>(this.unfork=()=>{st({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=g.findVersion(i,["staged","published"]);g.findVersion(n).unstage().unpublish().changeAndNotify(w.toProperties()),g.saveVersions(!1),this.setVersionContext({needsWrite:!0}),this.removeAttribute("forked"),requestAnimationFrame(this.onClose)}})},this.discard=()=>{this.props.changed&&(g.findVersion(L).revert(),g.saveVersions(!1),this.setVersionContext({needsWrite:!0}))},this.close=()=>{st({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=()=>{st({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:()=>{g.findVersion(L).commitData({view:this.editorContext.editor.getData({rootName:L}),model:""}).stage().publish(),this.removeAttribute("changed"),this.setAttribute("forked",L),g.saveVersions(!1)}})},()=>{delete this.unfork,delete this.discard,delete this.save,delete this.editorContext,delete this.versionContext,delete this.setEditorContext,delete this.setVersionContext}),[g]);let Wt=y(()=>this.target,[g]);return y(()=>g&&O(e,({picker:w,children:at})=>h.createElement(A,{ref:E=>{this.chrome=E?{positionable:E,wrapper:E.querySelector(".editor-chrome"),absolute:this.querySelector(".ui.overlays")}:null}},h.createElement(A,{className:"editor-wrapper",position:"absolute",left:0,top:0},h.createElement(o,{datasources:T.datasources,sdk:T,library:T.library,component:g,versions:mt,context:{isAutosaveEnabled:!1,onChromeMeasure:this.onMeasure,onChromeBeforeMeasure:this.onBeforeMeasure,onChromeMeasureElement:this.onChromeMeasureElement,onChromePosition:this.onPosition,onContentChange:this.onContentChange}},{exports:this.onEditorStateChange,after:at,chrome:({editor:E})=>E&&h.createElement(Q,null),children:({isArchivedDisplayed:E,editor:I,status:lt})=>h.createElement(A,{position:"absolute",left:0,top:0,className:"editor-chrome",p:4,boxShadow:"2xl",pointerEvents:"none",opacity:0,transition:"opacity 0.3s"},h.createElement(A,{left:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),h.createElement(A,{right:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),h.createElement(A,{top:0,height:"16",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),h.createElement(A,{bottom:0,height:"4",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),$&&h.createElement(l,{version:$,node:Wt,ignoreBreakpoints:!0,deps:[this.props.forked,this.props.changed]},{exports:this.onVersionStateChange,left:h.createElement(D,{justifyContent:"space-between"},h.createElement(c,{size:"sm",editor:lt=="ready"?I:null}),h.createElement(u,{size:"sm"})),middle:(ye,be)=>[!1],right:h.createElement(h.Fragment,null,h.createElement(Y,{variant:"secondary",size:"sm",onClick:this.close},"Close"),h.createElement(Y,{variant:"primary",size:"sm",onClick:this.save,isDisabled:!this.props.changed},this.props.changed?this.props.forked?"Save":"Save customization":"Up to date"),h.createElement(d,{isDisabled:!this.props.forked&&!this.props.changed},h.createElement(R,{onClick:this.unfork,isDisabled:!this.props.forked},"Unfork"),h.createElement(R,{onClick:this.discard,isDisabled:!this.props.changed},"Discard")))}))})))),[$,this.props.forked,this.props.changed])}isReadyToLoad(){return this.props.component!=null&&this.props.version!=null&&!this.props.hidden}};J.observedAttributes=["library","component","version","revision","hidden","state","changed","forked"];J.register("feaas-editor");function Bt(t=this){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"),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,onContextAttributeSet:void 0}}var K=class extends b{getProps(){return Bt(this)}load(){return import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}render({placeholder:e,context:r,mode:i,children:n,variant:o},{Picker:s,React:a,ReactDOM:l}){return a.createElement(s,{placeholder:e,mode:i||void 0,onClose:this.props.onClose,onContextAttributeSet:this.props.onContextAttributeSet,context:r,variant:o},n)}};K.observedAttributes=["library","mode","frontend","src","hidden","variant"];K.register("feaas-picker");function jt(t=this){var e,r,i,n;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",frontend:(r=t==null?void 0:t.getAttribute("frontend"))!==null&&r!==void 0?r:"https://components.sitecoreclud.io",backend:(i=t==null?void 0:t.getAttribute("backend"))!==null&&i!==void 0?i:"https://components-api.sitecoreclud.io",cdn:(n=t==null?void 0:t.getAttribute("cdn"))!==null&&n!==void 0?n:"https://feaascompontsapiprod.blob.core.windows.net",getToken:null}}var G=class extends b{constructor(){super(...arguments),this.onStatusChange=e=>{e=="ready"&&this.dispatchEvent(new Event("feaasReady",{bubbles:!0,composed:!0}))}}getProps(){return jt(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(e){return e}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(e=>{this.getRoot().appendChild(e)}),super.connectedCallback()}render({children:e,library:r},{AppContext:i,Chakra:{Button:n,Tooltip:o},React:s}){let a={containerRef:{current:this.getRoot()}};return o.defaultProps={hasArrow:!0,placement:"top",portalProps:a},s.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}}},e)}};G.observedAttributes=["library","component","version","revision","hostname","template"];G.register("feaas-context");
69
69
  //# sourceMappingURL=index.js.map