@sitecore-feaas/clientside 0.6.3-alpha.5 → 0.6.3-alpha.7

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.
@@ -1,7 +1,7 @@
1
1
  var Ye=Object.defineProperty;var q=(e,t)=>{for(var r in t)Ye(e,r,{get:t[r],enumerable:!0})};function x(e,t=r=>{}){var r;let n=()=>{var i,o;let a=new Promise((l,u)=>{i=c=>{e==null||e(c),l(c)},o=u});var s=Object.assign(a,{resolve:i,reject:o,restart:n,first:r});return r=s,s.catch(t),s};return n()}var Qe=typeof HTMLElement=="undefined"?typeof windowJSDOM!="undefined"?windowJSDOM.HTMLElement:class{}:HTMLElement,E=class extends Qe{getProps(t){return{}}constructor(){super(),this.defaultProps={},this.connected=!1,this.refs={},this.descendants=[],this.whenLoaded=x(t=>{this.payload=t}),this.whenRendered=x(()=>this.initialized=!0,()=>this.cancelRender()),this.addEventListener("feaasMount",this),this.addEventListener("feaasUnmount",this)}getRoot(){return this}attributeChangedCallback(t,r,n){this.set()}connectedCallback(){this.mount()}disconnectedCallback(){this.unmount()}mount(){try{console.log("hello in here");let t=this.getParent();if(t&&!t.connected||this.connected)return;this.connected=!0,this.log("FEAAS: Mount",this.tagName,this),this.dispatchEventIndirectly(new Event("feaasMount",{bubbles:!0,composed:!0})),this.getElements().map(r=>{var n;return(n=r.mount)===null||n===void 0?void 0:n.call(r)}),this.set()}catch(t){this.onError(t)}}dispatchEventIndirectly(t){this.dispatchEvent(t);let r=this.getParent();r&&!r.contains(this)&&(Object.defineProperty(t,"target",{value:this,writable:!1}),Object.defineProperty(t,"composedPath",{value:()=>[this],writable:!1}),r.handleEvent(t))}isJSONAttribute(t){return!1}log(...t){let r=t[0];(typeof location!="undefined"&&(location!=null&&location.hostname.startsWith("components-"))||localStorage["Sitecore.Components.Debug"])&&console.log(r+" "+t.slice(1).map(n=>n&&typeof n=="object"?"%O":"%s").join(" "),...t.slice(1))}unmount(){this.connected&&(this.log("FEAAS: Unmount",this),this.dispatchEventIndirectly(new Event("feaasUnmount",{bubbles:!0,composed:!0})),this.connected&&this.initialized&&this.render&&this.update(),this.cancelRender(),this.connected=!1,this.initialized&&this.render&&this.update())}getParent(t=!0){for(var r=this;r=r.parentElement||(r.parentNode instanceof ShadowRoot?r.parentNode.host:null);)if(!t||r.tagName.startsWith("FEAAS-"))return r;if(this.tagName!="FEAAS-CONTEXT")return document.querySelector("feaas-context")}getElements(t=this.getRoot(),r=!0){return Array.from(t.querySelectorAll("*")).map(n=>[!r||n.tagName.startsWith("FEAAS-")?n:null,n.shadowRoot?this.getElements(n.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,n;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&&((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}onError(t,r="uncaught",n=!1){let i=new CustomEvent("feaasError",{bubbles:!0,composed:!0,detail:t});if(this.dispatchEventIndirectly(i),this.whenLoaded.reject(t),!i.defaultPrevented&&!n){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.dispatchEventIndirectly(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;if(!this.connected)return;let n=(r=(t=this.payload)===null||t===void 0?void 0:t.ReactDOM)===null||r===void 0?void 0:r.flushSync;n?n(()=>this.update()):this.update()}load(){return Promise.resolve(null)}update(){var t,r,n;if(this.payload==null||!this.render)return;let{React:i,ReactDOM:o,ReactDOMClient:a}=this.payload||{};if(!i)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.getAttribute("hydrate")=="false"&&this.firstElementChild||(!this.refs.topReact&&!this.forceUpdateReact?(this.reactRoot||(this.reactRoot=a.createRoot(this.getReactRootElement())),this.reactRoot.render(this.getReactElement())):this.forceUpdateReact&&this.connected?(t=this.forceUpdateReact)===null||t===void 0||t.call(this):(n=(r=this.refs.topReact)===null||r===void 0?void 0:r.forceUpdateReact)===null||n===void 0||n.call(r))}invokeReactRendering(){let{React:t,ReactDOM:r}=this.payload||{};if(!this.connected)return null;let n=this.descendants.filter(i=>i.refs.parentReact==this&&i.payload&&i.connected).map((i,o)=>this.getReactElement(i));return this.render({...this.props,children:n},this.payload)}getReactErrorBoundary(t=this,r=t.tagName){if(this.reactErrorBoundary)return this.reactErrorBoundary;let{React:n,ReactDOM:i}=t.payload||{};return this.reactErrorBoundary||(this.reactErrorBoundary=class extends n.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromError(a){return{error:a}}componentDidCatch(a,s){console.error(`FEAAS: ${t.tagName} Error:`,a,s),t.onError(a,"react")}render(){if(!this.state.error)return this.props.children}})}getReactElement(t=this,r){let{React:n,ReactDOM:i}=t.payload||{},o=this.getReactErrorBoundary(),a=this.getReactWrapper(t);return n.createElement(o,{key:t.tagName+"-"+t.getUID(),slot:t.getAttribute("slot")},n.createElement(a,null))}getReactWrapper(t=this,r=t.tagName){if(t.reactWrapper)return t.reactWrapper;let{React:n,ReactDOM:i}=t.payload||{};return t.reactWrapper=o=>{if(t.render){let[a,s]=n.useReducer(l=>l+1,0);return t.forceUpdateReact=s,i.createPortal(n.createElement(n.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.isJSONAttribute(r),o=this.props[r],a=i?JSON.stringify(o):String(o),s=this.defaultProps[r],l=i?JSON.stringify(s):String(s),u=r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),c=this.getAttribute(u);try{var n=i?JSON.stringify(JSON.parse(c)):c}catch(d){var n=null}o==null||a===l?this.removeAttribute(u):(typeof o=="string"||typeof o=="number"||typeof o=="boolean"||i)&&n!=a&&this.setAttribute(u,a)}}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()),this.cancelRender(),this.nextRender=requestAnimationFrame(()=>{this.nextRender=null,this.advance().catch(t=>{})})}cancelRender(){cancelAnimationFrame(this.nextRender)}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,r){r==null&&(r=typeof window!="undefined"?window:null),r&&!r.customElements.get(t)&&r.customElements.define(t,this)}};var T=class extends E{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"),import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react-dom/client")]).then(([t,r,n])=>({React:t,ReactDOM:r,ReactDOMClient:n}))}render({},{React:t}){return t.createElement(t.Fragment,null)}},ie=class extends T{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))}};ie.observedAttributes=["counter"];var pe={};q(pe,{renderDOMContent:()=>P,renderDOMElement:()=>S,renderHTMLContent:()=>Et,setDOMAttribute:()=>O});var ue={};q(ue,{JSONPath:()=>p,queryObject:()=>B,queryObjectRaw:()=>Ne,queryScopes:()=>W,serializeCH1RichText:()=>$});function C(e){return C=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},C(e)}function _e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ce(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 De(e,t,r){return t&&Ce(e.prototype,t),r&&Ce(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Ze(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&&U(e,t)}function I(e){return I=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},I(e)}function U(e,t){return U=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},U(e,t)}function Fe(){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 j(e,t,r){return Fe()?j=Reflect.construct.bind():j=function(i,o,a){var s=[null];s.push.apply(s,o);var l=Function.bind.apply(i,s),u=new l;return a&&U(u,a.prototype),u},j.apply(null,arguments)}function et(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function oe(e){var t=typeof Map=="function"?new Map:void 0;return oe=function(n){if(n===null||!et(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 j(n,arguments,I(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),U(i,n)},oe(e)}function tt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function rt(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 tt(e)}function nt(e){var t=Fe();return function(){var n=I(e),i;if(t){var o=I(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return rt(this,i)}}function it(e){return ot(e)||at(e)||Re(e)||st()}function ot(e){if(Array.isArray(e))return ae(e)}function at(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Re(e,t){if(e){if(typeof e=="string")return ae(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 ae(e,t)}}function ae(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 st(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lt(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Re(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(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
3
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 l=r.next();return o=l.done,l},e:function(l){a=!0,s=l},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}}}var w=Object.prototype.hasOwnProperty;function N(e,t){return e=e.slice(),e.push(t),e}function se(e,t){return t=t.slice(),t.unshift(e),t}var ut=function(e){Ze(r,e);var t=nt(r);function r(n){var i;return _e(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 De(r)}(oe(Error));function p(e,t,r,n,i){if(!(this instanceof p))try{return new p(e,t,r,n,i)}catch(l){if(!l.avoidNew)throw l;return l.value}typeof e=="string"&&(i=n,n=r,r=t,t=e,e=null);var o=e&&C(e)==="object";if(e=e||{},this.json=e.json||r,this.path=e.path||t,this.resultType=e.resultType||"value",this.flatten=e.flatten||!1,this.wrap=w.call(e,"wrap")?e.wrap:!0,this.sandbox=e.sandbox||{},this.preventEval=e.preventEval||!1,this.parent=e.parent||null,this.parentProperty=e.parentProperty||null,this.callback=e.callback||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||C(s)!=="object")throw new ut(s);return s}}p.prototype.evaluate=function(e,t,r,n){var i=this,o=this.parent,a=this.parentProperty,s=this.flatten,l=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&&C(e)==="object"&&!Array.isArray(e)){if(!e.path&&e.path!=="")throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!w.call(e,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');var u=e;t=u.json,s=w.call(e,"flatten")?e.flatten:s,this.currResultType=w.call(e,"resultType")?e.resultType:this.currResultType,this.currSandbox=w.call(e,"sandbox")?e.sandbox:this.currSandbox,l=w.call(e,"wrap")?e.wrap:l,this.currPreventEval=w.call(e,"preventEval")?e.preventEval:this.currPreventEval,r=w.call(e,"callback")?e.callback:r,this.currOtherTypeCallback=w.call(e,"otherTypeCallback")?e.otherTypeCallback:this.currOtherTypeCallback,o=w.call(e,"parent")?e.parent:o,a=w.call(e,"parentProperty")?e.parentProperty:a,e=e.path}if(o=o||null,a=a||null,Array.isArray(e)&&(e=p.toPathString(e)),!(!e&&e!==""||!t)){var c=p.toPathArray(e);c[0]==="$"&&c.length>1&&c.shift(),this._hasParentSelector=null;var d=this._trace(c,t,["$"],o,a,r).filter(function(h){return h&&!h.isParentSelector});return d.length?!l&&d.length===1&&!d[0].hasArrExpr?this._getPreferredOutput(d[0]):d.reduce(function(h,f){var m=i._getPreferredOutput(f);return s&&Array.isArray(m)?h=h.concat(m):h.push(m),h},[]):l?[]:void 0}};p.prototype._getPreferredOutput=function(e){var t=this.currResultType;switch(t){case"all":{var 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){var n=this._getPreferredOutput(e);e.path=typeof e.path=="string"?e.path:p.toPathString(e.path),t(n,r,e)}};p.prototype._trace=function(e,t,r,n,i,o,a,s){var l=this,u;if(!e.length)return u={path:r,value:t,parent:n,parentProperty:i,hasArrExpr:a},this._handleCallback(u,o,"value"),u;var c=e[0],d=e.slice(1),h=[];function f(g){Array.isArray(g)?g.forEach(function(Xe){h.push(Xe)}):h.push(g)}if((typeof c!="string"||s)&&t&&w.call(t,c))f(this._trace(d,t[c],N(r,c),t,c,o,a));else if(c==="*")this._walk(t,function(g){f(l._trace(d,t[g],N(r,g),t,g,o,!0,!0))});else if(c==="..")f(this._trace(d,t,r,n,i,o,a)),this._walk(t,function(g){C(t[g])==="object"&&f(l._trace(e.slice(),t[g],N(r,g),t,g,o,!0))});else{if(c==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:d,isParentSelector:!0};if(c==="~")return u={path:N(r,c),value:i,parent:n,parentProperty:null},this._handleCallback(u,o,"property"),u;if(c==="$")f(this._trace(d,t,r,null,null,o,a));else if(/^(\x2D?[0-9]*):(\x2D?[0-9]*):?([0-9]*)$/.test(c))f(this._slice(c,d,t,r,n,i,o));else if(c.indexOf("?(")===0){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");var m=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(g){l._eval(m,t[g],g,r,n,i)&&f(l._trace(d,t[g],N(r,g),t,g,o,!0))})}else if(c[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");f(this._trace(se(this._eval(c,t,r[r.length-1],r.slice(0,-1),n,i),d),t,r,n,i,o,a))}else if(c[0]==="@"){var y=!1,v=c.slice(1,-2);switch(v){case"scalar":(!t||!["object","function"].includes(C(t)))&&(y=!0);break;case"boolean":case"string":case"undefined":case"function":C(t)===v&&(y=!0);break;case"integer":Number.isFinite(t)&&!(t%1)&&(y=!0);break;case"number":Number.isFinite(t)&&(y=!0);break;case"nonFinite":typeof t=="number"&&!Number.isFinite(t)&&(y=!0);break;case"object":t&&C(t)===v&&(y=!0);break;case"array":Array.isArray(t)&&(y=!0);break;case"other":y=this.currOtherTypeCallback(t,r,n,i);break;case"null":t===null&&(y=!0);break;default:throw new TypeError("Unknown value type "+v)}if(y)return u={path:r,value:t,parent:n,parentProperty:i},this._handleCallback(u,o,"value"),u}else if(c[0]==="`"&&t&&w.call(t,c.slice(1))){var b=c.slice(1);f(this._trace(d,t[b],N(r,b),t,b,o,a,!0))}else if(c.includes(",")){var D=c.split(","),z=lt(D),Ee;try{for(z.s();!(Ee=z.n()).done;){var Ge=Ee.value;f(this._trace(se(Ge,d),t,r,n,i,o,!0))}}catch(g){z.e(g)}finally{z.f()}}else!s&&t&&w.call(t,c)&&f(this._trace(d,t[c],N(r,c),t,c,o,a,!0))}if(this._hasParentSelector)for(var R=0;R<h.length;R++){var V=h[R];if(V&&V.isParentSelector){var L=this._trace(V.expr,t,V.path,n,i,o,a);if(Array.isArray(L)){h[R]=L[0];for(var Ke=L.length,ne=1;ne<Ke;ne++)R++,h.splice(R,0,L[ne])}else h[R]=L}}return h};p.prototype._walk=function(e,t){if(Array.isArray(e))for(var r=e.length,n=0;n<r;n++)t(n);else e&&C(e)==="object"&&Object.keys(e).forEach(function(i){t(i)})};p.prototype._slice=function(e,t,r,n,i,o,a){if(Array.isArray(r)){var s=r.length,l=e.split(":"),u=l[2]&&Number.parseInt(l[2])||1,c=l[0]&&Number.parseInt(l[0])||0,d=l[1]&&Number.parseInt(l[1])||s;c=c<0?Math.max(0,c+s):Math.min(s,c),d=d<0?Math.max(0,d+s):Math.min(s,d);for(var h=[],f=c;f<d;f+=u){var m=this._trace(se(f,t),r,n,i,o,a,!0);m.forEach(function(y){h.push(y)})}return h}};p.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=p.toPathString(n.concat([r])));var s="script:"+e;if(!p.cache[s]){var l=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&&(l=l.replace(/@path/g,"_$_path")),p.cache[s]=new this.vm.Script(l)}try{return p.cache[s].runInNewContext(this.currSandbox)}catch(u){throw new Error("jsonPath: "+u.message+": "+e)}};p.cache={};p.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};p.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};p.toPathArray=function(e){var t=p.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 ct=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])}},dt=function(){function e(t){_e(this,e),this.code=t}return De(e,[{key:"runInNewContext",value:function(r){var n=this.code,i=Object.keys(r),o=[];ct(i,o,function(c){return typeof r[c]=="function"});var a=i.map(function(c,d){return r[c]}),s=o.reduce(function(c,d){var h=r[d].toString();return/function/.test(h)||(h="function "+h),"var "+d+"="+h+";"+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 l=n.lastIndexOf(";"),u=l>-1?n.slice(0,l+1)+" return "+n.slice(l+1):" return "+n;return j(Function,i.concat([u])).apply(void 0,it(a))}}]),e}();p.prototype.vm={Script:dt};function Ne(e,t){try{return p({path:t,json:e})}catch(r){return[]}}function B(e,t,r=!0){let n=Ne(e,t)||[];return r?n.flat(1/0):n}function W(e,t,r=!1,n=e,i=!0){var o=t;let a=Object.keys(e).sort((l,u)=>u.length-l.length);for(let l of a)if(t.startsWith(l)){if(l==t){if(r)return e[l];continue}o=t.substring(l.length+1),n=e[l];break}var s=B(n,o,i);return console.log("------",s),s.length==0&&(s=[o.replace(/^.*?\./,"_."),o.replace(/^.*?\./,""),o.replace(/^([^.]+).*?\.\$([\.\[])/,"$1$2"),o.replace(/^.*?\.\$([\.\[])/,"_$1"),o.replace(/^.*?\.\$([\.\[])/,"$$$1"),o.replace(/^[^.]+$/,"_")].filter((l,u,c)=>c.indexOf(l)===u).reduce((l,u)=>l.length>0?l:B(n,u,i),[])),console.log("----",o,s),r?s[0]:s}function le(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 le(e.content,n,"h"+r);case"text":return(e.marks||[]).reduce((i,o)=>le(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 le(e.content||e.text,e.attrs,{bulletList:"ul",orderedList:"ol",listItem:"li",horizontalRule:"hr",paragraph:"p",codeBlock:"code",blockquote:"blockquote"}[e.type])}}var F=class{constructor(t,r=1,n){this.ownerDocument={createElement(i){return new F(i)},createDocumentFragment(){return new F(null,11)}},this.nodeName=t,this.nodeType=r,this.textContent=n,this.attributes=[],this.childNodes=[]}setAttribute(t,r){let n=this.attributes.find(i=>i.name===t);n?n.value=r:this.attributes.push({name:t,value:r})}getAttribute(t){let r=this.attributes.find(n=>n.name===t);return r?r.value:void 0}insertBefore(t,r){if(t.parentNode=this,r===null)this.childNodes.push(t);else{let n=this.childNodes.indexOf(r);n!==-1&&this.childNodes.splice(n,0,t)}}removeAttribute(t){let r=this.attributes.findIndex(n=>n.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 ce(this.childNodes)}set innerHTML(t){this.childNodes=de(String(t!=null?t:""))}get outerHTML(){return ce([this])}get children(){return this.childNodes.filter(t=>t.nodeType==1)}closest(t){let r=this;for(;r;){if(Oe(t,r))return r;r=r.parentNode}return null}querySelectorAll(t){let r=t.split(/\s*,\s*/),n=[],i=o=>{for(let a of r)if(Oe(a,o)){n.push(o);break}for(let a of o.childNodes)i(a)};for(let o of this.childNodes)i(o);return n}querySelector(t){return this.querySelectorAll(t)[0]}findSibling(t,r){if(!this.parentNode)return null;let n=this.parentNode.childNodes,i=n.indexOf(this);if(i===-1)return null;for(let o=i+t;o>=0&&o<n.length;o+=t){let a=n[o];if(!r||a.nodeType===1)return a}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 F(this.nodeName,this.nodeType);if(r.attributes=JSON.parse(JSON.stringify(this.attributes)),this.textContent&&(r.textContent=this.textContent),t)for(let n of this.childNodes){let i=n.cloneNode(!0);r.appendChild(i)}return r}get parentElement(){var t;return((t=this.parentNode)===null||t===void 0?void 0:t.nodeType)==1?this.parentNode:null}};function Oe(e,t){let r=e.match(/([.#]?[\w-]+|\[([\w-]+)(="([^"]*)")?\])/g);if(!r)return!1;for(let n of r)if(n.startsWith("#")){if(t.getAttribute("id")!==n.slice(1))return!1}else if(n.startsWith(".")){if(!(t.getAttribute("class")||"").split(" ").includes(n.slice(1)))return!1}else if(n.startsWith("[")){let i=n.match(/^\[([\w-]+)(="([^"]*)")?\]$/);if(i){let o=i[1],a=i[3],s=t.getAttribute(o);if(typeof a=="undefined"){if(s===void 0)return!1}else if(s!==a)return!1}else return!1}else if(t.nodeName!==n)return!1;return!0}function de(e){var t;let r=[],n=[];for(;e;){let i=e.match(/^<([\w-]+)(\s[^>]*)?>/),o=e.match(/^<\/([\w-]+)>/);if(i){let a=i[1].toLowerCase(),l=((t=(i[2]||"").match(/([\w-]+)(="([^"]*)")?/g))===null||t===void 0?void 0:t.map(c=>{let[d,h,,f]=c.match(/([\w-]+)(="([^"]*)")?/);return{name:h,value:ft(f||"")}}))||[],u=new F(a,1);if(u.attributes=l,n.length>0){let c=n[n.length-1];c.childNodes.push(u),u.parentNode=c}else r.push(u);["img","input","br"].includes(a)||n.push(u),e=e.slice(i[0].length)}else if(o)n.pop(),e=e.slice(o[0].length);else{let a=e.indexOf("<"),s=e.slice(0,a!==-1?a:void 0),l=new F("#text",3);if(l.textContent=s,n.length>0){let u=n[n.length-1];u.childNodes.push(l),l.parentNode=u}else r.push(l);e=e.slice(s.length)}}return r}function ht(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function ft(e){return e.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#x27;/g,"'")}function ce(e){return e.map(t=>{if(t.nodeType===3)return t.textContent||"";let{nodeName:r,attributes:n}=t,i=n.map(({name:a,value:s})=>` ${a}="${ht(String(s))}"`).join(""),o=ce(t.childNodes);return["img","input","br"].includes(r)?`<${r}${i} />`:`<${r}${i}>${o}</${r}>`}).join("")}function pt(e){let t=new e.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(n=>{let i=n.target,o=i.getAttribute("data-embed-src");o&&G(i,o),n.addedNodes&&n.addedNodes.forEach(a=>{a.nodeType==1&&mt(a,!1)})})});return t.observe(e,{attributes:!0,subtree:!0,childList:!0}),t}function mt(e,t=!0){let r=e.querySelectorAll("[data-embed-src]");for(var n=0;n<r.length;n++){let i=r[n];G(i,i.getAttribute("data-embed-src"))}if(t)return pt(e)}function G(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.setAttribute("type","module"),o.setAttribute("src",t),r.appendChild(o);break}}var fe={};q(fe,{adjustNumbers:()=>bt,cleanCollectionBit:()=>K,getHumanizedLabel:()=>At,getLastPathBit:()=>wt,getQualifier:()=>gt,normalizeCollectionScope:()=>he,parseLimit:()=>yt,parseRange:()=>vt});var yt=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},vt=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(n=>{if(n.match(/^-?\d+$/))return n;let i=n.match(/^(\d+):(\d+)$/);return i&&parseInt(i[1],10)<parseInt(i[2],10)?i[1]+"-"+i[2]:null});return r!=null&&r.every(Boolean)?r.join(","):null},gt=e=>{var t;return(t=e==null?void 0:e.match(/(\.\*|\[[^\]]*\])$/))===null||t===void 0?void 0:t[0]};function K(e){return e.replace(/(\.?\[[^\]\[]*\]|\.\*)$/g,"")}function he(e){return K(e)+".*"}function bt(e,t){return e==null?void 0:e.replace(/(.|^)(\d+)/g,(r,n,i)=>n+(n==":"?i:String(parseInt(i)+t)))}function At(e,t=2){var r=K(e).split(/]\.|\.\*\./g).pop().split(/\./g).slice(-3);return r=r.filter(n=>isNaN(parseInt(n))),r.map(n=>n.charAt(0).toUpperCase()+n.slice(1)).slice(-t).join(" ")}function wt(e){return K(e).split(".").pop()}var St=["January","February","March","April","May","June","July","August","September","October","November","December"],Te=e=>{if(!e||typeof e.getDay!="function")return;let t=e.getFullYear(),r=St[e.getMonth()],n=e.getDate();return`${r} ${n}, ${t}`},$e=function(e){return String(new Date(e))!=="Invalid Date"&&!isNaN(Number(new Date(e)))};function Me(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 xt(e,t,r){let n=e.getAttribute("data-path-scope");if(n==null)return;var i=Me(e);if(i!=0)return;let o=e.parentNode;if(o!=null){t==0?e.setAttribute("hidden","hidden"):e.getAttribute("hidden")!=null&&e.removeAttribute("hidden");for(var a=i+1,s=e,l=e;l=l.nextElementSibling;)l.getAttribute("data-path-scope")==n&&(a++,s=l);for(var u=a;u<t;u++)o.insertBefore(s.cloneNode(!0),s.nextElementSibling);for(var u=Math.max(1,t);u<a;u++)s=s.previousElementSibling,o.removeChild(s.nextElementSibling)}}function O(e,t,r,n,i=!0){var o,a,s;if(!e)return;var l=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 u=t.replace("data-path-","");if(t=="data-path-src"||t=="data-path-alt"){let b=Array.from(e.children).find(D=>D.localName=="picture")||e;l=e.localName=="img"?e:b.querySelector("img, video")}else if(t=="data-path-href")l=e.querySelector("a")||e.closest("a");else if(t=="data-path-hidden")console.log("hidden init value",r),r=r?null:!0,console.log("~~~ after:",r);else if(t=="data-path"||t=="data-embed-html"||t=="html")u="innerHTML";else if(t=="data-embed-src"&&i)G(e,r);else if(t=="data-path-attributes"){if(!Array.isArray(r)){let b=((o=e.getAttribute("data-attributes-keys"))===null||o===void 0?void 0:o.split(",").filter(Boolean))||[];if(!Array.isArray(r))for(var c in r){var d=r[c];O(e,c,typeof d=="object"&&d?JSON.stringify(d):d,n,i)}for(var h=0;h<b.length;h++)(r==null||!(b[h]in r))&&O(e,b[h],null,n,i);O(e,"data-attributes-keys",Object.keys(r||{}).join(","),{},i)}if(e.tagName=="FEAAS-EXTERNAL"){let b=String(e.getAttribute("data-path-attributes")||"").slice(0,-1).split(".")[0]||"_";O(e,"datasources",JSON.stringify({[b]:r}),{},i)}return}if(typeof r=="boolean"&&(r=r?"":null,console.log("turns it to empty?",r)),!l)return;let f=u=="innerHTML"||u=="src";if(console.log("debug set dom",t,u,r,f),f&&(r==null||r==="")){var m=String((s=(a=e.getAttribute("data-path-placeholder")||l[u])!==null&&a!==void 0?a:l.getAttribute(u))!==null&&s!==void 0?s:"");u=="innerHTML"?l.innerHTML=m:m?(console.log("set with empty value placeholder",t,u,m),l.setAttribute(u,m)):l.removeAttribute(u)}else if(r!=null)if(u=="innerHTML"){for(var y=String(r),v=l;v.parentElement&&v.localName.match(/^(a|var|strong|em|i|b)$/);)v=v.parentElement;v.localName.match(/p|h\d|button|time|li/)&&(y=y.replace(/<(p|h\d|li|ul)[^>]*?>|<\/(p|h\d|li|ul)[^>]*?>/g," ").trim().replace(/\s+/g," ")),String(v.getAttribute("class")).includes("-inline--time")&&$e(y)&&(y=Te(new Date(y))),l.innerHTML!=y&&(l.innerHTML=y)}else l.getAttribute(u)!=r&&(console.log("set with value",t,u,r),l.setAttribute(u,r));else l.removeAttribute(u)}var Pe=["data-attributes-keys","data-path-attributes","data-path-scope"];function S(e,t,r,n,i=!0){var o,a,s;let l=e;if(n||(t=((o=r==null?void 0:r.processData)===null||o===void 0?void 0:o.call(r,l,t))||t),l.nodeType==1){let d=l.getAttribute("data-path-scope");if(d){let f=Me(l),m=W(t,d,!1);f==0&&xt(l,((a=r==null?void 0:r.shouldRepeat)===null||a===void 0?void 0:a.call(r,l,m))===!1?1:m.length,r),t={...t,[he(d)]:m[f]}}let h=Array.prototype.slice.call(l.attributes).sort((f,m)=>Pe.indexOf(f.name)-Pe.indexOf(m.name));for(var u=0;u<h.length;u++){let{name:f,value:m}=h[u];f.startsWith("data-path")&&f!="data-path-scope"&&(console.log("debug entry",f,t,m,W(t,m,!0,void 0,l.tagName!="FEAAS-EXTERNAL")),O(l,f,W(t,m,!0,void 0,l.tagName!="FEAAS-EXTERNAL"),r,i)),f=="data-embed-src"&&O(l,f,l.getAttribute(f),r,i)}}for(var u=0,c;c=l.childNodes[u++];)ke(c)&&S(c,t,r,!0,i);return n||(s=r==null?void 0:r.onRender)===null||s===void 0||s.call(r,l,t),l}function ke(e){return e.nodeType==1}function P(e,t,r,n,i=!0){var o;let a=((o=n==null?void 0:n.processTemplate)===null||o===void 0?void 0:o.call(n,e,t,r))||t;if(e.innerHTML=a,e.classList.add("-feaas"),(e.closest(".component.feaas")||e).className.includes("-theme--"))for(var l=0,u;u=e.childNodes[l++];)ke(u)&&(u.className=u.className.replace(/(\s|^)-theme--[^\s]+\s*/g,"$1"));return S(e,r,n,null,i)}function Et(e,t,r,n=!1,i=!0){var o;let a=((o=r==null?void 0:r.processTemplate)===null||o===void 0?void 0:o.call(r,null,e,t))||e;if(typeof document=="undefined"||n){let s=de(a);return S(s[0],t,r,null,i).outerHTML}else{let s=document.createElement("div");return s.innerHTML=a,S(s,t,r,null,i),s.innerHTML}}var Le=["initial","check","updated"],X={};function or(){X={}}async function Y(e,t,r,n,i=X){return M({url:e,options:t,validator:r,callback:n,cache:i}).then(Q).then(o=>o.response)}async function M({url:e,options:t,validator:r,callback:n,cache:i},o="initial"){let a=new Date;if(i!=null){var s=Ct(e);if(Le.indexOf(s.phase)>=Le.indexOf(o))var l=s[o];else s.phase=o}let u=await(l||fetch(e,t));if(!l&&s&&(u.ok?s[o].resolve(u):s[o].reject(new Error("Fetch failed"))),!u.ok)throw new Error("Fetch failed");let c=new Date(u.headers.get("date"))<a||l&&o=="initial"&&(s.phase=="updated"||s.phase=="check");if((r==null?void 0:r(u,c))===!1)throw new me("Response is not valid");return await(n==null?void 0:n(u,o,c)),{url:e,options:t,isCached:c,response:u,validator:r,callback:n,cache:i}}function Ct(e,t=!1){let r=String(e).replace("?head","");var n=X[r];return!n&&!t&&(n=X[r]={phase:null,initial:x(),check:x(),updated:x(),final:x()}),n}var me=class extends Error{};async function Q(e){let{url:t,isCached:r,options:n,validator:i,response:o,cache:a}=e;if(r){let{response:s}=await M({url:t+(t.toString().includes("?")?"&":"?")+"head",options:{...n,method:"HEAD",cache:"no-cache"},validator:i,cache:a},"check");if(s.headers.get("last-modified")!=o.headers.get("last-modified"))return ye(e)}return e}async function ye(e){return M({...e,options:{...e.options,cache:"reload"}},"updated")}var _="https://feaas.blob.core.windows.net";function Z(e){let t=e==null?void 0:e.match(/^(?:(.*?)\/components)?\/?([^\/]+)\/([^\/]+)(?:\/([^\/]+)(?:\/(published|staged|saved|\d+)(?:\.html?)?)?)?$/);if(t){var[,r,n,i,o,a]=t;return{cdn:r,library:n,component:i,version:o,revision:a}}}function lr(e){if(!e||!e.library||!e.component)throw new Error("Component requires `library` and `component` properties");return`${e.cdn&&e.cdn!=_?`${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 ur(e){return`${e.cdn&&e.cdn!=_?`${e.cdn}/styles/`:""}${e.library}/${!e.revision||e.revision=="published"?"":e.revision}`.replace(/\/$|\/\/(?!.+\/styles\/)/g,"")}function H(e){let t=e==null?void 0:e.match(/^(?:(.*?)\/styles\/)?([^\/]+)(?:\/(published|staged|saved|\d+)(?:.css)?)?$/);if(t){var[,r,n,i]=t;return{cdn:r,library:n,revision:i}}else{let o=Z(e);if(o){var{cdn:r,library:n,revision:i}=o;return i!=null&&i.match(/\d/)&&(i=void 0),{cdn:r,library:n,revision:i}}}}function je(e){return typeof e=="string"&&(e={src:e}),"src"in e&&e.src?e={...Z(e.src)}:e={...e},`${e.cdn||e.hostname||_}/components/${e.library}/${e.component}/${e.version||"responsive"}/${e.revision||"published"}.html`}function ee(e){if(typeof e=="string"&&(e={src:e}),"src"in e){if(String(e.src).includes("v1/files/components/styles"))return e.src;e={...H(e.src)}}else e={...e};return`${e.cdn||e.hostname||_}/styles/${e.library}/${e.revision=="staged"?"staged":e.revision=="saved"?"saved":"published"}.css`}async function J(e,t,r=!1){let n=s=>s.headers.get("x-ms-meta-versionDeletedAt")==null,i=s=>s.clone().text().then(t),o=await Promise.all([e.instance&&M({options:{headers:{Accept:"text/html"},credentials:"omit"},url:je({...e,version:e.instance}),validator:n}).catch(s=>s),M({url:je(e),validator:n}).catch(s=>s)]),a=o.find(s=>s&&"isCached"in s&&s);if(!a||a instanceof Error)throw o.find(l=>l&&l instanceof Error)||new Error("Can not fetch component");return o[0]==a&&console.log("Using fork!",o),await i(a.response),r?a:Q({...a,callback:i}).catch(s=>{if(o[0]==a&&(ye({...a,callback:null,validator:null}),console.log("Fork was deleted"),!(o[1]instanceof Error)))return i(o[1].response),Q({...o[1],callback:i});throw s})}async function cr(e){typeof e=="string"&&(e={src:e});var t;let{response:r}=await J(e,n=>{t=n},!0);return{...e,template:t,lastModified:r.headers.get("last-modified")}}async function ve(e,t){return Y(ee(e),{headers:{Accept:"text/css"},credentials:"omit"},r=>r.headers.get("x-ms-meta-deletedAt")==null,(r,n)=>r.clone().text().then(i=>t(i,n)))}function fr(e,t){return _t(e,t||(t=document.createElement("style"))),t}function _t(e,t){return t||(t=document.createElement("style")),ve(e,(r,n)=>{t.textContent=r}).then(()=>t)}var Dt=new WeakSet;function ge(e,t){var r,n=Ft(e);if(n){if(Dt.has(n))return Promise.resolve(n);e=n.getAttribute("data-href")||n.getAttribute("href")}return ve(e,(i,o)=>{o=="initial"&&n||(r||(r=!n||n.tagName=="LINK"?Rt(e):n),r.textContent=i),t==null||t(i,o)}).then(()=>r||n)}function Ie(e){return new Promise((t,r)=>{ge(e,t).catch(r)})}function Ft(e){let t=ee(e),{library:r}=H(t),n=`/files/components/styles/${r}.css`;return document.querySelector(`style[data-href="${t}"],
4
+ `).trim();if(typeof e=="string")return e;if(e==null)return"";switch(e.type){case"heading":let{level:r,...n}=e.attrs;return le(e.content,n,"h"+r);case"text":return(e.marks||[]).reduce((i,o)=>le(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 le(e.content||e.text,e.attrs,{bulletList:"ul",orderedList:"ol",listItem:"li",horizontalRule:"hr",paragraph:"p",codeBlock:"code",blockquote:"blockquote"}[e.type])}}var F=class{constructor(t,r=1,n){this.ownerDocument={createElement(i){return new F(i)},createDocumentFragment(){return new F(null,11)}},this.nodeName=t,this.nodeType=r,this.textContent=n,this.attributes=[],this.childNodes=[]}setAttribute(t,r){let n=this.attributes.find(i=>i.name===t);n?n.value=r:this.attributes.push({name:t,value:r})}getAttribute(t){let r=this.attributes.find(n=>n.name===t);return r?r.value:void 0}insertBefore(t,r){if(t.parentNode=this,r===null)this.childNodes.push(t);else{let n=this.childNodes.indexOf(r);n!==-1&&this.childNodes.splice(n,0,t)}}removeAttribute(t){let r=this.attributes.findIndex(n=>n.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 ce(this.childNodes)}set innerHTML(t){this.childNodes=de(String(t!=null?t:""))}get outerHTML(){return ce([this])}get children(){return this.childNodes.filter(t=>t.nodeType==1)}closest(t){let r=this;for(;r;){if(Oe(t,r))return r;r=r.parentNode}return null}querySelectorAll(t){let r=t.split(/\s*,\s*/),n=[],i=o=>{for(let a of r)if(Oe(a,o)){n.push(o);break}for(let a of o.childNodes)i(a)};for(let o of this.childNodes)i(o);return n}querySelector(t){return this.querySelectorAll(t)[0]}findSibling(t,r){if(!this.parentNode)return null;let n=this.parentNode.childNodes,i=n.indexOf(this);if(i===-1)return null;for(let o=i+t;o>=0&&o<n.length;o+=t){let a=n[o];if(!r||a.nodeType===1)return a}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 F(this.nodeName,this.nodeType);if(r.attributes=JSON.parse(JSON.stringify(this.attributes)),this.textContent&&(r.textContent=this.textContent),t)for(let n of this.childNodes){let i=n.cloneNode(!0);r.appendChild(i)}return r}get parentElement(){var t;return((t=this.parentNode)===null||t===void 0?void 0:t.nodeType)==1?this.parentNode:null}};function Oe(e,t){let r=e.match(/([.#]?[\w-]+|\[([\w-]+)(="([^"]*)")?\])/g);if(!r)return!1;for(let n of r)if(n.startsWith("#")){if(t.getAttribute("id")!==n.slice(1))return!1}else if(n.startsWith(".")){if(!(t.getAttribute("class")||"").split(" ").includes(n.slice(1)))return!1}else if(n.startsWith("[")){let i=n.match(/^\[([\w-]+)(="([^"]*)")?\]$/);if(i){let o=i[1],a=i[3],s=t.getAttribute(o);if(typeof a=="undefined"){if(s===void 0)return!1}else if(s!==a)return!1}else return!1}else if(t.nodeName!==n)return!1;return!0}function de(e){var t;let r=[],n=[];for(;e;){let i=e.match(/^<([\w-]+)(\s[^>]*)?>/),o=e.match(/^<\/([\w-]+)>/);if(i){let a=i[1].toLowerCase(),l=((t=(i[2]||"").match(/([\w-]+)(="([^"]*)")?/g))===null||t===void 0?void 0:t.map(c=>{let[d,h,,f]=c.match(/([\w-]+)(="([^"]*)")?/);return{name:h,value:ft(f||"")}}))||[],u=new F(a,1);if(u.attributes=l,n.length>0){let c=n[n.length-1];c.childNodes.push(u),u.parentNode=c}else r.push(u);["img","input","br"].includes(a)||n.push(u),e=e.slice(i[0].length)}else if(o)n.pop(),e=e.slice(o[0].length);else{let a=e.indexOf("<"),s=e.slice(0,a!==-1?a:void 0),l=new F("#text",3);if(l.textContent=s,n.length>0){let u=n[n.length-1];u.childNodes.push(l),l.parentNode=u}else r.push(l);e=e.slice(s.length)}}return r}function ht(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function ft(e){return e.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#x27;/g,"'")}function ce(e){return e.map(t=>{if(t.nodeType===3)return t.textContent||"";let{nodeName:r,attributes:n}=t,i=n.map(({name:a,value:s})=>` ${a}="${ht(String(s))}"`).join(""),o=ce(t.childNodes);return["img","input","br"].includes(r)?`<${r}${i} />`:`<${r}${i}>${o}</${r}>`}).join("")}function pt(e){let t=new e.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(n=>{let i=n.target,o=i.getAttribute("data-embed-src");o&&G(i,o),n.addedNodes&&n.addedNodes.forEach(a=>{a.nodeType==1&&mt(a,!1)})})});return t.observe(e,{attributes:!0,subtree:!0,childList:!0}),t}function mt(e,t=!0){let r=e.querySelectorAll("[data-embed-src]");for(var n=0;n<r.length;n++){let i=r[n];G(i,i.getAttribute("data-embed-src"))}if(t)return pt(e)}function G(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.setAttribute("type","module"),o.setAttribute("src",t),r.appendChild(o);break}}var fe={};q(fe,{adjustNumbers:()=>bt,cleanCollectionBit:()=>K,getHumanizedLabel:()=>At,getLastPathBit:()=>wt,getQualifier:()=>gt,normalizeCollectionScope:()=>he,parseLimit:()=>yt,parseRange:()=>vt});var yt=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},vt=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(n=>{if(n.match(/^-?\d+$/))return n;let i=n.match(/^(\d+):(\d+)$/);return i&&parseInt(i[1],10)<parseInt(i[2],10)?i[1]+"-"+i[2]:null});return r!=null&&r.every(Boolean)?r.join(","):null},gt=e=>{var t;return(t=e==null?void 0:e.match(/(\.\*|\[[^\]]*\])$/))===null||t===void 0?void 0:t[0]};function K(e){return e.replace(/(\.?\[[^\]\[]*\]|\.\*)$/g,"")}function he(e){return K(e)+".*"}function bt(e,t){return e==null?void 0:e.replace(/(.|^)(\d+)/g,(r,n,i)=>n+(n==":"?i:String(parseInt(i)+t)))}function At(e,t=2){var r=K(e).split(/]\.|\.\*\./g).pop().split(/\./g).slice(-3);return r=r.filter(n=>isNaN(parseInt(n))),r.map(n=>n.charAt(0).toUpperCase()+n.slice(1)).slice(-t).join(" ")}function wt(e){return K(e).split(".").pop()}var St=["January","February","March","April","May","June","July","August","September","October","November","December"],Te=e=>{if(!e||typeof e.getDay!="function")return;let t=e.getFullYear(),r=St[e.getMonth()],n=e.getDate();return`${r} ${n}, ${t}`},$e=function(e){return String(new Date(e))!=="Invalid Date"&&!isNaN(Number(new Date(e)))};function Me(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 xt(e,t,r){let n=e.getAttribute("data-path-scope");if(n==null)return;var i=Me(e);if(i!=0)return;let o=e.parentNode;if(o!=null){t==0?e.setAttribute("hidden","hidden"):e.getAttribute("hidden")!=null&&e.removeAttribute("hidden");for(var a=i+1,s=e,l=e;l=l.nextElementSibling;)l.getAttribute("data-path-scope")==n&&(a++,s=l);for(var u=a;u<t;u++)o.insertBefore(s.cloneNode(!0),s.nextElementSibling);for(var u=Math.max(1,t);u<a;u++)s=s.previousElementSibling,o.removeChild(s.nextElementSibling)}}function O(e,t,r,n,i=!0){var o,a,s;if(!e)return;var l=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 u=t.replace("data-path-","");if(t=="data-path-src"||t=="data-path-alt"){let b=Array.from(e.children).find(D=>D.localName=="picture")||e;l=e.localName=="img"?e:b.querySelector("img, video")}else if(t=="data-path-href")l=e.querySelector("a")||e.closest("a");else if(t=="data-path-hidden")console.log("hidden init value",r),r=r?null:!0,console.log("~~~ after:",r);else if(t=="data-path"||t=="data-embed-html"||t=="html")u="innerHTML";else if(t=="data-embed-src"&&i)G(e,r);else if(t=="data-path-attributes"){if(!Array.isArray(r)){let b=((o=e.getAttribute("data-attributes-keys"))===null||o===void 0?void 0:o.split(",").filter(Boolean))||[];if(!Array.isArray(r))for(var c in r){var d=r[c];O(e,c,typeof d=="object"&&d?JSON.stringify(d):d,n,i)}for(var h=0;h<b.length;h++)(r==null||!(b[h]in r))&&O(e,b[h],null,n,i);O(e,"data-attributes-keys",Object.keys(r||{}).join(","),{},i)}if(e.tagName=="FEAAS-EXTERNAL"){let b=String(e.getAttribute("data-path-attributes")||"").slice(0,-1).split(".")[0]||"_";O(e,"datasources",JSON.stringify({[b]:r}),{},i)}return}if(typeof r=="boolean"&&(r=r?"":null,console.log("turns it to empty?",r)),!l)return;let f=u=="innerHTML"||u=="src";if(console.log("debug set dom",t,u,r,f),f&&(r==null||r==="")){var m=String((s=(a=e.getAttribute("data-path-placeholder")||l[u])!==null&&a!==void 0?a:l.getAttribute(u))!==null&&s!==void 0?s:"");u=="innerHTML"?l.innerHTML=m:m?(console.log("set with empty value placeholder",t,u,m),l.setAttribute(u,m)):l.removeAttribute(u)}else if(r!=null)if(u=="innerHTML"){for(var y=String(r),v=l;v.parentElement&&v.localName.match(/^(a|var|strong|em|i|b)$/);)v=v.parentElement;v.localName.match(/p|h\d|button|time|li/)&&(y=y.replace(/<(p|h\d|li|ul)[^>]*?>|<\/(p|h\d|li|ul)[^>]*?>/g," ").trim().replace(/\s+/g," ")),String(v.getAttribute("class")).includes("-inline--time")&&$e(y)&&(y=Te(new Date(y))),l.innerHTML!=y&&(l.innerHTML=y)}else l.getAttribute(u)!=r&&(console.log("set with value",t,u,r),u==="hidden"?(console.log("in here?..."),l[u]=!0):l.setAttribute(u,r));else l.removeAttribute(u);console.log(l)}var Pe=["data-attributes-keys","data-path-attributes","data-path-scope"];function S(e,t,r,n,i=!0){var o,a,s;let l=e;if(n||(t=((o=r==null?void 0:r.processData)===null||o===void 0?void 0:o.call(r,l,t))||t),l.nodeType==1){let d=l.getAttribute("data-path-scope");if(d){let f=Me(l),m=W(t,d,!1);f==0&&xt(l,((a=r==null?void 0:r.shouldRepeat)===null||a===void 0?void 0:a.call(r,l,m))===!1?1:m.length,r),t={...t,[he(d)]:m[f]}}let h=Array.prototype.slice.call(l.attributes).sort((f,m)=>Pe.indexOf(f.name)-Pe.indexOf(m.name));for(var u=0;u<h.length;u++){let{name:f,value:m}=h[u];f.startsWith("data-path")&&f!="data-path-scope"&&(console.log("debug entry",f,t,m,W(t,m,!0,void 0,l.tagName!="FEAAS-EXTERNAL")),O(l,f,W(t,m,!0,void 0,l.tagName!="FEAAS-EXTERNAL"),r,i)),f=="data-embed-src"&&O(l,f,l.getAttribute(f),r,i)}}for(var u=0,c;c=l.childNodes[u++];)ke(c)&&S(c,t,r,!0,i);return n||(s=r==null?void 0:r.onRender)===null||s===void 0||s.call(r,l,t),l}function ke(e){return e.nodeType==1}function P(e,t,r,n,i=!0){var o;let a=((o=n==null?void 0:n.processTemplate)===null||o===void 0?void 0:o.call(n,e,t,r))||t;if(e.innerHTML=a,e.classList.add("-feaas"),(e.closest(".component.feaas")||e).className.includes("-theme--"))for(var l=0,u;u=e.childNodes[l++];)ke(u)&&(u.className=u.className.replace(/(\s|^)-theme--[^\s]+\s*/g,"$1"));return S(e,r,n,null,i)}function Et(e,t,r,n=!1,i=!0){var o;let a=((o=r==null?void 0:r.processTemplate)===null||o===void 0?void 0:o.call(r,null,e,t))||e;if(typeof document=="undefined"||n){let s=de(a);return S(s[0],t,r,null,i).outerHTML}else{let s=document.createElement("div");return s.innerHTML=a,S(s,t,r,null,i),s.innerHTML}}var Le=["initial","check","updated"],X={};function or(){X={}}async function Y(e,t,r,n,i=X){return M({url:e,options:t,validator:r,callback:n,cache:i}).then(Q).then(o=>o.response)}async function M({url:e,options:t,validator:r,callback:n,cache:i},o="initial"){let a=new Date;if(i!=null){var s=Ct(e);if(Le.indexOf(s.phase)>=Le.indexOf(o))var l=s[o];else s.phase=o}let u=await(l||fetch(e,t));if(!l&&s&&(u.ok?s[o].resolve(u):s[o].reject(new Error("Fetch failed"))),!u.ok)throw new Error("Fetch failed");let c=new Date(u.headers.get("date"))<a||l&&o=="initial"&&(s.phase=="updated"||s.phase=="check");if((r==null?void 0:r(u,c))===!1)throw new me("Response is not valid");return await(n==null?void 0:n(u,o,c)),{url:e,options:t,isCached:c,response:u,validator:r,callback:n,cache:i}}function Ct(e,t=!1){let r=String(e).replace("?head","");var n=X[r];return!n&&!t&&(n=X[r]={phase:null,initial:x(),check:x(),updated:x(),final:x()}),n}var me=class extends Error{};async function Q(e){let{url:t,isCached:r,options:n,validator:i,response:o,cache:a}=e;if(r){let{response:s}=await M({url:t+(t.toString().includes("?")?"&":"?")+"head",options:{...n,method:"HEAD",cache:"no-cache"},validator:i,cache:a},"check");if(s.headers.get("last-modified")!=o.headers.get("last-modified"))return ye(e)}return e}async function ye(e){return M({...e,options:{...e.options,cache:"reload"}},"updated")}var _="https://feaas.blob.core.windows.net";function Z(e){let t=e==null?void 0:e.match(/^(?:(.*?)\/components)?\/?([^\/]+)\/([^\/]+)(?:\/([^\/]+)(?:\/(published|staged|saved|\d+)(?:\.html?)?)?)?$/);if(t){var[,r,n,i,o,a]=t;return{cdn:r,library:n,component:i,version:o,revision:a}}}function lr(e){if(!e||!e.library||!e.component)throw new Error("Component requires `library` and `component` properties");return`${e.cdn&&e.cdn!=_?`${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 ur(e){return`${e.cdn&&e.cdn!=_?`${e.cdn}/styles/`:""}${e.library}/${!e.revision||e.revision=="published"?"":e.revision}`.replace(/\/$|\/\/(?!.+\/styles\/)/g,"")}function H(e){let t=e==null?void 0:e.match(/^(?:(.*?)\/styles\/)?([^\/]+)(?:\/(published|staged|saved|\d+)(?:.css)?)?$/);if(t){var[,r,n,i]=t;return{cdn:r,library:n,revision:i}}else{let o=Z(e);if(o){var{cdn:r,library:n,revision:i}=o;return i!=null&&i.match(/\d/)&&(i=void 0),{cdn:r,library:n,revision:i}}}}function je(e){return typeof e=="string"&&(e={src:e}),"src"in e&&e.src?e={...Z(e.src)}:e={...e},`${e.cdn||e.hostname||_}/components/${e.library}/${e.component}/${e.version||"responsive"}/${e.revision||"published"}.html`}function ee(e){if(typeof e=="string"&&(e={src:e}),"src"in e){if(String(e.src).includes("v1/files/components/styles"))return e.src;e={...H(e.src)}}else e={...e};return`${e.cdn||e.hostname||_}/styles/${e.library}/${e.revision=="staged"?"staged":e.revision=="saved"?"saved":"published"}.css`}async function J(e,t,r=!1){let n=s=>s.headers.get("x-ms-meta-versionDeletedAt")==null,i=s=>s.clone().text().then(t),o=await Promise.all([e.instance&&M({options:{headers:{Accept:"text/html"},credentials:"omit"},url:je({...e,version:e.instance}),validator:n}).catch(s=>s),M({url:je(e),validator:n}).catch(s=>s)]),a=o.find(s=>s&&"isCached"in s&&s);if(!a||a instanceof Error)throw o.find(l=>l&&l instanceof Error)||new Error("Can not fetch component");return o[0]==a&&console.log("Using fork!",o),await i(a.response),r?a:Q({...a,callback:i}).catch(s=>{if(o[0]==a&&(ye({...a,callback:null,validator:null}),console.log("Fork was deleted"),!(o[1]instanceof Error)))return i(o[1].response),Q({...o[1],callback:i});throw s})}async function cr(e){typeof e=="string"&&(e={src:e});var t;let{response:r}=await J(e,n=>{t=n},!0);return{...e,template:t,lastModified:r.headers.get("last-modified")}}async function ve(e,t){return Y(ee(e),{headers:{Accept:"text/css"},credentials:"omit"},r=>r.headers.get("x-ms-meta-deletedAt")==null,(r,n)=>r.clone().text().then(i=>t(i,n)))}function fr(e,t){return _t(e,t||(t=document.createElement("style"))),t}function _t(e,t){return t||(t=document.createElement("style")),ve(e,(r,n)=>{t.textContent=r}).then(()=>t)}var Dt=new WeakSet;function ge(e,t){var r,n=Ft(e);if(n){if(Dt.has(n))return Promise.resolve(n);e=n.getAttribute("data-href")||n.getAttribute("href")}return ve(e,(i,o)=>{o=="initial"&&n||(r||(r=!n||n.tagName=="LINK"?Rt(e):n),r.textContent=i),t==null||t(i,o)}).then(()=>r||n)}function Ie(e){return new Promise((t,r)=>{ge(e,t).catch(r)})}function Ft(e){let t=ee(e),{library:r}=H(t),n=`/files/components/styles/${r}.css`;return document.querySelector(`style[data-href="${t}"],
5
5
  link[rel="stylesheet"][href="${t}"],
6
6
  style[data-href*="${n}"],
7
7
  link[rel="stylesheet"][href*="${n}"]`)}function Rt(e){let t=ee(e),r=document.createElement("style");return r.setAttribute("data-href",t),document.head.appendChild(r),r}function vr(e,t){let r=document.createElement("div");r.innerHTML=e;let n=document.createDocumentFragment();for(;r.firstChild;)n.appendChild(r.firstChild);return console.log("=== renderComponentElement",n,t),S(n,t),r}function Ue(e,t,r=!0){return Nt(e,t||(t=document.createElement("div")),r),t}async function Nt(e,t,r=!0){return t||(t=document.createElement("div")),t.childNodes.length?(console.log("=== renderComponentPromise",t,e.data),S(t,e.data,e,null,r)):"template"in e?P(t,e.template,e.data,e,r):J(e,n=>P(t,n,e.data,e,r)).then(()=>t)}import{customizeDataSettings as Ot}from"@sitecore/byoc";function Tt(e){let{params:t,method:r,headers:n,body:i,url:o}=A(e);var a={url:o},s={...n};return n["Content-Type"]==="application/json"&&delete s["Content-Type"],n.Accept==="application/json"&&delete s.Accept,Object.keys(s).length>0&&(a.headers=s),r!=="GET"&&(a.method=r),r==="GET"||r==="HEAD"||Object.keys(i).length===0||(a.body=i),Object.keys(t).length>0&&(a={...a,params:t}),a}var k=e=>{if(!e||typeof e.url!="string")return!1;for(var t in e)if(!(t=="body"||t=="params"||t=="headers"||t=="url"||t==="method"||t=="jsonpath"&&typeof e[t]=="string"))return!1;return!0};function Be(e){let{url:t,headers:r,params:n,method:i,body:o}=A(e),a,s=r["Content-Type"];i!="GET"&&i!="HEAD"&&(s==="application/json"&&(a=JSON.stringify(o)),s==="multipart/form-data"&&(a=Object.keys(o).reduce((u,c)=>(u.append(c,o[c]),u),new FormData)),s==="application/x-www-form-urlencoded"&&(a=new URLSearchParams(o)));let l=Object.keys(n).length?`?${new URLSearchParams(n)}`:"";return[`${t}${l}`,{headers:r,body:a,method:i}]}function A(e){let t={};for(let r in(e==null?void 0:e.headers)||{})if(e.headers.hasOwnProperty(r)){let n=r.replace(/^[a-z]|\-[a-z]/g,i=>i.toUpperCase());t[n]=e.headers[r]}return t.Accept||(t.Accept="application/json"),{params:(e==null?void 0:e.params)||{},headers:t,jsonpath:String((e==null?void 0:e.jsonpath)||"$"),method:((e==null?void 0:e.method)||"GET").toUpperCase(),body:(e==null?void 0:e.body)||{},url:String((e==null?void 0:e.url)||"")}}var be=async(e,t)=>{let r=Ot(t,e);if(r instanceof Promise)return r;let n=e;r&&(n=A(r));try{let[i,o]=Be(n),s=await(await A.fetchImplementation(i,{...o,method:o.method.toLowerCase()})).json();return n.jsonpath&&n.jsonpath!="$"?B(s,n.jsonpath):s}catch(i){return{}}};async function We(e){if(!e)return e;if(k(e))return be(e);let t=Object.keys(e),r=await Promise.all(t.map(n=>k(e[n])?be(e[n],n):null).filter(Boolean));return t.reduce((n,i)=>({...n,[i]:k(e[i])?r.shift():e[i]}),{})}function $t(e){return e?k(e)||Object.values(e).some(k):!1}A.clean=Tt;A.toFetchArguments=Be;A.fetchOne=be;A.fetch=We;A.isDataSettings=k;A.hasDataSettings=$t;A.fetchImplementation=(...e)=>fetch(...e);function Pt(e){var t,r,n,i,o,a,s,l;let u,c=e.getAttribute("src");if(c){let D=Z(c);if(!D)throw new Error(`Could not parse FEAAS Component source: ${c}`);var{cdn:d,library:h,component:f,version:m,revision:y}=D}let v=e.getAttribute("data");if(v!=null&&v!="")try{u=typeof v=="string"?JSON.parse(v):{}}catch(D){console.error(D)}let b=e.getAttribute("fetch");return{data:u||{},cdn:(r=(t=e.getContextAttribute("cdn"))!==null&&t!==void 0?t:d)!==null&&r!==void 0?r:_,library:(n=e.getAttribute("library"))!==null&&n!==void 0?n:h,component:(i=e.getAttribute("component"))!==null&&i!==void 0?i:f,version:(a=(o=e.getAttribute("version"))!==null&&o!==void 0?o:m)!==null&&a!==void 0?a:"responsive",revision:(l=(s=e.getAttribute("revision"))!==null&&s!==void 0?s: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"),fetch:b=="false"||b==null&&e.hasAttribute("fetch")?[]:b==null||b=="true"?["data","template","stylesheet"]:b.split(/(\s+|\-)+/g).filter(Boolean)}}var te=class extends E{setData(t){this.set({data:t})}getProps(){return Pt(this)}isJSONAttribute(t){return t=="data"}attributeChangedCallback(t,r,n){r!==n&&((t=="library"||t=="component"||t=="revision"||t=="version")&&(this.payload=void 0,this.alreadyRendered&&this.connected&&(this.needsRefresh=!0,this.needsToFetchTemplate=!0)),super.attributeChangedCallback(t,r,n),t=="data"&&(this.needsRefresh=!0,(this.props.fetch.includes("data")||this.alreadyRendered||!A.hasDataSettings(this.props.data))&&this.fetchData()))}async fetchData(){this.readyData=void 0,this.whenDataReady=this.whenDataReady.restart();let t=await A.fetch(this.props.data),r=this.alreadyRendered;await this.whenDataReady.resolve(t),r&&this.advance()}getEditor(){var t;return(t=document.querySelector("feaas-context"))===null||t===void 0?void 0:t.refs.editor}constructor(){super(),this.readyData={},this.whenDataReady=x(r=>this.readyData=r,r=>this.onError(r)),this.defaultProps={cdn:_,revision:"published",version:"responsive",editable:!1,suspended:!1,data:{}},this.onLoad=r=>{this.payload=r,this.advance()};let t=this.getAttribute("data");this.getAttribute("data")||this.whenDataReady.resolve({}),this.addEventListener("click",()=>{this.props.editable&&this.edit()})}edit(){let t=this.getEditor();if(t!=null&&t.setTarget(this))return t.open(),!0}getOriginal(){let t=this.getAttribute("data-path-scope");if(t){for(var r=this;(r=r.previousElementSibling)&&r.getAttribute("data-path-scope")==t;)var n=r;return n}}isReadyToLoad(){return super.isReadyToLoad()&&this.props.library!=null&&this.props.component!=null&&this.props.version!=null}async load(){var t;if(this.getOriginal())return;let r=()=>{this.payload!=null&&(n||this.readyData&&this.onLoad(this.payload))};if(this.props.fetch.includes("stylesheet"))var n=Ie({...this.props}).then(()=>{n=null,r()});if(this.props.fetch.includes("template")||this.needsToFetchTemplate){this.needsToFetchTemplate=!1;var i=J(this.props,o=>{this.payload=o,this.needsRefresh=!0,r()})}else this.payload=(t=this.props.template)!==null&&t!==void 0?t:this.innerHTML;return Promise.all([n,this.whenDataReady.then(()=>r()),i]).then(()=>this.payload)}flush(){this.readyData&&super.flush()}update(){if(this.alreadyRendered=!0,console.log("=== feaascomponent update",this.alreadyRendered),!(!this.props.fetch.includes("data")&&!this.props.fetch.includes("template")&&this.firstElementChild&&!this.needsRefresh))if(Array.from(this.children).filter(t=>t.tagName!="BR").length>0&&!this.needsRefresh)console.log("=== feaas component render dom",this.readyData),S(this,this.readyData);else{if(this.needsRefresh=!1,this.getOriginal())return;P(this,this.payload,this.readyData)}}};te.observedAttributes=["library","component","version","revision","hostname","cdn","template","data","instance","editable","with-stylesheet","fetch"];te.register("feaas-component");function Mt(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 re=class extends E{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return Mt(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=`