@sitecore-feaas/clientside 0.1.56 → 0.2.1

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 (98) hide show
  1. package/README.md +559 -56
  2. package/build/components/FEAASComponent.js +2 -2
  3. package/build/components/FEAASComponent.js.map +1 -1
  4. package/build/components/FEAASElement.js +408 -37
  5. package/build/components/FEAASElement.js.map +1 -1
  6. package/build/components/FEAASLoader.js +2 -2
  7. package/build/components/FEAASLoader.js.map +1 -1
  8. package/build/components/FEAASReactElement.js +47 -0
  9. package/build/components/FEAASReactElement.js.map +1 -0
  10. package/build/components/FEAASStylesheet.js +2 -2
  11. package/build/components/FEAASStylesheet.js.map +1 -1
  12. package/build/headless.js +4 -3
  13. package/build/headless.js.map +1 -1
  14. package/build/ui/FEAASContext.js +14 -5
  15. package/build/ui/FEAASContext.js.map +1 -1
  16. package/build/ui/FEAASEditor.js +2 -2
  17. package/build/ui/FEAASEditor.js.map +1 -1
  18. package/build/ui/FEAASExternal.js +66 -23
  19. package/build/ui/FEAASExternal.js.map +1 -1
  20. package/build/ui/FEAASPicker.js +3 -2
  21. package/build/ui/FEAASPicker.js.map +1 -1
  22. package/dist/browser/headless.cjs +5 -5
  23. package/dist/browser/headless.cjs.map +4 -4
  24. package/dist/browser/headless.esm.js +5 -5
  25. package/dist/browser/headless.esm.js.map +1 -1
  26. package/dist/browser/index.cjs +7 -7
  27. package/dist/browser/index.cjs.map +4 -4
  28. package/dist/browser/index.esm.js +7 -7
  29. package/dist/browser/index.esm.js.map +1 -1
  30. package/dist/browser/react.cjs +6 -6
  31. package/dist/browser/react.cjs.map +4 -4
  32. package/dist/browser/react.esm.js +6 -6
  33. package/dist/browser/react.esm.js.map +1 -1
  34. package/dist/node/headless.cjs +3 -3
  35. package/dist/node/headless.cjs.map +4 -4
  36. package/dist/node/headless.esm.js +2 -2
  37. package/dist/node/headless.esm.js.map +4 -4
  38. package/dist/node/index.cjs +4 -4
  39. package/dist/node/index.cjs.map +4 -4
  40. package/dist/node/index.esm.js +3 -3
  41. package/dist/node/index.esm.js.map +4 -4
  42. package/dist/node/react.cjs +4 -4
  43. package/dist/node/react.cjs.map +4 -4
  44. package/dist/node/react.esm.js +4 -4
  45. package/dist/node/react.esm.js.map +4 -4
  46. package/headless.cjs +3 -3
  47. package/headless.cjs.map +4 -4
  48. package/headless.js +3 -3
  49. package/headless.js.map +4 -4
  50. package/package.json +10 -2
  51. package/react.cjs +6 -6
  52. package/react.cjs.map +4 -4
  53. package/react.js +6 -6
  54. package/react.js.map +4 -4
  55. package/scripts/test-setup.ts +1 -0
  56. package/src/components/FEAASComponent.tsx +4 -4
  57. package/src/components/FEAASElement.tsx +467 -42
  58. package/src/components/FEAASLoader.tsx +2 -2
  59. package/src/components/FEAASReactElement.tsx +61 -0
  60. package/src/components/FEAASStylesheet.tsx +3 -3
  61. package/src/headless.ts +5 -4
  62. package/src/ui/FEAASContext.tsx +16 -7
  63. package/src/ui/FEAASEditor.tsx +7 -7
  64. package/src/ui/FEAASExternal.tsx +77 -23
  65. package/src/ui/FEAASPicker.tsx +4 -3
  66. package/src/ui/tsconfig.json +1 -1
  67. package/test/FEAASBase.test.tsx +2 -2
  68. package/test/FEAASComponent.test.tsx +3 -1
  69. package/test/FEAASContext.test.tsx +206 -29
  70. package/test/FEAASPicker.test.tsx +4 -2
  71. package/types/components/FEAASComponent.d.ts +3 -3
  72. package/types/components/FEAASComponent.d.ts.map +1 -1
  73. package/types/components/FEAASElement.d.ts +292 -23
  74. package/types/components/FEAASElement.d.ts.map +1 -1
  75. package/types/components/FEAASLoader.d.ts +2 -2
  76. package/types/components/FEAASLoader.d.ts.map +1 -1
  77. package/types/components/FEAASReactElement.d.ts +30 -0
  78. package/types/components/FEAASReactElement.d.ts.map +1 -0
  79. package/types/components/FEAASStylesheet.d.ts +3 -3
  80. package/types/components/FEAASStylesheet.d.ts.map +1 -1
  81. package/types/headless.d.ts +4 -3
  82. package/types/headless.d.ts.map +1 -1
  83. package/types/tsbuildinfo +1 -1
  84. package/types/ui/FEAASContext.d.ts +8 -7
  85. package/types/ui/FEAASContext.d.ts.map +1 -1
  86. package/types/ui/FEAASEditor.d.ts +6 -6
  87. package/types/ui/FEAASEditor.d.ts.map +1 -1
  88. package/types/ui/FEAASExternal.d.ts +8 -10
  89. package/types/ui/FEAASExternal.d.ts.map +1 -1
  90. package/types/ui/FEAASPicker.d.ts +7 -6
  91. package/types/ui/FEAASPicker.d.ts.map +1 -1
  92. package/types/ui/tsbuildinfo +1 -0
  93. package/build/components/FEAASBase.js +0 -416
  94. package/build/components/FEAASBase.js.map +0 -1
  95. package/src/components/FEAASBase.tsx +0 -485
  96. package/types/components/FEAASBase.d.ts +0 -299
  97. package/types/components/FEAASBase.d.ts.map +0 -1
  98. package/types/tsbuildinfo_ui +0 -1
