@sitecore-feaas/clientside 0.2.2 → 0.3.0

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