@sitecore-feaas/clientside 0.1.53 → 0.1.55
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.
- package/README.md +41 -7
- package/build/components/FEAASBase.js +12 -9
- package/build/components/FEAASBase.js.map +1 -1
- package/build/components/FEAASComponent.js +3 -2
- package/build/components/FEAASComponent.js.map +1 -1
- package/build/components/FEAASElement.js +2 -1
- package/build/components/FEAASElement.js.map +1 -1
- package/build/components/FEAASLoader.js +3 -2
- package/build/components/FEAASLoader.js.map +1 -1
- package/build/components/FEAASStylesheet.js +1 -1
- package/build/components/FEAASStylesheet.js.map +1 -1
- package/build/dom/data.js +0 -6
- package/build/dom/data.js.map +1 -1
- package/build/dom/html.js +7 -0
- package/build/dom/html.js.map +1 -1
- package/build/dom/rendering.js +8 -5
- package/build/dom/rendering.js.map +1 -1
- package/build/dom/thumbnail.js +247 -0
- package/build/dom/thumbnail.js.map +1 -0
- package/build/fetch.js +4 -2
- package/build/fetch.js.map +1 -1
- package/build/headless.js +2 -0
- package/build/headless.js.map +1 -1
- package/build/ui/FEAASContext.js +10 -4
- package/build/ui/FEAASContext.js.map +1 -1
- package/build/ui/FEAASEditor.js +7 -6
- package/build/ui/FEAASEditor.js.map +1 -1
- package/build/ui/FEAASExternal.js +12 -10
- package/build/ui/FEAASExternal.js.map +1 -1
- package/build/ui/FEAASPicker.js +10 -4
- package/build/ui/FEAASPicker.js.map +1 -1
- package/build/utils/datapath.js +29 -0
- package/build/utils/datapath.js.map +1 -0
- package/build/utils/promise.js +27 -0
- package/build/utils/promise.js.map +1 -1
- package/dist/browser/headless.cjs +8 -5
- package/dist/browser/headless.cjs.map +4 -4
- package/dist/browser/headless.esm.js +8 -5
- package/dist/browser/headless.esm.js.map +1 -1
- package/dist/browser/index.cjs +8 -5
- package/dist/browser/index.cjs.map +4 -4
- package/dist/browser/index.esm.js +8 -5
- package/dist/browser/index.esm.js.map +1 -1
- package/dist/browser/react.cjs +8 -5
- package/dist/browser/react.cjs.map +4 -4
- package/dist/browser/react.esm.js +8 -5
- package/dist/browser/react.esm.js.map +1 -1
- package/dist/node/headless.cjs +6 -3
- package/dist/node/headless.cjs.map +4 -4
- package/dist/node/headless.esm.js +6 -3
- package/dist/node/headless.esm.js.map +4 -4
- package/dist/node/index.cjs +6 -3
- package/dist/node/index.cjs.map +4 -4
- package/dist/node/index.esm.js +6 -3
- package/dist/node/index.esm.js.map +4 -4
- package/dist/node/react.cjs +6 -3
- package/dist/node/react.cjs.map +4 -4
- package/dist/node/react.esm.js +6 -3
- package/dist/node/react.esm.js.map +4 -4
- package/headless.cjs +6 -3
- package/headless.cjs.map +4 -4
- package/headless.js +6 -3
- package/headless.js.map +4 -4
- package/package.json +2 -1
- package/react.cjs +8 -5
- package/react.cjs.map +4 -4
- package/react.js +8 -5
- package/react.js.map +4 -4
- package/src/components/FEAASBase.tsx +12 -10
- package/src/components/FEAASComponent.tsx +1 -1
- package/src/components/FEAASLoader.tsx +1 -1
- package/src/components/FEAASStylesheet.tsx +1 -1
- package/src/dom/data.ts +0 -8
- package/src/dom/html.ts +8 -0
- package/src/dom/rendering.ts +9 -4
- package/src/dom/thumbnail.ts +293 -0
- package/src/fetch.ts +5 -3
- package/src/headless.ts +2 -0
- package/src/ui/FEAASContext.tsx +9 -3
- package/src/ui/FEAASEditor.tsx +5 -5
- package/src/ui/FEAASExternal.tsx +10 -10
- package/src/ui/FEAASPicker.tsx +10 -3
- package/src/utils/datapath.ts +31 -0
- package/src/utils/promise.ts +29 -2
- package/test/FEAASComponent.react.test.tsx +3 -6
- package/test/FEAASComponent.test.tsx +2 -1
- package/test/FEAASExternal.test.tsx +50 -4
- package/test/cjs/tsconfig.json +9 -0
- package/test/fetch.ts +1 -1
- package/types/components/FEAASBase.d.ts +12 -9
- package/types/components/FEAASBase.d.ts.map +1 -1
- package/types/components/FEAASComponent.d.ts +1 -1
- package/types/components/FEAASComponent.d.ts.map +1 -1
- package/types/components/FEAASLoader.d.ts +1 -1
- package/types/components/FEAASLoader.d.ts.map +1 -1
- package/types/components/FEAASStylesheet.d.ts +1 -1
- package/types/components/FEAASStylesheet.d.ts.map +1 -1
- package/types/dom/data.d.ts +0 -2
- package/types/dom/data.d.ts.map +1 -1
- package/types/dom/html.d.ts +2 -0
- package/types/dom/html.d.ts.map +1 -1
- package/types/dom/rendering.d.ts.map +1 -1
- package/types/dom/thumbnail.d.ts +82 -0
- package/types/dom/thumbnail.d.ts.map +1 -0
- package/types/fetch.d.ts +6 -4
- package/types/fetch.d.ts.map +1 -1
- package/types/headless.d.ts +2 -0
- package/types/headless.d.ts.map +1 -1
- package/types/tsbuildinfo +1 -1
- package/types/tsbuildinfo_ui +1 -1
- package/types/ui/FEAASContext.d.ts +9 -5
- package/types/ui/FEAASContext.d.ts.map +1 -1
- package/types/ui/FEAASEditor.d.ts +2 -2
- package/types/ui/FEAASEditor.d.ts.map +1 -1
- package/types/ui/FEAASExternal.d.ts +2 -2
- package/types/ui/FEAASExternal.d.ts.map +1 -1
- package/types/ui/FEAASPicker.d.ts +5 -5
- package/types/ui/FEAASPicker.d.ts.map +1 -1
- package/types/utils/datapath.d.ts +6 -0
- package/types/utils/datapath.d.ts.map +1 -0
- package/types/utils/promise.d.ts +28 -1
- package/types/utils/promise.d.ts.map +1 -1
package/dist/node/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var Yt=Object.create;var Y=Object.defineProperty;var Zt=Object.getOwnPropertyDescriptor;var Qt=Object.getOwnPropertyNames;var Xt=Object.getPrototypeOf,te=Object.prototype.hasOwnProperty;var ee=(e,t)=>{for(var r in t)Y(e,r,{get:t[r],enumerable:!0})},Et=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Qt(t))!te.call(e,n)&&n!==r&&Y(e,n,{get:()=>t[n],enumerable:!(i=Zt(t,n))||i.enumerable});return e};var re=(e,t,r)=>(r=e!=null?Yt(Xt(e)):{},Et(t||!e||!e.__esModule?Y(r,"default",{value:e,enumerable:!0}):r,e)),ie=e=>Et(Y({},"__esModule",{value:!0}),e);var me={};ee(me,{Base:()=>b,Component:()=>z,ComponentProps:()=>Dt,DEFAULT_CDN_URL:()=>S,FEAASBase:()=>b,FEAASComponent:()=>z,FEAASComponentsProps:()=>Dt,FEAASContext:()=>K,FEAASContextProps:()=>Wt,FEAASEditor:()=>q,FEAASEditorProps:()=>Bt,FEAASLoader:()=>V,FEAASLoaderProps:()=>Ft,FEAASPicker:()=>J,FEAASPickerProps:()=>Ht,FEAASStylesheet:()=>it,FEAASStylesheetProps:()=>Ut,JSONPath:()=>p,Loader:()=>V,MyComponent:()=>Z,Stylesheet:()=>it,autoloadScripts:()=>Rt,cleanCollectionBit:()=>wt,clearFetchCache:()=>de,createStylesheet:()=>Lt,fetchAndRevalidate:()=>pt,fetchAndRevalidateComponent:()=>$,fetchAndRevalidateStylesheet:()=>et,fetchBypassingCache:()=>X,fetchCache:()=>B,fetchComponent:()=>ue,fetchToValidateCache:()=>H,fetchWithCacheAwareness:()=>T,findStylesheet:()=>Ot,getComponentSource:()=>ce,getComponentURL:()=>ft,getFetchCache:()=>Nt,getFramePosition:()=>It,getStylesheetSource:()=>he,getStylesheetURL:()=>j,loadScript:()=>I,loadStylesheet:()=>rt,loadStylesheetAllowStale:()=>gt,normalizeCollectionScope:()=>ct,observeDOMElement:()=>St,parseComponentSource:()=>W,parseStylesheetSource:()=>tt,queryScopes:()=>Q,renderComponent:()=>ge,renderComponentElement:()=>fe,renderComponentPromise:()=>$t,renderDOMContent:()=>L,renderDOMElement:()=>w,renderHTMLContent:()=>le,renderStylesheet:()=>pe,renderStylesheetPromise:()=>Mt,serializeCH1RichText:()=>M,setDOMAttribute:()=>O});module.exports=ie(me);function k(e,t=r=>{}){var r;let i=()=>{var n,o;let s=new Promise((l,d)=>{n=h=>{e==null||e(h),l(h)},o=d});var a=Object.assign(s,{resolve:n,reject:o,restart:i,first:r});return r=a,a.catch(t),a};return i()}var ne=typeof HTMLElement=="undefined"?typeof windowJSDOM!="undefined"?windowJSDOM.HTMLElement:class{}:HTMLElement,b=class extends ne{getProps(t){return{}}constructor(){super(),this.defaultProps={},this.connected=!1,this.refs={},this.descendants=[],this.whenLoaded=k(t=>{this.payload=t}),this.whenRendered=k(()=>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 o=t.refs.parent;o;o=o.refs.parent)o.render&&((i=t.refs).parentReact||(i.parentReact=o),t.refs.topReact=o)}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(o){}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:o,ReactDOMClient:s}=this.payload||{};if(!n)throw new Error(`${this.tagName}: React is not present in payload`);if(!o)throw new Error(`${this.tagName}: ReactDOM is not present in payload`);!this.refs.topReact&&!this.forceUpdateReact?s?(this.reactRoot||(this.reactRoot=s.createRoot(this.getReactRootElement())),this.reactRoot.render(this.getReactElement())):o.render(this.getReactElement(),this.getReactRootElement()):this.forceUpdateReact?(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,o)=>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(s){return{error:s}}componentDidCatch(s,a){console.error(`FEAAS: ${t.tagName} Error:`,s,a),t.onError(s,"react")}render(){if(!this.state.error)return this.props.children}})}getReactElement(t=this,r){let{React:i,ReactDOM:n}=t.payload||{},o=this.getReactErrorBoundary(),s=this.getReactWrapper(t);return i.createElement(o,{key:t.tagName+"-"+t.getUID(),slot:t.getAttribute("slot")},i.createElement(s,null))}getReactWrapper(t=this,r=t.tagName){if(t.reactWrapper)return t.reactWrapper;let{React:i,ReactDOM:n}=t.payload||{};return t.reactWrapper=o=>{if(t.render){let[s,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)}},Z=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(o=>o+1)},[t]),r.createElement(r.Fragment,null,r.createElement("p",null,"Rendering attribute: ",t),r.createElement("p",null,"Triggered updates: ",i))}};Z.observedAttributes=["counter"];var Ct=re(require("vm"),1),{hasOwnProperty:A}=Object.prototype;function _(e,t){return e=e.slice(),e.push(t),e}function at(e,t){return t=t.slice(),t.unshift(e),t}var lt=class extends Error{constructor(t){super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),this.avoidNew=!0,this.value=t,this.name="NewError"}};function p(e,t,r,i,n){if(!(this instanceof p))try{return new p(e,t,r,i,n)}catch(s){if(!s.avoidNew)throw s;return s.value}typeof e=="string"&&(n=i,i=r,r=t,t=e,e=null);let o=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=A.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 s={path:o?e.path:t};o?"json"in e&&(s.json=e.json):s.json=r;let a=this.evaluate(s);if(!a||typeof a!="object")throw new lt(a);return a}}p.prototype.evaluate=function(e,t,r,i){let n=this.parent,o=this.parentProperty,{flatten:s,wrap:a}=this;if(this.currResultType=this.resultType,this.currPreventEval=this.preventEval,this.currSandbox=this.sandbox,r=r||this.callback,this.currOtherTypeCallback=i||this.otherTypeCallback,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(!A.call(e,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:t}=e),s=A.call(e,"flatten")?e.flatten:s,this.currResultType=A.call(e,"resultType")?e.resultType:this.currResultType,this.currSandbox=A.call(e,"sandbox")?e.sandbox:this.currSandbox,a=A.call(e,"wrap")?e.wrap:a,this.currPreventEval=A.call(e,"preventEval")?e.preventEval:this.currPreventEval,r=A.call(e,"callback")?e.callback:r,this.currOtherTypeCallback=A.call(e,"otherTypeCallback")?e.otherTypeCallback:this.currOtherTypeCallback,n=A.call(e,"parent")?e.parent:n,o=A.call(e,"parentProperty")?e.parentProperty:o,e=e.path}if(n=n||null,o=o||null,Array.isArray(e)&&(e=p.toPathString(e)),!e&&e!==""||!t)return;let l=p.toPathArray(e);l[0]==="$"&&l.length>1&&l.shift(),this._hasParentSelector=null;let d=this._trace(l,t,["$"],n,o,r).filter(function(h){return h&&!h.isParentSelector});return d.length?!a&&d.length===1&&!d[0].hasArrExpr?this._getPreferredOutput(d[0]):d.reduce((h,f)=>{let u=this._getPreferredOutput(f);return s&&Array.isArray(u)?h=h.concat(u):h.push(u),h},[]):a?[]:void 0};p.prototype._getPreferredOutput=function(e){let t=this.currResultType;switch(t){case"all":{let r=Array.isArray(e.path)?e.path:p.toPathArray(e.path);return e.pointer=p.toPointer(r),e.path=typeof e.path=="string"?e.path:p.toPathString(e.path),e}case"value":case"parent":case"parentProperty":return e[t];case"path":return p.toPathString(e[t]);case"pointer":return p.toPointer(e.path);default:throw new TypeError("Unknown result type")}};p.prototype._handleCallback=function(e,t,r){if(t){let i=this._getPreferredOutput(e);e.path=typeof e.path=="string"?e.path:p.toPathString(e.path),t(i,r,e)}};p.prototype._trace=function(e,t,r,i,n,o,s,a){let l;if(!e.length)return l={path:r,value:t,parent:i,parentProperty:n,hasArrExpr:s},this._handleCallback(l,o,"value"),l;let d=e[0],h=e.slice(1),f=[];function u(c){Array.isArray(c)?c.forEach(g=>{f.push(g)}):f.push(c)}if((typeof d!="string"||a)&&t&&A.call(t,d))u(this._trace(h,t[d],_(r,d),t,d,o,s));else if(d==="*")this._walk(t,c=>{u(this._trace(h,t[c],_(r,c),t,c,o,!0,!0))});else if(d==="..")u(this._trace(h,t,r,i,n,o,s)),this._walk(t,c=>{typeof t[c]=="object"&&u(this._trace(e.slice(),t[c],_(r,c),t,c,o,!0))});else{if(d==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:h,isParentSelector:!0};if(d==="~")return l={path:_(r,d),value:n,parent:i,parentProperty:null},this._handleCallback(l,o,"property"),l;if(d==="$")u(this._trace(h,t,r,null,null,o,s));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(d))u(this._slice(d,h,t,r,i,n,o));else if(d.indexOf("?(")===0){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");let c=d.replace(/^\?\((.*?)\)$/u,"$1");this._walk(t,g=>{this._eval(c,t[g],g,r,i,n)&&u(this._trace(h,t[g],_(r,g),t,g,o,!0))})}else if(d[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");u(this._trace(at(this._eval(d,t,r[r.length-1],r.slice(0,-1),i,n),h),t,r,i,n,o,s))}else if(d[0]==="@"){let c=!1,g=d.slice(1,-2);switch(g){case"scalar":(!t||!["object","function"].includes(typeof t))&&(c=!0);break;case"boolean":case"string":case"undefined":case"function":typeof t===g&&(c=!0);break;case"integer":Number.isFinite(t)&&!(t%1)&&(c=!0);break;case"number":Number.isFinite(t)&&(c=!0);break;case"nonFinite":typeof t=="number"&&!Number.isFinite(t)&&(c=!0);break;case"object":t&&typeof t===g&&(c=!0);break;case"array":Array.isArray(t)&&(c=!0);break;case"other":c=this.currOtherTypeCallback(t,r,i,n);break;case"null":t===null&&(c=!0);break;default:throw new TypeError("Unknown value type "+g)}if(c)return l={path:r,value:t,parent:i,parentProperty:n},this._handleCallback(l,o,"value"),l}else if(d[0]==="`"&&t&&A.call(t,d.slice(1))){let c=d.slice(1);u(this._trace(h,t[c],_(r,c),t,c,o,s,!0))}else if(d.includes(",")){let c=d.split(",");for(let g of c)u(this._trace(at(g,h),t,r,i,n,o,!0))}else!a&&t&&A.call(t,d)&&u(this._trace(h,t[d],_(r,d),t,d,o,s,!0))}if(this._hasParentSelector)for(let c=0;c<f.length;c++){let g=f[c];if(g&&g.isParentSelector){let E=this._trace(g.expr,t,g.path,i,n,o,s);if(Array.isArray(E)){f[c]=E[0];let R=E.length;for(let v=1;v<R;v++)c++,f.splice(c,0,E[v])}else f[c]=E}}return f};p.prototype._walk=function(e,t){if(Array.isArray(e)){let r=e.length;for(let i=0;i<r;i++)t(i)}else e&&typeof e=="object"&&Object.keys(e).forEach(r=>{t(r)})};p.prototype._slice=function(e,t,r,i,n,o,s){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,f=l[1]&&Number.parseInt(l[1])||a;h=h<0?Math.max(0,h+a):Math.min(a,h),f=f<0?Math.max(0,f+a):Math.min(a,f);let u=[];for(let c=h;c<f;c+=d)this._trace(at(c,t),r,i,n,o,s,!0).forEach(E=>{u.push(E)});return u};p.prototype._eval=function(e,t,r,i,n,o){this.currSandbox._$_parentProperty=o,this.currSandbox._$_parent=n,this.currSandbox._$_property=r,this.currSandbox._$_root=this.json,this.currSandbox._$_v=t;let s=e.includes("@path");s&&(this.currSandbox._$_path=p.toPathString(i.concat([r])));let a="script:"+e;if(!p.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");s&&(l=l.replace(/@path/gu,"_$_path")),p.cache[a]=new this.vm.Script(l)}try{return p.cache[a].runInNewContext(this.currSandbox)}catch(l){throw new Error("jsonPath: "+l.message+": "+e)}};p.cache={};p.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};p.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};p.toPathArray=function(e){let{cache:t}=p;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(o,s){return"[#"+(r.push(s)-1)+"]"}).replace(/\[['"]([^'\]]*)['"]\]/gu,function(o,s){return"['"+s.replace(/\./gu,"%@%").replace(/~/gu,"%%@@%%")+"']"}).replace(/~/gu,";~;").replace(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replace(/%@%/gu,".").replace(/%%@@%%/gu,"~").replace(/(?:;)?(\^+)(?:;)?/gu,function(o,s){return";"+s.split("").join(";")+";"}).replace(/;;;|;;/gu,";..;").replace(/;$|'?\]|'$/gu,"").split(";").map(function(o){let s=o.match(/#(\d+)/u);return!s||!s[1]?o:r[s[1]]});return t[e]=n,t[e].concat()};p.prototype.vm=Ct.default;function wt(e){return e.replace(/(\[[^\]\[]+\]|\.\*)$/g,"")}function ct(e){return wt(e)+".*"}function Q(e,t,r=!1,i=e){var n=t;let o=Object.keys(e).sort((a,l)=>l.length-a.length);for(let a of o)if(t.startsWith(a)){if(a==t){if(r)return e[a];continue}n=t.substring(a.length+1),i=e[a];break}var s=p({path:n,json:i});return Array.isArray(s)&&(s==null?void 0:s.length)==0&&(s=[n.replace(/^.*?\./,"_."),n.replace(/^.*?\./,""),n.replace(/^([^.]+).*?\.\$\./,"$1."),n.replace(/^.*?\.\$\./,"_."),n.replace(/^.*?\.\$\./,""),n.replace(/^[^.]+$/,"_")].filter((a,l,d)=>d.indexOf(a)===l).reduce((a,l)=>a.length>0?a:p({path:l,json:i}),[])),r&&Array.isArray(s)?s[0]:s}function dt(e,t={},r){return r?`<${r}${Object.entries(t).map(([i,n])=>n!=null&&` ${i}="${n}"`).filter(Boolean).join("")}>${M(e)}</${r}>`.replace(/^<([a-z0-9][^>]*)><\/[^>]+>$/,"<$1 />"):M(e)}function M(e){var t;if(Array.isArray(e))return e.map(M).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 dt(e.content,i,"h"+r);case"text":return(e.marks||[]).reduce((n,o)=>dt(n,o.attrs,{link:"a",bold:"strong",italic:"em",strike:"s",underline:"u"}[o.type]),(t=e.text)===null||t===void 0?void 0:t.replace(/\s+/," "));default:return dt(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 innerHTML(){return ht(this.childNodes)}set innerHTML(t){this.childNodes=ut(String(t!=null?t:""))}get outerHTML(){return ht([this])}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=o=>{for(let s of r)if(xt(s,o)){i.push(o);break}for(let s of o.childNodes)n(s)};for(let o of this.childNodes)n(o);return i}querySelector(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 o=n+t;o>=0&&o<i.length;o+=t){let s=i[o];if(!r||s.nodeType===1)return s}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 o=n[1],s=n[3],a=t.getAttribute(o);if(typeof s=="undefined"){if(a===void 0)return!1}else if(a!==s)return!1}else return!1}else if(t.nodeName!==i)return!1;return!0}function ut(e){var t;let r=[],i=[];for(;e;){let n=e.match(/^<([\w-]+)(\s[^>]*)?>/),o=e.match(/^<\/([\w-]+)>/);if(n){let s=n[1],l=((t=(n[2]||"").match(/([\w-]+)(="([^"]*)")?/g))===null||t===void 0?void 0:t.map(h=>{let[f,u,,c]=h.match(/([\w-]+)(="([^"]*)")?/);return{name:u,value:se(c||"")}}))||[],d=new P(s,1);if(d.attributes=l,i.length>0){let h=i[i.length-1];h.childNodes.push(d),d.parentNode=h}else r.push(d);i.push(d),e=e.slice(n[0].length)}else if(o)i.pop(),e=e.slice(o[0].length);else{let s=e.indexOf("<"),a=e.slice(0,s!==-1?s: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 oe(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function se(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'")}function ht(e){return e.map(t=>{if(t.nodeType===3)return t.textContent||"";let{nodeName:r,attributes:i}=t,n=i.map(({name:s,value:a})=>` ${s}="${oe(String(a))}"`).join(""),o=ht(t.childNodes);return["img","input","br"].includes(r)?`<${r}${n} />`:`<${r}${n}>${o}</${r}>`}).join("")}function St(e){let t=new e.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(i=>{let n=i.target,o=n.getAttribute("data-embed-src");o&&I(n,o),i.addedNodes&&i.addedNodes.forEach(s=>{s.nodeType==1&&Rt(s,!1)})})});return t.observe(e,{attributes:!0,subtree:!0,childList:!0}),t}function Rt(e,t=!0){let r=e.querySelectorAll("[data-embed-src]");for(var i=0;i<r.length;i++){let n=r[i];I(n,n.getAttribute("data-embed-src"))}if(t)return St(e)}function I(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 o=r.ownerDocument.createElement("script");o.setAttribute("type","module"),o.setAttribute("src",t),r.appendChild(o);break}}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 ae(e,t,r){let i=e.getAttribute("data-path-scope");if(i==null)return;var n=_t(e);if(n!=0)return;let o=e.parentNode;if(o!=null){t==0?e.setAttribute("hidden","hidden"):e.getAttribute("hidden")!=null&&e.removeAttribute("hidden");for(var s=n+1,a=e,l=e;l=l.nextElementSibling;)l.getAttribute("data-path-scope")==i&&(s++,a=l);for(var d=s;d<t;d++)o.insertBefore(a.cloneNode(!0),a.nextElementSibling);for(var d=Math.max(1,t);d<s;d++)a=a.previousElementSibling,o.removeChild(a.nextElementSibling)}}function O(e,t,r,i){var n;if(e){var o=e;(r==null?void 0:r.type)=="doc"&&Array.isArray(r.content)&&(r=M(r)),i!=null&&i.processValue&&(r=i==null?void 0:i.processValue(e,t,r));var s=t.replace("data-path-","");if(t=="data-path-src")o=e.tagName=="IMG"?e:e.querySelector("img, video");else if(t=="data-path-href")o=e.querySelector("a")||e.closest("a");else if(t=="data-path-alt")o=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")s="innerHTML";else if(t=="data-embed-src")I(e,r);else if(t=="data-path-attributes"){let f=((n=e.getAttribute("data-attributes-keys"))===null||n===void 0?void 0:n.split(",").filter(Boolean))||[];if(!Array.isArray(r))for(var a in r){var l=r[a];O(e,a,typeof l=="object"&&l?JSON.stringify(l):l,i)}for(var d=0;d<f.length;d++)(r==null||!(f[d]in r))&&O(e,f[d],null,i);O(e,"data-attributes-keys",Object.keys(r||{}).join(","));return}if(typeof r=="boolean"&&(r=r?"":null),!!o){var h=String(e.getAttribute("data-path-placeholder")||o[s]);r!=null?s=="innerHTML"?o.innerHTML!=r&&(o.innerHTML=r):o.getAttribute(s)!=r&&o.setAttribute(s,r):s=="innerHTML"?o.innerHTML=h:o.removeAttribute(s)}}}var kt=["data-attributes-keys","data-path-attributes","data-path-scope"];function w(e,t,r,i){var n,o,s;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=Q(t,h,!1)||[];u==0&&ae(a,((o=r==null?void 0:r.shouldRepeat)===null||o===void 0?void 0:o.call(r,a,c))===!1?1:c.length,r),t={...t,[ct(h)]:c[u]}}let f=Array.prototype.slice.call(a.attributes).sort((u,c)=>kt.indexOf(u.name)-kt.indexOf(c.name));for(var l=0;l<f.length;l++){let{name:u,value:c}=f[l];u.startsWith("data-path")&&u!="data-path-scope"&&O(a,u,Q(t,c,!0),r),u=="data-embed-src"&&O(a,u,a.getAttribute(u),r)}}for(var l=0,d;d=a.childNodes[l++];)Pt(d)&&w(d,t,r,!0);return i||(s=r==null?void 0:r.onRender)===null||s===void 0||s.call(r,a,t),a}function Pt(e){return e.nodeType==1}function L(e,t,r,i){var n;let o=((n=i==null?void 0:i.processTemplate)===null||n===void 0?void 0:n.call(i,e,t,r))||t;if(e.innerHTML=o,e.classList.add("-feaas"),(e.closest(".component.feaas")||e).className.includes("-theme--"))for(var a=0,l;l=e.childNodes[a++];)Pt(l)&&(l.className=l.className.replace(/(\s|^)-theme--[^\s]+\s*/g,"$1"));return w(e,r,i)}function le(e,t,r,i=!1){var n;let o=((n=r==null?void 0:r.processTemplate)===null||n===void 0?void 0:n.call(r,null,e,t))||e;if(typeof document=="undefined"||i){let s=ut(o);return w(s[0],t,r).outerHTML}else{let s=document.createElement("div");return s.innerHTML=o,w(s,t,r),s.innerHTML}}var Tt=["initial","check","updated"],B={};function de(){B={}}async function pt(e,t,r,i,n=B){return T({url:e,options:t,validator:r,callback:i,cache:n}).then(H).then(o=>o.response)}function Nt(e,t=!1){let r=String(e).replace("?head","");var i=B[r];return!i&&!t&&(i=B[r]={phase:null,initial:k(),check:k(),updated:k(),final:k()}),i}async function T({url:e,options:t,validator:r,callback:i,cache:n},o="initial"){let s=new Date;if(n!=null){var a=Nt(e);if(Tt.indexOf(a.phase)>=Tt.indexOf(o))var l=a[o];else a.phase=o}let d=await(l||fetch(e,t));if(!l&&a&&(d.ok?a[o].resolve(d):a[o].reject(new Error("Fetch failed"))),!d.ok)throw new Error("Fetch failed");if((r==null?void 0:r(d))===!1)throw new Error("Response is not valid");let h=new Date(d.headers.get("date"))<s||l&&o=="initial"&&(a.phase=="updated"||a.phase=="check");return await(i==null?void 0:i(d,o,h)),{url:e,options:t,isCached:h,response:d,validator:r,callback:i,cache:n}}async function H(e){let{url:t,isCached:r,options:i,validator:n,response:o,cache:s}=e;if(r){let{response:a}=await T({url:t+"?head",options:{...i,method:"HEAD",cache:"no-cache"},validator:n,cache:s},"check");if(a.headers.get("last-modified")!=o.headers.get("last-modified"))return X(e)}return e}async function X(e){return T({...e,options:{...e.options,cache:"reload"}},"updated")}var S="https://feaas.blob.core.windows.net";function W(e){let t=e.match(/^(?:(.*?)\/components)?\/?([^\/]+)\/([^\/]+)(?:\/([^\/]+)(?:\/(published|staged|saved|\d+)(?:\.html?)?)?)?$/);if(t){var[,r,i,n,o,s]=t;return{cdn:r,library:i,component:n,version:o,revision:s}}}function ce(e){if(!e||!e.library||!e.component)throw new Error("Component requires `library` and `component` properties");return`${e.cdn&&e.cdn!=S?`${e.cdn}/components`:""}/${e.library}/${e.component}/${!e.version||e.version=="responsive"&&(!e.revision||e.revision=="published")?"":e.version}/${!e.revision||e.revision=="published"?"":e.revision}`.replace(/(^\/|\/$|\/\/)(?!.+\/components\/)/g,"")}function he(e){return`${e.cdn&&e.cdn!=S?`${e.cdn}/styles/`:""}${e.library}/${!e.revision||e.revision=="published"?"":e.revision}`.replace(/\/$|\/\/(?!.+\/styles\/)/g,"")}function tt(e){let t=e.match(/^(?:(.*?)\/styles\/)?([^\/]+)(?:\/(published|staged|saved|\d+)(?:.css)?)?$/);if(t){var[,r,i,n]=t;return{cdn:r,library:i,revision:n}}else{let o=W(e);if(o){var{cdn:r,library:i,revision:n}=o;return n!=null&&n.match(/\d/)&&(n=void 0),{cdn:r,library:i,revision:n}}}}function ft(e){return typeof e=="string"&&(e={src:e}),"src"in e&&(e={...W(e.src)}),`${e.cdn||e.hostname||S}/components/${e.library}/${e.component}/${e.version}/${e.revision||"published"}.html`}function j(e){return typeof e=="string"&&(e={src:e}),"src"in e&&(e={...tt(e.src)}),`${e.cdn||e.hostname||S}/styles/${e.library}/${e.revision||"published"}.css`}async function $(e,t,r=!1){let i=a=>a.headers.get("x-ms-meta-versionDeletedAt")==null,n=a=>a.clone().text().then(t),o=await Promise.all([e.instance&&T({options:{headers:{Accept:"text/html"},credentials:"omit"},url:ft({...e,version:e.instance}),validator:i}).catch(a=>a),T({url:ft(e),validator:i}).catch(a=>a)]),s=o.find(a=>a&&"isCached"in a&&a);if(!s||s instanceof Error)throw o.find(l=>l&&l instanceof Error)||new Error("Can not fetch component");return o[0]==s&&console.log("Using fork!",o),await n(s.response),r?s:H({...s,callback:n}).catch(a=>{if(o[0]==s&&(X({...s,callback:null,validator:null}),console.log("Fork was deleted"),!(o[1]instanceof Error)))return n(o[1].response),H({...o[1],callback:n});throw a})}async function ue(e){typeof e=="string"&&(e={src:e});var t;let{response:r}=await $(e,i=>{t=i},!0);return{...e,template:t,lastModified:r.headers.get("last-modified")}}async function et(e,t){return typeof e=="string"&&(e={src:e}),pt(j(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 pe(e,t){return Mt(e,t||(t=document.createElement("style"))),t}function Mt(e,t){return t||(t=document.createElement("style")),et(e,(r,i)=>{t.textContent=r}).then(()=>t)}function rt(e,t){var r=Ot(e);if(!r)var i=Lt(e);return et(e,(n,o)=>{i&&(i.textContent=n),t==null||t(n,o)}).then(()=>r||i)}function gt(e){return new Promise((t,r)=>{rt(e,t).catch(r)})}function Ot(e){return document.head.querySelector(`style[data-href="${j(e)}"]`)}function Lt(e){let t=j(e),r=document.createElement("style");return r.setAttribute("data-href",t),document.head.appendChild(r),r}function fe(e,t){let r=document.createElement("div");r.innerHTML=e;let i=document.createDocumentFragment();for(;r.firstChild;)i.appendChild(r.firstChild);return w(i,t),r}function ge(e,t){return $t(e,t||(t=document.createElement("div"))),t}async function $t(e,t){return t||(t=document.createElement("div")),t.childNodes.length?w(t,e.data,e):"template"in e?L(t,e.template,e.data,e):$(e,r=>L(t,r,e.data,e)).then(()=>t)}function Dt(e=this){var t,r,i,n,o,s,a,l;let d,h=e.getAttribute("src");if(h){let v=W(h);if(!v)throw new Error(`Could not parse FEAAS Component source: ${h}`);var{cdn:f,library:u,component:c,version:g,revision:E}=v}let R=e.getAttribute("data");if(R!=null&&R!="")try{d=typeof R=="string"?JSON.parse(R):{}}catch(v){}return{data:d||{},cdn:(r=(t=e.getContextAttribute("cdn"))!==null&&t!==void 0?t:f)!==null&&r!==void 0?r:S,library:(i=e.getAttribute("library"))!==null&&i!==void 0?i:u,component:(n=e.getAttribute("component"))!==null&&n!==void 0?n:c,version:(s=(o=e.getAttribute("version"))!==null&&o!==void 0?o:g)!==null&&s!==void 0?s:"responsive",revision:(l=(a=e.getAttribute("revision"))!==null&&a!==void 0?a:E)!==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 z=class extends b{setData(t){this.set({data:t})}getProps(){return Dt(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:S,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=gt({...this.props,revision:"published"}).then(()=>{t=null,this.payload&&this.onLoad(this.payload)});return Promise.all([t,$(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)w(this,this.props.data);else{if(this.needsRefresh=!0,this.getOriginal())return;L(this,this.payload,this.props.data)}}};z.observedAttributes=["library","component","version","revision","hostname","cdn","template","data","instance","editable","with-stylesheet"];z.register("feaas-component");function Ft(e=this){return{opacity:e!=null&&e.getAttribute("opacity")?parseFloat(e==null?void 0:e.getAttribute("opacity")):1,hidden:(e==null?void 0:e.getAttribute("hidden"))!=null}}var V=class extends b{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return Ft(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 ae=Object.create;var Y=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var de=Object.getOwnPropertyNames;var ce=Object.getPrototypeOf,he=Object.prototype.hasOwnProperty;var Rt=(e,t)=>{for(var r in t)Y(e,r,{get:t[r],enumerable:!0})},_t=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of de(t))!he.call(e,n)&&n!==r&&Y(e,n,{get:()=>t[n],enumerable:!(i=le(t,n))||i.enumerable});return e};var ue=(e,t,r)=>(r=e!=null?ae(ce(e)):{},_t(t||!e||!e.__esModule?Y(r,"default",{value:e,enumerable:!0}):r,e)),pe=e=>_t(Y({},"__esModule",{value:!0}),e);var Ne={};Rt(Ne,{Base:()=>b,Component:()=>z,ComponentProps:()=>jt,DEFAULT_CDN_URL:()=>R,FEAASBase:()=>b,FEAASComponent:()=>z,FEAASComponentsProps:()=>jt,FEAASContext:()=>G,FEAASContextProps:()=>Xt,FEAASEditor:()=>q,FEAASEditorProps:()=>Qt,FEAASLoader:()=>J,FEAASLoaderProps:()=>Ht,FEAASPicker:()=>K,FEAASPickerProps:()=>Zt,FEAASStylesheet:()=>nt,FEAASStylesheetProps:()=>Vt,InvalidResponse:()=>X,JSONPath:()=>f,Loader:()=>J,MyComponent:()=>Q,Stylesheet:()=>nt,Thumbnail:()=>ot,autoloadScripts:()=>Pt,cleanCollectionBit:()=>Mt,clearFetchCache:()=>we,createStylesheet:()=>Wt,fetchAndRevalidate:()=>B,fetchAndRevalidateComponent:()=>$,fetchAndRevalidateStylesheet:()=>rt,fetchBypassingCache:()=>tt,fetchCache:()=>W,fetchComponent:()=>Se,fetchToValidateCache:()=>j,fetchWithCacheAwareness:()=>N,findStylesheet:()=>It,getComponentSource:()=>xe,getComponentURL:()=>mt,getFetchCache:()=>Ft,getFramePosition:()=>Yt,getQualifier:()=>ve,getStylesheetSource:()=>Ce,getStylesheetURL:()=>V,loadScript:()=>I,loadStylesheet:()=>it,loadStylesheetAllowStale:()=>gt,normalizeCollectionScope:()=>ft,observeDOMElement:()=>Nt,parseComponentSource:()=>H,parseLimit:()=>be,parseRange:()=>ye,parseStylesheetSource:()=>et,queryScopes:()=>Z,renderComponent:()=>bt,renderComponentElement:()=>_e,renderComponentPromise:()=>Bt,renderDOMContent:()=>O,renderDOMElement:()=>x,renderHTMLContent:()=>Ee,renderStylesheet:()=>Re,renderStylesheetPromise:()=>Ut,serializeCH1RichText:()=>M,setDOMAttribute:()=>L});module.exports=pe(Ne);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 fe=typeof HTMLElement=="undefined"?typeof windowJSDOM!="undefined"?windowJSDOM.HTMLElement:class{}:HTMLElement,b=class extends fe{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)}},Q=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))}};Q.observedAttributes=["counter"];var kt=ue(require("vm"),1),{hasOwnProperty:E}=Object.prototype;function k(e,t){return e=e.slice(),e.push(t),e}function dt(e,t){return t=t.slice(),t.unshift(e),t}var ct=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=E.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 ct(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(!E.call(e,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:t}=e),o=E.call(e,"flatten")?e.flatten:o,this.currResultType=E.call(e,"resultType")?e.resultType:this.currResultType,this.currSandbox=E.call(e,"sandbox")?e.sandbox:this.currSandbox,a=E.call(e,"wrap")?e.wrap:a,this.currPreventEval=E.call(e,"preventEval")?e.preventEval:this.currPreventEval,r=E.call(e,"callback")?e.callback:r,this.currOtherTypeCallback=E.call(e,"otherTypeCallback")?e.otherTypeCallback:this.currOtherTypeCallback,n=E.call(e,"parent")?e.parent:n,s=E.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&&E.call(t,d))u(this._trace(h,t[d],k(r,d),t,d,s,o));else if(d==="*")this._walk(t,c=>{u(this._trace(h,t[c],k(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],k(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:k(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],k(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(dt(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&&E.call(t,d.slice(1))){let c=d.slice(1);u(this._trace(h,t[c],k(r,c),t,c,s,o,!0))}else if(d.includes(",")){let c=d.split(",");for(let m of c)u(this._trace(dt(m,h),t,r,i,n,s,!0))}else!a&&t&&E.call(t,d)&&u(this._trace(h,t[d],k(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,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(dt(c,t),r,i,n,s,o,!0).forEach(y=>{u.push(y)});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=kt.default;function Z(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 ht(e,t={},r){return r?`<${r}${Object.entries(t).map(([i,n])=>n!=null&&` ${i}="${n}"`).filter(Boolean).join("")}>${M(e)}</${r}>`.replace(/^<([a-z0-9][^>]*)><\/[^>]+>$/,"<$1 />"):M(e)}function M(e){var t;if(Array.isArray(e))return e.map(M).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 ht(e.content,i,"h"+r);case"text":return(e.marks||[]).reduce((n,s)=>ht(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 ht(e.content||e.text,e.attrs,{bulletList:"ul",orderedList:"ol",listItem:"li",horizontalRule:"hr",paragraph:"p",codeBlock:"code",blockquote:"blockquote"}[e.type])}}var T=class{constructor(t,r=1,i){this.ownerDocument={createElement(n){return new T(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 ut(this.childNodes)}set innerHTML(t){this.childNodes=pt(String(t!=null?t:""))}get outerHTML(){return ut([this])}get children(){return this.childNodes.filter(t=>t.nodeType==1)}closest(t){let r=this;for(;r;){if(Tt(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(Tt(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 T(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 Tt(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 pt(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:ge(c||"")}}))||[],d=new T(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 T("#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 me(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function ge(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'")}function ut(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}="${me(String(a))}"`).join(""),s=ut(t.childNodes);return["img","input","br"].includes(r)?`<${r}${n} />`:`<${r}${n}>${s}</${r}>`}).join("")}function Nt(e){let t=new e.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(i=>{let n=i.target,s=n.getAttribute("data-embed-src");s&&I(n,s),i.addedNodes&&i.addedNodes.forEach(o=>{o.nodeType==1&&Pt(o,!1)})})});return t.observe(e,{attributes:!0,subtree:!0,childList:!0}),t}function Pt(e,t=!0){let r=e.querySelectorAll("[data-embed-src]");for(var i=0;i<r.length;i++){let n=r[i];I(n,n.getAttribute("data-embed-src"))}if(t)return Nt(e)}function I(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 be=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},ye=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 Mt(e){return e.replace(/(\[[^\]\[]+\]|\.\*)$/g,"")}function ft(e){return Mt(e)+".*"}function Ot(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 Ae(e,t,r){let i=e.getAttribute("data-path-scope");if(i==null)return;var n=Ot(e);if(n!=0)return;let s=e.parentNode;if(s!=null){t==0?e.setAttribute("hidden","hidden"):e.getAttribute("hidden")!=null&&e.removeAttribute("hidden");for(var o=n+1,a=e,l=e;l=l.nextElementSibling;)l.getAttribute("data-path-scope")==i&&(o++,a=l);for(var d=o;d<t;d++)s.insertBefore(a.cloneNode(!0),a.nextElementSibling);for(var d=Math.max(1,t);d<o;d++)a=a.previousElementSibling,s.removeChild(a.nextElementSibling)}}function L(e,t,r,i){var n,s;if(e){var o=e;(r==null?void 0:r.type)=="doc"&&Array.isArray(r.content)&&(r=M(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")I(e,r);else if(t=="data-path-attributes"){let u=((n=e.getAttribute("data-attributes-keys"))===null||n===void 0?void 0:n.split(",").filter(Boolean))||[];if(!Array.isArray(r))for(var l in r){var d=r[l];L(e,l,typeof d=="object"&&d?JSON.stringify(d):d,i)}for(var h=0;h<u.length;h++)(r==null||!(u[h]in r))&&L(e,u[h],null,i);L(e,"data-attributes-keys",Object.keys(r||{}).join(","));return}if(typeof r=="boolean"&&(r=r?"":null),!!o){var p=String((s=e.getAttribute("data-path-placeholder")||o[a])!==null&&s!==void 0?s:o.getAttribute(a));r!=null?a=="innerHTML"?o.innerHTML!=r&&(o.innerHTML=r):o.getAttribute(a)!=r&&o.setAttribute(a,r):a=="innerHTML"?o.innerHTML=p:o.removeAttribute(a)}}}var Lt=["data-attributes-keys","data-path-attributes","data-path-scope"];function x(e,t,r,i){var n,s,o;let a=e;if(i||(t=((n=r==null?void 0:r.processData)===null||n===void 0?void 0:n.call(r,a,t))||t),a.nodeType==1){let h=a.getAttribute("data-path-scope");if(h){let u=Ot(a),c=Z(t,h,!1)||[];u==0&&Ae(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,[ft(h)]:c[u]}}let p=Array.prototype.slice.call(a.attributes).sort((u,c)=>Lt.indexOf(u.name)-Lt.indexOf(c.name));for(var l=0;l<p.length;l++){let{name:u,value:c}=p[l];u.startsWith("data-path")&&u!="data-path-scope"&&L(a,u,Z(t,c,!0),r),u=="data-embed-src"&&L(a,u,a.getAttribute(u),r)}}for(var l=0,d;d=a.childNodes[l++];)$t(d)&&x(d,t,r,!0);return i||(o=r==null?void 0:r.onRender)===null||o===void 0||o.call(r,a,t),a}function $t(e){return e.nodeType==1}function O(e,t,r,i){var n;let s=((n=i==null?void 0:i.processTemplate)===null||n===void 0?void 0:n.call(i,e,t,r))||t;if(e.innerHTML=s,e.classList.add("-feaas"),(e.closest(".component.feaas")||e).className.includes("-theme--"))for(var a=0,l;l=e.childNodes[a++];)$t(l)&&(l.className=l.className.replace(/(\s|^)-theme--[^\s]+\s*/g,"$1"));return x(e,r,i)}function Ee(e,t,r,i=!1){var n;let s=((n=r==null?void 0:r.processTemplate)===null||n===void 0?void 0:n.call(r,null,e,t))||e;if(typeof document=="undefined"||i){let o=pt(s);return x(o[0],t,r).outerHTML}else{let o=document.createElement("div");return o.innerHTML=s,x(o,t,r),o.innerHTML}}var Dt=["initial","check","updated"],W={};function we(){W={}}async function B(e,t,r,i,n=W){return N({url:e,options:t,validator:r,callback:i,cache:n}).then(j).then(s=>s.response)}function Ft(e,t=!1){let r=String(e).replace("?head","");var i=W[r];return!i&&!t&&(i=W[r]={phase:null,initial:S(),check:S(),updated:S(),final:S()}),i}var X=class extends Error{};async function N({url:e,options:t,validator:r,callback:i,cache:n},s="initial"){let o=new Date;if(n!=null){var a=Ft(e);if(Dt.indexOf(a.phase)>=Dt.indexOf(s))var l=a[s];else a.phase=s}let d=await(l||fetch(e,t));if(!l&&a&&(d.ok?a[s].resolve(d):a[s].reject(new Error("Fetch failed"))),!d.ok)throw new Error("Fetch failed");let h=new Date(d.headers.get("date"))<o||l&&s=="initial"&&(a.phase=="updated"||a.phase=="check");if((r==null?void 0:r(d,h))===!1)throw new X("Response is not valid");return await(i==null?void 0:i(d,s,h)),{url:e,options:t,isCached:h,response:d,validator:r,callback:i,cache:n}}async function j(e){let{url:t,isCached:r,options:i,validator:n,response:s,cache:o}=e;if(r){let{response:a}=await N({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 tt(e)}return e}async function tt(e){return N({...e,options:{...e.options,cache:"reload"}},"updated")}var R="https://feaas.blob.core.windows.net";function H(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 xe(e){if(!e||!e.library||!e.component)throw new Error("Component requires `library` and `component` properties");return`${e.cdn&&e.cdn!=R?`${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 Ce(e){return`${e.cdn&&e.cdn!=R?`${e.cdn}/styles/`:""}${e.library}/${!e.revision||e.revision=="published"?"":e.revision}`.replace(/\/$|\/\/(?!.+\/styles\/)/g,"")}function et(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=H(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 mt(e){return typeof e=="string"&&(e={src:e}),"src"in e&&(e={...H(e.src)}),`${e.cdn||e.hostname||R}/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={...et(e.src)}),`${e.cdn||e.hostname||R}/styles/${e.library}/${e.revision||"published"}.css`}async function $(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&&N({options:{headers:{Accept:"text/html"},credentials:"omit"},url:mt({...e,version:e.instance}),validator:i}).catch(a=>a),N({url:mt(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:j({...o,callback:n}).catch(a=>{if(s[0]==o&&(tt({...o,callback:null,validator:null}),console.log("Fork was deleted"),!(s[1]instanceof Error)))return n(s[1].response),j({...s[1],callback:n});throw a})}async function Se(e){typeof e=="string"&&(e={src:e});var t;let{response:r}=await $(e,i=>{t=i},!0);return{...e,template:t,lastModified:r.headers.get("last-modified")}}async function rt(e,t){return typeof e=="string"&&(e={src:e}),B(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 Re(e,t){return Ut(e,t||(t=document.createElement("style"))),t}function Ut(e,t){return t||(t=document.createElement("style")),rt(e,(r,i)=>{t.textContent=r}).then(()=>t)}function it(e,t){var r=It(e);if(!r)var i=Wt(e);return rt(e,(n,s)=>{i&&(i.textContent=n),t==null||t(n,s)}).then(()=>r||i)}function gt(e){return new Promise((t,r)=>{it(e,t).catch(r)})}function It(e){return document.head.querySelector(`style[data-href="${V(e)}"]`)}function Wt(e){let t=V(e),r=document.createElement("style");return r.setAttribute("data-href",t),document.head.appendChild(r),r}function _e(e,t){let r=document.createElement("div");r.innerHTML=e;let i=document.createDocumentFragment();for(;r.firstChild;)i.appendChild(r.firstChild);return x(i,t),r}function bt(e,t){return Bt(e,t||(t=document.createElement("div"))),t}async function Bt(e,t){return t||(t=document.createElement("div")),t.childNodes.length?x(t,e.data,e):"template"in e?O(t,e.template,e.data,e):$(e,r=>O(t,r,e.data,e)).then(()=>t)}function jt(e){var t,r,i,n,s,o,a,l;let d,h=e.getAttribute("src");if(h){let A=H(h);if(!A)throw new Error(`Could not parse FEAAS Component source: ${h}`);var{cdn:p,library:u,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:R,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: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 z=class extends b{setData(t){this.set({data:t})}getProps(){return jt(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:R,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=gt({...this.props,revision:"published"}).then(()=>{t=null,this.payload&&this.onLoad(this.payload)});return Promise.all([t,$(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)x(this,this.props.data);else{if(this.needsRefresh=!0,this.getOriginal())return;O(this,this.payload,this.props.data)}}};z.observedAttributes=["library","component","version","revision","hostname","cdn","template","data","instance","editable","with-stylesheet"];z.register("feaas-component");function Ht(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 J=class extends b{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return Ht(this)}attributeChangedCallback(t,r,i){if(r!==i)return t=="hidden"&&(this.style.setProperty("display","block","important"),this.style.setProperty("transition","opacity 0.3s","important"),i?(this.style.setProperty("opacity","0","important"),this.style.pointerEvents="none"):(this.style.setProperty("opacity","1","important"),this.style.pointerEvents="all")),super.attributeChangedCallback(t,r,i)}connectedCallback(){this.payload=null,super.connectedCallback(),this.attributeChangedCallback("hidden",this.getAttribute("hidden"),this.getAttribute("hidden")),this.stylesheet=document.createElement("style"),this.stylesheet.textContent=`
|
|
3
3
|
#loader {
|
|
4
4
|
position: absolute;
|
|
5
5
|
top: 0;
|
|
@@ -63,5 +63,8 @@ var Yt=Object.create;var Y=Object.defineProperty;var Zt=Object.getOwnPropertyDes
|
|
|
63
63
|
style="animation: 1.5s linear 0s infinite normal none running loader-circular-track"
|
|
64
64
|
></circle>
|
|
65
65
|
</svg>
|
|
66
|
-
</div>`,this.getRoot().appendChild(this.stylesheet),this.getRoot().appendChild(this.loader)}update(){this.loader.style.opacity=String(this.props.opacity)}};V.observedAttributes=["hidden","opacity"];V.register("feaas-loader");function Ut(e=this){var t,r,i,n;let o=e.getAttribute("src");if(o)var{cdn:s,library:a,revision:l}=tt(o);return{library:e==null?void 0:e.getContextAttribute("library"),revision:(r=(t=e==null?void 0:e.getAttribute("revision"))!==null&&t!==void 0?t:l)!==null&&r!==void 0?r:"published",cdn:(n=(i=e==null?void 0:e.getContextAttribute("cdn"))!==null&&i!==void 0?i:e==null?void 0:e.getContextAttribute("hostname"))!==null&&n!==void 0?n:S}}var it=class extends b{constructor(){super(...arguments),this.onLoad=t=>{this.payload=t,this.advance()}}getProps(){return Ut(this)}isReadyToLoad(){return this.props.library!=null&&this.props.revision!=null&&this.props.cdn!=null}load(){return rt(this.props,this.onLoad)}};it.register("feaas-stylesheet");var mt;typeof window!="undefined"&&(window.FEAASElement=N,(mt=window.FEAASLoading)!==null&&mt!==void 0||(window.FEAASLoading=Promise.resolve()));function It(e){let t=[];if(e){let r=e.ownerDocument.defaultView,i,n;for(;r!==window.top;){i=r.parent;for(let o=0;o<i.frames.length;o++)if(i.frames[o]===r){for(let s of i.document.getElementsByTagName("iframe"))if(s.contentWindow===r){n=s.getBoundingClientRect();let a=s.contentWindow.getComputedStyle(s);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 Bt(e=this){var t;return{context:HTMLElement,frontend:e==null?void 0:e.getContextAttribute("frontend"),src:(t=e==null?void 0:e.getAttribute("src"))!==null&&t!==void 0?t:"/editor.js",library:e==null?void 0:e.getAttribute("library"),component:e==null?void 0:e.getAttribute("component"),version:e==null?void 0:e.getAttribute("version"),instance:e==null?void 0:e.getAttribute("instance"),forked:e==null?void 0:e.getAttribute("forked"),revision:(e==null?void 0:e.getAttribute("revision"))||"saved",hidden:(e==null?void 0:e.getAttribute("hidden"))!=null,for:e==null?void 0:e.getAttribute("for"),state:(e==null?void 0:e.getAttribute("state"))||"idle",changed:(e==null?void 0:e.getAttribute("changed"))!=null}}var 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=It(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 Bt(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(),o=document.body.getBoundingClientRect(),s=this.measurements[this.editedUID];s&&(Object.assign(n.clipper.style,{position:"absolute",top:i.top+this.iframe.clientTop-o.top+"px",left:i.left+this.iframe.clientLeft-o.left+"px",width:t+"px",height:r+"px",pointerEvents:"none",zIndex:1,overflow:"hidden"}),Object.assign(n.positionable.style,{position:"absolute",top:s.top+"px",left:s.left+"px",width:s.width+"px",zIndex:2,transition:"opacity 0.4s",pointerEvents:this.props.hidden?"none":"all"}),Object.assign(n.loader.style,{position:"absolute",top:s.top+"px",left:s.left+"px",width:s.width+"px",height:s.height+"px",filter:"opacity(0.6)",zIndex:3,pointerEvents:"none"}),document.dispatchEvent(new Event("feaasRefresh",{bubbles:!0})))}getPlaceholder(){return this.placeholder?this.placeholder:(this.placeholder={clipper:document.createElement("div"),positionable:document.createElement("div"),editable:Object.assign(document.createElement("div"),{className:"-feaas"}),loader:document.createElement("feaas-loader")},this.placeholder.clipper.appendChild(this.placeholder.positionable),this.placeholder.positionable.appendChild(this.placeholder.editable),this.placeholder.clipper.appendChild(this.placeholder.loader),this.placeholder)}attributeChangedCallback(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:o,VersionStatusList:s,VersionStatusButton:a,Version:l,VersionMenu:d,EditorUIUndo:h,EditorUIMode:f,React:{useEffect:u,useMemo:c,useState:g,useContext:E},Chakra:{HStack:R,Box:v,Button:bt,MenuItem:yt},Chrome:jt,ReactDOM:be,useSDK:zt,useSlots:Vt,useModelObserver:qt,ConfirmationContext:Jt,VersionContext:ye}){if(!this.payload)return;let{React:m}=this.payload,{sdk:G}=zt(),[y,vt]=g(),{setConfirm:nt}=E(Jt),D=n||i,Kt=G.library;y&&(this.component=y),u(()=>{if(this.props.hidden)return;let x=Kt.components.getItem(r).clone();return x.versions.search({ids:[i,n].filter(Boolean),componentIds:[r]}).then(ot=>{x.versions.setItems(ot);let C=x.findVersion(n,["staged","published"]),U=x.findVersion(i,["staged","published"]);if(C)C.deletedAt?(C.getDraft().changeAndNotify(U.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(U)){console.error("FEAAS Editor: Forking");let st=U.fork(n).id;this.setAttribute("instance",st)}else console.error("FEAAS Editor: Regular");vt(x)}),()=>{this.closing=setTimeout(()=>{this.closing=null,this.cleanup(),vt(null)},400)}},[i,this.props.hidden]);let At=qt(y==null?void 0:y.versions,[]).filter(x=>x.id==D),F=At[0];F&&!this.props.hidden&&(this.version=F),u(()=>(this.unfork=()=>{nt({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(D).revert(),y.saveVersions(!1),this.setVersionContext({needsWrite:!0}))},this.close=()=>{nt({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=()=>{nt({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(D).commitData({view:this.editorContext.editor.getData({rootName:D}),model:""}).stage().publish(),this.removeAttribute("changed"),this.setAttribute("forked",D),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 Gt=c(()=>this.target,[y]);return c(()=>y&&Vt(t,({picker:x,children:ot})=>m.createElement(v,{ref:C=>{this.chrome=C?{positionable:C,wrapper:C.querySelector(".editor-chrome"),absolute:this.querySelector(".ui.overlays")}:null}},m.createElement(v,{className:"editor-wrapper",position:"absolute",left:0,top:0},m.createElement(o,{datasources:G.datasources,sdk:G,library:G.library,component:y,versions:At,context:{isAutosaveEnabled:!1,onChromeMeasure:this.onMeasure,onChromeBeforeMeasure:this.onBeforeMeasure,onChromeMeasureElement:this.onChromeMeasureElement,onChromePosition:this.onPosition,onContentChange:this.onContentChange}},{exports:this.onEditorStateChange,after:ot,chrome:({editor:C})=>C&&m.createElement(jt,null),children:({isArchivedDisplayed:C,editor:U,status:st})=>m.createElement(v,{position:"absolute",left:0,top:0,className:"editor-chrome",p:4,boxShadow:"2xl",pointerEvents:"none",opacity:0,transition:"opacity 0.3s"},m.createElement(v,{left:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),m.createElement(v,{right:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),m.createElement(v,{top:0,height:"16",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),m.createElement(v,{bottom:0,height:"4",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),F&&m.createElement(l,{version:F,node:Gt,ignoreBreakpoints:!0,deps:[this.props.forked,this.props.changed]},{exports:this.onVersionStateChange,left:m.createElement(R,{justifyContent:"space-between"},m.createElement(h,{size:"sm",editor:st=="ready"?U:null}),m.createElement(f,{size:"sm"})),middle:(ve,Ae)=>[!1],right:m.createElement(m.Fragment,null,m.createElement(bt,{variant:"secondary",size:"sm",onClick:this.close},"Close"),m.createElement(bt,{variant:"primary",size:"sm",onClick:this.save,isDisabled:!this.props.changed},this.props.changed?this.props.forked?"Save":"Save customization":"Up to date"),m.createElement(d,{isDisabled:!this.props.forked&&!this.props.changed},m.createElement(yt,{onClick:this.unfork,isDisabled:!this.props.forked},"Unfork"),m.createElement(yt,{onClick:this.discard,isDisabled:!this.props.changed},"Discard")))}))})))),[F,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 Ht(e=this){var t,r;return{part:(e==null?void 0:e.getAttribute("part"))||"picker",slot:(e==null?void 0:e.getAttribute("part"))||"picker",mode:e==null?void 0:e.getAttribute("mode"),placeholder:(e==null?void 0:e.getAttribute("placeholder"))||"No theme",frontend:(t=e==null?void 0:e.getContextAttribute("frontend"))!==null&&t!==void 0?t:"https://components.sitecorecloud.io",src:(r=e==null?void 0:e.getAttribute("src"))!==null&&r!==void 0?r:"/picker.js",hidden:(e==null?void 0:e.getAttribute("hidden"))!=null,variant:e==null?void 0:e.getAttribute("variant"),context:void 0,onClose:void 0,onContextAttributeSet:void 0}}var J=class extends b{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return Ht(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:o},{Picker:s,React:a,ReactDOM:l}){return a.createElement(s,{placeholder:t,mode:i||void 0,onClose:this.props.onClose,onContextAttributeSet:this.props.onContextAttributeSet,context:r,variant:o},n)}};J.observedAttributes=["library","mode","frontend","src","hidden","variant"];J.register("feaas-picker");function Wt(e=this){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 K=class extends b{constructor(){super(...arguments),this.defaultProps={isolate:!0},this.onStatusChange=t=>{t=="ready"&&this.dispatchEvent(new Event("feaasReady",{bubbles:!0,composed:!0}))}}getProps(){return Wt(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:o},React:s}){let a={containerRef:{current:this.getRoot()}};return o.defaultProps={hasArrow:!0,placement:"top",portalProps:a},s.createElement(i,{backend:this.props.backend,libraryId:this.props.library,container:this.getRoot(),auth:this.props.auth,getTheme:this.getTheme,onStatusChange:this.onStatusChange,modalProps:{portalProps:a},chakraProps:{cssVarsRoot:":host",resetCSS:!0,toastOptions:{portalProps:a}}},t)}};K.observedAttributes=["library","component","version","revision","hostname","template"];K.register("feaas-context");0&&(module.exports={Base,Component,ComponentProps,DEFAULT_CDN_URL,FEAASBase,FEAASComponent,FEAASComponentsProps,FEAASContext,FEAASContextProps,FEAASEditor,FEAASEditorProps,FEAASLoader,FEAASLoaderProps,FEAASPicker,FEAASPickerProps,FEAASStylesheet,FEAASStylesheetProps,JSONPath,Loader,MyComponent,Stylesheet,autoloadScripts,cleanCollectionBit,clearFetchCache,createStylesheet,fetchAndRevalidate,fetchAndRevalidateComponent,fetchAndRevalidateStylesheet,fetchBypassingCache,fetchCache,fetchComponent,fetchToValidateCache,fetchWithCacheAwareness,findStylesheet,getComponentSource,getComponentURL,getFetchCache,getFramePosition,getStylesheetSource,getStylesheetURL,loadScript,loadStylesheet,loadStylesheetAllowStale,normalizeCollectionScope,observeDOMElement,parseComponentSource,parseStylesheetSource,queryScopes,renderComponent,renderComponentElement,renderComponentPromise,renderDOMContent,renderDOMElement,renderHTMLContent,renderStylesheet,renderStylesheetPromise,serializeCH1RichText,setDOMAttribute});
|
|
66
|
+
</div>`,this.getRoot().appendChild(this.stylesheet),this.getRoot().appendChild(this.loader)}update(){this.loader.style.opacity=String(this.props.opacity)}};J.observedAttributes=["hidden","opacity"];J.register("feaas-loader");function Vt(e){var t,r,i,n;let s=e.getAttribute("src");if(s)var{cdn:o,library:a,revision:l}=et(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:R}}var nt=class extends b{constructor(){super(...arguments),this.onLoad=t=>{this.payload=t,this.advance()}}getProps(){return Vt(this)}isReadyToLoad(){return this.props.library!=null&&this.props.revision!=null&&this.props.cdn!=null}load(){return it(this.props,this.onLoad)}};nt.register("feaas-stylesheet");var ot={};Rt(ot,{convertBase64toBlob:()=>zt,generate:()=>Kt,get:()=>ke,getVersionForThumbnail:()=>Jt,load:()=>qt,responseToImage:()=>yt,upload:()=>Gt});var zt=e=>fetch(e).then(t=>t.blob()),yt=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 Jt(e){return e.versions.length||await e.versions.fetch(),e.getVersionForWidth(800)}async function ke(e,t,r){try{if(!e.isNew)return await qt(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 Kt(e,t);return r==null||r(i,!1),i&&!e.isNew&&zt(i.src).then(n=>Gt(e,t,n)),i}async function qt(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 B(i,{},(a,l)=>{let d=Math.abs(Number(new Date(a.headers.get("x-ms-meta-componentRenderedAt")))-Number(s))<2e3;return l&&!d&&yt(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}`),yt(a).then(h=>{o=h,r(h,d)})},null),o}async function Kt(e,t){let r=t||(e.isNew?null:await Jt(e));if(!r||r.isViewEmpty())return null;let{stylesheet:i,datasources:n}=e.library;return await Te(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 Te(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 y=new Image;y.onload=()=>{a(y)},y.onerror=l,y.src=m})})},o.contentWindow.document.head.appendChild(d);let h=o.contentWindow.document.createElement("style");h.textContent=`
|
|
67
|
+
${n}
|
|
68
|
+
body, html { padding: 0; margin: 0; overflow: hidden }
|
|
69
|
+
`,o.contentWindow.document.head.appendChild(h);let p=bt({template:r,data:i});p.classList.add(...e,"-feaas--preview","-emulate--"+t.details.slug),o.contentWindow.document.body.appendChild(p)})}async function Gt(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 vt;typeof window!="undefined"&&(window.FEAASElement=P,(vt=window.FEAASLoading)!==null&&vt!==void 0||(window.FEAASLoading=Promise.resolve()));function Yt(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 Qt(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=Yt(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 Qt(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:y},Chakra:{HStack:_,Box:A,Button:At,MenuItem:Et},Chrome:te,ReactDOM:Pe,useSDK:ee,useLibrary:re,useSlots:ie,useModelObserver:ne,ConfirmationContext:oe,VersionContext:Me}){if(!this.payload)return;let{React:g}=this.payload,wt=ee(),xt=re(),[v,Ct]=m(),{setConfirm:st}=y(oe),D=n||i;v&&(this.component=v),u(()=>{if(this.props.hidden)return;let C=xt.components.getItem(r).clone();return C.versions.search({ids:[i,n].filter(Boolean),componentIds:[r]}).then(at=>{C.versions.setItems(at);let w=C.findVersion(n,["staged","published"]),U=C.findVersion(i,["staged","published"]);if(w)w.deletedAt?(w.getDraft().changeAndNotify(U.toProperties()).restore(),console.error("FEAAS Editor: Restoring fork")):(console.error("FEAAS Editor: Pre-forked"),this.setAttribute("forked",w.id));else if(this.removeAttribute("forked"),this.shouldFork(U)){console.error("FEAAS Editor: Forking");let lt=U.fork(n).id;this.setAttribute("instance",lt)}else console.error("FEAAS Editor: Regular");Ct(C)}),()=>{this.closing=setTimeout(()=>{this.closing=null,this.cleanup(),Ct(null)},400)}},[i,this.props.hidden]);let St=ne(v==null?void 0:v.versions,[]).filter(C=>C.id==D),F=St[0];F&&!this.props.hidden&&(this.version=F),u(()=>(this.unfork=()=>{st({title:"Reverting component customizations",button:"Discard",body:"Are you sure to reset component to its original state? All changes will be lost.",action:()=>{let C=v.findVersion(i,["staged","published"]);v.findVersion(n).unstage().unpublish().changeAndNotify(C.toProperties()),v.saveVersions(!1),this.setVersionContext({needsWrite:!0}),this.removeAttribute("forked"),requestAnimationFrame(this.onClose)}})},this.discard=()=>{this.props.changed&&(v.findVersion(D).revert(),v.saveVersions(!1),this.setVersionContext({needsWrite:!0}))},this.close=()=>{st({title:"Component has unsaved changes",button:"Discard",body:"Are you sure to close editor and discard changes?",bypass:!this.props.changed,action:()=>{this.discard(),requestAnimationFrame(this.onClose)}})},this.save=()=>{st({bypass:!!this.props.forked,title:"Customizing component",button:"Save",body:"Changes to the component will only be visible on that page. Changes to component done in Component Builder will not be reflected here. It will be possible to revert the customization.",action:()=>{v.findVersion(D).commitData({view:this.editorContext.editor.getData({rootName:D}),model:""}).stage().publish(),this.removeAttribute("changed"),this.setAttribute("forked",D),v.saveVersions(!1)}})},()=>{delete this.unfork,delete this.discard,delete this.save,delete this.editorContext,delete this.versionContext,delete this.setEditorContext,delete this.setVersionContext}),[v]);let se=c(()=>this.target,[v]);return c(()=>v&&ie(t,({picker:C,children:at})=>g.createElement(A,{ref:w=>{this.chrome=w?{positionable:w,wrapper:w.querySelector(".editor-chrome"),absolute:this.querySelector(".ui.overlays")}:null}},g.createElement(A,{className:"editor-wrapper",position:"absolute",left:0,top:0},g.createElement(s,{datasources:wt.datasources,sdk:wt,library:xt,component:v,versions:St,context:{isAutosaveEnabled:!1,onChromeMeasure:this.onMeasure,onChromeBeforeMeasure:this.onBeforeMeasure,onChromeMeasureElement:this.onChromeMeasureElement,onChromePosition:this.onPosition,onContentChange:this.onContentChange}},{exports:this.onEditorStateChange,after:at,chrome:({editor:w})=>w&&g.createElement(te,null),children:({isArchivedDisplayed:w,editor:U,status:lt})=>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"}),F&&g.createElement(l,{version:F,node:se,ignoreBreakpoints:!0,deps:[this.props.forked,this.props.changed]},{exports:this.onVersionStateChange,left:g.createElement(_,{justifyContent:"space-between"},g.createElement(h,{size:"sm",editor:lt=="ready"?U:null}),g.createElement(p,{size:"sm"})),middle:(Le,Oe)=>[!1],right:g.createElement(g.Fragment,null,g.createElement(At,{variant:"secondary",size:"sm",onClick:this.close},"Close"),g.createElement(At,{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(Et,{onClick:this.unfork,isDisabled:!this.props.forked},"Unfork"),g.createElement(Et,{onClick:this.discard,isDisabled:!this.props.changed},"Discard")))}))})))),[F,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 Zt(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 K=class extends b{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return Zt(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)}};K.observedAttributes=["library","mode","frontend","src","hidden","variant"];K.register("feaas-picker");function Xt(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 G=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 Xt(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)}};G.observedAttributes=["library","component","version","revision","hostname","template"];G.register("feaas-context");0&&(module.exports={Base,Component,ComponentProps,DEFAULT_CDN_URL,FEAASBase,FEAASComponent,FEAASComponentsProps,FEAASContext,FEAASContextProps,FEAASEditor,FEAASEditorProps,FEAASLoader,FEAASLoaderProps,FEAASPicker,FEAASPickerProps,FEAASStylesheet,FEAASStylesheetProps,InvalidResponse,JSONPath,Loader,MyComponent,Stylesheet,Thumbnail,autoloadScripts,cleanCollectionBit,clearFetchCache,createStylesheet,fetchAndRevalidate,fetchAndRevalidateComponent,fetchAndRevalidateStylesheet,fetchBypassingCache,fetchCache,fetchComponent,fetchToValidateCache,fetchWithCacheAwareness,findStylesheet,getComponentSource,getComponentURL,getFetchCache,getFramePosition,getQualifier,getStylesheetSource,getStylesheetURL,loadScript,loadStylesheet,loadStylesheetAllowStale,normalizeCollectionScope,observeDOMElement,parseComponentSource,parseLimit,parseRange,parseStylesheetSource,queryScopes,renderComponent,renderComponentElement,renderComponentPromise,renderDOMContent,renderDOMElement,renderHTMLContent,renderStylesheet,renderStylesheetPromise,serializeCH1RichText,setDOMAttribute});
|
|
67
70
|
//# sourceMappingURL=index.cjs.map
|