@@ -1,5 +1,5 @@
1
- var Kt=Object.defineProperty;var Gt=(e,t)=>{for(var r in t)Kt(e,r,{get:t[r],enumerable:!0})};function S(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 Yt=typeof HTMLElement=="undefined"?typeof windowJSDOM!="undefined"?windowJSDOM.HTMLElement:class{}:HTMLElement,b=class extends Yt{getProps(t){return{}}constructor(){super(),this.defaultProps={},this.connected=!1,this.refs={},this.descendants=[],this.whenLoaded=S(t=>{this.payload=t}),this.whenRendered=S(()=>this.initialized=!0,()=>cancelAnimationFrame(this.nextRender)),this.addEventListener("feaasMount",this),this.addEventListener("feaasUnmount",this)}getRoot(){return this}attributeChangedCallback(t,r,i){this.set()}connectedCallback(){this.mount()}disconnectedCallback(){this.unmount()}mount(){try{let t=this.getParent();if(t&&!t.connected||this.connected)return;this.connected=!0,this.log("FEAAS: Mount",this.tagName,this),this.dispatchEvent(new Event("feaasMount",{bubbles:!0,composed:!0})),this.getElements().map(r=>{var i;return(i=r.mount)===null||i===void 0?void 0:i.call(r)}),this.set()}catch(t){this.onError(t)}}log(...t){console.log(...t)}unmount(){this.connected&&(this.log("FEAAS: Unmount",this),this.dispatchEvent(new Event("feaasUnmount",{bubbles:!0,composed:!0})),this.connected=!1)}getParent(t=!0){for(var r=this;r=r.parentElement||(r.parentNode instanceof ShadowRoot?r.parentNode.host:null);)if(!t||r.tagName.startsWith("FEAAS-"))return r}getElements(t=this.getRoot(),r=!0){return Array.from(t.querySelectorAll("*")).map(i=>[!r||i.tagName.startsWith("FEAAS-")?i:null,i.shadowRoot?this.getElements(i.shadowRoot,r):null]).flat().filter(Boolean)}handleEvent(t){let r=t.composedPath()[0];switch(t.type){case"feaasMount":r!=this&&this.nestedCallback(r);break;case"feaasUnmount":r!=this&&this.unnestedCallback(r);break}}unnestedCallback(t){let r=this.descendants.indexOf(t);r!=-1&&(this.log("FEAAS: Unnest",this,t),this.descendants.splice(r,-1),this.refs[t.getComponentName()]=null,t.refs.parent==this&&(t.refs.parent=null),t.refs.top==this&&(t.refs.top=t.refs.parent))}nestedCallback(t){var r,i;if(this.descendants.indexOf(t)==-1&&(this.descendants.push(t),this.log("FEAAS: Nest",this,t),this.refs[t.getComponentName()]=t,t.refs.top=this,(r=t.refs).parent||(r.parent=this),t.render))for(var 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 P=class extends b{load(){return Promise.all([import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react"),import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react-dom")]).then(([t,r])=>({React:t,ReactDOM:r}))}render({},{React:t}){return t.createElement(t.Fragment,null)}},tt=class extends P{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))}};tt.observedAttributes=["counter"];import Xt from"vm";var{hasOwnProperty:C}=Object.prototype;function T(e,t){return e=e.slice(),e.push(t),e}function et(e,t){return t=t.slice(),t.unshift(e),t}var rt=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=C.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 rt(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(!C.call(e,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:t}=e),o=C.call(e,"flatten")?e.flatten:o,this.currResultType=C.call(e,"resultType")?e.resultType:this.currResultType,this.currSandbox=C.call(e,"sandbox")?e.sandbox:this.currSandbox,a=C.call(e,"wrap")?e.wrap:a,this.currPreventEval=C.call(e,"preventEval")?e.preventEval:this.currPreventEval,r=C.call(e,"callback")?e.callback:r,this.currOtherTypeCallback=C.call(e,"otherTypeCallback")?e.otherTypeCallback:this.currOtherTypeCallback,n=C.call(e,"parent")?e.parent:n,s=C.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&&C.call(t,d))u(this._trace(h,t[d],T(r,d),t,d,s,o));else if(d==="*")this._walk(t,c=>{u(this._trace(h,t[c],T(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],T(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:T(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],T(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(et(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&&C.call(t,d.slice(1))){let c=d.slice(1);u(this._trace(h,t[c],T(r,c),t,c,s,o,!0))}else if(d.includes(",")){let c=d.split(",");for(let m of c)u(this._trace(et(m,h),t,r,i,n,s,!0))}else!a&&t&&C.call(t,d)&&u(this._trace(h,t[d],T(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 v=this._trace(m.expr,t,m.path,i,n,s,o);if(Array.isArray(v)){p[c]=v[0];let _=v.length;for(let A=1;A<_;A++)c++,p.splice(c,0,v[A])}else p[c]=v}}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(et(c,t),r,i,n,s,o,!0).forEach(v=>{u.push(v)});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=Xt;function nt(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 it(e,t={},r){return r?`<${r}${Object.entries(t).map(([i,n])=>n!=null&&` ${i}="${n}"`).filter(Boolean).join("")}>${F(e)}</${r}>`.replace(/^<([a-z0-9][^>]*)><\/[^>]+>$/,"<$1 />"):F(e)}function F(e){var t;if(Array.isArray(e))return e.map(F).join(`
2
- `).trim();if(typeof e=="string")return e;if(e==null)return"";switch(e.type){case"heading":let{level:r,...i}=e.attrs;return it(e.content,i,"h"+r);case"text":return(e.marks||[]).reduce((n,s)=>it(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 it(e.content||e.text,e.attrs,{bulletList:"ul",orderedList:"ol",listItem:"li",horizontalRule:"hr",paragraph:"p",codeBlock:"code",blockquote:"blockquote"}[e.type])}}var N=class{constructor(t,r=1,i){this.ownerDocument={createElement(n){return new N(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 ot(this.childNodes)}set innerHTML(t){this.childNodes=st(String(t!=null?t:""))}get outerHTML(){return ot([this])}get children(){return this.childNodes.filter(t=>t.nodeType==1)}closest(t){let r=this;for(;r;){if(xt(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(xt(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 N(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 xt(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 st(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:Qt(c||"")}}))||[],d=new N(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 N("#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 Zt(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function Qt(e){return e.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#x27;/g,"'")}function ot(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}="${Zt(String(a))}"`).join(""),s=ot(t.childNodes);return["img","input","br"].includes(r)?`<${r}${n} />`:`<${r}${n}>${s}</${r}>`}).join("")}function St(e,t,r){var i;let n=((i=r==null?void 0:r.processTemplate)===null||i===void 0?void 0:i.call(r,null,e,t))||e,s=st(n);return R(s[0],t,r).outerHTML}function te(e){let t=new e.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(i=>{let n=i.target,s=n.getAttribute("data-embed-src");s&&W(n,s),i.addedNodes&&i.addedNodes.forEach(o=>{o.nodeType==1&&ee(o,!1)})})});return t.observe(e,{attributes:!0,subtree:!0,childList:!0}),t}function ee(e,t=!0){let r=e.querySelectorAll("[data-embed-src]");for(var i=0;i<r.length;i++){let n=r[i];W(n,n.getAttribute("data-embed-src"))}if(t)return te(e)}function W(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 He=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},ze=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},Ve=e=>{var t;return(t=e==null?void 0:e.match(/(\.\*|\[[^\]]+\])$/))===null||t===void 0?void 0:t[0]};function re(e){return e.replace(/(\[[^\]\[]+\]|\.\*)$/g,"")}function Rt(e){return re(e)+".*"}function _t(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 ie(e,t,r){let i=e.getAttribute("data-path-scope");if(i==null)return;var n=_t(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 U(e,t,r,i){var n,s;if(e){var o=e;(r==null?void 0:r.type)=="doc"&&Array.isArray(r.content)&&(r=F(r)),i!=null&&i.processValue&&(r=i==null?void 0:i.processValue(e,t,r));var 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")W(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];U(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))&&U(e,u[h],null,i);U(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 kt=["data-attributes-keys","data-path-attributes","data-path-scope"];function R(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=_t(a),c=nt(t,h,!1)||[];u==0&&ie(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,[Rt(h)]:c[u]}}let p=Array.prototype.slice.call(a.attributes).sort((u,c)=>kt.indexOf(u.name)-kt.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"&&U(a,u,nt(t,c,!0),r),u=="data-embed-src"&&U(a,u,a.getAttribute(u),r)}}for(var l=0,d;d=a.childNodes[l++];)Tt(d)&&R(d,t,r,!0);return i||(o=r==null?void 0:r.onRender)===null||o===void 0||o.call(r,a,t),a}function Tt(e){return e.nodeType==1}function I(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++];)Tt(l)&&(l.className=l.className.replace(/(\s|^)-theme--[^\s]+\s*/g,"$1"));return R(e,r,i)}var Nt=["initial","check","updated"],j={};function Qe(){j={}}async function H(e,t,r,i,n=j){return M({url:e,options:t,validator:r,callback:i,cache:n}).then(z).then(s=>s.response)}function ne(e,t=!1){let r=String(e).replace("?head","");var i=j[r];return!i&&!t&&(i=j[r]={phase:null,initial:S(),check:S(),updated:S(),final:S()}),i}var at=class extends Error{};async function M({url:e,options:t,validator:r,callback:i,cache:n},s="initial"){let o=new Date;if(n!=null){var a=ne(e);if(Nt.indexOf(a.phase)>=Nt.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 at("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 z(e){let{url:t,isCached:r,options:i,validator:n,response:s,cache:o}=e;if(r){let{response:a}=await M({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 lt(e)}return e}async function lt(e){return M({...e,options:{...e.options,cache:"reload"}},"updated")}var k="https://feaas.blob.core.windows.net";function O(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 rr(e){if(!e||!e.library||!e.component)throw new Error("Component requires `library` and `component` properties");return`${e.cdn&&e.cdn!=k?`${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 ir(e){return`${e.cdn&&e.cdn!=k?`${e.cdn}/styles/`:""}${e.library}/${!e.revision||e.revision=="published"?"":e.revision}`.replace(/\/$|\/\/(?!.+\/styles\/)/g,"")}function dt(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=O(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 Pt(e){return typeof e=="string"&&(e={src:e}),"src"in e&&(e={...O(e.src)}),`${e.cdn||e.hostname||k}/components/${e.library}/${e.component}/${e.version}/${e.revision||"published"}.html`}function V(e){return typeof e=="string"&&(e={src:e}),"src"in e&&(e={...dt(e.src)}),`${e.cdn||e.hostname||k}/styles/${e.library}/${e.revision||"published"}.css`}async function B(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&&M({options:{headers:{Accept:"text/html"},credentials:"omit"},url:Pt({...e,version:e.instance}),validator:i}).catch(a=>a),M({url:Pt(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:z({...o,callback:n}).catch(a=>{if(s[0]==o&&(lt({...o,callback:null,validator:null}),console.log("Fork was deleted"),!(s[1]instanceof Error)))return n(s[1].response),z({...s[1],callback:n});throw a})}async function nr(e){typeof e=="string"&&(e={src:e});var t;let{response:r}=await B(e,i=>{t=i},!0);return{...e,template:t,lastModified:r.headers.get("last-modified")}}async function ct(e,t){return typeof e=="string"&&(e={src:e}),H(V(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 ar(e,t){return oe(e,t||(t=document.createElement("style"))),t}function oe(e,t){return t||(t=document.createElement("style")),ct(e,(r,i)=>{t.textContent=r}).then(()=>t)}function ht(e,t){var r=se(e);if(!r)var i=ae(e);return ct(e,(n,s)=>{i&&(i.textContent=n),t==null||t(n,s)}).then(()=>r||i)}function Mt(e){return new Promise((t,r)=>{ht(e,t).catch(r)})}function se(e){return document.head.querySelector(`style[data-href="${V(e)}"]`)}function ae(e){let t=V(e),r=document.createElement("style");return r.setAttribute("data-href",t),document.head.appendChild(r),r}function hr(e,t){let r=document.createElement("div");r.innerHTML=e;let i=document.createDocumentFragment();for(;r.firstChild;)i.appendChild(r.firstChild);return R(i,t),r}function Ot(e,t){return le(e,t||(t=document.createElement("div"))),t}async function le(e,t){return t||(t=document.createElement("div")),t.childNodes.length?R(t,e.data,e):"template"in e?I(t,e.template,e.data,e):B(e,r=>I(t,r,e.data,e)).then(()=>t)}function de(e){var t,r,i,n,s,o,a,l;let d,h=e.getAttribute("src");if(h){let A=O(h);if(!A)throw new Error(`Could not parse FEAAS Component source: ${h}`);var{cdn:p,library:u,component:c,version:m,revision:v}=A}let _=e.getAttribute("data");if(_!=null&&_!="")try{d=typeof _=="string"?JSON.parse(_):{}}catch(A){}return{data:d||{},cdn:(r=(t=e.getContextAttribute("cdn"))!==null&&t!==void 0?t:p)!==null&&r!==void 0?r:k,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:v)!==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 J=class extends b{setData(t){this.set({data:t})}getProps(){return de(this)}attributeChangedCallback(t,r,i){r!==i&&((t=="library"||t=="component"||t=="revision"||t=="version")&&(this.payload=void 0),this.needsRefresh=!0,super.attributeChangedCallback(t,r,i))}getEditor(){var t;return(t=document.querySelector("feaas-context"))===null||t===void 0?void 0:t.refs.editor}constructor(){super(),this.defaultProps={cdn:k,revision:"published",version:"responsive",withStylesheet:!0,editable:!1,suspended:!1},this.onLoad=t=>{this.payload=t,this.advance()},this.addEventListener("click",()=>{this.props.editable&&this.edit()})}edit(){let t=this.getEditor();if(t!=null&&t.setTarget(this))return t.open(),!0}getOriginal(){let t=this.getAttribute("data-path-scope");if(t){for(var r=this;(r=r.previousElementSibling)&&r.getAttribute("data-path-scope")==t;)var i=r;return i}}isReadyToLoad(){return super.isReadyToLoad()&&this.props.library!=null&&this.props.component!=null&&this.props.version!=null}async load(){if(!this.getOriginal()){if(this.props.withStylesheet)var t=Mt({...this.props,revision:"published"}).then(()=>{t=null,this.payload&&this.onLoad(this.payload)});return Promise.all([t,B(this.props,r=>{this.payload=r,t||this.onLoad(r)})]).then(()=>this.payload)}}update(){if(Array.from(this.children).filter(t=>t.tagName!="BR").length>0&&!this.needsRefresh)R(this,this.props.data);else{if(this.needsRefresh=!0,this.getOriginal())return;I(this,this.payload,this.props.data)}}};J.observedAttributes=["library","component","version","revision","hostname","cdn","template","data","instance","editable","with-stylesheet"];J.register("feaas-component");function ce(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 q=class extends b{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return ce(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 Gt=Object.defineProperty;var Yt=(e,t)=>{for(var r in t)Gt(e,r,{get:t[r],enumerable:!0})};function S(e,t=r=>{}){var r;let i=()=>{var n,s;let o=new Promise((l,d)=>{n=u=>{e==null||e(u),l(u)},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 Xt=typeof HTMLElement=="undefined"?typeof windowJSDOM!="undefined"?windowJSDOM.HTMLElement:class{}:HTMLElement,b=class extends Xt{getProps(t){return{}}constructor(){super(),this.defaultProps={},this.connected=!1,this.refs={},this.descendants=[],this.whenLoaded=S(t=>{this.payload=t}),this.whenRendered=S(()=>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}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 N=class extends b{load(){return Promise.all([import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react"),import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react-dom")]).then(([t,r])=>({React:t,ReactDOM:r}))}render({},{React:t}){return t.createElement(t.Fragment,null)}},tt=class extends N{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))}};tt.observedAttributes=["counter"];import Zt from"vm";var{hasOwnProperty:w}=Object.prototype;function T(e,t){return e=e.slice(),e.push(t),e}function et(e,t){return t=t.slice(),t.unshift(e),t}var rt=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 rt(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(u){return u&&!u.isParentSelector});return d.length?!a&&d.length===1&&!d[0].hasArrExpr?this._getPreferredOutput(d[0]):d.reduce((u,p)=>{let h=this._getPreferredOutput(p);return o&&Array.isArray(h)?u=u.concat(h):u.push(h),u},[]):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],u=e.slice(1),p=[];function h(c){Array.isArray(c)?c.forEach(m=>{p.push(m)}):p.push(c)}if((typeof d!="string"||a)&&t&&w.call(t,d))h(this._trace(u,t[d],T(r,d),t,d,s,o));else if(d==="*")this._walk(t,c=>{h(this._trace(u,t[c],T(r,c),t,c,s,!0,!0))});else if(d==="..")h(this._trace(u,t,r,i,n,s,o)),this._walk(t,c=>{typeof t[c]=="object"&&h(this._trace(e.slice(),t[c],T(r,c),t,c,s,!0))});else{if(d==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:u,isParentSelector:!0};if(d==="~")return l={path:T(r,d),value:n,parent:i,parentProperty:null},this._handleCallback(l,s,"property"),l;if(d==="$")h(this._trace(u,t,r,null,null,s,o));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(d))h(this._slice(d,u,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)&&h(this._trace(u,t[m],T(r,m),t,m,s,!0))})}else if(d[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");h(this._trace(et(this._eval(d,t,r[r.length-1],r.slice(0,-1),i,n),u),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);h(this._trace(u,t[c],T(r,c),t,c,s,o,!0))}else if(d.includes(",")){let c=d.split(",");for(let m of c)h(this._trace(et(m,u),t,r,i,n,s,!0))}else!a&&t&&w.call(t,d)&&h(this._trace(u,t[d],T(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 y=this._trace(m.expr,t,m.path,i,n,s,o);if(Array.isArray(y)){p[c]=y[0];let _=y.length;for(let A=1;A<_;A++)c++,p.splice(c,0,y[A])}else p[c]=y}}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,u=l[0]&&Number.parseInt(l[0])||0,p=l[1]&&Number.parseInt(l[1])||a;u=u<0?Math.max(0,u+a):Math.min(a,u),p=p<0?Math.max(0,p+a):Math.min(a,p);let h=[];for(let c=u;c<p;c+=d)this._trace(et(c,t),r,i,n,s,o,!0).forEach(y=>{h.push(y)});return h};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;function nt(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 it(e,t={},r){return r?`<${r}${Object.entries(t).map(([i,n])=>n!=null&&` ${i}="${n}"`).filter(Boolean).join("")}>${U(e)}</${r}>`.replace(/^<([a-z0-9][^>]*)><\/[^>]+>$/,"<$1 />"):U(e)}function U(e){var t;if(Array.isArray(e))return e.map(U).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 it(e.content,i,"h"+r);case"text":return(e.marks||[]).reduce((n,s)=>it(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 it(e.content||e.text,e.attrs,{bulletList:"ul",orderedList:"ol",listItem:"li",horizontalRule:"hr",paragraph:"p",codeBlock:"code",blockquote:"blockquote"}[e.type])}}var P=class{constructor(t,r=1,i){this.ownerDocument={createElement(n){return new P(n)}},this.nodeName=t,this.nodeType=r,this.textContent=i,this.attributes=[],this.childNodes=[]}setAttribute(t,r){let i=this.attributes.find(n=>n.name===t);i?i.value=r:this.attributes.push({name:t,value:r})}getAttribute(t){let r=this.attributes.find(i=>i.name===t);return r?r.value:void 0}insertBefore(t,r){if(t.parentNode=this,r===null)this.childNodes.push(t);else{let i=this.childNodes.indexOf(r);i!==-1&&this.childNodes.splice(i,0,t)}}removeAttribute(t){let r=this.attributes.findIndex(i=>i.name===t);r!==-1&&this.attributes.splice(r,1)}appendChild(t){t.parentNode=this,this.childNodes.push(t)}get tagName(){var t;return(t=this.nodeName)===null||t===void 0?void 0:t.toUpperCase()}get localName(){var t;return(t=this.nodeName)===null||t===void 0?void 0:t.toLowerCase()}get innerHTML(){return ot(this.childNodes)}set innerHTML(t){this.childNodes=st(String(t!=null?t:""))}get outerHTML(){return ot([this])}get children(){return this.childNodes.filter(t=>t.nodeType==1)}closest(t){let r=this;for(;r;){if(xt(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(xt(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 P(this.nodeName,this.nodeType);if(r.attributes=JSON.parse(JSON.stringify(this.attributes)),this.textContent&&(r.textContent=this.textContent),t)for(let i of this.childNodes){let n=i.cloneNode(!0);r.appendChild(n)}return r}get parentElement(){var t;return((t=this.parentNode)===null||t===void 0?void 0:t.nodeType)==1?this.parentNode:null}};function xt(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 st(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(u=>{let[p,h,,c]=u.match(/([\w-]+)(="([^"]*)")?/);return{name:h,value:te(c||"")}}))||[],d=new P(o,1);if(d.attributes=l,i.length>0){let u=i[i.length-1];u.childNodes.push(d),d.parentNode=u}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 P("#text",3);if(l.textContent=a,i.length>0){let d=i[i.length-1];d.childNodes.push(l),l.parentNode=d}else r.push(l);e=e.slice(a.length)}}return r}function Qt(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function te(e){return e.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#x27;/g,"'")}function ot(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}="${Qt(String(a))}"`).join(""),s=ot(t.childNodes);return["img","input","br"].includes(r)?`<${r}${n} />`:`<${r}${n}>${s}</${r}>`}).join("")}function St(e,t,r){var i;let n=((i=r==null?void 0:r.processTemplate)===null||i===void 0?void 0:i.call(r,null,e,t))||e,s=st(n);return R(s[0],t,r).outerHTML}function ee(e){let t=new e.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(i=>{let n=i.target,s=n.getAttribute("data-embed-src");s&&j(n,s),i.addedNodes&&i.addedNodes.forEach(o=>{o.nodeType==1&&re(o,!1)})})});return t.observe(e,{attributes:!0,subtree:!0,childList:!0}),t}function re(e,t=!0){let r=e.querySelectorAll("[data-embed-src]");for(var i=0;i<r.length;i++){let n=r[i];j(n,n.getAttribute("data-embed-src"))}if(t)return ee(e)}function j(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 Je=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},Ke=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},qe=e=>{var t;return(t=e==null?void 0:e.match(/(\.\*|\[[^\]]+\])$/))===null||t===void 0?void 0:t[0]};function ie(e){return e.replace(/(\[[^\]\[]+\]|\.\*)$/g,"")}function Rt(e){return ie(e)+".*"}function _t(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 ne(e,t,r){let i=e.getAttribute("data-path-scope");if(i==null)return;var n=_t(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 F(e,t,r,i){var n,s;if(e){var o=e;(r==null?void 0:r.type)=="doc"&&Array.isArray(r.content)&&(r=U(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 h=Array.from(e.children).find(c=>c.localName=="picture")||e;o=e.localName=="img"?e:h.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")j(e,r);else if(t=="data-path-attributes"){let h=((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];F(e,l,typeof d=="object"&&d?JSON.stringify(d):d,i)}for(var u=0;u<h.length;u++)(r==null||!(h[u]in r))&&F(e,h[u],null,i);F(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 kt=["data-attributes-keys","data-path-attributes","data-path-scope"];function R(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 u=a.getAttribute("data-path-scope");if(u){let h=_t(a),c=nt(t,u,!1)||[];h==0&&ne(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,[Rt(u)]:c[h]}}let p=Array.prototype.slice.call(a.attributes).sort((h,c)=>kt.indexOf(h.name)-kt.indexOf(c.name));for(var l=0;l<p.length;l++){let{name:h,value:c}=p[l];h.startsWith("data-path")&&h!="data-path-scope"&&F(a,h,nt(t,c,!0),r),h=="data-embed-src"&&F(a,h,a.getAttribute(h),r)}}for(var l=0,d;d=a.childNodes[l++];)Tt(d)&&R(d,t,r,!0);return i||(o=r==null?void 0:r.onRender)===null||o===void 0||o.call(r,a,t),a}function Tt(e){return e.nodeType==1}function I(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++];)Tt(l)&&(l.className=l.className.replace(/(\s|^)-theme--[^\s]+\s*/g,"$1"));return R(e,r,i)}var Pt=["initial","check","updated"],B={};function rr(){B={}}async function H(e,t,r,i,n=B){return M({url:e,options:t,validator:r,callback:i,cache:n}).then(z).then(s=>s.response)}function oe(e,t=!1){let r=String(e).replace("?head","");var i=B[r];return!i&&!t&&(i=B[r]={phase:null,initial:S(),check:S(),updated:S(),final:S()}),i}var at=class extends Error{};async function M({url:e,options:t,validator:r,callback:i,cache:n},s="initial"){let o=new Date;if(n!=null){var a=oe(e);if(Pt.indexOf(a.phase)>=Pt.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 u=new Date(d.headers.get("date"))<o||l&&s=="initial"&&(a.phase=="updated"||a.phase=="check");if((r==null?void 0:r(d,u))===!1)throw new at("Response is not valid");return await(i==null?void 0:i(d,s,u)),{url:e,options:t,isCached:u,response:d,validator:r,callback:i,cache:n}}async function z(e){let{url:t,isCached:r,options:i,validator:n,response:s,cache:o}=e;if(r){let{response:a}=await M({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 lt(e)}return e}async function lt(e){return M({...e,options:{...e.options,cache:"reload"}},"updated")}var k="https://feaas.blob.core.windows.net";function O(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 or(e){if(!e||!e.library||!e.component)throw new Error("Component requires `library` and `component` properties");return`${e.cdn&&e.cdn!=k?`${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 sr(e){return`${e.cdn&&e.cdn!=k?`${e.cdn}/styles/`:""}${e.library}/${!e.revision||e.revision=="published"?"":e.revision}`.replace(/\/$|\/\/(?!.+\/styles\/)/g,"")}function dt(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=O(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 Nt(e){return typeof e=="string"&&(e={src:e}),"src"in e&&(e={...O(e.src)}),`${e.cdn||e.hostname||k}/components/${e.library}/${e.component}/${e.version}/${e.revision||"published"}.html`}function V(e){return typeof e=="string"&&(e={src:e}),"src"in e&&(e={...dt(e.src)}),`${e.cdn||e.hostname||k}/styles/${e.library}/${e.revision||"published"}.css`}async function W(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&&M({options:{headers:{Accept:"text/html"},credentials:"omit"},url:Nt({...e,version:e.instance}),validator:i}).catch(a=>a),M({url:Nt(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:z({...o,callback:n}).catch(a=>{if(s[0]==o&&(lt({...o,callback:null,validator:null}),console.log("Fork was deleted"),!(s[1]instanceof Error)))return n(s[1].response),z({...s[1],callback:n});throw a})}async function ar(e){typeof e=="string"&&(e={src:e});var t;let{response:r}=await W(e,i=>{t=i},!0);return{...e,template:t,lastModified:r.headers.get("last-modified")}}async function ct(e,t){return typeof e=="string"&&(e={src:e}),H(V(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 cr(e,t){return se(e,t||(t=document.createElement("style"))),t}function se(e,t){return t||(t=document.createElement("style")),ct(e,(r,i)=>{t.textContent=r}).then(()=>t)}function ut(e,t){var r=ae(e);if(!r)var i=le(e);return ct(e,(n,s)=>{i&&(i.textContent=n),t==null||t(n,s)}).then(()=>r||i)}function Mt(e){return new Promise((t,r)=>{ut(e,t).catch(r)})}function ae(e){return document.head.querySelector(`style[data-href="${V(e)}"]`)}function le(e){let t=V(e),r=document.createElement("style");return r.setAttribute("data-href",t),document.head.appendChild(r),r}function fr(e,t){let r=document.createElement("div");r.innerHTML=e;let i=document.createDocumentFragment();for(;r.firstChild;)i.appendChild(r.firstChild);return R(i,t),r}function Ot(e,t){return de(e,t||(t=document.createElement("div"))),t}async function de(e,t){return t||(t=document.createElement("div")),t.childNodes.length?R(t,e.data,e):"template"in e?I(t,e.template,e.data,e):W(e,r=>I(t,r,e.data,e)).then(()=>t)}function ce(e){var t,r,i,n,s,o,a,l;let d,u=e.getAttribute("src");if(u){let A=O(u);if(!A)throw new Error(`Could not parse FEAAS Component source: ${u}`);var{cdn:p,library:h,component:c,version:m,revision:y}=A}let _=e.getAttribute("data");if(_!=null&&_!="")try{d=typeof _=="string"?JSON.parse(_):{}}catch(A){}return{data:d||{},cdn:(r=(t=e.getContextAttribute("cdn"))!==null&&t!==void 0?t:p)!==null&&r!==void 0?r:k,library:(i=e.getAttribute("library"))!==null&&i!==void 0?i:h,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:y)!==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 J=class extends b{setData(t){this.set({data:t})}getProps(){return ce(this)}attributeChangedCallback(t,r,i){r!==i&&((t=="library"||t=="component"||t=="revision"||t=="version")&&(this.payload=void 0),this.needsRefresh=!0,super.attributeChangedCallback(t,r,i))}getEditor(){var t;return(t=document.querySelector("feaas-context"))===null||t===void 0?void 0:t.refs.editor}constructor(){super(),this.defaultProps={cdn:k,revision:"published",version:"responsive",withStylesheet:!0,editable:!1,suspended:!1},this.onLoad=t=>{this.payload=t,this.advance()},this.addEventListener("click",()=>{this.props.editable&&this.edit()})}edit(){let t=this.getEditor();if(t!=null&&t.setTarget(this))return t.open(),!0}getOriginal(){let t=this.getAttribute("data-path-scope");if(t){for(var r=this;(r=r.previousElementSibling)&&r.getAttribute("data-path-scope")==t;)var i=r;return i}}isReadyToLoad(){return super.isReadyToLoad()&&this.props.library!=null&&this.props.component!=null&&this.props.version!=null}async load(){if(!this.getOriginal()){if(this.props.withStylesheet)var t=Mt({...this.props,revision:"published"}).then(()=>{t=null,this.payload&&this.onLoad(this.payload)});return Promise.all([t,W(this.props,r=>{this.payload=r,t||this.onLoad(r)})]).then(()=>this.payload)}}update(){if(Array.from(this.children).filter(t=>t.tagName!="BR").length>0&&!this.needsRefresh)R(this,this.props.data);else{if(this.needsRefresh=!0,this.getOriginal())return;I(this,this.payload,this.props.data)}}};J.observedAttributes=["library","component","version","revision","hostname","cdn","template","data","instance","editable","with-stylesheet"];J.register("feaas-component");function ue(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 K=class extends b{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return ue(this)}attributeChangedCallback(t,r,i){if(r!==i)return t=="hidden"&&(this.style.setProperty("display","block","important"),this.style.setProperty("transition","opacity 0.3s","important"),i?(this.style.setProperty("opacity","0","important"),this.style.pointerEvents="none"):(this.style.setProperty("opacity","1","important"),this.style.pointerEvents="all")),super.attributeChangedCallback(t,r,i)}connectedCallback(){this.payload=null,super.connectedCallback(),this.attributeChangedCallback("hidden",this.getAttribute("hidden"),this.getAttribute("hidden")),this.stylesheet=document.createElement("style"),this.stylesheet.textContent=`
3
3
  #loader {
4
4
  position: absolute;
5
5
  top: 0;
@@ -63,8 +63,8 @@ var Kt=Object.defineProperty;var Gt=(e,t)=>{for(var r in t)Kt(e,r,{get:t[r],enum
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)}};q.observedAttributes=["hidden","opacity"];q.register("feaas-loader");function he(e){var t,r,i,n;let s=e.getAttribute("src");if(s)var{cdn:o,library:a,revision:l}=dt(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:k}}var ut=class extends b{constructor(){super(...arguments),this.onLoad=t=>{this.payload=t,this.advance()}}getProps(){return he(this)}isReadyToLoad(){return this.props.library!=null&&this.props.revision!=null&&this.props.cdn!=null}load(){return ht(this.props,this.onLoad)}};ut.register("feaas-stylesheet");var ft={};Gt(ft,{convertBase64toBlob:()=>Lt,generate:()=>Ft,get:()=>ue,getVersionForThumbnail:()=>$t,load:()=>Dt,responseToImage:()=>pt,upload:()=>Ut});var Lt=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 $t(e){return e.versions.length||await e.versions.fetch(),e.getVersionForWidth(800)}async function ue(e,t,r){try{if(!e.isNew)return await Dt(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 Ft(e,t);return r==null||r(i,!1),i&&!e.isNew&&Lt(i.src).then(n=>Ut(e,t,n)),i}async function Dt(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 H(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 Ft(e,t){let r=t||(e.isNew?null:await $t(e));if(!r||r.isViewEmpty())return null;let{stylesheet:i,datasources:n}=e.library;return await pe(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 pe(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 v=new Image;v.onload=()=>{a(v)},v.onerror=l,v.src=m})})},o.contentWindow.document.head.appendChild(d);let h=o.contentWindow.document.createElement("style");h.textContent=`
66
+ </div>`,this.getRoot().appendChild(this.stylesheet),this.getRoot().appendChild(this.loader)}update(){this.loader.style.opacity=String(this.props.opacity)}};K.observedAttributes=["hidden","opacity"];K.register("feaas-loader");function he(e){var t,r,i,n;let s=e.getAttribute("src");if(s)var{cdn:o,library:a,revision:l}=dt(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:k}}var ht=class extends b{constructor(){super(...arguments),this.onLoad=t=>{this.payload=t,this.advance()}}getProps(){return he(this)}isReadyToLoad(){return this.props.library!=null&&this.props.revision!=null&&this.props.cdn!=null}load(){return ut(this.props,this.onLoad)}};ht.register("feaas-stylesheet");var ft={};Yt(ft,{convertBase64toBlob:()=>Lt,generate:()=>Ut,get:()=>pe,getVersionForThumbnail:()=>$t,load:()=>Dt,responseToImage:()=>pt,upload:()=>Ft});var Lt=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 $t(e){return e.versions.length||await e.versions.fetch(),e.getVersionForWidth(800)}async function pe(e,t,r){try{if(!e.isNew)return await Dt(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 Ut(e,t);return r==null||r(i,!1),i&&!e.isNew&&Lt(i.src).then(n=>Ft(e,t,n)),i}async function Dt(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 H(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(u=>{o=u,r(u,l)}),d},(a,l,d)=>{e.sdk.log(`FEAAS: Thumbnail ${e.id}/${(t==null?void 0:t.id)||"responsive"}, status: ${l}`),pt(a).then(u=>{o=u,r(u,d)})},null),o}async function Ut(e,t){let r=t||(e.isNew?null:await $t(e));if(!r||r.isViewEmpty())return null;let{stylesheet:i,datasources:n}=e.library;return await fe(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 fe(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 h;(((h=o.contentWindow.document.fonts)===null||h===void 0?void 0:h.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 y=new Image;y.onload=()=>{a(y)},y.onerror=l,y.src=m})})},o.contentWindow.document.head.appendChild(d);let u=o.contentWindow.document.createElement("style");u.textContent=`
67
67
  ${n}
68
68
  body, html { padding: 0; margin: 0; overflow: hidden }
69
- `,o.contentWindow.document.head.appendChild(h);let p=Ot({template:r,data:i});p.classList.add(...e,"-feaas--preview","-emulate--"+t.details.slug),o.contentWindow.document.body.appendChild(p)})}async function Ut(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.FEAASElement=P,(mt=window.FEAASLoading)!==null&&mt!==void 0||(window.FEAASLoading=Promise.resolve()));function fe(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 me(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 K=class extends b{constructor(){super(...arguments),this.framePoint={top:0,left:0},this.wrapperRect={top:0,left:0,width:0,height:0},this.bodyRect={top:0,left:0,width:0,height:0},this.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=fe(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 me(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:v},Chakra:{HStack:_,Box:A,Button:vt,MenuItem:yt},Chrome:Wt,ReactDOM:xe,useSDK:jt,useLibrary:Ht,useSlots:zt,useModelObserver:Vt,ConfirmationContext:Jt,VersionContext:Se}){if(!this.payload)return;let{React:g}=this.payload,At=jt(),wt=Ht(),[y,Ct]=m(),{setConfirm:X}=v(Jt),L=n||i;y&&(this.component=y),u(()=>{if(this.props.hidden)return;let x=wt.components.getItem(r).clone();return x.versions.search({ids:[i,n].filter(Boolean),componentIds:[r]}).then(Z=>{x.versions.setItems(Z);let E=x.findVersion(n,["staged","published"]),D=x.findVersion(i,["staged","published"]);if(E)E.deletedAt?(E.getDraft().changeAndNotify(D.toProperties()).restore(),console.error("FEAAS Editor: Restoring fork")):(console.error("FEAAS Editor: Pre-forked"),this.setAttribute("forked",E.id));else if(this.removeAttribute("forked"),this.shouldFork(D)){console.error("FEAAS Editor: Forking");let Q=D.fork(n).id;this.setAttribute("instance",Q)}else console.error("FEAAS Editor: Regular");Ct(x)}),()=>{this.closing=setTimeout(()=>{this.closing=null,this.cleanup(),Ct(null)},400)}},[i,this.props.hidden]);let Et=Vt(y==null?void 0:y.versions,[]).filter(x=>x.id==L),$=Et[0];$&&!this.props.hidden&&(this.version=$),u(()=>(this.unfork=()=>{X({title:"Reverting component customizations",button:"Discard",body:"Are you sure to reset component to its original state? All changes will be lost.",action:()=>{let x=y.findVersion(i,["staged","published"]);y.findVersion(n).unstage().unpublish().changeAndNotify(x.toProperties()),y.saveVersions(!1),this.setVersionContext({needsWrite:!0}),this.removeAttribute("forked"),requestAnimationFrame(this.onClose)}})},this.discard=()=>{this.props.changed&&(y.findVersion(L).revert(),y.saveVersions(!1),this.setVersionContext({needsWrite:!0}))},this.close=()=>{X({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=()=>{X({bypass:!!this.props.forked,title:"Customizing component",button:"Save",body:"Changes to the component will only be visible on that page. Changes to component done in Component Builder will not be reflected here. It will be possible to revert the customization.",action:()=>{y.findVersion(L).commitData({view:this.editorContext.editor.getData({rootName:L}),model:""}).stage().publish(),this.removeAttribute("changed"),this.setAttribute("forked",L),y.saveVersions(!1)}})},()=>{delete this.unfork,delete this.discard,delete this.save,delete this.editorContext,delete this.versionContext,delete this.setEditorContext,delete this.setVersionContext}),[y]);let qt=c(()=>this.target,[y]);return c(()=>y&&zt(t,({picker:x,children:Z})=>g.createElement(A,{ref:E=>{this.chrome=E?{positionable:E,wrapper:E.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:At.datasources,sdk:At,library:wt,component:y,versions:Et,context:{isAutosaveEnabled:!1,onChromeMeasure:this.onMeasure,onChromeBeforeMeasure:this.onBeforeMeasure,onChromeMeasureElement:this.onChromeMeasureElement,onChromePosition:this.onPosition,onContentChange:this.onContentChange}},{exports:this.onEditorStateChange,after:Z,chrome:({editor:E})=>E&&g.createElement(Wt,null),children:({isArchivedDisplayed:E,editor:D,status:Q})=>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"}),$&&g.createElement(l,{version:$,node:qt,ignoreBreakpoints:!0,deps:[this.props.forked,this.props.changed]},{exports:this.onVersionStateChange,left:g.createElement(_,{justifyContent:"space-between"},g.createElement(h,{size:"sm",editor:Q=="ready"?D:null}),g.createElement(p,{size:"sm"})),middle:(Re,ke)=>[!1],right:g.createElement(g.Fragment,null,g.createElement(vt,{variant:"secondary",size:"sm",onClick:this.close},"Close"),g.createElement(vt,{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(yt,{onClick:this.unfork,isDisabled:!this.props.forked},"Unfork"),g.createElement(yt,{onClick:this.discard,isDisabled:!this.props.changed},"Discard")))}))})))),[$,this.props.forked,this.props.changed])}isReadyToLoad(){return this.props.component!=null&&this.props.version!=null&&!this.props.hidden}};K.observedAttributes=["library","component","version","revision","hidden","state","changed","forked"];K.register("feaas-editor");function ge(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 G=class extends b{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return ge(this)}load(){return this.import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}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)}};G.observedAttributes=["library","mode","frontend","src","hidden","variant"];G.register("feaas-picker");function be(e){var t,r,i,n;return{library:e==null?void 0:e.getAttribute("library"),src:(t=e==null?void 0:e.getAttribute("src"))!==null&&t!==void 0?t:"/context.js",frontend:(r=e==null?void 0:e.getAttribute("frontend"))!==null&&r!==void 0?r:"https://components.sitecoreclud.io",backend:(i=e==null?void 0:e.getAttribute("backend"))!==null&&i!==void 0?i:"https://components.sitecoreclud.io/api",cdn:(n=e==null?void 0:e.getAttribute("cdn"))!==null&&n!==void 0?n:"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 Y=class extends b{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=S(t=>{this.sdk=t})}getProps(){return be(this)}load(){return this.import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}isReadyToLoad(){return console.log("Is ready?",this.props,super.isReadyToLoad()&&this.props.library!=null),super.isReadyToLoad()&&this.props.library!=null}getTheme(t){return t}getRoot(){return this.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(){Array.from(this.children).forEach(t=>{this.getRoot().appendChild(t)}),super.connectedCallback()}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,{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:{cssVarsRoot:":host",resetCSS:!0,toastOptions:{portalProps:a}}},t)}};Y.observedAttributes=["library","component","version","revision","hostname","template"];Y.register("feaas-context");import Ce from"react";import It from"react";import ve from"react-dom";function gt(e){let t=/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;return e.replace(t,function(r){return"-"+r.toLowerCase()})}function bt(e){let t=/-[a-z\u00E0-\u00F6\u00F8-\u00FE]/g;return e.replace(t,function(r){return r.slice(1).toUpperCase()})}var ye=e=>{if(!e)return;let t,r;return e.properties&&(t=Object.keys(e.properties).reduce((i,n)=>(i[gt(n)]=e.properties[n],i),{}),r=(e.required||[]).map(i=>gt(i))),{...e,properties:t,required:r}},Ae=(e,t,r)=>{var i;switch((i=r==null?void 0:r[e])===null||i===void 0?void 0:i.type){case"string":return t;case"object":return JSON.parse(t);case"array":return JSON.parse(t);case"number":return+t;case"integer":return+t;case"boolean":return t==="true";default:return t}};function we(e){var t;let r=e.getAttributeNames(),i=e.getAttribute("data-external-id"),n=(t=w.registered[i])===null||t===void 0?void 0:t.schema;return r.reduce((o,a)=>{if(!a.startsWith("data-attribute")&&!["class","id","contenteditable"].includes(a)){let l=e.getAttribute(a);return{...o,[bt(a)]:Ae(bt(a),l,n==null?void 0:n.properties)}}else return o},{})}var w=class extends b{load(){return Promise.resolve({React:It,ReactDOM:ve})}render(t,{React:r}){var i;let{dataExternalId:n}=t,s=(i=w.registered[n])===null||i===void 0?void 0:i.component;return s||console.warn("FEAASExternal: The component you requested is not registered"),r.createElement(r.Fragment,null,s&&r.createElement(s,{...t}))}getProps(){return we(this)}static registerComponent(t,r={}){let i=r.name||t.name,n={...r,title:i,type:"object"};w.registered[i]={component:t,schema:n}}static setRegistrationCallback(){clearTimeout(w.registrationCallback),w.registrationCallback=setTimeout(()=>{var t;if(typeof window!="undefined"){let r=Object.keys(w.registered).map(i=>({...w.registered[i],name:i,schema:ye(w.registered[i].schema)}));(t=window==null?void 0:window.parent)===null||t===void 0||t.postMessage(JSON.stringify({action:"register-components",data:r}),"*")}},30)}static Preview(t){var r;let i=(t==null?void 0:t.src)||(typeof window!="undefined"?(r=window.location.search.match(/feaasSrc=([^&]+)/))===null||r===void 0?void 0:r[1]:null);return i?It.createElement(Bt,{src:i,...t}):null}};w.registered={};w.register("feaas-external");w.setRegistrationCallback();function Ee({data:e,...t}){if("template"in t&&t.template)var r=St(t.template,e||{});return"src"in t&&(t={...O(t.src),...t}),Ce.createElement("feaas-component",{...t,template:null,data:typeof e=="string"?e:e?JSON.stringify(e):null,dangerouslySetInnerHTML:{__html:r||""}})}var Bt=Ee;export{b as Base,Bt as Component,de as ComponentProps,k as DEFAULT_CDN_URL,w as External,b as FEAASBase,J as FEAASComponent,de as FEAASComponentsProps,Y as FEAASContext,be as FEAASContextProps,K as FEAASEditor,me as FEAASEditorProps,Ee as FEAASEmbed,q as FEAASLoader,ce as FEAASLoaderProps,G as FEAASPicker,ge as FEAASPickerProps,ut as FEAASStylesheet,he as FEAASStylesheetProps,at as InvalidResponse,f as JSONPath,q as Loader,tt as MyComponent,ut as Stylesheet,ft as Thumbnail,ee as autoloadScripts,re as cleanCollectionBit,Qe as clearFetchCache,ae as createStylesheet,H as fetchAndRevalidate,B as fetchAndRevalidateComponent,ct as fetchAndRevalidateStylesheet,lt as fetchBypassingCache,j as fetchCache,nr as fetchComponent,z as fetchToValidateCache,M as fetchWithCacheAwareness,se as findStylesheet,rr as getComponentSource,Pt as getComponentURL,ne as getFetchCache,fe as getFramePosition,Ve as getQualifier,ir as getStylesheetSource,V as getStylesheetURL,W as loadScript,ht as loadStylesheet,Mt as loadStylesheetAllowStale,Rt as normalizeCollectionScope,te as observeDOMElement,O as parseComponentSource,He as parseLimit,ze as parseRange,dt as parseStylesheetSource,nt as queryScopes,Ot as renderComponent,hr as renderComponentElement,le as renderComponentPromise,I as renderDOMContent,R as renderDOMElement,St as renderHTMLContent,ar as renderStylesheet,oe as renderStylesheetPromise,F as serializeCH1RichText,U as setDOMAttribute};
69
+ `,o.contentWindow.document.head.appendChild(u);let p=Ot({template:r,data:i});p.classList.add(...e,"-feaas--preview","-emulate--"+t.details.slug),o.contentWindow.document.body.appendChild(p)})}async function Ft(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=N,(mt=window.FEAASLoading)!==null&&mt!==void 0||(window.FEAASLoading=Promise.resolve()));function me(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 ge(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 q=class extends b{constructor(){super(...arguments),this.framePoint={top:0,left:0},this.wrapperRect={top:0,left:0,width:0,height:0},this.bodyRect={top:0,left:0,width:0,height:0},this.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=me(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 ge(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:u,EditorUIMode:p,React:{useEffect:h,useMemo:c,useState:m,useContext:y},Chakra:{HStack:_,Box:A,Button:vt,MenuItem:yt},Chrome:Bt,ReactDOM:ke,useSDK:Ht,useLibrary:zt,useSlots:Vt,useModelObserver:Jt,ConfirmationContext:Kt,VersionContext:_e}){if(!this.payload)return;let{React:g}=this.payload,Et=Ht(),At=zt(),[E,wt]=m(),{setConfirm:X}=y(Kt),L=n||i;E&&(this.component=E),h(()=>{if(this.props.hidden)return;let x=At.components.getItem(r).clone();return x.versions.search({ids:[i,n].filter(Boolean),componentIds:[r]}).then(Z=>{x.versions.setItems(Z);let C=x.findVersion(n,["staged","published"]),D=x.findVersion(i,["staged","published"]);if(C)C.deletedAt?(C.getDraft().changeAndNotify(D.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(D)){console.error("FEAAS Editor: Forking");let Q=D.fork(n).id;this.setAttribute("instance",Q)}else console.error("FEAAS Editor: Regular");wt(x)}),()=>{this.closing=setTimeout(()=>{this.closing=null,this.cleanup(),wt(null)},400)}},[i,this.props.hidden]);let Ct=Jt(E==null?void 0:E.versions,[]).filter(x=>x.id==L),$=Ct[0];$&&!this.props.hidden&&(this.version=$),h(()=>(this.unfork=()=>{X({title:"Reverting component customizations",button:"Discard",body:"Are you sure to reset component to its original state? All changes will be lost.",action:()=>{let x=E.findVersion(i,["staged","published"]);E.findVersion(n).unstage().unpublish().changeAndNotify(x.toProperties()),E.saveVersions(!1),this.setVersionContext({needsWrite:!0}),this.removeAttribute("forked"),requestAnimationFrame(this.onClose)}})},this.discard=()=>{this.props.changed&&(E.findVersion(L).revert(),E.saveVersions(!1),this.setVersionContext({needsWrite:!0}))},this.close=()=>{X({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=()=>{X({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:()=>{E.findVersion(L).commitData({view:this.editorContext.editor.getData({rootName:L}),model:""}).stage().publish(),this.removeAttribute("changed"),this.setAttribute("forked",L),E.saveVersions(!1)}})},()=>{delete this.unfork,delete this.discard,delete this.save,delete this.editorContext,delete this.versionContext,delete this.setEditorContext,delete this.setVersionContext}),[E]);let qt=c(()=>this.target,[E]);return c(()=>E&&Vt(t,({picker:x,children:Z})=>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:Et.datasources,sdk:Et,library:At,component:E,versions:Ct,context:{isAutosaveEnabled:!1,onChromeMeasure:this.onMeasure,onChromeBeforeMeasure:this.onBeforeMeasure,onChromeMeasureElement:this.onChromeMeasureElement,onChromePosition:this.onPosition,onContentChange:this.onContentChange}},{exports:this.onEditorStateChange,after:Z,chrome:({editor:C})=>C&&g.createElement(Bt,null),children:({isArchivedDisplayed:C,editor:D,status:Q})=>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"}),$&&g.createElement(l,{version:$,node:qt,ignoreBreakpoints:!0,deps:[this.props.forked,this.props.changed]},{exports:this.onVersionStateChange,left:g.createElement(_,{justifyContent:"space-between"},g.createElement(u,{size:"sm",editor:Q=="ready"?D:null}),g.createElement(p,{size:"sm"})),middle:(Te,Pe)=>[!1],right:g.createElement(g.Fragment,null,g.createElement(vt,{variant:"secondary",size:"sm",onClick:this.close},"Close"),g.createElement(vt,{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(yt,{onClick:this.unfork,isDisabled:!this.props.forked},"Unfork"),g.createElement(yt,{onClick:this.discard,isDisabled:!this.props.changed},"Discard")))}))})))),[$,this.props.forked,this.props.changed])}isReadyToLoad(){return this.props.component!=null&&this.props.version!=null&&!this.props.hidden}};q.observedAttributes=["library","component","version","revision","hidden","state","changed","forked"];q.register("feaas-editor");function be(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 G=class extends b{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return be(this)}load(){return this.import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}render({placeholder:t,context:r,mode:i,children:n,variant:s},{Picker:o,React:a,useLibrary:l}){let d=l("collections"),u=l("stylesheet.styles");return a.createElement(o,{rules:u,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)}};G.observedAttributes=["library","mode","frontend","src","hidden","variant"];G.register("feaas-picker");function ve(e){var t,r,i,n;return{library:e==null?void 0:e.getAttribute("library"),src:(t=e==null?void 0:e.getAttribute("src"))!==null&&t!==void 0?t:"/context.js",frontend:(r=e==null?void 0:e.getAttribute("frontend"))!==null&&r!==void 0?r:"https://components.sitecorecloud.io",backend:(i=e==null?void 0:e.getAttribute("backend"))!==null&&i!==void 0?i:"https://components.sitecorecloud.io/api",cdn:(n=e==null?void 0:e.getAttribute("cdn"))!==null&&n!==void 0?n:"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 Y=class extends b{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=S(t=>{this.sdk=t})}getProps(){return ve(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(){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,{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:".feaas-reset",cssVarsRoot:":host",resetCSS:!0,toastOptions:{portalProps:a}}},t)}};Y.observedAttributes=["library","component","version","revision","hostname","template"];Y.register("feaas-context");import Se from"react";import It from"react";import ye from"react-dom";function gt(e){let t=/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;return e.replace(t,function(r){return"-"+r.toLowerCase()})}function bt(e){let t=/-[a-z\u00E0-\u00F6\u00F8-\u00FE]/g;return e.replace(t,function(r){return r.slice(1).toUpperCase()})}var Ee=e=>Object.keys(e).reduce((t,r)=>{if(e[r].title)t[r]=e[r];else{let i=r.split("-").map(n=>n.charAt(0).toUpperCase()+n.slice(1).toLowerCase()).join(" ");t[r]={...e[r],title:i}}return t},{}),Wt=(e={})=>Object.keys(e).reduce((t,r)=>(t[gt(r)]=e[r],t),{}),Ae=e=>{if(!e)return;if(!e.properties)return e;let t,r;return t=Wt(e.properties),r=(e.required||[]).map(n=>gt(n)),t=Ee(t),{...e,properties:t,required:r,title:void 0}},we=(e,t)=>{if(!e||!t)return;let r;return r=Wt(e),Object.keys(t).filter(n=>/(integer|number)/.test(t[n].type)).forEach(n=>{r[n]?r[n]["ui:widget"]||(r[n]["ui:widget"]="updown"):r[n]={"ui:widget":"updown"}}),r},Ce=(e,t,r)=>{var i;switch((i=r==null?void 0:r[e])===null||i===void 0?void 0:i.type){case"string":return t;case"object":return JSON.parse(t);case"array":return JSON.parse(t);case"number":return+t;case"integer":return+t;case"boolean":return t==="true";default:return t}};function xe(e){var t;let r=e.getAttributeNames(),i=e.getAttribute("data-external-id"),n=(t=v.registered[i])===null||t===void 0?void 0:t.schema;return r.reduce((o,a)=>{if(!a.startsWith("data-attribute")&&!["class","id","contenteditable"].includes(a)){let l=e.getAttribute(a);return{...o,[bt(a)]:Ce(bt(a),l,n==null?void 0:n.properties)}}else return o},{})}var v=class extends b{load(){return Promise.resolve({React:It,ReactDOM:ye})}render(t,{React:r}){var i;let{dataExternalId:n}=t,s=(i=v.registered[n])===null||i===void 0?void 0:i.component;return s||console.warn("FEAASExternal: The component you requested is not registered"),r.createElement(r.Fragment,null,s&&r.createElement(s,{...t}))}getProps(){return xe(this)}static registerComponent(t,r={}){let i=r.name||t.name,{thumbnail:n,group:s,ui:o,...a}=r,l={...a,type:"object"};v.registered[i]={component:t,schema:l,uiSchema:o,thumbnail:n,group:s,title:(l==null?void 0:l.title)||i},v.setRegistrationCallback()}static setRegistrationCallback(){clearTimeout(v.registrationCallback),v.registrationCallback=setTimeout(()=>{var t;if(typeof window!="undefined"){let r=Object.keys(v.registered).map(i=>{var n;return{...v.registered[i],name:i,schema:Ae(v.registered[i].schema),uiSchema:we(v.registered[i].uiSchema,(n=v.registered[i].schema)===null||n===void 0?void 0:n.properties)}});(t=window.parent)===null||t===void 0||t.postMessage(JSON.stringify({action:"register-components",data:r}),"*")}},30)}static Preview(t){var r;let i=(t==null?void 0:t.src)||(typeof window!="undefined"?(r=window.location.search.match(/feaasSrc=([^&]+)/))===null||r===void 0?void 0:r[1]:null);return i?It.createElement(jt,{src:i,...t}):null}};v.registered={};v.register("feaas-external");v.setRegistrationCallback();function Re({data:e,...t}){if("template"in t&&t.template)var r=St(t.template,e||{});return"src"in t&&(t={...O(t.src),...t}),Se.createElement("feaas-component",{...t,template:null,data:typeof e=="string"?e:e?JSON.stringify(e):null,dangerouslySetInnerHTML:{__html:r||""}})}var jt=Re;export{jt as Component,ce as ComponentProps,Y as Context,S as ControlledPromise,k as DEFAULT_CDN_URL,b as Element,v as External,J as FEAASComponent,ce as FEAASComponentsProps,Y as FEAASContext,ve as FEAASContextProps,q as FEAASEditor,ge as FEAASEditorProps,b as FEAASElement,Re as FEAASEmbed,K as FEAASLoader,ue as FEAASLoaderProps,G as FEAASPicker,be as FEAASPickerProps,ht as FEAASStylesheet,he as FEAASStylesheetProps,at as InvalidResponse,f as JSONPath,K as Loader,tt as MyComponent,G as Picker,ht as Stylesheet,ft as Thumbnail,re as autoloadScripts,ie as cleanCollectionBit,rr as clearFetchCache,le as createStylesheet,H as fetchAndRevalidate,W as fetchAndRevalidateComponent,ct as fetchAndRevalidateStylesheet,lt as fetchBypassingCache,B as fetchCache,ar as fetchComponent,z as fetchToValidateCache,M as fetchWithCacheAwareness,ae as findStylesheet,or as getComponentSource,Nt as getComponentURL,oe as getFetchCache,me as getFramePosition,qe as getQualifier,sr as getStylesheetSource,V as getStylesheetURL,j as loadScript,ut as loadStylesheet,Mt as loadStylesheetAllowStale,Rt as normalizeCollectionScope,ee as observeDOMElement,O as parseComponentSource,Je as parseLimit,Ke as parseRange,dt as parseStylesheetSource,nt as queryScopes,Ot as renderComponent,fr as renderComponentElement,de as renderComponentPromise,I as renderDOMContent,R as renderDOMElement,St as renderHTMLContent,cr as renderStylesheet,se as renderStylesheetPromise,U as serializeCH1RichText,F as setDOMAttribute};
70
70
  //# sourceMappingURL=react.esm.js.map