@sitecore-feaas/clientside 0.1.23 → 0.1.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/build/components/FEAASBase.js +14 -7
  2. package/build/components/FEAASBase.js.map +1 -1
  3. package/build/components/FEAASComponent.js +10 -9
  4. package/build/components/FEAASComponent.js.map +1 -1
  5. package/build/components/FEAASElement.js +30 -0
  6. package/build/components/FEAASElement.js.map +1 -1
  7. package/build/components/FEAASLoader.js +2 -1
  8. package/build/components/FEAASLoader.js.map +1 -1
  9. package/build/dom.js +8 -5
  10. package/build/dom.js.map +1 -1
  11. package/build/fetch.js +0 -1
  12. package/build/fetch.js.map +1 -1
  13. package/build/ui/FEAASContext.js +13 -1
  14. package/build/ui/FEAASContext.js.map +1 -1
  15. package/dist/browser/basic.esm.js +5 -5
  16. package/dist/browser/basic.esm.js.map +1 -1
  17. package/dist/browser/basic.js +5 -5
  18. package/dist/browser/basic.js.map +1 -1
  19. package/dist/browser/index.esm.js +5 -5
  20. package/dist/browser/index.esm.js.map +1 -1
  21. package/dist/browser/index.js +5 -5
  22. package/dist/browser/index.js.map +1 -1
  23. package/dist/node/basic.esm.js +3 -3
  24. package/dist/node/basic.esm.js.map +1 -1
  25. package/dist/node/basic.js +3 -3
  26. package/dist/node/basic.js.map +1 -1
  27. package/dist/node/index.esm.js +3 -3
  28. package/dist/node/index.esm.js.map +1 -1
  29. package/dist/node/index.js +3 -3
  30. package/dist/node/index.js.map +1 -1
  31. package/examples/index.html +0 -8
  32. package/package.json +4 -4
  33. package/src/components/FEAASBase.tsx +11 -3
  34. package/src/components/FEAASElement.tsx +33 -0
  35. package/src/dom.ts +13 -10
  36. package/src/fetch.ts +0 -1
  37. package/src/ui/FEAASContext.tsx +12 -0
  38. package/src/ui/FEAASEditor.tsx +1 -1
  39. package/src/ui/FEAASPicker.tsx +1 -1
  40. package/test/tsconfig.json +1 -1
  41. package/types/components/FEAASBase.d.ts +4 -2
  42. package/types/components/FEAASBase.d.ts.map +1 -1
  43. package/types/components/FEAASComponent.d.ts +1 -1
  44. package/types/components/FEAASComponent.d.ts.map +1 -1
  45. package/types/components/FEAASElement.d.ts +15 -3
  46. package/types/components/FEAASElement.d.ts.map +1 -1
  47. package/types/components/FEAASLoader.d.ts +1 -1
  48. package/types/components/FEAASLoader.d.ts.map +1 -1
  49. package/types/components/FEAASStylesheet.d.ts +1 -1
  50. package/types/components/FEAASStylesheet.d.ts.map +1 -1
  51. package/types/dom.d.ts +3 -3
  52. package/types/dom.d.ts.map +1 -1
  53. package/types/fetch.d.ts.map +1 -1
  54. package/types/tsbuildinfo +1 -1
  55. package/types/tsbuildinfo_ui +1 -1
  56. package/types/ui/FEAASContext.d.ts +2 -0
  57. package/types/ui/FEAASContext.d.ts.map +1 -1
  58. package/types/ui/FEAASEditor.d.ts +1 -1
  59. package/types/ui/FEAASEditor.d.ts.map +1 -1
  60. package/types/ui/FEAASPicker.d.ts +1 -1
  61. package/types/ui/FEAASPicker.d.ts.map +1 -1
@@ -1,7 +1,7 @@
1
- var J=Object.defineProperty;var Et=Object.getOwnPropertyDescriptor;var Ft=Object.getOwnPropertyNames;var _t=Object.prototype.hasOwnProperty;var St=(t,e)=>{for(var r in e)J(t,r,{get:e[r],enumerable:!0})},xt=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ft(e))!_t.call(t,i)&&i!==r&&J(t,i,{get:()=>e[i],enumerable:!(n=Et(e,i))||n.enumerable});return t};var Rt=t=>xt(J({},"__esModule",{value:!0}),t);var Kt={};St(Kt,{Base:()=>m,Component:()=>T,FEAASBase:()=>m,FEAASComponent:()=>T,FEAASComponentsProps:()=>yt,FEAASLoader:()=>N,FEAASLoaderProps:()=>vt,FEAASStylesheet:()=>W,FEAASStylesheetProps:()=>bt,JSONPath:()=>d,Loader:()=>N,Stylesheet:()=>W,autoloadScripts:()=>ft,cleanCollectionBit:()=>ut,fetchAndRevalidate:()=>Y,fetchAndValidate:()=>F,invalidateRequest:()=>B,loadScript:()=>H,normalizeCollectionScope:()=>ct,observeDOMElement:()=>ht,queryScopes:()=>X,refetchAndValidate:()=>O,renderComponent:()=>Jt,renderComponentElement:()=>Wt,renderComponentPromise:()=>pt,renderDOMContent:()=>P,renderDOMElement:()=>_,renderStylesheet:()=>zt,renderStylesheetPromise:()=>dt,serializeCH1RichText:()=>$,setDOMAttribute:()=>S});module.exports=Rt(Kt);var Ct=typeof HTMLElement=="undefined"?class{}:HTMLElement,m=class extends Ct{constructor(){super(),this.connected=!1,this.refs={},this.descendants=[],this.onLoad=e=>{e!=null&&(this.payload=e,this.update())},this.addEventListener("feaasConnected",this),this.addEventListener("feaasDisconnected",this)}getProps(e){return{}}getRoot(){return this}attributeChangedCallback(e,r,n){this.set()}connectedCallback(){this.initialize()}initialize(){let e=this.getParent();if(!(e&&!e.connected)&&!this.connected)return this.connected=!0,console.log("FEAAS: Connected",this.tagName,this),this.dispatchEvent(new Event("feaasConnected",{bubbles:!0,composed:!0})),this.getElements().map(r=>r.initialize()),this.set(),!0}getParent(e=!0){for(var r=this;r=r.parentElement||(r.parentNode instanceof ShadowRoot?r.parentNode.host:null);)if(!e||r.tagName.startsWith("FEAAS-"))return r}getElements(e=this.getRoot(),r=!0){return Array.from(e.querySelectorAll("*")).map(n=>[!r||n.tagName.startsWith("FEAAS-")?n:null,n.shadowRoot?this.getElements(n.shadowRoot,r):null]).flat().filter(Boolean)}disconnectedCallback(){this.connected&&(console.log("FEAAS: Disconnected",this),this.dispatchEvent(new Event("feaasDisconnected",{bubbles:!0,composed:!0})),this.connected=null)}handleEvent(e){let r=e.composedPath()[0];switch(e.type){case"feaasConnected":r!=this&&this.nestedCallback(r);break;case"feaasDisconnected":r!=this&&this.unnestedCallback(r);break}}unnestedCallback(e){let r=this.descendants.indexOf(e);r!=-1&&(console.log("FEAAS: Unnest",this,e),this.descendants.splice(r,-1),this.refs[e.getComponentName()]=null,e.refs.parent==this&&(e.refs.parent=null),e.refs.top==this&&(e.refs.top=e.refs.parent))}nestedCallback(e){var r,n;if(this.descendants.indexOf(e)==-1&&(this.descendants.push(e),console.log("FEAAS: Nest",this,e),this.refs[e.getComponentName()]=e,e.refs.top=this,(r=e.refs).parent||(r.parent=this),e.render))for(var o=e.refs.parent;o;o=o.refs.parent)o.render&&((n=e.refs).parentReact||(n.parentReact=o),e.refs.topReact=o)}getComponentName(){return this.tagName.replace("FEAAS-","").toLowerCase()}isReadyToLoad(){return this.payload===void 0&&this.getAttribute("hidden")==null}async reify(){this.payload!==void 0?this.update():this.isReadyToLoad()&&(this.payload=null,this.load().then(this.onLoad))}load(){return Promise.resolve(null)}update(e=!1){var r,n,i;if(console.log("FEAAS: React",this.tagName,this.payload),this.payload==null)return;let{React:o,ReactDOM:a,ReactDOMClient:s}=this.payload||{};if(!o)throw new Error(`${this.tagName}: React is not present in payload`);if(!a)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(o.createElement(this.getReactWrapper()))):a.render(o.createElement(this.getReactWrapper()),this.getReactRootElement()):this.forceUpdateReact?(r=this.forceUpdateReact)===null||r===void 0||r.call(this):(i=(n=this.refs.topReact).forceUpdateReact)===null||i===void 0||i.call(n)}invokeReactRendering(){let{React:e,ReactDOM:r}=this.payload||{},n=this.descendants.filter(i=>i.refs.parentReact==this&&i.payload).map((i,o)=>e.createElement(this.getReactWrapper(i),{key:this.tagName+"-"+o,slot:i.getAttribute("slot")}));return this.render({...this.props,children:n},this.payload)}getReactWrapper(e=this,r=e.tagName){let n=e.reactWrapper||(e.reactWrapper=i=>{if(e.render){let{React:o,ReactDOM:a}=e.payload||{},[s,u]=o.useReducer(h=>h+1,0);return e.forceUpdateReact=u,a.createPortal(o.createElement(o.Fragment,null,e.invokeReactRendering()),e.getReactRootElement())}else return e.update()});return Object.assign(n,{displayName:r}),n}getUID(){return this.uid||(this.uid=String(Math.random()))}getReactRootElement(){return this.getRoot()}set(e){this.overrides={...this.overrides,...e},this.props={...this.getProps(),...this.overrides};for(var r in this.props){let n=this.props[r];this.props[r]==null?this.removeAttribute(r):(typeof n=="string"||typeof n=="number")&&this.getAttribute(r)!=String(n)&&this.setAttribute(r,String(n))}this.scheduleRender()}scheduleRender(){cancelAnimationFrame(this.nextRender),this.nextRender=requestAnimationFrame(()=>{this.reify()})}formatURL(e,r){return typeof e=="string"&&e.match(/^\/[^\/]/)?r+e:e}getContextAttribute(e,r=this){for(var n=this;n=n.parentElement||(n.parentNode instanceof ShadowRoot?n.parentNode.host:null);)if(n.getAttribute(e)!=null)return n.getAttribute(e);return this.getAttribute(e)}static register(e){typeof window!="undefined"&&!window.customElements.get(e)&&window.customElements.define(e,this)}};var R=class extends m{load(){return Promise.all([import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react"),import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react-dom")]).then(([e,r])=>({React:e,ReactDOM:r}))}render({},{React:e}){return e.createElement(e.Fragment,null)}};function g(t){return g=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(t)}function rt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function et(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function nt(t,e,r){return e&&et(t.prototype,e),r&&et(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Dt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&k(t,e)}function D(t){return D=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},D(t)}function k(t,e){return k=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},k(t,e)}function it(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function C(t,e,r){return it()?C=Reflect.construct.bind():C=function(i,o,a){var s=[null];s.push.apply(s,o);var u=Function.bind.apply(i,s),h=new u;return a&&k(h,a.prototype),h},C.apply(null,arguments)}function kt(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function K(t){var e=typeof Map=="function"?new Map:void 0;return K=function(n){if(n===null||!kt(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(n))return e.get(n);e.set(n,i)}function i(){return C(n,arguments,D(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),k(i,n)},K(t)}function Ot(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Pt(t,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ot(t)}function $t(t){var e=it();return function(){var n=D(t),i;if(e){var o=D(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Pt(this,i)}}function Tt(t){return Nt(t)||Mt(t)||ot(t)||Lt()}function Nt(t){if(Array.isArray(t))return V(t)}function Mt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function ot(t,e){if(t){if(typeof t=="string")return V(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return V(t,e)}}function V(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Lt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
2
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function jt(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=ot(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
3
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,s;return{s:function(){r=r.call(t)},n:function(){var u=r.next();return o=u.done,u},e:function(u){a=!0,s=u},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}}}var v=Object.prototype.hasOwnProperty;function E(t,e){return t=t.slice(),t.push(e),t}function G(t,e){return e=e.slice(),e.unshift(t),e}var Bt=function(t){Dt(r,t);var e=$t(r);function r(n){var i;return rt(this,r),i=e.call(this,'JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),i.avoidNew=!0,i.value=n,i.name="NewError",i}return nt(r)}(K(Error));function d(t,e,r,n,i){if(!(this instanceof d))try{return new d(t,e,r,n,i)}catch(u){if(!u.avoidNew)throw u;return u.value}typeof t=="string"&&(i=n,n=r,r=e,e=t,t=null);var o=t&&g(t)==="object";if(t=t||{},this.json=t.json||r,this.path=t.path||e,this.resultType=t.resultType||"value",this.flatten=t.flatten||!1,this.wrap=v.call(t,"wrap")?t.wrap:!0,this.sandbox=t.sandbox||{},this.preventEval=t.preventEval||!1,this.parent=t.parent||null,this.parentProperty=t.parentProperty||null,this.callback=t.callback||n||null,this.otherTypeCallback=t.otherTypeCallback||i||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},t.autostart!==!1){var a={path:o?t.path:e};o?"json"in t&&(a.json=t.json):a.json=r;var s=this.evaluate(a);if(!s||g(s)!=="object")throw new Bt(s);return s}}d.prototype.evaluate=function(t,e,r,n){var i=this,o=this.parent,a=this.parentProperty,s=this.flatten,u=this.wrap;if(this.currResultType=this.resultType,this.currPreventEval=this.preventEval,this.currSandbox=this.sandbox,r=r||this.callback,this.currOtherTypeCallback=n||this.otherTypeCallback,e=e||this.json,t=t||this.path,t&&g(t)==="object"&&!Array.isArray(t)){if(!t.path&&t.path!=="")throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!v.call(t,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');var h=t;e=h.json,s=v.call(t,"flatten")?t.flatten:s,this.currResultType=v.call(t,"resultType")?t.resultType:this.currResultType,this.currSandbox=v.call(t,"sandbox")?t.sandbox:this.currSandbox,u=v.call(t,"wrap")?t.wrap:u,this.currPreventEval=v.call(t,"preventEval")?t.preventEval:this.currPreventEval,r=v.call(t,"callback")?t.callback:r,this.currOtherTypeCallback=v.call(t,"otherTypeCallback")?t.otherTypeCallback:this.currOtherTypeCallback,o=v.call(t,"parent")?t.parent:o,a=v.call(t,"parentProperty")?t.parentProperty:a,t=t.path}if(o=o||null,a=a||null,Array.isArray(t)&&(t=d.toPathString(t)),!(!t&&t!==""||!e)){var c=d.toPathArray(t);c[0]==="$"&&c.length>1&&c.shift(),this._hasParentSelector=null;var l=this._trace(c,e,["$"],o,a,r).filter(function(f){return f&&!f.isParentSelector});return l.length?!u&&l.length===1&&!l[0].hasArrExpr?this._getPreferredOutput(l[0]):l.reduce(function(f,y){var A=i._getPreferredOutput(y);return s&&Array.isArray(A)?f=f.concat(A):f.push(A),f},[]):u?[]:void 0}};d.prototype._getPreferredOutput=function(t){var e=this.currResultType;switch(e){case"all":{var r=Array.isArray(t.path)?t.path:d.toPathArray(t.path);return t.pointer=d.toPointer(r),t.path=typeof t.path=="string"?t.path:d.toPathString(t.path),t}case"value":case"parent":case"parentProperty":return t[e];case"path":return d.toPathString(t[e]);case"pointer":return d.toPointer(t.path);default:throw new TypeError("Unknown result type")}};d.prototype._handleCallback=function(t,e,r){if(e){var n=this._getPreferredOutput(t);t.path=typeof t.path=="string"?t.path:d.toPathString(t.path),e(n,r,t)}};d.prototype._trace=function(t,e,r,n,i,o,a,s){var u=this,h;if(!t.length)return h={path:r,value:e,parent:n,parentProperty:i,hasArrExpr:a},this._handleCallback(h,o,"value"),h;var c=t[0],l=t.slice(1),f=[];function y(p){Array.isArray(p)?p.forEach(function(wt){f.push(wt)}):f.push(p)}if((typeof c!="string"||s)&&e&&v.call(e,c))y(this._trace(l,e[c],E(r,c),e,c,o,a));else if(c==="*")this._walk(e,function(p){y(u._trace(l,e[p],E(r,p),e,p,o,!0,!0))});else if(c==="..")y(this._trace(l,e,r,n,i,o,a)),this._walk(e,function(p){g(e[p])==="object"&&y(u._trace(t.slice(),e[p],E(r,p),e,p,o,!0))});else{if(c==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:l,isParentSelector:!0};if(c==="~")return h={path:E(r,c),value:i,parent:n,parentProperty:null},this._handleCallback(h,o,"property"),h;if(c==="$")y(this._trace(l,e,r,null,null,o,a));else if(/^(\x2D?[0-9]*):(\x2D?[0-9]*):?([0-9]*)$/.test(c))y(this._slice(c,l,e,r,n,i,o));else if(c.indexOf("?(")===0){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");var A=c.replace(/^\?\(((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?)\)$/,"$1");this._walk(e,function(p){u._eval(A,e[p],p,r,n,i)&&y(u._trace(l,e[p],E(r,p),e,p,o,!0))})}else if(c[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");y(this._trace(G(this._eval(c,e,r[r.length-1],r.slice(0,-1),n,i),l),e,r,n,i,o,a))}else if(c[0]==="@"){var b=!1,M=c.slice(1,-2);switch(M){case"scalar":(!e||!["object","function"].includes(g(e)))&&(b=!0);break;case"boolean":case"string":case"undefined":case"function":g(e)===M&&(b=!0);break;case"integer":Number.isFinite(e)&&!(e%1)&&(b=!0);break;case"number":Number.isFinite(e)&&(b=!0);break;case"nonFinite":typeof e=="number"&&!Number.isFinite(e)&&(b=!0);break;case"object":e&&g(e)===M&&(b=!0);break;case"array":Array.isArray(e)&&(b=!0);break;case"other":b=this.currOtherTypeCallback(e,r,n,i);break;case"null":e===null&&(b=!0);break;default:throw new TypeError("Unknown value type "+M)}if(b)return h={path:r,value:e,parent:n,parentProperty:i},this._handleCallback(h,o,"value"),h}else if(c[0]==="`"&&e&&v.call(e,c.slice(1))){var q=c.slice(1);y(this._trace(l,e[q],E(r,q),e,q,o,a,!0))}else if(c.includes(",")){var mt=c.split(","),L=jt(mt),tt;try{for(L.s();!(tt=L.n()).done;){var gt=tt.value;y(this._trace(G(gt,l),e,r,n,i,o,!0))}}catch(p){L.e(p)}finally{L.f()}}else!s&&e&&v.call(e,c)&&y(this._trace(l,e[c],E(r,c),e,c,o,a,!0))}if(this._hasParentSelector)for(var w=0;w<f.length;w++){var j=f[w];if(j&&j.isParentSelector){var x=this._trace(j.expr,e,j.path,n,i,o,a);if(Array.isArray(x)){f[w]=x[0];for(var At=x.length,z=1;z<At;z++)w++,f.splice(w,0,x[z])}else f[w]=x}}return f};d.prototype._walk=function(t,e){if(Array.isArray(t))for(var r=t.length,n=0;n<r;n++)e(n);else t&&g(t)==="object"&&Object.keys(t).forEach(function(i){e(i)})};d.prototype._slice=function(t,e,r,n,i,o,a){if(Array.isArray(r)){var s=r.length,u=t.split(":"),h=u[2]&&Number.parseInt(u[2])||1,c=u[0]&&Number.parseInt(u[0])||0,l=u[1]&&Number.parseInt(u[1])||s;c=c<0?Math.max(0,c+s):Math.min(s,c),l=l<0?Math.max(0,l+s):Math.min(s,l);for(var f=[],y=c;y<l;y+=h){var A=this._trace(G(y,e),r,n,i,o,a,!0);A.forEach(function(b){f.push(b)})}return f}};d.prototype._eval=function(t,e,r,n,i,o){this.currSandbox._$_parentProperty=o,this.currSandbox._$_parent=i,this.currSandbox._$_property=r,this.currSandbox._$_root=this.json,this.currSandbox._$_v=e;var a=t.includes("@path");a&&(this.currSandbox._$_path=d.toPathString(n.concat([r])));var s="script:"+t;if(!d.cache[s]){var u=t.replace(/@parentProperty/g,"_$_parentProperty").replace(/@parent/g,"_$_parent").replace(/@property/g,"_$_property").replace(/@root/g,"_$_root").replace(/@([\t-\r \)\.\[\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF])/g,"_$_v$1");a&&(u=u.replace(/@path/g,"_$_path")),d.cache[s]=new this.vm.Script(u)}try{return d.cache[s].runInNewContext(this.currSandbox)}catch(h){throw new Error("jsonPath: "+h.message+": "+t)}};d.cache={};d.toPathString=function(t){for(var e=t,r=e.length,n="$",i=1;i<r;i++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(e[i])||(n+=/^[\*0-9]+$/.test(e[i])?"["+e[i]+"]":"['"+e[i]+"']");return n};d.toPointer=function(t){for(var e=t,r=e.length,n="",i=1;i<r;i++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(e[i])||(n+="/"+e[i].toString().replace(/~/g,"~0").replace(/\//g,"~1"));return n};d.toPathArray=function(t){var e=d.cache;if(e[t])return e[t].concat();var r=[],n=t.replace(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/g,";$&;").replace(/['\[](\??\((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\))['\]]/g,function(o,a){return"[#"+(r.push(a)-1)+"]"}).replace(/\[["']((?:(?!['\]])[\s\S])*)["']\]/g,function(o,a){return"['"+a.replace(/\./g,"%@%").replace(/~/g,"%%@@%%")+"']"}).replace(/~/g,";~;").replace(/["']?\.["']?(?!(?:(?!\[)[\s\S])*\])|\[["']?/g,";").replace(/%@%/g,".").replace(/%%@@%%/g,"~").replace(/(?:;)?(\^+)(?:;)?/g,function(o,a){return";"+a.split("").join(";")+";"}).replace(/;;;|;;/g,";..;").replace(/;$|'?\]|'$/g,""),i=n.split(";").map(function(o){var a=o.match(/#([0-9]+)/);return!a||!a[1]?o:r[a[1]]});return e[t]=i,e[t].concat()};var It=function(e,r,n){for(var i=e.length,o=0;o<i;o++){var a=e[o];n(a)&&r.push(e.splice(o--,1)[0])}},Ut=function(){function t(e){rt(this,t),this.code=e}return nt(t,[{key:"runInNewContext",value:function(r){var n=this.code,i=Object.keys(r),o=[];It(i,o,function(c){return typeof r[c]=="function"});var a=i.map(function(c,l){return r[c]}),s=o.reduce(function(c,l){var f=r[l].toString();return/function/.test(f)||(f="function "+f),"var "+l+"="+f+";"+c},"");n=s+n,!/(["'])use strict\1/.test(n)&&!i.includes("arguments")&&(n="var arguments = undefined;"+n),n=n.replace(/;[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*$/,"");var u=n.lastIndexOf(";"),h=u>-1?n.slice(0,u+1)+" return "+n.slice(u+1):" return "+n;return C(Function,i.concat([h])).apply(void 0,Tt(a))}}]),t}();d.prototype.vm={Script:Ut};async function Y(t,e,r,n){return F({url:t,options:e,validator:r,callback:n}).then(O).then(i=>i.response)}async function F({url:t,options:e,validator:r,callback:n},i="initial"){let o=new Date;console.log("fetch",i,t);let a=await fetch(t,e);if(!a.ok)throw new Error("Fetch failed");if((r==null?void 0:r(a))===!1)throw new Error("Response is not valid");let s=new Date(a.headers.get("date"))<o;return n==null||n(a,i),{url:t,options:e,isCached:s,response:a,validator:r}}async function O(t){let{url:e,isCached:r,options:n,validator:i,response:o,callback:a}=t;if(r){let{response:s}=await F({url:e+"?"+Math.random(),options:{...n,method:"HEAD",cache:"no-cache"},validator:i},"check");if(s.headers.get("last-modified")!=o.headers.get("last-modified"))return B(t)}return t}async function B(t){let{url:e,options:r,validator:n,callback:i}=t;return F({url:e,options:{...r,cache:"reload"},validator:n,callback:i},"updated")}function at({cdn:t="https://feaascomponentsapidev.blob.core.windows.net",hostname:e,library:r,component:n,version:i,revision:o="published"}){return`${t||e}/components/${r}/${n}/${i}/${o}.html`}function Ht({cdn:t="https://feaascomponentsapidev.blob.core.windows.net",hostname:e,library:r,revision:n="published"}){return`${t||e}/styles/${r}/${n}.css`}async function I(t,e){let r=a=>a.headers.get("x-ms-meta-versionDeletedAt")==null,n=a=>{a.text().then(e)},i=await Promise.all([t.instance&&F({options:{headers:{Accept:"text/html"}},url:at({...t,version:t.instance}),validator:r}).catch(a=>a),F({url:at(t),validator:r}).catch(a=>a)]),o=i.find(a=>a&&"isCached"in a&&a);if(!o||o instanceof Error)throw i.find(s=>s&&s instanceof Error)||new Error("Can not fetch component");return i[0]==o&&console.log("Using fork!",i),n(o.response),O({...o,callback:n}).catch(a=>{if(i[0]==o&&(B({...o,callback:null,validator:null}),console.log("Fork was deleted"),!(i[1]instanceof Error)))return n(i[1].response),O({...i[1],callback:n});throw a})}async function U(t,e){return Y(Ht(t),{headers:{Accept:"text/css"}},r=>r.headers.get("x-ms-meta-deletedAt")==null,r=>{r.text().then(e)})}function Wt(t,e){let r=document.createElement("div");r.innerHTML=t;let n=document.createDocumentFragment();for(;r.firstChild;)n.appendChild(r.firstChild);return _(n,e),r}function ut(t){return t.replace(/(\[[^\]\[]+\]|\.\*)$/g,"")}function ct(t){return ut(t)+".*"}function lt(t){let e=t.getAttribute("data-path-scope");for(var r=0,n=t;n=n.previousElementSibling;)n.getAttribute("data-path-scope")==e&&r++;return r}function qt(t,e,r){let n=t.getAttribute("data-path-scope");if(n==null)return;var i=lt(t);if(i!=0)return;let o=t.parentElement;if(o!=null){e==0?t.setAttribute("hidden","hidden"):t.getAttribute("hidden")!=null&&t.removeAttribute("hidden");for(var a=i+1,s=t,u=t;u=u.nextElementSibling;)u.getAttribute("data-path-scope")==n&&(a++,s=u);for(var h=a;h<e;h++)o.insertBefore(s.cloneNode(!0),s.nextElementSibling);for(var h=Math.max(1,e);h<a;h++)s=s.previousElementSibling,o.removeChild(s.nextElementSibling)}}function X(t,e,r=!1,n=t){var i=e;let o=Object.keys(t).sort((s,u)=>u.length-s.length);for(let s of o)if(e.startsWith(s)){if(s==e){if(r)return t[s];continue}i=e.substring(s.length+1),n=t[s];break}var a=d({path:i,json:n});return Array.isArray(a)&&(a==null?void 0:a.length)==0&&(a=[i.replace(/^.*?\./,"_."),i.replace(/^.*?\./,""),i.replace(/^([^.]+).*?\.\$\./,"$1."),i.replace(/^.*?\.\$\./,"_."),i.replace(/^.*?\.\$\./,"")].filter((s,u,h)=>h.indexOf(s)===u).reduce((s,u)=>s.length>0?s:d({path:u,json:n}),[])),r&&Array.isArray(a)?a[0]:a}function S(t,e,r,n){var i;if(t){var o=t;(r==null?void 0:r.type)=="doc"&&Array.isArray(r.content)&&(r=$(r)),n!=null&&n.processValue&&(r=n==null?void 0:n.processValue(t,e,r));var a=e.replace("data-path-","");if(e=="data-path-src")o=t.tagName=="IMG"?t:t.querySelector("img, video");else if(e=="data-path-href")o=t.querySelector("a")||t.closest("a");else if(e=="data-path-alt")o=t.querySelector("img, picture");else if(e=="data-path-hidden")r=r?null:!0;else if(e=="data-path"||e=="data-embed-html"||e=="html")a="innerHTML";else if(e=="data-embed-src")H(t,r);else if(e=="data-path-attributes"){let l=((i=t.getAttribute("data-attributes-keys"))===null||i===void 0?void 0:i.split(",").filter(Boolean))||[];for(var s in r){var u=r[s];S(t,s,typeof u=="object"&&u?JSON.stringify(u):u,n)}for(var h=0;h<l.length;h++)(r==null||!(l[h]in r))&&S(t,l[h],null,n);S(t,"data-attributes-keys",Object.keys(r||{}).join(","));return}if(typeof r=="boolean"&&(r=r?"":null),!!o){var c=String(t.getAttribute("data-path-placeholder")||o[a]);r!=null?a=="innerHTML"?o.innerHTML!=r&&(o.innerHTML=r):o.getAttribute(a)!=r&&o.setAttribute(a,r):a=="innerHTML"?o.innerHTML=c:o.removeAttribute(a)}}}function ht(t){let e=new t.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(n=>{let i=n.target,o=i.getAttribute("data-embed-src");o&&H(i,o),n.addedNodes&&n.addedNodes.forEach(a=>{a.nodeType==1&&ft(a,!1)})})});return e.observe(t,{attributes:!0,subtree:!0,childList:!0}),e}function ft(t,e=!0){let r=t.querySelectorAll("[data-embed-src]");for(var n=0;n<r.length;n++){let i=r[n];H(i,i.getAttribute("data-embed-src"))}if(e)return ht(t)}function H(t,e){for(var r=t;r;r=r.parentElement)if(!r.parentElement){let i=r.querySelectorAll("script");for(var n=0;n<i.length;n++)if(i[n].getAttribute("src")==e)return!0;r.tagName=="HTML"&&(r=r.querySelector("head")||r);let o=r.ownerDocument.createElement("script");o.type="module",o.src=e,r.appendChild(o);break}}var st=["data-attributes-keys","data-path-attributes","data-path-scope"];function _(t,e,r,n){var i,o,a;let s=t;if(n||(e=((i=r==null?void 0:r.processData)===null||i===void 0?void 0:i.call(r,s,e))||e),s.nodeType==1){let h=s.getAttribute("data-path-scope");if(h){let l=lt(s),f=X(e,h,!1)||[];l==0&&qt(s,((o=r==null?void 0:r.shouldRepeat)===null||o===void 0?void 0:o.call(r,s,f))===!1?1:f.length,r),e={...e,[ct(h)]:f[l]}}let c=Array.prototype.slice.call(s.attributes).sort((l,f)=>st.indexOf(l.name)-st.indexOf(f.name));for(var u=0;u<c.length;u++){let{name:l,value:f}=c[u];l.startsWith("data-path")&&l!="data-path-scope"&&S(s,l,X(e,f,!0),r),l=="data-embed-src"&&S(s,l,s.getAttribute(l),r)}}for(var u=0;u<s.children.length;u++)_(s.children[u],e,r,!0);return n||(a=r==null?void 0:r.onRender)===null||a===void 0||a.call(r,s,e),s}function P(t,e,r,n){var i;let o=((i=n==null?void 0:n.processTemplate)===null||i===void 0?void 0:i.call(n,t,e,r))||e;if(t.innerHTML=o,t.classList.add("-feaas"),(t.closest(".component.feaas")||t).className.includes("-theme--"))for(let s of t.children)s.className=s.className.replace(/(\s|^)-theme--[^\s]+\s*/g,"$1");return _(t,r,n)}function zt(t,e){return dt(t,e||(e=document.createElement("style"))),e}function dt(t,e){return e||(e=document.createElement("style")),U(t,r=>{e.textContent=r}).then(()=>e)}function Jt(t,e){return pt(t,e||(e=document.createElement("div"))),e}async function pt(t,e){return e||(e=document.createElement("div")),e.childNodes.length?_(e,t.data,t):"template"in t?P(e,t.template,t.data,t):I(t,r=>P(e,r,t.data,t)).then(()=>e)}function Q(t,e={},r){return r?`<${r}${Object.entries(e).map(([n,i])=>i!=null&&` ${n}="${i}"`).filter(Boolean).join("")}>${$(t)}</${r}>`.replace(/^<([a-z0-9][^>]*)><\/[^>]+>$/,"<$1 />"):$(t)}function $(t){var e;if(Array.isArray(t))return t.map($).join(`
4
- `).trim();if(typeof t=="string")return t;if(t==null)return"";switch(t.type){case"heading":let{level:r,...n}=t.attrs;return Q(t.content,n,"h"+r);case"text":return(t.marks||[]).reduce((i,o)=>Q(i,o.attrs,{link:"a",bold:"strong",italic:"em",strike:"s",underline:"u"}[o.type]),(e=t.text)===null||e===void 0?void 0:e.replace(/\s+/," "));default:return Q(t.content||t.text,t.attrs,{bulletList:"ul",orderedList:"ol",listItem:"li",horizontalRule:"hr",paragraph:"p",codeBlock:"code",blockquote:"blockquote"}[t.type])}}function yt(t=this){let e,r=t.getAttribute("data");if(r!=null)try{e=typeof r=="string"?JSON.parse(r):{}}catch(n){}return{data:e!=null?e:{},library:t.getAttribute("library"),component:t.getAttribute("component"),version:t.getAttribute("version"),revision:t.getAttribute("revision"),hostname:t.getAttribute("hostname"),cdn:t.getContextAttribute("cdn"),template:t.getAttribute("template"),instance:t.getAttribute("instance"),editable:t.getAttribute("editable")!=null,suspended:t.getAttribute("suspended")!=null}}var T=class extends m{constructor(){super(),this.addEventListener("click",()=>{this.props.editable&&this.edit()})}setData(e){this.set({data:e})}getProps(){return yt(this)}attributeChangedCallback(e,r,n){r!==n&&(this.payload=void 0,this.needsRefresh=!0,super.attributeChangedCallback(e,r,n))}getEditor(){var e;return(e=document.querySelector("feaas-context"))===null||e===void 0?void 0:e.refs.editor}edit(){let e=this.getEditor();if(e!=null&&e.setTarget(this))return e.open(),!0}getOriginal(){let e=this.getAttribute("data-path-scope");if(e){for(var r=this;(r=r.previousElementSibling)&&r.getAttribute("data-path-scope")==e;)var n=r;return n}}isReadyToLoad(){return super.isReadyToLoad()&&this.props.library!=null&&this.props.component!=null&&this.props.version!=null}async load(){if(!this.getOriginal())try{I(this.props,this.onLoad)}catch(e){console.error(`FEAAS: Could not fetch component: ${this.props.component}/${this.props.version}/${this.props.revision}`)}}update(){if(Array.from(this.children).filter(e=>e.tagName!="BR").length>0&&!this.needsRefresh)_(this,this.props.data);else{if(this.needsRefresh=!0,this.getOriginal())return;P(this,this.payload,this.props.data)}}};T.observedAttributes=["library","component","version","revision","hostname","cdn","template","data","instance","editable"];T.register("feaas-component");function vt(t=this){return{opacity:t!=null&&t.getAttribute("opacity")?parseFloat(t==null?void 0:t.getAttribute("opacity")):1,hidden:(t==null?void 0:t.getAttribute("hidden"))!=null}}var N=class extends m{getProps(){return vt(this)}attributeChangedCallback(e,r,n){if(r!==n)return e=="hidden"&&(this.style.setProperty("display","block","important"),this.style.setProperty("transition","opacity 0.3s","important"),n?(this.style.setProperty("opacity","0","important"),this.style.pointerEvents="none"):(this.style.setProperty("opacity","1","important"),this.style.pointerEvents="all")),super.attributeChangedCallback(e,r,n)}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 K=Object.defineProperty;var Ft=Object.getOwnPropertyDescriptor;var _t=Object.getOwnPropertyNames;var St=Object.prototype.hasOwnProperty;var xt=(e,t)=>{for(var r in t)K(e,r,{get:t[r],enumerable:!0})},Rt=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of _t(t))!St.call(e,i)&&i!==r&&K(e,i,{get:()=>t[i],enumerable:!(n=Ft(t,i))||n.enumerable});return e};var Dt=e=>Rt(K({},"__esModule",{value:!0}),e);var Vt={};xt(Vt,{Base:()=>m,Component:()=>T,FEAASBase:()=>m,FEAASComponent:()=>T,FEAASComponentsProps:()=>vt,FEAASLoader:()=>N,FEAASLoaderProps:()=>bt,FEAASStylesheet:()=>q,FEAASStylesheetProps:()=>mt,JSONPath:()=>d,Loader:()=>N,MyComponent:()=>B,Stylesheet:()=>q,autoloadScripts:()=>dt,cleanCollectionBit:()=>ct,fetchAndRevalidate:()=>Q,fetchAndValidate:()=>F,invalidateRequest:()=>I,loadScript:()=>W,normalizeCollectionScope:()=>lt,observeDOMElement:()=>ft,queryScopes:()=>Z,refetchAndValidate:()=>O,renderComponent:()=>Kt,renderComponentElement:()=>qt,renderComponentPromise:()=>yt,renderDOMContent:()=>P,renderDOMElement:()=>_,renderStylesheet:()=>Jt,renderStylesheetPromise:()=>pt,serializeCH1RichText:()=>$,setDOMAttribute:()=>x});module.exports=Dt(Vt);var Ct=typeof HTMLElement=="undefined"?class{}:HTMLElement,m=class extends Ct{getProps(t){return{}}constructor(){super(),this.connected=!1,this.refs={},this.descendants=[],this.onLoad=t=>{t!=null&&(this.payload=t,this.update())},this.addEventListener("feaasConnected",this),this.addEventListener("feaasDisconnected",this)}getRoot(){return this}attributeChangedCallback(t,r,n){this.set()}connectedCallback(){this.initialize()}initialize(){let t=this.getParent();if(!(t&&!t.connected)&&!this.connected)return this.connected=!0,console.log("FEAAS: Connected",this.tagName,this),this.dispatchEvent(new Event("feaasConnected",{bubbles:!0,composed:!0})),this.getElements().map(r=>{var n;return(n=r.initialize)===null||n===void 0?void 0:n.call(r)}),this.set(),!0}getParent(t=!0){for(var r=this;r=r.parentElement||(r.parentNode instanceof ShadowRoot?r.parentNode.host:null);)if(!t||r.tagName.startsWith("FEAAS-"))return r}getElements(t=this.getRoot(),r=!0){return Array.from(t.querySelectorAll("*")).map(n=>[!r||n.tagName.startsWith("FEAAS-")?n:null,n.shadowRoot?this.getElements(n.shadowRoot,r):null]).flat().filter(Boolean)}disconnectedCallback(){this.connected&&(console.log("FEAAS: Disconnected",this),this.dispatchEvent(new Event("feaasDisconnected",{bubbles:!0,composed:!0})),this.connected=null)}handleEvent(t){let r=t.composedPath()[0];switch(t.type){case"feaasConnected":r!=this&&this.nestedCallback(r);break;case"feaasDisconnected":r!=this&&this.unnestedCallback(r);break}}unnestedCallback(t){let r=this.descendants.indexOf(t);r!=-1&&(console.log("FEAAS: Unnest",this,t),this.descendants.splice(r,-1),this.refs[t.getComponentName()]=null,t.refs.parent==this&&(t.refs.parent=null),t.refs.top==this&&(t.refs.top=t.refs.parent))}nestedCallback(t){var r,n;if(this.descendants.indexOf(t)==-1&&(this.descendants.push(t),console.log("FEAAS: Nest",this,t),this.refs[t.getComponentName()]=t,t.refs.top=this,(r=t.refs).parent||(r.parent=this),t.render))for(var o=t.refs.parent;o;o=o.refs.parent)o.render&&((n=t.refs).parentReact||(n.parentReact=o),t.refs.topReact=o)}getComponentName(){return this.tagName.replace("FEAAS-","").toLowerCase()}isReadyToLoad(){return this.payload===void 0&&this.getAttribute("hidden")==null}async reify(){this.payload!==void 0?this.update():this.isReadyToLoad()&&(this.payload=null,this.load().then(this.onLoad))}load(){return Promise.resolve(null)}update(t=!1){var r,n,i;if(console.log("FEAAS: React",this.tagName,this.payload),this.payload==null)return;let{React:o,ReactDOM:a,ReactDOMClient:s}=this.payload||{};if(!o)throw new Error(`${this.tagName}: React is not present in payload`);if(!a)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(o.createElement(this.getReactWrapper()))):a.render(o.createElement(this.getReactWrapper()),this.getReactRootElement()):this.forceUpdateReact?(r=this.forceUpdateReact)===null||r===void 0||r.call(this):(i=(n=this.refs.topReact).forceUpdateReact)===null||i===void 0||i.call(n)}invokeReactRendering(){let{React:t,ReactDOM:r}=this.payload||{},n=this.descendants.filter(i=>i.refs.parentReact==this&&i.payload).map((i,o)=>t.createElement(this.getReactWrapper(i),{key:i.tagName+"-"+i.getUID(),slot:i.getAttribute("slot")}));return this.render({...this.props,children:n},this.payload)}getReactWrapper(t=this,r=t.tagName){let n=t.reactWrapper||(t.reactWrapper=i=>{if(t.render){let{React:o,ReactDOM:a}=t.payload||{},[s,u]=o.useReducer(h=>h+1,0);return t.forceUpdateReact=u,a.createPortal(o.createElement(o.Fragment,null,t.invokeReactRendering()),t.getReactRootElement())}else return t.update()});return Object.assign(n,{key:this.tagName+"-"+this.getUID(),displayName:r}),n}getUID(){return this.uid||(this.uid=String(Math.random()))}getShadowRoot(){return this.shadowRoot||this.attachShadow({mode:"open"}),this.shadowRoot}getReactRootElement(){return this.useShadowRoot?this.getShadowRoot():this.getRoot()}set(t){this.overrides={...this.overrides,...t},this.props={...this.getProps(),...this.overrides};for(var r in this.props){let n=this.props[r];this.props[r]==null?this.removeAttribute(r):(typeof n=="string"||typeof n=="number")&&this.getAttribute(r)!=String(n)&&this.setAttribute(r,String(n))}this.scheduleRender()}scheduleRender(){cancelAnimationFrame(this.nextRender),this.nextRender=requestAnimationFrame(()=>{this.reify()})}formatURL(t,r){return typeof t=="string"&&t.match(/^\/[^\/]/)?r+t:t}getContextAttribute(t,r=this){for(var n=this;n=n.parentElement||(n.parentNode instanceof ShadowRoot?n.parentNode.host:null);)if(n.getAttribute(t)!=null)return n.getAttribute(t);return this.getAttribute(t)}static register(t){typeof window!="undefined"&&!window.customElements.get(t)&&window.customElements.define(t,this)}};var S=class extends m{load(){return Promise.all([import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react"),import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react-dom")]).then(([t,r])=>({React:t,ReactDOM:r}))}render({},{React:t}){return t.createElement(t.Fragment,null)}},B=class extends S{constructor(){super(...arguments),this.useShadowRoot=!0}getProps(){return{counter:parseFloat(this.getAttribute("counter"))}}render({counter:t},{React:r}){let[n,i]=r.useState(0);return r.useEffect(()=>{i(o=>o+1)},[t]),r.createElement(r.Fragment,null,r.createElement("p",null,"Rendering attribute: ",t),r.createElement("p",null,"Triggered updates: ",n))}};B.observedAttributes=["counter"];function g(e){return g=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},g(e)}function nt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function rt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function it(e,t,r){return t&&rt(e.prototype,t),r&&rt(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function kt(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&k(e,t)}function C(e){return C=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},C(e)}function k(e,t){return k=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},k(e,t)}function ot(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function D(e,t,r){return ot()?D=Reflect.construct.bind():D=function(i,o,a){var s=[null];s.push.apply(s,o);var u=Function.bind.apply(i,s),h=new u;return a&&k(h,a.prototype),h},D.apply(null,arguments)}function Ot(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function V(e){var t=typeof Map=="function"?new Map:void 0;return V=function(n){if(n===null||!Ot(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof t<"u"){if(t.has(n))return t.get(n);t.set(n,i)}function i(){return D(n,arguments,C(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),k(i,n)},V(e)}function Pt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $t(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Pt(e)}function Tt(e){var t=ot();return function(){var n=C(e),i;if(t){var o=C(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return $t(this,i)}}function Nt(e){return Mt(e)||Lt(e)||at(e)||jt()}function Mt(e){if(Array.isArray(e))return G(e)}function Lt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function at(e,t){if(e){if(typeof e=="string")return G(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return G(e,t)}}function G(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function jt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Bt(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=at(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
3
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,s;return{s:function(){r=r.call(e)},n:function(){var u=r.next();return o=u.done,u},e:function(u){a=!0,s=u},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}}}var v=Object.prototype.hasOwnProperty;function E(e,t){return e=e.slice(),e.push(t),e}function Y(e,t){return t=t.slice(),t.unshift(e),t}var It=function(e){kt(r,e);var t=Tt(r);function r(n){var i;return nt(this,r),i=t.call(this,'JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),i.avoidNew=!0,i.value=n,i.name="NewError",i}return it(r)}(V(Error));function d(e,t,r,n,i){if(!(this instanceof d))try{return new d(e,t,r,n,i)}catch(u){if(!u.avoidNew)throw u;return u.value}typeof e=="string"&&(i=n,n=r,r=t,t=e,e=null);var o=e&&g(e)==="object";if(e=e||{},this.json=e.json||r,this.path=e.path||t,this.resultType=e.resultType||"value",this.flatten=e.flatten||!1,this.wrap=v.call(e,"wrap")?e.wrap:!0,this.sandbox=e.sandbox||{},this.preventEval=e.preventEval||!1,this.parent=e.parent||null,this.parentProperty=e.parentProperty||null,this.callback=e.callback||n||null,this.otherTypeCallback=e.otherTypeCallback||i||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},e.autostart!==!1){var a={path:o?e.path:t};o?"json"in e&&(a.json=e.json):a.json=r;var s=this.evaluate(a);if(!s||g(s)!=="object")throw new It(s);return s}}d.prototype.evaluate=function(e,t,r,n){var i=this,o=this.parent,a=this.parentProperty,s=this.flatten,u=this.wrap;if(this.currResultType=this.resultType,this.currPreventEval=this.preventEval,this.currSandbox=this.sandbox,r=r||this.callback,this.currOtherTypeCallback=n||this.otherTypeCallback,t=t||this.json,e=e||this.path,e&&g(e)==="object"&&!Array.isArray(e)){if(!e.path&&e.path!=="")throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!v.call(e,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');var h=e;t=h.json,s=v.call(e,"flatten")?e.flatten:s,this.currResultType=v.call(e,"resultType")?e.resultType:this.currResultType,this.currSandbox=v.call(e,"sandbox")?e.sandbox:this.currSandbox,u=v.call(e,"wrap")?e.wrap:u,this.currPreventEval=v.call(e,"preventEval")?e.preventEval:this.currPreventEval,r=v.call(e,"callback")?e.callback:r,this.currOtherTypeCallback=v.call(e,"otherTypeCallback")?e.otherTypeCallback:this.currOtherTypeCallback,o=v.call(e,"parent")?e.parent:o,a=v.call(e,"parentProperty")?e.parentProperty:a,e=e.path}if(o=o||null,a=a||null,Array.isArray(e)&&(e=d.toPathString(e)),!(!e&&e!==""||!t)){var c=d.toPathArray(e);c[0]==="$"&&c.length>1&&c.shift(),this._hasParentSelector=null;var l=this._trace(c,t,["$"],o,a,r).filter(function(f){return f&&!f.isParentSelector});return l.length?!u&&l.length===1&&!l[0].hasArrExpr?this._getPreferredOutput(l[0]):l.reduce(function(f,y){var A=i._getPreferredOutput(y);return s&&Array.isArray(A)?f=f.concat(A):f.push(A),f},[]):u?[]:void 0}};d.prototype._getPreferredOutput=function(e){var t=this.currResultType;switch(t){case"all":{var r=Array.isArray(e.path)?e.path:d.toPathArray(e.path);return e.pointer=d.toPointer(r),e.path=typeof e.path=="string"?e.path:d.toPathString(e.path),e}case"value":case"parent":case"parentProperty":return e[t];case"path":return d.toPathString(e[t]);case"pointer":return d.toPointer(e.path);default:throw new TypeError("Unknown result type")}};d.prototype._handleCallback=function(e,t,r){if(t){var n=this._getPreferredOutput(e);e.path=typeof e.path=="string"?e.path:d.toPathString(e.path),t(n,r,e)}};d.prototype._trace=function(e,t,r,n,i,o,a,s){var u=this,h;if(!e.length)return h={path:r,value:t,parent:n,parentProperty:i,hasArrExpr:a},this._handleCallback(h,o,"value"),h;var c=e[0],l=e.slice(1),f=[];function y(p){Array.isArray(p)?p.forEach(function(Et){f.push(Et)}):f.push(p)}if((typeof c!="string"||s)&&t&&v.call(t,c))y(this._trace(l,t[c],E(r,c),t,c,o,a));else if(c==="*")this._walk(t,function(p){y(u._trace(l,t[p],E(r,p),t,p,o,!0,!0))});else if(c==="..")y(this._trace(l,t,r,n,i,o,a)),this._walk(t,function(p){g(t[p])==="object"&&y(u._trace(e.slice(),t[p],E(r,p),t,p,o,!0))});else{if(c==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:l,isParentSelector:!0};if(c==="~")return h={path:E(r,c),value:i,parent:n,parentProperty:null},this._handleCallback(h,o,"property"),h;if(c==="$")y(this._trace(l,t,r,null,null,o,a));else if(/^(\x2D?[0-9]*):(\x2D?[0-9]*):?([0-9]*)$/.test(c))y(this._slice(c,l,t,r,n,i,o));else if(c.indexOf("?(")===0){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");var A=c.replace(/^\?\(((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?)\)$/,"$1");this._walk(t,function(p){u._eval(A,t[p],p,r,n,i)&&y(u._trace(l,t[p],E(r,p),t,p,o,!0))})}else if(c[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");y(this._trace(Y(this._eval(c,t,r[r.length-1],r.slice(0,-1),n,i),l),t,r,n,i,o,a))}else if(c[0]==="@"){var b=!1,M=c.slice(1,-2);switch(M){case"scalar":(!t||!["object","function"].includes(g(t)))&&(b=!0);break;case"boolean":case"string":case"undefined":case"function":g(t)===M&&(b=!0);break;case"integer":Number.isFinite(t)&&!(t%1)&&(b=!0);break;case"number":Number.isFinite(t)&&(b=!0);break;case"nonFinite":typeof t=="number"&&!Number.isFinite(t)&&(b=!0);break;case"object":t&&g(t)===M&&(b=!0);break;case"array":Array.isArray(t)&&(b=!0);break;case"other":b=this.currOtherTypeCallback(t,r,n,i);break;case"null":t===null&&(b=!0);break;default:throw new TypeError("Unknown value type "+M)}if(b)return h={path:r,value:t,parent:n,parentProperty:i},this._handleCallback(h,o,"value"),h}else if(c[0]==="`"&&t&&v.call(t,c.slice(1))){var z=c.slice(1);y(this._trace(l,t[z],E(r,z),t,z,o,a,!0))}else if(c.includes(",")){var gt=c.split(","),L=Bt(gt),et;try{for(L.s();!(et=L.n()).done;){var At=et.value;y(this._trace(Y(At,l),t,r,n,i,o,!0))}}catch(p){L.e(p)}finally{L.f()}}else!s&&t&&v.call(t,c)&&y(this._trace(l,t[c],E(r,c),t,c,o,a,!0))}if(this._hasParentSelector)for(var w=0;w<f.length;w++){var j=f[w];if(j&&j.isParentSelector){var R=this._trace(j.expr,t,j.path,n,i,o,a);if(Array.isArray(R)){f[w]=R[0];for(var wt=R.length,J=1;J<wt;J++)w++,f.splice(w,0,R[J])}else f[w]=R}}return f};d.prototype._walk=function(e,t){if(Array.isArray(e))for(var r=e.length,n=0;n<r;n++)t(n);else e&&g(e)==="object"&&Object.keys(e).forEach(function(i){t(i)})};d.prototype._slice=function(e,t,r,n,i,o,a){if(Array.isArray(r)){var s=r.length,u=e.split(":"),h=u[2]&&Number.parseInt(u[2])||1,c=u[0]&&Number.parseInt(u[0])||0,l=u[1]&&Number.parseInt(u[1])||s;c=c<0?Math.max(0,c+s):Math.min(s,c),l=l<0?Math.max(0,l+s):Math.min(s,l);for(var f=[],y=c;y<l;y+=h){var A=this._trace(Y(y,t),r,n,i,o,a,!0);A.forEach(function(b){f.push(b)})}return f}};d.prototype._eval=function(e,t,r,n,i,o){this.currSandbox._$_parentProperty=o,this.currSandbox._$_parent=i,this.currSandbox._$_property=r,this.currSandbox._$_root=this.json,this.currSandbox._$_v=t;var a=e.includes("@path");a&&(this.currSandbox._$_path=d.toPathString(n.concat([r])));var s="script:"+e;if(!d.cache[s]){var u=e.replace(/@parentProperty/g,"_$_parentProperty").replace(/@parent/g,"_$_parent").replace(/@property/g,"_$_property").replace(/@root/g,"_$_root").replace(/@([\t-\r \)\.\[\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF])/g,"_$_v$1");a&&(u=u.replace(/@path/g,"_$_path")),d.cache[s]=new this.vm.Script(u)}try{return d.cache[s].runInNewContext(this.currSandbox)}catch(h){throw new Error("jsonPath: "+h.message+": "+e)}};d.cache={};d.toPathString=function(e){for(var t=e,r=t.length,n="$",i=1;i<r;i++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(t[i])||(n+=/^[\*0-9]+$/.test(t[i])?"["+t[i]+"]":"['"+t[i]+"']");return n};d.toPointer=function(e){for(var t=e,r=t.length,n="",i=1;i<r;i++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(t[i])||(n+="/"+t[i].toString().replace(/~/g,"~0").replace(/\//g,"~1"));return n};d.toPathArray=function(e){var t=d.cache;if(t[e])return t[e].concat();var r=[],n=e.replace(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/g,";$&;").replace(/['\[](\??\((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\))['\]]/g,function(o,a){return"[#"+(r.push(a)-1)+"]"}).replace(/\[["']((?:(?!['\]])[\s\S])*)["']\]/g,function(o,a){return"['"+a.replace(/\./g,"%@%").replace(/~/g,"%%@@%%")+"']"}).replace(/~/g,";~;").replace(/["']?\.["']?(?!(?:(?!\[)[\s\S])*\])|\[["']?/g,";").replace(/%@%/g,".").replace(/%%@@%%/g,"~").replace(/(?:;)?(\^+)(?:;)?/g,function(o,a){return";"+a.split("").join(";")+";"}).replace(/;;;|;;/g,";..;").replace(/;$|'?\]|'$/g,""),i=n.split(";").map(function(o){var a=o.match(/#([0-9]+)/);return!a||!a[1]?o:r[a[1]]});return t[e]=i,t[e].concat()};var Ut=function(t,r,n){for(var i=t.length,o=0;o<i;o++){var a=t[o];n(a)&&r.push(t.splice(o--,1)[0])}},Ht=function(){function e(t){nt(this,e),this.code=t}return it(e,[{key:"runInNewContext",value:function(r){var n=this.code,i=Object.keys(r),o=[];Ut(i,o,function(c){return typeof r[c]=="function"});var a=i.map(function(c,l){return r[c]}),s=o.reduce(function(c,l){var f=r[l].toString();return/function/.test(f)||(f="function "+f),"var "+l+"="+f+";"+c},"");n=s+n,!/(["'])use strict\1/.test(n)&&!i.includes("arguments")&&(n="var arguments = undefined;"+n),n=n.replace(/;[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*$/,"");var u=n.lastIndexOf(";"),h=u>-1?n.slice(0,u+1)+" return "+n.slice(u+1):" return "+n;return D(Function,i.concat([h])).apply(void 0,Nt(a))}}]),e}();d.prototype.vm={Script:Ht};async function Q(e,t,r,n){return F({url:e,options:t,validator:r,callback:n}).then(O).then(i=>i.response)}async function F({url:e,options:t,validator:r,callback:n},i="initial"){let o=new Date,a=await fetch(e,t);if(!a.ok)throw new Error("Fetch failed");if((r==null?void 0:r(a))===!1)throw new Error("Response is not valid");let s=new Date(a.headers.get("date"))<o;return n==null||n(a,i),{url:e,options:t,isCached:s,response:a,validator:r}}async function O(e){let{url:t,isCached:r,options:n,validator:i,response:o,callback:a}=e;if(r){let{response:s}=await F({url:t+"?"+Math.random(),options:{...n,method:"HEAD",cache:"no-cache"},validator:i},"check");if(s.headers.get("last-modified")!=o.headers.get("last-modified"))return I(e)}return e}async function I(e){let{url:t,options:r,validator:n,callback:i}=e;return F({url:t,options:{...r,cache:"reload"},validator:n,callback:i},"updated")}function st({cdn:e="https://feaascomponentsapidev.blob.core.windows.net",hostname:t,library:r,component:n,version:i,revision:o="published"}){return`${e||t}/components/${r}/${n}/${i}/${o}.html`}function Wt({cdn:e="https://feaascomponentsapidev.blob.core.windows.net",hostname:t,library:r,revision:n="published"}){return`${e||t}/styles/${r}/${n}.css`}async function U(e,t){let r=a=>a.headers.get("x-ms-meta-versionDeletedAt")==null,n=a=>{a.text().then(t)},i=await Promise.all([e.instance&&F({options:{headers:{Accept:"text/html"}},url:st({...e,version:e.instance}),validator:r}).catch(a=>a),F({url:st(e),validator:r}).catch(a=>a)]),o=i.find(a=>a&&"isCached"in a&&a);if(!o||o instanceof Error)throw i.find(s=>s&&s instanceof Error)||new Error("Can not fetch component");return i[0]==o&&console.log("Using fork!",i),n(o.response),O({...o,callback:n}).catch(a=>{if(i[0]==o&&(I({...o,callback:null,validator:null}),console.log("Fork was deleted"),!(i[1]instanceof Error)))return n(i[1].response),O({...i[1],callback:n});throw a})}async function H(e,t){return Q(Wt(e),{headers:{Accept:"text/css"}},r=>r.headers.get("x-ms-meta-deletedAt")==null,r=>{r.text().then(t)})}function qt(e,t){let r=document.createElement("div");r.innerHTML=e;let n=document.createDocumentFragment();for(;r.firstChild;)n.appendChild(r.firstChild);return _(n,t),r}function ct(e){return e.replace(/(\[[^\]\[]+\]|\.\*)$/g,"")}function lt(e){return ct(e)+".*"}function ht(e){let t=e.getAttribute("data-path-scope");for(var r=0,n=e;n=n.previousElementSibling;)n.getAttribute("data-path-scope")==t&&r++;return r}function zt(e,t,r){let n=e.getAttribute("data-path-scope");if(n==null)return;var i=ht(e);if(i!=0)return;let o=e.parentElement;if(o!=null){t==0?e.setAttribute("hidden","hidden"):e.getAttribute("hidden")!=null&&e.removeAttribute("hidden");for(var a=i+1,s=e,u=e;u=u.nextElementSibling;)u.getAttribute("data-path-scope")==n&&(a++,s=u);for(var h=a;h<t;h++)o.insertBefore(s.cloneNode(!0),s.nextElementSibling);for(var h=Math.max(1,t);h<a;h++)s=s.previousElementSibling,o.removeChild(s.nextElementSibling)}}function Z(e,t,r=!1,n=e){var i=t;let o=Object.keys(e).sort((s,u)=>u.length-s.length);for(let s of o)if(t.startsWith(s)){if(s==t){if(r)return e[s];continue}i=t.substring(s.length+1),n=e[s];break}var a=d({path:i,json:n});return Array.isArray(a)&&(a==null?void 0:a.length)==0&&(a=[i.replace(/^.*?\./,"_."),i.replace(/^.*?\./,""),i.replace(/^([^.]+).*?\.\$\./,"$1."),i.replace(/^.*?\.\$\./,"_."),i.replace(/^.*?\.\$\./,""),i.replace(/^[^.]+$/,"_")].filter((s,u,h)=>h.indexOf(s)===u).reduce((s,u)=>s.length>0?s:d({path:u,json:n}),[])),r&&Array.isArray(a)?a[0]:a}function x(e,t,r,n){var i;if(e){var o=e;(r==null?void 0:r.type)=="doc"&&Array.isArray(r.content)&&(r=$(r)),n!=null&&n.processValue&&(r=n==null?void 0:n.processValue(e,t,r));var a=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")a="innerHTML";else if(t=="data-embed-src")W(e,r);else if(t=="data-path-attributes"){let l=((i=e.getAttribute("data-attributes-keys"))===null||i===void 0?void 0:i.split(",").filter(Boolean))||[];if(!Array.isArray(r))for(var s in r){var u=r[s];x(e,s,typeof u=="object"&&u?JSON.stringify(u):u,n)}for(var h=0;h<l.length;h++)(r==null||!(l[h]in r))&&x(e,l[h],null,n);x(e,"data-attributes-keys",Object.keys(r||{}).join(","));return}if(typeof r=="boolean"&&(r=r?"":null),!!o){var c=String(e.getAttribute("data-path-placeholder")||o[a]);r!=null?a=="innerHTML"?o.innerHTML!=r&&(o.innerHTML=r):o.getAttribute(a)!=r&&o.setAttribute(a,r):a=="innerHTML"?o.innerHTML=c:o.removeAttribute(a)}}}function ft(e){let t=new e.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(n=>{let i=n.target,o=i.getAttribute("data-embed-src");o&&W(i,o),n.addedNodes&&n.addedNodes.forEach(a=>{a.nodeType==1&&dt(a,!1)})})});return t.observe(e,{attributes:!0,subtree:!0,childList:!0}),t}function dt(e,t=!0){let r=e.querySelectorAll("[data-embed-src]");for(var n=0;n<r.length;n++){let i=r[n];W(i,i.getAttribute("data-embed-src"))}if(t)return ft(e)}function W(e,t){for(var r=e;r;r=r.parentElement)if(!r.parentElement){let i=r.querySelectorAll("script");for(var n=0;n<i.length;n++)if(i[n].getAttribute("src")==t)return!0;r.tagName=="HTML"&&(r=r.querySelector("head")||r);let o=r.ownerDocument.createElement("script");o.type="module",o.src=t,r.appendChild(o);break}}var ut=["data-attributes-keys","data-path-attributes","data-path-scope"];function _(e,t,r,n){var i,o,a;let s=e;if(n||(t=((i=r==null?void 0:r.processData)===null||i===void 0?void 0:i.call(r,s,t))||t),s.nodeType==1){let h=s.getAttribute("data-path-scope");if(h){let l=ht(s),f=Z(t,h,!1)||[];l==0&&zt(s,((o=r==null?void 0:r.shouldRepeat)===null||o===void 0?void 0:o.call(r,s,f))===!1?1:f.length,r),t={...t,[lt(h)]:f[l]}}let c=Array.prototype.slice.call(s.attributes).sort((l,f)=>ut.indexOf(l.name)-ut.indexOf(f.name));for(var u=0;u<c.length;u++){let{name:l,value:f}=c[u];l.startsWith("data-path")&&l!="data-path-scope"&&x(s,l,Z(t,f,!0),r),l=="data-embed-src"&&x(s,l,s.getAttribute(l),r)}}for(var u=0;u<s.children.length;u++)_(s.children[u],t,r,!0);return n||(a=r==null?void 0:r.onRender)===null||a===void 0||a.call(r,s,t),s}function P(e,t,r,n){var i;let o=((i=n==null?void 0:n.processTemplate)===null||i===void 0?void 0:i.call(n,e,t,r))||t;if(e.innerHTML=o,e.classList.add("-feaas"),(e.closest(".component.feaas")||e).className.includes("-theme--"))for(let s of e.children)s.className=s.className.replace(/(\s|^)-theme--[^\s]+\s*/g,"$1");return _(e,r,n)}function Jt(e,t){return pt(e,t||(t=document.createElement("style"))),t}function pt(e,t){return t||(t=document.createElement("style")),H(e,r=>{t.textContent=r}).then(()=>t)}function Kt(e,t){return yt(e,t||(t=document.createElement("div"))),t}async function yt(e,t){return t||(t=document.createElement("div")),t.childNodes.length?_(t,e.data,e):"template"in e?P(t,e.template,e.data,e):U(e,r=>P(t,r,e.data,e)).then(()=>t)}function X(e,t={},r){return r?`<${r}${Object.entries(t).map(([n,i])=>i!=null&&` ${n}="${i}"`).filter(Boolean).join("")}>${$(e)}</${r}>`.replace(/^<([a-z0-9][^>]*)><\/[^>]+>$/,"<$1 />"):$(e)}function $(e){var t;if(Array.isArray(e))return e.map($).join(`
4
+ `).trim();if(typeof e=="string")return e;if(e==null)return"";switch(e.type){case"heading":let{level:r,...n}=e.attrs;return X(e.content,n,"h"+r);case"text":return(e.marks||[]).reduce((i,o)=>X(i,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 X(e.content||e.text,e.attrs,{bulletList:"ul",orderedList:"ol",listItem:"li",horizontalRule:"hr",paragraph:"p",codeBlock:"code",blockquote:"blockquote"}[e.type])}}function vt(e=this){let t,r=e.getAttribute("data");if(r!=null)try{t=typeof r=="string"?JSON.parse(r):{}}catch(n){}return{data:t!=null?t:{},library:e.getAttribute("library"),component:e.getAttribute("component"),version:e.getAttribute("version"),revision:e.getAttribute("revision"),hostname:e.getAttribute("hostname"),cdn:e.getContextAttribute("cdn"),template:e.getAttribute("template"),instance:e.getAttribute("instance"),editable:e.getAttribute("editable")!=null,suspended:e.getAttribute("suspended")!=null}}var T=class extends m{setData(t){this.set({data:t})}getProps(){return vt(this)}attributeChangedCallback(t,r,n){r!==n&&(this.payload=void 0,this.needsRefresh=!0,super.attributeChangedCallback(t,r,n))}getEditor(){var t;return(t=document.querySelector("feaas-context"))===null||t===void 0?void 0:t.refs.editor}constructor(){super(),this.addEventListener("click",()=>{this.props.editable&&this.edit()})}edit(){let t=this.getEditor();if(t!=null&&t.setTarget(this))return t.open(),!0}getOriginal(){let t=this.getAttribute("data-path-scope");if(t){for(var r=this;(r=r.previousElementSibling)&&r.getAttribute("data-path-scope")==t;)var n=r;return n}}isReadyToLoad(){return super.isReadyToLoad()&&this.props.library!=null&&this.props.component!=null&&this.props.version!=null}async load(){if(!this.getOriginal())try{U(this.props,this.onLoad)}catch(t){console.error(`FEAAS: Could not fetch component: ${this.props.component}/${this.props.version}/${this.props.revision}`)}}update(){if(Array.from(this.children).filter(t=>t.tagName!="BR").length>0&&!this.needsRefresh)_(this,this.props.data);else{if(this.needsRefresh=!0,this.getOriginal())return;P(this,this.payload,this.props.data)}}};T.observedAttributes=["library","component","version","revision","hostname","cdn","template","data","instance","editable"];T.register("feaas-component");function bt(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 N=class extends m{getProps(){return bt(this)}attributeChangedCallback(t,r,n){if(r!==n)return t=="hidden"&&(this.style.setProperty("display","block","important"),this.style.setProperty("transition","opacity 0.3s","important"),n?(this.style.setProperty("opacity","0","important"),this.style.pointerEvents="none"):(this.style.setProperty("opacity","1","important"),this.style.pointerEvents="all")),super.attributeChangedCallback(t,r,n)}connectedCallback(){this.payload=null,super.connectedCallback(),this.attributeChangedCallback("hidden",this.getAttribute("hidden"),this.getAttribute("hidden")),this.stylesheet=document.createElement("style"),this.stylesheet.textContent=`
5
5
  #loader {
6
6
  position: absolute;
7
7
  top: 0;
@@ -65,5 +65,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
65
65
  style="animation: 1.5s linear 0s infinite normal none running loader-circular-track"
66
66
  ></circle>
67
67
  </svg>
68
- </div>`,this.getRoot().appendChild(this.stylesheet),this.getRoot().appendChild(this.loader)}update(){this.loader.style.opacity=String(this.props.opacity)}};N.observedAttributes=["hidden","opacity"];N.register("feaas-loader");function bt(t=this){var e;return{library:t==null?void 0:t.getContextAttribute("library"),revision:(e=t==null?void 0:t.getAttribute("revision"))!==null&&e!==void 0?e:"published",cdn:(t==null?void 0:t.getContextAttribute("cdn"))||(t==null?void 0:t.getContextAttribute("hostname"))}}var W=class extends m{getProps(){return bt(this)}isReadyToLoad(){return this.props.library!=null&&this.props.revision!=null&&this.props.cdn!=null}async load(){U(this.props,this.onLoad)}update(){this.stylesheet||(this.stylesheet=document.createElement("style"),this.appendChild(this.stylesheet)),this.stylesheet.textContent=this.payload}};W.register("feaas-stylesheet");var Z;typeof window!="undefined"&&(window.FEAASElement=R,(Z=window.FEAASLoading)!==null&&Z!==void 0||(window.FEAASLoading=Promise.resolve()));
68
+ </div>`,this.getRoot().appendChild(this.stylesheet),this.getRoot().appendChild(this.loader)}update(){this.loader.style.opacity=String(this.props.opacity)}};N.observedAttributes=["hidden","opacity"];N.register("feaas-loader");function mt(e=this){var t;return{library:e==null?void 0:e.getContextAttribute("library"),revision:(t=e==null?void 0:e.getAttribute("revision"))!==null&&t!==void 0?t:"published",cdn:(e==null?void 0:e.getContextAttribute("cdn"))||(e==null?void 0:e.getContextAttribute("hostname"))}}var q=class extends m{getProps(){return mt(this)}isReadyToLoad(){return this.props.library!=null&&this.props.revision!=null&&this.props.cdn!=null}async load(){H(this.props,this.onLoad)}update(){this.stylesheet||(this.stylesheet=document.createElement("style"),this.appendChild(this.stylesheet)),this.stylesheet.textContent=this.payload}};q.register("feaas-stylesheet");var tt;typeof window!="undefined"&&(window.FEAASElement=S,(tt=window.FEAASLoading)!==null&&tt!==void 0||(window.FEAASLoading=Promise.resolve()));
69
69
  //# sourceMappingURL=basic.js.map